Distribute Group Values at Parallel Restart

Mostly to prepare for restoring the groups' active controls from
restart information.
This commit is contained in:
Bård Skaflestad
2020-08-28 08:39:09 +02:00
parent a0373ed428
commit bdc34a7580
3 changed files with 145 additions and 6 deletions

View File

@@ -206,6 +206,7 @@ std::size_t packSize(const std::array<T,N>& data, Dune::MPIHelper::MPICommunicat
HANDLE_AS_POD(data::Connection)
HANDLE_AS_POD(data::CurrentControl)
HANDLE_AS_POD(data::GroupConstraints)
HANDLE_AS_POD(data::Rates)
HANDLE_AS_POD(data::Segment)
@@ -217,6 +218,18 @@ std::size_t packSize(const data::GuideRateValue&, Dune::MPIHelper::MPICommunicat
+ packSize(std::array<double, nItem>{}, comm);
}
std::size_t packSize(const data::GroupGuideRates& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.production, comm)
+ packSize(data.injection, comm);
}
std::size_t packSize(const data::GroupData& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.currentControl, comm)
+ packSize(data.guideRates, comm);
}
std::size_t packSize(const data::Well& data, Dune::MPIHelper::MPICommunicator comm)
{
std::size_t size = packSize(data.rates, comm);
@@ -247,6 +260,13 @@ std::size_t packSize(const data::Solution& data, Dune::MPIHelper::MPICommunicato
return packSize(static_cast<const std::map< std::string, data::CellData>&>(data), comm);
}
std::size_t packSize(const data::GroupValues& data, Dune::MPIHelper::MPICommunicator comm)
{
// Needs explicit conversion to a supported base type holding the data
// to prevent throwing.
return packSize(static_cast<const std::map<std::string, data::GroupData>&>(data), comm);
}
std::size_t packSize(const data::WellRates& data, Dune::MPIHelper::MPICommunicator comm)
{
// Needs explicit conversion to a supported base type holding the data
@@ -256,7 +276,10 @@ std::size_t packSize(const data::WellRates& data, Dune::MPIHelper::MPICommunicat
std::size_t packSize(const RestartValue& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.solution, comm) + packSize(data.wells, comm) + packSize(data.extra, comm);
return packSize(data.solution, comm)
+ packSize(data.wells, comm)
+ packSize(data.groups, comm)
+ packSize(data.extra, comm);
}
////// pack routines
@@ -467,6 +490,20 @@ void pack(const data::GuideRateValue& data, std::vector<char>& buffer, int& posi
pack(val, buffer, position, comm);
}
void pack(const data::GroupGuideRates& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.production, buffer, position, comm);
pack(data.injection, buffer, position, comm);
}
void pack(const data::GroupData& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.currentControl, buffer, position, comm);
pack(data.guideRates, buffer, position, comm);
}
void pack(const data::Well& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@@ -515,11 +552,21 @@ void pack(const data::WellRates& data, std::vector<char>& buffer, int& position,
buffer, position, comm);
}
void pack(const data::GroupValues& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
// Needs explicit conversion to a supported base type holding the data
// to prevent throwing.
pack(static_cast<const std::map< std::string, data::GroupData>&>(data),
buffer, position, comm);
}
void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.solution, buffer, position, comm);
pack(data.wells, buffer, position, comm);
pack(data.groups, buffer, position, comm);
pack(data.extra, buffer, position, comm);
}
@@ -761,6 +808,20 @@ void unpack(data::GuideRateValue& data, std::vector<char>& buffer, int& position
}
}
void unpack(data::GroupGuideRates& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.production, buffer, position, comm);
unpack(data.injection, buffer, position, comm);
}
void unpack(data::GroupData& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.currentControl, buffer, position, comm);
unpack(data.guideRates, buffer, position, comm);
}
void unpack(RestartKey& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@@ -795,11 +856,21 @@ void unpack(data::WellRates& data, std::vector<char>& buffer, int& position,
buffer, position, comm);
}
void unpack(data::GroupValues& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
// Needs explicit conversion to a supported base type holding the data
// to prevent throwing.
unpack(static_cast<std::map< std::string, data::GroupData>&>(data),
buffer, position, comm);
}
void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.solution, buffer, position, comm);
unpack(data.wells, buffer, position, comm);
unpack(data.groups, buffer, position, comm);
unpack(data.extra, buffer, position, comm);
}

View File

@@ -307,6 +307,10 @@ ADD_PACK_PROTOTYPES(data::Rates)
ADD_PACK_PROTOTYPES(data::Segment)
ADD_PACK_PROTOTYPES(data::Solution)
ADD_PACK_PROTOTYPES(data::GuideRateValue)
ADD_PACK_PROTOTYPES(data::GroupConstraints)
ADD_PACK_PROTOTYPES(data::GroupGuideRates)
ADD_PACK_PROTOTYPES(data::GroupData)
ADD_PACK_PROTOTYPES(data::GroupValues)
ADD_PACK_PROTOTYPES(data::Well)
ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(RestartKey)