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 
19 namespace 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 
49  EdgeNd(Edge& cntr) :
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 
127  Real jacobian(Real x) const;
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:
158 
163 
166 
168  uint l_;
170 
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 
220  Real2d chi(Real xi) const;
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 
236  Real2d jacobian(Real x) const;
237 
242 
246  Real2d hessian(Real x) const;
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 
290  uint l_;
291 
294 
297 
305  Edge2d(Edge& cntr, MappingEdge2d* map, const Z2 dir, const uint l,
306  const uint i);
307  private:
310 
315  };
316 
317 } // namespace concepts
318 
319 #endif // cell1D_hh
Edge1d * chld_
Pointer to the first child.
Definition: cell1D.hh:162
virtual ~EdgeNd()
Definition: cell1D.hh:52
Edge2d * chld_
Pointer to the first child.
Definition: cell1D.hh:314
Edge1d * lnk_
Pointer to a sibling.
Definition: cell1D.hh:157
Real2d chi(Real xi) const
The element map.
virtual concepts::Real3d elemMap(const Real xi) const
Element map from point local coordinates in 1D.
Real jacobianDeterminant(const Real x) const
Returns the determinant of the Jacobian.
Definition: cell1D.hh:120
Edge1d(Edge &cntr, const MapEdge1d &map)
Constructor.
virtual concepts::Real3d elemMap(const Real2d &xi) const
Element map from point local coordinates in 2D.
MappingEdge2d * map_
Pointer to the element map.
Definition: cell1D.hh:288
Edge & connector() const
Returns the connector (topology)
Definition: cell1D.hh:59
Real2d n0(Real x) const
Returns the normal vector on a point of the edge.
Edge2d(Edge &cntr, MappingEdge2d *map, const Z2 dir, const uint l, const uint i)
Protected copy constructor.
virtual ~Edge2d()
EdgeNd(Edge &cntr)
Constructor.
Definition: cell1D.hh:49
virtual EdgeNd * child(uint i)=0
Returns a pointer to the ith child.
A 1D cell: edge.
Definition: cell1D.hh:83
unsigned char uchar
Abbreviation for unsigned char.
Definition: typedefs.hh:45
index_type i_
Index of the element (ie. left or right child)
Definition: cell1D.hh:172
A 1D cell: edge in 2D.
Definition: cell1D.hh:189
Real2d jacobian(Real x) const
Returns the Jacobian.
MapEdge1d * map_
Pointer to the element map.
Definition: cell1D.hh:165
Real size() const
Returns the size of the element.
Real2d hessian(Real x) const
Returns a vector withthe second derivatives.
virtual Real3d vertex(const uint i) const
Returns the coordinates of the ith vertex.
Edge2d * lnk_
Pointer to a sibling.
Definition: cell1D.hh:309
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.
One dimensional cell.
Definition: cell.hh:75
virtual concepts::Real3d elemMap(const Real1d &xi) const
Definition: cell1D.hh:113
virtual ~Edge1d()
virtual Real3d center() const
Returns the center of the cell.
Real jacobian(concepts::Point< Real, 1 > &x) const
Real jacobianInverse(const Real x) const
Returns the inverse of the Jacobian.
Definition: cell1D.hh:137
Real jacobianDeterminant(const Real x) const
Returns the determinant of the Jacobian.
Definition: cell1D.hh:229
virtual uint dim() const
Returns the dimension of the space, i.e. N.
Definition: cell1D.hh:100
virtual Edge2d * child(uint i)
Returns a child.
Real chi(Real xi) const
The element map.
Edge & cntr_
Reference to the edge (topology)
Definition: cell1D.hh:74
index_type i_
Index of the element (ie. left or right child)
Definition: cell1D.hh:293
Z2 dir_
Direction of the normal vector.
Definition: cell1D.hh:296
Real l2() const
Returns the Euclidian norm of the vector.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint index_type
Definition: cell1D.hh:40
virtual Edge2d * clone(Edge &cntr, MappingEdge2d *map) const
Definition: cell1D.hh:261
virtual Real jacobianDeterminant(const Real x) const =0
Returns the determinant of the Jacobian.
uint l_
Level of the element.
Definition: cell1D.hh:168
virtual Edge2d * clone() const
Returns a copy of itself.
A 1D element map for an edge.
Definition: elementMaps.hh:47
Z2 & dir()
Access to the direction of the normal vector.
Definition: cell1D.hh:275
virtual const Edge1d * child(uint i) const
Returns a pointer to the ith child.
virtual concepts::Real3d elemMap(const Real xi) const
Element map from point local coordinates in 1D.
Real jacobian(Real x) const
Returns the Jacobian.
Array< Real > hessianInverse(Real x) const
Returns the hessian matrix of the inverse function of the parametrisation in x.
const MapEdge1d * map() const
Definition: cell1D.hh:141
virtual const Edge2d * child(uint i) const
Returns a pointer to the ith child.
static uint MAX_LEVEL
Definition: cell1D.hh:44
virtual Edge1d * child(uint i)
Returns a child.
A 1D cell in any dimension: edge.
Definition: cell1D.hh:32
Level< 1 > lvl_
Definition: cell1D.hh:169
Edge2d(Edge &cntr, const MappingEdge2d &map, const Z2 dir=0)
Constructor.
Edge1d * clone(Edge &cntr, MapEdge1d *map) const
Returns a copy of itself.
Definition: cell1D.hh:150
uchar level() const
Returns the level of the cell.
Definition: cell1D.hh:266
const Level< 1 > & level() const
Definition: cell1D.hh:145
A 2D element map for an edge.
Definition: elementMaps.hh:84
virtual concepts::Real3d elemMap(const Real3d &xi) const
Element map from point local coordinates in 3D.
uint l_
Level of the element.
Definition: cell1D.hh:290
virtual uint dim() const =0
Returns the dimension of the space, i.e. N.
Z2 dir() const
Returns if the normal vector is right or left pointing.
Definition: cell1D.hh:271
virtual concepts::Real3d elemMap(const Real2d &xi) const
Element map from point local coordinates in 2D.
virtual const EdgeNd * child(uint i) const =0
Returns a pointer to the ith child.
Real tangentialSecondDerivative(const Real x) const
Returns the second tangential derivative.
Binary group (algebraic): only the values 0 and 1 are represented.
Definition: Zm.hh:16
An edge in the topology.
Definition: topology.hh:73
void swapdir()
Swaps the normal direction.
Definition: cell1D.hh:279
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const MappingEdge2d * map() const
Definition: cell1D.hh:254
virtual concepts::Real3d elemMap(const Real3d &xi) const
Element map from point local coordinates in 3D.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Edge1d(Edge &cntr, MapEdge1d *map, const uint l, const uint i)
Private copy constructor.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich