Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

graphics/meshDX.hh
Go to the documentation of this file.
00001 /* graphics of the mesh in OpenDX
00002  */
00003 
00004 #ifndef graphMeshDX_hh
00005 #define graphMeshDX_hh
00006 
00007 #include <iostream>
00008 #include <string>
00009 #include <list>
00010 #include "space/postProcess.hh"
00011 #include "basics/typedefs.hh"
00012 #include "basics/exceptions.hh"
00013 #include "spaceTraits.hh"
00014 #include "geometry/topology.hh"
00015 
00016 namespace hp2D {
00017   // forward declaration
00018   class Space;
00019 }
00020 
00021 namespace hp3D {
00022   // forward declaration
00023   class Space;
00024 }
00025 
00026 namespace graphics {
00027 
00028   using concepts::Real;
00029 
00030   // forward declartions
00031   class VertexList;
00032 
00033   // ********************************************************** Space traits **
00034 
00040   template<typename T, typename traits = spaceTraits<T> >
00041   struct spcDim {
00042     static inline uint dim() { return traits::dim(); }
00043   };
00044 
00057   template<typename T>
00058   uint spaceDimension(const T& spc) {
00059     return spcDim<T>::dim();
00060   }
00061 
00062   // **************************************************************** MeshDX **
00063 
00086   template<class F>
00087   class MeshDX {
00088   public:
00094     MeshDX(concepts::Mesh& msh, std::string filename)
00095       throw(concepts::Assertion);
00096 
00106     MeshDX(concepts::Space<F>& spc, std::string filename, uint dim)
00107       throw(concepts::Assertion);
00108   private:
00110     concepts::Space<F>* spc_;
00111 
00113     concepts::Mesh* msh_;
00114 
00116     std::string filename_;
00117 
00119     void constructor_(concepts::GlobalPostprocess<F>& postProcess,
00120           std::string& filename, uint nelm, uint dim);
00121   };
00122 
00131   MeshDX<Real> drawMeshDX(concepts::Mesh& msh, std::string filename);
00132 
00144   template<typename T>
00145   MeshDX<Real> drawMeshDX(T& spc, std::string filename) {
00146     return MeshDX<Real>(spc, filename, spaceDimension(spc));
00147   }
00148 
00149   // ************************************************************ MeshDXCell **
00150 
00162   template<class F>
00163   class MeshDXCell : public concepts::CellPostprocess<F> {
00164   public:
00179     MeshDXCell(std::ostream& os, VertexList& vtxList, uint nelms, uint nfaces,
00180          uint dim = 2);
00181 
00182     virtual ~MeshDXCell();
00183 
00184     virtual void operator() (const concepts::Element<F>& elm)
00185       throw(concepts::MissingFeature);
00186     virtual void operator() (const concepts::Cell& cell)
00187       throw(concepts::MissingFeature, concepts::Assertion);
00188   private:
00190     std::ostream& os_;
00191 
00193     VertexList& vtxList_;
00194 
00196     uint dim_;
00197   };
00198 
00199   // ******************************************************** BoundaryDXCell **
00200 
00211   template<typename F>
00212   class BoundaryDXCell : public concepts::CellPostprocess<F> {
00213   public:
00214     BoundaryDXCell(VertexList& vtxList) : vtxList_(vtxList) {}
00215     virtual ~BoundaryDXCell();
00216 
00217     virtual void operator() (const concepts::Element<F>& elm)
00218       throw(concepts::MissingFeature);
00219     virtual void operator() (const concepts::Cell& cell)
00220       throw(concepts::MissingFeature, concepts::Assertion);
00221 
00223     const std::list<const concepts::Connector*>& faces() const
00224     { return faces_; }
00225   private:
00227     VertexList& vtxList_;
00228 
00230     std::list<const concepts::Connector*> faces_;
00231   };
00232 
00233 } // namespace graphics
00234 
00235 #endif // graphMeshDX_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)