]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
use a boolean vector for the restriction_is_additive_flags to make it work also for...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 14:45:05 +0000 (14:45 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 14:45:05 +0000 (14:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@1659 0785d39b-7218-0410-832d-ea1e28bc413d

13 files changed:
deal.II/deal.II/include/fe/fe.h
deal.II/deal.II/include/fe/fe_system.h
deal.II/deal.II/include/fe/q1_mapping.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/fe/fe.cc
deal.II/deal.II/source/fe/fe_lib.criss_cross.cc
deal.II/deal.II/source/fe/fe_lib.cubic.cc
deal.II/deal.II/source/fe/fe_lib.dg.constant.cc
deal.II/deal.II/source/fe/fe_lib.linear.cc
deal.II/deal.II/source/fe/fe_lib.quadratic.cc
deal.II/deal.II/source/fe/fe_lib.quartic.cc
deal.II/deal.II/source/fe/fe_system.cc
deal.II/deal.II/source/fe/q1_mapping.cc

index c2390ec97bb063397fdb2b04939731cb269a481d..7e8062fd4ea3aac83438fcbc796531dcc51160c8 100644 (file)
@@ -105,103 +105,6 @@ class FiniteElementData
                                      */
     const unsigned int n_components;
 
-                                    /**
-                                     * This flag determines how the restriction
-                                     * of data from child cells to its mother
-                                     * is to be done. In this, it also
-                                     * determines in which way the restriction
-                                     * matrices of the derived class are to
-                                     * be used.
-                                     *
-                                     * For most elements, the mode is the
-                                     * following. Consider a 1d linear element,
-                                     * with two children and nodal values
-                                     * 1 and 2 on the first child, and 2 and 4
-                                     * on the second child. The restriction
-                                     * to the mother child then yields the
-                                     * values 1 and four, i.e. the values on
-                                     * the mother cell can be obtained by
-                                     * pointwise interpolation, where for each
-                                     * nodal value on the mother child one
-                                     * point on exactly one child exists.
-                                     * However, already on the quadratic
-                                     * element, the midpoint on the mother
-                                     * element can be obtained from any of
-                                     * the two children, which however would
-                                     * both yield the same value due to
-                                     * continuity. What we do in practice
-                                     * is to compute them from both sides
-                                     * and set them, rather than add them up.
-                                     * This makes some things much easier. In
-                                     * practice, if a degree of freedom on
-                                     * one of the child cells yields a
-                                     * nonzero contribution to one of the
-                                     * degrees of freedom on the mother
-                                     * cell, we overwrite the value on
-                                     * the mother cell. This way, when setting
-                                     * up the restriction matrices, we do not
-                                     * have to track which child is responsible
-                                     * for setting a given value on the mother
-                                     * cell. We call this the non-additive
-                                     * mode.
-                                     *
-                                     * The other possibility would be to
-                                     * add up the contributions from the
-                                     * different children. This would mean
-                                     * that both of the inner endpoint of
-                                     * the quadratic child elements above
-                                     * would have a weight of 1/2 with
-                                     * respect to the midpoint value on
-                                     * the mother cell. However, this also
-                                     * means that we have to first compute
-                                     * the restriction to the mother cell
-                                     * by addition from the child cells, and
-                                     * afterwards set them to the global
-                                     * vector. The same process, adding
-                                     * up the local contributions to the
-                                     * global vector is not possible since
-                                     * we do not know how many coarse cells
-                                     * contribute to nodes on the boundary.
-                                     *
-                                     * In contrast to the non-additive mode
-                                     * described above, which is the simplest
-                                     * way for elements can be interpolated
-                                     * from its children, interpolation is
-                                     * not possible for piecewise constant
-                                     * elements, to name only one example.
-                                     * Here, the value on the mother cell
-                                     * has to be taken the average of the
-                                     * values on the children, i.e. all
-                                     * children contribute alike to the
-                                     * one degree of freedom. Here, we have
-                                     * to sum up the contributions of all
-                                     * child cells with the same weight,
-                                     * and the non-additive mode of above
-                                     * would only set the value on the mother
-                                     * cell to the value of one of the child
-                                     * cell, irrespective of the values on the
-                                     * other cells.
-                                     *
-                                     * Similarly, for discontinuous linear
-                                     * elements, it might be better to not
-                                     * interpolate the values at the corners
-                                     * from the child cells, but to take a
-                                     * better average, for example
-                                     * interpolating at the centers of the
-                                     * child cells; in that case, the
-                                     * contributions of the child cells
-                                     * have to be additive as well.
-                                     *
-                                     * Given these notes, the flag under
-                                     * consideration has to be set to #false#
-                                     * for the usual continuous Lagrange
-                                     * elements, and #true# for the other
-                                     * cases mentioned above. The main function
-                                     * where it is used is
-                                     * #DoFAccessor::get_interpolated_dof_values#.
-                                     */
-    const bool restriction_is_additive;
-    
                                     /**
                                      * Default constructor. Constructs
                                      * an element
@@ -218,8 +121,7 @@ class FiniteElementData
     FiniteElementData (const unsigned int dofs_per_vertex,
                       const unsigned int dofs_per_line,
                       const unsigned int n_transform_functions,
-                      const unsigned int n_components,
-                      const bool restriction_is_additive);
+                      const unsigned int n_components);
 
                                     /**
                                      * Constructor for a 2-dimensional
@@ -229,8 +131,7 @@ class FiniteElementData
                       const unsigned int dofs_per_line,
                       const unsigned int dofs_per_quad,
                       const unsigned int n_transform_functions,
-                      const unsigned int n_components,
-                      const bool restriction_is_additive);
+                      const unsigned int n_components);
 
                                     /**
                                      * Constructor for a 3-dimensional
@@ -241,8 +142,7 @@ class FiniteElementData
                       const unsigned int dofs_per_quad,
                       const unsigned int dofs_per_hex,
                       const unsigned int n_transform_functions,
-                      const unsigned int n_components,
-                      const bool restriction_is_additive);
+                      const unsigned int n_components);
 
                                     /**
                                      * Declare this destructor virtual in
@@ -300,7 +200,8 @@ class FiniteElementBase : public Subscriptor,
                                      * matrices explicitely after calling
                                      * this base class' constructor.
                                      */
-    FiniteElementBase (const FiniteElementData<dim> &fe_data);
+    FiniteElementBase (const FiniteElementData<dim> &fe_data,
+                      const vector<bool> &restriction_is_additive_flags);
     
                                     /**
                                      * Return a readonly reference to the
@@ -392,7 +293,13 @@ class FiniteElementBase : public Subscriptor,
                                      * element.
                                      */
     unsigned int component_to_base(unsigned int index) const;
-    
+
+                                    /**
+                                     * Access the #restriction_is_additive_flag#
+                                     * field. See there for more information on 
+                                     * its contents.
+                                     */
+    bool restriction_is_additive (const unsigned int component) const;
 
                                     /**
                                      * Exception
@@ -596,6 +503,104 @@ class FiniteElementBase : public Subscriptor,
                                      * element.
                                      */
     vector<unsigned int> component_to_base_table;
+
+                                    /**
+                                     * This flag determines how the restriction
+                                     * of data from child cells to its mother
+                                     * is to be done. In this, it also
+                                     * determines in which way the restriction
+                                     * matrices of the derived class are to
+                                     * be used.
+                                     *
+                                     * For most elements, the mode is the
+                                     * following. Consider a 1d linear element,
+                                     * with two children and nodal values
+                                     * 1 and 2 on the first child, and 2 and 4
+                                     * on the second child. The restriction
+                                     * to the mother child then yields the
+                                     * values 1 and four, i.e. the values on
+                                     * the mother cell can be obtained by
+                                     * pointwise interpolation, where for each
+                                     * nodal value on the mother child one
+                                     * point on exactly one child exists.
+                                     * However, already on the quadratic
+                                     * element, the midpoint on the mother
+                                     * element can be obtained from any of
+                                     * the two children, which however would
+                                     * both yield the same value due to
+                                     * continuity. What we do in practice
+                                     * is to compute them from both sides
+                                     * and set them, rather than add them up.
+                                     * This makes some things much easier. In
+                                     * practice, if a degree of freedom on
+                                     * one of the child cells yields a
+                                     * nonzero contribution to one of the
+                                     * degrees of freedom on the mother
+                                     * cell, we overwrite the value on
+                                     * the mother cell. This way, when setting
+                                     * up the restriction matrices, we do not
+                                     * have to track which child is responsible
+                                     * for setting a given value on the mother
+                                     * cell. We call this the non-additive
+                                     * mode.
+                                     *
+                                     * The other possibility would be to
+                                     * add up the contributions from the
+                                     * different children. This would mean
+                                     * that both of the inner endpoint of
+                                     * the quadratic child elements above
+                                     * would have a weight of 1/2 with
+                                     * respect to the midpoint value on
+                                     * the mother cell. However, this also
+                                     * means that we have to first compute
+                                     * the restriction to the mother cell
+                                     * by addition from the child cells, and
+                                     * afterwards set them to the global
+                                     * vector. The same process, adding
+                                     * up the local contributions to the
+                                     * global vector is not possible since
+                                     * we do not know how many coarse cells
+                                     * contribute to nodes on the boundary.
+                                     *
+                                     * In contrast to the non-additive mode
+                                     * described above, which is the simplest
+                                     * way for elements can be interpolated
+                                     * from its children, interpolation is
+                                     * not possible for piecewise constant
+                                     * elements, to name only one example.
+                                     * Here, the value on the mother cell
+                                     * has to be taken the average of the
+                                     * values on the children, i.e. all
+                                     * children contribute alike to the
+                                     * one degree of freedom. Here, we have
+                                     * to sum up the contributions of all
+                                     * child cells with the same weight,
+                                     * and the non-additive mode of above
+                                     * would only set the value on the mother
+                                     * cell to the value of one of the child
+                                     * cell, irrespective of the values on the
+                                     * other cells.
+                                     *
+                                     * Similarly, for discontinuous linear
+                                     * elements, it might be better to not
+                                     * interpolate the values at the corners
+                                     * from the child cells, but to take a
+                                     * better average, for example
+                                     * interpolating at the centers of the
+                                     * child cells; in that case, the
+                                     * contributions of the child cells
+                                     * have to be additive as well.
+                                     *
+                                     * Given these notes, the flag under
+                                     * consideration has to be set to #false#
+                                     * for the usual continuous Lagrange
+                                     * elements, and #true# for the other
+                                     * cases mentioned above. The main function
+                                     * where it is used is
+                                     * #DoFAccessor::get_interpolated_dof_values#.
+                                     * There is one flag per component.
+                                     */
+    const vector<bool> restriction_is_additive_flags;    
 };
 
 
@@ -897,7 +902,8 @@ class FiniteElement : public FiniteElementBase<dim>
                                     /**
                                      * Constructor
                                      */
-    FiniteElement (const FiniteElementData<dim> &fe_data);
+    FiniteElement (const FiniteElementData<dim> &fe_data,
+                  const vector<bool> restriction_is_additive_flags);
 
                                     /**
                                      * Destructor. Only declared to have a
@@ -1619,6 +1625,17 @@ FiniteElementBase<dim>::component_to_base (unsigned int index) const
   return component_to_base_table[index];
 }
 
+template <int dim>
+inline
+bool
+FiniteElementBase<dim>::restriction_is_additive (const unsigned int component) const
+{
+  Assert(component<n_components,
+        ExcIndexRange(component, 0, n_components));
+  return restriction_is_additive_flags[component];
+}
+
+
 /*----------------------------   fe.h     ---------------------------*/
 /* end of #ifndef __fe_H */
 #endif
index d447286a52d75b0cf5a92cca550d38e1dd279229..4a2b58908a5a9043e0093c8d1c215995e938c166 100644 (file)
@@ -443,6 +443,40 @@ class FESystem : public FiniteElement<dim>
                          const FiniteElementData<dim> &fe3,
                          const unsigned int            N3);
 
+   
+                                    /**
+                                     * Helper function used in the constructor:
+                                     * takes a #FiniteElement# object
+                                     * and returns an boolean vector including
+                                     * the #restriction_is_additive_flags# of
+                                     * the mixed element consisting of #N#
+                                     * elements of the sub-element #fe#.
+                                     */
+    static vector<bool>
+    compute_restriction_is_additive_flags (const FiniteElement<dim> &fe,
+                                          const unsigned int        N);
+                                    /**
+                                     * Same as above for mixed elements
+                                     * with two different sub-elements.
+                                     */
+    static vector<bool>
+    compute_restriction_is_additive_flags (const FiniteElement<dim> &fe1,
+                                          const unsigned int        N1,
+                                          const FiniteElement<dim> &fe2,
+                                          const unsigned int        N2);
+
+                                    /**
+                                     * Same as above for mixed elements
+                                     * with three different sub-elements.
+                                     */
+    static vector<bool>
+    compute_restriction_is_additive_flags (const FiniteElement<dim> &fe1,
+                                          const unsigned int        N1,
+                                          const FiniteElement<dim> &fe2,
+                                          const unsigned int        N2,
+                                          const FiniteElement<dim> &fe3,
+                                          const unsigned int        N3);
+    
                                     /**
                                      * This function is simply singled out of
                                      * the constructor. It sets up the
@@ -494,32 +528,11 @@ FESystem<dim>::n_base_elements() const
 
 
 
-template<int dim>
-inline unsigned int
-FESystem<dim>::element_multiplicity(unsigned int index) const
-{
-  Assert (index < base_elements.size(), 
-         ExcIndexRange(index, 0, base_elements.size()));
-  return base_elements[index].second;
-}
-
-
-
-template <int dim>
-inline const FiniteElement<dim>&
-FESystem<dim>::base_element(unsigned int index) const
-{
-  Assert (index < base_elements.size(), 
-         ExcIndexRange(index, 0, base_elements.size()));
-  return *base_elements[index].first;
-}
-
-
-
 template <int dim>
 template <class FE>
 FESystem<dim>::FESystem (const FE &fe, const unsigned int n_elements) :
-               FiniteElement<dim> (multiply_dof_numbers(fe, n_elements)),
+               FiniteElement<dim> (multiply_dof_numbers(fe, n_elements),
+                                   compute_restriction_is_additive_flags (fe, n_elements)),
                base_elements(1)
 {
   base_elements[0] = ElementPair(new FE, n_elements);
@@ -534,7 +547,9 @@ template <class FE1, class FE2>
 FESystem<dim>::FESystem (const FE1 &fe1, const unsigned int n1,
                         const FE2 &fe2, const unsigned int n2)
                :
-               FiniteElement<dim> (multiply_dof_numbers(fe1, n1, fe2, n2)),
+               FiniteElement<dim> (multiply_dof_numbers(fe1, n1, fe2, n2),
+                                   compute_restriction_is_additive_flags (fe1, n1,
+                                                                          fe2, n2)),
                base_elements(2)
 {
   Assert(fe1.n_transform_functions == fe2.n_transform_functions,
@@ -557,7 +572,10 @@ FESystem<dim>::FESystem (const FE1 &fe1, const unsigned int n1,
                :
                FiniteElement<dim> (multiply_dof_numbers(fe1, n1,
                                                         fe2, n2,
-                                                        fe3, n3)),
+                                                        fe3, n3),
+                                   compute_restriction_is_additive_flags (fe1, n1,
+                                                                          fe2, n2,
+                                                                          fe3, n3)),
                base_elements(3)
 {
   Assert(fe1.n_transform_functions == fe2.n_transform_functions,
@@ -576,6 +594,31 @@ FESystem<dim>::FESystem (const FE1 &fe1, const unsigned int n1,
 
 
 
+template<int dim>
+inline unsigned int
+FESystem<dim>::element_multiplicity(unsigned int index) const
+{
+  Assert (index < base_elements.size(), 
+         ExcIndexRange(index, 0, base_elements.size()));
+  return base_elements[index].second;
+}
+
+
+
+template <int dim>
+inline const FiniteElement<dim>&
+FESystem<dim>::base_element(unsigned int index) const
+{
+  Assert (index < base_elements.size(), 
+         ExcIndexRange(index, 0, base_elements.size()));
+  return *base_elements[index].first;
+}
+
+
+
+
+
+
 
 /*----------------------------  fe_lib.system.h  ---------------------------*/
 /* end of #ifndef __fe_system_H */
index e0638265a13dd0a4a5bcd1cc87886b258e97cc31..2b88ab4cb8d7c26e7d1735e7344991a489db76c4 100644 (file)
@@ -32,10 +32,10 @@ class FEQ1Mapping : public FiniteElement<dim>
                                      */
     FEQ1Mapping (const unsigned int dofs_per_vertex,
                 const unsigned int dofs_per_line,
-                const unsigned int dofs_per_quad  =0,
-                const unsigned int dofs_per_hex   =0,
-                const unsigned int n_components   =1,
-                const bool restriction_is_additive=false);
+                const unsigned int dofs_per_quad,
+                const unsigned int dofs_per_hex,
+                const unsigned int n_components,
+                const vector<bool> restriction_is_additive_flags);
 
                                     /**
                                      * Return the value of the #i#th shape
index bf8a635ce67e665fb1ecc4112cd6e8b486bc5ce1..b39d07b7fb5172097c0e44ecb8667c3a71773fc0 100644 (file)
@@ -680,9 +680,6 @@ DoFCellAccessor<dim>::get_interpolated_dof_values (const Vector<number> &values,
       
       interpolated_values.clear ();
 
-      const bool restriction_is_additive 
-       = dof_handler->get_fe().restriction_is_additive;
-
       for (unsigned int child=0; child<GeometryInfo<dim>::children_per_cell;
           ++child)
        {
@@ -702,18 +699,18 @@ DoFCellAccessor<dim>::get_interpolated_dof_values (const Vector<number> &values,
                                           // end in adding up the contribution
                                           // from nodes on boundaries of
                                           // children more than once.
-         if (restriction_is_additive) 
+         for (unsigned int i=0; i<total_dofs; ++i)
            {
-             for (unsigned int i=0; i<total_dofs; ++i)
+             const unsigned int component
+               = dof_handler->get_fe().system_to_component_index(i).first;
+         
+             if (dof_handler->get_fe().restriction_is_additive(component)) 
                interpolated_values(i) += tmp2(i);
-           } 
-         else
-           {  
-             for (unsigned int i=0; i<total_dofs; ++i)
+             else
                if (tmp2(i) != 0)
                  interpolated_values(i) = tmp2(i);
-           };
-       };
+           } 
+       }
     };
 };
 
index a84a261f7ec26a8c8970fbc6afc55a41e5bc8091..57838c5d31edc1ab005bda47772215aaa223be67 100644 (file)
@@ -28,8 +28,7 @@ FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                           const unsigned int dofs_per_quad,
                                           const unsigned int dofs_per_hex,
                                           const unsigned int n_transform_functions,
-                                          const unsigned int n_components,
-                                          const bool restriction_is_additive) :
+                                          const unsigned int n_components) :
                dofs_per_vertex(dofs_per_vertex),
                dofs_per_line(dofs_per_line),
                dofs_per_quad(dofs_per_quad),
@@ -52,8 +51,7 @@ FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                      * dofs_per_line),
                total_dofs (first_hex_index+dofs_per_hex),
                n_transform_functions (n_transform_functions),
-               n_components(n_components),
-               restriction_is_additive(restriction_is_additive)
+               n_components(n_components)
 {
   Assert(dim==3, ExcDimensionMismatch(3,dim));
 };
@@ -65,8 +63,7 @@ FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                           const unsigned int dofs_per_line,
                                           const unsigned int dofs_per_quad,
                                           const unsigned int n_transform_functions,
-                                          const unsigned int n_components,
-                                          const bool restriction_is_additive) :
+                                          const unsigned int n_components) :
                dofs_per_vertex(dofs_per_vertex),
                dofs_per_line(dofs_per_line),
                dofs_per_quad(dofs_per_quad),
@@ -85,8 +82,7 @@ FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                      * dofs_per_line),
                total_dofs (first_quad_index+dofs_per_quad),
                n_transform_functions (n_transform_functions),
-               n_components(n_components),
-               restriction_is_additive(restriction_is_additive)
+               n_components(n_components)
 {
   Assert(dim==2, ExcDimensionMismatch(2,dim));
 };
@@ -97,8 +93,7 @@ template <int dim>
 FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                           const unsigned int dofs_per_line,
                                           const unsigned int n_transform_functions,
-                                          const unsigned int n_components,
-                                          const bool restriction_is_additive) :
+                                          const unsigned int n_components) :
                dofs_per_vertex(dofs_per_vertex),
                dofs_per_line(dofs_per_line),
                dofs_per_quad(0),
@@ -116,8 +111,7 @@ FiniteElementData<dim>::FiniteElementData (const unsigned int dofs_per_vertex,
                                      * dofs_per_line),
                total_dofs (first_line_index+dofs_per_line),
                n_transform_functions (n_transform_functions),
-               n_components(n_components),
-               restriction_is_additive(restriction_is_additive)
+               n_components(n_components)
 {
   Assert(dim==1, ExcDimensionMismatch(1,dim));
 };
@@ -139,8 +133,7 @@ bool FiniteElementData<dim>::operator== (const FiniteElementData<dim> &f) const
          (dofs_per_quad == f.dofs_per_quad) &&
          (dofs_per_hex == f.dofs_per_hex) &&
          (n_transform_functions == f.n_transform_functions) &&
-         (n_components == f.n_components) &&
-         (restriction_is_additive == f.restriction_is_additive));
+         (n_components == f.n_components));
 };
 
 
@@ -150,14 +143,19 @@ bool FiniteElementData<dim>::operator== (const FiniteElementData<dim> &f) const
 
 
 template <int dim>
-FiniteElementBase<dim>::FiniteElementBase (const FiniteElementData<dim> &fe_data) :
+FiniteElementBase<dim>::FiniteElementBase (const FiniteElementData<dim> &fe_data,
+                                          const vector<bool> &restriction_is_additive_flags) :
                FiniteElementData<dim> (fe_data),
                system_to_component_table(total_dofs),
                face_system_to_component_table(dofs_per_face),
                component_to_system_table(n_components, vector<unsigned>(total_dofs)),
                face_component_to_system_table(n_components, vector<unsigned>(dofs_per_face)),
-               component_to_base_table(n_components)
+               component_to_base_table(n_components),
+               restriction_is_additive_flags(restriction_is_additive_flags)
 {
+  Assert(restriction_is_additive_flags.size()==fe_data.n_components,
+        ExcWrongFieldDimension(restriction_is_additive_flags.size(),fe_data.n_components));
+
   for (unsigned int i=0; i<GeometryInfo<dim>::children_per_cell; ++i) 
     {
       restriction[i].reinit (total_dofs, total_dofs);
@@ -250,14 +248,14 @@ bool FiniteElementBase<dim>::operator == (const FiniteElementBase<dim> &f) const
 
 
 
-
-
 /*------------------------------- FiniteElement ----------------------*/
 
 
 template <int dim>
-FiniteElement<dim>::FiniteElement (const FiniteElementData<dim> &fe_data) :
-               FiniteElementBase<dim> (fe_data) {};
+FiniteElement<dim>::FiniteElement (const FiniteElementData<dim> &fe_data,
+                                  const vector<bool> restriction_is_additive_flags) :
+               FiniteElementBase<dim> (fe_data,
+                                       restriction_is_additive_flags) {};
 
 #if deal_II_dimension == 1
 
index b8fab956ffcdbf4e37e2412aa716185cbdd90d08..53238f07637a2cd03ceecabf6cd33c06eaca7631 100644 (file)
 template <>
 FECrissCross<1>::FECrissCross () :
                                   // set more or less invalid data
-               FiniteElement<1> (FiniteElementData<1> (0,0,0,0))
+               FiniteElement<1> (FiniteElementData<1> (0,0,0,0),
+                                 vector<bool>())
 {
   Assert (false, ExcNotUseful());
 };
@@ -458,7 +459,8 @@ void FECrissCross<1>::fill_fe_values (const DoFHandler<1>::cell_iterator &,
 
 template <>
 FECrissCross<2>::FECrissCross () :
-               FiniteElement<2> (FiniteElementData<2> (1,0,1,5,1))
+               FiniteElement<2> (FiniteElementData<2> (1,0,1,5,1),
+                                 vector<bool> (1, false))
 {
   interface_constraints(0,0) = 1./2.;
   interface_constraints(0,1) = 1./2.;
index 9c852bc5f43838cdb1f59b4468f675be33e05b93..8a99f20dc90dd0054f21ad1ca158a871295a4f6d 100644 (file)
@@ -21,7 +21,8 @@ template <> void FEQ3<deal_II_dimension>::initialize_matrices ();
 
 template <>
 FEQ3<1>::FEQ3 () :
-               FEQ1Mapping<1> (1, 2) {
+               FEQ1Mapping<1> (1, 2, 0, 0, 1,
+                               vector<bool> (1, false)) {
   initialize_matrices ();
 };
 
@@ -29,7 +30,8 @@ FEQ3<1>::FEQ3 () :
 
 template <>
 FEQ3<1>::FEQ3 (const int) :
-               FEQ1Mapping<1> (0, 4)
+               FEQ1Mapping<1> (0, 4, 0, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -240,7 +242,8 @@ void FEQ3<1>::get_local_mass_matrix (const DoFHandler<1>::cell_iterator &cell,
 
 template <>
 FEQ3<2>::FEQ3 () :
-               FEQ1Mapping<2> (1, 2, 4)
+               FEQ1Mapping<2> (1, 2, 4, 0, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,0) = -1.0/16.0;
   interface_constraints(0,1) = -1.0/16.0;
@@ -264,7 +267,8 @@ FEQ3<2>::FEQ3 () :
 
 template <>
 FEQ3<2>::FEQ3 (const int) :
-               FEQ1Mapping<2> (0, 0, 16)
+               FEQ1Mapping<2> (0, 0, 16, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -1603,7 +1607,8 @@ void FEQ3<2>::get_face_support_points (const DoFHandler<2>::face_iterator &face,
 
 template <>
 FEQ3<3>::FEQ3 () :
-               FEQ1Mapping<3> (1, 2, 4, 8)
+               FEQ1Mapping<3> (1, 2, 4, 8, 1,
+                               vector<bool> (1, false))
 {
       interface_constraints(0,0) = 1.0/256.0;
       interface_constraints(0,1) = 1.0/256.0;
@@ -1865,7 +1870,8 @@ FEQ3<3>::FEQ3 () :
 
 template <>
 FEQ3<3>::FEQ3 (const int) :
-               FEQ1Mapping<3> (0, 0, 0, 64)
+               FEQ1Mapping<3> (0, 0, 0, 64, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
index 912999ee60abc0487988f871ebb344cb522a9726..a9d8810202d6134c2886a31ef79aaeeba13f9117 100644 (file)
@@ -18,7 +18,7 @@ FEDG_Q0<dim>::FEDG_Q0 () :
                                  (dim==2 ? 1 : 0),
                                  (dim==3 ? 1 : 0),
                                  1,
-                                 true)
+                                 vector<bool> (1, true))
 {
   for (unsigned int i=0; i<GeometryInfo<dim>::children_per_cell; ++i)
     { 
index aa22e9440424e1546983f5358137881f1fadfa65..4778488d2ec5089fb2e409daeff1c23bd45733a8 100644 (file)
@@ -22,7 +22,8 @@ template <> void FEQ1<deal_II_dimension>::initialize_matrices ();
 
 template <>
 FEQ1<1>::FEQ1 () :
-               FEQ1Mapping<1> (1, 0)
+               FEQ1Mapping<1> (1, 0, 0, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -30,7 +31,8 @@ FEQ1<1>::FEQ1 () :
 
 template <>
 FEQ1<1>::FEQ1 (const int) :
-               FEQ1Mapping<1> (0, 2)
+               FEQ1Mapping<1> (0, 2, 0, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -165,7 +167,8 @@ void FEQ1<1>::get_local_mass_matrix (const DoFHandler<1>::cell_iterator &cell,
 
 template <>
 FEQ1<2>::FEQ1 () :
-               FEQ1Mapping<2> (1, 0, 0)
+               FEQ1Mapping<2> (1, 0, 0, 0, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,0) = 1./2.;
   interface_constraints(0,1) = 1./2.;
@@ -177,7 +180,8 @@ FEQ1<2>::FEQ1 () :
 
 template <>
 FEQ1<2>::FEQ1 (const int) :
-               FEQ1Mapping<2> (0, 0, 4)
+               FEQ1Mapping<2> (0, 0, 4, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -433,7 +437,8 @@ void FEQ1<2>::get_unit_support_points (vector<Point<2> > &unit_points) const {
 
 template <>
 FEQ1<3>::FEQ1 () :
-               FEQ1Mapping<3> (1, 0, 0, 0)
+               FEQ1Mapping<3> (1, 0, 0, 0, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,0) = 1.0/4.0;
   interface_constraints(0,1) = 1.0/4.0;
@@ -455,7 +460,8 @@ FEQ1<3>::FEQ1 () :
 
 template <>
 FEQ1<3>::FEQ1 (const int) :
-               FEQ1Mapping<3> (0, 0, 0, 8)
+               FEQ1Mapping<3> (0, 0, 0, 8, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
index 430eb71af210691b662fc47c75eca9947aaa2b68..0dd21c0f68b8cd29991b59a0d0a6a7b4eb9e9d85 100644 (file)
@@ -19,7 +19,8 @@ template <> void FEQ2<deal_II_dimension>::initialize_matrices ();
 
 template <>
 FEQ2<1>::FEQ2 () :
-               FEQ1Mapping<1> (1, 1) {
+               FEQ1Mapping<1> (1, 1, 0, 0, 1,
+                               vector<bool> (1, false)) {
   initialize_matrices ();
 };
 
@@ -27,7 +28,8 @@ FEQ2<1>::FEQ2 () :
 
 template <>
 FEQ2<1>::FEQ2 (const int) :
-               FEQ1Mapping<1> (0, 3) {
+               FEQ1Mapping<1> (0, 3, 0, 0, 1,
+                               vector<bool> (1, false)) {
   initialize_matrices ();
 };
 
@@ -121,7 +123,7 @@ void FEQ2<1>::initialize_matrices () {
 template <>
 double
 FEQ2<1>::shape_value(const unsigned int i,
-                              const Point<1>     &p) const
+                    const Point<1>     &p) const
 {
   Assert((i<total_dofs), ExcIndexRange(i, 0, total_dofs));
   const double xi = p(0);
@@ -139,7 +141,7 @@ FEQ2<1>::shape_value(const unsigned int i,
 template <>
 Tensor<1,1>
 FEQ2<1>::shape_grad(const unsigned int i,
-                             const Point<1>    &p) const
+                   const Point<1>    &p) const
 {
   Assert((i<total_dofs), ExcIndexRange(i, 0, total_dofs));
   const double xi = p(0);
@@ -162,7 +164,7 @@ FEQ2<1>::shape_grad(const unsigned int i,
 template <>
 Tensor<2,1>
 FEQ2<1>::shape_grad_grad (const unsigned int i,
-                                   const Point<1>    &) const
+                         const Point<1>    &) const
 {
   Assert((i<total_dofs), ExcIndexRange(i, 0, total_dofs));
 
@@ -209,7 +211,7 @@ void FEQ2<1>::get_face_support_points (const DoFHandler<1>::face_iterator &,
 
 template <>
 void FEQ2<1>::get_local_mass_matrix (const DoFHandler<1>::cell_iterator &cell,
-                                              FullMatrix<double> &local_mass_matrix) const {
+                                    FullMatrix<double> &local_mass_matrix) const {
   Assert (local_mass_matrix.n() == total_dofs,
          ExcWrongFieldDimension(local_mass_matrix.n(),total_dofs));
   Assert (local_mass_matrix.m() == total_dofs,
@@ -232,7 +234,8 @@ void FEQ2<1>::get_local_mass_matrix (const DoFHandler<1>::cell_iterator &cell,
 
 template <>
 FEQ2<2>::FEQ2 () :
-               FEQ1Mapping<2> (1, 1, 1)
+               FEQ1Mapping<2> (1, 1, 1, 0, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,2) = 1.0;
   interface_constraints(1,0) = 3./8.;
@@ -249,7 +252,8 @@ FEQ2<2>::FEQ2 () :
 
 template <>
 FEQ2<2>::FEQ2 (const int) :
-               FEQ1Mapping<2> (0, 0, 9)
+               FEQ1Mapping<2> (0, 0, 9, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
@@ -1121,7 +1125,8 @@ void FEQ2<2>::get_face_support_points (const DoFHandler<2>::face_iterator &face,
 
 template <>
 FEQ2<3>::FEQ2 () :
-               FEQ1Mapping<3> (1, 1, 1, 1)
+               FEQ1Mapping<3> (1, 1, 1, 1, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,8) = 1.0;
   interface_constraints(1,4) = 1.0;
@@ -1208,7 +1213,8 @@ FEQ2<3>::FEQ2 () :
 
 template <>
 FEQ2<3>::FEQ2 (const int) :
-               FEQ1Mapping<3> (0, 0, 0, 27)
+               FEQ1Mapping<3> (0, 0, 0, 27, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
index 94e7f846aafc8bcb90bde5601fd3aa65aecdf987..9ee95948427f7bd572315fef6a52f3e76a143964 100644 (file)
@@ -19,14 +19,16 @@ template <> void FEQ4<deal_II_dimension>::initialize_matrices ();
 
 template <>
 FEQ4<1>::FEQ4 () :
-               FEQ1Mapping<1> (1, 3) {
+               FEQ1Mapping<1> (1, 3, 0, 0, 1,
+                               vector<bool> (1, false)) {
   initialize_matrices ();
 };
 
 
 template <>
 FEQ4<1>::FEQ4 (const int) :
-               FEQ1Mapping<1> (0, 5) {
+               FEQ1Mapping<1> (0, 5, 0, 0, 1,
+                               vector<bool> (1, false)) {
   initialize_matrices ();
 };
 
@@ -218,7 +220,8 @@ void FEQ4<1>::get_local_mass_matrix (const DoFHandler<1>::cell_iterator &cell,
 
 template <>
 FEQ4<2>::FEQ4 () :
-               FEQ1Mapping<2> (1, 3, 9)
+               FEQ1Mapping<2> (1, 3, 9, 0, 1,
+                               vector<bool> (1, false))
 {
   interface_constraints(0,3) = 1.0;
   interface_constraints(1,0) = 35.0/128.0;
@@ -251,7 +254,8 @@ FEQ4<2>::FEQ4 () :
 
 template <>
 FEQ4<2>::FEQ4 (const int) :
-               FEQ1Mapping<2> (0, 0, 25)
+               FEQ1Mapping<2> (0, 0, 25, 0, 1,
+                               vector<bool> (1, false))
 {
   initialize_matrices ();
 };
index 2ecc79a58430e7f2b0a30703d4410b7cbe6d0a9a..82bb713624baca63e4a2b086930b26747ae060bf 100644 (file)
@@ -514,6 +514,62 @@ FESystem<2>::multiply_dof_numbers (const FiniteElementData<2> &fe1,
 #endif
 
 
+template <int dim>
+vector<bool>
+FESystem<dim>::compute_restriction_is_additive_flags (const FiniteElement<dim> &fe,
+                                                     const unsigned int n_elements) 
+{
+  vector<bool> tmp;
+  for (unsigned int i=0; i<n_elements; ++i)
+    for (unsigned int component=0; component<fe.n_components; ++component)
+      tmp.push_back (fe.restriction_is_additive (component));
+  return tmp;
+};
+
+
+template <int dim>
+vector<bool>
+FESystem<dim>::compute_restriction_is_additive_flags (const FiniteElement<dim> &fe1,
+                                                     const unsigned int        N1,
+                                                     const FiniteElement<dim> &fe2,
+                                                     const unsigned int        N2) 
+{
+  vector<bool> tmp;
+  for (unsigned int i=0; i<N1; ++i)
+    for (unsigned int component=0; component<fe1.n_components; ++component)
+      tmp.push_back (fe1.restriction_is_additive (component));
+  for (unsigned int i=0; i<N2; ++i)
+    for (unsigned int component=0; component<fe2.n_components; ++component)
+      tmp.push_back (fe2.restriction_is_additive (component));
+  return tmp;
+};
+
+
+template <int dim>
+vector<bool>
+FESystem<dim>::compute_restriction_is_additive_flags (const FiniteElement<dim> &fe1,
+                                                     const unsigned int        N1,
+                                                     const FiniteElement<dim> &fe2,
+                                                     const unsigned int        N2,
+                                                     const FiniteElement<dim> &fe3,
+                                                     const unsigned int        N3) 
+{
+  vector<bool> tmp;
+  for (unsigned int i=0; i<N1; ++i)
+    for (unsigned int component=0; component<fe1.n_components; ++component)
+      tmp.push_back (fe1.restriction_is_additive (component));
+  for (unsigned int i=0; i<N2; ++i)
+    for (unsigned int component=0; component<fe2.n_components; ++component)
+      tmp.push_back (fe2.restriction_is_additive (component));
+  for (unsigned int i=0; i<N3; ++i)
+    for (unsigned int component=0; component<fe3.n_components; ++component)
+      tmp.push_back (fe3.restriction_is_additive (component));
+  return tmp;
+};
+
+               
+
+
 template <int dim>
 double
 FESystem<dim>::shape_value (const unsigned int i,
index 2753e1e8a753d9ee705ed456e70c1cc4a0a8256b..a496850ce8d04b2b2abc4e38524d37533d685827 100644 (file)
@@ -24,12 +24,12 @@ FEQ1Mapping<1>::FEQ1Mapping (const unsigned int dofs_per_vertex,
                             const unsigned int dofs_per_quad,
                             const unsigned int dofs_per_hex,
                             const unsigned int n_components,
-                            const bool restriction_is_additive) :
+                            const vector<bool> restriction_is_additive_flags) :
                FiniteElement<1> (FiniteElementData<1> (dofs_per_vertex,
                                                        dofs_per_line,
                                                        GeometryInfo<1>::vertices_per_cell,
-                                                       n_components,
-                                                       restriction_is_additive))
+                                                       n_components),
+                                 restriction_is_additive_flags)
 {
   Assert (dofs_per_quad==0, ExcInvalidData());
   Assert (dofs_per_hex==0,  ExcInvalidData());
@@ -147,13 +147,13 @@ FEQ1Mapping<2>::FEQ1Mapping (const unsigned int dofs_per_vertex,
                             const unsigned int dofs_per_quad,
                             const unsigned int dofs_per_hex,
                             const unsigned int n_components,
-                            const bool restriction_is_additive) :
+                            const vector<bool> restriction_is_additive_flags) :
                FiniteElement<2> (FiniteElementData<2> (dofs_per_vertex,
                                                        dofs_per_line,
                                                        dofs_per_quad,
                                                        GeometryInfo<2>::vertices_per_cell,
-                                                       n_components,
-                                                       restriction_is_additive))
+                                                       n_components),
+                                 restriction_is_additive_flags)
 {
   Assert (dofs_per_hex == 0, ExcInvalidData());
 };
@@ -321,14 +321,14 @@ FEQ1Mapping<3>::FEQ1Mapping (const unsigned int dofs_per_vertex,
                             const unsigned int dofs_per_quad,
                             const unsigned int dofs_per_hex,
                             const unsigned int n_components,
-                            const bool restriction_is_additive) :
+                            const vector<bool> restriction_is_additive_flags) :
                FiniteElement<3> (FiniteElementData<3> (dofs_per_vertex,
                                                        dofs_per_line,
                                                        dofs_per_quad,
                                                        dofs_per_hex,
                                                        GeometryInfo<3>::vertices_per_cell,
-                                                       n_components,
-                                                       restriction_is_additive))
+                                                       n_components),
+                                 restriction_is_additive_flags)
 {};
 
 

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.