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

hp3D/singularSet.hh
Go to the documentation of this file.
00001 /* singular Edges and classes for distances
00002 */
00003 
00004 #ifndef singularSet_hh
00005 #define singularSet_hh
00006 
00007 #include "basics/vectorsMatrices.hh"
00008 #include "toolbox/scannerConnectors.hh"
00009 #include "geometry/topology.hh"
00010 #include "geometry/mesh.hh"
00011 
00012 namespace hp3D {
00013 // forward declarations
00014   class Hexahedron;
00015   class TrivialWeight;
00016 
00017   using concepts::Real;
00018 
00019   // ********************************************************** SingularEdge **
00020 
00028   class SingularEdge {
00029     friend std::ostream& operator<<(std::ostream& os, const SingularEdge& s);
00030   public:
00038     SingularEdge(const concepts::Connector1* edge, const concepts::Real3d vtx0,
00039      const concepts::Real3d vtx1) :
00040       edge_(edge), vtx0_(vtx0), vtx1_(vtx1) {
00041       diffVector_ = diffVectorNormed_ = (vtx1_-vtx0_);
00042       diffVectorNormed_ *= 1.0 / diffVectorNormed_.l2_2();
00043       diffVectorTimesVtx0Normed_ = diffVectorNormed_ * vtx0_;
00044     }
00046     const concepts::Connector1* edge() const { return edge_; }
00073     Real distance(const concepts::Real3d point, const Hexahedron* elm) const;
00075     Real distanceV0(const concepts::Real3d point, const Hexahedron* elm) const;
00077     Real distanceV1(const concepts::Real3d point, const Hexahedron* elm) const;
00078   private:
00080     const concepts::Connector1* edge_;
00082     const concepts::Real3d vtx0_, vtx1_;
00084     concepts::Real3d diffVector_;
00086     concepts::Real3d diffVectorNormed_;
00090     concepts::Real diffVectorTimesVtx0Normed_;
00091   };
00092 
00093   // ******************************************************** SingularVertex **
00094 
00102   class SingularVertex {
00103     friend std::ostream& operator<<(std::ostream& os, const SingularVertex& s);
00104   public:
00109     SingularVertex(const concepts::Connector0* vertex,
00110        const concepts::Real3d vtx0) :
00111       vertex_(vertex), vtx0_(vtx0) {}
00113     const concepts::Connector0* vertex() const { return vertex_; }
00116     Real distance(concepts::Real3d point) const;
00120     Real distance(concepts::Real3d point, const Hexahedron* elm) const;
00121   private:
00123     const concepts::Connector0* vertex_;
00125     const concepts::Real3d vtx0_;
00126   };
00127 
00128   // *********************************************************** SingularSet **
00129 
00134   class SingularSet {
00135     friend std::ostream& operator<<(std::ostream& os, const SingularSet& s);
00136   public:
00137     SingularSet() : vertices_(0), edges_(0) {}
00138     ~SingularSet();
00142     void add(const concepts::Attribute& attrib, concepts::Mesh3& msh);
00144     concepts::Scan<SingularVertex>* verticesScan() const {
00145       return new concepts::PListScan<SingularVertex>(*vertices_);
00146     }
00148     concepts::Scan<SingularEdge>* edgesScan() const {
00149       return new concepts::PListScan<SingularEdge>(*edges_);
00150     }
00151   private:
00153     concepts::Joiner<SingularVertex*, 1>* vertices_;
00155     concepts::Joiner<SingularEdge*, 1>* edges_;
00156   };
00157 
00158 } // namespace hp3D
00159 
00160 #endif // singularSet_hh

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