version 0.4.1
tensorproductquadrule.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
8#pragma once
9
10#include <dune/geometry/quadraturerules.hh>
11namespace Ikarus {
12
28template <class BaseQuadrature, class Quadrature>
29auto tensorProductQuadrature(const BaseQuadrature& baseQuad, const Quadrature& onedQuad) {
30 constexpr int baseQuadDim = BaseQuadrature::d;
31 auto rule = Dune::QuadratureRule<double, baseQuadDim + 1>();
32 const unsigned int baseQuadSize = baseQuad.size();
33 for (unsigned int bqi = 0; bqi < baseQuadSize; ++bqi) {
34 const typename Dune::QuadraturePoint<double, baseQuadDim>::Vector& basePoint = baseQuad[bqi].position();
35 const double& baseWeight = baseQuad[bqi].weight();
36
37 typename Dune::QuadraturePoint<double, baseQuadDim + 1>::Vector point;
38 for (unsigned int i = 0; i < baseQuadDim; ++i)
39 point[i] = basePoint[i];
40
41 const unsigned int onedQuadSize = onedQuad.size();
42 for (unsigned int oqi = 0; oqi < onedQuadSize; ++oqi) {
43 point[baseQuadDim] = onedQuad[oqi].position()[0];
44 rule.emplace_back(Dune::QuadraturePoint(point, baseWeight * onedQuad[oqi].weight()));
45 }
46 }
47 return rule;
48}
49} // namespace Ikarus
Definition: assemblermanipulatorbuildingblocks.hh:22
auto tensorProductQuadrature(const BaseQuadrature &baseQuad, const Quadrature &onedQuad)
Computes the tensor product quadrature rule using a base and one-dimensional quadrature rule.
Definition: tensorproductquadrule.hh:29