35 : communicator_(comm) {
40 : communicator_(PETSC_COMM_WORLD) {
41 resize(local_size, ghost_idx);
52 data_ptr_ = std::make_shared< std::vector<double> >(local_size);
54 ASSERT(
data_ptr_.use_count() == 1 ) (
data_ptr_.use_count() ).error(
"Object referenced by other pointer. Can not resize.");
67 ASSERT(
communicator_ == PETSC_COMM_WORLD).error(
"Cannot allocate ghost values in sequential vector.");
69 data_ptr_ = std::make_shared< std::vector<double> >(local_size + ghost_idx.size());
71 ASSERT(
data_ptr_.use_count() == 1 ) (
data_ptr_.use_count() ).error(
"Object referenced by other pointer. Can not resize.");
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];
141 ASSERT_EQ(loc_indices.n_elem, values.n_elem);
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);