deal.II version GIT relicensing-2220-ge8e5360a96 2024-12-05 09:50:00+00:00
|
#include <deal.II/lac/petsc_communication_pattern.h>
Public Member Functions | |
CommunicationPattern () | |
virtual | ~CommunicationPattern () override |
virtual void | reinit (const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override |
void | reinit (const std::vector< types::global_dof_index > &indices_locally_owned, const std::vector< types::global_dof_index > &indices_want, const MPI_Comm communicator) |
void | reinit (const types::global_dof_index local_size, const IndexSet &ghost_indices, const MPI_Comm communicator) |
template<typename Number > | |
void | export_to_ghosted_array (const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const |
template<typename Number > | |
void | export_to_ghosted_array_start (const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const |
template<typename Number > | |
void | export_to_ghosted_array_finish (const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &ghost_array) const |
template<typename Number > | |
void | import_from_ghosted_array (const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const |
template<typename Number > | |
void | import_from_ghosted_array_start (const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const |
template<typename Number > | |
void | import_from_ghosted_array_finish (const VectorOperation::values op, const ArrayView< const Number > &ghost_array, const ArrayView< Number > &locally_owned_array) const |
MPI_Comm | get_mpi_communicator () const override |
operator const PetscSF & () const | |
void | clear () |
Protected Member Functions | |
void | do_reinit (const std::vector< PetscInt > &inidx, const std::vector< PetscInt > &inloc, const std::vector< PetscInt > &outidx, const std::vector< PetscInt > &outloc, const MPI_Comm communicator) |
Protected Attributes | |
PetscSF | sf |
CommunicationPattern implementation based on the PetscSF object. This class implements the same communication patterns of Utilities::MPI::NoncontiguousPartitioner, internally using PetscSF API calls.
For additional information, see the paper [218]
Definition at line 48 of file petsc_communication_pattern.h.
PETScWrappers::CommunicationPattern::CommunicationPattern | ( | ) |
Default constructor.
Definition at line 35 of file petsc_communication_pattern.cc.
|
overridevirtual |
Destructor.
Definition at line 41 of file petsc_communication_pattern.cc.
|
overridevirtual |
Reinitialize the communication pattern.
[in] | locally_owned_indices | The set of indices of elements in the array mentioned in the class documentation that are stored on the current process. |
[in] | ghost_indices | The set of indices of elements in the array mentioned in the class documentation that the current process will need to be able to import. |
[in] | communicator | The MPI communicator used to describe the entire set of processes that participate in the storage and access to elements of the array. |
Implements Utilities::MPI::CommunicationPatternBase.
Definition at line 94 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::reinit | ( | const std::vector< types::global_dof_index > & | indices_locally_owned, |
const std::vector< types::global_dof_index > & | indices_want, | ||
const MPI_Comm | communicator | ||
) |
Reinitialize the communication pattern. The argument indices_locally_owned
and indices_want
indicates the owned and required dofs, respectively. This allows the indices to not be sorted and to include entries with the value numbers::invalid_dof_index which do not take part of the index exchange but are present in the data vectors as padding.
The export_to_ghost_array will populate an array with the values associated to the indices_want
only.
This emulates the corresponding constructor in Utilities::MPI::NoncontiguousPartitioner.
Definition at line 120 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::reinit | ( | const types::global_dof_index | local_size, |
const IndexSet & | ghost_indices, | ||
const MPI_Comm | communicator | ||
) |
Reinitialization that takes the number of locally-owned degrees of freedom local_size
and an index set for the required ghost indices ghost_indices
.
The local index range is translated to global indices in an ascending and one-to-one fashion, i.e., the indices of process \(p\) sit exactly between the indices of the processes \(p-1\) and \(p+1\), respectively.
The export_to_ghost_array will populate an array containing values from locally-owned AND ghost indices, as for the relevant set of dofs of a usual FEM simulation.
Definition at line 49 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::export_to_ghosted_array | ( | const ArrayView< const Number > & | locally_owned_array, |
const ArrayView< Number > & | ghost_array | ||
) | const |
Fill the vector ghost_array
according to the precomputed communication pattern with values from locally_owned_array
.
Definition at line 332 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::export_to_ghosted_array_start | ( | const ArrayView< const Number > & | locally_owned_array, |
const ArrayView< Number > & | ghost_array | ||
) | const |
Start the communication round to fill the vector ghost_array
according to the precomputed communication pattern with values from locally_owned_array
. It can be overlapped with other communications.
Definition at line 296 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::export_to_ghosted_array_finish | ( | const ArrayView< const Number > & | locally_owned_array, |
const ArrayView< Number > & | ghost_array | ||
) | const |
Finish the communication round to fill the vector ghost_array
according to the precomputed communication pattern with values from locally_owned_array
. It can be overlapped with other communications.
Definition at line 314 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::import_from_ghosted_array | ( | const VectorOperation::values | op, |
const ArrayView< const Number > & | ghost_array, | ||
const ArrayView< Number > & | locally_owned_array | ||
) | const |
Modify the vector locally_owned_array
according to the precomputed communication pattern and the operation op
with values from ghost_array
.
Definition at line 375 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::import_from_ghosted_array_start | ( | const VectorOperation::values | op, |
const ArrayView< const Number > & | ghost_array, | ||
const ArrayView< Number > & | locally_owned_array | ||
) | const |
Start the communication round to modify the vector locally_owned_array
according to the precomputed communication pattern and the operation op
with values from ghost_array
. It can be overlapped with other communications.
Definition at line 344 of file petsc_communication_pattern.cc.
void PETScWrappers::CommunicationPattern::import_from_ghosted_array_finish | ( | const VectorOperation::values | op, |
const ArrayView< const Number > & | ghost_array, | ||
const ArrayView< Number > & | locally_owned_array | ||
) | const |
Finish the communication round to modify the vector locally_owned_array
according to the precomputed communication pattern and the operation op
with values from ghost_array
. It can be overlapped with other communications.
Definition at line 360 of file petsc_communication_pattern.cc.
|
overridevirtual |
Return the underlying MPI communicator.
Implements Utilities::MPI::CommunicationPatternBase.
Definition at line 287 of file petsc_communication_pattern.cc.
|
inline |
Conversion operator to gain access to the underlying PETSc object.
Definition at line 179 of file petsc_communication_pattern.h.
void PETScWrappers::CommunicationPattern::clear | ( | ) |
Reset the object.
Definition at line 279 of file petsc_communication_pattern.cc.
|
protected |
General setup
Definition at line 179 of file petsc_communication_pattern.cc.
|
protected |
A generic PetscSF object that will perform the communication.
Definition at line 194 of file petsc_communication_pattern.h.