From 012ae98df03fee6d44e9fd598a8fdd5f465246ff Mon Sep 17 00:00:00 2001 From: "daniel.arndt" Date: Mon, 30 Jun 2014 23:49:21 +0000 Subject: [PATCH] Fixed GridGenerator::merge_triangulations, Issue 197 git-svn-id: https://svn.dealii.org/trunk@33104 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 + deal.II/source/grid/grid_generator.cc | 57 ++++- .../merge_triangulations_02.cc | 0 .../merge_triangulations_02.output | 120 ++++++++++- .../merge_triangulations_03.cc | 0 tests/deal.II/merge_triangulations_03.output | 17 ++ tests/fail/merge_triangulations_03.output | 199 ------------------ 7 files changed, 198 insertions(+), 201 deletions(-) rename tests/{fail => deal.II}/merge_triangulations_02.cc (100%) rename tests/{fail => deal.II}/merge_triangulations_02.output (50%) rename tests/{fail => deal.II}/merge_triangulations_03.cc (100%) create mode 100644 tests/deal.II/merge_triangulations_03.output delete mode 100644 tests/fail/merge_triangulations_03.output diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 95df70da1b..806f960395 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -148,6 +148,12 @@ inconvenience this causes.

Specific improvements

    +
  1. Fixed: GridGenerator::merge_triangulations produced sometimes invalid + orientations of faces. This is now fixed. +
    + (Daniel Arndt, 2014/06/30) +
  2. +
  3. Fixed: TrilinosWrappers::PreconditionAMG did not read user-provided constant modes (aka null space) when the null space dimension is one but not just the trivial one vector. This is now fixed. diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 7595d5612c..5233e55acf 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -44,7 +44,58 @@ DEAL_II_NAMESPACE_OPEN +// anonymous namespace for internal helper functions +namespace +{ + /** + * A set of three functions that + * reorder the data from the + * "current" to the "classic" + * format of vertex numbering of + * cells and faces. These functions + * do the reordering of their + * arguments in-place. + */ + void + reorder_compatibility (const std::vector > &, + const SubCellData &) + { + // nothing to do here: the format + // hasn't changed for 1d + } + + + void + reorder_compatibility (std::vector > &cells, + const SubCellData &) + { + for (unsigned int cell=0; cell > &cells, + SubCellData &subcelldata) + { + unsigned int tmp[GeometryInfo<3>::vertices_per_cell]; + for (unsigned int cell=0; cell::vertices_per_cell; ++i) + tmp[i] = cells[cell].vertices[i]; + for (unsigned int i=0; i::vertices_per_cell; ++i) + cells[cell].vertices[i] = tmp[GeometryInfo<3>::ucd_to_deal[i]]; + } + + // now points in boundary quads + std::vector >::iterator boundary_quad + = subcelldata.boundary_quads.begin(); + std::vector >::iterator end_quad + = subcelldata.boundary_quads.end(); + for (unsigned int quad_no=0; boundary_quad!=end_quad; ++boundary_quad, ++quad_no) + std::swap(boundary_quad->vertices[2], boundary_quad->vertices[3]); + } +} namespace GridGenerator { @@ -3429,8 +3480,12 @@ namespace GridGenerator GridTools::delete_duplicated_vertices (vertices, cells, subcell_data, considered_vertices); + // reorder_cells expects data in the "classic" format, transform + // the cell data before and after the call to that function + reorder_compatibility(cells, subcell_data); + GridReordering::reorder_cells(cells); result.clear (); - result.create_triangulation (vertices, cells, subcell_data); + result.create_triangulation_compatibility (vertices, cells, subcell_data); } diff --git a/tests/fail/merge_triangulations_02.cc b/tests/deal.II/merge_triangulations_02.cc similarity index 100% rename from tests/fail/merge_triangulations_02.cc rename to tests/deal.II/merge_triangulations_02.cc diff --git a/tests/fail/merge_triangulations_02.output b/tests/deal.II/merge_triangulations_02.output similarity index 50% rename from tests/fail/merge_triangulations_02.output rename to tests/deal.II/merge_triangulations_02.output index d871c6b8ed..2cd7f2c411 100644 --- a/tests/fail/merge_triangulations_02.output +++ b/tests/deal.II/merge_triangulations_02.output @@ -1,4 +1,4 @@ -JobId linux-sh2g.site Mon Apr 7 13:28:47 2014 + DEAL::Mesh info: DEAL:: dimension: 2 DEAL:: no. of cells: 8 @@ -119,3 +119,121 @@ DEAL:: boundary indicators: 0(8 times) 1(8 times) 1.0 -3.0 0 0 +DEAL::Mesh info: +DEAL:: dimension: 2 +DEAL:: no. of cells: 16 +DEAL:: boundary indicators: 0(28 times) +0.18 0.18 0 0 +0.25 0.0 0 0 +1.0 0.0 0 0 +1.0 1.0 0 0 +0.18 0.18 0 0 + + +1.5e-17 0.25 0 0 +0.18 0.18 0 0 +1.0 1.0 0 0 +6.1e-17 1.0 0 0 +1.5e-17 0.25 0 0 + + +-0.18 0.18 0 0 +1.5e-17 0.25 0 0 +6.1e-17 1.0 0 0 +-1.0 1.0 0 0 +-0.18 0.18 0 0 + + +-0.25 3.1e-17 0 0 +-0.18 0.18 0 0 +-1.0 1.0 0 0 +-1.0 1.2e-16 0 0 +-0.25 3.1e-17 0 0 + + +-0.18 -0.18 0 0 +-0.25 3.1e-17 0 0 +-1.0 1.2e-16 0 0 +-1.0 -1.0 0 0 +-0.18 -0.18 0 0 + + +-4.6e-17 -0.25 0 0 +-0.18 -0.18 0 0 +-1.0 -1.0 0 0 +-1.8e-16 -1.0 0 0 +-4.6e-17 -0.25 0 0 + + +0.18 -0.18 0 0 +-4.6e-17 -0.25 0 0 +-1.8e-16 -1.0 0 0 +1.0 -1.0 0 0 +0.18 -0.18 0 0 + + +0.25 0.0 0 0 +0.18 -0.18 0 0 +1.0 -1.0 0 0 +1.0 0.0 0 0 +0.25 0.0 0 0 + + +0.18 -1.8 0 0 +0.25 -2.0 0 0 +1.0 -2.0 0 0 +1.0 -1.0 0 0 +0.18 -1.8 0 0 + + +0.18 -1.8 0 0 +1.0 -1.0 0 0 +-1.8e-16 -1.0 0 0 +1.5e-17 -1.8 0 0 +0.18 -1.8 0 0 + + +1.5e-17 -1.8 0 0 +-1.8e-16 -1.0 0 0 +-1.0 -1.0 0 0 +-0.18 -1.8 0 0 +1.5e-17 -1.8 0 0 + + +-0.25 -2.0 0 0 +-0.18 -1.8 0 0 +-1.0 -1.0 0 0 +-1.0 -2.0 0 0 +-0.25 -2.0 0 0 + + +-0.18 -2.2 0 0 +-0.25 -2.0 0 0 +-1.0 -2.0 0 0 +-1.0 -3.0 0 0 +-0.18 -2.2 0 0 + + +-4.6e-17 -2.2 0 0 +-0.18 -2.2 0 0 +-1.0 -3.0 0 0 +-1.8e-16 -3.0 0 0 +-4.6e-17 -2.2 0 0 + + +0.18 -2.2 0 0 +-4.6e-17 -2.2 0 0 +-1.8e-16 -3.0 0 0 +1.0 -3.0 0 0 +0.18 -2.2 0 0 + + +0.25 -2.0 0 0 +0.18 -2.2 0 0 +1.0 -3.0 0 0 +1.0 -2.0 0 0 +0.25 -2.0 0 0 + + +DEAL::Number of active cells: 16 +DEAL::Total number of cells: 16 diff --git a/tests/fail/merge_triangulations_03.cc b/tests/deal.II/merge_triangulations_03.cc similarity index 100% rename from tests/fail/merge_triangulations_03.cc rename to tests/deal.II/merge_triangulations_03.cc diff --git a/tests/deal.II/merge_triangulations_03.output b/tests/deal.II/merge_triangulations_03.output new file mode 100644 index 0000000000..bac9476aff --- /dev/null +++ b/tests/deal.II/merge_triangulations_03.output @@ -0,0 +1,17 @@ + +DEAL::Mesh info for shell.eps: +DEAL:: dimension: 2 +DEAL:: no. of cells: 8 +DEAL:: boundary indicators: 0(8 times) 1(8 times) +DEAL::Mesh info for ball.eps: +DEAL:: dimension: 2 +DEAL:: no. of cells: 20 +DEAL:: boundary indicators: 0(8 times) +DEAL::Mesh info for flat_ball.eps: +DEAL:: dimension: 2 +DEAL:: no. of cells: 20 +DEAL:: boundary indicators: 0(8 times) +DEAL::Mesh info for tria_out.eps: +DEAL:: dimension: 2 +DEAL:: no. of cells: 28 +DEAL:: boundary indicators: 0(8 times) diff --git a/tests/fail/merge_triangulations_03.output b/tests/fail/merge_triangulations_03.output deleted file mode 100644 index 10bee8a32c..0000000000 --- a/tests/fail/merge_triangulations_03.output +++ /dev/null @@ -1,199 +0,0 @@ - -0.0 0.0 0 0 -1.0 0.0 0 0 -1.0 1.0 0 0 -0.0 1.0 0 0 -0.0 0.0 0 0 - - -2.0 0.0 0 0 -3.0 0.0 0 0 -3.0 1.0 0 0 -2.0 1.0 0 0 -2.0 0.0 0 0 - - -DEAL:: Total number of cells = 2 -DEAL:: Total number of vertices = 8 -0.0 0.0 0.0 0 0 -1.0 0.0 0.0 0 0 -1.0 0.0 1.0 0 0 -0.0 0.0 1.0 0 0 -0.0 0.0 0.0 0 0 - -0.0 1.0 0.0 0 0 -1.0 1.0 0.0 0 0 -1.0 1.0 1.0 0 0 -0.0 1.0 1.0 0 0 -0.0 1.0 0.0 0 0 - -0.0 0.0 0.0 0 0 -0.0 1.0 0.0 0 0 - -1.0 0.0 0.0 0 0 -1.0 1.0 0.0 0 0 - -1.0 0.0 1.0 0 0 -1.0 1.0 1.0 0 0 - -0.0 0.0 1.0 0 0 -0.0 1.0 1.0 0 0 - -2.0 0.0 0.0 0 0 -3.0 0.0 0.0 0 0 -3.0 0.0 1.0 0 0 -2.0 0.0 1.0 0 0 -2.0 0.0 0.0 0 0 - -2.0 1.0 0.0 0 0 -3.0 1.0 0.0 0 0 -3.0 1.0 1.0 0 0 -2.0 1.0 1.0 0 0 -2.0 1.0 0.0 0 0 - -2.0 0.0 0.0 0 0 -2.0 1.0 0.0 0 0 - -3.0 0.0 0.0 0 0 -3.0 1.0 0.0 0 0 - -3.0 0.0 1.0 0 0 -3.0 1.0 1.0 0 0 - -2.0 0.0 1.0 0 0 -2.0 1.0 1.0 0 0 - -DEAL:: Total number of cells = 2 -DEAL:: Total number of vertices = 16 -0.0 0.0 0 0 -1.0 0.0 0 0 -1.0 1.0 0 0 -0.0 1.0 0 0 -0.0 0.0 0 0 - - -1.0 0.0 0 0 -2.0 0.0 0 0 -2.0 1.0 0 0 -1.0 1.0 0 0 -1.0 0.0 0 0 - - -DEAL:: Total number of cells = 2 -DEAL:: Total number of vertices = 6 -0.0 0.0 0.0 0 0 -1.0 0.0 0.0 0 0 -1.0 0.0 1.0 0 0 -0.0 0.0 1.0 0 0 -0.0 0.0 0.0 0 0 - -0.0 1.0 0.0 0 0 -1.0 1.0 0.0 0 0 -1.0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 1.0 0 0 -2.0 1.0 1.0 0 0 -2.0 1.0 2.0 0 0 -1.0 1.0 2.0 0 0 -1.0 1.0 1.0 0 0 - -1.0 2.0 1.0 0 0 -2.0 2.0 1.0 0 0 -2.0 2.0 2.0 0 0 -1.0 2.0 2.0 0 0 -1.0 2.0 1.0 0 0 - -1.0 1.0 1.0 0 0 -1.0 2.0 1.0 0 0 - -2.0 1.0 1.0 0 0 -2.0 2.0 1.0 0 0 - -2.0 1.0 2.0 0 0 -2.0 2.0 2.0 0 0 - -1.0 1.0 2.0 0 0 -1.0 2.0 2.0 0 0 - -DEAL:: Total number of cells = 2 -DEAL:: Total number of vertices = 15 -- 2.39.5