]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix comments in @code blocks in grid headers 6893/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 6 Jul 2018 10:58:16 +0000 (12:58 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 6 Jul 2018 13:41:01 +0000 (15:41 +0200)
include/deal.II/grid/filtered_iterator.h
include/deal.II/grid/grid_out.h
include/deal.II/grid/grid_tools.h
include/deal.II/grid/tria.h
include/deal.II/grid/tria_iterator.h

index 7a08dc63be2a65414a287560f6452089cc0f5278..d4f7189d1c0b2fdd0950f3f1c74584dd2443cf73 100644 (file)
@@ -398,11 +398,12 @@ namespace IteratorFilters
  * @code
  *   class Active
  *   {
- *     public:
- *       template <class Iterator>
- *       bool operator () (const Iterator &i) const {
- *         return (i->active());
- *       }
+ *   public:
+ *     template <class Iterator>
+ *     bool operator () (const Iterator &i) const
+ *     {
+ *       return (i->active());
+ *     }
  *   };
  * @endcode
  * and objects of this type can be used as predicates. Likewise, this more
@@ -410,17 +411,19 @@ namespace IteratorFilters
  * @code
  *   class SubdomainEqualTo
  *   {
- *     public:
- *       SubdomainEqualTo (const types::subdomain_id subdomain_id)
- *                   : subdomain_id (subdomain_id) {};
+ *   public:
+ *     SubdomainEqualTo (const types::subdomain_id subdomain_id)
+ *       : subdomain_id (subdomain_id)
+ *     {};
  *
- *       template <class Iterator>
- *       bool operator () (const Iterator &i) const {
- *         return (i->subdomain_id() == subdomain_id);
- *       }
+ *     template <class Iterator>
+ *     bool operator () (const Iterator &i) const
+ *     {
+ *       return (i->subdomain_id() == subdomain_id);
+ *     }
  *
- *     private:
- *       const types::subdomain_id subdomain_id;
+ *   private:
+ *     const types::subdomain_id subdomain_id;
  *   };
  * @endcode
  * Objects like <code>SubdomainEqualTo(3)</code> can then be used as
@@ -473,8 +476,8 @@ namespace IteratorFilters
  * flag:
  * @code
  *   FilteredIterator<typename Triangulation<dim>::active_cell_iterator>
- *      begin (IteratorFilters::UserFlagSet()),
- *      end (IteratorFilters::UserFlagSet());
+ *     begin (IteratorFilters::UserFlagSet()),
+ *     end (IteratorFilters::UserFlagSet());
  *   begin.set_to_next_positive(tria.begin_active());
  *   end = tria.end();
  *   n_flagged_cells = std::distance (begin, end);
@@ -546,9 +549,9 @@ public:
    * advanced until we either hit the past-the-end iterator, or the
    * predicate is satisfied. This allows, for example, to write code like
    * @code
-   *   FilteredIterator<typename Triangulation<dim>::active_cell_iterator>
-   *     cell (IteratorFilters::SubdomainEqualTo(13),
-   *           triangulation.begin_active());
+   * FilteredIterator<typename Triangulation<dim>::active_cell_iterator>
+   *   cell (IteratorFilters::SubdomainEqualTo(13),
+   *         triangulation.begin_active());
    * @endcode
    *
    * If the cell <code>triangulation.begin_active()</code> does not have a
@@ -836,7 +839,7 @@ namespace internal
  * @code
  *   DoFHandler<dim> dof_handler;
  *   ...
- *   for (auto cell : dof_handler.active_cell_iterators())
+ *   for (const auto &cell : dof_handler.active_cell_iterators())
  *     {
  *       if (cell->is_locally_owned())
  *         {
@@ -849,8 +852,10 @@ namespace internal
  * @code
  *   DoFHandler<dim> dof_handler;
  *   ...
- *   for (auto cell : filter_iterators(dof_handler.active_cell_iterators(),
- *                                    IteratorFilters::LocallyOwnedCell())
+ *   const auto filtered_iterators_range =
+ *     filter_iterators(dof_handler.active_cell_iterators(),
+ *                      IteratorFilters::LocallyOwned());
+ *   for (const auto &cell : filtered_iterators_range)
  *     {
  *       fe_values.reinit (cell);
  *       ...do the local integration on 'cell'...;
@@ -879,7 +884,7 @@ filter_iterators(IteratorRange<BaseIterator> i, const Predicate &p)
  * @code
  *   DoFHandler<dim> dof_handler;
  *   ...
- *   for (auto cell : dof_handler.active_cell_iterators())
+ *   for (const auto &cell : dof_handler.active_cell_iterators())
  *     {
  *       if (cell->is_locally_owned())
  *         {
@@ -895,9 +900,11 @@ filter_iterators(IteratorRange<BaseIterator> i, const Predicate &p)
  * @code
  *   DoFHandler<dim> dof_handler;
  *   ...
- *   for (auto cell : filter_iterators(dof_handler.active_cell_iterators(),
- *                                    IteratorFilters::LocallyOwnedCell(),
- *                                    IteratorFilters::AtBoundary())
+ *   const auto filtered_iterators_range =
+ *     filter_iterators(dof_handler.active_cell_iterators(),
+ *                      IteratorFilters::LocallyOwnedCell(),
+ *                      IteratorFilters::AtBoundary());
+ *   for (const auto &cell : filter_iterators_range)
  *     {
  *       fe_values.reinit (cell);
  *       ...do the local integration on 'cell'...;
index 9d094aa1b3bcc56222205b5ee420e3e1f67dd5ac..b221fd6a5e9501158c22deb095d63ecc76bda9bb 100644 (file)
@@ -843,10 +843,10 @@ namespace GridOutFlags
  * a runtime parameter, you can write
  * @code
  *   GridOut::OutputFormat grid_format =
- *                   GridOut::parse_output_format(get_format_name_from_somewhere());
- *   ofstream output_file("some_filename" +
- * GridOut::default_suffix(output_format)); GridOut().write (tria, output_file,
- * output_format);
+ *     GridOut::parse_output_format(get_format_name_from_somewhere());
+ *   ofstream output_file("some_filename"
+ *                        + GridOut::default_suffix(output_format));
+ *   GridOut().write (tria, output_file, output_format);
  * @endcode
  * The function <tt>get_output_format_names()</tt> provides a list of possible
  * names of output formats in a string that is understandable by the
index 546cdded4ebc53e0cb95a2b4fb52af968627c24b..b73d4de5de96d310a30cc180940c8054381467d4 100644 (file)
@@ -693,10 +693,11 @@ namespace GridTools
    * @note The actual return type of this function, i.e., the type referenced
    * above as @p return_type, is
    * @code
-   *   std::tuple<
-   *   std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator
-   * >, std::vector< std::vector< Point<dim> > >, std::vector<
-   * std::vector<unsigned int> > >
+   * std::tuple<
+   *   std::vector<
+   *     typename Triangulation<dim, spacedim>::active_cell_iterator>,
+   *   std::vector<std::vector<Point<dim>>>,
+   *   std::vector<std::vector<unsigned int>>>
    * @endcode
    * The type is abbreviated above to improve readability of this page.
    *
@@ -768,11 +769,12 @@ namespace GridTools
    * above as @p return_type, is
    * @code
    * std::tuple<
-   *   std::vector< typename Triangulation<dim, spacedim>::active_cell_iterator
-   * >, std::vector< std::vector< Point<dim> > >, std::vector< std::vector<
-   * unsigned int > >, std::vector< std::vector< Point<spacedim> > >,
-   *       std::vector< std::vector< unsigned int > >
-   *       >
+   *   std::vector<
+   *     typename Triangulation<dim, spacedim>::active_cell_iterator>,
+   *   std::vector<std::vector<Point<dim>>>,
+   *   std::vector<std::vector<unsigned int>>,
+   *   std::vector<std::vector<Point<spacedim>>>,
+   *   std::vector<std::vector<unsigned int>>>
    * @endcode
    * The type is abbreviated above to improve readability of this page.
    *
@@ -812,11 +814,11 @@ namespace GridTools
    * equality:
    *
    * @code
-   * used_vertices = extract_used_vertices(tria);
-   * all_vertices = tria.get_vertices();
+   * const auto used_vertices = extract_used_vertices(tria);
+   * auto all_vertices = tria.get_vertices();
    *
-   * for(auto &id_and_v : used_vertices)
-   *    all_vertices[id_and_v.first] == id_and_v.second; // true
+   * for(const auto &id_and_v : used_vertices)
+   *   all_vertices[id_and_v.first] == id_and_v.second; // true
    * @endcode
    *
    * Notice that the above is not satisfied for mappings that change the
@@ -1265,16 +1267,14 @@ namespace GridTools
    * IteratorFilters. For example, it is possible to extract a layer
    * of cells around all of those cells with a given material id,
    * @code
-   * GridTools::compute_active_cell_halo_layer(tria,
-   *                                           IteratorFilters::MaterialIdEqualTo(1,
-   * true));
+   * GridTools::compute_active_cell_halo_layer(
+   *   tria, IteratorFilters::MaterialIdEqualTo(1, true));
    * @endcode
    * or around all cells with one of a set of active FE indices for an
    * hp::DoFHandler
    * @code
-   * GridTools::compute_active_cell_halo_layer(hp_dof_handler,
-   *                                           IteratorFilters::ActiveFEIndexEqualTo({1,2},
-   * true));
+   * GridTools::compute_active_cell_halo_layer(
+   *   hp_dof_handler, IteratorFilters::ActiveFEIndexEqualTo({1,2}, true));
    * @endcode
    * Note that in the last two examples we ensure that the predicate returns
    * true only for locally owned cells. This means that the halo layer will
@@ -1528,9 +1528,9 @@ namespace GridTools
    * @note The actual return type of this function, i.e., the type referenced
    * above as @p return_type, is
    * @code
-   *   std::tuple< std::vector< std::vector< unsigned int > >,
-   *       std::map< unsigned int, unsigned int>,
-   *       std::map< unsigned int, std::vector< unsigned int > > >
+   * std::tuple<std::vector<std::vector<unsigned int>>,
+   *            std::map< unsigned int, unsigned int>,
+   *            std::map< unsigned int, std::vector<unsigned int>>>
    * @endcode
    * The type is abbreviated above to improve readability of this page.
    *
@@ -2588,24 +2588,23 @@ namespace GridTools
    * other processors to ensure that one can query the right value
    * also on those processors:
    * @code
-   *    auto pack
-   *    = [] (const typename
-   * dealii::hp::DoFHandler<dim,spacedim>::active_cell_iterator &cell) ->
-   * unsigned int
-   *    {
-   *      return cell->active_fe_index();
-   *    };
-   *
-   *    auto unpack
-   *      = [] (const typename
-   * dealii::hp::DoFHandler<dim,spacedim>::active_cell_iterator &cell, const
-   * unsigned int &active_fe_index) -> void
-   *    {
-   *      cell->set_active_fe_index(active_fe_index);
-   *    };
-   *
-   *   GridTools::exchange_cell_data_to_ghosts<unsigned int,
-   * dealii::hp::DoFHandler<dim,spacedim>> (dof_handler, pack, unpack);
+   * using active_cell_iterator =
+   *   typename dealii::hp::DoFHandler<dim,spacedim>::active_cell_iterator;
+   * auto pack = [] (const active_cell_iterator &cell) -> unsigned int
+   *             {
+   *               return cell->active_fe_index();
+   *             };
+   *
+   * auto unpack = [] (const active_cell_iterator &cell,
+   *                   const unsigned int &active_fe_index) -> void
+   *               {
+   *                 cell->set_active_fe_index(active_fe_index);
+   *               };
+   *
+   * GridTools::exchange_cell_data_to_ghosts<
+   *   unsigned int, dealii::hp::DoFHandler<dim,spacedim>> (dof_handler,
+   *                                                        pack,
+   *                                                        unpack);
    * @endcode
    *
    * You will notice that the @p pack lambda function returns an `unsigned int`,
index 17cdad1fed4380f782b3b3b000b119a88aff8bdc..e69f67210a2e4df2580fd25b16a690a02482557a 100644 (file)
@@ -571,13 +571,11 @@ namespace internal
  * <ul>
  * <li> <em>Counting the number of cells on a specific level</em>
  *    @code
- *     template <int dim, int spacedim>
- *     int Triangulation<dim, spacedim>::n_cells (const int level) const
- *     {
- *        cell_iterator cell = begin (level),
- *                      endc = end (level);
+ *      template <int dim, int spacedim>
+ *      int Triangulation<dim, spacedim>::n_cells (const int level) const
+ *      {
  *        int n=0;
- *        for (; cell!=endc; ++cell)
+ *        for (const auto &cell : cell_iterators_on_level(level))
  *          ++n;
  *        return n;
  *      }
@@ -602,10 +600,7 @@ namespace internal
  *      template <int dim>
  *      void Triangulation<dim>::refine_global ()
  *      {
- *        active_cell_iterator cell = begin_active(),
- *                             endc = end();
- *
- *        for (; cell != endc; ++cell)
+ *        for (const auto &cell : active_cell_iterators())
  *          cell->set_refine_flag ();
  *        execute_coarsening_and_refinement ();
  *      }
@@ -617,7 +612,7 @@ namespace internal
  *
  * Usage of a Triangulation is mainly done through the use of iterators. An
  * example probably shows best how to use it:
- *  @code
+ * @code
  * int main ()
  * {
  *   Triangulation<2> tria;
@@ -651,7 +646,7 @@ namespace internal
  *   ofstream out("grid.1");
  *   GridOut::write_gnuplot (tria, out);
  * }
- *  @endcode
+ * @endcode
  *
  *
  * <h3>Creating a triangulation</h3>
@@ -976,31 +971,33 @@ namespace internal
  * int main ()
  * {
  *   Triangulation<2> triangulation;
- *   const Point<2> vertices[8] = {Point<2>(-1,-1),
- *                                 Point<2>(+1,-1),
- *                                 Point<2>(-1,-1)*0.5,
- *                                 Point<2>(+1,-1)*0.5,
- *                                 Point<2>(-1,+1)*0.5,
- *                                 Point<2>(+1,+1)*0.5,
- *                                 Point<2>(-1,+1),
- *                                 Point<2>(+1,+1)};
- *   const int cell_vertices[5][4] = {{0, 1, 2, 3},
- *                                    {0, 2, 6, 4},
- *                                    {2, 3, 4, 5},
- *                                    {1, 7, 3, 5},
- *                                    {6, 4, 7, 5}};
- *
- *   std::vector<CellData<2>> cells(5, CellData<2>());
- *   for (unsigned int i=0; i<5; ++i)
- *     for (unsigned int j=0; j<4; ++j)
+ *   const std::vector<Point<2>> vertices = {{-1.0,-1.0},
+ *                                           {+1.0,-1.0},
+ *                                           {-0.5,-0.5},
+ *                                           {+0.5,-0.5},
+ *                                           {-0.5,+0.5},
+ *                                           {+1.0,+1.0},
+ *                                           {-1.0,+1.0},
+ *                                           {+1.0,+1.0}};
+ *   const std::vector<std::array<int,GeometryInfo<2>::vertices_per_cell>>
+ *     cell_vertices = {{0, 1, 2, 3},
+ *                      {0, 2, 6, 4},
+ *                      {2, 3, 4, 5},
+ *                      {1, 7, 3, 5},
+ *                      {6, 4, 7, 5}};
+ *
+ *   std::vector<CellData<2>> cells(cell_vertices.size(), CellData<2>());
+ *   for (unsigned int i=0; i<cell_vertices.size(); ++i)
+ *     for (unsigned int j=0; j<GeometryInfo<2>::vertices_per_cell; ++j)
  *       cells[i].vertices[j] = cell_vertices[i][j];
  *
- *   triangulation.create_triangulation ({std::begin(vertices),
- * std::end(vertices)}, cells, SubCellData());
+ *   triangulation.create_triangulation (vertices, cells, SubCellData());
  *   triangulation.set_all_manifold_ids_on_boundary(42);
- *   // set_manifold stores a copy of its second argument, so a temporary is
- * okay triangulation.set_manifold(42, PolarManifold<2>()); for (unsigned int i
- * = 0; i < 4; ++i)
+ *
+ *   // set_manifold stores a copy of its second argument,
+ *   // so a temporary is ookay
+ *   triangulation.set_manifold(42, PolarManifold<2>());
+ *   for (unsigned int i = 0; i < 4; ++i)
  *     {
  *       // refine all boundary cells
  *       for (const auto &cell : triangulation.active_cell_iterators())
@@ -1081,45 +1078,43 @@ namespace internal
  * has some more error checking and has to handle the case that subsequent
  * cells might actually belong to different triangulation, but that is of no
  * concern to us here):
- *   @code
- *     template <int dim>
- *     class FEValues
- *     {
- *       Triangulation<dim>::active_cell_iterator current_cell, previous_cell;
- *     public:
- *       void reinit (Triangulation<dim>::active_cell_iterator &cell);
- *       void invalidate_previous_cell ();
- *     };
- *
- *     template <int dim>
- *     void
- *     FEValues<dim>::reinit (Triangulation<dim>::active_cell_iterator &cell)
+ * @code
+ * template <int dim>
+ * class FEValues
+ * {
+ *   Triangulation<dim>::active_cell_iterator current_cell, previous_cell;
+ * public:
+ *   void reinit (Triangulation<dim>::active_cell_iterator &cell);
+ *   void invalidate_previous_cell ();
+ * };
+ *
+ * template <int dim>
+ * void
+ * FEValues<dim>::reinit (Triangulation<dim>::active_cell_iterator &cell)
+ * {
+ *   if (previous_cell.status() != valid)
  *     {
- *       if (previous_cell.status() != valid)
- *         {
- *           // previous_cell has not been set. set it now, and register
- *           // with the triangulation that we want to be informed about
- *           // mesh refinement
- *           previous_cell = current_cell;
- *           previous_cell->get_triangulation().signals.post_refinement
- *             .connect (std::bind (&FEValues<dim>::invalidate_previous_cell,
- *                                  std::ref (*this)));
- *         }
- *       else
- *         previous_cell = current_cell;
- *
- *       current_cell = cell;
- *       // ... do something with the cell...
+ *       // previous_cell has not been set. set it now, and register with the
+ *       // triangulation that we want to be informed about mesh refinement
+ *       previous_cell = current_cell;
+ *       previous_cell->get_triangulation().signals.post_refinement.connect(
+ *         std::bind (&FEValues<dim>::invalidate_previous_cell,
+ *                    std::ref (*this)));
  *     }
+ *   else
+ *    previous_cell = current_cell;
  *
+ *   current_cell = cell;
+ *   // ... do something with the cell...
+ * }
  *
- *     template <int dim>
- *     void
- *     FEValues<dim>::invalidate_previous_cell ()
- *     {
- *       previous_cell = Triangulation<dim>::active_cell_iterator();
- *     }
- *   @endcode
+ * template <int dim>
+ * void
+ * FEValues<dim>::invalidate_previous_cell ()
+ * {
+ *   previous_cell = Triangulation<dim>::active_cell_iterator();
+ * }
+ * @endcode
  * Here, whenever the triangulation is refined, it triggers the post-
  * refinement signal which calls the function object attached to it. This
  * function object is the member function
@@ -2656,10 +2651,13 @@ public:
    * does not contain any active cells (i.e., all cells on this level are
    * further refined, then this function returns
    * <code>end_active(level)</code> so that loops of the kind
-   *  @code
-   *    for (cell=tria.begin_active(level); cell!=tria.end_active(level);
-   * ++cell)
-   *      ...
+   * @code
+   *   for (const auto cell=tria.begin_active(level);
+   *        cell!=tria.end_active(level);
+   *        ++cell)
+   *     {
+   *       ...
+   *     }
    *  @endcode
    * have zero iterations, as may be expected if there are no active cells on
    * this level.
@@ -2745,7 +2743,7 @@ public:
    * @code
    *   Triangulation<dim> triangulation;
    *   ...
-   *   for (auto cell : triangulation.active_cell_iterators())
+   *   for (const auto &cell : triangulation.active_cell_iterators())
    *     cell->set_user_flag();
    * @endcode
    *
index 0141c517465c55c50a32128269742b879d9b7f75..e8b0e3892cfd7a724f707df5e95ac6a556f8910c 100644 (file)
@@ -60,21 +60,21 @@ class TriaActiveIterator;
  * In addition to the standard interface, an iterator of this class provides a
  * <tt>-@></tt> operator, i.e. you can write statements like
  * @code
- * i->set_refine_flag ();
+ * cell->set_refine_flag ();
  * @endcode
  *
- * Iterators are used whenever a loop over all lines, quads, cells etc.  is to
+ * Iterators are used whenever a loop over all lines, quads, cells etc. is to
  * be performed. These loops can then be coded like this:
  * @code
- *   cell_iterator i   = tria.begin();
- *   cell_iterator end = tria.end();
- *   for (; i!=end; ++i)
- *     if (cell->at_boundary())
- *       cell->set_refine_flag();
+ * cell_iterator cell = tria.begin();
+ * cell_iterator end  = tria.end();
+ * for (; cell!=end; ++cell)
+ *   if (cell->at_boundary())
+ *     cell->set_refine_flag();
  * @endcode
  *
- * Note the usage of <tt>++i</tt> instead of <tt>i++</tt> since this does not
- * involve temporaries and copying. It is recommended to use a fixed value
+ * Note the usage of <tt>++cell</tt> instead of <tt>cell++</tt> since this does
+ * not involve temporaries and copying. It is recommended to use a fixed value
  * <tt>end</tt> inside the loop instead of <tt>tria.end()</tt>, since the
  * creation and copying of these iterators is rather expensive compared to
  * normal pointers.
@@ -255,8 +255,7 @@ public:
    * derived iterators:
    * @code
    * DoFCellAccessor dof_accessor;
-   * Triangulation::active_cell_iterator cell
-   *   = accessor;
+   * Triangulation::active_cell_iterator cell = dof_accessor;
    * @endcode
    */
   explicit TriaRawIterator(const Accessor &a);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.