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