Add getSize static method to calculate the size of sources in SliceUnion

This commit is contained in:
2023-01-25 16:25:09 +01:00
parent 933d556c84
commit 4e2d1143e5
2 changed files with 65 additions and 0 deletions

View File

@@ -387,6 +387,22 @@ template <typename F=double>
}
}
static size_t
getSize(const std::vector<size_t> sliceLength,
const std::vector<size_t> paramLength,
const size_t np,
const MPI_Comm global_world) {
const RankMap<F> rankMap(paramLength, np, global_world);
const size_t
nSources = rankMap.nSources(),
sliceSize = std::accumulate(sliceLength.begin(),
sliceLength.end(),
1UL,
std::multiplies<size_t>());
return nSources * sliceSize;
}
// CONSTRUCTOR
SliceUnion( std::vector<typename Slice<F>::Type> sliceTypes_
, std::vector<size_t> sliceLength_