--- /dev/null
+Changed: The overloads of KellyErrorEstimator::estimate() which compute
+multiple vector error estimates at once now require that vectors be passed
+in ArrayView objects of pointers to ReadVector instead of std::vector objects
+of pointers to VectorType objects.
+<br>
+(David Wells, 2023/07/02)
* existence of this function, see the general documentation of this class.
*
* Since we do not want to force the user of this function to copy around
- * their solution vectors, the vector of solution vectors takes pointers to
+ * their solution vectors, the ArrayView of solution vectors takes pointers to
* the solutions, rather than being a vector of vectors. This makes it
* simpler to have the solution vectors somewhere in memory, rather than to
* have them collected somewhere special. (Note that it is not possible to
const DoFHandler<dim, spacedim> &dof,
const Quadrature<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<dim, spacedim> &dof,
const Quadrature<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<dim, spacedim> &dof,
const hp::QCollection<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<dim, spacedim> &dof,
const hp::QCollection<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<1, spacedim> &dof,
const Quadrature<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<1, spacedim> &dof,
const Quadrature<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<1, spacedim> &dof,
const hp::QCollection<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
const DoFHandler<1, spacedim> &dof,
const hp::QCollection<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
const ComponentMask & component_mask = ComponentMask(),
const Function<spacedim> *coefficients = nullptr,
const unsigned int n_threads = numbers::invalid_unsigned_int,
template <typename Number, int dim, int spacedim>
void
integrate_over_regular_face(
- const std::vector<const ReadVector<Number> *> &solutions,
- ParallelData<dim, spacedim, Number> & parallel_data,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ParallelData<dim, spacedim, Number> & parallel_data,
std::map<typename DoFHandler<dim, spacedim>::face_iterator,
- std::vector<double>> & local_face_integrals,
+ std::vector<double>> & local_face_integrals,
const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell,
const unsigned int face_no,
dealii::hp::FEFaceValues<dim, spacedim> &fe_face_values_cell,
template <typename Number, int dim, int spacedim>
void
integrate_over_irregular_face(
- const std::vector<const ReadVector<Number> *> &solutions,
- ParallelData<dim, spacedim, Number> & parallel_data,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ParallelData<dim, spacedim, Number> & parallel_data,
std::map<typename DoFHandler<dim, spacedim>::face_iterator,
- std::vector<double>> & local_face_integrals,
+ std::vector<double>> & local_face_integrals,
const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell,
const unsigned int face_no,
dealii::hp::FEFaceValues<dim, spacedim> & fe_face_values,
void
estimate_one_cell(
const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell,
- ParallelData<dim, spacedim, Number> & parallel_data,
+ ParallelData<dim, spacedim, Number> & parallel_data,
std::map<typename DoFHandler<dim, spacedim>::face_iterator,
- std::vector<double>> & local_face_integrals,
- const std::vector<const ReadVector<Number> *> &solutions,
+ std::vector<double>> & local_face_integrals,
+ const ArrayView<const ReadVector<Number> *> &solutions,
const typename KellyErrorEstimator<dim, spacedim>::Strategy strategy)
{
const unsigned int n_solution_vectors = solutions.size();
const Strategy strategy)
{
// just pass on to the other function
- const std::vector<const ReadVector<Number> *> solutions(1, &solution);
- std::vector<Vector<float> *> errors(1, &error);
+ std::vector<const ReadVector<Number> *> solutions(1, &solution);
+ std::vector<Vector<float> *> errors(1, &error);
+ ArrayView<Vector<float> *> error_view = make_array_view(errors);
estimate(mapping,
dof_handler,
quadrature,
neumann_bc,
- solutions,
- errors,
+ make_array_view(solutions),
+ error_view,
component_mask,
coefficients,
n_threads,
const Strategy strategy)
{
// just pass on to the other function
- const std::vector<const ReadVector<Number> *> solutions(1, &solution);
- std::vector<Vector<float> *> errors(1, &error);
+ std::vector<const ReadVector<Number> *> solutions(1, &solution);
+ std::vector<Vector<float> *> errors(1, &error);
+ ArrayView<Vector<float> *> error_view = make_array_view(errors);
estimate(mapping,
dof_handler,
quadrature,
neumann_bc,
- solutions,
- errors,
+ make_array_view(solutions),
+ error_view,
component_mask,
coefficients,
n_threads,
const DoFHandler<dim, spacedim> &dof_handler,
const hp::QCollection<dim - 1> & face_quadratures,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
const unsigned int,
const types::subdomain_id subdomain_id_,
const types::material_id material_id,
const DoFHandler<dim, spacedim> &dof_handler,
const Quadrature<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
// forward to the function with the QCollection
estimate(mapping,
const DoFHandler<dim, spacedim> &dof_handler,
const Quadrature<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
estimate(get_default_linear_mapping(dof_handler.get_triangulation()),
dof_handler,
const DoFHandler<dim, spacedim> &dof_handler,
const hp::QCollection<dim - 1> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
estimate(get_default_linear_mapping(dof_handler.get_triangulation()),
dof_handler,
const Quadrature<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const Quadrature<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const hp::QCollection<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const hp::QCollection<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const Strategy strategy)
{
// just pass on to the other function
- const std::vector<const ReadVector<Number> *> solutions(1, &solution);
- std::vector<Vector<float> *> errors(1, &error);
+ std::vector<const ReadVector<Number> *> solutions(1, &solution);
+ std::vector<Vector<float> *> errors(1, &error);
+ ArrayView<Vector<float> *> error_view = make_array_view(errors);
estimate(mapping,
dof_handler,
quadrature,
neumann_bc,
- solutions,
- errors,
+ make_array_view(solutions),
+ error_view,
component_mask,
coefficients,
n_threads,
const DoFHandler<1, spacedim> &dof_handler,
const Quadrature<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
const auto reference_cell = ReferenceCells::Line;
estimate(reference_cell.template get_default_linear_mapping<1, spacedim>(),
const Strategy strategy)
{
// just pass on to the other function
- const std::vector<const ReadVector<Number> *> solutions(1, &solution);
- std::vector<Vector<float> *> errors(1, &error);
+ std::vector<const ReadVector<Number> *> solutions(1, &solution);
+ std::vector<Vector<float> *> errors(1, &error);
+ ArrayView<Vector<float> *> error_view = make_array_view(errors);
estimate(mapping,
dof_handler,
quadrature,
neumann_bc,
- solutions,
- errors,
+ make_array_view(solutions),
+ error_view,
component_mask,
coefficients,
n_threads,
const DoFHandler<1, spacedim> &dof_handler,
const hp::QCollection<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
const auto reference_cell = ReferenceCells::Line;
estimate(reference_cell.template get_default_linear_mapping<1, spacedim>(),
const DoFHandler<1, spacedim> &dof_handler,
const hp::QCollection<0> &,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficient,
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficient,
const unsigned int,
const types::subdomain_id subdomain_id_,
const types::material_id material_id,
const DoFHandler<1, spacedim> &dof_handler,
const Quadrature<0> & quadrature,
const std::map<types::boundary_id, const Function<spacedim, Number> *>
- & neumann_bc,
- const std::vector<const ReadVector<Number> *> &solutions,
- std::vector<Vector<float> *> & errors,
- const ComponentMask & component_mask,
- const Function<spacedim> * coefficients,
- const unsigned int n_threads,
- const types::subdomain_id subdomain_id,
- const types::material_id material_id,
- const Strategy strategy)
+ & neumann_bc,
+ const ArrayView<const ReadVector<Number> *> &solutions,
+ ArrayView<Vector<float> *> & errors,
+ const ComponentMask & component_mask,
+ const Function<spacedim> * coefficients,
+ const unsigned int n_threads,
+ const types::subdomain_id subdomain_id,
+ const types::material_id material_id,
+ const Strategy strategy)
{
const hp::QCollection<0> quadrature_collection(quadrature);
estimate(mapping,
const Quadrature<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const Quadrature<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const hp::QCollection<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
const hp::QCollection<deal_II_dimension - 1> &,
const std::map<types::boundary_id,
const Function<deal_II_space_dimension, S> *> &,
- const std::vector<const ReadVector<S> *> &,
- std::vector<Vector<float> *> &,
+ const ArrayView<const ReadVector<S> *> &,
+ ArrayView<Vector<float> *> &,
const ComponentMask &,
const Function<deal_II_space_dimension> *,
const unsigned int,
EigenvalueProblem<dim>::estimate_error()
{
{
- std::vector<const PETScWrappers::MPI::Vector *> sol(
- number_of_eigenvalues);
- std::vector<Vector<float> *> error(number_of_eigenvalues);
+ std::vector<const ReadVector<PetscScalar> *> sol(number_of_eigenvalues);
+ std::vector<Vector<float> *> error(number_of_eigenvalues);
for (unsigned int i = 0; i < number_of_eigenvalues; ++i)
{
face_quadrature_formula.push_back(QGauss<dim - 1>(3));
face_quadrature_formula.push_back(QGauss<dim - 1>(3));
+ ArrayView<const ReadVector<PetscScalar> *> sol_view =
+ make_array_view(sol);
+ ArrayView<Vector<float> *> error_view = make_array_view(error);
KellyErrorEstimator<dim>::estimate(
dof_handler,
face_quadrature_formula,
std::map<types::boundary_id, const Function<dim> *>(),
- sol,
- error);
+ sol_view,
+ error_view);
}
// sum up for a global:
EigenvalueProblem<dim>::estimate_error()
{
{
- std::vector<const PETScWrappers::MPI::Vector *> sol(
- number_of_eigenvalues);
- std::vector<dealii::Vector<float> *> error(number_of_eigenvalues);
+ std::vector<const ReadVector<PetscScalar> *> sol(number_of_eigenvalues);
+ std::vector<Vector<float> *> error(number_of_eigenvalues);
for (unsigned int i = 0; i < number_of_eigenvalues; ++i)
{
face_quadrature_formula.push_back(dealii::QGauss<dim - 1>(3));
face_quadrature_formula.push_back(dealii::QGauss<dim - 1>(3));
+ ArrayView<const ReadVector<PetscScalar> *> sol_view =
+ make_array_view(sol);
+ ArrayView<Vector<float> *> error_view = make_array_view(error);
KellyErrorEstimator<dim>::estimate(
dof_handler,
face_quadrature_formula,
std::map<types::boundary_id, const Function<dim> *>(),
- sol,
- error);
+ sol_view,
+ error_view);
}
// sum up for a global: