Usually the ConditionalOStream-variable is initialized in the constructor 
of the object, as for example in
template <int dim>
MinimalSurfaceProblem<dim>::MinimalSurfaceProblem (const char *file_name)
                    typename Triangulation<dim>::MeshSmoothing(Triangulation
<dim>::smoothing_on_refinement | Triangulation<dim>::smoothing_on_coarsening
      dof_handler (triangulation),
      fe (FE_Q<dim>(2), n_components * dim),
      pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) 
== 0)),


Now I would like to do that in a function of the class, instead of the 
constructor, so that I am able to write into a log file instead of using 
std::cout. I tried the following methods:
pcout = ConditionalOStream(std::cout, (Utilities::MPI::this_mpi_process(
mpi_communicator) == 0));
resulting in
error: use of deleted function ‘dealii::ConditionalOStream& dealii::
pcout = ConditionalOStream pcout_local(std::cout, (Utilities::MPI::
this_mpi_process(mpi_communicator) == 0));
resulting in
error: expected primary-expression before ‘pcout_local’
             pcout = ConditionalOStream pcout_local(std::cout, (Utilities::
MPI::this_mpi_process(mpi_communicator) == 0));
pcout = ConditionalOStream::ConditionalOStream(std::cout, (Utilities::MPI::
this_mpi_process(mpi_communicator) == 0));
resulting in 
error: cannot call constructor ‘dealii::ConditionalOStream::
ConditionalOStream’ directly [-fpermissive]
             pcout = ConditionalOStream::ConditionalOStream(std::cout, (
Utilities::MPI::this_mpi_process(mpi_communicator) == 0));

Is there another way I can use in order to replace std::cout with a custom 
stream (such as
std::ofstream file_out_stream;, std::ios::out | std::ios::app);
pcout = ConditionalOStream::ConditionalOStream(file_out_stream, (Utilities::
MPI::this_mpi_process(mpi_communicator) == 0));
Thank you!

The deal.II project is located at
For mailing list/forum options, see
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to