14#ifndef DUMUX_GEOMETRY_REFINEMENT_QUADRATURERULE_HH
15#define DUMUX_GEOMETRY_REFINEMENT_QUADRATURERULE_HH
17#include <dune/geometry/quadraturerules.hh>
18#include <dune/geometry/virtualrefinement.hh>
27template<
typename ct,
int mydim>
32 static constexpr int dim = mydim;
42 auto& refinement = Dune::buildRefinement<dim, ct>(type, type);
43 const auto tag = Dune::refinementLevels(levels);
46 const auto numVertices = refinement.nVertices(tag);
47 std::vector<Dune::FieldVector<ct, dim>> points; points.reserve(numVertices);
48 auto vIt = refinement.vBegin(tag);
49 const auto vItEnd = refinement.vEnd(tag);
50 for (; vIt != vItEnd; ++vIt)
51 points.emplace_back(vIt.coords());
54 const auto numElements = refinement.nElements(tag);
55 this->reserve(numElements);
56 auto eIt = refinement.eBegin(tag);
57 const auto eItEnd = refinement.eEnd(tag);
58 for (; eIt != eItEnd; ++eIt)
61 const auto weight = computeVolume_(type, points, eIt.vertexIndices());
62 this->emplace_back(eIt.coords(), weight);
67 template<
class VertexIndices>
68 ct computeVolume_(Dune::GeometryType t,
const std::vector<Dune::FieldVector<ct, dim>>& points,
const VertexIndices& indices)
const
70 if (t != Dune::GeometryTypes::simplex(2))
71 DUNE_THROW(Dune::NotImplemented,
"Only implemented for 2d simplices");
73 const auto ab = points[indices[1]] - points[indices[0]];
74 const auto ac = points[indices[2]] - points[indices[0]];
A "quadrature" based on virtual refinement.
Definition: refinementquadraturerule.hh:29
~RefinementQuadratureRule() final
Definition: refinementquadraturerule.hh:37
RefinementQuadratureRule(Dune::GeometryType type, int levels)
Definition: refinementquadraturerule.hh:39
static constexpr int dim
The space dimension.
Definition: refinementquadraturerule.hh:32
static constexpr int highest_order
The highest quadrature order available.
Definition: refinementquadraturerule.hh:35
Dune::FieldVector< Scalar, 3 > crossProduct(const Dune::FieldVector< Scalar, 3 > &vec1, const Dune::FieldVector< Scalar, 3 > &vec2)
Cross product of two vectors in three-dimensional Euclidean space.
Definition: math.hh:671
Define some often used mathematical functions.
Definition: common/pdesolver.hh:24