Class documentation of Concepts

Loading...
Searching...
No Matches
cell3D.hh
Go to the documentation of this file.
1
8#ifndef cell3D_hh
9#define cell3D_hh
10
11#include <iostream>
12#include "basics/typedefs.hh"
14#include "basics/level.hh"
15#include "topology3D.hh"
16#include "cell.hh"
17#include "elementMaps3D.hh"
18
19
20namespace concepts {
21
22 // ****************************************************** NegativeJacobian **
23
29 public:
34 NegativeJacobian(const std::string& errMsg) throw();
35 protected:
36 virtual std::ostream& info(std::ostream& os) const throw();
37 };
38
39 // ********************************************************* Tetrahedron3d **
40
47 class Tetrahedron3d : public Cell3 {
48 public:
49
50 /* Type for indices in the hierarchical definition of the cells
51
52 Use a type with a larger range depending on the number of cell
53 refinements.
54 */
55 typedef uint index_type;
56
57 // Maximal number of levels in the cell refinement
58
59 static uint MAX_LEVEL;
60
62 struct Index {
65
70 index_type i_;
71
76 index_type j_;
77
82 index_type k_;
83
84 inline Index() : l_(0), i_(0), j_(0), k_(0) {}
85 inline Index(uchar l, index_type i, index_type j, index_type k) :
86 l_(l), i_(i), j_(j), k_(k) {}
87 inline std::ostream& info(std::ostream& os) const;
88 };
89
96 virtual ~Tetrahedron3d();
97
99 virtual const Tetrahedron3d* child(uint i) const;
100 Tetrahedron& connector() const { return cntr_; }
101
111 Real3d center() const {return chi(0.5, 0.5, 0.5);};
112
114 protected:
115 virtual std::ostream& info(std::ostream& os) const;
116 private:
118 Index idx_;
119
121 Tetrahedron& cntr_;
122
124 Tetrahedron3d* lnk_;
125
129 Tetrahedron3d* chld_;
130
132 MapTetrahedron3d* map_;
133
136 const Index& idx);
137 };
138
139 inline std::ostream& Tetrahedron3d::Index::info(std::ostream& os) const {
140 return os << '(' << (uint)l_ << ", "
141 << i_ << ", " << j_ << ", " << k_ << ')';
142 }
143
144 // ****************************************************** Hex3dSubdivision **
145
146 class Hexahedron3d;
147
160 public:
163 virtual void createChildren(Hexahedron3d& h) const = 0;
166 virtual void removeChildren(Hexahedron3d& h) const;
169 virtual const HexSubdivision* topologicalStrategy() const = 0;
170 };
171
172 // ********************************************************** Hex3dSubdiv8 **
173
178 public:
179 virtual void createChildren(Hexahedron3d& h) const;
180 virtual const HexSubdiv8* topologicalStrategy() const;
181 static const Hex3dSubdiv8* instance();
182 virtual ~Hex3dSubdiv8();
183 protected:
184 virtual std::ostream& info(std::ostream& os) const;
185 private:
186 static std::unique_ptr<Hex3dSubdiv8> instance_;
187 };
188
189 // ********************************************************* Hex3dSubdiv2x **
190
196 public:
197 virtual void createChildren(Hexahedron3d& h) const;
198 virtual const HexSubdiv2x* topologicalStrategy() const;
199 static const Hex3dSubdiv2x* instance();
200 virtual ~Hex3dSubdiv2x();
201 protected:
202 virtual std::ostream& info(std::ostream& os) const;
203 private:
204 static std::unique_ptr<Hex3dSubdiv2x> instance_;
205 };
206
207 // ********************************************************* Hex3dSubdiv2y **
208
214 public:
215 virtual void createChildren(Hexahedron3d& h) const;
216 virtual const HexSubdiv2y* topologicalStrategy() const;
217 static const Hex3dSubdiv2y* instance();
218 virtual ~Hex3dSubdiv2y();
219 protected:
220 virtual std::ostream& info(std::ostream& os) const;
221 private:
222 static std::unique_ptr<Hex3dSubdiv2y> instance_;
223 };
224
225 // ********************************************************* Hex3dSubdiv2z **
226
232 public:
233 virtual void createChildren(Hexahedron3d& h) const;
234 virtual const HexSubdiv2z* topologicalStrategy() const;
235 static const Hex3dSubdiv2z* instance();
236 virtual ~Hex3dSubdiv2z();
237 protected:
238 virtual std::ostream& info(std::ostream& os) const;
239 private:
240 static std::unique_ptr<Hex3dSubdiv2z> instance_;
241 };
242
243 // ********************************************************* Hex3dSubdiv4x **
244
249 public:
250 virtual void createChildren(Hexahedron3d& h) const;
251 virtual const HexSubdiv4x* topologicalStrategy() const;
252 static const Hex3dSubdiv4x* instance();
253 virtual ~Hex3dSubdiv4x();
254 protected:
255 virtual std::ostream& info(std::ostream& os) const;
256 private:
257 static std::unique_ptr<Hex3dSubdiv4x> instance_;
258 };
259
260 // ********************************************************* Hex3dSubdiv4y **
261
266 public:
267 virtual void createChildren(Hexahedron3d& h) const;
268 virtual const HexSubdiv4y* topologicalStrategy() const;
269 static const Hex3dSubdiv4y* instance();
270 virtual ~Hex3dSubdiv4y();
271 protected:
272 virtual std::ostream& info(std::ostream& os) const;
273 private:
274 static std::unique_ptr<Hex3dSubdiv4y> instance_;
275 };
276
277 // ********************************************************* Hex3dSubdiv4z **
278
283 public:
284 virtual void createChildren(Hexahedron3d& h) const;
285 virtual const HexSubdiv4z* topologicalStrategy() const;
286 static const Hex3dSubdiv4z* instance();
287 virtual ~Hex3dSubdiv4z();
288 protected:
289 virtual std::ostream& info(std::ostream& os) const;
290 private:
291 static std::unique_ptr<Hex3dSubdiv4z> instance_;
292 };
293
294 // ********************************************************** Hexahedron3d **
295
296 // forward declaration
297 class MappingQuad3d;
298
317 class Hexahedron3d : public Cell3 {
318 friend class Hex3dSubdivision;
319 friend class Hex3dSubdiv8;
320 friend class Hex3dSubdiv2x;
321 friend class Hex3dSubdiv2y;
322 friend class Hex3dSubdiv2z;
323 friend class Hex3dSubdiv4x;
324 friend class Hex3dSubdiv4y;
325 friend class Hex3dSubdiv4z;
326 public:
327
328 /* Type for indices in the hierarchical definition of the cells
329
330 Use a type with a larger range depending on the number of cell
331 refinements.
332 */
333 typedef uint index_type;
334
335 // Maximal number of levels in the cell refinement
336
337 static uint MAX_LEVEL;
338
340 struct Index {
343
348 index_type i_;
349
354 index_type j_;
355
360 index_type k_;
361
362 inline Index() : level_(0), i_(0), j_(0), k_(0) {}
363 inline Index(uchar l, uchar m, uchar n, index_type i, index_type j, index_type k) :
364 level_(l), i_(i), j_(j), k_(k) { level_.l_[1] = m; level_.l_[2] = n; }
365 inline Index(const Index& i) : level_(i.level_), i_(i.i_), j_(i.j_),
366 k_(i.k_) {}
367 };
368
369 friend std::ostream& operator<<(std::ostream& os,
370 const Hexahedron3d::Index& i);
371
378 virtual ~Hexahedron3d();
379
380 virtual Hexahedron3d* child(uint i);
381 virtual const Hexahedron3d* child(uint i) const;
382 inline Hexahedron& connector() const { return cntr_; }
383
392 Real3d chi(Real xi, Real eta, Real zeta) const;
393
394 Real3d elemMap(const Real3d& coord_local) const
395 {
396 return chi(coord_local[0], coord_local[1], coord_local[2]);
397 }
398
424 MapReal3d jacobian(const Real xi, const Real eta, const Real zeta) const;
425
426 MapReal3d jacobian(const concepts::Real3d& p) const;
427
428 /*
429 * Hessian of the mapping
430 */
431
432 MapReal3d hessian(const uint i,const Real xi, const Real eta, const Real zeta) const;
433
434 MapReal3d hessian(const uint i,const concepts::Real3d& p) const;
435
439 MapReal3d jacobianInverse(const Real xi, const Real eta,
440 const Real zeta) const {
441 return jacobian(xi, eta, zeta).inverse();
442 }
443
447 Real jacobianDeterminant(const Real xi, const Real eta,
448 const Real zeta) const {
449 return jacobian(xi, eta, zeta).determinant();
450 }
451
453 const Level<3>& level() const { return idx_.level_; }
454
455 Real3d vertex(uint i) const;
456 Real3d center() const {return chi(0.5, 0.5, 0.5);};
457
459 inline const MappingHexahedron3d* map() const {return map_;};
460
464 MappingQuad3d* faceMap(uint face) const;
465
478 void setStrategy(const Hex3dSubdivision* strategy = 0);
479
485 const Hex3dSubdivision* getStrategy() const { return subdivStrategy_; }
486 protected:
487 virtual std::ostream& info(std::ostream& os) const;
488 private:
490 Index idx_;
491
493 Hexahedron& cntr_;
494
496 Hexahedron3d* lnk_;
497
501 Hexahedron3d* chld_;
502
505
507 const Hex3dSubdivision* subdivStrategy_;
508
511 const Index& idx);
512 };
513
514 // ****************************************************** Parallelepiped3d **
515
523 class Parallelepiped3d : public Cell3 {
524 public:
525
526 /* Type for indices in the hierarchical definition of the cells
527
528 Use a type with a larger range depending on the number of cell
529 refinements.
530 */
531 typedef uint index_type;
532
533 // Maximal number of levels in the cell refinement
534
535 static uint MAX_LEVEL;
536
538 struct Index {
541
546 index_type i_;
547
552 index_type j_;
553
558 index_type k_;
559
560 inline Index() : l_(0), i_(0), j_(0), k_(0) {}
561 inline Index(uchar l, index_type i, index_type j, index_type k) :
562 l_(l), i_(i), j_(j), k_(k) {}
563 inline std::ostream& info(std::ostream& os) const;
564 };
565
572 virtual ~Parallelepiped3d();
573
574 virtual Parallelepiped3d* child(uint c);
575 virtual const Parallelepiped3d* child(uint c) const;
576 Hexahedron& connector() const { return cntr_; }
577
586 Real3d chi(Real xi, Real eta, Real zeta) const;
587 Real3d center() const {return chi(0.5, 0.5, 0.5);};
588
589 Real3d vertex(uint i) const;
590 protected:
591 virtual std::ostream& info(std::ostream& os) const;
592 private:
594 Index idx_;
595
597 Hexahedron& cntr_;
598
600 Parallelepiped3d* lnk_;
601
605 Parallelepiped3d* chld_;
606
609
612 const Index& idx);
613 };
614
615 inline std::ostream& Parallelepiped3d::Index::info(std::ostream& os) const {
616 return os << '(' << (uint)l_ << ", "
617 << i_ << ", " << j_ << ", " << k_ << ')';
618 }
619
620} // namespace concepts
621
622#endif // cell3D_hh
Three dimensional cell.
Definition cell.hh:112
virtual const HexSubdiv2x * topologicalStrategy() const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void createChildren(Hexahedron3d &h) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const HexSubdiv2y * topologicalStrategy() const
virtual void createChildren(Hexahedron3d &h) const
virtual void createChildren(Hexahedron3d &h) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const HexSubdiv2z * topologicalStrategy() const
virtual const HexSubdiv4x * topologicalStrategy() const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void createChildren(Hexahedron3d &h) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const HexSubdiv4y * topologicalStrategy() const
virtual void createChildren(Hexahedron3d &h) const
virtual void createChildren(Hexahedron3d &h) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const HexSubdiv4z * topologicalStrategy() const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const HexSubdiv8 * topologicalStrategy() const
virtual void createChildren(Hexahedron3d &h) const
virtual void removeChildren(Hexahedron3d &h) const
virtual void createChildren(Hexahedron3d &h) const =0
virtual const HexSubdivision * topologicalStrategy() const =0
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const Level< 3 > & level() const
Returns the level of the cell.
Definition cell3D.hh:453
Hexahedron & connector() const
Returns the connector.
Definition cell3D.hh:382
Real3d elemMap(const Real3d &coord_local) const
Element map from point local coordinates in 3D.
Definition cell3D.hh:394
MapReal3d jacobian(const Real xi, const Real eta, const Real zeta) const
Real3d vertex(uint i) const
Returns the coordinates of the ith vertex.
Hexahedron3d(Hexahedron &cntr, const MappingHexahedron3d &map)
void setStrategy(const Hex3dSubdivision *strategy=0)
Real3d center() const
Returns the center of the cell.
Definition cell3D.hh:456
const MappingHexahedron3d * map() const
Returns the element map.
Definition cell3D.hh:459
MapReal3d jacobianInverse(const Real xi, const Real eta, const Real zeta) const
Definition cell3D.hh:439
Real3d chi(Real xi, Real eta, Real zeta) const
const Hex3dSubdivision * getStrategy() const
Definition cell3D.hh:485
virtual const Hexahedron3d * child(uint i) const
virtual Hexahedron3d * child(uint i)
Real jacobianDeterminant(const Real xi, const Real eta, const Real zeta) const
Definition cell3D.hh:447
MappingQuad3d * faceMap(uint face) const
Mapping< F, DimX, DimY > inverse() const
Returns the inverse of the matrix.
NegativeJacobian(const std::string &errMsg)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Real3d chi(Real xi, Real eta, Real zeta) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual Parallelepiped3d * child(uint c)
Real3d center() const
Returns the center of the cell.
Definition cell3D.hh:587
Parallelepiped3d(Hexahedron &cntr, const MapParallelepiped3d &map)
Real3d vertex(uint i) const
Returns the coordinates of the ith vertex.
Hexahedron & connector() const
Returns the connector.
Definition cell3D.hh:576
virtual const Parallelepiped3d * child(uint c) const
virtual const Tetrahedron3d * child(uint i) const
Tetrahedron3d(Tetrahedron &cntr, const MapTetrahedron3d &map)
Real3d chi(Real xi, Real eta, Real zeta) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Tetrahedron & connector() const
Returns the connector.
Definition cell3D.hh:100
Real3d center() const
Returns the center of the cell.
Definition cell3D.hh:111
Real3d vertex(uint i) const
Returns the coordinates of the ith vertex.
virtual Tetrahedron3d * child(uint i)
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
Subclass of Hexahedron3d representing its index.
Definition cell3D.hh:340
Level< 3 > level_
Level of this element.
Definition cell3D.hh:342
short l_[dim]
Level.
Definition level.hh:24
Subclass of Tetrahedron3d representing its index.
Definition cell3D.hh:538
uchar l_
Level of this element.
Definition cell3D.hh:540
Subclass of Tetrahedron3d representing its index.
Definition cell3D.hh:62
uchar l_
Level of this element.
Definition cell3D.hh:64