]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Get rid of create_triangulation_compatibility in the UCD reader. 12042/head
authorDavid Wells <drwells@email.unc.edu>
Wed, 14 Apr 2021 03:39:29 +0000 (23:39 -0400)
committerDavid Wells <drwells@email.unc.edu>
Wed, 14 Apr 2021 13:37:58 +0000 (09:37 -0400)
To keep reading input consistently this also requires that we slightly modify
the cell inversion algorithm. This is backwards-compatible since the option to
use the new style ordering was added in 7f9c1023b61.

source/grid/grid_in.cc
source/grid/grid_reordering.cc

index 66cbae62dd94c231f07ef77e21c4808c56f9ccc2..8eae912d794dbe2738dabf7887b9a493568624bf 100644 (file)
@@ -946,7 +946,7 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
           // allocate and read indices
           cells.emplace_back();
           for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
-            in >> cells.back().vertices[i];
+            in >> cells.back().vertices[GeometryInfo<dim>::ucd_to_deal[i]];
 
           // to make sure that the cast won't fail
           Assert(material_id <= std::numeric_limits<types::material_id>::max(),
@@ -1033,10 +1033,9 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
         // boundary info
         {
           subcelldata.boundary_quads.emplace_back();
-          in >> subcelldata.boundary_quads.back().vertices[0] >>
-            subcelldata.boundary_quads.back().vertices[1] >>
-            subcelldata.boundary_quads.back().vertices[2] >>
-            subcelldata.boundary_quads.back().vertices[3];
+          for (const unsigned int i : GeometryInfo<2>::vertex_indices())
+            in >> subcelldata.boundary_quads.back()
+                    .vertices[GeometryInfo<2>::ucd_to_deal[i]];
 
           // to make sure that the cast won't fail
           Assert(material_id <= std::numeric_limits<types::boundary_id>::max(),
@@ -1096,9 +1095,10 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
   // ... and cells
   if (dim == spacedim)
     GridReordering<dim, spacedim>::invert_all_cells_of_negative_grid(vertices,
-                                                                     cells);
-  GridReordering<dim, spacedim>::reorder_cells(cells);
-  tria->create_triangulation_compatibility(vertices, cells, subcelldata);
+                                                                     cells,
+                                                                     true);
+  GridReordering<dim, spacedim>::reorder_cells(cells, true);
+  tria->create_triangulation(vertices, cells, subcelldata);
 }
 
 namespace
index 5a034b1d1ffae6d86a8afcd644e0573391cac083..90f93551c67b3dc2ec5ec83b8c98cc8f86adf3c8 100644 (file)
@@ -1260,8 +1260,18 @@ GridReordering<3>::invert_all_cells_of_negative_grid(
         {
           ++n_negative_cells;
           // reorder vertices: swap front and back face
-          for (unsigned int i = 0; i < 4; ++i)
-            std::swap(cell.vertices[i], cell.vertices[i + 4]);
+          if (use_new_style_ordering)
+            {
+              std::swap(cell.vertices[0], cell.vertices[2]);
+              std::swap(cell.vertices[1], cell.vertices[3]);
+              std::swap(cell.vertices[4], cell.vertices[6]);
+              std::swap(cell.vertices[5], cell.vertices[7]);
+            }
+          else
+            {
+              for (unsigned int i = 0; i < 4; ++i)
+                std::swap(cell.vertices[i], cell.vertices[i + 4]);
+            }
           copy_vertices_to_temp(cell);
 
           // Check whether the resulting cell is now ok.

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.