mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for GConSale
This commit is contained in:
parent
5de7605863
commit
e7f0a00b00
@ -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); \
|
||||
|
@ -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)
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.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/GuideRateModel.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
|
||||
@ -1902,6 +1903,37 @@ BOOST_AUTO_TEST_CASE(GuideRateConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GConSaleGroup)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::GConSale::GCONSALEGroup val1{Opm::UDAValue(1.0),
|
||||
Opm::UDAValue(2.0),
|
||||
Opm::UDAValue(3.0),
|
||||
Opm::GConSale::MaxProcedure::PLUG,
|
||||
4.0, Opm::UnitSystem()};
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GConSale)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::GConSale::GCONSALEGroup group{Opm::UDAValue(1.0),
|
||||
Opm::UDAValue(2.0),
|
||||
Opm::UDAValue(3.0),
|
||||
Opm::GConSale::MaxProcedure::PLUG,
|
||||
4.0, Opm::UnitSystem()};
|
||||
Opm::GConSale val1({{"test1", group}, {"test2", group}});
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool init_unit_test_func()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user