On 03/07/2018 01:48 AM, 'Maxi Miller' via deal.II User Group wrote:
Usually the ConditionalOStream-variable is initialized in the constructor of
the object, as for example in
|
template<intdim>
MinimalSurfaceProblem<dim>::MinimalSurfaceProblem(constchar*file_name)
:
mpi_communicator(MPI_COMM_WORLD),
triangulation(mpi_communicator,
typenameTriangulation<dim>::MeshSmoothing(Triangulation<dim>::smoothing_on_refinement
|Triangulation<dim>::smoothing_on_coarsening)),
n_components(1),
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:
> [...]
There is no immediate function that allows you to change the stream and state
of the ConditionalOStream at a later time. But you can of course create the
output log file stream as a member variable and initialize it *before* the
pcout object, and then initialize the pcout object with it.
Alternatively, make your pcout object a *pointer to* a ConditionalOStream
object and set the pointer when you have your stream object ready.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
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
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.