]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Triangulation::get_manifold(): asset that manifold has been attached 11566/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 16 Jan 2021 08:16:28 +0000 (09:16 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 6 Dec 2023 08:58:40 +0000 (09:58 +0100)
34 files changed:
doc/news/changes/incompatibilities/20221209Munch [new file with mode: 0644]
include/deal.II/grid/tria.h
source/grid/grid_generator.cc
source/grid/grid_generator_pipe_junction.cc
source/grid/tria.cc
tests/codim_one/boundary_indicator_01.cc
tests/codim_one/extract_boundary_mesh_01.cc
tests/codim_one/extract_boundary_mesh_08.cc
tests/codim_one/extract_boundary_mesh_11.cc
tests/codim_one/extract_boundary_mesh_12.cc
tests/codim_one/extract_boundary_mesh_13.cc
tests/fe/cell_similarity_08.cc
tests/grid/extrude_copy_manifold.cc
tests/grid/get_coarse_mesh_description_01.cc
tests/grid/grid_hyper_shell.cc
tests/grid/grid_tools_regularize_02.cc
tests/grid/merge_triangulations_04.cc
tests/grid/move_constructor.cc
tests/hp/distribute_dofs_linear_time.cc
tests/manifold/manifold_id_02.cc
tests/manifold/manifold_id_03.cc
tests/manifold/manifold_id_04.cc
tests/manifold/manifold_id_08.cc
tests/manifold/polar_manifold_04.cc
tests/mappings/mapping_q_mixed_manifolds_02.cc
tests/mpi/periodicity_02.cc
tests/numerics/no_flux_10.cc
tests/opencascade/circle_normal_projection.cc
tests/opencascade/interpolation_curve_boundary.cc
tests/opencascade/interpolation_curve_boundary_02.cc
tests/opencascade/normal_projection_01.cc
tests/simplex/mapping_transformations_01.cc
tests/simplex/step-02.cc
tests/simplex/step-68.cc

diff --git a/doc/news/changes/incompatibilities/20221209Munch b/doc/news/changes/incompatibilities/20221209Munch
new file mode 100644 (file)
index 0000000..cc2c8f4
--- /dev/null
@@ -0,0 +1,8 @@
+Changed: When calling Triangulation::get_manifold(manifold_id) for 
+a non-existing manifold_id, the function returned a flat manifold.
+This behaviour has been changed and an assert is thrown in this case.
+Furthermore, the functions Triangulation::reset_manifold() and
+Triangulation::reset_all_manifolds() do not actually remove the manifolds
+but make them flat.
+<br>
+(Peter Munch, 2022/12/09)
index b5d1fe81918369869490df8fea7bff4f5785754f..1183900c22a58652f8ce7993261db8aa9806fec0 100644 (file)
@@ -1893,6 +1893,10 @@ public:
    * assignment of a different Manifold object by the function
    * Triangulation::set_manifold().
    *
+   * @note Geometric objects with the manifold ID @p manifold_number will
+   *   still have the same ID after calling this function so that the function
+   *   get_manifold_ids() will still return the same set of IDs.
+   *
    * @ingroup manifold
    *
    * @see
@@ -1907,6 +1911,11 @@ public:
    * of all Manifold objects by the function
    * Triangulation::set_manifold().
    *
+   * @note Geometric objects not having numbers::flat_manifold_id as manifold ID
+   *   will after calling this function still have the same IDs. Their IDs are
+   *   not replaced by numbers::flat_manifold_id so that the function
+   *   get_manifold_ids() will still return the same set of IDs.
+   *
    * @ingroup manifold
    *
    * @see
index d02d13c3bf41f74190d10991dcb90546fd9ed488..1dadc41314ab78e6402b97da5d97f245c4919fa3 100644 (file)
@@ -2109,6 +2109,8 @@ namespace GridGenerator
     tria.set_manifold(2,
                       CylindricalManifold<3>(Tensor<1, 3>({0., 1., 0.}),
                                              Point<3>()));
+
+    tria.set_manifold(0, FlatManifold<3>());
     TransfiniteInterpolationManifold<3> transfinite;
     transfinite.initialize(tria);
     tria.set_manifold(0, transfinite);
@@ -3492,6 +3494,7 @@ namespace GridGenerator
 
     PolarManifold<2> polar_manifold(new_center);
     tria.set_manifold(polar_manifold_id, polar_manifold);
+    tria.set_manifold(tfi_manifold_id, FlatManifold<2>());
     TransfiniteInterpolationManifold<2> inner_manifold;
     inner_manifold.initialize(tria);
     tria.set_manifold(tfi_manifold_id, inner_manifold);
@@ -3541,8 +3544,11 @@ namespace GridGenerator
     const CylindricalManifold<3> cylindrical_manifold(
       direction,
       /*axial_point*/ new_center);
+    tria.set_manifold(polar_manifold_id, FlatManifold<3>());
+    tria.set_manifold(tfi_manifold_id, FlatManifold<3>());
     TransfiniteInterpolationManifold<3> inner_manifold;
     inner_manifold.initialize(tria);
+
     tria.set_manifold(polar_manifold_id, cylindrical_manifold);
     tria.set_manifold(tfi_manifold_id, inner_manifold);
   }
@@ -3748,6 +3754,8 @@ namespace GridGenerator
     // attach manifolds
     PolarManifold<2> polar_manifold(Point<2>(0.2, 0.2));
     tria.set_manifold(polar_manifold_id, polar_manifold);
+
+    tria.set_manifold(tfi_manifold_id, FlatManifold<2>());
     TransfiniteInterpolationManifold<2> inner_manifold;
     inner_manifold.initialize(tria);
     tria.set_manifold(tfi_manifold_id, inner_manifold);
@@ -3802,6 +3810,8 @@ namespace GridGenerator
     const Point<3>     axial_point(m_ptr->center[0], m_ptr->center[1], 0.0);
     const Tensor<1, 3> direction{{0.0, 0.0, 1.0}};
 
+    tria.set_manifold(cylindrical_manifold_id, FlatManifold<3>());
+    tria.set_manifold(tfi_manifold_id, FlatManifold<3>());
     const CylindricalManifold<3> cylindrical_manifold(direction, axial_point);
     TransfiniteInterpolationManifold<3> inner_manifold;
     inner_manifold.initialize(tria);
@@ -4327,6 +4337,8 @@ namespace GridGenerator
     tria.set_manifold(0, SphericalManifold<2>(p));
     if (internal_manifolds)
       tria.set_manifold(1, SphericalManifold<2>(p));
+    else
+      tria.set_manifold(1, FlatManifold<2>());
   }
 
 
@@ -4443,6 +4455,9 @@ namespace GridGenerator
     SphericalManifold<dim> inner_manifold(inner_center);
     SphericalManifold<dim> outer_manifold(outer_center);
 
+    tria.set_manifold(0, FlatManifold<dim>());
+    tria.set_manifold(1, FlatManifold<dim>());
+    tria.set_manifold(2, FlatManifold<dim>());
     TransfiniteInterpolationManifold<dim> transfinite;
     transfinite.initialize(tria);
 
@@ -5103,6 +5118,8 @@ namespace GridGenerator
     tria.set_manifold(0, SphericalManifold<3>(p));
     if (internal_manifold)
       tria.set_manifold(1, SphericalManifold<3>(p));
+    else
+      tria.set_manifold(1, FlatManifold<3>());
   }
 
 
@@ -5915,6 +5932,8 @@ namespace GridGenerator
         cell->set_all_manifold_ids(numbers::flat_manifold_id);
     GridTools::shift(p, tria);
 
+    tria.set_manifold(1, FlatManifold<dim>());
+
     tria.set_all_manifold_ids_on_boundary(0);
     tria.set_manifold(0, SphericalManifold<dim>(p));
   }
@@ -7798,6 +7817,10 @@ namespace GridGenerator
       }
 
     out_tria.create_triangulation(v, cells, subcelldata);
+
+    for (const auto i : out_tria.get_manifold_ids())
+      if (i != numbers::flat_manifold_id)
+        out_tria.set_manifold(i, FlatManifold<dim, spacedim2>());
   }
 
 
@@ -8207,7 +8230,12 @@ namespace GridGenerator
           }
       }
 
+    out_tria.clear();
     out_tria.create_triangulation(vertices, cells, subcell_data);
+
+    for (const auto i : out_tria.get_manifold_ids())
+      if (i != numbers::flat_manifold_id)
+        out_tria.set_manifold(i, FlatManifold<dim, spacedim>());
   }
 
 
@@ -8508,6 +8536,17 @@ namespace GridGenerator
       surface_to_volume_mapping[temporary_map_boundary_cell_face[i].first] =
         temporary_map_boundary_cell_face[i].second.first;
 
+    // TODO: we attach flat manifolds here; one should attach submanifolds here
+    const auto attached_mids =
+      surface_mesh.get_triangulation().get_manifold_ids();
+    for (const auto i : volume_mesh.get_triangulation().get_manifold_ids())
+      if (i != numbers::flat_manifold_id &&
+          std::find(attached_mids.begin(), attached_mids.end(), i) ==
+            attached_mids.end())
+        const_cast<Triangulation<dim - 1, spacedim> &>(
+          surface_mesh.get_triangulation())
+          .set_manifold(i, FlatManifold<dim - 1, spacedim>());
+
     return surface_to_volume_mapping;
   }
 
index 5108cfcda23061ae1d855e8e27449e16610f25ea..f5ba8d62c9b1ba6e28c7e99f4ebdb69017259569 100644 (file)
@@ -614,6 +614,7 @@ namespace GridGenerator
 
     for (unsigned int p = 0; p < n_pipes; ++p)
       tria.set_manifold(p, manifolds[p]);
+    tria.set_manifold(n_pipes, FlatManifold<3>());
 
     // Since GridGenerator::merge_triangulations() does not copy boundary IDs
     // either, we need to set them after the final geometry is created. Luckily,
index f8914c93c7aaf4bea9bcac1a875290b1200c38f6..de285dca22eb4a2ed7283ab2fd23d3ef370bb5ed 100644 (file)
@@ -12294,7 +12294,10 @@ void Triangulation<dim, spacedim>::reset_manifold(
   AssertIndexRange(m_number, numbers::flat_manifold_id);
 
   // delete the entry located at number.
-  manifolds.erase(m_number);
+  manifolds[m_number] =
+    internal::TriangulationImplementation::get_default_flat_manifold<dim,
+                                                                     spacedim>()
+      .clone();
 }
 
 
@@ -12302,7 +12305,10 @@ template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
 void Triangulation<dim, spacedim>::reset_all_manifolds()
 {
-  manifolds.clear();
+  for (auto &m : manifolds)
+    m.second = internal::TriangulationImplementation::
+                 get_default_flat_manifold<dim, spacedim>()
+                   .clone();
 }
 
 
@@ -12384,6 +12390,11 @@ DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
 const Manifold<dim, spacedim> &Triangulation<dim, spacedim>::get_manifold(
   const types::manifold_id m_number) const
 {
+  // check if flat manifold has been queried
+  if (m_number == numbers::flat_manifold_id)
+    return internal::TriangulationImplementation::
+      get_default_flat_manifold<dim, spacedim>();
+
   // look, if there is a manifold stored at
   // manifold_id number.
   const auto it = manifolds.find(m_number);
@@ -12394,10 +12405,15 @@ const Manifold<dim, spacedim> &Triangulation<dim, spacedim>::get_manifold(
       return *(it->second);
     }
 
-  // if we have not found an entry connected with number, we return
-  // the default (flat) manifold
+  Assert(
+    false,
+    ExcMessage(
+      "No manifold of the manifold id " + std::to_string(m_number) +
+      " has been attached to the triangulation. "
+      "Please attach the right manifold with Triangulation::set_manifold()."));
+
   return internal::TriangulationImplementation::
-    get_default_flat_manifold<dim, spacedim>();
+    get_default_flat_manifold<dim, spacedim>(); // never reached
 }
 
 
index a898a62e3a54ba631f263dbb730764c269b6b2b3..0624ba81334a5db97131d6ffbf838b7f8a982105 100644 (file)
@@ -92,6 +92,7 @@ main()
     GridGenerator::extract_boundary_mesh(volume_mesh,
                                          boundary_mesh,
                                          boundary_ids);
+    boundary_mesh.set_manifold(1, FlatManifold<dim - 1, dim>());
     deallog << volume_mesh.n_active_cells() << std::endl;
     deallog << boundary_mesh.n_active_cells() << std::endl;
 
index 38a65ef1a0d4c8923d5cd5d182f40c78a0bc5642..18479f5a2330389769c79a1e1417655fc55a55f6 100644 (file)
@@ -29,6 +29,7 @@
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
@@ -116,6 +117,10 @@ main()
 
     Triangulation<dim - 1, dim> boundary_mesh;
 
+    for (const auto bid : volume_mesh.get_manifold_ids())
+      if (bid != numbers::flat_manifold_id)
+        boundary_mesh.set_manifold(bid, FlatManifold<2, 3>());
+
     surface_to_volume_mapping =
       GridGenerator::extract_boundary_mesh(volume_mesh, boundary_mesh);
 
index ba3dfc76f0902b9e8eb0605bd042d1a42b66fd3e..6039a5e65367931f2e9fadb64e95f1876270fb6d 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/tria.h>
 
 #include "../tests.h"
@@ -35,6 +36,11 @@ test()
   GridOut().write_gnuplot(triangulation, deallog.get_file_stream());
 
   Triangulation<dim - 1, dim> triangulation_surface;
+
+  for (const auto bid : triangulation.get_manifold_ids())
+    if (bid != numbers::flat_manifold_id)
+      triangulation_surface.set_manifold(bid, FlatManifold<2, 3>());
+
   GridGenerator::extract_boundary_mesh(triangulation, triangulation_surface);
   triangulation_surface.refine_global(2);
 
index 7ac14e48b17bdf279fbf359eacabf094c2d8ab8f..bd4df02b413b04555665891b94db9a8c67b62744 100644 (file)
@@ -59,6 +59,10 @@ test()
   // now extract the surface mesh
   Triangulation<dim - 1, dim> triangulation_surface;
 
+  for (const auto bid : triangulation.get_manifold_ids())
+    if (bid != numbers::flat_manifold_id)
+      triangulation_surface.set_manifold(bid, FlatManifold<2, 3>());
+
   static const CylindricalManifold<dim - 1, dim> surface_cyl(0);
   triangulation_surface.set_manifold(0, surface_cyl);
 
index 4c8efbe9c908fd83e662bcd98082286c7f680e3e..cde714fa3fe12c4dd60e321ce5f6ff28ee343573 100644 (file)
@@ -44,6 +44,10 @@ test()
   // now extract the surface mesh
   Triangulation<dim - 1, dim> triangulation_surface;
 
+  for (const auto bid : triangulation.get_manifold_ids())
+    if (bid != numbers::flat_manifold_id)
+      triangulation_surface.set_manifold(bid, FlatManifold<2, 3>());
+
   static const CylindricalManifold<dim - 1, dim> surface_cyl(0);
   triangulation_surface.set_manifold(0, surface_cyl);
 
index 84e66c166a5c3460ed657efbe04f008495046eca..c3a6ca46591d29568f0b431a750e844ee68f7a07 100644 (file)
@@ -20,6 +20,7 @@
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
@@ -53,6 +54,10 @@ test()
             cell->face(f)->set_manifold_id(cell->face(f)->boundary_id());
         }
 
+  for (const auto bid : triangulation.get_manifold_ids())
+    if (bid != numbers::flat_manifold_id)
+      triangulation.set_manifold(bid, FlatManifold<3>());
+
   static const CylindricalManifold<dim> outer_cylinder(0);
   triangulation.set_manifold(0, outer_cylinder);
 
@@ -63,6 +68,10 @@ test()
   // now extract the surface mesh
   Triangulation<dim - 1, dim> triangulation_surface;
 
+  for (const auto bid : triangulation.get_manifold_ids())
+    if (bid != numbers::flat_manifold_id)
+      triangulation_surface.set_manifold(bid, FlatManifold<2, 3>());
+
   static const CylindricalManifold<dim - 1, dim> surface_cyl(0);
   triangulation_surface.set_manifold(0, surface_cyl);
 
index cdab926c1e0c85a4818a89526907ef2978733886..f0e17bfc3d66a35a72c605e7ee2ed69e8156bac8 100644 (file)
@@ -155,6 +155,9 @@ test()
   GridGenerator::subdivided_hyper_rectangle(tr, subdivisions, p1, p2);
   GridTools::copy_boundary_to_manifold_id(tr);
 
+  for (const auto bid : tr.get_boundary_ids())
+    tr.set_manifold(bid, FlatManifold<dim>());
+
   static const SphericalManifold<dim> boundary(tr.begin_active()->center());
   tr.set_manifold(1, boundary);
 
index 3c171519cbc007f3b423fef6d77472aa659c8d68..eeaa626640395752f0b9d9611df2950e8c5d3640 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
@@ -47,6 +48,8 @@ test()
   Triangulation<3> triangulation_3;
   GridGenerator::extrude_triangulation(
     triangulation_2, 3, 1.0, triangulation_3, true);
+  triangulation_3.set_manifold(0, FlatManifold<3>());
+  triangulation_3.set_manifold(1, FlatManifold<3>());
   TransfiniteInterpolationManifold<3> tfi_manifold;
   tfi_manifold.initialize(triangulation_3);
   CylindricalManifold<3> cylinder_manifold(2);
index 6fe909fb6f0600ef8bcc58f95848b38c698ad695..41cd70f69eec156a4f58be6fcc9a0790757d1b48 100644 (file)
@@ -18,6 +18,7 @@
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/tria.h>
 
 #include "../tests.h"
@@ -34,10 +35,17 @@ setup_tria(Triangulation<1> &tria)
       static_cast<types::material_id>(10.0 * (3.0 + cell->center()[0])));
   for (auto face : tria.active_face_iterators())
     if (0.5 < face->center()[0])
-      face->set_all_manifold_ids(42);
+      {
+        face->set_all_manifold_ids(42);
+        tria.set_manifold(42, FlatManifold<1>());
+      }
   for (auto &cell : tria.active_cell_iterators())
-    cell->set_manifold_id(
-      static_cast<types::material_id>(10.0 * (2.0 + cell->center()[0])));
+    {
+      const auto bid =
+        static_cast<types::material_id>(10.0 * (2.0 + cell->center()[0]));
+      cell->set_manifold_id(bid);
+      tria.set_manifold(bid, FlatManifold<1>());
+    }
 }
 
 
@@ -63,13 +71,19 @@ setup_tria(Triangulation<dim> &tria)
   // detail that unassigned manifolds are flat.
   for (auto face : tria.active_face_iterators())
     if (-0.1 < face->center()[0])
-      face->set_all_manifold_ids(42);
+      {
+        face->set_all_manifold_ids(42);
+        tria.set_manifold(42, FlatManifold<dim>());
+      }
   for (auto &cell : tria.active_cell_iterators())
     if (cell->center() != Point<dim>())
       {
         const double angle = std::atan2(cell->center()[0], cell->center()[1]);
-        cell->set_manifold_id(
-          static_cast<types::material_id>(361 - angle * 180.0 / numbers::PI));
+
+        const auto bid =
+          static_cast<types::material_id>(361 - angle * 180.0 / numbers::PI);
+        cell->set_manifold_id(bid);
+        tria.set_manifold(bid, FlatManifold<dim>());
       }
 }
 
@@ -93,6 +107,10 @@ test()
     tria_2.create_triangulation(vertices, cells, subcell_data);
     Assert(GridTools::have_same_coarse_mesh(tria, tria_2), ExcInternalError());
 
+    for (const auto bid : tria_2.get_manifold_ids())
+      if (bid != numbers::flat_manifold_id)
+        tria_2.set_manifold(bid, FlatManifold<dim>());
+
     GridOut grid_out;
     deallog << "Original Triangulation:" << std::endl;
     grid_out.write_vtk(tria, deallog.get_file_stream());
index 17ce245e1a051ee857f7f968630e32bd0d071e0e..81d7b0a3ace5d658fcd1400463fbee207f7601c0 100644 (file)
@@ -47,6 +47,10 @@ check(double r1, double r2, unsigned int n)
   tria.reset_manifold(0);
   tria.set_all_manifold_ids(numbers::flat_manifold_id);
   GridTools::copy_boundary_to_manifold_id(tria);
+
+  for (const auto bid : tria.get_boundary_ids())
+    tria.set_manifold(bid, FlatManifold<dim>());
+
   if (dim == 3)
     for (typename Triangulation<dim>::active_cell_iterator c =
            tria.begin_active();
index c74ae29d0a7d1b5e018c35b8ed29a7f92c6c5379..632356139accecc0267a5fb204a16f32c2b3c845 100644 (file)
@@ -42,6 +42,9 @@ main()
 
   GridTools::copy_boundary_to_manifold_id(tria);
 
+  for (const auto bid : tria.get_boundary_ids())
+    tria.set_manifold(bid, FlatManifold<2>());
+
   tria.set_manifold(0, m0);
   tria.set_manifold(1, m1);
 
index f133bfa48836d107643f713c354f2c19e9206df9..59be64f491622d4ca60ca21007fddbb1bfee7ea5 100644 (file)
@@ -115,6 +115,7 @@ main()
 
   PolarManifold<2> polar_manifold(Point<2>(0.2, 0.2));
   result_2.set_manifold(polar_id, polar_manifold);
+  result_2.set_manifold(tfi_id, FlatManifold<2>());
   TransfiniteInterpolationManifold<2> inner_manifold;
   inner_manifold.initialize(result_2);
   result_2.set_manifold(tfi_id, inner_manifold);
index 82f0f3f1b886218e5d96bb2005610ee828a59f2e..23e2ad920db98fef0d310a4d2cbd79e0d55134d9 100644 (file)
@@ -28,8 +28,14 @@ template <int dim>
 void
 print_tria_info(const Triangulation<dim> &tria)
 {
+  const std::vector<types::manifold_id> bids =
+    tria.n_active_cells() == 0 ? std::vector<types::manifold_id>() :
+                                 tria.get_manifold_ids();
+
   const bool manifold_0_is_flat =
+    (std::find(bids.begin(), bids.end(), 0) == bids.end()) ||
     dynamic_cast<const FlatManifold<dim> *>(&tria.get_manifold(0)) != nullptr;
+
   deallog << (tria.n_active_cells() != 0) << ", " << (tria.n_active_hexs() != 0)
           << ", " << (tria.n_active_quads() != 0) << ", "
           << (tria.n_active_lines() != 0) << ", " << (tria.n_levels() != 0)
index b85072fabdf752da1b49d36fb71771d2b6d34f59..7ebae4183b96527d363e451eafb820dd0ddf37b4 100644 (file)
@@ -72,6 +72,7 @@ ladutenko_circle(Triangulation<dim> &triangulation,
   GridGenerator::hyper_ball(triangulation, center, radius);
   triangulation.set_all_manifold_ids(circular_manifold_id);
   triangulation.set_manifold(circular_manifold_id, *boundary);
+  triangulation.set_manifold(straight_manifold_id, FlatManifold<dim>());
 
   const double core_radius  = 1.0 / 4.8 * radius;
   const double inner_radius = 1.0 / 2.4 * radius;
index b155dd3b2dec42e6435430eef147dc64c8198c55..d89b979cd578772260d05eb1d620a93e9f4dd4b7 100644 (file)
@@ -48,6 +48,8 @@ test(unsigned int ref = 1)
   typename Triangulation<dim, spacedim>::active_cell_iterator cell;
 
   tria.begin_active()->set_all_manifold_ids(1);
+  tria.set_manifold(1, FlatManifold<dim, spacedim>());
+
   tria.refine_global(ref);
 
   for (cell = tria.begin_active(); cell != tria.end(); ++cell)
index dcc9fed3c6789d3b59d7912f5b04eab673127380..51ff52050a783b504ecfdc082aab52129a18d818 100644 (file)
@@ -44,6 +44,7 @@ test(unsigned int ref = 1)
 
 
   tria.begin_active()->set_manifold_id(1);
+  tria.set_manifold(1, FlatManifold<dim, spacedim>());
 
   tria.refine_global(1);
 
index c151f1622cf4d1e11fa39e56ef1168ba090523f8..49e8612f3beb9874e5ca671b543a78255af7bd0e 100644 (file)
@@ -45,6 +45,10 @@ test(unsigned int ref = 1)
   for (const unsigned int f : GeometryInfo<dim>::face_indices())
     tria.begin_active()->face(f)->set_manifold_id(2);
 
+  tria.set_manifold(1, FlatManifold<dim, spacedim>());
+  tria.set_manifold(2, FlatManifold<dim, spacedim>());
+  tria.set_manifold(3, FlatManifold<dim, spacedim>());
+
   tria.refine_global(1);
 
   for (cell = tria.begin_active(); cell != tria.end(); ++cell)
index 6b300feebcec79355bba4e2b0fb6e4c4d7023427..83ac2c6b84a5a07de0518b695a5497dc19b557f5 100644 (file)
@@ -16,6 +16,7 @@
 // Make sure that Triangulation::get_manifold_ids() work correctly
 
 #include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
 #include "../tests.h"
@@ -37,6 +38,10 @@ test(unsigned int ref = 1)
 
   tria.begin_active()->line(0)->set_manifold_id(3);
 
+  tria.set_manifold(1, FlatManifold<dim>());
+  tria.set_manifold(2, FlatManifold<dim>());
+  tria.set_manifold(3, FlatManifold<dim>());
+
   tria.refine_global(ref);
 
   for (cell = tria.begin_active(); cell != tria.end(); ++cell)
index 39a94b77e05c2153a3fcd1d68c405c7cfc11c392..49df373e1be4cf3c0c30fd35fca51342999ac1b1 100644 (file)
@@ -53,6 +53,7 @@ test(unsigned int ref = 1)
         cell->set_all_manifold_ids(0);
     }
 
+  tria.set_manifold(0, FlatManifold<dim, spacedim>());
   tria.set_manifold(1, manifold);
   tria.refine_global(2);
 
index 9a1d3029a9b08e78c3bd1ca9d1029efd14fccee4..080084e7125cddce78be669dc69fb501ffa92012 100644 (file)
@@ -164,6 +164,7 @@ create_triangulation(Triangulation<2> &tria)
       if (Point<2>(X_C, Y_C).distance(cell->center()) <= R_2)
         cell->set_all_manifold_ids(MANIFOLD_ID);
     }
+  tria.set_manifold(MANIFOLD_ID, FlatManifold<2>());
 }
 
 void
@@ -182,6 +183,8 @@ create_triangulation(Triangulation<3> &tria)
       if (Point<3>(X_C, Y_C, cell->center()[2]).distance(cell->center()) <= R_2)
         cell->set_all_manifold_ids(MANIFOLD_ID);
     }
+  tria.set_manifold(0, FlatManifold<3>());
+  tria.set_manifold(MANIFOLD_ID, FlatManifold<3>());
 }
 
 template <int dim>
index 72225a23ce657ad420d577ac6b8a1b9858664a5b..f07e865ca79852a7fbdef51cc26d075dec7695d6 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 
 #include <deal.II/lac/affine_constraints.h>
@@ -760,6 +761,9 @@ namespace Step22
     triangulation.set_all_manifold_ids(numbers::flat_manifold_id);
     GridTools::copy_boundary_to_manifold_id(triangulation);
 
+    for (const auto bid : triangulation.get_boundary_ids())
+      triangulation.set_manifold(bid, FlatManifold<dim>());
+
 #ifdef PERIODIC
     std::vector<GridTools::PeriodicFacePair<
       typename parallel::distributed::Triangulation<dim>::cell_iterator>>
index f75ecd8ab609d3815ed9507cdf35b32d3eac13ab..8dbac5e982c021310d93c4ca986c037c5560271f 100644 (file)
@@ -42,6 +42,7 @@
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
@@ -207,6 +208,9 @@ run()
   sixty_deg_hyper_shell(triangulation, Point<dim>(), 0.5, 1.0);
   GridTools::copy_boundary_to_manifold_id(triangulation);
 
+  for (unsigned int d = 0; d < 2 * dim; ++d)
+    triangulation.set_manifold(d, FlatManifold<dim>());
+
   static SphericalManifold<dim> boundary((Point<dim>()));
   triangulation.set_manifold(0, boundary);
 
index aa508f3b9b955adbbccd8d337794aeff48906d01..af4ae58facb99c89d9e38e29c3e1d55008200e97 100644 (file)
@@ -79,6 +79,7 @@ main()
   // points created in the interior
   // of the face.
   tria.begin()->set_manifold_id(1);
+  tria.set_manifold(1, FlatManifold<2, 3>());
 
   // We refine twice, and expect the
   // outer points to end up on the
index 19bcbab15e16b06571902f877391aa9d848c7f0c..f874e8eddaba9ebe2261440b32979c202431e621 100644 (file)
@@ -68,6 +68,7 @@ main()
   // This is here to ignore the points created in the interior of the
   // face.
   tria.begin()->set_manifold_id(1);
+  tria.set_manifold(1, FlatManifold<2, 3>());
 
   // We refine twice, and expect the outer points to end up on a
   // smooth curve interpolating the square vertices.
index 32929253bb3542eb14b8e386f3dff9e7ebf3facd..7f52ac5e87b9454d427d0b18c768f856720804b8 100644 (file)
@@ -69,6 +69,7 @@ main()
   // This is here to ignore the points created in the interior of the
   // face.
   tria.begin()->set_manifold_id(1);
+  tria.set_manifold(1, FlatManifold<2, 3>());
 
   // We refine twice, and expect the outer points to end up on a
   // smooth curve interpolating the square vertices.
index 4957d2f2ece6f67adacda00bb58ee313752382a2..6eddae9ba5312ebd248af1ce42db3e9fe32391dd 100644 (file)
@@ -69,6 +69,7 @@ main()
   // of the face.
   tria.begin()->set_all_manifold_ids(1);
   tria.begin()->set_manifold_id(0);
+  tria.set_manifold(0, FlatManifold<3>());
 
   tria.refine_global(2);
 
index c0719dae99a369916f937b881cb0aab94ff64e95..6e080c6f8a82153c20ce463452cd446055194e17 100644 (file)
@@ -25,6 +25,7 @@
 #include <deal.II/fe/mapping_fe.h>
 
 #include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 #include <deal.II/grid/tria_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
@@ -47,6 +48,7 @@ make_grid(Triangulation<2> &triangulation)
 
   GridGenerator::convert_hypercube_to_simplex_mesh(triangulation_temp,
                                                    triangulation);
+  triangulation.set_manifold(0, FlatManifold<2>());
 }
 
 int
index 526f6230eb6e136a1b4fc51bc022510944134a6e..e6073281f49aae929eefd844bd5ccd3a2c0454af 100644 (file)
@@ -57,6 +57,9 @@ make_grid(Triangulation<2> &triangulation)
 
   GridGenerator::convert_hypercube_to_simplex_mesh(triangulation_temp,
                                                    triangulation);
+  for (const auto i : triangulation_temp.get_manifold_ids())
+    if (i != numbers::flat_manifold_id)
+      triangulation.set_manifold(i, triangulation_temp.get_manifold(i));
 
   triangulation.refine_global(); // WARNING: no local refinement is performed
 }
index 5b65bfeb57874b44f308d1b5edff4afd07e0620d..71853c3b4bbe7be0aa035b0345f1ad81bb990a46 100644 (file)
@@ -234,6 +234,7 @@ namespace Step68
     GridGenerator::convert_hypercube_to_simplex_mesh(
       temporary_quad_particle_triangulation,
       temporary_tri_particle_triangulation);
+    temporary_tri_particle_triangulation.set_manifold(0, FlatManifold<dim>());
 
 
     // extract relevant information from distributed triangulation
@@ -246,6 +247,7 @@ namespace Step68
     parallel::fullydistributed::Triangulation<dim> particle_triangulation(
       mpi_communicator);
     particle_triangulation.create_triangulation(particle_construction_data);
+    particle_triangulation.set_manifold(0, FlatManifold<dim>());
 
     // We generate the necessary bounding boxes for the particles generator.
     // These bounding boxes are required to quickly identify in which

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.