4#ifndef DUNE_PDELAB_FINITEELEMENT_LOCALBASISCACHE_HH
5#define DUNE_PDELAB_FINITEELEMENT_LOCALBASISCACHE_HH
16 template<
class LocalBasisType>
19 typedef typename LocalBasisType::Traits::DomainFieldType DomainFieldType;
20 typedef typename LocalBasisType::Traits::DomainType DomainType;
21 typedef typename LocalBasisType::Traits::RangeType RangeType;
22 typedef typename LocalBasisType::Traits::JacobianType JacobianType;
26 bool operator() (
const DomainType& v1,
const DomainType& v2)
const
28 for (
typename DomainType::size_type i=0; i<DomainType::dimension; i++)
30 if ( v1[i] < v2[i]-1e-5 )
return true;
31 if ( v1[i] > v2[i]+1e-5 )
return false;
37 typedef std::map<DomainType,std::vector<RangeType>,less_than> FunctionCache;
38 typedef std::map<DomainType,std::vector<JacobianType>,less_than> JacobianCache;
46 const std::vector<RangeType>&
49 typename FunctionCache::iterator it = functioncache.find(position);
50 if (it!=functioncache.end())
return it->second;
51 std::vector<RangeType> values;
52 localbasis.evaluateFunction(position,values);
53 it = functioncache.insert(functioncache.begin(),std::pair<DomainType,std::vector<RangeType> >(position,values));
58 const std::vector<JacobianType>&
61 typename JacobianCache::iterator it = jacobiancache.find(position);
62 if (it!=jacobiancache.end())
return it->second;
63 std::vector<JacobianType> values;
64 localbasis.evaluateJacobian(position,values);
65 it = jacobiancache.insert(jacobiancache.begin(),std::pair<DomainType,std::vector<JacobianType> >(position,values));
70 mutable FunctionCache functioncache;
71 mutable JacobianCache jacobiancache;
store values of basis functions and gradients in a cache
Definition: localbasiscache.hh:18
LocalBasisCache()
constructor
Definition: localbasiscache.hh:43
const std::vector< RangeType > & evaluateFunction(const DomainType &position, const LocalBasisType &localbasis) const
evaluate basis functions at a point
Definition: localbasiscache.hh:47
const std::vector< JacobianType > & evaluateJacobian(const DomainType &position, const LocalBasisType &localbasis) const
evaluate Jacobians at a point
Definition: localbasiscache.hh:59
A few common exception classes.
Dune namespace.
Definition: alignedallocator.hh:13