00001 #ifndef OPENTISSUE_CORE_CONTAINERS_MESH_COMMON_UTIL_MESH_COORDINATE_ITERATOR_H 00002 #define OPENTISSUE_CORE_CONTAINERS_MESH_COMMON_UTIL_MESH_COORDINATE_ITERATOR_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 00013 namespace OpenTissue 00014 { 00015 namespace mesh 00016 { 00017 00018 00019 template<typename mesh_type> 00020 class CoordinateIterator 00021 { 00022 public: 00023 00024 typedef typename mesh_type::math_types::vector3_type value_type; 00025 typedef typename mesh_type::vertex_iterator vertex_iterator; 00026 00027 protected: 00028 00029 vertex_iterator m_iterator; 00030 00031 public: 00032 00033 00034 CoordinateIterator() 00035 : m_iterator() 00036 {} 00037 00038 explicit CoordinateIterator(vertex_iterator const & v) 00039 : m_iterator(v) 00040 {} 00041 00042 CoordinateIterator(CoordinateIterator const & c) 00043 : m_iterator(c.m_iterator) 00044 {} 00045 00046 CoordinateIterator &operator=(vertex_iterator const & v) { m_iterator =v; }; 00047 CoordinateIterator &operator=(CoordinateIterator const & c) { m_iterator = c.m_iterator; }; 00048 00049 public: 00050 00051 bool operator==(CoordinateIterator const& other) const { return (m_iterator == other.m_iterator); } 00052 bool operator!=(CoordinateIterator const& other) const { return (m_iterator != other.m_iterator); } 00053 00054 CoordinateIterator & operator++() 00055 { 00056 ++m_iterator; 00057 return *this; 00058 } 00059 00060 CoordinateIterator & operator--() 00061 { 00062 --m_iterator; 00063 return *this; 00064 } 00065 00066 value_type& operator*() const { return m_iterator->m_coord; } 00067 value_type * operator->() const { return &(m_iterator->m_coord); } 00068 00069 }; 00070 00071 } // namespace mesh 00072 } // namespace OpenTissue 00073 00074 //OPENTISSUE_CORE_CONTAINERS_MESH_COMMON_UTIL_MESH_COORDINATE_ITERATOR_H 00075 #endif