21 #ifndef __MESH_DISTRIBUTED_TOOLS_H 22 #define __MESH_DISTRIBUTED_TOOLS_H 29 #include <unordered_map> 31 #include <dolfin/common/MPI.h> 52 const std::map<
unsigned int, std::pair<unsigned int, unsigned int>>& slave_entities,
53 std::vector<std::int64_t>& global_entity_indices,
54 std::map<std::int32_t, std::set<unsigned int>>& shared_entities,
67 std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t> > >
70 std::size_t dim,
const Mesh& mesh);
75 static std::unordered_map<
unsigned int,
76 std::vector<std::pair<unsigned int, unsigned int> > >
82 static std::vector<double>
88 std::vector<double>& data,
89 const std::size_t width);
94 std::vector<double>& values,
95 const std::size_t width,
96 const std::vector<std::int64_t>& global_indices);
102 typedef std::vector<std::size_t> Entity;
108 EntityData() : local_index(0) {}
111 explicit EntityData(
unsigned int index) : local_index(index) {}
114 EntityData(
unsigned int index,
const std::vector<unsigned int>& procs)
115 : local_index(index), processes(procs) {}
118 EntityData(
unsigned int index,
unsigned int process)
119 : local_index(index), processes(1, process) {}
122 unsigned int local_index;
125 std::vector<unsigned int> processes;
134 static void compute_entity_ownership(
135 const MPI_Comm mpi_comm,
136 const std::map<std::vector<std::size_t>,
unsigned int>& entities,
137 const std::map<std::int32_t, std::set<unsigned int> >& shared_vertices_local,
138 const std::vector<std::int64_t>& global_vertex_indices,
140 std::vector<std::size_t>& owned_entities,
141 std::array<std::map<Entity, EntityData>, 2>& shared_entities);
145 static void compute_preliminary_entity_ownership(
146 const MPI_Comm mpi_comm,
147 const std::map<std::size_t, std::set<unsigned int> >& shared_vertices,
148 const std::map<Entity, unsigned int>& entities,
149 std::vector<std::size_t>& owned_entities,
150 std::array<std::map<Entity, EntityData>, 2>& entity_ownership);
154 compute_final_entity_ownership(
const MPI_Comm mpi_comm,
155 std::vector<std::size_t>& owned_entities,
156 std::array<std::map<Entity,
157 EntityData>, 2>& entity_ownership);
160 static bool is_shared(
const std::vector<std::size_t>& entity_vertices,
161 const std::map<std::size_t, std::set<unsigned int> >& shared_vertices);
164 static std::pair<std::size_t, std::size_t>
165 compute_num_global_entities(
const MPI_Comm mpi_comm,
166 std::size_t num_local_entities,
167 std::size_t num_processes,
168 std::size_t process_number);