1 #ifndef MAPPINGQUAD3D_HH
2 #define MAPPINGQUAD3D_HH
8 #if __cplusplus >= 201103L
22 #include <type_traits>
35 class MappingQuad3d :
public Map2d {
39 virtual ~MappingQuad3d() {}
68 virtual Real faceElement(
const Real x,
const Real y)
const;
72 virtual Real3d jacobianColumn(uint i,
const Real x,
const Real y)
const = 0;
78 virtual Real3d hessianColumn(uint i, uint j,
const Real x,
const Real y)
const = 0;
86 virtual MappingEdge3d* edge(uint edge)
const = 0;
93 virtual MappingQuad3d* part(
const Real2d &x0,
const Real2d &y0)
const;
99 virtual MappingQuad3d* invertOrientation(
const uint dir,
const uint shift)
const = 0;
103 virtual MappingQuad3d* clone()
const = 0;
105 virtual std::ostream& info(std::ostream& os)
const;
114 class PartMappingQuad3d :
public MappingQuad3d {
122 PartMappingQuad3d(
const MappingQuad3d &map,
126 PartMappingQuad3d(
const PartMappingQuad3d &partMap);
129 PartMappingQuad3d* clone()
const;
136 virtual Real3d jacobianColumn(uint i,
const Real xi,
const Real eta)
const;
138 virtual Real3d hessianColumn(uint i, uint j,
const Real x,
const Real y)
const;
140 virtual MappingEdge3d* edge(uint edge)
const;
146 virtual MappingQuad3d* invertOrientation(
const uint dir,
const uint shift)
const;
149 virtual std::ostream& info(std::ostream& os)
const;
153 std::unique_ptr<const MappingQuad3d> map_;
167 return x0_ +
Real2d(xi * d_[0], eta * d_[1]);
177 class BilinearQuad3d :
public MappingQuad3d {
184 BilinearQuad3d(
const BilinearQuad3d& v);
185 virtual ~BilinearQuad3d();
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;
197 virtual MappingEdge3d* edge(uint edge)
const;
199 virtual BilinearQuad3d* part(
const Real2d &x0,
const Real2d &y0)
const;
201 virtual BilinearQuad3d* invertOrientation(
const uint dir,
const uint shift)
const;
203 virtual BilinearQuad3d* clone()
const;
205 virtual bool straight()
const {
return true; }
207 virtual std::ostream& info(std::ostream& os)
const;
239 class BallQuad3d :
public MappingQuad3d {
251 BallQuad3d(Sequence< CircleMappingEdge3d* > edgemap,
253 BallQuad3d(
const CircleMappingEdge3d* edge0,
const CircleMappingEdge3d* edge1,
254 const CircleMappingEdge3d* edge2,
const CircleMappingEdge3d* edge3,
256 BallQuad3d(Sequence< const MappingEdge3d* > edgemap,
259 BallQuad3d(
const MappingEdge3d* edge0,
const MappingEdge3d* edge1,
260 const MappingEdge3d* edge2,
const MappingEdge3d* edge3,
263 BallQuad3d(
const BallQuad3d& other);
265 ~BallQuad3d()
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;
277 bool inverseMapping(
const Real3d& physicalPoint,
Real2d& coord)
const;
279 BallQuad3d* part(
const Real2d& x0,
const Real2d& y0)
const override;
281 MappingEdge3d* edge(
const uint edge)
const override;
283 BallQuad3d* clone()
const override;
306 BallQuad3d* invertOrientation(
const uint dir,
const uint shift)
const override;
308 Real getRadius()
const {
return radius_; }
309 Real3d getCenter()
const {
return center_; }
311 std::ostream& info(std::ostream& os)
const override;
314 std::array<Real3d,4> vtx_;
328 void construct_(
const std::array< const MappingEdge3d*,4 >& edgemap,
const Quad& quad);
333 bool isRegular()
const;
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;
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;
373 class BlendingQuad :
public MappingQuad<Dim> {
404 BlendingQuad(
const Sequence<
const MappingEdge<Dim>* > edgemap,
406 BlendingQuad(
const MappingEdge<Dim>& edge0,
const MappingEdge<Dim>& edge1,
407 const MappingEdge<Dim>& edge2,
const MappingEdge<Dim>& edge3,
409 BlendingQuad(
const BlendingQuad& other);
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); }
419 std::ostream& info(std::ostream& os)
const override;
422 std::array<std::unique_ptr<MappingEdge<Dim>>,4> edgemap_;
427 void construct_(
const std::array<
const MappingEdge<Dim>*,4 >& edgemap,
const Quad& quad);
430 using BlendingQuad3d = BlendingQuad<3u>;
435 class MappingHexahedron3d;
447 class MappingHexahedronQuad3d :
public MappingQuad3d {
453 MappingHexahedronQuad3d(
const MappingHexahedron3d& map,
const uint face);
462 MappingHexahedronQuad3d(
const MappingHexahedron3d& map,
466 MappingHexahedronQuad3d(
const MappingHexahedronQuad3d& other);
468 MappingHexahedronQuad3d* clone()
const override;
469 ~MappingHexahedronQuad3d()
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;
476 std::ostream& info(std::ostream& os)
const override;
479 std::unique_ptr<MappingHexahedron3d> map_;
484 std::array<Real3d,2> diff_;
488 return xi_ + diff_[0]*x + diff_[1]*y;
491 inline const Real3d lderiv_(uint i,
const Real x,
const Real y)
const {
492 return i == 0 ? diff_[0] : diff_[1];
498 #endif // __cplusplus >= 201103L
500 #endif // mappingQuad3d_HH