mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
updates in EclMpiSerializer to avoid explicit instances in serializer
now the serializer is 'standard', as in we only require basic types + stl containers. this should make the actual implementation pretty pluggable. will ease replacing our serialization routines with those in Dune 2.7 later.
This commit is contained in:
parent
9b545e58a4
commit
59d1ff9b88
@ -42,6 +42,8 @@ public:
|
||||
{
|
||||
if constexpr (is_ptr<T>::value) {
|
||||
ptr(data);
|
||||
} else if constexpr (is_pair<T>::value) {
|
||||
pair(data);
|
||||
} else {
|
||||
if (m_op == Operation::PACKSIZE)
|
||||
m_packSize += Mpi::packSize(data, m_comm);
|
||||
@ -92,13 +94,15 @@ public:
|
||||
auto handle = [&](auto& d)
|
||||
{
|
||||
if constexpr (is_vector<Data>::value)
|
||||
vector(d);
|
||||
this->template vector<typename Data::value_type,complexType>(d);
|
||||
else if constexpr (is_ptr<Data>::value)
|
||||
ptr(d);
|
||||
else if constexpr (!complexType)
|
||||
d.template serializeOp<EclMpiSerializer, false>(*this);
|
||||
else
|
||||
else if constexpr (is_dynamic_state<Data>::value)
|
||||
d.template serializeOp<EclMpiSerializer, complexType>(*this);
|
||||
else if constexpr (complexType)
|
||||
d.serializeOp(*this);
|
||||
else
|
||||
(*this)(d);
|
||||
};
|
||||
|
||||
if (m_op == Operation::PACKSIZE) {
|
||||
@ -212,6 +216,16 @@ protected:
|
||||
constexpr static bool value = true;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_dynamic_state {
|
||||
constexpr static bool value = false;
|
||||
};
|
||||
|
||||
template<class T1>
|
||||
struct is_dynamic_state<DynamicState<T1>> {
|
||||
constexpr static bool value = true;
|
||||
};
|
||||
|
||||
template<class T1, class T2>
|
||||
void pair(const std::pair<T1,T2>& data)
|
||||
{
|
||||
|
@ -22,10 +22,6 @@
|
||||
#endif
|
||||
|
||||
#include "ParallelRestart.hpp"
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
#include <dune/common/parallel/mpitraits.hh>
|
||||
|
||||
#define HANDLE_AS_POD(T) \
|
||||
@ -743,8 +739,6 @@ INSTANTIATE_PACK_VECTOR(std::map<std::string,int>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<std::string,std::vector<size_t>>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<int,std::vector<int>>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<int,std::vector<size_t>>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<RFTConfig::RFT,std::size_t>)
|
||||
INSTANTIATE_PACK_VECTOR(std::pair<RFTConfig::PLT,std::size_t>)
|
||||
INSTANTIATE_PACK_VECTOR(std::string)
|
||||
|
||||
#undef INSTANTIATE_PACK_VECTOR
|
||||
@ -770,21 +764,15 @@ INSTANTIATE_PACK(std::array<bool,3>)
|
||||
INSTANTIATE_PACK(std::array<int,3>)
|
||||
INSTANTIATE_PACK(unsigned char)
|
||||
INSTANTIATE_PACK(std::map<std::pair<int,int>,std::pair<bool,double>>)
|
||||
INSTANTIATE_PACK(std::map<FaceDir::DirEnum,std::string>)
|
||||
INSTANTIATE_PACK(std::map<FaceDir::DirEnum,std::vector<double>>)
|
||||
INSTANTIATE_PACK(std::map<std::string,std::vector<int>>)
|
||||
INSTANTIATE_PACK(std::map<std::string,std::map<std::pair<int,int>,int>>)
|
||||
INSTANTIATE_PACK(std::map<std::string,int>)
|
||||
INSTANTIATE_PACK(std::map<std::string,double>)
|
||||
INSTANTIATE_PACK(std::map<int,int>)
|
||||
INSTANTIATE_PACK(std::map<UDQVarType,std::size_t>)
|
||||
INSTANTIATE_PACK(std::unordered_map<std::string,size_t>)
|
||||
INSTANTIATE_PACK(std::unordered_map<std::string,std::string>)
|
||||
INSTANTIATE_PACK(std::unordered_set<std::string>)
|
||||
INSTANTIATE_PACK(std::set<std::string>)
|
||||
INSTANTIATE_PACK(std::pair<bool,double>)
|
||||
INSTANTIATE_PACK(std::pair<bool,std::size_t>)
|
||||
INSTANTIATE_PACK(std::pair<Phase,bool>)
|
||||
|
||||
#undef INSTANTIATE_PACK
|
||||
|
||||
|
@ -483,7 +483,8 @@ Opm::Action::ActionX getActionX()
|
||||
}
|
||||
|
||||
|
||||
Opm::AquiferCT getAquiferCT() {
|
||||
Opm::AquiferCT getAquiferCT()
|
||||
{
|
||||
Opm::AquiferCT::AQUCT_data data;
|
||||
data.aquiferID = 1;
|
||||
data.inftableID = 2;
|
||||
@ -504,7 +505,9 @@ Opm::AquiferCT getAquiferCT() {
|
||||
return Opm::AquiferCT( { data } );
|
||||
}
|
||||
|
||||
Opm::Aquifetp getAquifetp() {
|
||||
|
||||
Opm::Aquifetp getAquifetp()
|
||||
{
|
||||
Opm::Aquifetp::AQUFETP_data data;
|
||||
|
||||
data.aquiferID = 1;
|
||||
@ -518,8 +521,8 @@ Opm::Aquifetp getAquifetp() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
Opm::Aquancon getAquancon() {
|
||||
Opm::Aquancon getAquancon()
|
||||
{
|
||||
Opm::Aquancon::AquancCell cell(1, 100, std::make_pair(false, 0), 100, Opm::FaceDir::XPlus);
|
||||
return Opm::Aquancon( std::unordered_map<int, std::vector<Opm::Aquancon::AquancCell>>{{1, {cell}}});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user