From 8284043c76fee27c840526d84c11db3c921479e4 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 25 Jun 2003 18:43:25 +0000 Subject: [PATCH] Fix one aspect of FETools::extrapolate git-svn-id: https://svn.dealii.org/trunk@7813 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_tools.h | 40 ++++++++++++++++----------- deal.II/deal.II/source/fe/fe_tools.cc | 29 +++++++++++++------ deal.II/doc/news/c-4-0.html | 23 +++++++++++---- 3 files changed, 62 insertions(+), 30 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_tools.h b/deal.II/deal.II/include/fe/fe_tools.h index c10f96cd31..6167cd3375 100644 --- a/deal.II/deal.II/include/fe/fe_tools.h +++ b/deal.II/deal.II/include/fe/fe_tools.h @@ -351,12 +351,20 @@ class FETools * an additional * @p{ConstraintMatrix} argument, * see below. + * + * Since this function operates + * on patches of cells, it is + * required that the underlying + * grid is refined at least once + * for every coarse grid cell. If + * this is not the case, an + * exception will be raised. */ template - static void extrapolate(const DoFHandler& dof1, - const InVector& z1, - const DoFHandler& dof2, - OutVector& z2); + static void extrapolate (const DoFHandler& dof1, + const InVector& z1, + const DoFHandler& dof2, + OutVector& z2); /** * Gives the patchwise @@ -374,18 +382,16 @@ class FETools * elements on grids with hanging * nodes (locally refined grids). * - * This function is interesting - * for e.g. extrapolating - * patchwise a piecewise linear - * solution to a piecewise - * quadratic solution. + * Otherwise, the same holds as + * for the other @p{extrapolate} + * function. */ template - static void extrapolate(const DoFHandler& dof1, - const InVector& z1, - const DoFHandler& dof2, - const ConstraintMatrix& constraints, - OutVector& z2); + static void extrapolate (const DoFHandler& dof1, + const InVector& z1, + const DoFHandler& dof2, + const ConstraintMatrix& constraints, + OutVector& z2); /** * The numbering of the degrees @@ -461,7 +467,6 @@ class FETools * Exception */ DeclException0 (ExcFEMustBePrimitive); - /** * Exception */ @@ -476,7 +481,10 @@ class FETools << "hanging nodes but without providing hanging node " << "constraints. Use the respective function with " << "additional ConstraintMatrix argument(s), instead."); - + /** + * Exception + */ + DeclException0 (ExcGridNotRefinedAtLeastOnce); /** * Exception */ diff --git a/deal.II/deal.II/source/fe/fe_tools.cc b/deal.II/deal.II/source/fe/fe_tools.cc index 815e2f5816..b99d04b73e 100644 --- a/deal.II/deal.II/source/fe/fe_tools.cc +++ b/deal.II/deal.II/source/fe/fe_tools.cc @@ -155,9 +155,9 @@ void FETools::get_back_interpolation_matrix(const FiniteElement &fe1, template -void FETools::get_interpolation_difference_matrix(const FiniteElement &fe1, - const FiniteElement &fe2, - FullMatrix &difference_matrix) +void FETools::get_interpolation_difference_matrix (const FiniteElement &fe1, + const FiniteElement &fe2, + FullMatrix &difference_matrix) { Assert (fe1.n_components() == fe2.n_components(), ExcDimensionMismatch(fe1.n_components(), fe2.n_components())); @@ -354,10 +354,10 @@ void FETools::back_interpolate(const DoFHandler &dof1, template -void FETools::interpolation_difference(const DoFHandler &dof1, - const InVector &u1, - const FiniteElement &fe2, - OutVector &u1_difference) +void FETools::interpolation_difference (const DoFHandler &dof1, + const InVector &u1, + const FiniteElement &fe2, + OutVector &u1_difference) { Assert(dof1.get_fe().n_components() == fe2.n_components(), ExcDimensionMismatch(dof1.get_fe().n_components(), fe2.n_components())); @@ -459,7 +459,20 @@ void FETools::extrapolate(const DoFHandler &dof1, const unsigned int dofs_per_cell = dof2.get_fe().dofs_per_cell; const Triangulation &tria=dof1.get_tria(); Vector dof_values(dofs_per_cell); - + + // make sure that each cell on the + // coarsest level is at least once + // refined. otherwise, we can't + // treat these cells and would + // generate a bogus result + { + typename DoFHandler::cell_iterator cell = dof2.begin(0), + endc = dof2.end(0); + for (; cell!=endc; ++cell) + Assert (cell->has_children(), ExcGridNotRefinedAtLeastOnce()); + } + + // then traverse grid bottom up for (unsigned int level=0; level::cell_iterator cell=dof2.begin(level), diff --git a/deal.II/doc/news/c-4-0.html b/deal.II/doc/news/c-4-0.html index 127517d45f..04ac35fe52 100644 --- a/deal.II/doc/news/c-4-0.html +++ b/deal.II/doc/news/c-4-0.html @@ -14,7 +14,7 @@

This is the list of changes made after the release of -deal.II version ??.??. It is subdivided into changes +deal.II version 4.0. It is subdivided into changes made to the three sub-libraries base, lac, and deal.II, as well as changes to the general infrastructure, @@ -67,12 +67,23 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

deal.II

    +
  1. + Fixed: The FETools::extrapolate + function operates on patches of cells, but didn't check whether + the grid is at least refined once everywhere. If this was not + the case, it would generate wrong results. It now checks for + this, and if the grid has unrefined coarse grid cells, an + exception is generated. +
    + (WB 2002/06/25) +

    +
  2. - Improved: FEFaceValuesBase has a new - function orientation accessing a unique - and consistent orientation for each face. -
    - (GK 2003/06/23) + Improved: FEFaceValuesBase has a new + function orientation accessing a unique + and consistent orientation for each face. +
    + (GK 2003/06/23)

  3. Changed: Embedding and restriction matrices for intergrid transfer are -- 2.39.5