91template <
typename BackendTag = backend::CpuTag>
104 std::vector<size_t> indices;
116 }
else if (direction[0] < 0) {
117 send_lower[0] = local_lower[0];
118 send_upper[0] = local_lower[0] + halo_width;
121 send_lower[0] = local_lower[0];
122 send_upper[0] = local_upper[0];
125 if (direction[1] > 0) {
126 send_lower[1] = local_upper[1] - halo_width;
127 send_upper[1] = local_upper[1];
128 }
else if (direction[1] < 0) {
129 send_lower[1] = local_lower[1];
130 send_upper[1] = local_lower[1] + halo_width;
132 send_lower[1] = local_lower[1];
133 send_upper[1] = local_upper[1];
136 if (direction[2] > 0) {
137 send_lower[2] = local_upper[2] - halo_width;
138 send_upper[2] = local_upper[2];
139 }
else if (direction[2] < 0) {
140 send_lower[2] = local_lower[2];
141 send_upper[2] = local_lower[2] + halo_width;
143 send_lower[2] = local_lower[2];
144 send_upper[2] = local_upper[2];
150 for (
int z = send_lower[2]; z < send_upper[2]; ++z) {
151 for (
int y = send_lower[1]; y < send_upper[1]; ++y) {
152 for (
int x = send_lower[0]; x < send_upper[0]; ++x) {
155 int local_z = z - local_lower[2];
156 int local_y = y - local_lower[1];
157 int local_x = x - local_lower[0];
160 if (local_x >= 0 && local_x < local_size[0] && local_y >= 0 &&
161 local_y < local_size[1] && local_z >= 0 && local_z < local_size[2]) {
164 static_cast<size_t>(local_z) *
static_cast<size_t>(local_size[1]) *
165 static_cast<size_t>(local_size[0]) +
166 static_cast<size_t>(local_y) *
static_cast<size_t>(local_size[0]) +
167 static_cast<size_t>(local_x);
168 indices.push_back(local_idx);
174 return core::SparseVector<BackendTag, size_t>(indices);
195template <
typename BackendTag = backend::CpuTag>
196core::SparseVector<BackendTag, size_t>
201 decomposition::get_global_world(
decomp);
208 std::vector<size_t> indices;
304template <
typename BackendTag = backend::CpuTag>
305std::map<Int3, std::pair<core::SparseVector<BackendTag, size_t>,
309 std::map<Int3, std::pair<core::SparseVector<BackendTag, size_t>,
316 case Connectivity::Faces:
319 case Connectivity::All:
322 default:
neighbors = decomposition::find_face_neighbors(
decomp, rank);
break;
Sparse vector for indexed data views.
Definition sparse_vector.hpp:66
Core type definitions for World parameters.
std::array< int, 3 > Int3
Type aliases for clarity.
Definition types.hpp:45
Domain decomposition for parallel MPI simulations.
Neighbor finding utilities for Decomposition.
core::SparseVector< BackendTag, size_t > create_recv_halo(const decomposition::Decomposition &decomp, int rank, const Int3 &direction, int halo_width)
Create SparseVector representing receive halo region.
Definition halo_pattern.hpp:197
Connectivity
Connectivity pattern for halo exchange.
Definition halo_pattern.hpp:64
std::map< Int3, std::pair< core::SparseVector< BackendTag, size_t >, core::SparseVector< BackendTag, size_t > > > create_halo_patterns(const decomposition::Decomposition &decomp, int rank, Connectivity connectivity, int halo_width)
Create all halo patterns for a rank.
Definition halo_pattern.hpp:307
const auto & get_upper(const CartesianWorld &world) noexcept
Get the upper bounds of the world in a specific dimension.
Definition world_queries.hpp:168
const auto & get_lower(const CartesianWorld &world) noexcept
Get the lower bounds of the world.
Definition world_queries.hpp:149
Sparse vector for halo exchange and indexed data views.
Describes a static, pure partitioning of the global simulation domain into local subdomains.
Definition decomposition.hpp:182
Represents the global simulation domain (the "world").
Definition world.hpp:91
World class definition and unified interface.