41 resize(local_size, ghost_idx);
52 data_ptr_ = std::make_shared< std::vector<double> >(local_size);
69 data_ptr_ = std::make_shared< std::vector<double> >(local_size + ghost_idx.size());
73 data_ptr_->resize(local_size + ghost_idx.size());
115 for(
unsigned int i=0; i<loc_indices.n_elem; i++){
116 unsigned int idx = loc_indices(i);
118 vec(i) = (*data_ptr_)[idx];
129 for(
unsigned int i=0; i<loc_indices.n_elem; i++){
130 unsigned int idx = loc_indices(i);
132 vec(i) = (*data_ptr_)[idx];
143 for(
unsigned int i=0; i<loc_indices.n_elem; i++){
144 unsigned int idx = loc_indices(i);
146 (*data_ptr_)[idx] = values(i);
unsigned int size() const
Return size of output data.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
MPI_Comm communicator_
communicator
arma::Col< IntIdx > LocDofVec
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)
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
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)
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
static VectorMPI sequential(unsigned int size)