From 4215360ed77f6e3f592a119e0ae1bfe7fa17f171 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 4 Jul 2018 12:26:36 +0200 Subject: [PATCH] Fix comments in @code blocks in distributed headers --- include/deal.II/distributed/shared_tria.h | 71 +++++++++--------- .../deal.II/distributed/solution_transfer.h | 40 +++++----- include/deal.II/distributed/tria.h | 75 +++++++++---------- 3 files changed, 91 insertions(+), 95 deletions(-) diff --git a/include/deal.II/distributed/shared_tria.h b/include/deal.II/distributed/shared_tria.h index 88e99b4432..66af85cf51 100644 --- a/include/deal.II/distributed/shared_tria.h +++ b/include/deal.II/distributed/shared_tria.h @@ -168,47 +168,44 @@ namespace parallel * triangulation whenever it is first created and passing the user * defined function through the signal using std::bind. * Here is an example: - * @code - * template - * void mypartition(parallel::shared::Triangulation &tria) - * { - * // user defined partitioning scheme: assign subdomain_ids - * // round-robin in a mostly random way: - * std::vector assignment = - * {0,0,1,2,0,0,2,1,0,2,2,1,2,2,0,0}; typename - * Triangulation::active_cell_iterator cell = tria.begin_active(), - * endc = tria.end(); - * unsigned int index = 0; - * for (; cell != endc; ++cell, ++index) - * cell->set_subdomain_id(assignment[index%16]); - * } + * @code + * template + * void mypartition(parallel::shared::Triangulation &tria) + * { + * // user defined partitioning scheme: assign subdomain_ids + * // round-robin in a mostly random way: + * std::vector assignment = + * {0,0,1,2,0,0,2,1,0,2,2,1,2,2,0,0}; + * unsigned int index = 0; + * for (const auto &cell : tria.active_cell_iterators()) + * cell->set_subdomain_id(assignment[(index++)%16]); + * } * - * int main () - * { - * parallel::shared::Triangulation tria(..., - * parallel::shared::Triangulation::Settings::partition_custom_signal); - * tria.signals.post_refinement.connect - * (std::bind(&mypartition, std::ref(tria))); - * } - * @endcode + * int main () + * { + * parallel::shared::Triangulation tria( + * ..., + * parallel::shared::Triangulation::partition_custom_signal); + * tria.signals.post_refinement.connect(std::bind(&mypartition, + * std::ref(tria))); + * } + * @endcode * * An equivalent code using lambda functions would look like this: - * @code - * int main () + * @code + * int main () + * { + * parallel::shared::Triangulation tria( + * ..., + * parallel::shared::Triangulation::partition_custom_signal); + * tria.signals.post_refinement.connect ( + * [&tria]() * { - * parallel::shared::Triangulation tria(..., - * parallel::shared::Triangulation::Settings::partition_custom_signal); - * tria.signals.post_refinement.connect ([&tria]() - * { - * // user defined - * partitioning scheme - * // as above - * ... - * } - * ); - * } - * @endcode - * + * // user defined partitioning scheme as above + * ... + * }); + * } + * @endcode * * @note If you plan to use a custom partition with geometric multigrid, * you must manually partition the level cells in addition to the active diff --git a/include/deal.II/distributed/solution_transfer.h b/include/deal.II/distributed/solution_transfer.h index e23d5c1413..2508af9196 100644 --- a/include/deal.II/distributed/solution_transfer.h +++ b/include/deal.II/distributed/solution_transfer.h @@ -55,25 +55,28 @@ namespace parallel * TrilinosWrappers::MPI::Vector, or corresponding blockvectors. * @code * SolutionTransfer soltrans(dof_handler); - * // flag some cells for refinement - * // and coarsening, e.g. - * GridRefinement::refine_and_coarsen_fixed_fraction( - * tria, error_indicators, 0.3, 0.05); - * // prepare the triangulation, + * // flag some cells for refinement and coarsening, e.g. + * GridRefinement::refine_and_coarsen_fixed_fraction(tria, + * error_indicators, + * 0.3, + * 0.05); + * + * // prepare the triangulation, * tria.prepare_coarsening_and_refinement(); - * // prepare the SolutionTransfer object - * // for coarsening and refinement and - * give - * // the solution vector that we intend - * to - * // interpolate later, + * + * // prepare the SolutionTransfer object for coarsening and refinement + * // and give the solution vector that we intend to interpolate later, * soltrans.prepare_for_coarsening_and_refinement(solution); - * // actually execute the refinement, + * + * // actually execute the refinement, * tria.execute_coarsening_and_refinement (); - * // redistribute dofs, + * + * // redistribute dofs, * dof_handler.distribute_dofs (fe); - * // and interpolate the solution + * + * // and interpolate the solution * VectorType interpolated_solution; + * * //create VectorType in the right size here * soltrans.interpolate(interpolated_solution); * @endcode @@ -96,10 +99,10 @@ namespace parallel * * If vector has the locally relevant DoFs, serialization works as * follows: - * *@code - * + * @code * parallel::distributed::SolutionTransfer - * sol_trans(dof_handler); sol_trans.prepare_serialization (vector); + * sol_trans(dof_handler); + * sol_trans.prepare_serialization (vector); * * triangulation.save(filename); * @endcode @@ -110,7 +113,8 @@ namespace parallel * triangulation.load(filename); * * parallel::distributed::SolutionTransfer - * sol_trans(dof_handler); sol_trans.deserialize (distributed_vector); + * sol_trans(dof_handler); + * sol_trans.deserialize (distributed_vector); * @endcode * * diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index 0c20b18eef..0bbe14037f 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -159,28 +159,25 @@ namespace parallel * information into the function. C++ provides a nice mechanism for this * that is best explained using an example: * @code - * #include + * #include * - * template - * void set_boundary_ids (parallel::distributed::Triangulation - * &triangulation) - * { - * ... set boundary indicators on the triangulation object ... - * } + * template + * void set_boundary_ids ( + * parallel::distributed::Triangulation &triangulation) + * { + * ... set boundary indicators on the triangulation object ... + * } * - * template - * void - * MyClass:: - * create_coarse_mesh (parallel::distributed::Triangulation - * &coarse_grid) const - * { - * ... create the coarse mesh ... + * template + * void + * MyClass::create_coarse_mesh ( + * parallel::distributed::Triangulation &coarse_grid) const + * { + * ... create the coarse mesh ... * - * coarse_grid.signals.post_refinement.connect - * (std::bind (&set_boundary_ids, - * std::ref(coarse_grid))); - * - * } + * coarse_grid.signals.post_refinement.connect( + * std::bind (&set_boundary_ids, std::ref(coarse_grid))); + * } * @endcode * * What the call to std::bind does is to produce an @@ -201,30 +198,28 @@ namespace parallel * static, but possibly private) member function of the * MyClass class, then the following will work: * @code - * #include + * #include * - * template - * void - * MyClass:: - * set_boundary_ids (parallel::distributed::Triangulation - * &triangulation) const - * { - * ... set boundary indicators on the triangulation object ... - * } + * template + * void + * MyClass::set_boundary_ids ( + * parallel::distributed::Triangulation &triangulation) const + * { + * ... set boundary indicators on the triangulation object ... + * } * - * template - * void - * MyClass:: - * create_coarse_mesh (parallel::distributed::Triangulation - * &coarse_grid) const - * { - * ... create the coarse mesh ... + * template + * void + * MyClass::create_coarse_mesh ( + * parallel::distributed::Triangulation &coarse_grid) const + * { + * ... create the coarse mesh ... * - * coarse_grid.signals.post_refinement.connect - * (std::bind (&MyGeometry::set_boundary_ids, - * std::cref(*this), - * std::ref(coarse_grid))); - * } + * coarse_grid.signals.post_refinement.connect( + * std::bind (&MyGeometry::set_boundary_ids, + * std::cref(*this), + * std::ref(coarse_grid))); + * } * @endcode * Here, like any other member function, set_boundary_ids * implicitly takes a pointer or reference to the object it belongs to as -- 2.39.5