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) {
114 (*data_ptr_)[pos] = val;
118 inline void normalize(
unsigned int pos,
double divisor) {
121 (*data_ptr_)[pos] /= divisor;
125 inline void add(
unsigned int pos,
double val) {
128 (*data_ptr_)[pos] += val;
157 { VecGhostUpdateBegin(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);}
161 { VecGhostUpdateEnd(
data_petsc_, INSERT_VALUES, SCATTER_FORWARD);}
165 { VecGhostUpdateBegin(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);}
169 { VecGhostUpdateEnd(
data_petsc_, ADD_VALUES, SCATTER_REVERSE);}
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
void add_global(unsigned int pos, double val)
Add value to item on given global position.
void copy_from(const VectorMPI &other)
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)
double get(unsigned int pos) const
Return value on given position.
void normalize(unsigned int pos, double divisor)
Normalize value on given position.
void set(unsigned int pos, double val)
Set value on given position.
void resize(unsigned int local_size)
void local_to_ghost_end()
local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values
void set_subvec(const LocDofVec &loc_indices, const arma::vec &values)
void add(unsigned int pos, double val)
Add value to item on given position.
static VectorMPI sequential(unsigned int size)
void local_to_ghost_begin()
local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values
VectorDataPtr data_ptr_
shared pointer to vector of data
Vec data_petsc_
stored vector of data in PETSC format
void ghost_to_local_end()
ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processo...
std::shared_ptr< VectorData > VectorDataPtr
Vec & petsc_vec()
Getter for PETSC vector of output data (e.g. can be used by scatters).
void swap(VectorMPI &other)
Swaps the current vector data with the other vector data.
MPI_Comm communicator_
communicator
unsigned int size() const
Return size of output data.
void ghost_to_local_begin()
ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processo...
VectorMPI(MPI_Comm comm=PETSC_COMM_SELF)
std::vector< double > VectorData
Global macros to enhance readability and debugging, general constants.
arma::Col< IntIdx > LocDofVec
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.