Class documentation of Concepts

Loading...
Searching...
No Matches
cell1D.hh
Go to the documentation of this file.
1
8#ifndef cell1D_hh
9#define cell1D_hh
10
11#include <iostream>
12#include <memory>
13#include "basics/typedefs.hh"
15#include "topology.hh"
16#include "cell.hh"
17#include "operator/matrix.hh"
18
19namespace concepts {
20
21 // forward declaration
22 class MapEdge1d;
23 class MappingEdge2d;
24
25 // **************************************************************** EdgeNd **
26
32 class EdgeNd: public Cell1 {
33 public:
34
35 /* Type for indices in the hierarchical definition of the cells
36
37 Use a type with a larger range depending on the number of cell
38 refinements.
39 */
40 typedef uint index_type;
41
42 // Maximal number of levels in the cell refinement
43
44 static uint MAX_LEVEL;
45
50 cntr_(cntr) {
51 }
52 virtual ~EdgeNd() {
53 }
54
55 virtual EdgeNd* child(uint i) = 0;
56 virtual const EdgeNd* child(uint i) const = 0;
57
59 inline Edge& connector() const {
60 return cntr_;
61 }
62
64 virtual Real jacobianDeterminant(const Real x) const = 0;
65
66 virtual Real3d vertex(const uint i) const;
67 virtual Real3d center() const;
68
70 virtual uint dim() const = 0;
71 protected:
72 virtual std::ostream& info(std::ostream& os) const;
75 };
76
77 // **************************************************************** Edge1d **
78
83 class Edge1d: public EdgeNd {
84 public:
90 Edge1d(Edge& cntr, const MapEdge1d& map);
91 virtual ~Edge1d();
92
97 virtual Edge1d* child(uint i);
98 virtual const Edge1d* child(uint i) const;
99
100 virtual inline uint dim() const {
101 return 1;
102 }
103
110 Real chi(Real xi) const;
111
112 virtual concepts::Real3d elemMap(const Real xi) const;
113 virtual concepts::Real3d elemMap(const Real1d& xi) const { return this->elemMap(xi[0]); };
114 virtual concepts::Real3d elemMap(const Real2d& xi) const;
115 virtual concepts::Real3d elemMap(const Real3d& xi) const;
116
120 inline Real jacobianDeterminant(const Real x) const {
121 return jacobian(x);
122 }
123
128
130
132 Real size() const;
133
137 inline Real jacobianInverse(const Real x) const {
138 return 1.0 / jacobian(x);
139 }
140
141 inline const MapEdge1d* map() const {
142 return map_;
143 }
144
145 inline const Level<1>& level() const{
146 return lvl_;
147 }
148
150 inline Edge1d* clone(Edge& cntr, MapEdge1d* map) const {
151 return new Edge1d(cntr, map, l_, i_);
152 }
153 protected:
154 virtual std::ostream& info(std::ostream& os) const;
155 private:
157 Edge1d* lnk_;
158
162 Edge1d* chld_;
163
165 MapEdge1d* map_;
166
168 uint l_;
169 Level<1> lvl_;
170
172 index_type i_;
173
180 Edge1d(Edge& cntr, MapEdge1d* map, const uint l, const uint i);
181 };
182
183 // **************************************************************** Edge2d **
184
189 class Edge2d: public EdgeNd {
190 public:
199 Edge2d(Edge& cntr, const MappingEdge2d& map, const Z2 dir = 0);
200
201 virtual ~Edge2d();
202
207 virtual Edge2d* child(uint i);
208 virtual const Edge2d* child(uint i) const;
209
210 virtual inline uint dim() const {
211 return 2;
212 }
213
221
222 virtual concepts::Real3d elemMap(const Real xi) const;
223 virtual concepts::Real3d elemMap(const Real2d& xi) const;
224 virtual concepts::Real3d elemMap(const Real3d& xi) const;
225
229 inline Real jacobianDeterminant(const Real x) const {
230 return jacobian(x).l2();
231 }
232
237
242
247
253
254 inline const MappingEdge2d* map() const {
255 return map_;
256 }
257
259 virtual Edge2d* clone() const;
260
261 virtual Edge2d* clone(Edge& cntr, MappingEdge2d* map) const {
262 return new Edge2d(cntr, map, dir_, l_, i_);
263 }
264
266 uchar level() const {
267 return l_;
268 }
269
271 Z2 dir() const {
272 return dir_;
273 }
275 Z2& dir() {
276 return dir_;
277 }
279 inline void swapdir() {
280 ++dir_;
281 }
283 Real2d n0(Real x) const;
284 protected:
285 virtual std::ostream& info(std::ostream& os) const;
286
291
293 index_type i_;
294
297
305 Edge2d(Edge& cntr, MappingEdge2d* map, const Z2 dir, const uint l,
306 const uint i);
307 private:
309 Edge2d* lnk_;
310
314 Edge2d* chld_;
315 };
316
317} // namespace concepts
318
319#endif // cell1D_hh
One dimensional cell.
Definition cell.hh:75
virtual Edge1d * child(uint i)
Real jacobianDeterminant(const Real x) const
Definition cell1D.hh:120
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual concepts::Real3d elemMap(const Real3d &xi) const
Element map from point local coordinates in 3D.
Edge1d(Edge &cntr, const MapEdge1d &map)
Real size() const
Returns the size of the element.
Edge1d * clone(Edge &cntr, MapEdge1d *map) const
Returns a copy of itself.
Definition cell1D.hh:150
virtual const Edge1d * child(uint i) const
Real jacobianInverse(const Real x) const
Definition cell1D.hh:137
Real chi(Real xi) const
Real jacobian(Real x) const
virtual concepts::Real3d elemMap(const Real xi) const
Element map from point local coordinates in 1D.
virtual uint dim() const
Returns the dimension of the space, i.e. N.
Definition cell1D.hh:100
virtual concepts::Real3d elemMap(const Real2d &xi) const
Element map from point local coordinates in 2D.
virtual concepts::Real3d elemMap(const Real xi) const
Element map from point local coordinates in 1D.
virtual Edge2d * child(uint i)
Real tangentialSecondDerivative(const Real x) const
Real2d chi(Real xi) const
Z2 dir() const
Returns if the normal vector is right or left pointing.
Definition cell1D.hh:271
uint l_
Level of the element.
Definition cell1D.hh:290
Real2d jacobian(Real x) const
virtual const Edge2d * child(uint i) const
Real2d n0(Real x) const
Returns the normal vector on a point of the edge.
Real2d hessian(Real x) const
Z2 & dir()
Access to the direction of the normal vector.
Definition cell1D.hh:275
index_type i_
Index of the element (ie. left or right child)
Definition cell1D.hh:293
Real jacobianDeterminant(const Real x) const
Definition cell1D.hh:229
uchar level() const
Returns the level of the cell.
Definition cell1D.hh:266
virtual Edge2d * clone() const
Returns a copy of itself.
MappingEdge2d * map_
Pointer to the element map.
Definition cell1D.hh:288
Edge2d(Edge &cntr, const MappingEdge2d &map, const Z2 dir=0)
Z2 dir_
Direction of the normal vector.
Definition cell1D.hh:296
void swapdir()
Swaps the normal direction.
Definition cell1D.hh:279
virtual concepts::Real3d elemMap(const Real2d &xi) const
Element map from point local coordinates in 2D.
virtual concepts::Real3d elemMap(const Real3d &xi) const
Element map from point local coordinates in 3D.
virtual uint dim() const
Returns the dimension of the space, i.e. N.
Definition cell1D.hh:210
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Array< Real > hessianInverse(Real x) const
Edge2d(Edge &cntr, MappingEdge2d *map, const Z2 dir, const uint l, const uint i)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
EdgeNd(Edge &cntr)
Definition cell1D.hh:49
virtual Real jacobianDeterminant(const Real x) const =0
Returns the determinant of the Jacobian.
Edge & connector() const
Returns the connector (topology)
Definition cell1D.hh:59
Edge & cntr_
Reference to the edge (topology)
Definition cell1D.hh:74
virtual Real3d center() const
Returns the center of the cell.
virtual const EdgeNd * child(uint i) const =0
virtual Real3d vertex(const uint i) const
Returns the coordinates of the ith vertex.
virtual uint dim() const =0
Returns the dimension of the space, i.e. N.
virtual EdgeNd * child(uint i)=0
Real l2() const
Returns the Euclidian norm of the vector.
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
unsigned char uchar
Abbreviation for unsigned char.
Definition typedefs.hh:48