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