18 #ifndef VECTOR_MPI_HH_ 19 #define VECTOR_MPI_HH_ 62 return new VectorMPI(size, PETSC_COMM_SELF);
69 void resize(
unsigned int local_size) {
71 data_ptr_ = std::make_shared< std::vector<double> >(local_size);
MPI_Comm communicator_
communicator
void copy(VectorMPI &other)
VectorMPI(unsigned int local_size, MPI_Comm comm=PETSC_COMM_WORLD)
Create shared pointer and PETSC vector with given size. COLLECTIVE.
static VectorMPI * sequential(unsigned int size)
void duplicate(VectorMPI other)
Return new vector with same parallel structure.
std::vector< double > VectorData
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
VectorDataPtr data_ptr()
Getter for shared pointer of output data.
double & operator[](unsigned int idx)
VectorMPI(MPI_Comm comm=PETSC_COMM_SELF)
Global macros to enhance readability and debugging, general constants.
VectorDataPtr data_ptr_
shared pointer to vector of data
Vec data_petsc_
stored vector of data in PETSC format
void resize(unsigned int local_size)
Vec & petsc_vec()
Getter for PETSC vector of output data (e.g. can be used by scatters).
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value andis_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
void swap(VectorMPI &other)
std::shared_ptr< VectorData > VectorDataPtr
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
unsigned int size()
Return size of output data.