From: Daniel Arndt Date: Mon, 30 Jun 2014 23:49:21 +0000 (+0000) Subject: Fixed GridGenerator::merge_triangulations, Issue 197 X-Git-Tag: v8.2.0-rc1~344 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a1099389ac379024f8e908cbbb465e2c1373957;p=dealii.git Fixed GridGenerator::merge_triangulations, Issue 197 git-svn-id: https://svn.dealii.org/trunk@33104 0785d39b-7218-0410-832d-ea1e28bc413d --- 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/deal.II/merge_triangulations_02.output b/tests/deal.II/merge_triangulations_02.output new file mode 100644 index 0000000000..2cd7f2c411 --- /dev/null +++ b/tests/deal.II/merge_triangulations_02.output @@ -0,0 +1,239 @@ + +DEAL::Mesh info: +DEAL:: dimension: 2 +DEAL:: no. of cells: 8 +DEAL:: boundary indicators: 0(8 times) 1(8 times) +1.0 0.0 0 0 +1.0 1.0 0 0 +0.18 0.18 0 0 +0.25 0.0 0 0 +1.0 0.0 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.0 1.0 0 0 + + +6.1e-17 1.0 0 0 +-1.0 1.0 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 +-1.0 1.2e-16 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 +-1.0 -1.0 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 +-1.8e-16 -1.0 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 +1.0 -1.0 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 +1.0 0.0 0 0 +0.25 0.0 0 0 +0.18 -0.18 0 0 +1.0 -1.0 0 0 + + +DEAL::Mesh info: +DEAL:: dimension: 2 +DEAL:: no. of cells: 8 +DEAL:: boundary indicators: 0(8 times) 1(8 times) +1.0 -2.0 0 0 +1.0 -1.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 +6.1e-17 -1.0 0 0 +1.5e-17 -1.8 0 0 +0.18 -1.8 0 0 +1.0 -1.0 0 0 + + +6.1e-17 -1.0 0 0 +-1.0 -1.0 0 0 +-0.18 -1.8 0 0 +1.5e-17 -1.8 0 0 +6.1e-17 -1.0 0 0 + + +-1.0 -1.0 0 0 +-1.0 -2.0 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 +-1.0 -3.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 +-1.8e-16 -3.0 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 +1.0 -3.0 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 +1.0 -2.0 0 0 +0.25 -2.0 0 0 +0.18 -2.2 0 0 +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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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)