Chi-Tech
GhostedParallelSTLVector.cc
Go to the documentation of this file.
2
3#include "chi_log.h"
4
5#include <algorithm>
6
7namespace chi_math
8{
9
10std::unique_ptr<ParallelVector> GhostedParallelSTLVector::MakeCopy() const
11{
12 return std::make_unique<GhostedParallelSTLVector>(*this);
13}
14
15std::unique_ptr<ParallelVector> GhostedParallelSTLVector::MakeClone() const
16{
17 auto new_vec = std::make_unique<GhostedParallelSTLVector>(*this);
18
19 new_vec->Set(0.0);
20
21 return new_vec;
22}
23
24double GhostedParallelSTLVector::GetGlobalValue(const int64_t global_id) const
25{
26 if (global_id >= extents_[location_id_] and
27 global_id < extents_[location_id_ + 1])
28 return values_[global_id - extents_[location_id_]];
29
31 ghost_comm_.MapGhostToLocal(global_id) == -1,
32 "Invalid global id specified. Specified global ids must be "
33 "locally owned or ghosts.");
34 return values_[ghost_comm_.MapGhostToLocal(global_id)];
35}
36
37} // namespace chi_math
#define ChiInvalidArgumentIf(condition, message)
std::unique_ptr< ParallelVector > MakeClone() const override
double GetGlobalValue(int64_t global_id) const
std::unique_ptr< ParallelVector > MakeCopy() const override
const std::vector< uint64_t > extents_
std::vector< double > values_
int64_t MapGhostToLocal(int64_t ghost_id) const