*/
typedef Tensor<2,spacedim> hessian_type;
+ /**
+ * A structure where for each shape
+ * function we pre-compute a bunch of
+ * data that will make later accesses
+ * much cheaper.
+ */
+ struct ShapeFunctionData
+ {
+ /**
+ * For each shape function, store
+ * whether the selected vector
+ * component may be nonzero. For
+ * primitive shape functions we
+ * know for sure whether a certain
+ * scalar component of a given
+ * shape function is nonzero,
+ * whereas for non-primitive shape
+ * functions this may not be
+ * entirely clear (e.g. for RT
+ * elements it depends on the shape
+ * of a cell).
+ */
+ bool is_nonzero_shape_function_component;
+
+ /**
+ * For each shape function, store
+ * the row index within the
+ * shape_values, shape_gradients,
+ * and shape_hessians tables (the
+ * column index is the quadrature
+ * point index). If the shape
+ * function is primitive, then we
+ * can get this information from
+ * the shape_function_to_row_table
+ * of the FEValues object;
+ * otherwise, we have to work a bit
+ * harder to compute this
+ * information.
+ */
+ unsigned int row_index;
+ };
+
/**
* Default constructor. Creates an
* invalid object.
void get_function_laplacians (const InputVector &fe_function,
std::vector<value_type> &laplacians) const;
-
private:
/**
* A reference to the FEValuesBase object
*/
const unsigned int component;
- /**
- * A structure where for each shape
- * function we pre-compute a bunch of
- * data that will make later accesses
- * much cheaper.
- */
- struct ShapeFunctionData
- {
- /**
- * For each shape function, store
- * whether the selected vector
- * component may be nonzero. For
- * primitive shape functions we
- * know for sure whether a certain
- * scalar component of a given
- * shape function is nonzero,
- * whereas for non-primitive shape
- * functions this may not be
- * entirely clear (e.g. for RT
- * elements it depends on the shape
- * of a cell).
- */
- bool is_nonzero_shape_function_component;
-
- /**
- * For each shape function, store
- * the row index within the
- * shape_values, shape_gradients,
- * and shape_hessians tables (the
- * column index is the quadrature
- * point index). If the shape
- * function is primitive, then we
- * can get this information from
- * the shape_function_to_row_table
- * of the FEValues object;
- * otherwise, we have to work a bit
- * harder to compute this
- * information.
- */
- unsigned int row_index;
- };
-
/**
* Store the data about shape
* functions.
*/
typedef Tensor<3,spacedim> hessian_type;
+ /**
+ * A structure where for each shape
+ * function we pre-compute a bunch of
+ * data that will make later accesses
+ * much cheaper.
+ */
+ struct ShapeFunctionData
+ {
+ /**
+ * For each pair (shape
+ * function,component within
+ * vector), store whether the
+ * selected vector component may be
+ * nonzero. For primitive shape
+ * functions we know for sure
+ * whether a certain scalar
+ * component of a given shape
+ * function is nonzero, whereas for
+ * non-primitive shape functions
+ * this may not be entirely clear
+ * (e.g. for RT elements it depends
+ * on the shape of a cell).
+ */
+ bool is_nonzero_shape_function_component[spacedim];
+
+ /**
+ * For each pair (shape function,
+ * component within vector), store
+ * the row index within the
+ * shape_values, shape_gradients,
+ * and shape_hessians tables (the
+ * column index is the quadrature
+ * point index). If the shape
+ * function is primitive, then we
+ * can get this information from
+ * the shape_function_to_row_table
+ * of the FEValues object;
+ * otherwise, we have to work a bit
+ * harder to compute this
+ * information.
+ */
+ unsigned int row_index[spacedim];
+
+ /**
+ * For each shape function say the
+ * following: if only a single
+ * entry in
+ * is_nonzero_shape_function_component
+ * for this shape function is
+ * nonzero, then store the
+ * corresponding value of row_index
+ * and
+ * single_nonzero_component_index
+ * represents the index between 0
+ * and dim for which it is
+ * attained. If multiple components
+ * are nonzero, then store -1. If
+ * no components are nonzero then
+ * store -2.
+ */
+ int single_nonzero_component;
+ unsigned int single_nonzero_component_index;
+ };
+
/**
* Default constructor. Creates an
* invalid object.
*/
const unsigned int first_vector_component;
- /**
- * A structure where for each shape
- * function we pre-compute a bunch of
- * data that will make later accesses
- * much cheaper.
- */
- struct ShapeFunctionData
- {
- /**
- * For each pair (shape
- * function,component within
- * vector), store whether the
- * selected vector component may be
- * nonzero. For primitive shape
- * functions we know for sure
- * whether a certain scalar
- * component of a given shape
- * function is nonzero, whereas for
- * non-primitive shape functions
- * this may not be entirely clear
- * (e.g. for RT elements it depends
- * on the shape of a cell).
- */
- bool is_nonzero_shape_function_component[spacedim];
-
- /**
- * For each pair (shape function,
- * component within vector), store
- * the row index within the
- * shape_values, shape_gradients,
- * and shape_hessians tables (the
- * column index is the quadrature
- * point index). If the shape
- * function is primitive, then we
- * can get this information from
- * the shape_function_to_row_table
- * of the FEValues object;
- * otherwise, we have to work a bit
- * harder to compute this
- * information.
- */
- unsigned int row_index[spacedim];
-
- /**
- * For each shape function say the
- * following: if only a single
- * entry in
- * is_nonzero_shape_function_component
- * for this shape function is
- * nonzero, then store the
- * corresponding value of row_index
- * and
- * single_nonzero_component_index
- * represents the index between 0
- * and dim for which it is
- * attained. If multiple components
- * are nonzero, then store -1. If
- * no components are nonzero then
- * store -2.
- */
- int single_nonzero_component;
- unsigned int single_nonzero_component_index;
- };
-
/**
* Store the data about shape
* functions.
*/
typedef Tensor<1, spacedim> divergence_type;
+ /**
+ * A structure where for each shape
+ * function we pre-compute a bunch of
+ * data that will make later accesses
+ * much cheaper.
+ */
+ struct ShapeFunctionData
+ {
+ /**
+ * For each pair (shape
+ * function,component within
+ * vector), store whether the
+ * selected vector component may be
+ * nonzero. For primitive shape
+ * functions we know for sure
+ * whether a certain scalar
+ * component of a given shape
+ * function is nonzero, whereas for
+ * non-primitive shape functions
+ * this may not be entirely clear
+ * (e.g. for RT elements it depends
+ * on the shape of a cell).
+ */
+ bool is_nonzero_shape_function_component[value_type::n_independent_components];
+
+ /**
+ * For each pair (shape function,
+ * component within vector), store
+ * the row index within the
+ * shape_values, shape_gradients,
+ * and shape_hessians tables (the
+ * column index is the quadrature
+ * point index). If the shape
+ * function is primitive, then we
+ * can get this information from
+ * the shape_function_to_row_table
+ * of the FEValues object;
+ * otherwise, we have to work a bit
+ * harder to compute this
+ * information.
+ */
+ unsigned int row_index[value_type::n_independent_components];
+
+ /**
+ * For each shape function say the
+ * following: if only a single
+ * entry in
+ * is_nonzero_shape_function_component
+ * for this shape function is
+ * nonzero, then store the
+ * corresponding value of row_index
+ * and
+ * single_nonzero_component_index
+ * represents the index between 0
+ * and (dim^2 + dim)/2 for which it is
+ * attained. If multiple components
+ * are nonzero, then store -1. If
+ * no components are nonzero then
+ * store -2.
+ */
+ int single_nonzero_component;
+ unsigned int single_nonzero_component_index;
+ };
+
/**
* Default constructor. Creates an
* invalid object.
*/
const unsigned int first_tensor_component;
- /**
- * A structure where for each shape
- * function we pre-compute a bunch of
- * data that will make later accesses
- * much cheaper.
- */
- struct ShapeFunctionData
- {
- /**
- * For each pair (shape
- * function,component within
- * vector), store whether the
- * selected vector component may be
- * nonzero. For primitive shape
- * functions we know for sure
- * whether a certain scalar
- * component of a given shape
- * function is nonzero, whereas for
- * non-primitive shape functions
- * this may not be entirely clear
- * (e.g. for RT elements it depends
- * on the shape of a cell).
- */
- bool is_nonzero_shape_function_component[value_type::n_independent_components];
-
- /**
- * For each pair (shape function,
- * component within vector), store
- * the row index within the
- * shape_values, shape_gradients,
- * and shape_hessians tables (the
- * column index is the quadrature
- * point index). If the shape
- * function is primitive, then we
- * can get this information from
- * the shape_function_to_row_table
- * of the FEValues object;
- * otherwise, we have to work a bit
- * harder to compute this
- * information.
- */
- unsigned int row_index[value_type::n_independent_components];
-
- /**
- * For each shape function say the
- * following: if only a single
- * entry in
- * is_nonzero_shape_function_component
- * for this shape function is
- * nonzero, then store the
- * corresponding value of row_index
- * and
- * single_nonzero_component_index
- * represents the index between 0
- * and (dim^2 + dim)/2 for which it is
- * attained. If multiple components
- * are nonzero, then store -1. If
- * no components are nonzero then
- * store -2.
- */
- int single_nonzero_component;
- unsigned int single_nonzero_component_index;
- };
-
/**
* Store the data about shape
* functions.
// consistently throughout the code since revision 17903 at least.
// ------------------------- scalar functions --------------------------
-
- struct ShapeFunctionDataScalar
- {
- bool is_nonzero_shape_function_component;
- unsigned int row_index;
- };
-
+ template <int dim, int spacedim>
void
do_function_values (const ::dealii::Vector<double> &dof_values,
const Table<2,double> &shape_values,
- const std::vector<ShapeFunctionDataScalar> &shape_function_data,
+ const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<double> &values)
{
const unsigned int dofs_per_cell = dof_values.size();
// same code for gradient and Hessian, template argument 'order' to give
// the order of the derivative (= rank of gradient/Hessian tensor)
- template <int order, int spacedim>
+ template <int order, int dim, int spacedim>
void
do_function_derivatives (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives,
- const std::vector<ShapeFunctionDataScalar> &shape_function_data,
+ const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<Tensor<order,spacedim> > &derivatives)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_laplacians (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians,
- const std::vector<ShapeFunctionDataScalar> &shape_function_data,
+ const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<double> &laplacians)
{
const unsigned int dofs_per_cell = dof_values.size();
// ----------------------------- vector part ---------------------------
- template <int spacedim>
- struct ShapeFunctionDataVector
- {
- bool is_nonzero_shape_function_component[spacedim];
- unsigned int row_index[spacedim];
- int single_nonzero_component;
- unsigned int single_nonzero_component_index;
- };
-
-
-
- template <int spacedim>
+ template <int dim, int spacedim>
void do_function_values (const ::dealii::Vector<double> &dof_values,
const Table<2,double> &shape_values,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<Tensor<1,spacedim> > &values)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int order, int spacedim>
+ template <int order, int dim, int spacedim>
void
do_function_derivatives (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<Tensor<order+1,spacedim> > &derivatives)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_symmetric_gradients (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<dealii::SymmetricTensor<2,spacedim> > &symmetric_gradients)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_divergences (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<double> &divergences)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_curls (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename dealii::internal::CurlType<spacedim>::type> &curls)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_laplacians (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians,
- const std::vector<ShapeFunctionDataVector<spacedim> > &shape_function_data,
+ const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<Tensor<1,spacedim> > &laplacians)
{
const unsigned int dofs_per_cell = dof_values.size();
// ---------------------- symmetric tensor part ------------------------
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_values (const ::dealii::Vector<double> &dof_values,
const Table<2,double> &shape_values,
- const std::vector<ShapeFunctionDataVector<dealii::SymmetricTensor<2,spacedim>::n_independent_components> > &shape_function_data,
+ const std::vector<typename SymmetricTensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<dealii::SymmetricTensor<2,spacedim> > &values)
{
const unsigned int dofs_per_cell = dof_values.size();
- template <int spacedim>
+ template <int dim, int spacedim>
void
do_function_divergences (const ::dealii::Vector<double> &dof_values,
const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients,
- const std::vector<ShapeFunctionDataVector<dealii::SymmetricTensor<2,spacedim>::n_independent_components> > &shape_function_data,
+ const std::vector<typename SymmetricTensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<Tensor<1,spacedim> > &divergences)
{
const unsigned int dofs_per_cell = dof_values.size();
}
}
}
+
} // end of namespace internal
// get function values of dofs on this cell and call internal worker function
dealii::Vector<double> dof_values(fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_values (dof_values, fe_values.shape_values,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataScalar>&>(shape_function_data),
- values);
+ internal::do_function_values<dim,spacedim>
+ (dof_values, fe_values.shape_values, shape_function_data, values);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives (dof_values, fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataScalar>&>(shape_function_data),
- gradients);
+ internal::do_function_derivatives<1,dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data, gradients);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives (dof_values, fe_values.shape_hessians,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataScalar>&>(shape_function_data),
- hessians);
+ internal::do_function_derivatives<2,dim,spacedim>
+ (dof_values, fe_values.shape_hessians, shape_function_data, hessians);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_laplacians (dof_values, fe_values.shape_hessians,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataScalar>&>(shape_function_data),
- laplacians);
+ internal::do_function_laplacians<dim,spacedim>
+ (dof_values, fe_values.shape_hessians, shape_function_data, laplacians);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_values (dof_values, fe_values.shape_values,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- values);
+ internal::do_function_values<dim,spacedim>
+ (dof_values, fe_values.shape_values, shape_function_data, values);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives (dof_values, fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- gradients);
+ internal::do_function_derivatives<1,dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data, gradients);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_symmetric_gradients (dof_values,
- fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- symmetric_gradients);
+ internal::do_function_symmetric_gradients<dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data,
+ symmetric_gradients);
}
// on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_divergences (dof_values,
- fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- divergences);
+ internal::do_function_divergences<dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data, divergences);
}
template <int dim, int spacedim>
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values (fe_function, dof_values);
- internal::do_function_curls (dof_values, fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- curls);
+ internal::do_function_curls<dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data, curls);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives (dof_values, fe_values.shape_hessians,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- hessians);
+ internal::do_function_derivatives<2,dim,spacedim>
+ (dof_values, fe_values.shape_hessians, shape_function_data, hessians);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values (fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_laplacians (dof_values, fe_values.shape_hessians,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<spacedim> >&>(shape_function_data),
- laplacians);
+ internal::do_function_laplacians<dim,spacedim>
+ (dof_values, fe_values.shape_hessians, shape_function_data, laplacians);
}
// get function values of dofs on this cell
dealii::Vector<double> dof_values(fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_values (dof_values, fe_values.shape_values,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<dealii::SymmetricTensor<2,spacedim>::n_independent_components> >&>(shape_function_data),
- values);
+ internal::do_function_values<dim,spacedim>
+ (dof_values, fe_values.shape_values, shape_function_data, values);
}
// on this cell
dealii::Vector<double> dof_values(fe_values.dofs_per_cell);
fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_divergences (dof_values, fe_values.shape_gradients,
- reinterpret_cast<const std::vector<internal::ShapeFunctionDataVector<dealii::SymmetricTensor<2,spacedim>::n_independent_components> >&>(shape_function_data),
- divergences);
+ internal::do_function_divergences<dim,spacedim>
+ (dof_values, fe_values.shape_gradients, shape_function_data, divergences);
}
}