dune-pdelab  2.0.0
gridfunctionspace/tags.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 
4 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_TAGS_HH
5 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_TAGS_HH
6 
7 #include <dune/grid/common/gridenums.hh>
8 #include <dune/typetree/utility.hh>
9 
12 
13 #include <numeric>
14 
15 namespace Dune {
16  namespace PDELab {
17 
21 
23 
25 
27 
29 
30  template<typename ProxiedGFSTag>
32  : public ProxiedGFSTag
33  {};
34 
37 
39 
50 
53 
60 
63 
75  {
76 
77 #if HAVE_INITIALIZER_LIST || DOXYGEN
78 
80 
99  InterleavedOrderingTag(std::initializer_list<std::size_t> sizes)
100  : _offsets(sizes.size() + 1,0)
101  {
102  std::partial_sum(sizes.begin(),sizes.end(),_offsets.begin() + 1);
103  }
104 
105 #endif
106 
108  InterleavedOrderingTag(std::vector<std::size_t> sizes)
109  : _offsets(sizes.size() + 1,0)
110  {
111  std::partial_sum(sizes.begin(),sizes.end(),_offsets.begin() + 1);
112  }
113 
115  const std::vector<std::size_t>& offsets() const
116  {
117  return _offsets;
118  }
119 
120  private:
121 
122  std::vector<std::size_t> _offsets;
123  };
124 
125 
128 
135  {
136 
138  PermutationOrderingTag(std::vector<std::size_t> perm)
139  : _perm(perm)
140  {
141  }
142 
144  const std::vector<std::size_t>& permutation() const
145  {
146  return _perm;
147  }
148 
150  void updatePermutation(const std::vector<std::size_t>& perm)
151  {
152  assert(perm.size() == _perm.size());
153  _perm = perm;
154  }
155 
156  private:
157 
158  std::vector<std::size_t> _perm;
159  };
160 
162  template<bool v>
164  {
165  static const bool no_const_ordering_size = v;
166  };
167 
168  namespace {
169 
170  // Use this compile-time bridge to shup up GCC warnings
171 
172  template<int i>
173  struct shift_if_nonnegative
174  {
175  static const unsigned int value = 1 << i;
176  };
177 
178  template<>
179  struct shift_if_nonnegative<-1>
180  {
181  static const unsigned int value = 0;
182  };
183 
184  }
185 
187 
191  template<int p0 = -1, int p1 = -1, int p2 = -1, int p3 = -1, int p4 = -1>
193  {
194 
195  static const unsigned int partition_mask =
201 
202  };
203 
205 
215  template<typename Params>
217  : public Params
218  {};
219 
220 #ifndef DOXYGEN
221 
222  typedef PartitionSelector<
223  InteriorEntity,
224  BorderEntity,
225  OverlapEntity,
226  FrontEntity,
227  GhostEntity
228  > AllPartitionSelector;
229 
230  typedef PartitionSelector<
231  InteriorEntity,
232  BorderEntity
233  > NonOverlappingPartitionSelector;
234 
235 #endif // DOXYGEN
236 
239  : public NoConstOrderingSize<false>
240  , public AllPartitionSelector
241  {};
242 
245  : public NoConstOrderingSize<true>
246  , public NonOverlappingPartitionSelector
247  {};
248 
250  typedef LeafOrderingTag<
253 
255 
259 
261  typedef LeafOrderingTag<
264 
267  struct SingleCodimMapper {};
268 
271 
274 
277 
281 
285 
289 
292  struct SimpleLFSCacheTag {};
293 
294 
295  template<typename GFS, typename Tag>
297  {
299  };
300 
301  template<typename GFS>
303  {
305  };
306 
307 
308  template<typename GFS>
310  {
312  };
313 
314 
315 #ifndef DOXYGEN
316 
318 
333  template<typename GFS>
334  struct gfs_to_lfs {
335 
337  //typedef Dune::PDELab::MultiIndex<std::size_t,TypeTree::TreeInfo<GFS>::depth> MultiIndex;
338  typedef typename build_dof_index_type<GFS>::type DOFIndex;
339 
340  };
341 
342 #endif // DOXYGEN
343 
345  } // namespace PDELab
346 } // namespace Dune
347 
348 #endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_TAGS_HH
SimpleDOFIndex< typename GFS::Traits::SizeType > type
Definition: gridfunctionspace/tags.hh:304
Indicate blocking of the unknowns by grid entity.
Definition: gridfunctionspace/tags.hh:49
Definition: gridfunctionspace/tags.hh:280
Definition: dofindex.hh:14
Tag denoting a PowerLocalFunctionSpace.
Definition: gridfunctionspace/tags.hh:270
DefaultLeafOrderingTag GridFunctionGeneralMapper
GridFunctionGeneralMapper is deprecated, use DefaultLeafOrderingTag instead.
Definition: gridfunctionspace/tags.hh:258
Definition: gridfunctionspace/tags.hh:309
Leaf ordering parameters for non-overlapping function spaces.
Definition: gridfunctionspace/tags.hh:244
InterleavedOrderingTag(std::initializer_list< std::size_t > sizes)
Constructs an InterleavedOrderingTag with a block structure given by the initializer list sizes...
Definition: gridfunctionspace/tags.hh:99
Indicate lexicographic ordering of the unknowns of non-leaf grid function spaces. ...
Definition: gridfunctionspace/tags.hh:59
Definition: gridfunctionspace/tags.hh:22
Tag indicating a standard ordering for a leaf GridfunctionSpace.
Definition: gridfunctionspace/tags.hh:216
Definition: gridfunctionspace/tags.hh:26
_build_dof_index_type< GFS, typename GFS::OrderingTag >::type type
Definition: gridfunctionspace/tags.hh:311
InterleavedOrderingTag(std::vector< std::size_t > sizes)
Constructs an InterleavedOrderingTag with a block structure given by the std::vector sizes...
Definition: gridfunctionspace/tags.hh:108
static const unsigned int partition_mask
Definition: gridfunctionspace/tags.hh:195
Definition: gridfunctionspace/tags.hh:267
static const bool no_const_ordering_size
Definition: gridfunctionspace/tags.hh:165
Mixin indicating whether a leaf GridFunctionSpace should never assume a const ordering size...
Definition: gridfunctionspace/tags.hh:163
Definition: gridfunctionspace/tags.hh:288
Indicate permuted ordering of the unknowns of non-leaf grid function spaces according to a given perm...
Definition: gridfunctionspace/tags.hh:134
Indicate interleaved ordering of the unknowns of non-leaf grid function spaces according to a given b...
Definition: gridfunctionspace/tags.hh:74
void updatePermutation(const std::vector< std::size_t > &perm)
Replaces the existing permutation by a new one.
Definition: gridfunctionspace/tags.hh:150
static const unsigned int value
Definition: gridfunctionspace/tags.hh:175
Definition: gridfunctionspace/tags.hh:24
Definition: gridfunctionspace/tags.hh:28
Tag for the intermediate base class of the CompositeGridFunctionSpace.
Definition: gridfunctionspace/tags.hh:36
LeafOrderingTag< DefaultLeafOrderingParams > DefaultLeafOrderingTag
Default ordering tag for a MultiIndex-based ordering with standard behavior.
Definition: gridfunctionspace/tags.hh:252
const std::vector< std::size_t > & permutation() const
Returns the permutation.
Definition: gridfunctionspace/tags.hh:144
PermutationOrderingTag(std::vector< std::size_t > perm)
Constructs n PermutationOrderingTag using the permutation given by std::vector perm.
Definition: gridfunctionspace/tags.hh:138
Definition: gridfunctionspace/tags.hh:296
Helper for building the bitmask describing the grid partitions contained in a GFS.
Definition: gridfunctionspace/tags.hh:192
Leaf ordering parameters for standard function spaces.
Definition: gridfunctionspace/tags.hh:238
Definition: gridfunctionspace/tags.hh:31
Definition: gridfunctionspace/tags.hh:292
LeafOrderingTag< NonOverlappingLeafOrderingParams > NonOverlappingLeafOrderingTag
Ordering tag for a MultiIndex-based ordering on nonoverlapping grids with standard behavior...
Definition: gridfunctionspace/tags.hh:263
Definition: gridfunctionspace/tags.hh:284
Tag denoting a LeafLocalFunctionSpace.
Definition: gridfunctionspace/tags.hh:276
Definition: simpledofindex.hh:14
Tag denoting a CompositeLocalFunctionSpace.
Definition: gridfunctionspace/tags.hh:273
Dune::PDELab::DOFIndex< std::size_t, TypeTree::TreeInfo< GFS >::depth, 2 > type
Definition: gridfunctionspace/tags.hh:298
const std::vector< std::size_t > & offsets() const
Returns a list of offsets for the child blocks.
Definition: gridfunctionspace/tags.hh:115