Flow123d
JS_before_hm-2277-gb15131e45
|
Go to the documentation of this file.
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);}
arma::Col< IntIdx > LocDofVec
VectorDataPtr data_ptr_
shared pointer to vector of data
VectorMPI(MPI_Comm comm=PETSC_COMM_SELF)
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.
void normalize(unsigned int pos, double divisor)
Normalize value on given position.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
void set(unsigned int pos, double val)
Set value on given position.
void swap(VectorMPI &other)
Swaps the current vector data with the other vector data.
void copy_from(VectorMPI &other)
std::shared_ptr< VectorData > VectorDataPtr
Vec data_petsc_
stored vector of data in PETSC format
arma::vec get_subvec(const LocDofVec &loc_indices)
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
void add(unsigned int pos, double val)
Add value to item on given position.
MPI_Comm communicator_
communicator
void set_subvec(const LocDofVec &loc_indices, const arma::vec &values)
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
static VectorMPI sequential(unsigned int size)
void duplicate_from(VectorMPI other)
For the current vector, it creates the same parallel structure as the other vector has.
double get(unsigned int pos) const
Return value on given position.
void add_global(unsigned int pos, double val)
Add value to item on given global position.
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) only for debug mode.
unsigned int size() const
Return size of output data.
std::vector< double > VectorData