Class documentation of Concepts

Loading...
Searching...
No Matches
mappingQuad3D.hh
Go to the documentation of this file.
1#ifndef MAPPINGQUAD3D_HH
2#define MAPPINGQUAD3D_HH
3
8#if __cplusplus >= 201103L
9
11#include "basics/typedefs.hh"
13#include "basics/debug.hh"
16#include "geometry/topology.hh"
17
18#include "coordinateChange.hh"
19#include "mappingEdge3D.hh"
20
21#include <array>
22#include <type_traits>
23
24namespace concepts {
25
26 // ********************************************************* MappingQuad3d **
27
28 //forward declaration
29 class MappingEdge3d;
30
35 class MappingQuad3d : public Map2d {
36 public:
39 virtual ~MappingQuad3d() {}
44 // FIXME: Coordinate parameters should be constant
45 virtual Real3d operator()(Real x, Real y) const = 0;
46
68 virtual Real faceElement(const Real x, const Real y) const;
69
72 virtual Real3d jacobianColumn(uint i, const Real x, const Real y) const = 0;
73
78 virtual Real3d hessianColumn(uint i, uint j, const Real x, const Real y) const = 0;
79
83 virtual Real3d normal(const Real &x, const Real &y) const;
84
86 virtual MappingEdge3d* edge(uint edge) const = 0;
87
93 virtual MappingQuad3d* part(const Real2d &x0, const Real2d &y0) const;
94
99 virtual MappingQuad3d* invertOrientation(const uint dir, const uint shift) const = 0;
100
103 virtual MappingQuad3d* clone() const = 0;
104 protected:
105 virtual std::ostream& info(std::ostream& os) const;
106 };
107
108 // ********************************************************* PartMappingQuad3d **
109
114 class PartMappingQuad3d : public MappingQuad3d {
115 public:
123 const Real2d &xi0, const Real2d &xi1);
124
127
129 PartMappingQuad3d* clone() const;
130
134 virtual Real3d operator()(Real xi, Real eta) const;
135
136 virtual Real3d jacobianColumn(uint i, const Real xi, const Real eta) const;
137
138 virtual Real3d hessianColumn(uint i, uint j, const Real x, const Real y) const;
140 virtual MappingEdge3d* edge(uint edge) const;
141
146 virtual MappingQuad3d* invertOrientation(const uint dir, const uint shift) const;
147
148 protected:
149 virtual std::ostream& info(std::ostream& os) const;
150
151 private:
153 std::unique_ptr<const MappingQuad3d> map_;
154
158 const Real2d x0_;
159
163 const Real2d d_;
164
165 inline const Real2d xi_(const Real xi, const Real eta) const
166 {
167 return x0_ + Real2d(xi * d_[0], eta * d_[1]);
168 }
169 };
170
171 // ********************************************************** BilinearQuad3d **
172
177 class BilinearQuad3d : public MappingQuad3d {
178 public:
181 BilinearQuad3d(Real3d vtx0, Real3d vtx1, Real3d vtx2, Real3d vtx3);
185 virtual ~BilinearQuad3d();
186 virtual Real3d operator()(Real x, Real y) const;
187
193 virtual Real3d jacobianColumn(uint i, const Real x, const Real y) const;
194 virtual Real3d hessianColumn(uint i, uint j, const Real x, const Real y) const;
195
197 virtual MappingEdge3d* edge(uint edge) const;
198
199 virtual BilinearQuad3d* part(const Real2d &x0, const Real2d &y0) const;
200
201 virtual BilinearQuad3d* invertOrientation(const uint dir, const uint shift) const;
202
203 virtual BilinearQuad3d* clone() const;
204
205 virtual bool straight() const { return true; }
206 protected:
207 virtual std::ostream& info(std::ostream& os) const;
208 private:
210 Real3d vtx_[4];
211
212 bool inputCheck(const Real3d &vtx0, const Real3d &vtx1,
213 const Real3d &vtx2, const Real3d &vtx3) const;
214 };
215
216
217 // ********************************************************** BallQuad3d **
218
239 class BallQuad3d : public MappingQuad3d {
240 public:
241
248 BallQuad3d(const Real3d& vtx0,const Real3d& vtx1,
249 const Real3d& vtx2,const Real3d& vtx3,
250 const Real radius,const Real3d& center);
252 const Quad& quad);
253 BallQuad3d(const CircleMappingEdge3d* edge0, const CircleMappingEdge3d* edge1,
254 const CircleMappingEdge3d* edge2, const CircleMappingEdge3d* edge3,
255 const Quad& quad);
257 const Real radius, const Real3d& center,
258 const Quad& quad);
259 BallQuad3d(const MappingEdge3d* edge0, const MappingEdge3d* edge1,
260 const MappingEdge3d* edge2, const MappingEdge3d* edge3,
261 const Real radius, const Real3d& center,
262 const Quad& quad);
264
265 ~BallQuad3d() override;
266 Real3d operator()(Real x, Real y) const override;
267 Real3d jacobianColumn(uint i, const Real x, const Real y) const override;
268 Real3d hessianColumn(uint i, uint j, const Real x, const Real y) const override;
269
277 bool inverseMapping(const Real3d& physicalPoint, Real2d& coord) const;
278
279 BallQuad3d* part(const Real2d& x0, const Real2d& y0) const override;
280
281 MappingEdge3d* edge(const uint edge) const override;
282
283 BallQuad3d* clone() const override;
284
306 BallQuad3d* invertOrientation(const uint dir, const uint shift) const override;
307
308 Real getRadius() const { return radius_; }
309 Real3d getCenter() const { return center_; }
310 protected:
311 std::ostream& info(std::ostream& os) const override;
312 private:
314 std::array<Real3d,4> vtx_;
315
317 Real radius_;
318
320 Real3d center_;
321
322/* /// Map of the edges
323 std::array<std::unique_ptr<MappingEdge3d>,4> edgemap_;*/
324
328 void construct_(const std::array< const MappingEdge3d*,4 >& edgemap, const Quad& quad);
329
333 bool isRegular() const;
334 };
335
336
337
338// ********************************************************* BlendingQuad3d **
339
362 template<uint Dim>
363 using MappingQuad = typename std::enable_if< (2u <= Dim && Dim <= 3u),
364 typename std::tuple_element<Dim-2u,
365 std::tuple<MappingQuad2d,MappingQuad3d>>::type>::type;
366
367 template<uint Dim>
368 using MappingEdge = typename std::enable_if< (1u <= Dim && Dim <= 3u),
369 typename std::tuple_element<Dim-1u,
370 std::tuple<MapEdge1d,MappingEdge2d,MappingEdge3d>>::type>::type;
371
372 template<uint Dim>
373 class BlendingQuad : public MappingQuad<Dim> {
374 public:
375
404 BlendingQuad(const Sequence< const MappingEdge<Dim>* > edgemap,
405 const Quad& quad);
408 const Quad& quad);
410 ~BlendingQuad() override;
411 Point<Real,Dim> operator()(Real x, Real y) const override;
412 Point<Real,Dim> jacobianColumn(uint i, const Real x, const Real y) const override;
413 Point<Real,Dim> hessianColumn(uint i, uint j, const Real x, const Real y) const override;
414 MappingEdge<Dim>* edge(const uint edge) const override;
416 BlendingQuad* invertOrientation(const uint dir, const uint shift) const override;
417 BlendingQuad* clone() const override { return new BlendingQuad(*this); }
418 protected:
419 std::ostream& info(std::ostream& os) const override;
420 private:
422 std::array<std::unique_ptr<MappingEdge<Dim>>,4> edgemap_;
423 /*/// Vector that contains the vertices.
424 Point<Real,Dim> vtx_[4];*/
425
427 void construct_(const std::array< const MappingEdge<Dim>*,4 >& edgemap, const Quad& quad);
428 };
429
431
432 // ***************************************************** MappingHexahedronQuad3d **
433
434 // forward declaration
435 class MappingHexahedron3d;
436
448 public:
453 MappingHexahedronQuad3d(const MappingHexahedron3d& map, const uint face);
462 MappingHexahedronQuad3d(const MappingHexahedron3d& map,
463 const Real3d xi,
464 const Real3d diff0, const Real3d diff1);
468 MappingHexahedronQuad3d* clone() const override;
469 ~MappingHexahedronQuad3d() override {};
470 Real3d operator()(Real x, Real y) const override;
471 Real3d jacobianColumn(uint i, const Real x, const Real y) const override;
472 Real3d hessianColumn(uint i, uint j, const Real x, const Real y) const override;
473 MappingEdge3d* edge(const uint edge) const override;
474 MappingHexahedronQuad3d* invertOrientation(const uint dir, const uint shift) const override;
475 protected:
476 std::ostream& info(std::ostream& os) const override;
477 private:
479 std::unique_ptr<MappingHexahedron3d> map_;
481 Real3d xi_;
484 std::array<Real3d,2> diff_;
485
487 inline const Real3d lcoord_(const Real x, const Real y) const {
488 return xi_ + diff_[0]*x + diff_[1]*y;
489 }
491 inline const Real3d lderiv_(uint i, const Real x, const Real y) const {
492 return i == 0 ? diff_[0] : diff_[1];
493 }
494 };
495
496} // namespace concepts
497
498#endif // __cplusplus >= 201103L
499
500#endif // mappingQuad3d_HH
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320