00001 #ifndef DEF_TILE
00002 #define DEF_TILE
00003
00004
00005 #include "Common.hh"
00006
00007 #include "TableauBiDim.hh"
00008
00009 #include <list>
00010 #include <map>
00011
00012 #include "TileFaceIter.hh"
00013 #include "TileVertexIter.hh"
00014
00015 #include "SparseMatrix.hh"
00016
00017
00024 class Tile
00025 {
00026 private:
00027
00031 const unsigned int id;
00032
00036 Seed seed;
00037
00041 BaseMesh::VertexHandle base_mesh_vertex;
00042
00046 bool boundary_neighbours_calculated;
00047
00051 std::map< int, std::list< int >* > boundary_neighbours;
00052
00056 static TableauBiDim<double> tile_boundary_length;
00057
00065 list<Vertex> interior_vertices;
00066
00067
00075 list<Vertex> boundary_vertices;
00076
00077
00085 unsigned int no_vertices_on_mesh_boundary;
00086
00087
00089 vector< unsigned int > neighbour_tiles;
00090
00091
00101 void calculate_boundary_neighbours(OriginalMesh const & m );
00102
00103
00104
00105
00106 public:
00107
00108
00109
00110
00111
00113
00114
00116 std::vector< unsigned int >::const_iterator neighbour_tiles_begin() const ;
00117
00119 std::vector< unsigned int >::const_iterator neighbour_tiles_end() const;
00120
00122 std::list< Vertex >::const_iterator interior_vertices_begin() const;
00124 std::list< Vertex >::const_iterator interior_vertices_end() const;
00126 std::list< Vertex >::const_iterator boundary_vertices_begin() const;
00128 std::list< Vertex >::const_iterator boundary_vertices_end() const;
00129
00130 friend class Tile_Vertex_Iter;
00131
00132 friend class Tile_Face_Iter;
00133
00135 Tile_Vertex_Iter vertices_begin();
00136
00140 Tile_Face_Iter faces_begin(OriginalMesh* mesh);
00141
00142
00147 Tile_Face_Iter faces_begin(OriginalMesh* mesh, OriginalMesh::FaceHandle& fh);
00148
00149
00150
00152
00153
00154
00160 Tile(const Vertex tile_seed, const unsigned int tile_id);
00161
00162
00164 ~Tile() { clear(); }
00165
00166
00167
00168
00170 Seed get_seed() const
00171 { return seed;}
00172
00174 const unsigned int get_id() const
00175 { return id; }
00176
00178 BaseMesh::VertexHandle get_base_mesh_vertex() const
00179 {
00180 return base_mesh_vertex;
00181 }
00182
00184 void set_base_mesh_vertex(BaseMesh::VertexHandle const & bm_vertex)
00185 {
00186 base_mesh_vertex = bm_vertex;
00187 }
00188
00193 void clear();
00194
00195
00203 void add_vertex(Vertex v, bool is_on_tile_boundary, bool is_on_mesh_boundary);
00204
00205
00214 void change_to_boundary(Vertex v);
00215
00216
00223 Vertex reposition_seed(const OriginalMesh& mesh);
00224
00237 void boundary_parametrization(OriginalMesh& om, const OriginalMesh& bm, const vector<Tile*>& tiles, map<int, unsigned int>& matrix_pos, SparseMatrix& matrix, double* b_ret_x, double* b_ret_y, OriginalMesh::Point& ret_map_centroid);
00238
00239
00253 static void calculate_boundary_lengths(OriginalMesh& m, const vector<Tile*>& tiles);
00254
00255
00256
00257
00258
00259
00261
00262
00263
00269 bool check_conditions_EB(Vertex& new_seed, const OriginalMesh& mesh);
00270
00271
00286 bool check_conditions_NZ(Vertex& new_seed, OriginalMesh& mesh);
00287
00300 bool check_conditions_MB(Vertex& new_seed, OriginalMesh& mesh);
00301
00318 bool check_conditions_MN(Vertex& new_seed, OriginalMesh& mesh);
00320
00322 double calculate_error(OriginalMesh& mesh);
00323
00324
00333 void find_neighbours_orders(OriginalMesh& m);
00334
00343 bool connected_neighbours(OriginalMesh& m, unsigned int germe1, unsigned int germe2);
00344
00345 };
00346
00347 #endif