* Implementation of the same
* function in
* @ref{FiniteElement}.
+ *
+ * Passes on control to
+ * @p{compute_fill} that does the
+ * work for all three
+ * @p{fill_fe*_values}
+ * functions.
*/
virtual void
fill_fe_values (const Mapping<dim> &mapping,
* Implementation of the same
* function in
* @ref{FiniteElement}.
+ *
+ * Passes on control to
+ * @p{compute_fill} that does the
+ * work for all three
+ * @p{fill_fe*_values} functions.
*/
virtual void
fill_fe_face_values (const Mapping<dim> &mapping,
* Implementation of the same
* function in
* @ref{FiniteElement}.
+ *
+ * Passes on control to
+ * @p{compute_fill} that does the
+ * work for all three
+ * @p{fill_fe*_values} functions.
*/
virtual void
fill_fe_subface_values (const Mapping<dim> &mapping,
/**
+ * Do the work for the three
+ * @p{fill_fe*_values} functions.
+ *
* Calls (among other things)
* @p{fill_fe_([sub]face)_values}
* of the base elements. Calls
* @p{fill_fe_values} if
- * @p{face_no==-1} and
- * @p{sub_no==-1}; calls
- * @p{fill_fe_face_values} if
- * @p{face_no==-1} and
- * @p{sub_no!=-1}; and calls
- * @p{fill_fe_subface_values} if
- * @p{face_no!=-1} and
- * @p{sub_no!=-1}.
+ * @p{face_no==invalid_face_no}
+ * and
+ * @p{sub_no==invalid_face_no};
+ * calls @p{fill_fe_face_values}
+ * if
+ * @p{face_no==invalid_face_no}
+ * and
+ * @p{sub_no!=invalid_face_no};
+ * and calls
+ * @p{fill_fe_subface_values} if
+ * @p{face_no!=invalid_face_no}
+ * and
+ * @p{sub_no!=invalid_face_no}.
*/
template <int dim_1>
void compute_fill (const Mapping<dim> &mapping,
const unsigned int face_no,
const unsigned int sub_no,
const Quadrature<dim_1> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fe_data,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fe_data,
FEValuesData<dim> &data) const ;
private:
* classes).
*/
void delete_fe_values_data (const unsigned int base_no);
+
+ /**
+ * Set the @p{first_cell}
+ * flag to @p{false}. Used by
+ * the @p{FEValues} class to
+ * indicate that we have
+ * already done the work on
+ * the first cell.
+ *
+ * In addition to calling the
+ * respective function of the
+ * base class, this function
+ * also calls the functions
+ * of the sub-data objects.
+ */
+ virtual void clear_first_cell ();
private:
*/
UpdateFlags current_update_flags() const;
- /**
- * Determine if this is the
- * first cell visited. Then,
- * we need to use
- * @p{update_once} to fill
- * cell-independent
- * fields. Users of derived
- * classes will have to set
- * this field to @p{false};
- * it is initialized to
- * @p{true}.
- */
- bool first_cell;
-
+ /**
+ * Return whether we are
+ * presently initializing
+ * data for the first
+ * cell. The value of the
+ * field this function is
+ * returning is set to
+ * @p{true} in the
+ * constructor, and cleared
+ * by the @p{FEValues} class
+ * after the first cell has
+ * been initialized.
+ *
+ * This function is used to
+ * determine whether we need
+ * to use the @p{update_once}
+ * flags for computing data,
+ * or whether we can use the
+ * @p{update_each} flags.
+ */
+ bool is_first_cell () const;
+
+ /**
+ * Set the @p{first_cell}
+ * flag to @p{false}. Used by
+ * the @p{FEValues} class to
+ * indicate that we have
+ * already done the work on
+ * the first cell.
+ */
+ virtual void clear_first_cell ();
+
/**
* Return an estimate (in
* bytes) or the memory
* object.
*/
virtual unsigned int memory_consumption () const;
+
+ private:
+ /**
+ * The value returned by
+ * @p{is_first_cell}.
+ */
+ bool first_cell;
};
/**
template <int dim>
inline
UpdateFlags
-Mapping<dim>::InternalDataBase::current_update_flags() const
+Mapping<dim>::InternalDataBase::current_update_flags () const
{
if (first_cell)
{
- Assert(update_flags==(update_once|update_each), ExcInternalError());
+ Assert (update_flags==(update_once|update_each),
+ ExcInternalError());
return update_flags;
}
else
return update_each;
-
- return update_default;
-}
+};
+
+
+template <int dim>
+inline
+bool
+Mapping<dim>::InternalDataBase::is_first_cell () const
+{
+ return first_cell;
+};
+
+
+
+template <int dim>
+inline
+void
+Mapping<dim>::InternalDataBase::clear_first_cell ()
+{
+ first_cell = false;
+};
#endif
+template <int dim>
+void
+FESystem<dim>::InternalData::clear_first_cell ()
+{
+ // call respective function of base
+ // class
+ FiniteElementBase<dim>::InternalDataBase::clear_first_cell ();
+ // then the functions of all the
+ // sub-objects
+ for (unsigned int i=0; i<base_fe_datas.size(); ++i)
+ base_fe_datas[i]->clear_first_cell ();
+};
+
+
/* ---------------------------------- FESystem ------------------- */
template <int dim>
void
-FESystem<dim>::fill_fe_values (const Mapping<dim> &mapping,
- const typename DoFHandler<dim>::cell_iterator &cell,
- const Quadrature<dim> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fe_data,
- FEValuesData<dim> &data) const
+FESystem<dim>::
+fill_fe_values (const Mapping<dim> &mapping,
+ const typename DoFHandler<dim>::cell_iterator &cell,
+ const Quadrature<dim> &quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fe_data,
+ FEValuesData<dim> &data) const
{
compute_fill(mapping, cell, invalid_face_number, invalid_face_number,
quadrature, mapping_data, fe_data, data);
template <int dim>
void
-FESystem<dim>::fill_fe_face_values (const Mapping<dim> &mapping,
- const typename DoFHandler<dim>::cell_iterator &cell,
- const unsigned int face_no,
- const Quadrature<dim-1> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fe_data,
- FEValuesData<dim> &data) const
+FESystem<dim>::
+fill_fe_face_values (const Mapping<dim> &mapping,
+ const typename DoFHandler<dim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const Quadrature<dim-1> &quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fe_data,
+ FEValuesData<dim> &data) const
{
- compute_fill(mapping, cell, face_no, invalid_face_number,
- quadrature, mapping_data, fe_data, data);
+ compute_fill (mapping, cell, face_no, invalid_face_number,
+ quadrature, mapping_data, fe_data, data);
};
template <int dim>
void
-FESystem<dim>::fill_fe_subface_values (const Mapping<dim> &mapping,
- const typename DoFHandler<dim>::cell_iterator &cell,
- const unsigned int face_no,
- const unsigned int sub_no,
- const Quadrature<dim-1> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fe_data,
- FEValuesData<dim> &data) const
+FESystem<dim>::
+fill_fe_subface_values (const Mapping<dim> &mapping,
+ const typename DoFHandler<dim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const unsigned int sub_no,
+ const Quadrature<dim-1> &quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fe_data,
+ FEValuesData<dim> &data) const
{
- compute_fill(mapping, cell, face_no, sub_no,
- quadrature, mapping_data, fe_data, data);
+ compute_fill (mapping, cell, face_no, sub_no,
+ quadrature, mapping_data, fe_data, data);
}
template <int dim>
template <int dim_1>
void
-FESystem<dim>::compute_fill (const Mapping<dim> &mapping,
- const typename DoFHandler<dim>::cell_iterator &cell,
- const unsigned int face_no,
- const unsigned int sub_no,
- const Quadrature<dim_1> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fedata,
- FEValuesData<dim> &data) const
+FESystem<dim>::
+compute_fill (const Mapping<dim> &mapping,
+ const typename DoFHandler<dim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const unsigned int sub_no,
+ const Quadrature<dim_1> &quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fedata,
+ FEValuesData<dim> &data) const
{
const unsigned int n_q_points = quadrature.n_quadrature_points;
// possible
InternalData & fe_data = dynamic_cast<InternalData&> (fedata);
- // Either dim_1==dim (fill_fe_values)
- // or dim_1==dim-1 (fill_fe_(sub)face_values)
+ // Either dim_1==dim
+ // (fill_fe_values) or dim_1==dim-1
+ // (fill_fe_(sub)face_values)
Assert(dim_1==dim || dim_1==dim-1, ExcInternalError());
const UpdateFlags flags(dim_1==dim ?
fe_data.current_update_flags() :
if (flags & (update_values | update_gradients))
{
- if (fe_data.first_cell)
+ if (fe_data.is_first_cell())
{
// Initialize the
// FEValuesDatas for the
base_fe_data = fe_data.get_fe_data(base_no);
// compute update flags ...
- const UpdateFlags base_update_flags(mapping_data.update_flags
- | base_fe_data.update_flags);
+ const UpdateFlags base_update_flags
+ = mapping_data.update_flags | base_fe_data.update_flags;
// Initialize the FEValuesDatas
// for the base elements.
Assert(dim_1==dim,
typename FiniteElementData<dim>::
ExcSpaceDimensionMismatch(dim_1,dim));
- cell_quadrature=dynamic_cast<const Quadrature<dim> *>(quadrature_base_pointer);
+ cell_quadrature
+ = dynamic_cast<const Quadrature<dim> *>(quadrature_base_pointer);
Assert (cell_quadrature != 0, ExcInternalError());
}
else
Assert(dim_1==dim-1,
typename FiniteElementData<dim>::
ExcSpaceDimensionMismatch(dim_1,dim-1));
- face_quadrature=dynamic_cast<const Quadrature<dim-1> *>(quadrature_base_pointer);
+ face_quadrature
+ = dynamic_cast<const Quadrature<dim-1> *>(quadrature_base_pointer);
Assert (face_quadrature != 0, ExcInternalError());
}
// data on each face,
// therefore use
// base_fe_data.update_flags.
- //
- // Store these flags into
- // base_flags before
- // calling
- // base_fe.fill_fe_([sub]face_)values
- // as the latter changes
- // the return value of
- // base_fe_data.current_update_flags()
- const UpdateFlags base_flags(dim_1==dim ?
- base_fe_data.current_update_flags() :
- base_fe_data.update_flags);
-
if (face_no==invalid_face_number)
base_fe.fill_fe_values(mapping, cell,
*cell_quadrature, mapping_data, base_fe_data, base_data);
// those shape functions
// that belong to a given
// base element
+ const UpdateFlags base_flags(dim_1==dim ?
+ base_fe_data.current_update_flags() :
+ base_fe_data.update_flags);
for (unsigned int system_index=0; system_index<this->dofs_per_cell;
++system_index)
if (this->system_to_base_table[system_index].first.first == base_no)
};
};
- if (fe_data.first_cell)
+ if (fe_data.is_first_cell())
{
- fe_data.first_cell = false;
- for (unsigned int base_no=0; base_no<n_base_elements(); ++base_no)
- Assert(fe_data.get_fe_data(base_no).first_cell==false, ExcInternalError());
-
// delete FEValuesDatas that
// are not needed any more
for (unsigned int base_no=0; base_no<n_base_elements(); ++base_no)