Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_CONTAINERS_T4MESH_T4BOUNDARY_FACES_H
00002 #define OPENTISSUE_CORE_CONTAINERS_T4MESH_T4BOUNDARY_FACES_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <list>
00013 #include <cassert>
00014
00015 namespace OpenTissue
00016 {
00017 namespace t4mesh
00018 {
00019
00023 template<typename M, typename F>
00024 class T4Face : public F
00025 {
00026 public:
00027
00028 typedef M mesh_type;
00029 typedef F face_traits;
00030 typedef T4Face<M,F> face_type;
00031 typedef typename mesh_type::index_type index_type;
00032
00033 protected:
00034
00035 index_type m_idx0;
00036 index_type m_idx1;
00037 index_type m_idx2;
00038
00039 public:
00040
00041 T4Face()
00042 : m_idx0(-1)
00043 , m_idx1(-1)
00044 , m_idx2(-1)
00045 {}
00046
00047 T4Face(index_type const & index0, index_type const & index1, index_type const & index2)
00048 : m_idx0(index0)
00049 , m_idx1(index1)
00050 , m_idx2(index2)
00051 {}
00052
00053 public:
00054
00055 const index_type & idx0() const { return m_idx0; }
00056 const index_type & idx1() const { return m_idx1; }
00057 const index_type & idx2() const { return m_idx2; }
00058
00059 };
00060
00086 template<class M,typename F>
00087 class T4BoundaryFaces
00088 {
00089 public:
00090
00091 typedef M mesh_type;
00092 typedef F face_traits;
00093 typedef T4Face<M,F> face_type;
00094 typedef std::list<face_type> face_container;
00095 typedef typename face_container::iterator face_iterator;
00096 typedef typename face_container::const_iterator const_face_iterator;
00097
00098 protected:
00099
00100 face_container m_faces;
00101
00102 public:
00103
00104 face_iterator begin() { return m_faces.begin(); }
00105 face_iterator end() { return m_faces.end(); }
00106 const_face_iterator begin() const { return m_faces.begin(); }
00107 const_face_iterator end() const { return m_faces.end(); }
00108
00109 public:
00110
00115 T4BoundaryFaces()
00116 : m_faces()
00117 {}
00118
00130 T4BoundaryFaces(mesh_type & mesh)
00131 : m_faces()
00132 {
00133 typename mesh_type::tetrahedron_iterator tetrahedron;
00134 for( tetrahedron = mesh.tetrahedron_begin(); tetrahedron != mesh.tetrahedron_end(); ++tetrahedron)
00135 {
00136 if(tetrahedron->jkm()==mesh.tetrahedron_end())
00137 m_faces.push_back(face_type(tetrahedron->j()->idx(),tetrahedron->k()->idx(),tetrahedron->m()->idx()));
00138 if(tetrahedron->ijm()==mesh.tetrahedron_end())
00139 m_faces.push_back(face_type(tetrahedron->i()->idx(),tetrahedron->j()->idx(),tetrahedron->m()->idx()));
00140 if(tetrahedron->kim()==mesh.tetrahedron_end())
00141 m_faces.push_back(face_type(tetrahedron->k()->idx(),tetrahedron->i()->idx(),tetrahedron->m()->idx()));
00142 if(tetrahedron->ikj()==mesh.tetrahedron_end())
00143 m_faces.push_back(face_type(tetrahedron->i()->idx(),tetrahedron->k()->idx(),tetrahedron->j()->idx()));
00144 }
00145 }
00146
00147 };
00148
00149 }
00150 }
00151
00152
00153 #endif