Go to the documentation of this file.
3 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLFSINDEXCACHE_HH
4 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLFSINDEXCACHE_HH
12 template<
typename LFS,
typename C>
18 DOF_NONCONSTRAINED = 0,
19 DOF_CONSTRAINED = 1<<0,
26 using GFS =
typename LFS::Traits::GridFunctionSpace;
28 using DOFIndex =
typename Ordering::Traits::DOFIndex;
35 typedef std::unordered_map<DI,CI>
CIMap;
37 typedef std::unordered_map<const CI*,std::pair<size_type,bool> >
InverseMap;
39 struct ConstraintsEntry
40 :
public std::pair<const CI*,typename C::mapped_type::mapped_type>
43 typedef typename C::mapped_type::mapped_type
Weight;
47 return *(this->first);
63 , _enable_constraints_caching(enable_constraints_caching)
64 , _container_indices(lfs.maxSize())
65 , _dof_flags(lfs.maxSize(),0)
66 , _constraints_iterators(lfs.maxSize())
67 , _inverse_cache_built(false)
77 return _lfs.dofIndex(i);
82 return _lfs.containerIndex(i);
92 return _dof_flags[i] & DOF_CONSTRAINED;
97 return _dof_flags[i] & DOF_DIRICHLET;
103 return _constraints_iterators[i].first;
109 return _constraints_iterators[i].second;
124 return _enable_constraints_caching;
130 const bool _enable_constraints_caching;
132 std::vector<unsigned char> _dof_flags;
133 std::vector<std::pair<ConstraintsIterator,ConstraintsIterator> > _constraints_iterators;
134 mutable CIMap _container_index_map;
136 mutable bool _inverse_cache_built;
139 const C& _gfs_constraints;
144 template<
typename LFS>
151 using GFS =
typename LFS::Traits::GridFunctionSpace;
153 using DOFIndex =
typename Ordering::Traits::DOFIndex;
159 struct ConstraintsEntry
160 :
public std::pair<const CI*,double>
167 return *(this->first);
180 typedef std::unordered_map<DI,CI>
CIMap;
193 return _lfs.dofIndex(i);
198 return _lfs.containerIndex(i);
203 return _lfs.containerIndex(i);
218 return _constraints.begin();
223 return _constraints.end();
248 mutable CIMap _container_index_map;
256 #endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLFSINDEXCACHE_HH
const LocalFunctionSpace & localFunctionSpace() const
Definition: dunefunctionslfsindexcache.hh:226
std::unordered_map< DI, CI > CIMap
Definition: dunefunctionslfsindexcache.hh:35
ConstraintsVector::const_iterator ConstraintsIterator
Definition: dunefunctionslfsindexcache.hh:59
const ContainerIndex & containerIndex() const
Definition: dunefunctionslfsindexcache.hh:45
Ordering::Traits::ContainerIndex ContainerIndex
Definition: lfsindexcache.hh:260
CI containerIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:196
CI containerIndex(const DI &i) const
Definition: dunefunctionslfsindexcache.hh:201
bool isConstrained(size_type i) const
Definition: lfsindexcache.hh:410
void update()
Definition: dunefunctionslfsindexcache.hh:72
std::unordered_map< const CI *, std::pair< size_type, bool > > InverseMap
Definition: lfsindexcache.hh:269
Definition: lfsindexcache.hh:244
CI containerIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:80
typename LFS::Traits::GridFunctionSpace GFS
Definition: dunefunctionslfsindexcache.hh:26
CI ContainerIndex
Definition: dunefunctionslfsindexcache.hh:42
DOFIndex DI
Definition: dunefunctionslfsindexcache.hh:29
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
const ContainerIndex & containerIndex() const
Definition: dunefunctionslfsindexcache.hh:165
std::vector< CI > CIVector
Definition: lfsindexcache.hh:266
void constraints(const GFS &gfs, CG &cg, const bool verbose=false)
construct constraints
Definition: constraints.hh:749
typename Ordering::Traits::ContainerIndex ContainerIndex
Definition: dunefunctionslfsindexcache.hh:30
std::vector< ConstraintsEntry > ConstraintsVector
Definition: dunefunctionslfsindexcache.hh:58
double Weight
Definition: dunefunctionslfsindexcache.hh:163
std::vector< CI > CIVector
Definition: dunefunctionslfsindexcache.hh:34
ContainerIndex CI
Definition: dunefunctionslfsindexcache.hh:31
LFSIndexCacheBase(const LFS &lfs)
Definition: dunefunctionslfsindexcache.hh:182
const Weight & weight() const
Definition: dunefunctionslfsindexcache.hh:50
ConstraintsIterator constraintsEnd(size_type i) const
Definition: dunefunctionslfsindexcache.hh:106
std::vector< ConstraintsEntry > ConstraintsVector
Definition: lfsindexcache.hh:290
std::unordered_map< DI, CI > CIMap
Definition: dunefunctionslfsindexcache.hh:180
CI containerIndex(const DI &i) const
Definition: dunefunctionslfsindexcache.hh:85
typename GFS::Ordering Ordering
Definition: dunefunctionslfsindexcache.hh:152
LFSIndexCacheBase(const LFS &lfs, const C &c, bool enable_constraints_caching)
Definition: dunefunctionslfsindexcache.hh:187
LFS LocalFunctionSpace
Definition: dunefunctionslfsindexcache.hh:25
bool isConstrained(size_type i) const
Definition: dunefunctionslfsindexcache.hh:90
Ordering::Traits::DOFIndex DOFIndex
Definition: lfsindexcache.hh:262
std::size_t size_type
Definition: dunefunctionslfsindexcache.hh:32
size_type size() const
Definition: dunefunctionslfsindexcache.hh:231
size_type size() const
Definition: dunefunctionslfsindexcache.hh:117
bool constraintsCachingEnabled() const
Definition: dunefunctionslfsindexcache.hh:122
typename Ordering::Traits::ContainerIndex ContainerIndex
Definition: dunefunctionslfsindexcache.hh:155
DI dofIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:75
ConstraintsVector::const_iterator ConstraintsIterator
Definition: dunefunctionslfsindexcache.hh:177
DOFIndex DI
Definition: dunefunctionslfsindexcache.hh:154
const LocalFunctionSpace & localFunctionSpace() const
Definition: dunefunctionslfsindexcache.hh:112
std::vector< CI > CIVector
Definition: dunefunctionslfsindexcache.hh:179
typename GFS::Ordering Ordering
Definition: dunefunctionslfsindexcache.hh:27
LFSIndexCacheBase(const LFS &lfs, const C &constraints, bool enable_constraints_caching)
Definition: dunefunctionslfsindexcache.hh:61
Definition: constraintstransformation.hh:111
DI dofIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:191
ConstraintsIterator constraintsEnd(size_type i) const
Definition: dunefunctionslfsindexcache.hh:221
typename Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslfsindexcache.hh:153
LFS LocalFunctionSpace
Definition: dunefunctionslfsindexcache.hh:150
std::vector< ConstraintsEntry > ConstraintsVector
Definition: dunefunctionslfsindexcache.hh:176
const Weight & weight() const
Definition: dunefunctionslfsindexcache.hh:170
std::unordered_map< const CI *, std::pair< size_type, bool > > InverseMap
Definition: dunefunctionslfsindexcache.hh:37
ConstraintsIterator constraintsBegin(size_type i) const
Definition: dunefunctionslfsindexcache.hh:100
CI ContainerIndex
Definition: dunefunctionslfsindexcache.hh:162
typename Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslfsindexcache.hh:28
void update()
Definition: dunefunctionslfsindexcache.hh:241
ContainerIndex CI
Definition: dunefunctionslfsindexcache.hh:156
bool isConstrained(size_type i) const
Definition: dunefunctionslfsindexcache.hh:206
bool isDirichletConstraint(size_type i) const
Definition: dunefunctionslfsindexcache.hh:211
C::mapped_type::mapped_type Weight
Definition: dunefunctionslfsindexcache.hh:43
std::unordered_map< DI, CI > CIMap
Definition: lfsindexcache.hh:267
typename LFS::Traits::GridFunctionSpace GFS
Definition: dunefunctionslfsindexcache.hh:151
ConstraintsIterator constraintsBegin(size_type i) const
Definition: dunefunctionslfsindexcache.hh:216
std::size_t size_type
Definition: dunefunctionslfsindexcache.hh:157
bool constraintsCachingEnabled() const
Definition: dunefunctionslfsindexcache.hh:236
bool isDirichletConstraint(size_type i) const
Definition: dunefunctionslfsindexcache.hh:95