00001
00002
00003
00004
00005 #ifndef elementMaps3D_hh
00006 #define elementMaps3D_hh
00007
00008 #include "basics/outputOperator.hh"
00009 #include "basics/typedefs.hh"
00010 #include "basics/vectorsMatrices.hh"
00011 #include "basics/debug.hh"
00012
00013
00014 #define geoMapTetrahedron3dAppl_D 0
00015
00016 namespace concepts {
00017
00018
00019
00023 class Map3d : public OutputOperator {
00024 public:
00025 std::ostream& info(std::ostream& os) const {return os << "Map3d()";};
00026 };
00027
00028
00029
00030
00063 class MapTetrahedron3d : public Map3d {
00064 public:
00076 MapTetrahedron3d(char* map, Real scX, Real scY, Real scZ);
00077
00084 MapTetrahedron3d(Real3d vtx0, Real3d vtx1, Real3d vtx2, Real3d vtx3);
00085
00087 MapTetrahedron3d(const MapTetrahedron3d &map);
00088 ~MapTetrahedron3d() { delete[] map_; }
00089
00106 Real3d operator()(Real x, Real y, Real z) const {
00107 if (map_)
00108 return Real3d(map_, scx_ * x, scy_ * y, scz_ * z);
00109 else {
00110 Real3d xi(x*(1.0-y)*(1.0-z), y*(1.0-z), z);
00111 Real3d res(B_ * xi);
00112 res += b_;
00113 DEBUGL(geoMapTetrahedron3dAppl_D, '(' << x << ", " << y
00114 << ", " << z << ") -> " << xi << " -> " << res);
00115 return res;
00116 }
00117 }
00118
00120 Real jacobian() const {
00121 if (map_)
00122 throw conceptsException(MissingFeature("jacobian not supported"));
00123 return B_.determinant(); }
00124
00126 inline MapTetrahedron3d* clone() const {
00127 return new MapTetrahedron3d(*this);
00128 };
00129
00130 private:
00132 uchar* map_;
00133
00135 uint sz_;
00136
00138 Real scx_;
00139
00141 Real scy_;
00142
00144 Real scz_;
00145
00147 MapReal3d B_;
00148
00150 Real3d b_;
00151
00153 void operator=(const MapTetrahedron3d &);
00154 };
00155
00156
00157
00158
00176 class MapHexahedron3d : public Map3d {
00177
00179 uchar* map_;
00180
00182 uint sz_;
00183
00185 Real scx_;
00186
00188 Real scy_;
00189
00191 Real scz_;
00192
00194 Real3d *comp_;
00195
00197 void operator=(const MapHexahedron3d &);
00198
00199 public:
00211 MapHexahedron3d(char* map, Real scX, Real scY, Real scZ);
00212
00219 MapHexahedron3d(const Real3d& vtx0, const Real3d& vtx1,
00220 const Real3d& vtx2, const Real3d& vtx3,
00221 const Real3d& vtx4, const Real3d& vtx5,
00222 const Real3d& vtx6, const Real3d& vtx7);
00223
00225 MapHexahedron3d(const MapHexahedron3d &map);
00226 ~MapHexahedron3d() { delete[] map_; delete[] comp_; };
00227
00236 inline Real3d operator()(Real x, Real y, Real z) const {
00237 conceptsAssert(x >= 0.0, Assertion());
00238 conceptsAssert(x <= 1.0, Assertion());
00239 conceptsAssert(y >= 0.0, Assertion());
00240 conceptsAssert(y <= 1.0, Assertion());
00241 conceptsAssert(z >= 0.0, Assertion());
00242 conceptsAssert(z <= 1.0, Assertion());
00243 if (map_)
00244 return Real3d(map_, scx_ * x, scy_ * y, scz_* z);
00245 else {
00246 Real3d res(comp_[0]*(x*y*z));
00247 res += comp_[1]*(x*y);
00248 res += comp_[2]*(x*z);
00249 res += comp_[3]*(y*z);
00250 res += comp_[4]*x;
00251 res += comp_[5]*y;
00252 res += comp_[6]*z;
00253 res += comp_[7];
00254 return res;
00255 }
00256 }
00257
00262 MapReal3d jacobian(const Real x, const Real y, const Real z) const;
00263
00268 MapReal3d jacobianInverse(const Real x, const Real y, const Real z) const {
00269 return jacobian(x, y, z).inverse();
00270 }
00271
00273 Real jacobianDeterminant(const Real x, const Real y, const Real z) const {
00274 return jacobian(x, y, z).determinant();
00275 }
00276
00278 MapHexahedron3d* clone() const { return new MapHexahedron3d(*this); }
00279 };
00280
00281
00282
00283
00292 class MapParallelepiped3d : public Map3d {
00293 public:
00300 MapParallelepiped3d(Real3d vtx0, Real3d vtx1, Real3d vtx2, Real3d vtx3);
00301
00303 MapParallelepiped3d(const MapParallelepiped3d &map);
00304
00313 Real3d operator()(Real x, Real y, Real z) const {
00314 Real3d res(B1_*x + B2_*y + B3_*z);
00315 res += b_;
00316 return res;
00317 }
00318
00320 Real jacobian() const {
00321 return (B1_ ^ B2_) * B3_;
00322 }
00323
00325 inline MapParallelepiped3d* clone() const {
00326 return new MapParallelepiped3d(*this);
00327 };
00328
00329 private:
00330 Real3d b_;
00331 Real3d B1_;
00332 Real3d B2_;
00333 Real3d B3_;
00334
00336 void operator=(const MapParallelepiped3d &);
00337 };
00338
00339 }
00340
00341 #endif // elementMaps3D_hh