18 #ifndef VECTOR_MPI_HH_ 19 #define VECTOR_MPI_HH_ 67 void resize(
unsigned int local_size);
105 inline double get(
unsigned int pos)
const {
111 inline void set(
unsigned int pos,
double val) {
113 (*data_ptr_)[pos] = val;
117 inline void normalize(
unsigned int pos,
double divisor) {
119 (*data_ptr_)[pos] /= divisor;
123 inline void add(
unsigned int pos,
double val) {
125 (*data_ptr_)[pos] += val;
148 { VecGhostUpdateBegin(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);}
152 { VecGhostUpdateEnd(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);}
156 { VecGhostUpdateBegin(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);}
160 { VecGhostUpdateEnd(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);}
unsigned int size() const
Return size of output data.
MPI_Comm communicator_
communicator
arma::Col< IntIdx > LocDofVec
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 ...
std::vector< double > VectorData
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
VectorMPI(MPI_Comm comm=PETSC_COMM_SELF)
void copy_from(VectorMPI &other)
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 add(unsigned int pos, double val)
Add value to item on given position.
void local_to_ghost_end()
local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values ...
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
void normalize(unsigned int pos, double divisor)
Normalize value on given position.
void swap(VectorMPI &other)
Swaps the current vector data with the other vector data.
void set_subvec(const LocDofVec &loc_indices, const arma::vec &values)
void duplicate_from(VectorMPI other)
For the current vector, it creates the same parallel structure as the other vector has...
arma::vec get_subvec(const LocDofVec &loc_indices)
void ghost_to_local_begin()
ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processo...
std::shared_ptr< VectorData > VectorDataPtr
#define ASSERT_PTR_DBG(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
static VectorMPI sequential(unsigned int size)