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.dofIndex(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.dofIndex(i);
218 return _constraints.begin();
223 return _constraints.end();
248 mutable CIMap _container_index_map;
256 #endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLFSINDEXCACHE_HH
typename LFS::Traits::GridFunctionSpace GFS
Definition: dunefunctionslfsindexcache.hh:26
DOFIndex DI
Definition: dunefunctionslfsindexcache.hh:29
const ContainerIndex & containerIndex() const
Definition: dunefunctionslfsindexcache.hh:165
std::vector< CI > CIVector
Definition: lfsindexcache.hh:266
typename LFS::Traits::GridFunctionSpace GFS
Definition: dunefunctionslfsindexcache.hh:151
bool isDirichletConstraint(size_type i) const
Definition: dunefunctionslfsindexcache.hh:211
std::vector< ConstraintsEntry > ConstraintsVector
Definition: dunefunctionslfsindexcache.hh:58
C::mapped_type::mapped_type Weight
Definition: dunefunctionslfsindexcache.hh:43
double Weight
Definition: dunefunctionslfsindexcache.hh:163
std::vector< CI > CIVector
Definition: dunefunctionslfsindexcache.hh:34
ContainerIndex CI
Definition: dunefunctionslfsindexcache.hh:31
CI containerIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:196
ConstraintsIterator constraintsEnd(size_type i) const
Definition: dunefunctionslfsindexcache.hh:221
ConstraintsIterator constraintsEnd(size_type i) const
Definition: dunefunctionslfsindexcache.hh:106
bool isDirichletConstraint(size_type i) const
Definition: dunefunctionslfsindexcache.hh:95
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
LFS LocalFunctionSpace
Definition: dunefunctionslfsindexcache.hh:150
typename Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslfsindexcache.hh:153
typename Ordering::Traits::ContainerIndex ContainerIndex
Definition: dunefunctionslfsindexcache.hh:155
std::vector< ConstraintsEntry > ConstraintsVector
Definition: dunefunctionslfsindexcache.hh:176
CI containerIndex(const DI &i) const
Definition: dunefunctionslfsindexcache.hh:85
ConstraintsVector::const_iterator ConstraintsIterator
Definition: dunefunctionslfsindexcache.hh:59
DOFIndex DI
Definition: dunefunctionslfsindexcache.hh:154
std::vector< CI > CIVector
Definition: dunefunctionslfsindexcache.hh:179
std::unordered_map< DI, CI > CIMap
Definition: lfsindexcache.hh:267
LFS LocalFunctionSpace
Definition: dunefunctionslfsindexcache.hh:25
Ordering::Traits::DOFIndex DOFIndex
Definition: lfsindexcache.hh:262
bool isConstrained(size_type i) const
Definition: dunefunctionslfsindexcache.hh:90
std::vector< ConstraintsEntry > ConstraintsVector
Definition: lfsindexcache.hh:290
std::size_t size_type
Definition: dunefunctionslfsindexcache.hh:32
bool constraintsCachingEnabled() const
Definition: dunefunctionslfsindexcache.hh:122
const LocalFunctionSpace & localFunctionSpace() const
Definition: dunefunctionslfsindexcache.hh:226
ConstraintsVector::const_iterator ConstraintsIterator
Definition: dunefunctionslfsindexcache.hh:177
const LocalFunctionSpace & localFunctionSpace() const
Definition: dunefunctionslfsindexcache.hh:112
typename GFS::Ordering Ordering
Definition: dunefunctionslfsindexcache.hh:152
std::unordered_map< const CI *, std::pair< size_type, bool > > InverseMap
Definition: lfsindexcache.hh:269
LFSIndexCacheBase(const LFS &lfs, const C &c, bool enable_constraints_caching)
Definition: dunefunctionslfsindexcache.hh:187
CI ContainerIndex
Definition: dunefunctionslfsindexcache.hh:42
CI containerIndex(const DI &i) const
Definition: dunefunctionslfsindexcache.hh:201
void constraints(const GFS &gfs, CG &cg, const bool verbose=false)
construct constraints
Definition: constraints.hh:751
ConstraintsIterator constraintsBegin(size_type i) const
Definition: dunefunctionslfsindexcache.hh:216
std::size_t size_type
Definition: dunefunctionslfsindexcache.hh:157
DI dofIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:191
bool constraintsCachingEnabled() const
Definition: dunefunctionslfsindexcache.hh:236
const Weight & weight() const
Definition: dunefunctionslfsindexcache.hh:50
typename Ordering::Traits::ContainerIndex ContainerIndex
Definition: dunefunctionslfsindexcache.hh:30
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
Definition: constraintstransformation.hh:111
CI ContainerIndex
Definition: dunefunctionslfsindexcache.hh:162
typename Ordering::Traits::DOFIndex DOFIndex
Definition: dunefunctionslfsindexcache.hh:28
LFSIndexCacheBase(const LFS &lfs)
Definition: dunefunctionslfsindexcache.hh:182
ContainerIndex CI
Definition: dunefunctionslfsindexcache.hh:156
std::unordered_map< DI, CI > CIMap
Definition: dunefunctionslfsindexcache.hh:180
Definition: lfsindexcache.hh:244
const ContainerIndex & containerIndex() const
Definition: dunefunctionslfsindexcache.hh:45
size_type size() const
Definition: dunefunctionslfsindexcache.hh:231
size_type size() const
Definition: dunefunctionslfsindexcache.hh:117
void update()
Definition: dunefunctionslfsindexcache.hh:241
std::unordered_map< DI, CI > CIMap
Definition: dunefunctionslfsindexcache.hh:35
DI dofIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:75
bool isConstrained(size_type i) const
Definition: dunefunctionslfsindexcache.hh:206
typename GFS::Ordering Ordering
Definition: dunefunctionslfsindexcache.hh:27
LFSIndexCacheBase(const LFS &lfs, const C &constraints, bool enable_constraints_caching)
Definition: dunefunctionslfsindexcache.hh:61
Ordering::Traits::ContainerIndex ContainerIndex
Definition: lfsindexcache.hh:260
void update()
Definition: dunefunctionslfsindexcache.hh:72
bool isConstrained(size_type i) const
Definition: lfsindexcache.hh:410
CI containerIndex(size_type i) const
Definition: dunefunctionslfsindexcache.hh:80