mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
add mpi serialization for std::set
This commit is contained in:
parent
725af1442e
commit
b596ac6e6e
@ -222,6 +222,18 @@ std::size_t packSize(const std::unordered_set<T,H,KE,A>& data,
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
template<class K, class C, class A>
|
||||
std::size_t packSize(const std::set<K,C,A>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::size_t totalSize = packSize(data.size(), comm);
|
||||
for (const auto& entry : data)
|
||||
{
|
||||
totalSize += packSize(entry, comm);
|
||||
}
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
@ -1765,6 +1777,19 @@ void pack(const std::vector<T, A>& data, std::vector<char>& buffer, int& positio
|
||||
pack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class K, class C, class A>
|
||||
void pack(const std::set<K,C,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.size(), buffer, position, comm);
|
||||
|
||||
for (const auto& entry : data)
|
||||
{
|
||||
pack(entry, buffer, position, comm);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class H, class KE, class A>
|
||||
void pack(const std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
@ -3499,6 +3524,22 @@ void unpack(std::tuple<Ts...>& data, std::vector<char>& buffer,
|
||||
unpack_tuple_entry(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class K, class C, class A>
|
||||
void unpack(std::set<K,C,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::size_t size = 0;
|
||||
unpack(size, buffer, position, comm);
|
||||
|
||||
for (;size>0; size--)
|
||||
{
|
||||
K entry;
|
||||
unpack(entry, buffer, position, comm);
|
||||
data.insert(entry);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class H, class KE, class A>
|
||||
void unpack(std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#include <dune/common/parallel/mpihelper.hh>
|
||||
|
||||
#include <set>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@ -190,6 +191,10 @@ std::size_t packSize(const std::pair<T1,T2>& data, Dune::MPIHelper::MPICommunica
|
||||
template<class T, class A>
|
||||
std::size_t packSize(const std::vector<T,A>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class K, class C, class A>
|
||||
std::size_t packSize(const std::set<K,C,A>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class T, class H, class KE, class A>
|
||||
std::size_t packSize(const std::unordered_set<T,H,KE,A>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
@ -331,6 +336,11 @@ template<class... Ts>
|
||||
void pack(const std::tuple<Ts...>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class K, class C, class A>
|
||||
void pack(const std::set<K,C,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class T, class H, class KE, class A>
|
||||
void pack(const std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
@ -489,6 +499,11 @@ template<class... Ts>
|
||||
void unpack(std::tuple<Ts...>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class K, class C, class A>
|
||||
void unpack(std::set<K,C,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class T, class H, class KE, class A>
|
||||
void unpack(std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
|
Loading…
Reference in New Issue
Block a user