unit_point(const unsigned int point_index) const;
/**
- * Number of quadrature points of the current cell/face.
+ * Return an object that can be thought of as an array containing all indices
+ * from zero to n_quadrature_points. This allows to write code using
+ * range-based for loops.
*/
- const unsigned int n_q_points;
+ inline std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+ quadrature_point_indices() const;
private:
/**
void
setup(const unsigned int first_selected_component);
+ /**
+ * Number of quadrature points of the current cell/face.
+ */
+ const unsigned int n_q_points;
+
/**
* Pointer to the Mapping object passed to the constructor.
*/
return unit_points[point_index];
}
+
+
+template <int n_components, int dim, int spacedim, typename Number>
+inline std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+FEPointEvaluation<n_components, dim, spacedim, Number>::
+ quadrature_point_indices() const
+{
+ return {0U, n_q_points};
+}
+
DEAL_II_NAMESPACE_CLOSE
#endif
fe_point.evaluate(solution_values_in,
EvaluationFlags::values | EvaluationFlags::gradients);
- for (unsigned int q = 0; q < fe_point.n_q_points; ++q)
+ for (const auto q : fe_point.quadrature_point_indices())
{
fe_point.submit_value(fe_point.JxW(q) * fe_point.get_value(q), q);
fe_point.submit_gradient(fe_point.JxW(q) * fe_point.get_gradient(q),
EvaluationFlags::values |
EvaluationFlags::gradients);
- for (unsigned int q = 0; q < fe_point_faces_m.n_q_points; ++q)
+ for (const auto q : fe_point_faces_m.quadrature_point_indices())
{
fe_point_faces_m.submit_value(fe_point_faces_m.JxW(q) *
(fe_point_faces_m.get_value(q) -