00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OCTREE_MESH_HPP
00021 #define OCTREE_MESH_HPP
00022
00023 #include <Mesh.hpp>
00024
00025 #include <CartesianHexahedron.hpp>
00026 #include <SurfaceMeshOfQuadrangles.hpp>
00027
00028 #include <VerticesSet.hpp>
00029 #include <VerticesCorrespondance.hpp>
00030
00031 #include <Connectivity.hpp>
00032
00041 class OctreeMesh
00042 : public Mesh
00043 {
00044 public:
00045 typedef CartesianHexahedron CellType;
00046 typedef Quadrangle FaceType;
00047
00048 enum {
00049 family = Mesh::volume
00050 };
00051
00052 typedef SurfaceMeshOfQuadrangles BorderMeshType;
00053
00054 private:
00055 ReferenceCounting<Vector<CartesianHexahedron> >
00056 __cells;
00058 Connectivity<OctreeMesh> __connectivity;
00064 OctreeMesh(const OctreeMesh&);
00065
00066 public:
00067 typedef Mesh::T_iterator<OctreeMesh, CartesianHexahedron> iterator;
00068 typedef Mesh::T_iterator<const OctreeMesh, const CartesianHexahedron> const_iterator;
00069
00075 bool isPeriodic() const
00076 {
00077 return false;
00078 }
00079
00085 bool hasBorderMesh() const
00086 {
00087 return false;
00088 }
00089
00090 ConstReferenceCounting<Mesh> borderBaseMesh() const
00091 {
00092 throw ErrorHandler(__FILE__,__LINE__,
00093 "not implemented yet",
00094 ErrorHandler::unexpected);
00095
00096 return 0;
00097 }
00098
00104 ConstReferenceCounting<BorderMeshType> borderMesh() const
00105 {
00106 throw ErrorHandler(__FILE__,__LINE__,
00107 "not implemented",
00108 ErrorHandler::unexpected);
00109 return 0;
00110 }
00111
00119 CartesianHexahedron& cell(const size_t& i)
00120 {
00121 return (*__cells)[i];
00122 }
00123
00131 const CartesianHexahedron& cell(const size_t& i) const
00132 {
00133 return (*__cells)[i];
00134 }
00135
00141 std::string typeName() const
00142 {
00143 return "non conforming octree-mesh";
00144 }
00145
00155 bool inside(const real_t& x, const real_t& y, const real_t& z) const
00156 {
00157 throw ErrorHandler(__FILE__,__LINE__,
00158 "cannot check if a vertex is inside an octree mesh",
00159 ErrorHandler::unexpected);
00160 return false;
00161 }
00162
00170 bool inside(const TinyVector<3u, real_t>& p) const
00171 {
00172 return this->inside(p[0],p[1],p[2]);
00173 }
00174
00179 void buildFaces()
00180 {
00181 throw ErrorHandler(__FILE__,__LINE__,
00182 "not implemented",
00183 ErrorHandler::unexpected);
00184 }
00185
00190 void buildEdges()
00191 {
00192 throw ErrorHandler(__FILE__,__LINE__,
00193 "not implemented",
00194 ErrorHandler::unexpected);
00195 }
00196
00202 bool hasFaces() const
00203 {
00204 return false;
00205 }
00206
00212 const size_t& numberOfCells() const;
00213
00214 size_t cellNumber(const CartesianHexahedron& h) const
00215 {
00216 return __cells->number(h);
00217 }
00218
00219 const FaceType& face(const size_t& i) const
00220 {
00221 static FaceType badFace;
00222 return badFace;
00223 }
00224
00225 size_t faceNumber(const FaceType& f) const
00226 {
00227 return std::numeric_limits<size_t>::max();
00228 }
00229
00231 const size_t& numberOfFaces() const
00232 {
00233 static size_t badValue;
00234 return badValue;
00235 }
00236
00242 const Connectivity<OctreeMesh>& connectivity() const
00243 {
00244 return __connectivity;
00245 }
00246
00252 Connectivity<OctreeMesh>& connectivity()
00253 {
00254 return __connectivity;
00255 }
00256
00264 OctreeMesh(ReferenceCounting<VerticesSet> vertices,
00265 ReferenceCounting<VerticesCorrespondance> correspondance,
00266 ReferenceCounting<Vector<CartesianHexahedron> > hexahedra)
00267 : Mesh(Mesh::octreeMesh,
00268 Mesh::volume,
00269 vertices,
00270 correspondance),
00271 __cells(hexahedra),
00272 __connectivity(*this)
00273 {
00274 ;
00275 }
00276
00281 ~OctreeMesh()
00282 {
00283 ;
00284 }
00285 };
00286
00287 #endif // OCTREE_MESH_HPP