DUNE PDELab (git)

singlecodimleafordering.hh
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_ORDERING_SINGLECODIMLEAFORDERING_HH
5#define DUNE_PDELAB_ORDERING_SINGLECODIMLEAFORDERING_HH
6
7#include <dune/typetree/leafnode.hh>
8
9#include <dune/pdelab/ordering/utility.hh>
10#include <dune/pdelab/gridfunctionspace/tags.hh>
11
12namespace Dune {
13 namespace PDELab {
14
17
18 template<typename GV, typename DI, typename CI>
19 class SingleCodimLeafOrdering
20 : public TypeTree::LeafNode
21 {
22
23 public:
24
25 typedef FlatContainerAllocationTag ContainerAllocationTag;
26
27 typedef SimpleLFSCacheTag CacheTag;
28
29
30 typedef SimpleOrderingTraits<DI,CI> Traits;
31
32 typename Traits::ContainerIndex mapIndex(const typename Traits::DOFIndex& di) const
33 {
34 return di[0];
35 }
36
37 void mapIndex(typename Traits::DOFIndex di, typename Traits::ContainerIndex& ci) const
38 {
39 ci = di[0];
40 }
41
42 typename Traits::SizeType size() const
43 {
44 return _gv.size(0);
45 }
46
47 typename Traits::SizeType blockCount() const
48 {
49 return size();
50 }
51
52 typename Traits::SizeType maxLocalSize() const
53 {
54 return 1;
55 }
56
57 void update()
58 {
59 }
60
61 SingleCodimLeafOrdering(const GV& gv)
62 : _gv(gv)
63 {
64 }
65
66 bool container_blocked() const
67 {
68 return false;
69 }
70
71 typename Traits::SizeType size(typename Traits::ContainerIndex suffix) const
72 {
73 assert(suffix.size() == 0);
74 return size();
75 }
76
77 private:
78
79 GV _gv;
80
81 };
82
83
84 template<typename GFS, typename Transformation>
85 struct leaf_gfs_to_ordering_descriptor<GFS,Transformation,SingleCodimMapper>
86 {
87
88 static const bool recursive = false;
89
90 typedef SingleCodimLeafOrdering<
91 typename GFS::Traits::GridView,
92 SimpleDOFIndex<typename GFS::Traits::SizeType>,
93 SimpleContainerIndex<typename GFS::Traits::SizeType>
94 > transformed_type;
95
96 typedef std::shared_ptr<transformed_type> transformed_storage_type;
97
98 static transformed_type transform(const GFS& gfs, const Transformation& t)
99 {
100 return transformed_type(gfs.gridView());
101 }
102
103 static transformed_storage_type transform_storage(std::shared_ptr<const GFS> gfs, const Transformation& t)
104 {
105 return std::make_shared<transformed_type>(gfs->gridView());
106 }
107
108 };
109
111
112 } // namespace PDELab
113} // namespace Dune
114
115#endif // DUNE_PDELAB_ORDERING_SINGLECODIMLEAFORDERING_HH
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)