Commit 9d6d4bc5 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/remove_lfecache' into 'master'

Remove LagrangeLFECache since it is not used anywhere in dune-vtk

See merge request spraetor/dune-vtk!22
parents 4697fbe9 f74499df
......@@ -5,7 +5,6 @@ dune_add_library("filesystem" OBJECT
install(FILES
enum.hh
filesystem.hh
lagrangelfecache.hh
lagrangepoints.hh
string.hh
uid.hh
......
#pragma once
#include <map>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/lagrange.hh>
#include <dune/vtk/utility/lagrangepoints.hh>
namespace Dune
{
// LocalFiniteElement for the lagrange pointset compatible with VTK
template <class Domain, class Range, int dim, int ORDER=-1>
class LagrangeLFECache
{
public:
using FiniteElementType = LagrangeLocalFiniteElement<VtkLagrangePointSet, dim, Domain, Range>;
LagrangeLFECache (unsigned int order = ORDER)
: order_(order)
{}
FiniteElementType const& get (GeometryType type)
{
auto it = data_.find(type);
if (it == data_.end())
it = data_.emplace(type,FiniteElementType(type,order_)).first;
return it->second;
}
private:
unsigned int order_;
std::map<GeometryType, FiniteElementType> data_;
};
} // end namespace Dune
......@@ -9,5 +9,3 @@ dune_add_test(NAME test-lagrange2
dune_add_test(NAME test-lagrange3
SOURCES test-lagrange.cc
COMPILE_DEFINITIONS "CHECKDIM=3")
dune_add_test(SOURCES test-lfecache.cc)
\ No newline at end of file
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dune/common/hybridutilities.hh>
#include <dune/common/rangeutilities.hh>
#include <dune/common/std/utility.hh>
#include <dune/common/test/testsuite.hh>
#include <dune/geometry/type.hh>
#include <dune/vtk/utility/lagrangelfecache.hh>
template <class FiniteElementCache>
int test (FiniteElementCache& cache, Dune::GeometryType type)
{
using FiniteElement = typename FiniteElementCache::FiniteElementType;
const FiniteElement& finiteElement = cache.get(type);
if (!(finiteElement.type() == type))
DUNE_THROW(Dune::Exception, "Wrong GeometryType in constructed local finite-element");
return finiteElement.localBasis().order();
}
int main()
{
using namespace Dune;
const int max_dim = 3;
const unsigned int max_order = 4;
TestSuite testSuite;
Hybrid::forEach(StaticIntegralRange<int,max_dim+1,1>{},[&](auto dim)
{
// template order parameter
Hybrid::forEach(StaticIntegralRange<int,max_order+1,1>{},[&](auto k) {
using FiniteElementCache = LagrangeLFECache<double, double, dim.value, k.value>;
FiniteElementCache cache{};
testSuite.check(test(cache, Dune::GeometryTypes::simplex(dim)) == k);
testSuite.check(test(cache, Dune::GeometryTypes::cube(dim)) == k);
});
// runtime order parameter
for (unsigned int k = 1; k <= max_order; ++k) {
using FiniteElementCache = LagrangeLFECache<double, double, dim>;
FiniteElementCache cache{k};
testSuite.check(test(cache, Dune::GeometryTypes::simplex(dim)) == k);
testSuite.check(test(cache, Dune::GeometryTypes::cube(dim)) == k);
}
});
return testSuite.exit();
}
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