Loading...
Searching...
No Matches
terra::grid::shell::SubdomainNeighborhood Class Reference

Neighborhood information of a single subdomain. More...

#include <spherical_shell.hpp>

Public Types

using UnpackOrderingEdge = BoundaryDirection
 
using UnpackOrderingFace = std::tuple< BoundaryDirection, BoundaryDirection >
 
using NeighborSubdomainTupleVertex = std::tuple< SubdomainInfo, BoundaryVertex, mpi::MPIRank >
 
using NeighborSubdomainTupleEdge = std::tuple< SubdomainInfo, BoundaryEdge, UnpackOrderingEdge, mpi::MPIRank >
 
using NeighborSubdomainTupleFace = std::tuple< SubdomainInfo, BoundaryFace, UnpackOrderingFace, mpi::MPIRank >
 

Public Member Functions

 SubdomainNeighborhood ()=default
 
 SubdomainNeighborhood (const DomainInfo &domain_info, const SubdomainInfo &subdomain_info, const SubdomainToRankDistributionFunction &subdomain_to_rank)
 
const std::map< BoundaryVertex, std::vector< NeighborSubdomainTupleVertex > > & neighborhood_vertex () const
 
const std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > > & neighborhood_edge () const
 
const std::map< BoundaryFace, NeighborSubdomainTupleFace > & neighborhood_face () const
 

Detailed Description

Neighborhood information of a single subdomain.

Note
If you want to create a domain for an application, use the terra::grid::shell::DistributedDomain class, which constructs an instance of this class internally.

Holds information such as the MPI ranks of the neighboring subdomains, and their orientation. Required for communication (packing, unpacking, sending, receiving 'ghost-layer' data).

Details on communication

Data is rotated during unpacking.

Packing/sending

Sender just packs data from the grid into a buffer using the (x, y, r) coordinates in order. For instance: the face boundary xr is packed into a 2D buffer: buffer( x, r ), the face boundary yr is packed as buffer( y, r ), always iterating locally from 0 to end.

Unpacking

When a packet from a certain neighbor subdomain arrives, we have the following information set up in this class (for instance in the NeighborSubdomainTupleFace instances):

Organization

At each boundary face of a local subdomain we store in this class a list of tuples with entries:

SubdomainInfo: neighboring subdomain identifier BoundaryFace: boundary face of the neighboring subdomain (from its local view) UnpackingOrderingFace: information how to iterate over the buffer for each coordinate during unpacking

So e.g., the data (for some subdomain):

neighborhood_face_[ F_X1R ] = { neighbor_subdomain_info, F_1YR, (BACKWARD, FORWARD), neighbor_rank }

means that for this subdomain, the boundary face F_X1R interfaces with the neighbor subdomain neighbor_subdomain_info, at its boundary F_1YR, that is located on rank neighbor_rank. If we unpack data that we receive from the subdomain, we must invert the iteration over the first buffer index, and move forward in the second index.

Note
See terra::grid::BoundaryVertex, terra::grid::BoundaryEdge, terra::grid::BoundaryFace, terra::grid::BoundaryDirection for details on the naming convention of the boundary types like F_X1R. Roughly: 0 == start, 1 == end, X == varying in x, Y == varying in y, R == varying in r.

Execution

Let's assume we receive data from the neighbor specified above.

Sender side (with local boundary F_1YR):

buffer( y, r ) = send_data( sender_local_subdomain_id, x_size - 1, y, r )
^^^^^^^^^^
== x_end
== const

Receiver side (with local boundary F_X1R):

recv_data( receiver_local_subdomain_id, x, y_size - 1, r ) = buffer( x_size - 1 - x, r )
^^^^^^^^^^ ^^^^^^^^^^^^^^ ^
== y_end BACKWARD FORWARD
== const
Note
It is due to the structure of the spherical shell mesh that we never have to swap the indices! (For vertex boundaries this is anyway not required (0D array) and for edges neither (1D array - we only have forward and backward iteration).) Thus, it is enough to have the FORWARD/BACKWARD tuple! The radial direction is always radial. And if we communicate in the radial direction (i.e., sending "xy-planes") then we never need to swap since we are in the same diamond.

Member Typedef Documentation

◆ NeighborSubdomainTupleEdge

◆ NeighborSubdomainTupleFace

◆ NeighborSubdomainTupleVertex

◆ UnpackOrderingEdge

◆ UnpackOrderingFace

Constructor & Destructor Documentation

◆ SubdomainNeighborhood() [1/2]

terra::grid::shell::SubdomainNeighborhood::SubdomainNeighborhood ( )
default

◆ SubdomainNeighborhood() [2/2]

terra::grid::shell::SubdomainNeighborhood::SubdomainNeighborhood ( const DomainInfo domain_info,
const SubdomainInfo subdomain_info,
const SubdomainToRankDistributionFunction subdomain_to_rank 
)
inline

Member Function Documentation

◆ neighborhood_edge()

const std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > > & terra::grid::shell::SubdomainNeighborhood::neighborhood_edge ( ) const
inline

◆ neighborhood_face()

const std::map< BoundaryFace, NeighborSubdomainTupleFace > & terra::grid::shell::SubdomainNeighborhood::neighborhood_face ( ) const
inline

◆ neighborhood_vertex()

const std::map< BoundaryVertex, std::vector< NeighborSubdomainTupleVertex > > & terra::grid::shell::SubdomainNeighborhood::neighborhood_vertex ( ) const
inline

The documentation for this class was generated from the following file: