Flow123d
release_3.0.0-968-gc87a28e79
|
Go to the documentation of this file.
18 #ifndef VECTOR_MPI_HH_
19 #define VECTOR_MPI_HH_
59 resize(local_size, ghost_idx);
76 void resize(
unsigned int local_size) {
78 data_ptr_ = std::make_shared< std::vector<double> >(local_size);
97 data_ptr_ = std::make_shared< std::vector<double> >(local_size + ghost_idx.size());
101 data_ptr_->resize(local_size + ghost_idx.size());
160 VecGhostUpdateBegin(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);
165 VecGhostUpdateEnd(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);
170 VecGhostUpdateBegin(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);
175 VecGhostUpdateEnd(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);
double & operator[](unsigned int idx)
void copy(VectorMPI &other)
VectorDataPtr data_ptr_
shared pointer to vector of data
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value and is_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
VectorMPI(MPI_Comm comm=PETSC_COMM_SELF)
static VectorMPI sequential(unsigned int size)
void ghost_to_local_begin()
ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processo...
void resize(unsigned int local_size)
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
VectorMPI(unsigned int local_size, MPI_Comm comm=PETSC_COMM_WORLD)
Create shared pointer and PETSC vector with given size. COLLECTIVE.
void resize(unsigned int local_size, std::vector< LongIdx > &ghost_idx)
void swap(VectorMPI &other)
std::shared_ptr< VectorData > VectorDataPtr
Vec data_petsc_
stored vector of data in PETSC format
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
void ghost_to_local_end()
ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processo...
void local_to_ghost_begin()
local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values
MPI_Comm communicator_
communicator
Global macros to enhance readability and debugging, general constants.
void local_to_ghost_end()
local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values
VectorMPI(unsigned int local_size, std::vector< LongIdx > &ghost_idx)
Create PETSc vector with ghost values whose indices are specified in ghost_idx.
VectorDataPtr data_ptr()
Getter for shared pointer of output data.
Vec & petsc_vec()
Getter for PETSC vector of output data (e.g. can be used by scatters).
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
unsigned int size() const
Return size of output data.
std::vector< double > VectorData
void duplicate(VectorMPI other)
Return new vector with same parallel structure.