12#ifndef DISTRIBUTED_MESH_H
13#define DISTRIBUTED_MESH_H
18#include <unordered_map>
19#include <unordered_set>
53 using PeriodicMap = std::unordered_map<uint64_t, std::pair<uint64_t, std::array<int8_t, 3>>>;
69 const std::vector<uint64_t> &
graph_offsets()
const {
return graph_offsets_; }
70 const std::vector<uint64_t> &
graph_neighbors()
const {
return graph_neighbors_; }
82 void distribute(
const std::vector<int> & owner);
96 std::vector<uint64_t> gid;
97 std::vector<int> owner;
98 std::vector<uint8_t> layer;
99 std::vector<uint64_t> node_offsets{0}, nodes;
100 std::vector<uint32_t> boundary_offsets{0};
101 std::vector<std::array<uint32_t, 2>> boundary;
112 void match_periodic(
const std::vector<Mesh::PeriodicPair> & pairs);
115 const std::pair<uint64_t, std::array<int8_t, 3>> * periodic_class(
uint64_t g)
const;
122 void append_record(std::vector<uint64_t> &
out,
uint32_t i)
const;
123 void read_records(
const std::vector<uint64_t> &
in,
uint8_t layer);
124 std::vector<std::array<double, N_DIM>> fetch_nodes(
const std::vector<uint64_t> &
sorted_ids)
const;
128 std::vector<uint64_t> cell_dist, node_dist;
129 std::vector<std::string> zones;
132 std::vector<uint64_t> graph_offsets_, graph_neighbors_;
133 std::vector<uint32_t> boundary_offsets{0};
134 std::vector<std::array<uint32_t, 2>> boundary;
137 std::vector<int> owner;
138 std::vector<uint64_t> directory_offsets{0};
139 std::vector<std::pair<uint64_t, int>> directory;
141 std::unordered_map<uint64_t, uint32_t> halo_index;
142 std::vector<uint64_t> owned_nodes;
143 std::unordered_set<uint64_t> searched_nodes;
144 std::vector<std::pair<uint64_t, int>> next_layer;
The mesh during setup, spread over the ranks. Each rank starts from its block of the mesh (cells,...
Definition distributed_mesh.h:50
std::vector< std::array< double, N_DIM > > block_cell_centers() const
Vertex average of every block cell (collective).
Definition distributed_mesh.cpp:541
std::unordered_map< uint64_t, std::pair< uint64_t, std::array< int8_t, 3 > > > PeriodicMap
Periodic node -> (key, lattice offset), as in PeriodicNodes but by global id.
Definition distributed_mesh.h:53
const PeriodicMap & block_periodic_classes() const
Periodic classes of the periodic nodes of the block's cells and boundary faces, and no others.
Definition distributed_mesh.h:73
const std::vector< uint64_t > & graph_neighbors() const
Definition distributed_mesh.h:70
const std::vector< uint64_t > & cell_distribution() const
First block cell of every rank, and the total (ParMETIS vtxdist).
Definition distributed_mesh.h:66
void distribute(const std::vector< int > &owner)
Send every block cell to its owner rank, and drop the dual graph (collective).
Definition distributed_mesh.cpp:607
std::shared_ptr< Mesh > build_local_mesh(int halo_layers, Distribution &dist)
This rank's mesh: its owned cells in global order, then halo_layers layers of vertex neighbors,...
Definition distributed_mesh.cpp:729
uint32_t n_block_cells() const
Definition distributed_mesh.h:63
const std::vector< uint64_t > & graph_offsets() const
Dual graph of the block cells (cells sharing a face), by global id (CSR); until distribute().
Definition distributed_mesh.h:69
const MeshBlock & mesh_block() const
This rank's block of the mesh.
Definition distributed_mesh.h:76
uint64_t n_global_cells() const
Definition distributed_mesh.h:61
uint64_t first_cell() const
Definition distributed_mesh.h:62
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
A rank's share of a distributed mesh: owned cells, halo layers and the halo exchange plan.
A rank's contiguous block of a mesh, by global id, and the sources that produce one: HDF5 mesh files,...
Identification of the nodes of periodic boundary zones.
Local numbering: owned cells first (in global order), then halo layer 1, 2, ... Every local cell keep...
Definition distribution.h:26
Contiguous ranges of a mesh's cells and nodes and a set of its boundary faces. Global ids are positio...
Definition mesh_block.h:35
uint64_t n_cells() const
Definition mesh_block.h:51
uint64_t first_cell
Definition mesh_block.h:36
Periodic classes of the mesh nodes: the translation of each lattice direction, and per node its key (...
Definition periodic.h:28
TableBatchT< Space > out
Definition teno_setup.cpp:681
Geometry< Space > g
Definition teno_setup.cpp:678