[CppAD] custom output streams with PrintOp

Brad Bell bradbell at seanet.com
Fri Aug 5 11:15:29 EDT 2011


I like the option of
     f.Forward(0, x, s)
where f is an ADFun object and s is an output stream and s could be a 
std::stringstream. That way an application that uses CppAD could trap 
the output in s and decided how to present it to the applications use. 
In addition, each thread could use its own stringstream s and there 
would be no competition (and locking) for a common resource.

On 8/5/2011 7:02 AM, Iakov Nakhimovski wrote:
> Hello!
>
> I’d like to propose support for custom output streams to be used with
> PrintOp. Right now all the messages go to std::cout which is not
> convenient in the case of DLL potentially run in multithreaded
> context.
> To enable the support I’d suggest either:
> 1.      Adding ostream&  to ADFun<Base>  and player<Base>  classes
> complemented with appropriate set/get on the ADFun (default is
> cstd::cout).
> 2.      Optional ostream* parameter for “Forward” to be forwarded into
> forward_sweep/forward0sweep (instead of the bool print). The parameter
> is then propagated to PrintOp and used for printing (NULL pointer = no
> output).
>
> Thanks in advance!
>
> /Iakov
>
>
>
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cppad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/cppad/attachments/20110805/3114aa47/attachment.html 


More information about the CppAD mailing list