Commit cb1b3f97 authored by Timo Koch's avatar Timo Koch
Browse files

[box][localfiniteelementcache] Use thread-safe version of the local finite element cache

parent bca59569
Pipeline #16951 passed with stages
......@@ -25,7 +25,6 @@
#define DUMUX_DISCRETIZATION_BOX_FLUXVARIABLES_CACHE_HH
#include <dune/common/fvector.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
namespace Dumux {
......@@ -49,8 +48,7 @@ class BoxFluxVariablesCache
static const int dimWorld = GridView::dimensionworld;
using CoordScalar = typename GridView::ctype;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType;
using FeLocalBasis = typename GridGeometry::FeCache::FiniteElementType::Traits::LocalBasisType;
using ShapeJacobian = typename FeLocalBasis::Traits::JacobianType;
using ShapeValue = typename Dune::FieldVector<Scalar, 1>;
using JacobianInverseTransposed = typename Element::Geometry::JacobianInverseTransposed;
......
......@@ -29,7 +29,7 @@
#include <utility>
#include <unordered_map>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
#include <dumux/discretization/method.hh>
#include <dumux/common/indextraits.hh>
......@@ -112,7 +112,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......@@ -401,7 +401,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......
......@@ -27,6 +27,7 @@
#include <iterator>
#include <algorithm>
#include <type_traits>
#include <memory>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
......@@ -175,16 +176,15 @@ PrimaryVariables evalSolution(const Element& element,
using CoordScalar = typename Element::Geometry::GlobalCoordinate::value_type;
static constexpr int dim = Element::Geometry::mydimension;
//! The box scheme always uses linear Ansatz functions
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using ShapeValue = typename FeCache::FiniteElementType::Traits::LocalBasisType::Traits::RangeType;
// obtain local finite element basis
FeCache feCache;
const auto& localBasis = feCache.get(geometry.type()).localBasis();
// The box scheme always uses linear Ansatz functions
using FEFactory = Dune::PQkLocalFiniteElementFactory<CoordScalar, Scalar, dim, 1>;
using FiniteElement = typename FEFactory::FiniteElementType;
std::unique_ptr<FiniteElement> fe(FEFactory::create(geometry.type()));
const auto& localBasis = fe->localBasis();
// evaluate the shape functions at the scv center
const auto localPos = geometry.local(globalPos);
using ShapeValue = typename FiniteElement::Traits::LocalBasisType::Traits::RangeType;
std::vector< ShapeValue > shapeValues;
localBasis.evaluateFunction(localPos, shapeValues);
......
......@@ -30,7 +30,7 @@
#include <functional>
#include <dune/common/exceptions.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
#include <dumux/discretization/method.hh>
#include <dumux/common/indextraits.hh>
......@@ -525,7 +525,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......@@ -742,7 +742,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......
......@@ -31,7 +31,7 @@
#include <utility>
#include <dune/grid/common/mcmgmapper.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/indextraits.hh>
......@@ -124,7 +124,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......@@ -438,7 +438,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......
......@@ -26,8 +26,6 @@
#ifndef DUMUX_POROUSMEDIUM_BOXDFM_FLUXVARIABLESCACHE_HH
#define DUMUX_POROUSMEDIUM_BOXDFM_FLUXVARIABLESCACHE_HH
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dumux/common/properties.hh>
#include <dumux/discretization/method.hh>
#include <dumux/flux/fluxvariablescaching.hh>
......@@ -45,9 +43,10 @@ class BoxDfmFluxVariablesCache
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Problem = GetPropType<TypeTag, Properties::Problem>;
using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using GridView = typename GridGeometry::GridView;
using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
using FVElementGeometry = typename GridGeometry::LocalView;
using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using Element = typename GridView::template Codim<0>::Entity;
......@@ -59,8 +58,7 @@ class BoxDfmFluxVariablesCache
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType;
using FeLocalBasis = typename GridGeometry::FeCache::FiniteElementType::Traits::LocalBasisType;
using ShapeJacobian = typename FeLocalBasis::Traits::JacobianType;
using ShapeValue = typename Dune::FieldVector<Scalar, 1>;
using JacobianInverseTransposed = typename Element::Geometry::JacobianInverseTransposed;
......
......@@ -32,7 +32,7 @@
#include <utility>
#include <unordered_map>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
#include <dune/geometry/multilineargeometry.hh>
#include <dune/grid/common/mcmgmapper.hh>
......@@ -130,7 +130,7 @@ public:
//! Export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! Export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! Export the grid view type
using GridView = GV;
......@@ -462,7 +462,7 @@ public:
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeCache = Dune::LagrangeLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
......
Supports Markdown
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