[Dune] intersection iterators and ghost elements
Oliver Sander
sander at mi.fu-berlin.de
Fri Nov 20 17:36:03 CET 2009
Dear Dune!
Is it correct that ghost elements do not need to fully implement
intersection
iterators? Is that documented anywhere?
Yours,
Oliver
sander at dune-project.org schrieb:
> Author: sander
> Date: 2009-11-20 17:33:49 +0100 (Fri, 20 Nov 2009)
> New Revision: 5971
>
> Modified:
> trunk/dune/grid/test/test-parallel-ug.cc
> Log:
> Do not test the intersection iterators of ghost elements, as they
> may not be fully implemented.
>
>
> Modified: trunk/dune/grid/test/test-parallel-ug.cc
> ===================================================================
> --- trunk/dune/grid/test/test-parallel-ug.cc 2009-11-20 15:07:01 UTC (rev 5970)
> +++ trunk/dune/grid/test/test-parallel-ug.cc 2009-11-20 16:33:49 UTC (rev 5971)
> @@ -10,6 +10,7 @@
> #include <dune/grid/common/mcmgmapper.hh>
> #include <dune/grid/io/file/vtk/vtkwriter.hh>
> #include <dune/common/mpihelper.hh>
> +#include <dune/grid/common/gridenums.hh>
>
> using namespace Dune;
>
> @@ -114,9 +115,8 @@
> UserDataType &userDataReceive_;
> };
>
> -
> template <class GridView>
> -void checkConsistency(const GridView &gv)
> +void checkIntersections(const GridView &gv)
> {
> typedef typename GridView::template Codim<0>::Entity Element;
> typedef typename GridView::template Codim<0>::Iterator Iterator;
> @@ -124,8 +124,10 @@
>
> Iterator it = gv.template begin<0>();
> const Iterator &endIt = gv.template end<0>();
> -
> + // check the intersections
> for (; it != endIt; ++it) {
> + if (it->partitionType() == Dune::GhostEntity)
> + continue;
>
> IntersectionIterator isIt = gv.ibegin(*it);
> const IntersectionIterator &isEndIt = gv.iend(*it);
> @@ -136,10 +138,17 @@
> if (isIt->neighbor()) {
> isIt->outside();
> }
> +
> ++ n;
> }
>
> - assert(n == 2*GridView::dimension); // quadrilaterals
> + if (n != 2*GridView::dimension)
> + {
> +
> + DUNE_THROW(Dune::InvalidStateException,
> + "Number of faces for non-ghost cell incorrect. Is "
> + << n << " but should be " << 2*GridView::dimension);
> + }
> }
> };
>
> @@ -216,9 +225,8 @@
> {
> std::cout << "Testing communication for codim " << commCodim << " entities\n";
>
> - typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView,
> - LayoutWrapper<commCodim>::template Layout> MapperType;
> -
> + typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, LayoutWrapper<commCodim>::template Layout>
> + MapperType;
> MapperType mapper(gridView);
>
> std::cout << "Index set has " << mapper.size() << " codim " << commCodim << " entities\n";
> @@ -253,8 +261,8 @@
> // communicate the entities at the interior border to all other
> // processes
> gridView.grid().communicate(datahandle,
> - Dune::InteriorBorder_All_Interface,
> - Dune::ForwardCommunication);
> + Dune::InteriorBorder_All_Interface,
> + Dune::ForwardCommunication);
>
> //////////////////////////////////////////////////////
> // Write results to disk
> @@ -332,9 +340,9 @@
> << " edges and " << leafGridView.size(dim)
> << " nodes.\n";
>
> - // iterate over all elements and element intersections
> - checkConsistency(level0GridView);
> - checkConsistency(leafGridView);
> + // some consistency checks for the mappers and the intersections
> + checkIntersections(grid.levelView(0));
> + checkIntersections(grid.leafView());
>
> //////////////////////////////////////////////////////
> // Test element and node communication
> @@ -342,17 +350,19 @@
> testCommunication<typename GridType::LevelGridView, 0>(grid.levelView(0));
> testCommunication<typename GridType::LeafGridView, dim>(grid.leafView());
>
> - // //////////////////////////////////////////////////
> - // Refine globally and test again
> - // //////////////////////////////////////////////////
> -
> + ////////////////////////////////////////////////////
> + // Refine globally and test again
> + ////////////////////////////////////////////////////
> +
> + std::cout << "Global refinement\n";
> grid.globalRefine(1);
>
> - for (int i=0; i<=grid.maxLevel(); i++)
> - checkConsistency(grid.levelView(i));
> + for (int i=0; i<=grid.maxLevel(); i++) {
> + checkIntersections(grid.levelView(i));
> + }
> +
> + checkIntersections(grid.leafView());
>
> - checkConsistency(grid.leafView());
> -
> for (int i=0; i<=grid.maxLevel(); i++)
> testCommunication<typename GridType::LevelGridView, 0>(grid.levelView(i));
> testCommunication<typename GridType::LeafGridView, dim>(grid.leafView());
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
>
--
************************************************************************
* Oliver Sander ** email: sander at mi.fu-berlin.de *
* Freie Universität Berlin ** phone: + 49 (30) 838 75348 *
* Institut für Mathematik ** URL : page.mi.fu-berlin.de/~sander *
* Arnimallee 6 ** -------------------------------------*
* 14195 Berlin, Germany ** Member of MATHEON (www.matheon.de) *
************************************************************************
More information about the Dune
mailing list