*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const;
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const;
/**
* This function relates to get_function_gradients() in the same way
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const;
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const;
/**
* This function relates to get_function_gradients() in the same way
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const;
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const;
/**
* This function relates to get_function_gradients() in the same way
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector &fe_function,
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
- &gradients) const;
+ const ReadVector<Number> & fe_function,
+ std::vector<Tensor<1, spacedim, Number>> &gradients) const;
/**
* This function does the same as the other get_function_gradients(), but
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector &fe_function,
- std::vector<
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>>>
- &gradients) const;
+ const ReadVector<Number> & fe_function,
+ std::vector<std::vector<Tensor<1, spacedim, Number>>> &gradients) const;
/**
* This function relates to the first of the get_function_gradients() function
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector & fe_function,
+ const ReadVector<Number> & fe_function,
const ArrayView<const types::global_dof_index> &indices,
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
- &gradients) const;
+ std::vector<Tensor<1, spacedim, Number>> & gradients) const;
/**
* This function relates to the first of the get_function_gradients() function
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
- template <class InputVector>
+ template <typename Number>
void
get_function_gradients(
- const InputVector & fe_function,
- const ArrayView<const types::global_dof_index> &indices,
- ArrayView<
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>>>
- gradients,
+ const ReadVector<Number> & fe_function,
+ const ArrayView<const types::global_dof_index> & indices,
+ ArrayView<std::vector<Tensor<1, spacedim, Number>>> gradients,
const bool quadrature_points_fastest = false) const;
/** @} */
template <int dim, int spacedim>
- template <class InputVector>
+ template <typename Number>
void
Scalar<dim, spacedim>::get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const
{
Assert(fe_values->update_flags & update_gradients,
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
fe_values->present_cell.n_dofs_for_dof_handler());
// get function values of dofs on this cell
- dealii::Vector<typename InputVector::value_type> dof_values(
- fe_values->dofs_per_cell);
+ dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
fe_values->present_cell.get_interpolated_dof_values(fe_function,
dof_values);
internal::do_function_derivatives<1, dim, spacedim>(
template <int dim, int spacedim>
- template <class InputVector>
+ template <typename InputVector>
void
Scalar<dim, spacedim>::get_function_gradients_from_local_dof_values(
const InputVector &dof_values,
template <int dim, int spacedim>
- template <class InputVector>
+ template <typename Number>
void
Vector<dim, spacedim>::get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const
{
Assert(fe_values->update_flags & update_gradients,
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
fe_values->present_cell.n_dofs_for_dof_handler());
// get function values of dofs on this cell
- dealii::Vector<typename InputVector::value_type> dof_values(
- fe_values->dofs_per_cell);
+ dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
fe_values->present_cell.get_interpolated_dof_values(fe_function,
dof_values);
internal::do_function_derivatives<1, dim, spacedim>(
template <int dim, int spacedim>
- template <class InputVector>
+ template <typename InputVector>
void
Vector<dim, spacedim>::get_function_gradients_from_local_dof_values(
const InputVector &dof_values,
template <int dim, int spacedim>
- template <class InputVector>
+ template <typename Number>
void
Tensor<2, dim, spacedim>::get_function_gradients(
- const InputVector &fe_function,
- std::vector<solution_gradient_type<typename InputVector::value_type>>
- &gradients) const
+ const ReadVector<Number> & fe_function,
+ std::vector<solution_gradient_type<Number>> &gradients) const
{
Assert(fe_values->update_flags & update_gradients,
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
// get function values of dofs
// on this cell
- dealii::Vector<typename InputVector::value_type> dof_values(
- fe_values->dofs_per_cell);
+ dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
fe_values->present_cell.get_interpolated_dof_values(fe_function,
dof_values);
internal::do_function_gradients<dim, spacedim>(
template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
void
FEValuesBase<dim, spacedim>::get_function_gradients(
- const InputVector &fe_function,
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>> &gradients)
- const
+ const ReadVector<Number> & fe_function,
+ std::vector<Tensor<1, spacedim, Number>> &gradients) const
{
- using Number = typename InputVector::value_type;
Assert(this->update_flags & update_gradients,
ExcAccessToUninitializedField("update_gradients"));
AssertDimension(fe->n_components(), 1);
template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
void
FEValuesBase<dim, spacedim>::get_function_gradients(
- const InputVector & fe_function,
+ const ReadVector<Number> & fe_function,
const ArrayView<const types::global_dof_index> &indices,
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>> &gradients)
- const
+ std::vector<Tensor<1, spacedim, Number>> & gradients) const
{
- using Number = typename InputVector::value_type;
Assert(this->update_flags & update_gradients,
ExcAccessToUninitializedField("update_gradients"));
AssertDimension(fe->n_components(), 1);
AssertDimension(indices.size(), dofs_per_cell);
boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
- for (unsigned int i = 0; i < dofs_per_cell; ++i)
- dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
- internal::do_function_derivatives(make_array_view(dof_values.begin(),
- dof_values.end()),
+ auto view = make_array_view(dof_values.begin(), dof_values.end());
+ fe_function.extract_subvector_to(indices, view);
+ internal::do_function_derivatives(view,
this->finite_element_output.shape_gradients,
gradients);
}
template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
void
FEValuesBase<dim, spacedim>::get_function_gradients(
- const InputVector &fe_function,
- std::vector<
- std::vector<Tensor<1, spacedim, typename InputVector::value_type>>>
- &gradients) const
+ const ReadVector<Number> & fe_function,
+ std::vector<std::vector<Tensor<1, spacedim, Number>>> &gradients) const
{
- using Number = typename InputVector::value_type;
Assert(this->update_flags & update_gradients,
ExcAccessToUninitializedField("update_gradients"));
Assert(present_cell.is_initialized(), ExcNotReinited());
template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
void
FEValuesBase<dim, spacedim>::get_function_gradients(
- const InputVector & fe_function,
- const ArrayView<const types::global_dof_index> &indices,
- ArrayView<std::vector<Tensor<1, spacedim, typename InputVector::value_type>>>
- gradients,
+ const ReadVector<Number> & fe_function,
+ const ArrayView<const types::global_dof_index> & indices,
+ ArrayView<std::vector<Tensor<1, spacedim, Number>>> gradients,
const bool quadrature_points_fastest) const
{
- using Number = typename InputVector::value_type;
// Size of indices must be a multiple of dofs_per_cell such that an integer
// number of function values is generated in each point.
Assert(indices.size() % dofs_per_cell == 0,
Assert(this->update_flags & update_gradients,
ExcAccessToUninitializedField("update_gradients"));
- boost::container::small_vector<Number, 200> dof_values(indices.size());
- for (unsigned int i = 0; i < indices.size(); ++i)
- dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
+ boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
+ auto view = make_array_view(dof_values.begin(), dof_values.end());
+ fe_function.extract_subvector_to(indices, view);
internal::do_function_derivatives(
make_array_view(dof_values.begin(), dof_values.end()),
this->finite_element_output.shape_gradients,
const ArrayView<const types::global_dof_index> &,
ArrayView<std::vector<S>>,
bool) const;
+
+ template void
+ FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ std::vector<
+ ProductType<S, dealii::Tensor<1, deal_II_space_dimension>>::type> &)
+ const;
+
+ template void
+ FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ std::vector<
+ ProductType<S, dealii::Tensor<2, deal_II_space_dimension>>::type> &)
+ const;
+
+ template void
+ FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ std::vector<
+ ProductType<S, dealii::Tensor<3, deal_II_space_dimension>>::type> &)
+ const;
+
+ template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ std::vector<dealii::Tensor<1, deal_II_space_dimension, S>> &) const;
+
+ template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ const ArrayView<const types::global_dof_index> &,
+ std::vector<dealii::Tensor<1, deal_II_space_dimension, S>> &) const;
+
+ template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ std::vector<std::vector<dealii::Tensor<1, deal_II_space_dimension, S>>>
+ &) const;
+
+ template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+ get_function_gradients<S>(
+ const ReadVector<S> &,
+ const ArrayView<const types::global_dof_index> &,
+ ArrayView<std::vector<dealii::Tensor<1, deal_II_space_dimension, S>>>,
+ bool) const;
# endif
}
{
# if deal_II_dimension <= deal_II_space_dimension
template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::VEC>(
- const dealii::VEC &,
- std::vector<
- ProductType<dealii::VEC::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
- template void
FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
get_function_hessians<dealii::VEC>(
const dealii::VEC &,
const;
template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::VEC>(
- const dealii::VEC &,
- std::vector<
- ProductType<dealii::VEC::value_type,
- dealii::Tensor<2, deal_II_space_dimension>>::type> &)
- const;
- template void
FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
get_function_symmetric_gradients<dealii::VEC>(
const dealii::VEC &,
ProductType<dealii::VEC::value_type,
dealii::Tensor<1, deal_II_space_dimension>>::type> &)
const;
- template void
- FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::VEC>(
- const dealii::VEC &,
- std::vector<
- ProductType<dealii::VEC::value_type,
- dealii::Tensor<3, deal_II_space_dimension>>::type> &)
- const;
# endif
}
{
# if deal_II_dimension <= deal_II_space_dimension
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<VEC>(
- const VEC &,
- std::vector<dealii::Tensor<1, deal_II_space_dimension, VEC::value_type>>
- &) const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<VEC>(
- const VEC &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<dealii::Tensor<1, deal_II_space_dimension, VEC::value_type>>
- &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<VEC>(
- const VEC &,
- std::vector<std::vector<
- dealii::Tensor<1, deal_II_space_dimension, VEC::value_type>>> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<VEC>(
- const VEC &,
- const ArrayView<const types::global_dof_index> &,
- ArrayView<std::vector<
- dealii::Tensor<1, deal_II_space_dimension, VEC::value_type>>>,
- bool) const;
-
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
get_function_hessians<VEC>(
const VEC &,