HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
discrete-space-descriptor.hpp
Go to the documentation of this file.
1// -*- C++ -*-
2#ifndef DISCRETE_SPACE_DESCRIPTOR_HPP
3#define DISCRETE_SPACE_DESCRIPTOR_HPP
4
5#include <iostream>
6
7#include <list>
8#include <map>
9
10#include <boost/fusion/include/sequence.hpp>
11#include <boost/fusion/include/map.hpp>
12
13#include <basis.hpp>
14
15namespace HArDCore2D {
16
17 namespace DSL {
18
19 typedef Family<GradientBasis<ShiftedBasis<MonomialScalarBasisCell> > > GolyCellType;
20 typedef Family<GolyComplBasisCell> GolyComplCellType;
21 typedef Family<MonomialScalarBasisCell> PolyCellType;
22 typedef Family<MonomialScalarBasisEdge> PolyEdgeType;
23 typedef TensorizedVectorFamily<PolyCellType, dimspace> PolynCellType;
24 typedef TensorizedVectorFamily<Family<MonomialScalarBasisEdge>, dimspace> PolynEdgeType;
25 typedef MatrixFamily<PolyCellType, dimspace> PolynxnCellType;
28 typedef double RealVertexType;
29 typedef Family<CurlBasis<ShiftedBasis<MonomialScalarBasisCell> > > RolyCellType;
30 typedef Family<RolyComplBasisCell> RolyComplCellType;
31
32 typedef boost::fusion::vector<PolyCellType, PolyEdgeType, PolynCellType, PolynxnCellType, PolynEdgeType, RolyCellType, RolyComplCellType, GolyCellType, GolyComplCellType, RealVertexType, RealnVertexType, RealnxnVertexType> LocalPolynomialSpaces;
33
34 //------------------------------------------------------------------------------
35
36 class DiscreteSpaceDescriptor {
37 public:
38 struct LocalPolynomialSpaceDescriptor
39 {
41 std::string _name,
42 size_t _degree,
43 bool _is_dof
44 ) :
45 name(_name),
46 degree(_degree),
47 is_dof(_is_dof)
48 {
49 // Do nothing
50 }
51
52 std::string name;
53 size_t degree;
54 bool is_dof;
55 };
56
58 const std::string & name,
59 const Mesh & mesh,
60 std::ostream & output = std::cout
61 );
62
63 inline const std::string & name() const {
64 return m_name;
65 }
66
67 inline const Mesh & mesh() const {
68 return m_mesh;
69 }
70
71 inline std::ostream & output() {
72 return m_output;
73 }
74
75
77
78 DiscreteSpaceDescriptor & addPolyCell(const std::string & name,size_t degree, bool is_dof = false);
79
81
82 DiscreteSpaceDescriptor & addPolyEdge(const std::string & name,size_t degree, bool is_dof = false);
83
85
86 DiscreteSpaceDescriptor & addPolynCell(const std::string & name,size_t degree, bool is_dof = false);
87
89
90 DiscreteSpaceDescriptor & addPolynxnCell(const std::string & name,size_t degree, bool is_dof = false);
91
93
94 DiscreteSpaceDescriptor & addPolynEdge(const std::string & name,size_t degree, bool is_dof = false);
95
97
98 DiscreteSpaceDescriptor & addRolyCell(const std::string & name,size_t degree, bool is_dof = false);
99
101
102 DiscreteSpaceDescriptor & addRolyComplCell(const std::string & name,size_t degree, bool is_dof = false);
103
105
106 DiscreteSpaceDescriptor & addGolyCell(const std::string & name,size_t degree, bool is_dof = false);
107
109
110 DiscreteSpaceDescriptor & addGolyComplCell(const std::string & name,size_t degree, bool is_dof = false);
111
113
114 DiscreteSpaceDescriptor & addRealVertex(const std::string & name, bool is_dof = false);
115
117
118 DiscreteSpaceDescriptor & addRealnVertex(const std::string & name, bool is_dof = false);
119
121
122 DiscreteSpaceDescriptor & addRealnxnVertex(const std::string & name, bool is_dof = false);
123
124
126 {
127 return m_n_cell_dofs;
128 }
129
130 size_t numberOfLocalCellDofs(const std::string & dof_name) const
131 {
132 return m_cell_dofs.at(dof_name);
133 }
134
136 {
137 return m_n_edge_dofs;
138 }
139
140 size_t numberOfLocalEdgeDofs(const std::string & dof_name) const
141 {
142 return m_edge_dofs.at(dof_name);
143 }
144
146 {
147 return m_n_vertex_dofs;
148 }
149
150 size_t numberOfLocalVertexDofs(const std::string & dof_name) const
151 {
152 return m_vertex_dofs.at(dof_name);
153 }
154
155 template<typename T>
156 const std::list<LocalPolynomialSpaceDescriptor> & getDescriptor() const
157 {
158 return boost::fusion::at_key<T>(m_dofs);
159 }
160
161 const std::map<std::string, size_t> & cellDofs() const {
162 return m_cell_dofs;
163 }
164
165 const std::map<std::string, size_t> & edgeDofs() const {
166 return m_edge_dofs;
167 }
168
169 const std::map<std::string, size_t> & vertexDofs() const {
170 return m_vertex_dofs;
171 }
172
173 private:
174 std::string m_name;
175 const Mesh & m_mesh;
176 std::ostream & m_output;
177
178 std::map<std::string, size_t> m_cell_dofs;
179 std::map<std::string, size_t> m_edge_dofs;
180 std::map<std::string, size_t> m_vertex_dofs;
181
182 // TO BE REMOVED WHEN THE NEW IMPLEMENTATION IS COMPLETE
183 size_t m_n_cell_dofs;
184 size_t m_n_edge_dofs;
185 size_t m_n_vertex_dofs;
186
187 boost::fusion::map<
188 boost::fusion::pair<PolyCellType, std::list<LocalPolynomialSpaceDescriptor> >,
189 boost::fusion::pair<PolyEdgeType, std::list<LocalPolynomialSpaceDescriptor> >,
190 boost::fusion::pair<PolynCellType, std::list<LocalPolynomialSpaceDescriptor> >,
191 boost::fusion::pair<PolynxnCellType, std::list<LocalPolynomialSpaceDescriptor> >,
192 boost::fusion::pair<PolynEdgeType, std::list<LocalPolynomialSpaceDescriptor> >,
193 boost::fusion::pair<RolyCellType, std::list<LocalPolynomialSpaceDescriptor> >,
194 boost::fusion::pair<RolyComplCellType, std::list<LocalPolynomialSpaceDescriptor> >,
195 boost::fusion::pair<GolyCellType, std::list<LocalPolynomialSpaceDescriptor> >,
196 boost::fusion::pair<GolyComplCellType, std::list<LocalPolynomialSpaceDescriptor> >,
197 boost::fusion::pair<RealVertexType, std::list<LocalPolynomialSpaceDescriptor> >,
198 boost::fusion::pair<RealnVertexType, std::list<LocalPolynomialSpaceDescriptor> >,
199 boost::fusion::pair<RealnxnVertexType, std::list<LocalPolynomialSpaceDescriptor> >
200 > m_dofs;
201 };
202
203 DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor make_dof(const std::string name, size_t degree);
204
205 } // namespace DSL
206} // namespace HArDCore2D
207#endif
Definition discrete-space-descriptor.hpp:43
std::ostream & output()
Definition discrete-space-descriptor.hpp:78
size_t numberOfLocalEdgeDofs() const
Definition discrete-space-descriptor.hpp:135
DiscreteSpaceDescriptor & addPolynxnCell(const LocalPolynomialSpaceDescriptor &descriptor)
const std::map< std::string, size_t > & vertexDofs() const
Definition discrete-space-descriptor.hpp:169
DiscreteSpaceDescriptor & addGolyComplCell(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addPolyEdge(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addRealnxnVertex(const std::string &name, bool is_dof=false)
DiscreteSpaceDescriptor(const std::string &name, const Mesh &mesh, std::ostream &output=std::cout)
const std::map< std::string, size_t > & edgeDofs() const
Definition discrete-space-descriptor.hpp:165
DiscreteSpaceDescriptor & addRealVertex(const std::string &name, bool is_dof=false)
DiscreteSpaceDescriptor & addRealnVertex(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addRealnVertex(const std::string &name, bool is_dof=false)
DiscreteSpaceDescriptor & addRolyComplCell(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addRealnxnVertex(const LocalPolynomialSpaceDescriptor &descriptor)
size_t numberOfLocalVertexDofs(const std::string &dof_name) const
Definition discrete-space-descriptor.hpp:150
DiscreteSpaceDescriptor & addPolyCell(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addPolynEdge(const LocalPolynomialSpaceDescriptor &descriptor)
size_t numberOfLocalCellDofs(const std::string &dof_name) const
Definition discrete-space-descriptor.hpp:130
size_t numberOfLocalCellDofs() const
Definition discrete-space-descriptor.hpp:125
DiscreteSpaceDescriptor & addGolyComplCell(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addRealVertex(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addPolyEdge(const LocalPolynomialSpaceDescriptor &descriptor)
size_t numberOfLocalEdgeDofs(const std::string &dof_name) const
Definition discrete-space-descriptor.hpp:140
DiscreteSpaceDescriptor & addPolynxnCell(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addPolyCell(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addRolyCell(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addRolyCell(const std::string &name, size_t degree, bool is_dof=false)
const Mesh & mesh() const
Definition discrete-space-descriptor.hpp:74
const std::map< std::string, size_t > & cellDofs() const
Definition discrete-space-descriptor.hpp:161
DiscreteSpaceDescriptor & addPolynCell(const LocalPolynomialSpaceDescriptor &descriptor)
DiscreteSpaceDescriptor & addRolyComplCell(const std::string &name, size_t degree, bool is_dof=false)
const std::string & name() const
Definition discrete-space-descriptor.hpp:70
size_t numberOfLocalVertexDofs() const
Definition discrete-space-descriptor.hpp:145
DiscreteSpaceDescriptor & addPolynCell(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addGolyCell(const std::string &name, size_t degree, bool is_dof=false)
DiscreteSpaceDescriptor & addGolyCell(const LocalPolynomialSpaceDescriptor &descriptor)
const std::list< LocalPolynomialSpaceDescriptor > & getDescriptor() const
Definition discrete-space-descriptor.hpp:156
DiscreteSpaceDescriptor & addPolynEdge(const std::string &name, size_t degree, bool is_dof=false)
Definition Mesh2D.hpp:26
Eigen::Vector2d VectorRd
Definition basis.hpp:55
Eigen::Matrix2d MatrixRd
Definition basis.hpp:54
constexpr int dimspace
Dimension, and generic types for vector in correct dimension (makes it easier to translate a code bet...
Definition basis.hpp:53
boost::fusion::vector< PolyCellType, PolyEdgeType, PolynCellType, PolynxnCellType, PolynEdgeType, RolyCellType, RolyComplCellType, GolyCellType, GolyComplCellType, RealVertexType, RealnVertexType, RealnxnVertexType, SymPolynxnCellType > LocalPolynomialSpaces
Definition discrete-space-descriptor.hpp:39
Family< GradientBasis< ShiftedBasis< MonomialScalarBasisCell > > > GolyCellType
Definition discrete-space-descriptor.hpp:19
TensorizedVectorFamily< PolyCellType, dimspace > PolynCellType
Definition discrete-space-descriptor.hpp:23
VectorRd RealnVertexType
Definition discrete-space-descriptor.hpp:26
MatrixRd RealnxnVertexType
Definition discrete-space-descriptor.hpp:27
Family< GolyComplBasisCell > GolyComplCellType
Definition discrete-space-descriptor.hpp:20
double RealVertexType
Definition discrete-space-descriptor.hpp:28
TensorizedVectorFamily< Family< MonomialScalarBasisEdge >, dimspace > PolynEdgeType
Definition discrete-space-descriptor.hpp:24
Family< RolyComplBasisCell > RolyComplCellType
Definition discrete-space-descriptor.hpp:30
Family< CurlBasis< ShiftedBasis< MonomialScalarBasisCell > > > RolyCellType
Definition discrete-space-descriptor.hpp:29
Family< MonomialScalarBasisCell > PolyCellType
Definition discrete-space-descriptor.hpp:21
MatrixFamily< PolyCellType, dimspace > PolynxnCellType
Definition discrete-space-descriptor.hpp:25
DiscreteSpaceDescriptor::LocalPolynomialSpaceDescriptor make_dof(const std::string name, size_t degree)
Definition discrete-space-descriptor.cpp:249
Family< MonomialScalarBasisEdge > PolyEdgeType
Definition discrete-space-descriptor.hpp:22
Definition ddr-klplate.hpp:27
bool is_dof
Definition discrete-space-descriptor.hpp:61
std::string name
Definition discrete-space-descriptor.hpp:59
LocalPolynomialSpaceDescriptor(std::string _name, size_t _degree, bool _is_dof)
Definition discrete-space-descriptor.hpp:40
size_t degree
Definition discrete-space-descriptor.hpp:60