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

geometry/cell.hh
Go to the documentation of this file.
00001 /* Cells.
00002  * Geometrical information (coordinates), brings element maps and
00003  * topology together
00004  */
00005 
00006 #ifndef cell_hh
00007 #define cell_hh
00008 
00009 #include <iostream>
00010 
00011 #include "basics/outputOperator.hh"
00012 #include "basics/typedefs.hh"
00013 #include "basics/exceptions.hh"
00014 #include "basics/vectorsMatricesForward.hh"
00015 #include "basics/vectorsMatrices.hh"
00016 #include "connector.hh"
00017 
00018 namespace concepts {
00019 
00020   // ****************************************************************** Cell **
00021 
00037   class Cell : public OutputOperator {
00038   public:
00042     virtual Cell* child(uint i) = 0;
00046     virtual const Cell* child(uint i) const = 0;
00048     inline bool hasChildren() const { return child(0) != 0; }
00050     virtual Connector& connector() const = 0;
00051 
00053     virtual Real3d elemMap(const Real coord_local) const;
00054 
00056     virtual Real3d elemMap(const Real2d& coord_local) const;
00057 
00059     virtual Real3d elemMap(const Real3d& coord_local) const;
00060 
00061   protected:
00062     virtual std::ostream& info(std::ostream& os) const = 0;
00063   };
00064 
00066   bool operator<(const Cell& cell_x, const Cell& cell_y);
00067 
00068   // ***************************************************************** Cell1 **
00069 
00071   class Cell1 : public Cell {
00072   public:
00073     virtual Cell1* child(uint i) = 0;
00074     virtual const Cell1* child(uint i) const = 0;
00075     virtual Connector1& connector() const = 0;
00077     virtual Real3d vertex(uint i) const = 0;
00079     virtual Real3d center() const = 0;
00080   };
00081 
00082   // ***************************************************************** Cell2 **
00083 
00085   class Cell2 : public Cell {
00086   public:
00087     virtual Cell2* child(uint i) = 0;
00088     virtual const Cell2* child(uint i) const = 0;
00089     virtual Connector2& connector() const = 0;
00091     virtual Real3d vertex(uint i) const = 0;
00093     virtual Real3d center() const = 0;
00094 
00095     virtual Real3d elemMap(const Real2d& coord_local) const = 0;
00100     virtual Real3d elemMap(const Real3d& coord_local) const {
00101       return elemMap(Real2d(coord_local[0], coord_local[1]));
00102     }
00103   };
00104 
00105   // ***************************************************************** Cell3 **
00106 
00108   class Cell3 : public Cell {
00109   public:
00110     virtual Cell3* child(uint i) = 0;
00111     virtual const Cell3* child(uint i) const = 0;
00112     virtual Connector3& connector() const = 0;
00114     virtual Real3d vertex(uint i) const = 0;
00116     virtual Real3d center() const = 0;
00117   };
00118 
00119 } // namespace concepts
00120 
00121 namespace std {
00122 
00123   // ****************************************************** std::less<Cell*> **
00124 
00133   template<>
00134   struct less<concepts::Cell*> :
00135     public std::binary_function<concepts::Cell*, concepts::Cell*, bool> {
00136     bool operator()(concepts::Cell* const& __x,
00137         concepts::Cell* const& __y) const;
00138   };
00139 
00140   template<>
00141   struct less<concepts::Cell1*> : less<concepts::Cell*>{};
00142   template<>
00143   struct less<concepts::Cell2*> : less<concepts::Cell*>{};
00144   template<>
00145   struct less<concepts::Cell3*> : less<concepts::Cell*>{};
00146 
00147 } // namespace std
00148 
00149 #endif // cell_hh

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