|
DOLFIN-X
DOLFIN-X C++ interface
|
This class represents the distribution index arrays across processes. An index array is a contiguous collection of N+1 indices [0, 1, . . ., N] that are distributed across M processes. On a given process, the IndexMap stores a portion of the index set using local indices [0, 1, . . . , n], and a map from the local indices to a unique global index. More...
#include <IndexMap.h>
Public Types | |
| enum class | Mode { insert , add } |
| Mode for reverse scatter operation. | |
| enum class | Direction { reverse , forward , symmetric } |
| Edge directions of neighborhood communicator. | |
Public Member Functions | |
| IndexMap (MPI_Comm comm, std::int32_t local_size) | |
| Create an non-overlapping index map with local_size owned on this process. More... | |
| IndexMap (MPI_Comm mpi_comm, std::int32_t local_size, const std::vector< int > &dest_ranks, const std::vector< std::int64_t > &ghosts, const std::vector< int > &src_ranks) | |
| Create an index map with local_size owned indiced on this process. More... | |
| IndexMap (const IndexMap &map)=delete | |
| IndexMap (IndexMap &&map)=default | |
| Move constructor. | |
| ~IndexMap ()=default | |
| Destructor. | |
| IndexMap & | operator= (IndexMap &&map)=default |
| Move assignment. | |
| IndexMap & | operator= (const IndexMap &map)=delete |
| std::array< std::int64_t, 2 > | local_range () const noexcept |
| Range of indices (global) owned by this process. | |
| std::int32_t | num_ghosts () const noexcept |
| Number of ghost indices on this process. | |
| std::int32_t | size_local () const noexcept |
| Number of indices owned by on this process. | |
| std::int64_t | size_global () const noexcept |
| Number indices across communicator. | |
| const std::vector< std::int64_t > & | ghosts () const noexcept |
| Local-to-global map for ghosts (local indexing beyond end of local range) | |
| MPI_Comm | comm (Direction dir=Direction::symmetric) const |
| Return a MPI communicator with attached distributed graph topology information. More... | |
| void | local_to_global (const std::int32_t *local, int n, std::int64_t *global) const |
| Compute global indices for array of local indices. More... | |
| std::vector< std::int32_t > | global_to_local (const std::vector< std::int64_t > &indices) const |
| Compute local indices for array of global indices. More... | |
| std::vector< std::int64_t > | global_indices () const |
| Global indices. More... | |
| const std::vector< std::int32_t > & | shared_indices () const noexcept |
| std::vector< int > | ghost_owner_rank () const |
| Owner rank (on global communicator) of each ghost entry. | |
| std::map< std::int32_t, std::set< int > > | compute_shared_indices () const |
| void | scatter_fwd (const std::vector< std::int64_t > &local_data, std::vector< std::int64_t > &remote_data, int n) const |
| Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local(). More... | |
| void | scatter_fwd (const std::vector< std::int32_t > &local_data, std::vector< std::int32_t > &remote_data, int n) const |
| Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local(). More... | |
| std::vector< std::int64_t > | scatter_fwd (const std::vector< std::int64_t > &local_data, int n) const |
| Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local(). More... | |
| std::vector< std::int32_t > | scatter_fwd (const std::vector< std::int32_t > &local_data, int n) const |
| Send n values for each index that is owned to processes that have the index as a ghost. More... | |
| void | scatter_rev (std::vector< std::int64_t > &local_data, const std::vector< std::int64_t > &remote_data, int n, IndexMap::Mode op) const |
| Send n values for each ghost index to owning to the process. More... | |
| void | scatter_rev (std::vector< std::int32_t > &local_data, const std::vector< std::int32_t > &remote_data, int n, IndexMap::Mode op) const |
| Send n values for each ghost index to owning to the process. More... | |
This class represents the distribution index arrays across processes. An index array is a contiguous collection of N+1 indices [0, 1, . . ., N] that are distributed across M processes. On a given process, the IndexMap stores a portion of the index set using local indices [0, 1, . . . , n], and a map from the local indices to a unique global index.
| IndexMap::IndexMap | ( | MPI_Comm | comm, |
| std::int32_t | local_size | ||
| ) |
| IndexMap::IndexMap | ( | MPI_Comm | mpi_comm, |
| std::int32_t | local_size, | ||
| const std::vector< int > & | dest_ranks, | ||
| const std::vector< std::int64_t > & | ghosts, | ||
| const std::vector< int > & | src_ranks | ||
| ) |
Create an index map with local_size owned indiced on this process.
| [in] | mpi_comm | The MPI communicator |
| [in] | local_size | Local size of the IndexMap, i.e. the number of owned entries |
| [in] | dest_ranks | Ranks that 'ghost' indices that are owned by the calling rank. I.e., ranks that the caller will send data to when updating ghost values. |
| [in] | ghosts | The global indices of ghost entries |
| [in] | src_ranks | Owner rank (on global communicator) of each entry in ghosts |
| MPI_Comm IndexMap::comm | ( | Direction | dir = Direction::symmetric | ) | const |
Return a MPI communicator with attached distributed graph topology information.
| [in] | dir | Edge direction of communicator (forward, reverse, symmetric) |
| std::map< std::int32_t, std::set< int > > IndexMap::compute_shared_indices | ( | ) | const |
Compute map from each local (owned) index to the set of ranks that have the index as a ghost
| std::vector< std::int64_t > IndexMap::global_indices | ( | ) | const |
Global indices.
| std::vector< std::int32_t > IndexMap::global_to_local | ( | const std::vector< std::int64_t > & | indices | ) | const |
Compute local indices for array of global indices.
| [in] | indices | Global indices |
| void IndexMap::local_to_global | ( | const std::int32_t * | local, |
| int | n, | ||
| std::int64_t * | global | ||
| ) | const |
Compute global indices for array of local indices.
| [in] | local | Local indices |
| [in] | n | Number of indices |
| [out] | global | The global indices |
| std::vector< std::int32_t > IndexMap::scatter_fwd | ( | const std::vector< std::int32_t > & | local_data, |
| int | n | ||
| ) | const |
Send n values for each index that is owned to processes that have the index as a ghost.
| [in] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in] | n | Number of data items per index |
| void IndexMap::scatter_fwd | ( | const std::vector< std::int32_t > & | local_data, |
| std::vector< std::int32_t > & | remote_data, | ||
| int | n | ||
| ) | const |
Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local().
| [in] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in,out] | remote_data | Ghost data on this process received from the owning process. Size will be n * num_ghosts(). |
| [in] | n | Number of data items per index |
| std::vector< std::int64_t > IndexMap::scatter_fwd | ( | const std::vector< std::int64_t > & | local_data, |
| int | n | ||
| ) | const |
Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local().
| [in] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in] | n | Number of data items per index |
| void IndexMap::scatter_fwd | ( | const std::vector< std::int64_t > & | local_data, |
| std::vector< std::int64_t > & | remote_data, | ||
| int | n | ||
| ) | const |
Send n values for each index that is owned to processes that have the index as a ghost. The size of the input array local_data must be the same as n * size_local().
| [in] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in,out] | remote_data | Ghost data on this process received from the owning process. Size will be n * num_ghosts(). |
| [in] | n | Number of data items per index |
| void IndexMap::scatter_rev | ( | std::vector< std::int32_t > & | local_data, |
| const std::vector< std::int32_t > & | remote_data, | ||
| int | n, | ||
| IndexMap::Mode | op | ||
| ) | const |
Send n values for each ghost index to owning to the process.
| [in,out] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in] | remote_data | Ghost data on this process received from the owning process. Size will be n * num_ghosts(). |
| [in] | n | Number of data items per index |
| [in] | op | Sum or set received values in local_data |
| void IndexMap::scatter_rev | ( | std::vector< std::int64_t > & | local_data, |
| const std::vector< std::int64_t > & | remote_data, | ||
| int | n, | ||
| IndexMap::Mode | op | ||
| ) | const |
Send n values for each ghost index to owning to the process.
| [in,out] | local_data | Local data associated with each owned local index to be sent to process where the data is ghosted. Size must be n * size_local(). |
| [in] | remote_data | Ghost data on this process received from the owning process. Size will be n * num_ghosts(). |
| [in] | n | Number of data items per index |
| [in] | op | Sum or set received values in local_data |
|
noexcept |