mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: a macro to handle types as pod
This commit is contained in:
parent
c7163d66f0
commit
95ee6566d4
@ -31,6 +31,22 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
||||||
#include <dune/common/parallel/mpitraits.hh>
|
#include <dune/common/parallel/mpitraits.hh>
|
||||||
|
|
||||||
|
#define HANDLE_AS_POD(T) \
|
||||||
|
std::size_t packSize(const T& data, Dune::MPIHelper::MPICommunicator comm) \
|
||||||
|
{ \
|
||||||
|
return packSize(data, comm, std::integral_constant<bool,true>()); \
|
||||||
|
} \
|
||||||
|
void pack(const T& data, std::vector<char>& buffer, int& position, \
|
||||||
|
Dune::MPIHelper::MPICommunicator comm) \
|
||||||
|
{ \
|
||||||
|
pack(data, buffer, position, comm, std::integral_constant<bool,true>()); \
|
||||||
|
} \
|
||||||
|
void unpack(T& data, std::vector<char>& buffer, int& position, \
|
||||||
|
Dune::MPIHelper::MPICommunicator comm) \
|
||||||
|
{ \
|
||||||
|
unpack(data, buffer, position, comm, std::integral_constant<bool,true>()); \
|
||||||
|
}
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
namespace Mpi
|
namespace Mpi
|
||||||
@ -160,23 +176,9 @@ std::size_t packSize(const std::unordered_map<T1,T2,H,P,A>& data, Dune::MPIHelpe
|
|||||||
return totalSize;
|
return totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t packSize(const data::Rates& data, Dune::MPIHelper::MPICommunicator comm)
|
HANDLE_AS_POD(data::Connection)
|
||||||
{
|
HANDLE_AS_POD(data::Rates)
|
||||||
// plain struct no pointers -> treat as pod
|
HANDLE_AS_POD(data::Segment)
|
||||||
return packSize(data, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t packSize(const data::Connection& data, Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
return packSize(data, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t packSize(const data::Segment& data, Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
return packSize(data, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t packSize(const data::Well& data, Dune::MPIHelper::MPICommunicator comm)
|
std::size_t packSize(const data::Well& data, Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
@ -409,27 +411,6 @@ void pack(const std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pack(const data::Rates& data, std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
pack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void pack(const data::Connection& data, std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
pack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void pack(const data::Segment& data,std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
pack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void pack(const data::Well& data, std::vector<char>& buffer, int& position,
|
void pack(const data::Well& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
@ -689,27 +670,6 @@ void unpack(std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpack(data::Rates& data, std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
unpack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void unpack(data::Connection& data, std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
unpack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void unpack(data::Segment& data,std::vector<char>& buffer, int& position,
|
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
|
||||||
{
|
|
||||||
// plain struct no pointers -> treat as pod
|
|
||||||
unpack(data, buffer, position, comm, std::integral_constant<bool,true>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void unpack(data::Well& data, std::vector<char>& buffer, int& position,
|
void unpack(data::Well& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user