mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
changed: handle all arrays in eclmpiserializer
thus we can remove support in MPIPacker
This commit is contained in:
parent
3164fa6154
commit
4cd9272a76
@ -92,6 +92,8 @@ public:
|
||||
optional(data);
|
||||
} else if constexpr (is_map<T>::value) {
|
||||
map(const_cast<T&>(data));
|
||||
} else if constexpr (is_array<T>::value) {
|
||||
array(const_cast<T&>(data));
|
||||
} else {
|
||||
if (m_op == Operation::PACKSIZE)
|
||||
m_packSize += Mpi::packSize(data, m_comm);
|
||||
@ -503,6 +505,17 @@ protected:
|
||||
constexpr static bool value = true;
|
||||
};
|
||||
|
||||
//! \brief Predicate for arrays
|
||||
template<class T>
|
||||
struct is_array {
|
||||
constexpr static bool value = false;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct is_array<std::array<T,N>> {
|
||||
constexpr static bool value = true;
|
||||
};
|
||||
|
||||
//! Detect existence of \c serializeOp member function
|
||||
//!
|
||||
//! Base case (no \c serializeOp member function)
|
||||
|
@ -153,12 +153,6 @@ std::size_t packSize(const std::string& str, Opm::Parallel::MPIComm comm)
|
||||
return packSize(str.c_str(), comm);
|
||||
}
|
||||
|
||||
template<class T, std::size_t N>
|
||||
std::size_t packSize(const std::array<T,N>& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return N*packSize(data[0], comm);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct Packing
|
||||
{
|
||||
@ -284,14 +278,6 @@ void pack(const std::unordered_set<T,H,KE,A>& data,
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, size_t N>
|
||||
void pack(const std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
for (const T& entry : data)
|
||||
pack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class A>
|
||||
void pack(const std::vector<bool,A>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
@ -492,14 +478,6 @@ void unpack(std::unordered_set<T,H,KE,A>& data,
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, size_t N>
|
||||
void unpack(std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
for (T& entry : data)
|
||||
unpack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
@ -564,7 +542,6 @@ INSTANTIATE_PACK_VECTOR(unsigned int)
|
||||
INSTANTIATE_PACK_VECTOR(unsigned long int)
|
||||
INSTANTIATE_PACK_VECTOR(unsigned long long int)
|
||||
INSTANTIATE_PACK_VECTOR(std::time_t)
|
||||
INSTANTIATE_PACK_VECTOR(std::array<double, 3>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<bool,double>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<std::string,std::vector<size_t>>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<int,std::vector<int>>)
|
||||
@ -593,11 +570,6 @@ INSTANTIATE_PACK(unsigned char)
|
||||
INSTANTIATE_PACK(unsigned int)
|
||||
INSTANTIATE_PACK(unsigned long int)
|
||||
INSTANTIATE_PACK(unsigned long long int)
|
||||
INSTANTIATE_PACK(std::array<short,3>)
|
||||
INSTANTIATE_PACK(std::array<bool,3>)
|
||||
INSTANTIATE_PACK(std::array<int,3>)
|
||||
INSTANTIATE_PACK(std::array<double,4>)
|
||||
INSTANTIATE_PACK(std::array<double,5>)
|
||||
INSTANTIATE_PACK(std::pair<double, double>)
|
||||
INSTANTIATE_PACK(std::unordered_set<std::string>)
|
||||
INSTANTIATE_PACK(std::set<std::string>)
|
||||
|
@ -97,9 +97,6 @@ std::size_t packSize(const std::vector<bool,A>& data, Opm::Parallel::MPIComm com
|
||||
template<class... Ts>
|
||||
std::size_t packSize(const std::tuple<Ts...>& data, Opm::Parallel::MPIComm comm);
|
||||
|
||||
template<class T, std::size_t N>
|
||||
std::size_t packSize(const std::array<T,N>& data, Opm::Parallel::MPIComm comm);
|
||||
|
||||
std::size_t packSize(const char* str, Opm::Parallel::MPIComm comm);
|
||||
|
||||
template<std::size_t Size>
|
||||
@ -174,10 +171,6 @@ void pack(const std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
template<class T, size_t N>
|
||||
void pack(const std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
void pack(const char* str, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
@ -255,10 +248,6 @@ void unpack(std::unordered_set<T,H,KE,A>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
template<class T, size_t N>
|
||||
void unpack(std::array<T,N>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user