This should improve data locality and simplify memory management.
mapping.transform (make_array_view(fe_data.shape_gradients[k]),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (flags & update_hessians && cell_similarity != CellSimilarity::translation)
{
mapping.transform (make_array_view(fe_data.shape_hessians[k]),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
mapping.transform (ArrayView<const Tensor<1,dim> >(&fe_data.shape_gradients[k][offset], quadrature.size()),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (flags & update_hessians)
{
quadrature.size()),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
quadrature.size()),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
quadrature.size()),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (flags & update_hessians)
{
quadrature.size()),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
quadrature.size()),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
* Storage type for gradients. The layout of data is the same as for the
* #ShapeVector data type.
*/
- typedef std::vector<std::vector<Tensor<1,spacedim> > > GradientVector;
+ typedef dealii::Table<2,Tensor<1,spacedim> > GradientVector;
/**
* Likewise for second order derivatives.
*/
- typedef std::vector<std::vector<Tensor<2,spacedim> > > HessianVector;
+ typedef dealii::Table<2,Tensor<2,spacedim> > HessianVector;
/**
* And the same also applies to the third order derivatives.
*/
- typedef std::vector<std::vector<Tensor<3,spacedim> > > ThirdDerivativeVector;
+ typedef dealii::Table<2,Tensor<3,spacedim> > ThirdDerivativeVector;
/**
* Store the values of the shape functions at the quadrature points. See the
ExcAccessToUninitializedField("update_gradients"));
Assert (fe->is_primitive (i),
ExcShapeFunctionNotPrimitive(i));
- Assert (i<this->finite_element_output.shape_gradients.size(),
- ExcIndexRange (i, 0, this->finite_element_output.shape_gradients.size()));
- Assert (j<this->finite_element_output.shape_gradients[0].size(),
- ExcIndexRange (j, 0, this->finite_element_output.shape_gradients[0].size()));
// if the entire FE is primitive,
// then we can take a short-cut:
ExcAccessToUninitializedField("update_hessians"));
Assert (fe->is_primitive (i),
ExcShapeFunctionNotPrimitive(i));
- Assert (i<this->finite_element_output.shape_hessians.size(),
- ExcIndexRange (i, 0, this->finite_element_output.shape_hessians.size()));
- Assert (j<this->finite_element_output.shape_hessians[0].size(),
- ExcIndexRange (j, 0, this->finite_element_output.shape_hessians[0].size()));
// if the entire FE is primitive,
// then we can take a short-cut:
ExcAccessToUninitializedField("update_3rd_derivatives"));
Assert (fe->is_primitive (i),
ExcShapeFunctionNotPrimitive(i));
- Assert (i<this->finite_element_output.shape_3rd_derivatives.size(),
- ExcIndexRange (i, 0, this->finite_element_output.shape_3rd_derivatives.size()));
- Assert (j<this->finite_element_output.shape_3rd_derivatives[0].size(),
- ExcIndexRange (j, 0, this->finite_element_output.shape_3rd_derivatives[0].size()));
// if the entire FE is primitive,
// then we can take a short-cut:
mapping.transform (make_array_view(fe_data.shape_gradients[k]),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation)
{
mapping.transform (make_array_view(fe_data.shape_hessians[k]),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
mapping.transform (make_array_view(fe_data.shape_gradients[k]),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation)
{
mapping.transform (make_array_view(fe_data.shape_hessians[k]),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
mapping.transform (make_array_view(fe_data.shape_gradients[k]),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation)
{
mapping.transform (make_array_view(fe_data.shape_hessians[k]),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
mapping.transform (make_array_view(fe_data.shape_gradients[k]),
mapping_covariant,
mapping_internal,
- make_array_view(output_data.shape_gradients[k]));
+ make_array_view(output_data.shape_gradients, k));
if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation)
{
mapping.transform (make_array_view(fe_data.shape_hessians[k]),
mapping_covariant_gradient,
mapping_internal,
- make_array_view(output_data.shape_hessians[k]));
+ make_array_view(output_data.shape_hessians, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
for (unsigned int i=0; i<quadrature.size(); ++i)
mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]),
mapping_covariant_hessian,
mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives[k]));
+ make_array_view(output_data.shape_3rd_derivatives, k));
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
correct_third_derivatives(output_data, mapping_data, quadrature.size(), k);
template <int order, int dim, int spacedim, typename Number>
void
do_function_derivatives (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<order,spacedim> > > &shape_derivatives,
+ const Table<2,dealii::Tensor<order,spacedim> > &shape_derivatives,
const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::Tensor<order,spacedim> >::type> &derivatives)
{
template <int dim, int spacedim, typename Number>
void
do_function_laplacians (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<2,spacedim> > > &shape_hessians,
+ const Table<2,dealii::Tensor<2,spacedim> > &shape_hessians,
const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,double>::type> &laplacians)
{
template <int order, int dim, int spacedim, typename Number>
void
do_function_derivatives (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<order,spacedim> > > &shape_derivatives,
+ const Table<2,dealii::Tensor<order,spacedim> > &shape_derivatives,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::Tensor<order+1,spacedim> >::type> &derivatives)
{
template <int dim, int spacedim, typename Number>
void
do_function_symmetric_gradients (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients,
+ const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::SymmetricTensor<2,spacedim> >::type> &symmetric_gradients)
{
template <int dim, int spacedim, typename Number>
void
do_function_divergences (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients,
+ const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,double>::type> &divergences)
{
template <int dim, int spacedim, typename Number>
void
do_function_curls (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients,
+ const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,typename dealii::internal::CurlType<spacedim>::type>::type> &curls)
{
template <int dim, int spacedim, typename Number>
void
do_function_laplacians (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<2,spacedim> > > &shape_hessians,
+ const Table<2,dealii::Tensor<2,spacedim> > &shape_hessians,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::Tensor<1,spacedim> >::type> &laplacians)
{
template <int dim, int spacedim, typename Number>
void
do_function_divergences (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients,
+ const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename SymmetricTensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::Tensor<1,spacedim> >::type> &divergences)
{
template <int dim, int spacedim, typename Number>
void
do_function_divergences (const ::dealii::Vector<Number> &dof_values,
- const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients,
+ const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Tensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
std::vector<typename ProductType<Number,dealii::Tensor<1,spacedim> >::type> &divergences)
{
}
if (flags & update_gradients)
- this->shape_gradients.resize (n_nonzero_shape_components,
- std::vector<Tensor<1,spacedim> > (n_quadrature_points,
- numbers::signaling_nan<Tensor<1,spacedim> >()));
+ {
+ this->shape_gradients.reinit(n_nonzero_shape_components,
+ n_quadrature_points);
+ this->shape_gradients.fill (numbers::signaling_nan<Tensor<1,spacedim> >());
+ }
if (flags & update_hessians)
- this->shape_hessians.resize (n_nonzero_shape_components,
- std::vector<Tensor<2,spacedim> > (n_quadrature_points,
- numbers::signaling_nan<Tensor<2,spacedim> >()));
+ {
+ this->shape_hessians.reinit(n_nonzero_shape_components,
+ n_quadrature_points);
+ this->shape_hessians.fill (numbers::signaling_nan<Tensor<2,spacedim> >());
+ }
if (flags & update_3rd_derivatives)
- this->shape_3rd_derivatives.resize (n_nonzero_shape_components,
- std::vector<Tensor<3,spacedim> > (n_quadrature_points,
- numbers::signaling_nan<Tensor<3,spacedim> >()));
+ {
+ this->shape_3rd_derivatives.reinit(n_nonzero_shape_components,
+ n_quadrature_points);
+ this->shape_3rd_derivatives.fill (numbers::signaling_nan<Tensor<3,spacedim> >());
+ }
}
template <int order, int spacedim, typename Number>
void
do_function_derivatives (const Number *dof_values_ptr,
- const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives,
+ const dealii::Table<2,Tensor<order,spacedim> > &shape_derivatives,
std::vector<Tensor<order,spacedim,Number> > &derivatives)
{
- const unsigned int dofs_per_cell = shape_derivatives.size();
+ const unsigned int dofs_per_cell = shape_derivatives.size()[0];
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
shape_derivatives[0].size() : derivatives.size();
AssertDimension(derivatives.size(), n_quadrature_points);
template <int order, int dim, int spacedim, typename Number>
void
do_function_derivatives (const Number *dof_values_ptr,
- const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives,
+ const dealii::Table<2,Tensor<order,spacedim> > &shape_derivatives,
const FiniteElement<dim,spacedim> &fe,
const std::vector<unsigned int> &shape_function_to_row_table,
VectorSlice<std::vector<std::vector<Tensor<order,spacedim,Number> > > > &derivatives,
template <int spacedim, typename Number, typename Number2>
void
do_function_laplacians (const Number2 *dof_values_ptr,
- const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians,
+ const dealii::Table<2,Tensor<2,spacedim> > &shape_hessians,
std::vector<Number> &laplacians)
{
- const unsigned int dofs_per_cell = shape_hessians.size();
+ const unsigned int dofs_per_cell = shape_hessians.size()[0];
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
shape_hessians[0].size() : laplacians.size();
AssertDimension(laplacians.size(), n_quadrature_points);
template <int dim, int spacedim, typename VectorType, typename Number>
void
do_function_laplacians (const Number *dof_values_ptr,
- const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians,
+ const dealii::Table<2,Tensor<2,spacedim> > &shape_hessians,
const FiniteElement<dim,spacedim> &fe,
const std::vector<unsigned int> &shape_function_to_row_table,
std::vector<VectorType> &laplacians,