/usr/include/dune/geometry/quadraturerules/compositequadraturerule.hh is in libdune-geometry-dev 2.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOMETRY_COMPOSITE_QUADRATURE_RULE_HH
#define DUNE_GEOMETRY_COMPOSITE_QUADRATURE_RULE_HH
/** \file
* \brief Construct composite quadrature rules from other quadrature rules
*/
#include <dune/geometry/quadraturerules.hh>
#include <dune/geometry/virtualrefinement.hh>
namespace Dune {
/** \brief Construct composite quadrature rules from other quadrature rules
*
* \tparam ctype Type used for coordinates and quadrature weights
* \tparam dim Dimension of the reference element
*/
template <class ctype, int dim>
class CompositeQuadratureRule
: public Dune::QuadratureRule<ctype,dim>
{
public:
/** \brief Construct composite quadrature rule
* \param quad Base quadrature rule. Element type of this rule must be simplex
* \param refinement Number of uniform refinement steps
*/
CompositeQuadratureRule(const Dune::QuadratureRule<ctype,dim>& quad, int refinement)
: QuadratureRule<ctype,dim>(quad.type(), quad.order())
{
// Currently only works for simplices, because we are using the StaticRefinement
assert(quad.type().isSimplex());
typedef Dune::StaticRefinement<Dune::GenericGeometry::SimplexTopology<dim>::type::id,
ctype,
Dune::GenericGeometry::SimplexTopology<dim>::type::id,
dim> Refinement;
typedef typename Refinement::ElementIterator eIterator;
ctype volume = Dune::ReferenceElements<ctype,dim>::general(quad.type()).volume();
eIterator eSubEnd = Refinement::eEnd(refinement);
eIterator eSubIt = Refinement::eBegin(refinement);
for (; eSubIt != eSubEnd; ++eSubIt) {
// Percentage of the overall volume of this subelement
ctype volumeFraction = eSubIt.geometry().volume() / volume;
for (size_t i=0; i<quad.size(); i++) {
this->push_back(Dune::QuadraturePoint<ctype,dim>(eSubIt.geometry().global(quad[i].position()),
volumeFraction*quad[i].weight()));
}
}
}
};
}
#endif // DUNE_GEOMETRY_COMPOSITE_QUADRATURE_RULE_HH
|