+/**
+ * This enum definition is used for storing similarities of the current cell
+ * to the previously visited cell. This information is used for reusing data
+ * when calling the method FEValues::reinit() (like derivatives, which do
+ * not change if one cell is just a translation of the previous). Currently,
+ * this variable does only recognize a translation. However, this concept
+ * makes it easy to add additional staties to be detected in
+ * FEValues/FEFaceValues for making use of these similarities as well.
+ */
+namespace CellSimilarity
+{
+ enum Similarity
+ {
+ none,
+ translation
+ };
+}
+
+
/*@}*/
+
+
DEAL_II_NAMESPACE_CLOSE
#endif
const std::vector<Point<spacedim> > & get_cell_normal_vectors () const;
-
/**
* Return the outward normal vector to
* the cell at the <tt>i</tt>th quadrature
*/
const Point<spacedim> & cell_normal_vector (const unsigned int i) const;
+ /**
+ * Return the relation of the current
+ * cell to the previous cell. This
+ * allows re-use of some cell data
+ * (like local matrices for equations
+ * with constant coefficients) if the
+ * result is
+ * <tt>CellSimilarity::translation</tt>.
+ */
+ const enum CellSimilarity::Similarity get_cell_similarity () const;
+
/**
* Determine an estimate for the
* memory consumption (in bytes)
*/
UpdateFlags compute_update_flags (const UpdateFlags update_flags) const;
+ /**
+ * An enum variable that can store
+ * different states of the current cell
+ * in comparison to the previously
+ * visited cell. If wanted, additional
+ * states can be checked here and used
+ * in one of the methods used during
+ * reinit.
+ */
+ enum CellSimilarity::Similarity cell_similarity;
+
+ /**
+ * A function that checks whether the
+ * new cell is similar to the one
+ * previously used. Then, a significant
+ * amount of the data can be reused,
+ * e.g. the derivatives of the basis
+ * functions in real space, shape_grad.
+ */
+ void
+ check_cell_similarity (const typename Triangulation<dim,spacedim>::cell_iterator &cell);
+
private:
/**
* Copy constructor. Since
*/
FEValues (const Mapping<dim,spacedim> &mapping,
const FiniteElement<dim,spacedim> &fe,
- const Quadrature<dim> &quadrature,
- const UpdateFlags update_flags);
+ const Quadrature<dim> &quadrature,
+ const UpdateFlags update_flags);
/**
* Constructor. Uses MappingQ1
* implicitly.
*/
FEValues (const FiniteElement<dim,spacedim> &fe,
- const Quadrature<dim> &quadrature,
- const UpdateFlags update_flags);
+ const Quadrature<dim> &quadrature,
+ const UpdateFlags update_flags);
/**
* Reinitialize the gradients,
*/
void initialize (const UpdateFlags update_flags);
- /**
- * An enum variable that can store
- * different states of the current cell
- * in comparison to the previously
- * visited cell. If wanted, additional
- * states can be checked here and used
- * in one of the methods used during
- * reinit.
- */
- enum CellSimilarity::Similarity cell_similarity;
-
- /**
- * A function that checks whether the
- * new cell is similar to the one
- * previously used. Then, a significant
- * amount of the data can be reused,
- * e.g. the derivatives of the basis
- * functions in real space, shape_grad.
- */
- void
- check_cell_similarity (const typename Triangulation<dim,spacedim>::cell_iterator &cell);
-
/**
* The reinit() functions do
* only that part of the work
* of faces times the number of subfaces
* per face.
*/
- FEFaceValuesBase (const unsigned int n_q_points,
- const unsigned int dofs_per_cell,
- const UpdateFlags update_flags,
+ FEFaceValuesBase (const unsigned int n_q_points,
+ const unsigned int dofs_per_cell,
+ const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const FiniteElement<dim,spacedim> &fe,
- const Quadrature<dim-1>& quadrature);
+ const Quadrature<dim-1>& quadrature);
/**
* Return the outward normal vector to
*/
FEFaceValues (const Mapping<dim,spacedim> &mapping,
const FiniteElement<dim,spacedim> &fe,
- const Quadrature<dim-1> &quadrature,
- const UpdateFlags update_flags);
+ const Quadrature<dim-1> &quadrature,
+ const UpdateFlags update_flags);
/**
* Constructor. Uses MappingQ1
* implicitly.
*/
FEFaceValues (const FiniteElement<dim,spacedim> &fe,
- const Quadrature<dim-1> &quadrature,
- const UpdateFlags update_flags);
+ const Quadrature<dim-1> &quadrature,
+ const UpdateFlags update_flags);
/**
* Reinitialize the gradients, Jacobi
* and the given finite element.
*/
void reinit (const typename DoFHandler<dim,spacedim>::cell_iterator &cell,
- const unsigned int face_no);
+ const unsigned int face_no);
/**
* Reinitialize the gradients,
* object.
*/
void reinit (const typename hp::DoFHandler<dim,spacedim>::cell_iterator &cell,
- const unsigned int face_no);
+ const unsigned int face_no);
/**
* Reinitialize the gradients,
* object.
*/
void reinit (const typename MGDoFHandler<dim,spacedim>::cell_iterator &cell,
- const unsigned int face_no);
+ const unsigned int face_no);
/**
* Reinitialize the gradients,
* handler type objects.
*/
void reinit (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
- const unsigned int face_no);
+ const unsigned int face_no);
/**
* Return a reference to this
template <int dim, int spacedim> class FEFaceValues;
template <int dim, int spacedim> class FESubfaceValues;
- /**
- * An enum variable that can store
- * different states of the current cell
- * in comparison to the previously
- * visited cell. If wanted, additional
- * states can be checked here and used
- * in one of the methods used during
- * reinit.
- */
-namespace CellSimilarity
-{
- enum Similarity
- {
- no_similarity,
- translation
- };
-}
-
/**
* The transformation type used
* for the Mapping::transform() functions.
FEValuesData<dim,spacedim> &data) const
{
compute_fill (mapping, cell, face_no, invalid_face_number, quadrature,
- CellSimilarity::no_similarity, mapping_data, fe_data, data);
+ CellSimilarity::none, mapping_data, fe_data, data);
}
FEValuesData<dim,spacedim> &data) const
{
compute_fill (mapping, cell, face_no, sub_no, quadrature,
- CellSimilarity::no_similarity, mapping_data, fe_data, data);
+ CellSimilarity::none, mapping_data, fe_data, data);
}
}
+
+template <int dim, int spacedim>
+inline
+void
+FEValuesBase<dim,spacedim>::check_cell_similarity
+ (const typename Triangulation<dim,spacedim>::cell_iterator &cell)
+{
+ // case that there has not been any cell
+ // before
+ if (&*this->present_cell == 0)
+ {
+ cell_similarity = CellSimilarity::none;
+ return;
+ }
+
+ const typename Triangulation<dim,spacedim>::cell_iterator & present_cell =
+ *this->present_cell;
+
+ // test for translation
+ {
+ // otherwise, go through the vertices and
+ // check... The cell is a translation of
+ // the previous one in case the distance
+ // between the individual vertices in the
+ // two cell is the same for all the
+ // vertices. So do the check by first
+ // getting the distance on the first
+ // vertex, and then checking whether all
+ // others have the same.
+ bool is_translation = true;
+ const Point<spacedim> dist = cell->vertex(0) - present_cell->vertex(0);
+ for (unsigned int i=1; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+ {
+ Point<spacedim> dist_new = cell->vertex(i) - present_cell->vertex(i) - dist;
+ if (dist_new.norm_square() > 1e-28)
+ {
+ is_translation = false;
+ break;
+ }
+ }
+
+ cell_similarity = (is_translation == true
+ ?
+ CellSimilarity::translation
+ :
+ CellSimilarity::none);
+ return;
+ }
+
+ // TODO: here, one could implement other
+ // checks for similarity, e.g. for
+ // children of a parallelogram.
+}
+
+
+
+template <int dim, int spacedim>
+const enum CellSimilarity::Similarity
+FEValuesBase<dim,spacedim>::get_cell_similarity () const
+{
+ return cell_similarity;
+}
+
+
/*------------------------------- FEValues -------------------------------*/
-template <int dim, int spacedim>
-inline
-void
-FEValues<dim,spacedim>::check_cell_similarity (const typename Triangulation<dim,spacedim>::cell_iterator &cell)
-{
- // case that there has not been any cell
- // before
- if (&*this->present_cell == 0)
- {
- cell_similarity = CellSimilarity::no_similarity;
- return;
- }
-
- const typename Triangulation<dim,spacedim>::cell_iterator & present_cell =
- *this->present_cell;
-
- // test for translation
- {
- // otherwise, go through the vertices and
- // check...
- bool is_translation = true;
- const Point<spacedim> dist = cell->vertex(0) - present_cell->vertex(0);
- for (unsigned int i=1; i<GeometryInfo<dim>::vertices_per_cell; ++i)
- {
- Point<spacedim> dist_new = cell->vertex(i) - present_cell->vertex(i) - dist;
- if (dist_new.norm_square() > 1e-28)
- {
- is_translation = false;
- break;
- }
- }
-
- cell_similarity = (is_translation == true
- ?
- CellSimilarity::translation
- :
- CellSimilarity::no_similarity);
- return;
- }
-
- // TODO: here, one could implement other
- // checks for similarity, e.g. for
- // children of a parallelogram.
-}
-
-
-
template <int dim, int spacedim>
void FEValues<dim,spacedim>::do_reinit ()
{
InternalData &data = static_cast<InternalData&> (mapping_data);
compute_fill (cell, face_no, invalid_face_number,
- CellSimilarity::no_similarity,
+ CellSimilarity::none,
data,
quadrature_points,
normal_vectors);
Assert (dynamic_cast<InternalData*> (&mapping_data) != 0, ExcInternalError());
InternalData &data = static_cast<InternalData&> (mapping_data);
- compute_fill (cell, face_no, sub_no, CellSimilarity::no_similarity,
+ compute_fill (cell, face_no, sub_no, CellSimilarity::none,
data,
quadrature_points,
normal_vectors);
else
{
p_data=&data;
- cell_similarity = CellSimilarity::no_similarity;
+ cell_similarity = CellSimilarity::none;
}
MappingQ1<dim,spacedim>::fill_fe_values(cell, q, cell_similarity, *p_data,
std::vector<Tensor<1,dim> > &boundary_forms,
std::vector<Point<spacedim> > &normal_vectors) const
{
- compute_fill (cell, n_q_points, data_set, CellSimilarity::no_similarity,
+ compute_fill (cell, n_q_points, data_set, CellSimilarity::none,
data, quadrature_points);
const UpdateFlags update_flags(data.current_update_flags());
// disable any previously detected
// similarity and hand on to the
// respective function of the base class.
- cell_similarity = CellSimilarity::no_similarity;
+ cell_similarity = CellSimilarity::none;
MappingQ1<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
quadrature_points, JxW_values, jacobians,
jacobian_grads, inverse_jacobians,
// disable any previously detected
// similarity and hand on to the respective
// function of the base class.
- cell_similarity = CellSimilarity::no_similarity;
+ cell_similarity = CellSimilarity::none;
MappingQ<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
quadrature_points, JxW_values, jacobians,
jacobian_grads, inverse_jacobians,
for (int col=0; col < row_length; ++col)
row_indices[col] = sparsity_pattern.column_number (row, col);
- graph->InsertGlobalIndices (row, row_length, &row_indices[0]);
+ graph->InsertGlobalIndices (static_cast<int>(row),
+ row_length, &row_indices[0]);
+
}
// Now, fill the graph (sort indices, make