mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for std::unique_ptr
This commit is contained in:
parent
1860141771
commit
6e8b82ae7d
@ -1158,6 +1158,17 @@ std::size_t packSize(const std::shared_ptr<T>& data,
|
|||||||
template std::size_t packSize(const std::shared_ptr<SpiralICD>& data,
|
template std::size_t packSize(const std::shared_ptr<SpiralICD>& data,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
std::size_t packSize(const std::unique_ptr<T>& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
std::size_t size = packSize(bool(), comm);
|
||||||
|
if (data)
|
||||||
|
size += packSize(*data, comm);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t packSize(const Dimension& data,
|
std::size_t packSize(const Dimension& data,
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
@ -2654,6 +2665,15 @@ void pack(const std::shared_ptr<T>& data, std::vector<char>& buffer, int& positi
|
|||||||
pack(*data, buffer, position, comm);
|
pack(*data, buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void pack(const std::unique_ptr<T>& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data != nullptr, buffer, position, comm);
|
||||||
|
if (data)
|
||||||
|
pack(*data, buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
template void pack(const std::shared_ptr<SpiralICD>& data, std::vector<char>& buffer,
|
template void pack(const std::shared_ptr<SpiralICD>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
@ -4632,6 +4652,18 @@ void unpack(std::shared_ptr<T>& data, std::vector<char>& buffer, int& position,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void unpack(std::unique_ptr<T>& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
bool hasVal;
|
||||||
|
unpack(hasVal, buffer, position, comm);
|
||||||
|
if (hasVal) {
|
||||||
|
data.reset(new T);
|
||||||
|
unpack(*data, buffer, position, comm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template void unpack(std::shared_ptr<SpiralICD>& data,
|
template void unpack(std::shared_ptr<SpiralICD>& data,
|
||||||
std::vector<char>& buffer, int& position,
|
std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
@ -194,6 +194,10 @@ std::size_t packSize(const std::shared_ptr<T>& data,
|
|||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
std::size_t packSize(const std::array<T,N>& data, Dune::MPIHelper::MPICommunicator comm);
|
std::size_t packSize(const std::array<T,N>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
std::size_t packSize(const std::unique_ptr<T>& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
std::size_t packSize(const char* str, 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);
|
std::size_t packSize(const std::string& str, Dune::MPIHelper::MPICommunicator comm);
|
||||||
@ -327,6 +331,10 @@ template<class T, size_t N>
|
|||||||
void pack(const std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
void pack(const std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void pack(const std::unique_ptr<T>& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
template<class T1, class T2, class C, class A>
|
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,
|
void pack(const std::map<T1,T2,C,A>& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
@ -481,6 +489,10 @@ template<class T, size_t N>
|
|||||||
void unpack(std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
void unpack(std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void unpack(std::unique_ptr<T>& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
template<class T1, class T2, class C, class A>
|
template<class T1, class T2, class C, class A>
|
||||||
void unpack(std::map<T1,T2,C,A>& data, std::vector<char>& buffer, int& position,
|
void unpack(std::map<T1,T2,C,A>& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
Loading…
Reference in New Issue
Block a user