Commit 7465e2c2 authored by Praetorius, Simon's avatar Praetorius, Simon

Local basis cache depending on node type

parent d68cbeaf
This diff is collapsed.
#pragma once
#include <vector>
#include <dune/geometry/quadraturerules.hh>
#include <dune/geometry/type.hh>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/TupleUtility.hpp>
#include <amdis/utility/ConcurrentCache.hpp>
namespace AMDiS
{
namespace Impl
{
/// Pair of GeometryType and quadrature order and size
template <class LocalBasisType, class Tag>
struct EvaluatorCacheKey
{
using type = std::tuple<HashableGeometryType,typename LocalBasisType::Traits::DomainType>;
type value;
friend std::size_t hash_value(EvaluatorCacheKey const& t)
{
std::size_t seed = hash_value(std::get<0>(t.value));
Dune::hash_range(seed, std::get<1>(t.value).begin(), std::get<1>(t.value).end());
return seed;
}
friend bool operator==(EvaluatorCacheKey const& lhs, EvaluatorCacheKey const& rhs)
{
return lhs.value == rhs.value;
}
};
}
} // end namespace AMDiS
DUNE_DEFINE_HASH(DUNE_HASH_TEMPLATE_ARGS(class LocalBasisType, class Tag),DUNE_HASH_TYPE(AMDiS::Impl::EvaluatorCacheKey<LocalBasisType,Tag>))
namespace AMDiS
{
template <class LocalBasisType>
class LocalBasisEvaluatorCache
{
public:
using Traits = typename LocalBasisType::Traits;
using DomainType = typename Traits::DomainType;
using RangeType = typename Traits::RangeType;
using RangeFieldType = typename Traits::RangeFieldType;
using JacobianType = typename Traits::JacobianType;
using QuadratureRule = Dune::QuadratureRule<RangeFieldType,Traits::dimDomain>;
using QuadratureRules = Dune::QuadratureRules<RangeFieldType,Traits::dimDomain>;
private:
using ValuesKey = Impl::EvaluatorCacheKey<LocalBasisType, struct ValuesTag>;
using GradientsKey = Impl::EvaluatorCacheKey<LocalBasisType, struct GradientsTag>;
using Policy = tag::thread_local_policy;
public:
using ShapeValues = std::vector<RangeType>;
using ShapeGradients = std::vector<JacobianType>;
LocalBasisEvaluatorCache(LocalBasisType const& localBasis)
: localBasis_(&localBasis)
{}
template <class LocalContext>
ShapeValues const& evaluateFunction(LocalContext const& context, DomainType const& local)
{
ValuesKey key{typename ValuesKey::type{context.type(),local}};
return ShapeValuesCache::get(key, [&](ShapeValues* data, ValuesKey const&)
{
localBasis_->evaluateFunction(local, *data);
});
}
template <class LocalContext>
ShapeGradients const& evaluateJacobian(LocalContext const& context, DomainType const& local)
{
GradientsKey key{typename GradientsKey::type{context.type(),local}};
return ShapeGradientsCache::get(key, [&](ShapeGradients* data, GradientsKey const&)
{
localBasis_->evaluateJacobian(local, *data);
});
}
private:
using ShapeValuesCache = ConcurrentCache<ValuesKey, ShapeValues, Policy>;
using ShapeGradientsCache = ConcurrentCache<GradientsKey, ShapeGradients, Policy>;
LocalBasisType const* localBasis_;
};
} // end namespace AMDiS
......@@ -58,8 +58,7 @@ namespace AMDiS
static_assert(std::is_same<FiniteElementType_t<RowNode>, FiniteElementType_t<ColNode>>{},
"Galerkin operator requires equal finite elements for test and trial space." );
using LocalBasisType = typename FiniteElementType_t<RowNode>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<RowNode>::Traits::RangeFieldType;
auto localFctA = localFunction(gridFctA_); localFctA.bind(context.element());
auto localFctB = localFunction(gridFctB_); localFctB.bind(context.element());
......@@ -75,9 +74,9 @@ namespace AMDiS
using QuadratureRules = Dune::QuadratureRules<typename Context::Geometry::ctype, Context::LocalContext::mydimension>;
auto const& quad = QuadratureRules::rule(context.type(), quadDeg);
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context, quad);
NodeQuadCache<RowNode> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
......@@ -146,8 +145,6 @@ namespace AMDiS
static_assert(Node::isLeaf,
"Operator can be applied to Leaf-Nodes only." );
using LocalBasisType = typename FiniteElementType_t<Node>::Traits::LocalBasisType;
auto localFctF = localFunction(gridFctF_); localFctF.bind(context.element());
auto const& localFE = node.finiteElement();
......@@ -158,8 +155,8 @@ namespace AMDiS
using QuadratureRules = Dune::QuadratureRules<typename Context::Geometry::ctype, Context::LocalContext::dimension>;
auto const& quad = QuadratureRules::rule(context.type(), quad_order);
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context, quad);
NodeQuadCache<Node> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
......
......@@ -50,12 +50,10 @@ namespace AMDiS
auto const& localFE = node.child(0).finiteElement();
std::size_t feSize = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<typename Node::ChildType>::Traits::RangeFieldType;
NodeQuadCache<typename Node::ChildType> cache(localFE.localBasis());
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -48,12 +48,10 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t feSize = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<Node>::Traits::RangeFieldType;
NodeQuadCache<Node> cache(localFE.localBasis());
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -49,12 +49,10 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t feSize = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<Node>::Traits::RangeFieldType;
NodeQuadCache<Node> cache(localFE.localBasis());
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -54,16 +54,13 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RangeFieldType = typename NodeQuadCache<typename ColNode::ChildType>::Traits::RangeFieldType;
using RangeFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<typename ColNode::ChildType> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQp(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -52,16 +52,13 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RangeFieldType = typename NodeQuadCache<ColNode>::Traits::RangeFieldType;
using RangeFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<ColNode> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQp(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -55,16 +55,13 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RangeFieldType = typename NodeQuadCache<ColNode>::Traits::RangeFieldType;
using RangeFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<ColNode> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQp(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -54,16 +54,13 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RangeFieldType = typename NodeQuadCache<ColNode>::Traits::RangeFieldType;
using RangeFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<typename RowNode::ChildType> rowCache(rowLocalFE.localBasis());
NodeQuadCache<ColNode> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQp(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& shapeValuesCache = rowCache.evaluateFunctionAtQP(context, quad);
auto const& shapeGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -71,17 +71,14 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RowFieldType = typename NodeQuadCache<typename RowNode::ChildType>::Traits::RangeFieldType;
using ColFieldType = typename NodeQuadCache<typename ColNode::ChildType>::Traits::RangeFieldType;
using RowFieldType = typename RowLocalBasisType::Traits::RangeFieldType;
using ColFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<typename RowNode::ChildType> rowCache(rowLocalFE.localBasis());
NodeQuadCache<typename ColNode::ChildType> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& rowGradientsCache = rowCache.evaluateJacobianAtQp(context, quad);
auto const& colGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& rowGradientsCache = rowCache.evaluateJacobianAtQP(context, quad);
auto const& colGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -136,12 +133,12 @@ namespace AMDiS
auto const& localFE = node.child(0).finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using LeafNode = typename Node::ChildType;
using RangeFieldType = typename NodeQuadCache<LeafNode>::Traits::RangeFieldType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<LeafNode> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -74,12 +74,11 @@ namespace AMDiS
auto const& localFE = rowNode.finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<RowNode>::Traits::RangeFieldType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<RowNode> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -123,11 +122,10 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<RowNode>::Traits::RangeFieldType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
NodeQuadCache<RowNode> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -176,11 +174,10 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
using RangeFieldType = typename LocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<RowNode>::Traits::RangeFieldType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQp(context, quad);
NodeQuadCache<RowNode> cache(localFE.localBasis());
auto const& shapeGradientsCache = cache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -57,17 +57,14 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
using RowFieldType = typename NodeQuadCache<RowNode>::Traits::RangeFieldType;
using ColFieldType = typename NodeQuadCache<ColNode>::Traits::RangeFieldType;
using RowFieldType = typename RowLocalBasisType::Traits::RangeFieldType;
using ColFieldType = typename ColLocalBasisType::Traits::RangeFieldType;
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<ColNode> colCache(colLocalFE.localBasis());
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
auto const& rowGradientsCache = rowCache.evaluateJacobianAtQp(context, quad);
auto const& colGradientsCache = colCache.evaluateJacobianAtQp(context, quad);
auto const& rowGradientsCache = rowCache.evaluateJacobianAtQP(context, quad);
auto const& colGradientsCache = colCache.evaluateJacobianAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -43,6 +43,7 @@ namespace AMDiS
ElementMatrix& elementMatrix)
{
using VelocityNode = typename Node::template Child<0>::type;
using VelocityCompNode = typename VelocityNode::template Child<0>::type;
using PressureNode = typename Node::template Child<1>::type;
static_assert(VelocityNode::isPower && PressureNode::isLeaf, "");
......@@ -56,14 +57,11 @@ namespace AMDiS
auto const& pressureLocalFE = tree.child(_1).finiteElement();
std::size_t numPressureLocalFE = pressureLocalFE.size();
using VelocityLocalBasisType = typename std::decay_t<decltype(velocityLocalFE)>::Traits::LocalBasisType;
using PressureLocalBasisType = typename std::decay_t<decltype(pressureLocalFE)>::Traits::LocalBasisType;
NodeQuadCache<VelocityCompNode> velocityCache(velocityLocalFE.localBasis());
NodeQuadCache<PressureNode> pressureCache(pressureLocalFE.localBasis());
LocalBasisCache<VelocityLocalBasisType> velocityCache(velocityLocalFE.localBasis());
LocalBasisCache<PressureLocalBasisType> pressureCache(pressureLocalFE.localBasis());
auto const& shapeGradientsCache = velocityCache.evaluateJacobianAtQp(context, quad);
auto const& pressureValuesCache = pressureCache.evaluateFunctionAtQp(context, quad);
auto const& shapeGradientsCache = velocityCache.evaluateJacobianAtQP(context, quad);
auto const& pressureValuesCache = pressureCache.evaluateFunctionAtQP(context, quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -78,7 +76,7 @@ namespace AMDiS
auto const& shapeGradients = shapeGradientsCache[iq];
// Compute the shape function gradients on the real element
using RangeFieldType = typename VelocityLocalBasisType::Traits::RangeFieldType;
using RangeFieldType = typename NodeQuadCache<VelocityCompNode>::Traits::RangeFieldType;
using WorldVector = Dune::FieldVector<RangeFieldType,Context::dow>;
thread_local std::vector<WorldVector> gradients;
gradients.resize(shapeGradients.size());
......
......@@ -46,10 +46,9 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<Node> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context,quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -67,13 +67,11 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<ColNode> colCache(colLocalFE.localBasis());
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQp(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQp(context,quad);
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQP(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -111,10 +109,9 @@ namespace AMDiS
auto const& localFE = node.finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<RowNode> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context,quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -54,13 +54,11 @@ namespace AMDiS
std::size_t rowSize = rowLocalFE.size();
std::size_t colSize = colLocalFE.size();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
NodeQuadCache<RowNode> rowCache(rowLocalFE.localBasis());
NodeQuadCache<typename ColNode::ChildType> colCache(colLocalFE.localBasis());
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQp(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQp(context,quad);
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQP(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -50,10 +50,9 @@ namespace AMDiS
auto const& localFE = node.child(0).finiteElement();
std::size_t size = localFE.size();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<typename Node::ChildType> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context,quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -78,13 +78,11 @@ namespace AMDiS
auto const& rowLocalFE = rowNode.child(0).finiteElement();
auto const& colLocalFE = colNode.child(0).finiteElement();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
NodeQuadCache<typename RowNode::ChildType> rowCache(rowLocalFE.localBasis());
NodeQuadCache<typename ColNode::ChildType> colCache(colLocalFE.localBasis());
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQp(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQp(context,quad);
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQP(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -125,10 +123,9 @@ namespace AMDiS
auto const& localFE = node.child(0).finiteElement();
using LocalBasisType = typename std::decay_t<decltype(localFE)>::Traits::LocalBasisType;
LocalBasisCache<LocalBasisType> cache(localFE.localBasis());
NodeQuadCache<typename RowNode::ChildType> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQp(context,quad);
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......@@ -175,13 +172,11 @@ namespace AMDiS
auto const& rowLocalFE = rowNode.child(0).finiteElement();
auto const& colLocalFE = colNode.child(0).finiteElement();
using RowLocalBasisType = typename std::decay_t<decltype(rowLocalFE)>::Traits::LocalBasisType;
using ColLocalBasisType = typename std::decay_t<decltype(colLocalFE)>::Traits::LocalBasisType;
LocalBasisCache<RowLocalBasisType> rowCache(rowLocalFE.localBasis());
LocalBasisCache<ColLocalBasisType> colCache(colLocalFE.localBasis());
NodeQuadCache<typename RowNode::ChildType> rowCache(rowLocalFE.localBasis());
NodeQuadCache<typename ColNode::ChildType> colCache(colLocalFE.localBasis());
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQp(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQp(context,quad);
auto const& rowShapeValuesCache = rowCache.evaluateFunctionAtQP(context,quad);
auto const& colShapeValuesCache = colCache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
......
......@@ -152,9 +152,9 @@ LocalFunction::operator()(Domain const& x) const
auto&& fe = node.finiteElement();
auto&& localBasis = fe.localBasis();
LocalBasisCache<std::decay_t<decltype(localBasis)>> localBasisCache(localBasis);
auto const& shapeFunctionValues = localBasisCache.evaluateFunction(localView_.element(), x);
assert(shapeFunctionValues.size() == localBasis.size());
using Node = std::decay_t<decltype(node)>;
NodeCache<Node> localBasisCache(localBasis);
auto const& shapeFunctionValues = localBasisCache.evaluateFunction(localView_.element().type(),x);
// Get range entry associated to this node
auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, y));
......@@ -204,9 +204,9 @@ GradientLocalFunction::operator()(Domain const& x) const
auto&& fe = node.finiteElement();
auto&& localBasis = fe.localBasis();
LocalBasisCache<std::decay_t<decltype(localBasis)>> localBasisCache(localBasis);
auto const& referenceGradients = localBasisCache.evaluateJacobian(localView_.element(), x);
assert(referenceGradients.size() == localBasis.size());
using Node = std::decay_t<decltype(node)>;
NodeCache<Node> localBasisCache(localBasis);
auto const& referenceGradients = localBasisCache.evaluateJacobian(localView_.element().type(),x);
// The transposed inverse Jacobian of the map from the reference element to the element
auto&& jacobian = geometry_.value().jacobianInverseTransposed(x);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment