• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

/home/hauberg/Dokumenter/Capture/humim-tracker-0.1/src/OpenTissue/OpenTissue/core/containers/mesh/polymesh/circulators/polymesh_vertex_face_circulator.h

Go to the documentation of this file.
00001 #ifndef OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_CIRCULATORS_POLYMESH_VERTEX_FACE_CIRCULATOR_H
00002 #define OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_CIRCULATORS_POLYMESH_VERTEX_FACE_CIRCULATOR_H
00003 //
00004 // OpenTissue Template Library
00005 // - A generic toolbox for physics-based modeling and simulation.
00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
00007 //
00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
00009 //
00010 #include <OpenTissue/configuration.h>
00011 
00012 #include <OpenTissue/core/containers/mesh/polymesh/circulators/polymesh_vertex_halfedge_circulator.h>
00013 
00014 namespace OpenTissue
00015 {
00016   namespace polymesh
00017   {
00018 
00019 
00034     template<
00035       typename PolyMesh,
00036     class Value
00037     >
00038     class PolyMeshVertexFaceCirculator
00039     {
00040     protected:
00041 
00042       typename PolyMesh::vertex_halfedge_circulator m_circ;
00043 
00044     protected:
00045 
00046       bool is_end() const
00047       {
00048         // this works due to m_circ's operator== ignores the rhs argument!
00049         return m_circ == m_circ;/*.operator==(typename PolyMesh::vertex_halfedge_circulator() )*/;
00050       }
00051 
00052     public:
00053 
00054       PolyMeshVertexFaceCirculator()
00055         : m_circ()
00056       {}
00057 
00058       explicit PolyMeshVertexFaceCirculator(  typename PolyMesh::vertex_type const & v)
00059         : m_circ(v)
00060       {
00061         while(m_circ->get_face_handle().is_null() && 
00062               !is_end() )
00063         {
00064           ++m_circ;
00065         }
00066       }
00067 
00068       template <class OtherValue>
00069       PolyMeshVertexFaceCirculator(
00070         PolyMeshVertexFaceCirculator<PolyMesh,OtherValue> const& other
00071         )
00072         : m_circ( other.m_circ )
00073       {}
00074 
00075     public:
00076 
00077       template <class OtherValue>
00078       bool operator==(PolyMeshVertexFaceCirculator<PolyMesh,OtherValue> const& other) const
00079       {
00080         return (m_circ == other.m_circ);
00081       }
00082 
00083       template <class OtherValue>
00084       bool operator!=(PolyMeshVertexFaceCirculator<PolyMesh,OtherValue> const& other) const
00085       {
00086         return (m_circ != other.m_circ);
00087       }
00088 
00089       PolyMeshVertexFaceCirculator & operator++()
00090       {
00091         //do {
00092         //  ++m_circ;
00093         //}
00094         //while(m_circ->get_face_handle().is_null()
00095         //      && !is_end()
00096         //      );
00097         ++m_circ;
00098         return *this;
00099       }
00100 
00101       PolyMeshVertexFaceCirculator & operator--()
00102       {
00103         --m_circ;
00104 
00105         return *this;
00106       }
00107 
00108     public:
00109 
00110       Value & operator*() const
00111       {
00112         assert(!m_circ->get_face_handle().is_null() || !"face was null");
00113         return *(m_circ->get_face_iterator());
00114       }
00115 
00116       Value * operator->() const
00117       {
00118         assert(!m_circ->get_face_handle().is_null() || !"face was null");
00119         return &(*(m_circ->get_face_iterator()));
00120       }
00121 
00122     };
00123 
00124   } // namespace polymesh
00125 } // namespace OpenTissue
00126 
00127 //OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_CIRCULATORS_POLYMESH_VERTEX_FACE_CIRCULATOR_H
00128 #endif

Generated on Thu Dec 1 2011 12:51:16 for HUMIM Tracker by  doxygen 1.7.1