mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization specialization for std::vector<bool>
This commit is contained in:
parent
95ee6566d4
commit
b33611077b
@ -128,12 +128,20 @@ std::size_t packSize(const std::vector<T,A>& data, Dune::MPIHelper::MPICommunica
|
||||
return size;
|
||||
}
|
||||
|
||||
template<class A>
|
||||
std::size_t packSize(const std::vector<bool,A>& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
bool entry;
|
||||
return packSize(data.size(), comm) + data.size()*packSize(entry,comm);
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getIndex(), comm) + packSize(data.getStorage(), comm);
|
||||
}
|
||||
|
||||
|
||||
std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
@ -356,6 +364,17 @@ void pack(const std::vector<T, A>& data, std::vector<char>& buffer, int& positio
|
||||
pack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class A>
|
||||
void pack(const std::vector<bool,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.size(), buffer, position, comm);
|
||||
for (const auto& entry : data) {
|
||||
bool b = entry;
|
||||
pack(b, buffer, position, comm);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
void pack(const OrderedMap<Key, Value>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
@ -604,6 +623,21 @@ void unpack(std::vector<T,A>& data, std::vector<char>& buffer, int& position,
|
||||
unpack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class A>
|
||||
void unpack(std::vector<bool,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
size_t size;
|
||||
unpack(size, buffer, position, comm);
|
||||
data.clear();
|
||||
data.reserve(size);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
bool entry;
|
||||
unpack(entry, buffer, position, comm);
|
||||
data.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
void unpack(OrderedMap<Key,Value>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
|
@ -76,6 +76,9 @@ 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 A>
|
||||
std::size_t packSize(const std::vector<bool,A>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
std::size_t packSize(const std::string& str, Dune::MPIHelper::MPICommunicator comm);
|
||||
@ -124,6 +127,10 @@ template<class T, class A>
|
||||
void pack(const std::vector<T,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class A>
|
||||
void pack(const std::vector<bool,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class T1, class T2, class C, class A>
|
||||
void pack(const std::map<T1,T2,C,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
@ -174,6 +181,10 @@ template<class T, class A>
|
||||
void unpack(std::vector<T,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class A>
|
||||
void unpack(std::vector<bool,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class T1, class T2, class C, class A>
|
||||
void unpack(std::map<T1,T2,C,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
Loading…
Reference in New Issue
Block a user