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 block indices [0, 1, . . ., N] that are distributed across processes 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 block indices to a unique global block index. More...
#include <IndexMap.h>
Public Types | |
enum | Mode { insert, add } |
Mode for reverse scatter operation. | |
Public Member Functions | |
IndexMap (MPI_Comm mpi_comm, std::int32_t local_size, const std::vector< std::int64_t > &ghosts, int block_size) | |
Create Index map with local_size owned blocks on this process, and blocks have size block_size. More... | |
IndexMap (MPI_Comm mpi_comm, std::int32_t local_size, const Eigen::Ref< const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 >> &ghosts, int block_size) | |
Create Index map with local_size owned blocks on this process, and blocks have size block_size. More... | |
IndexMap (const IndexMap &map)=delete | |
Copy constructor. | |
IndexMap (IndexMap &&map)=default | |
Move constructor. | |
~IndexMap ()=default | |
Destructor. | |
std::array< std::int64_t, 2 > | local_range () const |
Range of indices (global) owned by this process. | |
int | block_size () const |
Block size. | |
std::int32_t | num_ghosts () const |
Number of ghost indices on this process. | |
std::int32_t | size_local () const |
Number of indices owned by on this process. | |
std::int64_t | size_global () const |
Number indices across communicator. | |
const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 > & | ghosts () const |
Local-to-global map for ghosts (local indexing beyond end of local range) | |
Eigen::Array< std::int64_t, Eigen::Dynamic, 1 > | local_to_global (const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &indices, bool blocked=true) const |
Compute global indices for array of local indices. More... | |
std::vector< std::int64_t > | local_to_global (const std::vector< std::int32_t > &indices, bool blocked=true) const |
std::vector< std::int32_t > | global_to_local (const std::vector< std::int64_t > &indices, bool blocked=true) const |
Compute local indices for array of global indices. More... | |
std::vector< std::int32_t > | global_to_local (const Eigen::Ref< const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 >> &indices, bool blocked=true) const |
Compute local indices for array of global indices. More... | |
std::vector< std::int64_t > | global_indices (bool blocked=true) const |
Global indices. More... | |
std::int64_t | local_to_global (std::int32_t local_index) const |
const std::vector< std::int32_t > & | forward_indices () const |
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > | ghost_owners () const |
Owner rank (on global communicator) of each ghost entry. | |
int | owner (std::int64_t global_index) const |
Get process that owns index (global block index) | |
Eigen::Array< std::int64_t, Eigen::Dynamic, 1 > | indices (bool unroll_block) const |
Return array of global indices for all indices on this process, including ghosts. | |
MPI_Comm | mpi_comm () const |
Return MPI communicator. More... | |
const std::vector< std::int32_t > & | neighbours () const |
Neighbors for neigborhood communicator. | |
std::map< std::int32_t, std::set< std::int32_t > > | 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 block indices [0, 1, . . ., N] that are distributed across processes 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 block indices to a unique global block index.
IndexMap::IndexMap | ( | MPI_Comm | mpi_comm, |
std::int32_t | local_size, | ||
const std::vector< std::int64_t > & | ghosts, | ||
int | block_size | ||
) |
Create Index map with local_size owned blocks on this process, and blocks have size block_size.
Collective
IndexMap::IndexMap | ( | MPI_Comm | mpi_comm, |
std::int32_t | local_size, | ||
const Eigen::Ref< const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 >> & | ghosts, | ||
int | block_size | ||
) |
Create Index map with local_size owned blocks on this process, and blocks have size block_size.
Collective
std::map< int, std::set< int > > IndexMap::compute_shared_indices | ( | ) | const |
Compute map from each local index to the complete set of sharing processes for that index
|
inline |
std::vector< std::int64_t > IndexMap::global_indices | ( | bool | blocked = true | ) | const |
Global indices.
std::vector< std::int32_t > IndexMap::global_to_local | ( | const Eigen::Ref< const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 >> & | indices, |
bool | blocked = true |
||
) | const |
Compute local indices for array of global indices.
[in] | indices | Global indices |
[in] | blocked | If true work with blocked indices. If false the input indices are not block-wise. |
std::vector< std::int32_t > IndexMap::global_to_local | ( | const std::vector< std::int64_t > & | indices, |
bool | blocked = true |
||
) | const |
Compute local indices for array of global indices.
[in] | indices | Global indices |
[in] | blocked | If true work with blocked indices. If false the input indices are not block-wise. |
Eigen::Array< std::int64_t, Eigen::Dynamic, 1 > IndexMap::local_to_global | ( | const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> & | indices, |
bool | blocked = true |
||
) | const |
Compute global indices for array of local indices.
[in] | indices | Local indices |
[in] | blocked | If true work with blocked indices. If false the input indices are not block-wise. |
std::vector< std::int64_t > IndexMap::local_to_global | ( | const std::vector< std::int32_t > & | indices, |
bool | blocked = true |
||
) | const |
Compute global indices for array of local indices
[in] | indices | Local indices |
[in] | blocked | If true work with blocked indices. If false the input indices are not block-wise. |
|
inline |
MPI_Comm IndexMap::mpi_comm | ( | ) | const |
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 |