]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Indentation :)
authorBruno Blais <blais.bruno@gmail.com>
Tue, 10 Jun 2025 16:15:43 +0000 (12:15 -0400)
committerBruno Blais <blais.bruno@gmail.com>
Tue, 10 Jun 2025 16:15:43 +0000 (12:15 -0400)
include/deal.II/grid/grid_generator.h
source/grid/grid_generator.cc
source/grid/grid_generator_from_name.cc
tests/grid/grid_generator_custom_channel_with_cylinder.cc

index 048bcdc9a169d0d1cd22f0238d12db9605510095..e9f3720ca837bbfcf9d59e706482779feccd0185 100644 (file)
@@ -547,19 +547,20 @@ namespace GridGenerator
                         const double        skewness           = 2.0,
                         const bool          colorize           = false);
 
-    /**
+  /**
    * Generate a grid consisting of a channel with a cylinder where the length
    * and the height of the channel can be defined by the user. This generator is
-   * a generalized version of GridGenerator::channel_with_cylinder. It can be used
-   * for benchmarking Navier-Stokes solvers for various flows around a cylinder cases
-   * in 2D or 3D. The main limitation of this generator is that the diameter of the cylindre is
-   * fixed at one and that the dimensions of the channel must be an integer multiple of this diameter.
-   * Consequently, the length before the cylinder
-   * @length_pre, the length after the cylinder @length_post and the half height of the channel @half_height
-   * must be integer values. The geometry consists of a channel
-   * of size $[-L_{pre}, -H] \times [L_{post}, H] \times [0, W] $ (where the $z$
-   * dimension is omitted in 2d) with a cylinder, parallel to the $z$ axis
-   * with diameter $1$, centered at $(0, 0, 0)$. The channel has three
+   * a generalized version of GridGenerator::channel_with_cylinder. It can be
+   * used for benchmarking Navier-Stokes solvers for various flows around a
+   * cylinder cases in 2D or 3D. The main limitation of this generator is that
+   * the diameter of the cylindre is fixed at one and that the dimensions of the
+   * channel must be an integer multiple of this diameter. Consequently, the
+   * length before the cylinder
+   * @length_pre, the length after the cylinder @length_post and the half height
+   * of the channel @half_height must be integer values. The geometry consists
+   * of a channel of size $[-L_{pre}, -H] \times [L_{post}, H] \times [0, W] $
+   * (where the $z$ dimension is omitted in 2d) with a cylinder, parallel to the
+   * $z$ axis with diameter $1$, centered at $(0, 0, 0)$. The channel has three
    * distinct regions:
    * <ol>
    *   <li>If @p n_shells is greater than zero, then there are that many shells
@@ -569,8 +570,8 @@ namespace GridGenerator
    *   <li>a bulk region consisting of Cartesian cells.</li>
    * </ol>
    * Here is an example of a grid (without additional global refinement)
-   * where the arguments were @length_pre=8, @length_post=16, @half_height=8 and the
-   * default arguments are used for the number of shells and skewness:
+   * where the arguments were @length_pre=8, @length_post=16, @half_height=8 and
+   * the default arguments are used for the number of shells and skewness:
    *
    * @image html custom_channel_with_cylinder.png
    *
@@ -601,7 +602,8 @@ namespace GridGenerator
    * @param length_post The length of the channel from the cylinder (0) to the right side (x+)
    *
    * @param shell_region_radius Radius of the layer of shells around the cylinder.
-   * This value should be between larger than 0.5 (the radius of the cylinder) and smaller than 1 (the half-length of the box around the cylinder).
+   * This value should be between larger than 0.5 (the radius of the cylinder)
+   * and smaller than 1 (the half-length of the box around the cylinder).
    *
    * @param n_shells Number of shells to use in the shell layer.
    *
@@ -616,23 +618,24 @@ namespace GridGenerator
    * The left boundary (at $x = -L_{pre}$) is assigned an id of $0$, the right
    * boundary (at $x = L_{post}$) is assigned an id of $1$; the boundary of
    * the obstacle in the middle (i.e., the circle in 2d or the cylinder
-   * walls in 3d) is assigned an id of $2$, the bottom wall (at $y=-H$) is assigned and id of $/$, the top wall (at $y=H$)
-   * is assigned an id of $4$. In 3D, the front wall ($z=0$) is assigned an id of $5$ and the back wall ($z=W$) is assigned
-   * an id of $6$.
+   * walls in 3d) is assigned an id of $2$, the bottom wall (at $y=-H$) is
+   * assigned and id of $/$, the top wall (at $y=H$) is assigned an id of $4$.
+   * In 3D, the front wall ($z=0$) is assigned an id of $5$ and the back wall
+   * ($z=W$) is assigned an id of $6$.
    */
   template <int dim>
   void
   custom_channel_with_cylinder(Triangulation<dim> &tria,
-    const unsigned int       half_height,
-    const unsigned int       length_pre,
-    const unsigned int       length_post,
-    const double       depth=1,
-    const unsigned int  depth_division=1,
-    const double       shell_region_radius = 0.75,
-    const unsigned int  n_shells           = 2,
-    const double        skewness           = 2.0,
-    const bool          colorize           = false);
-                      
+                               const unsigned int  half_height,
+                               const unsigned int  length_pre,
+                               const unsigned int  length_post,
+                               const double        depth               = 1,
+                               const unsigned int  depth_division      = 1,
+                               const double        shell_region_radius = 0.75,
+                               const unsigned int  n_shells            = 2,
+                               const double        skewness            = 2.0,
+                               const bool          colorize            = false);
+
   /**
    * A general @p dim -dimensional cell (a segment if dim is 1, a quadrilateral
    * if @p dim is 2, or a hexahedron if @p dim is 3) immersed in a
index 9e81f59aa1899da943672f139cddc1fc659299cf..d91c74eb552ee6b0a712d436f8eb1b7ded2841f3 100644 (file)
@@ -3831,38 +3831,39 @@ namespace GridGenerator
 
   template <>
   void
-  custom_channel_with_cylinder([[maybe_unused]] Triangulation<1>  &tria,
-                        [[maybe_unused]] const unsigned int       half_height,
-                        [[maybe_unused]] const unsigned int       length_pre,
-                        [[maybe_unused]] const unsigned int       length_post,
-                        [[maybe_unused]] const double       depth,
-                        [[maybe_unused]] unsigned int  depth_division,
-                        [[maybe_unused]] const double       shell_region_radius,
-                        [[maybe_unused]] const unsigned int n_shells,
-                        [[maybe_unused]] const double       skewness,
-                        [[maybe_unused]] const bool         colorize)
+  custom_channel_with_cylinder(
+    [[maybe_unused]] Triangulation<1>  &tria,
+    [[maybe_unused]] const unsigned int half_height,
+    [[maybe_unused]] const unsigned int length_pre,
+    [[maybe_unused]] const unsigned int length_post,
+    [[maybe_unused]] const double       depth,
+    [[maybe_unused]] unsigned int       depth_division,
+    [[maybe_unused]] const double       shell_region_radius,
+    [[maybe_unused]] const unsigned int n_shells,
+    [[maybe_unused]] const double       skewness,
+    [[maybe_unused]] const bool         colorize)
   {
     DEAL_II_NOT_IMPLEMENTED();
   }
 
   template <>
   void
-  custom_channel_with_cylinder(Triangulation<2>  &tria,
-                        const unsigned int       half_height,
-                        const unsigned int       length_pre,
-                        const unsigned int       length_post,
-                        [[maybe_unused]] const double       depth,
-                        [[maybe_unused]] unsigned int  depth_division,
-                        const double       shell_region_radius,
-                        const unsigned int n_shells,
-                        const double       skewness,
-                        const bool         colorize)
+  custom_channel_with_cylinder(Triangulation<2>             &tria,
+                               const unsigned int            half_height,
+                               const unsigned int            length_pre,
+                               const unsigned int            length_post,
+                               [[maybe_unused]] const double depth,
+                               [[maybe_unused]] unsigned int depth_division,
+                               const double       shell_region_radius,
+                               const unsigned int n_shells,
+                               const double       skewness,
+                               const bool         colorize)
   {
-     const types::manifold_id polar_manifold_id = 0;
+    const types::manifold_id polar_manifold_id = 0;
     const types::manifold_id tfi_manifold_id   = 1;
 
     // The radius of the cylinder is 0.5, so the diameter is 1.
-    const double radius = 0.5;
+    const double radius     = 0.5;
     const double box_radius = 1;
 
     // We assume that the cylinder is centered at (0,0) and has a diameter of 1.
@@ -3870,16 +3871,17 @@ namespace GridGenerator
     // The number of repetitions is chosen to ensure that the cylinder
     // occupies four cells.
 
-    const unsigned int length_repetitions =length_pre+length_post;
-    const unsigned int height_repetitions =2*half_height;
+    const unsigned int length_repetitions = length_pre + length_post;
+    const unsigned int height_repetitions = 2 * half_height;
 
-    // We begin by setting up a grid that is length_repetition by height_repetitions cells.
-    // These cells are all square
+    // We begin by setting up a grid that is length_repetition by
+    // height_repetitions cells. These cells are all square
     Triangulation<2> bulk_tria;
-    GridGenerator::subdivided_hyper_rectangle(bulk_tria,
-                                              {(length_repetitions), height_repetitions},
-                                              Point<2>(-double(length_pre), -double(half_height)),
-                                              Point<2>(double(length_post), double(half_height)));
+    GridGenerator::subdivided_hyper_rectangle(
+      bulk_tria,
+      {(length_repetitions), height_repetitions},
+      Point<2>(-double(length_pre), -double(half_height)),
+      Point<2>(double(length_post), double(half_height)));
 
     // bulk_tria now looks like this:
     //
@@ -3894,12 +3896,13 @@ namespace GridGenerator
     //   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     //
     // The next step is to remove the cells marked with XXs: we will place
-    // the grid around the cylinder there later. The following loop determines which cells need to be removed from the Triangulation
+    // the grid around the cylinder there later. The following loop determines
+    // which cells need to be removed from the Triangulation
     //    (i.e., find the cells marked with XX in the picture).
     std::set<Triangulation<2>::active_cell_iterator> cells_to_remove;
     for (const auto &cell : bulk_tria.active_cell_iterators())
       {
-        if ((cell->center() - Point<2>(0., 0.)).norm() < 1.1*box_radius)
+        if ((cell->center() - Point<2>(0., 0.)).norm() < 1.1 * box_radius)
           cells_to_remove.insert(cell);
       }
 
@@ -3924,8 +3927,9 @@ namespace GridGenerator
             cell->face(face_n)->set_manifold_id(tfi_manifold_id);
       }
 
-    // The shell region should have a radius that is larger than the radius of the cylinder
-    if (radius < shell_region_radius )
+    // The shell region should have a radius that is larger than the radius of
+    // the cylinder
+    if (radius < shell_region_radius)
       {
         Assert(0 < n_shells,
                ExcMessage("If the shell region has positive width then "
@@ -3934,7 +3938,7 @@ namespace GridGenerator
         GridGenerator::concentric_hyper_shells(shell_tria,
                                                Point<2>(),
                                                radius,
-                                                shell_region_radius,
+                                               shell_region_radius,
                                                n_shells,
                                                skewness,
                                                8);
@@ -4010,27 +4014,27 @@ namespace GridGenerator
   template <>
   void
   custom_channel_with_cylinder(Triangulation<3>  &tria,
-                        const unsigned int       half_height,
-                        const unsigned int       length_pre,
-                        const unsigned int       length_post,
-                        const double       depth,
-                         unsigned int  depth_division,
-                        const double       shell_region_radius,
-                        const unsigned int n_shells,
-                        const double       skewness,
-                        const bool         colorize) {
-
+                               const unsigned int half_height,
+                               const unsigned int length_pre,
+                               const unsigned int length_post,
+                               const double       depth,
+                               unsigned int       depth_division,
+                               const double       shell_region_radius,
+                               const unsigned int n_shells,
+                               const double       skewness,
+                               const bool         colorize)
+  {
     Triangulation<2> tria_2;
     custom_channel_with_cylinder(tria_2,
-                      half_height,
-                      length_pre,
-                      length_post,
-                      depth,
-                      depth_division,
-                      shell_region_radius,
-                      n_shells,
-                      skewness,
-                      colorize);
+                                 half_height,
+                                 length_pre,
+                                 length_post,
+                                 depth,
+                                 depth_division,
+                                 shell_region_radius,
+                                 n_shells,
+                                 skewness,
+                                 colorize);
 
     // extrude to 3d
     extrude_triangulation(tria_2, depth_division, depth, tria, true);
index 859aaee9b7bad2170f38849d34be8102d9cf63fc..dcbffcff3696bfc6ae26afedca3a5de2c6fc3a4c 100644 (file)
@@ -120,8 +120,17 @@ namespace GridGenerator
         parse_and_create<dim, dim, double, unsigned int, double, bool>(
           channel_with_cylinder, arguments, tria);
       else if (name == "custom_channel_with_cylinder")
-        parse_and_create<dim, dim, unsigned int, unsigned int, unsigned int, double, unsigned int, double, unsigned int, double, bool>(
-          custom_channel_with_cylinder, arguments, tria);
+        parse_and_create<dim,
+                         dim,
+                         unsigned int,
+                         unsigned int,
+                         unsigned int,
+                         double,
+                         unsigned int,
+                         double,
+                         unsigned int,
+                         double,
+                         bool>(custom_channel_with_cylinder, arguments, tria);
       else if (name == "enclosed_hyper_cube")
         parse_and_create<dim, dim, double, double, double, bool>(
           enclosed_hyper_cube, arguments, tria);
index 46ea527a8f958181621d411f0de540408b3cd7ee..d2ad0f266dfb38a70ac1c055b288f7144e36a899 100644 (file)
@@ -30,7 +30,8 @@ dim_2(std::ostream &os)
   const unsigned int d = 2;
   Triangulation<d>   tr;
 
-  GridGenerator::custom_channel_with_cylinder(tr, 4,3,5,1,2,0.75,4,2,true);
+  GridGenerator::custom_channel_with_cylinder(
+    tr, 4, 3, 5, 1, 2, 0.75, 4, 2, true);
 
   GridOut gout;
   gout.write_vtk(tr, os);
@@ -41,7 +42,8 @@ dim_3(std::ostream &os)
 {
   const unsigned int d = 3;
   Triangulation<d>   tr;
-  GridGenerator::custom_channel_with_cylinder(tr, 4,3,5,1,2,0.75,4,2,true);
+  GridGenerator::custom_channel_with_cylinder(
+    tr, 4, 3, 5, 1, 2, 0.75, 4, 2, true);
   GridOut gout;
   gout.write_vtk(tr, os);
 }

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.