00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ParallelTetMesh_h
00013 #define ParallelTetMesh_h
00014
00015 #include <algorithm>
00016 #include <map>
00017 #include <vector>
00018 #include <utility>
00019 #include "mpi.h"
00020 #include "entity.h"
00021 #include "tetmesh.h"
00022 #include "utility/parallel_tools.h"
00023
00024 namespace mesh {
00025
00026 class ParallelTetMesh : public TetMesh {
00027
00028 public:
00030 ParallelTetMesh(MPI_Comm _comm);
00031
00033 virtual ~ParallelTetMesh();
00034
00036 void initPoint(int nofPoint);
00037
00043 void insertPoint(int id, double x, double y, double z);
00044
00046 void initTet(int nofTet);
00047
00055 void insertTet(id_t global_id, id_t id0, id_t id1, id_t id2, id_t id3, id_t material);
00056
00066 id_t lookupFace(id_t node0, id_t node1, id_t node2);
00067
00071 void fix_edge_orientation();
00072
00076 void finalize_mesh(int nofSym);
00077
00082 id_t point_gid(id_t lid) const;
00083
00088 id_t face_gid(id_t lid) const;
00089
00094 id_t edge_gid(id_t lid) const;
00095
00097 MPI_Comm get_comm();
00098
00102 id_t get_dof_removed_offset(id_t my_offset);
00103
00106 id_t get_dof_removed_offset();
00107
00111 id_t get_num_global_points() const {
00112 return _num_global_points;
00113 }
00114
00118 id_t get_num_global_edges() const {
00119 return _num_global_edges;
00120 }
00121
00125 id_t get_num_global_faces() const {
00126 return _num_global_faces;
00127 }
00128
00131 id_t get_num_global_tets();
00132
00136 bool is_owned_point(id_t gid) const;
00137
00141 bool is_owned_edge(id_t gid) const;
00142
00146 bool is_owned_face(id_t gid) const;
00147
00148 const std::vector<id_t>& get_edge_gids() const {
00149 return _edge_gids;
00150 }
00151
00152 const std::vector<id_t>& get_node_gids() const {
00153 return _point_gids;
00154 }
00155
00156 private:
00157
00159 void synchronize();
00160
00164 void set_face_gids();
00165
00169 void set_edge_gids();
00170
00174 void set_point_ownership();
00175
00178 std::vector<bool> _point_owned_by_me;
00179
00185 utility::triple<id_t, id_t, id_t> get_face_corner_gids(const Face& face) const;
00186
00192 std::pair<id_t, id_t> get_edge_corner_gids(const Edge& edge) const;
00193
00195 MPI_Comm _comm;
00196
00198 int _mpi_size;
00199
00201 int _mpi_rank;
00202
00204 int _tet_counter;
00205
00207 int _point_counter;
00208
00212 int _num_global_points;
00213
00217 id_t _num_global_edges;
00218
00222 id_t _num_global_faces;
00223
00225 std::vector<id_t> _face_gids;
00226
00228 std::vector<id_t> _edge_gids;
00229
00231 std::vector<id_t> _point_gids;
00232
00235 std::map<int,int> _point_local_id;
00236
00239 id_t _my_edges[4];
00240
00243 id_t _my_faces[4];
00244 };
00245
00246 }
00247 #endif