]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix one aspect of FETools::extrapolate
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 25 Jun 2003 18:43:25 +0000 (18:43 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 25 Jun 2003 18:43:25 +0000 (18:43 +0000)
git-svn-id: https://svn.dealii.org/trunk@7813 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe_tools.h
deal.II/deal.II/source/fe/fe_tools.cc
deal.II/doc/news/c-4-0.html

index c10f96cd312b09703a201347b16b31c0d27efa1b..6167cd33752597452d0e78ccdd6594fe2440eb71 100644 (file)
@@ -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 <int dim, class InVector, class OutVector>
-    static void extrapolate(const DoFHandler<dim>& dof1,
-                           const InVector&        z1,
-                           const DoFHandler<dim>& dof2,
-                           OutVector&             z2);    
+    static void extrapolate (const DoFHandler<dim>& dof1,
+                            const InVector&        z1,
+                            const DoFHandler<dim>& 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 <int dim, class InVector, class OutVector>
-    static void extrapolate(const DoFHandler<dim>&  dof1,
-                           const InVector&         z1,
-                           const DoFHandler<dim>&  dof2,
-                           const ConstraintMatrix& constraints,
-                           OutVector&              z2);    
+    static void extrapolate (const DoFHandler<dim>&  dof1,
+                            const InVector&         z1,
+                            const DoFHandler<dim>&  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
                                      */
index 815e2f5816e2c82977d4b58d92464ea9cda27f75..b99d04b73ece0d90807624dc9dbe2067d67b7de6 100644 (file)
@@ -155,9 +155,9 @@ void FETools::get_back_interpolation_matrix(const FiniteElement<dim> &fe1,
 
 
 template <int dim, typename number>
-void FETools::get_interpolation_difference_matrix(const FiniteElement<dim> &fe1,
-                                                 const FiniteElement<dim> &fe2,
-                                                 FullMatrix<number> &difference_matrix)
+void FETools::get_interpolation_difference_matrix (const FiniteElement<dim> &fe1,
+                                                  const FiniteElement<dim> &fe2,
+                                                  FullMatrix<number> &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<dim> &dof1,
 
   
 template <int dim, class InVector, class OutVector>
-void FETools::interpolation_difference(const DoFHandler<dim> &dof1,
-                                      const InVector &u1,
-                                      const FiniteElement<dim> &fe2,
-                                      OutVector &u1_difference)
+void FETools::interpolation_difference (const DoFHandler<dim> &dof1,
+                                       const InVector &u1,
+                                       const FiniteElement<dim> &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<dim> &dof1,
   const unsigned int dofs_per_cell  = dof2.get_fe().dofs_per_cell;
   const Triangulation<dim> &tria=dof1.get_tria();
   Vector<typename OutVector::value_type> 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<dim>::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<tria.n_levels()-1; ++level)
     {
       typename DoFHandler<dim>::cell_iterator cell=dof2.begin(level),
index 127517d45fc2d17c633097bba7d5234acda7181e..04ac35fe5246a45769853c42b742520045ad6263 100644 (file)
@@ -14,7 +14,7 @@
 
 <p>
 This is the list of changes made after the release of 
-<acronym>deal.II</acronym> version ??.??. It is subdivided into changes
+<acronym>deal.II</acronym> version 4.0. It is subdivided into changes
 made to the three sub-libraries <a href="#base">base</a>, 
 <a href="#lac">lac</a>, and <a href="#deal.II">deal.II</a>, as well as
 changes to the <a href="#general">general infrastructure,
@@ -67,12 +67,23 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p> 
+       Fixed: The <code class="member">FETools::extrapolate</code>
+       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.
+       <br>
+       (WB 2002/06/25)
+       </p>
+
   <li> <p>
-  Improved: <code class="class">FEFaceValuesBase</code> has a new
-  function <code class="member">orientation</code> accessing a unique
-  and consistent orientation for each face.
-  <br>
-  (GK 2003/06/23)
+       Improved: <code class="class">FEFaceValuesBase</code> has a new
+       function <code class="member">orientation</code> accessing a unique
+       and consistent orientation for each face.
+       <br> 
+       (GK 2003/06/23)
 
   <li> <p> 
        Changed: Embedding and restriction matrices for intergrid transfer are

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.