From 18f44882da402d299d6b229911fae26b690cc484 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 17 Apr 2000 15:54:49 +0000 Subject: [PATCH] Add a way to retrieve the respective grids from an intergrid map, and use this way to assert that the grids are the correct ones in the function compute_intergrid_constraints. git-svn-id: https://svn.dealii.org/trunk@2737 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/intergrid_map.h | 22 +++++++++++++++ deal.II/deal.II/source/dofs/dof_tools.cc | 8 ++++++ deal.II/deal.II/source/grid/intergrid_map.cc | 28 ++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/deal.II/deal.II/include/grid/intergrid_map.h b/deal.II/deal.II/include/grid/intergrid_map.h index bc0bd22ddf..cdd90bd5a3 100644 --- a/deal.II/deal.II/include/grid/intergrid_map.h +++ b/deal.II/deal.II/include/grid/intergrid_map.h @@ -156,6 +156,18 @@ class InterGridMap * Delete all data of this class. */ void clear (); + + /** + * Return a pointer to the source + * grid. + */ + const GridClass & get_source_grid () const; + + /** + * Return a pointer to the + * destination grid. + */ + const GridClass & get_destination_grid () const; /** * Exception @@ -176,6 +188,16 @@ class InterGridMap */ vector > mapping; + /** + * Store a pointer to the source grid. + */ + SmartPointer > source_grid; + + /** + * Likewise for the destination grid. + */ + SmartPointer > destination_grid; + /** * Set the mapping for the pair of * cells given. These shall match diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index e7f1a75753..8562018d88 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -823,6 +823,14 @@ DoFTools::compute_intergrid_constraints (const DoFHandler &coa // test, but better than nothing Assert (coarse_grid.get_tria().n_cells(0) == fine_grid.get_tria().n_cells(0), ExcGridsDontMatch()); + + // check whether the map correlates + // the right objects + Assert (&coarse_to_fine_grid_map.get_source_grid() == &coarse_grid, + ExcGridsDontMatch ()); + Assert (&coarse_to_fine_grid_map.get_destination_grid() == &fine_grid, + ExcGridsDontMatch ()); + // check whether component numbers // are valid diff --git a/deal.II/deal.II/source/grid/intergrid_map.cc b/deal.II/deal.II/source/grid/intergrid_map.cc index cd34c03abe..6c20a2bad7 100644 --- a/deal.II/deal.II/source/grid/intergrid_map.cc +++ b/deal.II/deal.II/source/grid/intergrid_map.cc @@ -56,6 +56,9 @@ void InterGridMap::make_mapping (const GridClass &source_gri // first delete all contents clear (); + // next store pointers to grids + this->source_grid = &source_grid; + this->destination_grid = &destination_grid; // then set up the containers from // scratch and fill them with end-iterators @@ -102,6 +105,7 @@ void InterGridMap::make_mapping (const GridClass &source_gri }; + template