58template <
int spacedim>
59template <
typename InputVector>
68 const InputVector & solution,
72 const unsigned int n_threads,
78 const std::vector<const InputVector *> solutions(1, &solution);
79 std::vector<Vector<float> *> errors(1, &error);
96template <
int spacedim>
97template <
typename InputVector>
105 const InputVector & solution,
109 const unsigned int n_threads,
130template <
int spacedim>
131template <
typename InputVector>
139 const std::vector<const InputVector *> &solutions,
143 const unsigned int n_threads,
164template <
int spacedim>
165template <
typename InputVector>
174 const InputVector & solution,
178 const unsigned int n_threads,
184 const std::vector<const InputVector *> solutions(1, &solution);
185 std::vector<Vector<float> *> errors(1, &error);
202template <
int spacedim>
203template <
typename InputVector>
211 const InputVector & solution,
215 const unsigned int n_threads,
236template <
int spacedim>
237template <
typename InputVector>
245 const std::vector<const InputVector *> &solutions,
249 const unsigned int n_threads,
270template <
int spacedim>
271template <
typename InputVector>
280 const std::vector<const InputVector *> &solutions,
290 using number =
typename InputVector::value_type;
299 "For distributed Triangulation objects and associated "
300 "DoFHandler objects, asking for any subdomain other than the "
301 "locally owned one does not make sense."));
306 subdomain_id = subdomain_id_;
310 const unsigned int n_solution_vectors = solutions.size();
315 ExcMessage(
"You are not allowed to list the special boundary "
316 "indicator for internal boundaries in your boundary "
319 for (
const auto &boundary_function : neumann_bc)
321 (void)boundary_function;
322 Assert(boundary_function.second->n_components == n_components,
323 ExcInvalidBoundaryFunction(boundary_function.first,
324 boundary_function.second->n_components,
329 ExcInvalidComponentMask());
331 ExcInvalidComponentMask());
333 Assert((coefficient ==
nullptr) ||
336 ExcInvalidCoefficient());
338 Assert(solutions.size() > 0, ExcNoSolutions());
339 Assert(solutions.size() == errors.size(),
340 ExcIncompatibleNumberOfElements(solutions.size(), errors.size()));
341 for (
unsigned int n = 0; n < solutions.size(); ++n)
345 Assert((coefficient ==
nullptr) ||
348 ExcInvalidCoefficient());
350 for (
const auto &boundary_function : neumann_bc)
352 (void)boundary_function;
353 Assert(boundary_function.second->n_components == n_components,
354 ExcInvalidBoundaryFunction(boundary_function.first,
355 boundary_function.second->n_components,
360 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
367 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
368 gradients_here(n_solution_vectors,
372 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
373 gradients_neighbor(gradients_here);
374 std::vector<Vector<typename ProductType<number, double>::type>>
375 grad_dot_n_neighbor(n_solution_vectors,
383 if (coefficient ==
nullptr)
384 for (
unsigned int c = 0; c < n_components; ++c)
385 coefficient_values(c) = 1;
409 (cell->subdomain_id() == subdomain_id)) &&
411 (cell->material_id() == material_id)))
413 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
414 (*errors[n])(cell->active_cell_index()) = 0;
417 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
419 *solutions[s], gradients_here[s]);
423 for (
unsigned int n = 0; n < 2; ++n)
426 auto neighbor = cell->neighbor(n);
428 while (neighbor->has_children())
429 neighbor = neighbor->child(n == 0 ? 1 : 0);
431 fe_face_values.
reinit(cell, n);
437 fe_values.
reinit(neighbor);
439 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
441 *solutions[s], gradients_neighbor[s]);
443 fe_face_values.
reinit(neighbor, n == 0 ? 1 : 0);
446 .get_normal_vectors()[0];
450 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
451 for (
unsigned int c = 0; c < n_components; ++c)
452 grad_dot_n_neighbor[s](c) =
453 -(gradients_neighbor[s][n == 0 ? 1 : 0][c] *
456 else if (neumann_bc.find(n) != neumann_bc.end())
460 if (n_components == 1)
462 const typename InputVector::value_type v =
463 neumann_bc.find(n)->second->value(cell->vertex(n));
465 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
466 grad_dot_n_neighbor[s](0) = v;
471 neumann_bc.find(n)->second->vector_value(cell->vertex(n),
474 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
475 grad_dot_n_neighbor[s] = v;
480 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
481 grad_dot_n_neighbor[s] = 0;
485 if (coefficient !=
nullptr)
489 const double c_value = coefficient->
value(cell->vertex(n));
490 for (
unsigned int c = 0; c < n_components; ++c)
491 coefficient_values(c) = c_value;
499 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
500 for (
unsigned int component = 0; component < n_components;
502 if (component_mask[component] ==
true)
507 gradients_here[s][n][component] * normal;
510 ((grad_dot_n_here - grad_dot_n_neighbor[s](component)) *
511 coefficient_values(component));
512 (*errors[s])(cell->active_cell_index()) +=
515 double>::type>::abs_square(jump) *
520 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
521 (*errors[s])(cell->active_cell_index()) =
522 std::sqrt((*errors[s])(cell->active_cell_index()));
528template <
int spacedim>
529template <
typename InputVector>
538 const std::vector<const InputVector *> &solutions,
542 const unsigned int n_threads,
550 quadrature_collection,
565#include "error_estimator_1d.inst"
bool represents_n_components(const unsigned int n) const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const Triangulation< dim, spacedim > & get_triangulation() const
types::global_dof_index n_dofs() const
unsigned int n_components() const
const unsigned int n_components
virtual RangeNumberType value(const Point< dim > &p, const unsigned int component=0) const
virtual void vector_value(const Point< dim > &p, Vector< RangeNumberType > &values) const
static void estimate(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim - 1 > &quadrature, const std::map< types::boundary_id, const Function< spacedim, typename InputVector::value_type > * > &neumann_bc, const InputVector &solution, Vector< float > &error, const ComponentMask &component_mask=ComponentMask(), const Function< spacedim > *coefficients=nullptr, const unsigned int n_threads=numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id, const types::material_id material_id=numbers::invalid_material_id, const Strategy strategy=cell_diameter_over_24)
Abstract base class for mapping classes.
unsigned int n_active_cells() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda > > &cell, const unsigned int face_no, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
const FEValuesType & get_present_fe_values() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda > > &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
void push_back(const Mapping< dim, spacedim > &new_mapping)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
@ update_normal_vectors
Normal vectors.
@ update_gradients
Shape function gradients.
IteratorRange< active_cell_iterator > active_cell_iterators() const
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
@ valid
Iterator points to a valid object.
const types::material_id invalid_material_id
const types::boundary_id internal_face_boundary_id
const types::subdomain_id invalid_subdomain_id
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type