Class documentation of Concepts

Loading...
Searching...
No Matches
elementMaps3D.hh
Go to the documentation of this file.
1
7#ifndef elementMaps3D_hh
8#define elementMaps3D_hh
9
11#include "basics/typedefs.hh"
13#include "basics/debug.hh"
14#include "elementMaps.hh"
15
16// debugging
17#define geoMapTetrahedron3dAppl_D 0
18
19namespace concepts {
20
21 // ***************************************************************** Map3d **
22
26 class Map3d : public OutputOperator {
27 public:
28 std::ostream& info(std::ostream& os) const {return os << "Map3d()";};
29 };
30
31
32 // ****************************************************** MapTetrahedron3d **
33
66 class MapTetrahedron3d : public Map3d {
67 public:
80
88
91 ~MapTetrahedron3d() { delete[] map_; }
92
109 Real3d operator()(Real x, Real y, Real z) const {
110 if (map_)
111 return Real3d(map_, scx_ * x, scy_ * y, scz_ * z);
112 else {
113 Real3d xi(x*(1.0-y)*(1.0-z), y*(1.0-z), z);
114 Real3d res(B_ * xi);
115 res += b_;
116 DEBUGL(geoMapTetrahedron3dAppl_D, '(' << x << ", " << y
117 << ", " << z << ") -> " << xi << " -> " << res);
118 return res;
119 }
120 }
121
123 Real jacobian() const {
124 if (map_)
125 throw conceptsException(MissingFeature("jacobian not supported"));
126 return B_.determinant(); }
127
129 inline MapTetrahedron3d* clone() const {
130 return new MapTetrahedron3d(*this);
131 };
132
133private:
135 uchar* map_;
136
138 uint sz_;
139
141 Real scx_;
142
144 Real scy_;
145
147 Real scz_;
148
150 MapReal3d B_;
151
153 Real3d b_;
154
156 void operator=(const MapTetrahedron3d &);
157 };
158
159
160 // ********************************************************** MappingHexahedron3d **
161
162 //forward declaration
163 class MappingQuad3d;
164
171 class MappingHexahedron3d : public Map3d {
172 public:
173
174 virtual ~MappingHexahedron3d() {}
179 virtual Real3d operator()(Real x, Real y, Real z) const = 0;
180
185 virtual MapReal3d jacobian(const Real x, const Real y, const Real z) const = 0;
186
190 virtual MapReal3d hessian(uint i,const Real x, const Real y, const Real z) const = 0;
191
196 virtual MapReal3d jacobianInverse(const Real x, const Real y, const Real z) const {
197 return jacobian(x,y,z).inverse(); }
198
200 virtual Real jacobianDeterminant(const Real x, const Real y, const Real z) const {
201 return jacobian(x,y,z).determinant(); }
202
204 virtual MappingQuad3d* face(const uint face) const = 0;
205
207 virtual MappingHexahedron3d* clone() const = 0;
208
210 virtual MappingHexahedron3d* part(const Real3d xi0, const Real3d xi1) const = 0;
211
212 protected:
213 virtual std::ostream& info(std::ostream& os) const = 0;
214 };
215
216 // ********************************************************* BlendingHexahedron3d **
217
218 //forward declaration
219 class MappingQuad3d;
220 class MappingEdge3d;
221 class Hexahedron;
222
243 public:
244
274 const Hexahedron& hex);
276 BlendingHexahedron3d* clone() const override { return new BlendingHexahedron3d(*this); }
277 ~BlendingHexahedron3d() override;
278 Real3d operator()(Real x, Real y, Real z) const override;
279 MapReal3d jacobian(const Real x, const Real y, const Real z) const override;
280 MapReal3d hessian(uint i,const Real x, const Real y, const Real z) const override;
281 MappingQuad3d* face(const uint face) const override;
282 MappingEdge3d* edge(const uint edge) const;
284 MappingHexahedron3d* part(const Real3d xi0, const Real3d xi1) const override;
285 protected:
286 std::ostream& info(std::ostream& os) const override;
287 private:
288 // Maps of the faces
289 std::array<std::unique_ptr<MappingQuad3d>,6> quadmap_;
290 // Maps of the edges
291 std::array<std::unique_ptr<MappingEdge3d>,12> edgemap_;
292 // Coordinates of the vertices
293 std::array<Real3d,8> vtx_;
294
295 // Find all geometric boundary quads, edges and vertices
296 // This function should actually be a member of a MappingHex class, which should independent of the
297 // dimension of the ambient space
298 void construct_(const std::array<const MappingQuad3d*,6>& quadmap, const Hexahedron& hex);
299 };
300
301 // ***************************************************** PartMappingHexahedron3d **
302
314 public:
321 const Real3d x0, const Real3d x1);
323 ~PartMappingHexahedron3d() override {};
325 Real3d operator()(Real x, Real y, Real z) const override;
326 MapReal3d jacobian(const Real x, const Real y, const Real z) const override;
327 MapReal3d hessian(uint i,const Real x, const Real y, const Real z) const override;
328 MappingQuad3d* face(const uint face) const override;
329 PartMappingHexahedron3d* part(const Real3d x0, const Real3d x1) const override;
330 protected:
331 std::ostream& info(std::ostream& os) const override;
332 private:
334 std::unique_ptr<MappingHexahedron3d> map_;
336 const Real3d x0_;
338 const Real3d d_;
339
341 inline const Real3d xi_(const Real x, const Real y, const Real z) const {
342 return x0_ + Real3d(x * d_[0], y * d_[1], z * d_[2]);
343 }
344 };
345
346
347 // ******************************************************* MapHexahedron3d **
348
367
369 uchar* map_;
370
372 uint sz_;
373
375 Real scx_;
376
378 Real scy_;
379
381 Real scz_;
382
384 Real3d *comp_;
385
387 void operator=(const MapHexahedron3d &);
388
389 public:
402
410 const Real3d& vtx2, const Real3d& vtx3,
411 const Real3d& vtx4, const Real3d& vtx5,
412 const Real3d& vtx6, const Real3d& vtx7);
413
416 ~MapHexahedron3d() { delete[] map_; delete[] comp_; }
417
426 inline Real3d operator()(Real x, Real y, Real z) const {
427 conceptsAssert(x >= 0.0, Assertion());
428 conceptsAssert(x <= 1.0, Assertion());
429 conceptsAssert(y >= 0.0, Assertion());
430 conceptsAssert(y <= 1.0, Assertion());
431 conceptsAssert(z >= 0.0, Assertion());
432 conceptsAssert(z <= 1.0, Assertion());
433 if (map_)
434 return Real3d(map_, scx_ * x, scy_ * y, scz_* z);
435 else {
436 Real3d res(comp_[0]*(x*y*z));
437 res += comp_[1]*(x*y);
438 res += comp_[2]*(x*z);
439 res += comp_[3]*(y*z);
440 res += comp_[4]*x;
441 res += comp_[5]*y;
442 res += comp_[6]*z;
443 res += comp_[7];
444 return res;
445 }
446 }
447
452 MapReal3d jacobian(const Real x, const Real y, const Real z) const;
453
456 MapReal3d hessian(uint i,const Real x, const Real y, const Real z) const;
457
462 MapReal3d jacobianInverse(const Real x, const Real y, const Real z) const {
463 return jacobian(x, y, z).inverse();
464 }
465
467 Real jacobianDeterminant(const Real x, const Real y, const Real z) const {
468 return jacobian(x, y, z).determinant();
469 }
470
472 MapHexahedron3d* clone() const { return new MapHexahedron3d(*this); }
473
476
478 MapHexahedron3d* part(const Real3d x0, const Real3d z0) const;
479
480 protected:
481 virtual std::ostream& info(std::ostream& os) const;
482 };
483
484
485 // *************************************************** MapParallelepiped3d **
486
495 class MapParallelepiped3d : public Map3d {
496 public:
504
507
516 Real3d operator()(Real x, Real y, Real z) const {
517 Real3d res(B1_*x + B2_*y + B3_*z);
518 res += b_;
519 return res;
520 }
521
523 Real jacobian() const {
524 return (B1_ ^ B2_) * B3_;
525 }
526
528 inline MapParallelepiped3d* clone() const {
529 return new MapParallelepiped3d(*this);
530 };
531
532 private:
533 Real3d b_;
534 Real3d B1_;
535 Real3d B2_;
536 Real3d B3_;
537
539 void operator=(const MapParallelepiped3d &);
540 };
541
542} // namespace concepts
543
544#endif // elementMaps3D_hh
#define conceptsException(exc)
Real3d operator()(Real x, Real y, Real z) const override
MappingHexahedron3d * part(const Real3d xi0, const Real3d xi1) const override
MapReal3d hessian(uint i, const Real x, const Real y, const Real z) const override
std::ostream & info(std::ostream &os) const override
Returns information in an output stream.
MapReal3d jacobian(const Real x, const Real y, const Real z) const override
MappingQuad3d * face(const uint face) const override
BlendingHexahedron3d * clone() const override
Returns a copy of the map.
BlendingHexahedron3d(const Sequence< const MappingQuad3d * > quadmap, const Hexahedron &hex)
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
MapReal3d hessian(uint i, const Real x, const Real y, const Real z) const
MapHexahedron3d * part(const Real3d x0, const Real3d z0) const
MapHexahedron3d * clone() const
Returns a copy of the map.
MappingQuad3d * face(uint face) const
Real jacobianDeterminant(const Real x, const Real y, const Real z) const
Returns the determinant of the Jacobian.
MapHexahedron3d(char *map, Real scX, Real scY, Real scZ)
MapHexahedron3d(const MapHexahedron3d &map)
Copy constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
MapReal3d jacobianInverse(const Real x, const Real y, const Real z) const
Real3d operator()(Real x, Real y, Real z) const
MapReal3d jacobian(const Real x, const Real y, const Real z) const
MapHexahedron3d(const Real3d &vtx0, const Real3d &vtx1, const Real3d &vtx2, const Real3d &vtx3, const Real3d &vtx4, const Real3d &vtx5, const Real3d &vtx6, const Real3d &vtx7)
MapParallelepiped3d * clone() const
Returns a copy of the map.
Real jacobian() const
Returns the jacobian.
MapParallelepiped3d(Real3d vtx0, Real3d vtx1, Real3d vtx2, Real3d vtx3)
MapParallelepiped3d(const MapParallelepiped3d &map)
Copy constructor.
Real3d operator()(Real x, Real y, Real z) const
MapTetrahedron3d(char *map, Real scX, Real scY, Real scZ)
MapTetrahedron3d(Real3d vtx0, Real3d vtx1, Real3d vtx2, Real3d vtx3)
MapTetrahedron3d(const MapTetrahedron3d &map)
Copy constructor.
Real jacobian() const
Returns the jacobian.
Real3d operator()(Real x, Real y, Real z) const
MapTetrahedron3d * clone() const
Returns a copy of the map.
virtual MappingQuad3d * face(const uint face) const =0
virtual MappingHexahedron3d * clone() const =0
Returns a copy of the map.
virtual MapReal3d jacobianInverse(const Real x, const Real y, const Real z) const
virtual MapReal3d hessian(uint i, const Real x, const Real y, const Real z) const =0
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
virtual MapReal3d jacobian(const Real x, const Real y, const Real z) const =0
virtual Real jacobianDeterminant(const Real x, const Real y, const Real z) const
Returns the determinant of the Jacobian.
virtual Real3d operator()(Real x, Real y, Real z) const =0
virtual MappingHexahedron3d * part(const Real3d xi0, const Real3d xi1) const =0
Mapping< F, DimX, DimY > inverse() const
Returns the inverse of the matrix.
F determinant() const
Returns the determinant of the matrix (only valid for square matrices)
PartMappingHexahedron3d(const MappingHexahedron3d &map, const Real3d x0, const Real3d x1)
Real3d operator()(Real x, Real y, Real z) const override
MapReal3d hessian(uint i, const Real x, const Real y, const Real z) const override
std::ostream & info(std::ostream &os) const override
Returns information in an output stream.
PartMappingHexahedron3d * clone() const override
Returns a copy of the map.
PartMappingHexahedron3d * part(const Real3d x0, const Real3d x1) const override
MappingQuad3d * face(const uint face) const override
MapReal3d jacobian(const Real x, const Real y, const Real z) const override
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
Definition debug.hh:40
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