[Dune] [Dune-Commit] dune-grid r6593 - releases/2.0/dune/grid/albertagrid/test
Christian Engwer
christi at uni-hd.de
Fri Apr 9 15:02:19 CEST 2010
Thank you! commited...
On Fri, Apr 09, 2010 at 02:07:28PM +0200, Jö Fahlke wrote:
> Am Fri, 9. Apr 2010, 11:30:23 +0200 schrieb Jö Fahlke:
> > I'm going to fix the test such that passing becomes the expected behaviour,
> > and of course I'll improve the message above as well. This way we will notice
> > when someone fiddles with Albertas heuristic again in such a way that the grid
> > tested here does no longer work.
>
> OK, there was already some divergence between 2.0 and the trunk here, making
> it difficult to simply merge from the trunk. Attached is the patch for 2.0,
> I'm going to check in the corresponding fix on the trunk shortly, once I have
> verified it still runs.
>
> Jö.
>
> From 02517dc1f17e86d279047cdaee32afcc58dfdd35 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?J=C3=B6=20Fahlke?= <jorrit at jorrit.de>
> Date: Fri, 9 Apr 2010 12:21:17 +0200
> Subject: [PATCH] Fix the test for 3D refinement in Alberta.
>
> - Output should make it completely clear now what is happening and why.
> - In addition to the 5-triangulated unit cube, also check the 6-triangulated
> unit cube and the unit tetrahedron. The latter is a safety measure: it
> refining the unit tetrahedron results in a segfault, chances are that the
> recursive bisection is *not* the culprit.
> - The test is now expected to pass
> ---
> dune/grid/albertagrid/test/Makefile.am | 2 -
> .../grid/albertagrid/test/test-alberta3d-refine.cc | 97 ++++++++++++++++++--
> 2 files changed, 90 insertions(+), 9 deletions(-)
>
> diff --git a/dune/grid/albertagrid/test/Makefile.am b/dune/grid/albertagrid/test/Makefile.am
> index e582546..64de1dc 100644
> --- a/dune/grid/albertagrid/test/Makefile.am
> +++ b/dune/grid/albertagrid/test/Makefile.am
> @@ -2,7 +2,6 @@ EXTRA_DIST =
> check_PROGRAMS =
>
> TESTS =
> -XFAIL_TESTS =
>
> GRIDDIM=2
>
> @@ -10,7 +9,6 @@ if ALBERTA
> # test program will return the special exit code 77 ("skipped") if alberta is
> # not available
> TESTS += test-alberta3d-refine
> -XFAIL_TESTS += test-alberta3d-refine
> check_PROGRAMS += test-alberta3d-refine
> test_alberta3d_refine_SOURCES = test-alberta3d-refine.cc
> test_alberta3d_refine_CPPFLAGS = $(AM_CPPFLAGS) \
> diff --git a/dune/grid/albertagrid/test/test-alberta3d-refine.cc b/dune/grid/albertagrid/test/test-alberta3d-refine.cc
> index 75655a8..dcce953 100644
> --- a/dune/grid/albertagrid/test/test-alberta3d-refine.cc
> +++ b/dune/grid/albertagrid/test/test-alberta3d-refine.cc
> @@ -19,9 +19,69 @@
> #include <dune/grid/albertagrid/gridfactory.hh>
> #endif
>
> +// single unit tet
> +template<typename Grid>
> +class UnitTetMaker {
> + dune_static_assert(Grid::dimension == 3, "Dimension of grid must be 3");
> + dune_static_assert(Grid::dimensionworld == 3, "Dimension of world must be 3");
> +public:
> + static Dune::shared_ptr<Grid> create() {
> + Dune::GridFactory<Grid> gf;
> +
> + // insert vertices
> + Dune::FieldVector<typename Grid::ctype, 3> pos;
> + pos[0] = 0; pos[1] = 0; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 1; pos[1] = 0; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 0; pos[1] = 1; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 0; pos[1] = 0; pos[2] = 1; gf.insertVertex(pos);
> +
> +
> + // insert elements
> + Dune::GeometryType type; type.makeTetrahedron();
> + std::vector<unsigned int> vid(4);
> + vid[0] = 0; vid[1] = 1; vid[2] = 2; vid[3] = 3; gf.insertElement(type, vid);
> +
> + return Dune::shared_ptr<Grid>(gf.createGrid());
> + }
> +};
> +
> +// kuhn triangulation with 6 tets
> +template<typename Grid>
> +class KuhnTriangulatedUnitCubeMaker {
> + dune_static_assert(Grid::dimension == 3, "Dimension of grid must be 3");
> + dune_static_assert(Grid::dimensionworld == 3, "Dimension of world must be 3");
> +public:
> + static Dune::shared_ptr<Grid> create() {
> + Dune::GridFactory<Grid> gf;
> + Dune::FieldVector<typename Grid::ctype, 3> pos;
> +
> + pos[0] = 0; pos[1] = 0; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 1; pos[1] = 0; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 0; pos[1] = 1; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 1; pos[1] = 1; pos[2] = 0; gf.insertVertex(pos);
> + pos[0] = 0; pos[1] = 0; pos[2] = 1; gf.insertVertex(pos);
> + pos[0] = 1; pos[1] = 0; pos[2] = 1; gf.insertVertex(pos);
> + pos[0] = 0; pos[1] = 1; pos[2] = 1; gf.insertVertex(pos);
> + pos[0] = 1; pos[1] = 1; pos[2] = 1; gf.insertVertex(pos);
> +
> + Dune::GeometryType type;
> + type.makeTetrahedron();
> + std::vector<unsigned int> vid(4);
> +
> + vid[0] = 0; vid[1] = 1; vid[2] = 3; vid[3] = 7; gf.insertElement(type, vid);
> + vid[0] = 0; vid[1] = 2; vid[2] = 3; vid[3] = 7; gf.insertElement(type, vid);
> + vid[0] = 0; vid[1] = 2; vid[2] = 6; vid[3] = 7; gf.insertElement(type, vid);
> + vid[0] = 0; vid[1] = 4; vid[2] = 6; vid[3] = 7; gf.insertElement(type, vid);
> + vid[0] = 0; vid[1] = 4; vid[2] = 5; vid[3] = 7; gf.insertElement(type, vid);
> + vid[0] = 0; vid[1] = 1; vid[2] = 5; vid[3] = 7; gf.insertElement(type, vid);
> +
> + return Dune::shared_ptr<Grid>(gf.createGrid());
> + }
> +};
> +
> // minimal triangulation with 5 tets, contains unit tet
> template<typename Grid>
> -class TriangulatedUnitCubeMaker {
> +class MinTriangulatedUnitCubeMaker {
> dune_static_assert(Grid::dimension == 3, "Dimension of grid must be 3");
> dune_static_assert(Grid::dimensionworld == 3, "Dimension of world must be 3");
> public:
> @@ -71,14 +131,37 @@ int main(int argc, char** argv)
> #error ALBERTA_DIM is not set to 3 -- please check the Makefile.am
> #endif
> {
> - std::cout << "The following stuff is expected to fail currently, because the recursive" << std::endl
> - << "bisection algorithm of alberta will run into an endless recursion for" << std::endl
> - << "certain grids. See Flyspry#569." << std::endl;
> typedef Dune::AlbertaGrid<3, 3> Grid;
> - Dune::shared_ptr<Grid> grid = TriangulatedUnitCubeMaker<Grid>::create();
> - grid->globalRefine(2);
>
> - result = 1;
> + std::cout << "The recursive-bisection refinement algorithm of alberta "
> + << "cannot be used on arbitrary meshes (see Flyspry#569 for a "
> + << "more comprehensive explanation). However, the heuristic "
> + << "used in the GridFactory can be tuned to support certain "
> + << "types of meshes. This test makes sure that meshes that "
> + << "worked at one time in the past continue to work in the "
> + << "future. If a certain mesh does not work, this program "
> + << "will usually generate a segmentation fault.\n"
> + << std::endl;
> +
> + std::cout << "Checking unit tetrahedron..." << std::endl;
> + std::cout << "Note: The unit tetrahdron check is a safety measure. If "
> + << "this test already produces a segfault, the problem is "
> + << "probably not Albertas recursive bisection algorithm but "
> + << "something else." << std::endl;
> + UnitTetMaker<Grid>::create()->globalRefine(2);
> + std::cout << "Checking unit tetrahedron: success\n" << std::endl;
> +
> + std::cout << "Checking 6-triangulation of unit cube..." << std::endl;
> + KuhnTriangulatedUnitCubeMaker<Grid>::create()->globalRefine(2);
> + std::cout << "Checking 6-triangulation of unit cube: success\n"
> + << std::endl;
> +
> + std::cout << "Checking 5-triangulation of unit cube..." << std::endl;
> + MinTriangulatedUnitCubeMaker<Grid>::create()->globalRefine(2);
> + std::cout << "Checking 5-triangulation of unit cube: success\n"
> + << std::endl;
> +
> + result = 0;
> }
> #endif
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
More information about the Dune
mailing list