add mpi serialization for GConSale

This commit is contained in:
Arne Morten Kvarving
2019-12-12 14:00:07 +01:00
parent 5de7605863
commit e7f0a00b00
3 changed files with 92 additions and 0 deletions

View File

@@ -1414,6 +1414,23 @@ std::size_t packSize(const GuideRateConfig& data,
packSize(data.getGroups(), comm);
}
std::size_t packSize(const GConSale::GCONSALEGroup& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.sales_target, comm) +
packSize(data.max_sales_rate, comm) +
packSize(data.min_sales_rate, comm) +
packSize(data.max_proc, comm) +
packSize(data.udq_undefined, comm) +
packSize(data.unit_system, comm);
}
std::size_t packSize(const GConSale& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getGroups(), comm);
}
////// pack routines
template<class T>
@@ -2850,6 +2867,25 @@ void pack(const GuideRateConfig& data,
pack(data.getGroups(), buffer, position, comm);
}
void pack(const GConSale::GCONSALEGroup& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.sales_target, buffer, position, comm);
pack(data.max_sales_rate, buffer, position, comm);
pack(data.min_sales_rate, buffer, position, comm);
pack(data.max_proc, buffer, position, comm);
pack(data.udq_undefined, buffer, position, comm);
pack(data.unit_system, buffer, position, comm);
}
void pack(const GConSale& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getGroups(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -4871,6 +4907,27 @@ void unpack(GuideRateConfig& data,
data = GuideRateConfig(model, wells, groups);
}
void unpack(GConSale::GCONSALEGroup& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.sales_target, buffer, position, comm);
unpack(data.max_sales_rate, buffer, position, comm);
unpack(data.min_sales_rate, buffer, position, comm);
unpack(data.max_proc, buffer, position, comm);
unpack(data.udq_undefined, buffer, position, comm);
unpack(data.unit_system, buffer, position, comm);
}
void unpack(GConSale& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::map<std::string,GConSale::GCONSALEGroup> groups;
unpack(groups, buffer, position, comm);
data = GConSale(groups);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -41,6 +41,7 @@
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
@@ -601,6 +602,8 @@ ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(Events)
ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(GConSale)
ADD_PACK_PROTOTYPES(GConSale::GCONSALEGroup)
ADD_PACK_PROTOTYPES(GuideRateConfig)
ADD_PACK_PROTOTYPES(GuideRateConfig::GroupTarget)
ADD_PACK_PROTOTYPES(GuideRateConfig::WellTarget)