bool
is_primitive (const unsigned int i) const;
- /**
- * Return whether the entire
- * finite element is primitive,
- * in the sense that all its
- * shape functions are
- * primitive. If the finite
- * element is scalar, then this
- * is always the case.
- *
- * Since this is an extremely
- * common operation, the result
- * is cached in the
- * #cached_primitivity
- * variable which is computed in
- * the constructor.
- */
- bool
- is_primitive () const;
+ FiniteElementData<dim>::is_primitive;
/**
* Number of base elements in a
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false,
const bool isotropic_prolongation_only=false);
-
- /**
- * Store whether all shape
- * functions are primitive. Since
- * finding this out is a very
- * common operation, we cache the
- * result, i.e. compute the value
- * in the constructor for simpler
- * access.
- */
- const bool cached_primitivity;
-
/**
* Vector of projection
* matrices. See
//
// for good measure, short circuit the test
// if the entire FE is primitive
- return ((cached_primitivity == true)
- ||
+ return (is_primitive() ||
(n_nonzero_components_table[i] == 1));
}
-template <int dim, int spacedim>
-inline
-bool
-FiniteElement<dim,spacedim>::is_primitive () const
-{
- return cached_primitivity;
-}
-
-
DEAL_II_NAMESPACE_CLOSE
#endif
*/
unsigned int n_blocks () const;
+ /**
+ * Return whether the entire
+ * finite element is primitive,
+ * in the sense that all its
+ * shape functions are
+ * primitive. If the finite
+ * element is scalar, then this
+ * is always the case.
+ *
+ * Since this is an extremely
+ * common operation, the result
+ * is cached in the
+ * #cached_primitivity
+ * variable which is computed in
+ * the constructor.
+ */
+ bool is_primitive () const;
+
/**
* Maximal polynomial degree of a
* shape function in a single
* Comparison operator.
*/
bool operator == (const FiniteElementData &) const;
+
+ protected:
+
+ /**
+ * Set the primitivity of the
+ * element. This is usually done
+ * by the constructor of a
+ * derived class.
+ * See @ref GlossPrimitive "primitive"
+ * for details.
+ */
+ void set_primitivity(const bool value);
+
+ private:
+ /**
+ * Store whether all shape
+ * functions are primitive. Since
+ * finding this out is a very
+ * common operation, we cache the
+ * result, i.e. compute the value
+ * in the constructor for simpler
+ * access.
+ */
+ bool cached_primitivity;
};
+template <int dim>
+inline
+bool
+FiniteElementData<dim>::is_primitive () const
+{
+ return cached_primitivity;
+}
+
+
+template <int dim>
+inline
+void
+FiniteElementData<dim>::set_primitivity (const bool value)
+{
+ cached_primitivity = value;
+}
+
+
template <int dim>
inline
unsigned int
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
const std::vector<std::vector<bool> > &nonzero_c)
:
FiniteElementData<dim> (fe_data),
- cached_primitivity(false),
adjust_quad_dof_index_for_face_orientation_table (dim == 3 ?
this->dofs_per_quad : 0 ,
dim==3 ? 8 : 0),
// nonzero_components vector.
const_cast<std::vector<unsigned int>&>
(n_nonzero_components_table) = compute_n_nonzero_components(nonzero_components);
- const_cast<bool&>
- (cached_primitivity) = std::find_if (n_nonzero_components_table.begin(),
- n_nonzero_components_table.end(),
- std::bind2nd(std::not_equal_to<unsigned int>(),
- 1U))
- == n_nonzero_components_table.end();
+ this->set_primitivity(std::find_if (n_nonzero_components_table.begin(),
+ n_nonzero_components_table.end(),
+ std::bind2nd(std::not_equal_to<unsigned int>(),
+ 1U))
+ == n_nonzero_components_table.end());
Assert (restriction_is_additive_flags.size() == this->dofs_per_cell,
// only one (vector-)component; if
// the element is not primitive,
// leave these tables empty.
- if (cached_primitivity)
+ if (this->is_primitive())
{
system_to_component_table.resize(this->dofs_per_cell);
face_system_to_component_table.resize(this->dofs_per_face);
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
components(0),
blocks(0),
degree(0),
- conforming_space(unknown)
+ conforming_space(unknown),
+ cached_primitivity(false)
{}