17#ifndef dealii_vector_tools_evaluation_h
18#define dealii_vector_tools_evaluation_h
71 template <
int n_components,
int dim,
int spacedim,
typename VectorType>
72 std::vector<typename FEPointEvaluation<n_components, dim>::value_type>
76 const VectorType & vector,
89 template <
int n_components,
int dim,
int spacedim,
typename VectorType>
90 std::vector<typename FEPointEvaluation<n_components, dim>::value_type>
94 const VectorType & vector,
103 template <
int n_components,
int dim,
int spacedim,
typename VectorType>
104 inline std::vector<typename FEPointEvaluation<n_components, dim>::value_type>
107 const VectorType & vector,
114 return point_values<n_components>(cache, dof_handler, vector, flags);
124 template <
typename T>
153 template <
int rank,
int dim,
typename Number>
162 return std::accumulate(
values.begin(),
165 (Number(1.0) *
values.size());
178 template <
int n_components,
int dim,
int spacedim,
typename VectorType>
179 inline std::vector<typename FEPointEvaluation<n_components, dim>::value_type>
183 const VectorType & vector,
191 "Utilities::MPI::RemotePointEvaluation is not ready yet! "
192 "Please call Utilities::MPI::RemotePointEvaluation::reinit() "
193 "yourself or the other point_values(), which does this for"
199 "The provided Utilities::MPI::RemotePointEvaluation and DoFHandler "
200 "object have been set up with different Triangulation objects, "
201 "a scenario not supported!"));
204 const auto evaluation_point_results = [&]() {
207 const auto evaluation_function = [&](
auto &
values,
208 const auto &cell_data) {
209 std::vector<typename VectorType::value_type> solution_values;
211 std::vector<std::unique_ptr<FEPointEvaluation<n_components, dim>>>
214 for (
unsigned int i = 0; i < cell_data.cells.size(); ++i)
218 cell_data.cells[i].first,
219 cell_data.cells[i].second,
223 cell_data.reference_point_values.data() +
224 cell_data.reference_point_ptrs[i],
225 cell_data.reference_point_ptrs[i + 1] -
226 cell_data.reference_point_ptrs[i]);
228 solution_values.resize(
230 cell->get_dof_values(vector,
231 solution_values.begin(),
232 solution_values.end());
234 if (evaluators[cell->active_fe_index()] ==
nullptr)
235 evaluators[cell->active_fe_index()] =
236 std::make_unique<FEPointEvaluation<n_components, dim>>(
238 auto &evaluator = *evaluators[cell->active_fe_index()];
240 evaluator.
reinit(cell, unit_points);
241 evaluator.evaluate(solution_values,
244 for (
unsigned int q = 0; q < unit_points.size(); ++q)
245 values[q + cell_data.reference_point_ptrs[i]] =
246 evaluator.get_value(q);
250 std::vector<value_type> evaluation_point_results;
251 std::vector<value_type> buffer;
253 cache.template evaluate_and_process<value_type>(evaluation_point_results,
255 evaluation_function);
257 return evaluation_point_results;
263 return evaluation_point_results;
268 std::vector<value_type> unique_evaluation_point_results(
273 for (
unsigned int i = 0; i < ptr.size() - 1; ++i)
275 const auto n_entries = ptr[i + 1] - ptr[i];
279 unique_evaluation_point_results[i] =
280 internal::reduce(flags,
282 evaluation_point_results.data() + ptr[i],
286 return unique_evaluation_point_results;
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
void reinit(const Triangulation< dim, spacedim > &tria)
typename internal::FEPointEvaluation::EvaluatorTypeTraits< dim, n_components, Number >::value_type value_type
unsigned int n_dofs_per_cell() const
Abstract base class for mapping classes.
const Triangulation< dim, spacedim > & get_triangulation() const
const std::vector< unsigned int > & get_point_ptrs() const
bool is_map_unique() const
const Mapping< dim, spacedim > & get_mapping() const
void reinit(const std::vector< Point< spacedim > > &points, const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping)
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
@ update_values
Shape function values.
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::active_cell_iterator active_cell_iterator
The namespace for the EvaluationFlags enum.
EvaluationFlags
The EvaluationFlags enum.