mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
drop primitive serializer support for data:: types
This commit is contained in:
parent
42384c8052
commit
b53ab951d0
@ -32,34 +32,11 @@
|
||||
#if HAVE_MPI
|
||||
#include <ebos/eclmpiserializer.hh>
|
||||
#endif
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
#include <opm/output/data/Cells.hpp>
|
||||
#include <opm/output/data/Groups.hpp>
|
||||
#include <opm/output/data/GuideRateValue.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
|
||||
|
||||
#define HANDLE_AS_POD(T) \
|
||||
std::size_t packSize(const T& data, Opm::Parallel::MPIComm comm) \
|
||||
{ \
|
||||
return packSize(data, comm, std::integral_constant<bool,true>()); \
|
||||
} \
|
||||
void pack(const T& data, std::vector<char>& buffer, int& position, \
|
||||
Opm::Parallel::MPIComm comm) \
|
||||
{ \
|
||||
pack(data, buffer, position, comm, std::integral_constant<bool,true>()); \
|
||||
} \
|
||||
void unpack(T& data, std::vector<char>& buffer, int& position, \
|
||||
Opm::Parallel::MPIComm comm) \
|
||||
{ \
|
||||
unpack(data, buffer, position, comm, std::integral_constant<bool,true>()); \
|
||||
}
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Mpi
|
||||
@ -224,195 +201,11 @@ std::size_t packSize(const std::array<T,N>& data, Opm::Parallel::MPIComm comm)
|
||||
return N*packSize(data[0], comm);
|
||||
}
|
||||
|
||||
HANDLE_AS_POD(data::CarterTracyData)
|
||||
HANDLE_AS_POD(data::CurrentControl)
|
||||
HANDLE_AS_POD(data::FetkovichData)
|
||||
HANDLE_AS_POD(data::GroupConstraints)
|
||||
HANDLE_AS_POD(data::NodeData)
|
||||
|
||||
template <class T>
|
||||
struct Packing
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Packing<data::Rates>
|
||||
{
|
||||
static std::size_t packSize(const data::Rates& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
std::size_t totalSize = 0;
|
||||
totalSize += Mpi::packSize(data.mask, comm);
|
||||
totalSize += Mpi::packSize(data.wat, comm);
|
||||
totalSize += Mpi::packSize(data.oil, comm);
|
||||
totalSize += Mpi::packSize(data.gas, comm);
|
||||
totalSize += Mpi::packSize(data.polymer, comm);
|
||||
totalSize += Mpi::packSize(data.solvent, comm);
|
||||
totalSize += Mpi::packSize(data.energy, comm);
|
||||
totalSize += Mpi::packSize(data.dissolved_gas, comm);
|
||||
totalSize += Mpi::packSize(data.vaporized_oil, comm);
|
||||
totalSize += Mpi::packSize(data.reservoir_water, comm);
|
||||
totalSize += Mpi::packSize(data.reservoir_oil, comm);
|
||||
totalSize += Mpi::packSize(data.reservoir_gas, comm);
|
||||
totalSize += Mpi::packSize(data.productivity_index_water, comm);
|
||||
totalSize += Mpi::packSize(data.productivity_index_oil, comm);
|
||||
totalSize += Mpi::packSize(data.productivity_index_gas, comm);
|
||||
totalSize += Mpi::packSize(data.well_potential_water, comm);
|
||||
totalSize += Mpi::packSize(data.well_potential_oil, comm);
|
||||
totalSize += Mpi::packSize(data.well_potential_gas, comm);
|
||||
totalSize += Mpi::packSize(data.brine, comm);
|
||||
totalSize += Mpi::packSize(data.alq, comm);
|
||||
totalSize += Mpi::packSize(data.tracer, comm);
|
||||
totalSize += Mpi::packSize(data.micp, comm);
|
||||
totalSize += Mpi::packSize(data.vaporized_water, comm);
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
static void pack(const data::Rates& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::pack(data.mask, buffer, position, comm);
|
||||
Mpi::pack(data.wat, buffer, position, comm);
|
||||
Mpi::pack(data.oil, buffer, position, comm);
|
||||
Mpi::pack(data.gas, buffer, position, comm);
|
||||
Mpi::pack(data.polymer, buffer, position, comm);
|
||||
Mpi::pack(data.solvent, buffer, position, comm);
|
||||
Mpi::pack(data.energy, buffer, position, comm);
|
||||
Mpi::pack(data.dissolved_gas, buffer, position, comm);
|
||||
Mpi::pack(data.vaporized_oil, buffer, position, comm);
|
||||
Mpi::pack(data.reservoir_water, buffer, position, comm);
|
||||
Mpi::pack(data.reservoir_oil, buffer, position, comm);
|
||||
Mpi::pack(data.reservoir_gas, buffer, position, comm);
|
||||
Mpi::pack(data.productivity_index_water, buffer, position, comm);
|
||||
Mpi::pack(data.productivity_index_oil, buffer, position, comm);
|
||||
Mpi::pack(data.productivity_index_gas, buffer, position, comm);
|
||||
Mpi::pack(data.well_potential_water, buffer, position, comm);
|
||||
Mpi::pack(data.well_potential_oil, buffer, position, comm);
|
||||
Mpi::pack(data.well_potential_gas, buffer, position, comm);
|
||||
Mpi::pack(data.brine, buffer, position, comm);
|
||||
Mpi::pack(data.alq, buffer, position, comm);
|
||||
Mpi::pack(data.tracer, buffer, position, comm);
|
||||
Mpi::pack(data.micp, buffer, position, comm);
|
||||
Mpi::pack(data.vaporized_water, buffer, position, comm);
|
||||
}
|
||||
|
||||
static void unpack(data::Rates& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::unpack(data.mask, buffer, position, comm);
|
||||
Mpi::unpack(data.wat, buffer, position, comm);
|
||||
Mpi::unpack(data.oil, buffer, position, comm);
|
||||
Mpi::unpack(data.gas, buffer, position, comm);
|
||||
Mpi::unpack(data.polymer, buffer, position, comm);
|
||||
Mpi::unpack(data.solvent, buffer, position, comm);
|
||||
Mpi::unpack(data.energy, buffer, position, comm);
|
||||
Mpi::unpack(data.dissolved_gas, buffer, position, comm);
|
||||
Mpi::unpack(data.vaporized_oil, buffer, position, comm);
|
||||
Mpi::unpack(data.reservoir_water, buffer, position, comm);
|
||||
Mpi::unpack(data.reservoir_oil, buffer, position, comm);
|
||||
Mpi::unpack(data.reservoir_gas, buffer, position, comm);
|
||||
Mpi::unpack(data.productivity_index_water, buffer, position, comm);
|
||||
Mpi::unpack(data.productivity_index_oil, buffer, position, comm);
|
||||
Mpi::unpack(data.productivity_index_gas, buffer, position, comm);
|
||||
Mpi::unpack(data.well_potential_water, buffer, position, comm);
|
||||
Mpi::unpack(data.well_potential_oil, buffer, position, comm);
|
||||
Mpi::unpack(data.well_potential_gas, buffer, position, comm);
|
||||
Mpi::unpack(data.brine, buffer, position, comm);
|
||||
Mpi::unpack(data.alq, buffer, position, comm);
|
||||
Mpi::unpack(data.tracer, buffer, position, comm);
|
||||
Mpi::unpack(data.micp, buffer, position, comm);
|
||||
Mpi::unpack(data.vaporized_water, buffer, position, comm);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Packing<data::Connection>
|
||||
{
|
||||
static std::size_t packSize(const data::Connection& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
std::size_t totalSize = 0;
|
||||
totalSize += Mpi::packSize(data.index, comm);
|
||||
totalSize += Mpi::packSize(data.rates, comm);
|
||||
totalSize += Mpi::packSize(data.pressure, comm);
|
||||
totalSize += Mpi::packSize(data.reservoir_rate, comm);
|
||||
totalSize += Mpi::packSize(data.cell_pressure, comm);
|
||||
totalSize += Mpi::packSize(data.cell_saturation_water, comm);
|
||||
totalSize += Mpi::packSize(data.cell_saturation_gas, comm);
|
||||
totalSize += Mpi::packSize(data.effective_Kh, comm);
|
||||
totalSize += Mpi::packSize(data.trans_factor, comm);
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
static void pack(const data::Connection& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::pack(data.index, buffer, position, comm);
|
||||
Mpi::pack(data.rates, buffer, position, comm);
|
||||
Mpi::pack(data.pressure, buffer, position, comm);
|
||||
Mpi::pack(data.reservoir_rate, buffer, position, comm);
|
||||
Mpi::pack(data.cell_pressure, buffer, position, comm);
|
||||
Mpi::pack(data.cell_saturation_water, buffer, position, comm);
|
||||
Mpi::pack(data.cell_saturation_gas, buffer, position, comm);
|
||||
Mpi::pack(data.effective_Kh, buffer, position, comm);
|
||||
Mpi::pack(data.trans_factor, buffer, position, comm);
|
||||
}
|
||||
|
||||
static void unpack(data::Connection& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::unpack(data.index, buffer, position, comm);
|
||||
Mpi::unpack(data.rates, buffer, position, comm);
|
||||
Mpi::unpack(data.pressure, buffer, position, comm);
|
||||
Mpi::unpack(data.reservoir_rate, buffer, position, comm);
|
||||
Mpi::unpack(data.cell_pressure, buffer, position, comm);
|
||||
Mpi::unpack(data.cell_saturation_water, buffer, position, comm);
|
||||
Mpi::unpack(data.cell_saturation_gas, buffer, position, comm);
|
||||
Mpi::unpack(data.effective_Kh, buffer, position, comm);
|
||||
Mpi::unpack(data.trans_factor, buffer, position, comm);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Packing<data::SegmentPressures>
|
||||
{
|
||||
static std::size_t packSize(const data::SegmentPressures& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Mpi::packSize(data.values_, comm);
|
||||
}
|
||||
|
||||
static void pack(const data::SegmentPressures& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::pack(data.values_, buffer, position, comm);
|
||||
}
|
||||
|
||||
static void unpack(data::SegmentPressures& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::unpack(data.values_, buffer, position, comm);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Packing<data::Segment>
|
||||
{
|
||||
static std::size_t packSize(const data::Segment& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
std::size_t totalSize = 0;
|
||||
totalSize += Mpi::packSize(data.rates, comm);
|
||||
totalSize += Mpi::packSize(data.pressures, comm);
|
||||
totalSize += Mpi::packSize(data.segNumber, comm);
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
static void pack(const data::Segment& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::pack(data.rates, buffer, position, comm);
|
||||
Mpi::pack(data.pressures, buffer, position, comm);
|
||||
Mpi::pack(data.segNumber, buffer, position, comm);
|
||||
}
|
||||
|
||||
static void unpack(data::Segment& data, std::vector<char>& buffer, int& position, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Mpi::unpack(data.rates, buffer, position, comm);
|
||||
Mpi::unpack(data.pressures, buffer, position, comm);
|
||||
Mpi::unpack(data.segNumber, buffer, position, comm);
|
||||
}
|
||||
};
|
||||
|
||||
template <std::size_t Size>
|
||||
struct Packing<std::bitset<Size>>
|
||||
{
|
||||
@ -434,140 +227,12 @@ struct Packing<std::bitset<Size>>
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t packSize(const data::NumericAquiferData& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.initPressure, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::AquiferData& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
const auto type = 0ull;
|
||||
|
||||
const auto base = packSize(data.aquiferID, comm)
|
||||
+ packSize(data.pressure, comm)
|
||||
+ packSize(data.fluxRate, comm)
|
||||
+ packSize(data.volume, comm)
|
||||
+ packSize(data.initPressure, comm)
|
||||
+ packSize(data.datumDepth, comm)
|
||||
+ packSize(type, comm);
|
||||
|
||||
if (auto const* aquFet = data.typeData.get<data::AquiferType::Fetkovich>();
|
||||
aquFet != nullptr)
|
||||
{
|
||||
return base + packSize(*aquFet, comm);
|
||||
}
|
||||
else if (auto const* aquCT = data.typeData.get<data::AquiferType::CarterTracy>();
|
||||
aquCT != nullptr)
|
||||
{
|
||||
return base + packSize(*aquCT, comm);
|
||||
}
|
||||
else if (auto const* aquNum = data.typeData.get<data::AquiferType::Numerical>();
|
||||
aquNum != nullptr)
|
||||
{
|
||||
return base + packSize(*aquNum, comm);
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::GuideRateValue&, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
const auto nItem = static_cast<std::size_t>(data::GuideRateValue::Item::NumItems);
|
||||
|
||||
return packSize(std::array<int , nItem>{}, comm)
|
||||
+ packSize(std::array<double, nItem>{}, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::GroupGuideRates& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.production, comm)
|
||||
+ packSize(data.injection, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::GroupData& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.currentControl, comm)
|
||||
+ packSize(data.guideRates, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Well& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
std::size_t size = packSize(data.rates, comm);
|
||||
size += packSize(data.bhp, comm) + packSize(data.thp, comm);
|
||||
size += packSize(data.temperature, comm);
|
||||
size += packSize(data.control, comm);
|
||||
size += packSize(data.connections, comm);
|
||||
size += packSize(data.segments, comm);
|
||||
size += packSize(data.current_control, comm);
|
||||
size += packSize(data.guide_rates, comm);
|
||||
return size;
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Rates& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Packing<data::Rates>::packSize(data, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Connection& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Packing<data::Connection>::packSize(data, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::SegmentPressures& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Packing<data::SegmentPressures>::packSize(data, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Segment& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Packing<data::Segment>::packSize(data, comm);
|
||||
}
|
||||
|
||||
template<std::size_t Size>
|
||||
std::size_t packSize(const std::bitset<Size>& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return Packing<std::bitset<Size>>::packSize(data, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::CellData& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.dim, comm) + packSize(data.data, comm) + packSize(data.target, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const RestartKey& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.key, comm) + packSize(data.dim, comm) + packSize(data.required, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Solution& data, Opm::Parallel::MPIComm 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::CellData>&>(data), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::GroupAndNetworkValues& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.groupData, comm)
|
||||
+ packSize(data.nodeData, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::Wells& data, Opm::Parallel::MPIComm 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::Well>&>(data), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const RestartValue& data, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
return packSize(data.solution, comm)
|
||||
+ packSize(data.wells, comm)
|
||||
+ packSize(data.grp_nwrk, comm)
|
||||
+ packSize(data.aquifer, comm)
|
||||
+ packSize(data.extra, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Opm::time_point&, Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
std::time_t tp = 0;
|
||||
@ -761,153 +426,6 @@ void pack(const std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer
|
||||
}
|
||||
}
|
||||
|
||||
void pack(const data::NumericAquiferData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.initPressure, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::AquiferData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
const auto type =
|
||||
(data.typeData.is<data::AquiferType::Fetkovich>() * (1ull << 0))
|
||||
+ (data.typeData.is<data::AquiferType::CarterTracy>() * (1ull << 1))
|
||||
+ (data.typeData.is<data::AquiferType::Numerical>() * (1ull << 2));
|
||||
|
||||
pack(data.aquiferID, buffer, position, comm);
|
||||
pack(data.pressure, buffer, position, comm);
|
||||
pack(data.fluxRate, buffer, position, comm);
|
||||
pack(data.volume, buffer, position, comm);
|
||||
pack(data.initPressure, buffer, position, comm);
|
||||
pack(data.datumDepth, buffer, position, comm);
|
||||
pack(type, buffer, position, comm);
|
||||
|
||||
if (auto const* aquFet = data.typeData.get<data::AquiferType::Fetkovich>();
|
||||
aquFet != nullptr)
|
||||
{
|
||||
pack(*aquFet, buffer, position, comm);
|
||||
}
|
||||
else if (auto const* aquCT = data.typeData.get<data::AquiferType::CarterTracy>();
|
||||
aquCT != nullptr)
|
||||
{
|
||||
pack(*aquCT, buffer, position, comm);
|
||||
}
|
||||
else if (auto const* aquNum = data.typeData.get<data::AquiferType::Numerical>();
|
||||
aquNum != nullptr)
|
||||
{
|
||||
pack(*aquNum, buffer, position, comm);
|
||||
}
|
||||
}
|
||||
|
||||
void pack(const data::GuideRateValue& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
using Item = data::GuideRateValue::Item;
|
||||
const auto nItem = static_cast<std::size_t>(Item::NumItems);
|
||||
|
||||
auto has = std::array<int , nItem>{}; has.fill(0);
|
||||
auto val = std::array<double, nItem>{}; val.fill(0.0);
|
||||
|
||||
for (auto itemID = 0*nItem; itemID < nItem; ++itemID) {
|
||||
const auto item = static_cast<Item>(itemID);
|
||||
|
||||
if (data.has(item)) {
|
||||
has[itemID] = 1;
|
||||
val[itemID] = data.get(item);
|
||||
}
|
||||
}
|
||||
|
||||
pack(has, buffer, position, comm);
|
||||
pack(val, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::GroupGuideRates& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm 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,
|
||||
Opm::Parallel::MPIComm 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,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.rates, buffer, position, comm);
|
||||
pack(data.bhp, buffer, position, comm);
|
||||
pack(data.thp, buffer, position, comm);
|
||||
pack(data.temperature, buffer, position, comm);
|
||||
pack(data.control, buffer, position, comm);
|
||||
pack(data.connections, buffer, position, comm);
|
||||
pack(data.segments, buffer, position, comm);
|
||||
pack(data.current_control, buffer, position, comm);
|
||||
pack(data.guide_rates, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const RestartKey& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.key, buffer, position, comm);
|
||||
pack(data.dim, buffer, position, comm);
|
||||
pack(data.required, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::CellData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.dim, buffer, position, comm);
|
||||
pack(data.data, buffer, position, comm);
|
||||
pack(data.target, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::Solution& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
pack(static_cast<const std::map< std::string, data::CellData>&>(data),
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::Wells& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
pack(static_cast<const std::map< std::string, data::Well>&>(data),
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::Rates& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Rates>::pack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::Connection& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Connection>::pack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::SegmentPressures& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::SegmentPressures>::pack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::Segment& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Segment>::pack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<std::size_t Size>
|
||||
void pack(const std::bitset<Size>& data, std::vector<char>& buffer,
|
||||
int& position, Opm::Parallel::MPIComm comm)
|
||||
@ -915,23 +433,6 @@ void pack(const std::bitset<Size>& data, std::vector<char>& buffer,
|
||||
Packing<std::bitset<Size>>::pack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::GroupAndNetworkValues& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.groupData, buffer, position, comm);
|
||||
pack(data.nodeData, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
pack(data.solution, buffer, position, comm);
|
||||
pack(data.wells, buffer, position, comm);
|
||||
pack(data.grp_nwrk, buffer, position, comm);
|
||||
pack(data.aquifer, buffer, position, comm);
|
||||
pack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Opm::time_point& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
@ -1146,144 +647,6 @@ void unpack(std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer, in
|
||||
}
|
||||
}
|
||||
|
||||
void unpack(data::Well& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.rates, buffer, position, comm);
|
||||
unpack(data.bhp, buffer, position, comm);
|
||||
unpack(data.thp, buffer, position, comm);
|
||||
unpack(data.temperature, buffer, position, comm);
|
||||
unpack(data.control, buffer, position, comm);
|
||||
unpack(data.connections, buffer, position, comm);
|
||||
unpack(data.segments, buffer, position, comm);
|
||||
unpack(data.current_control, buffer, position, comm);
|
||||
unpack(data.guide_rates, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::NumericAquiferData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.initPressure, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::AquiferData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
auto type = 0ull;
|
||||
|
||||
unpack(data.aquiferID, buffer, position, comm);
|
||||
unpack(data.pressure, buffer, position, comm);
|
||||
unpack(data.fluxRate, buffer, position, comm);
|
||||
unpack(data.volume, buffer, position, comm);
|
||||
unpack(data.initPressure, buffer, position, comm);
|
||||
unpack(data.datumDepth, buffer, position, comm);
|
||||
unpack(type, buffer, position, comm);
|
||||
|
||||
if (type == (1ull << 0)) {
|
||||
auto* aquFet = data.typeData.create<data::AquiferType::Fetkovich>();
|
||||
unpack(*aquFet, buffer, position, comm);
|
||||
}
|
||||
else if (type == (1ull << 1)) {
|
||||
auto* aquCT = data.typeData.create<data::AquiferType::CarterTracy>();
|
||||
unpack(*aquCT, buffer, position, comm);
|
||||
}
|
||||
else if (type == (1ull << 2)) {
|
||||
auto* aquNum = data.typeData.create<data::AquiferType::Numerical>();
|
||||
unpack(*aquNum, buffer, position, comm);
|
||||
}
|
||||
}
|
||||
|
||||
void unpack(data::GuideRateValue& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
using Item = data::GuideRateValue::Item;
|
||||
const auto nItem = static_cast<std::size_t>(Item::NumItems);
|
||||
|
||||
auto has = std::array<int , nItem>{};
|
||||
auto val = std::array<double, nItem>{};
|
||||
|
||||
unpack(has, buffer, position, comm);
|
||||
unpack(val, buffer, position, comm);
|
||||
|
||||
for (auto itemID = 0*nItem; itemID < nItem; ++itemID) {
|
||||
if (has[itemID] != 0) {
|
||||
data.set(static_cast<Item>(itemID), val[itemID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void unpack(data::GroupGuideRates& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.production, buffer, position, comm);
|
||||
unpack(data.injection, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::GroupData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.currentControl, buffer, position, comm);
|
||||
unpack(data.guideRates, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(RestartKey& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.key, buffer, position, comm);
|
||||
unpack(data.dim, buffer, position, comm);
|
||||
unpack(data.required, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::CellData& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.dim, buffer, position, comm);
|
||||
unpack(data.data, buffer, position, comm);
|
||||
unpack(data.target, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::Solution& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
unpack(static_cast<std::map< std::string, data::CellData>&>(data),
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::Wells& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
unpack(static_cast<std::map< std::string, data::Well>&>(data),
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::Rates& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Rates>::unpack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::Connection& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Connection>::unpack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::SegmentPressures& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::SegmentPressures>::unpack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::Segment& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
Packing<data::Segment>::unpack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<std::size_t Size>
|
||||
void unpack(std::bitset<Size>& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
@ -1291,23 +654,6 @@ void unpack(std::bitset<Size>& data, std::vector<char>& buffer, int& position,
|
||||
Packing<std::bitset<Size>>::unpack(data, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::GroupAndNetworkValues& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.groupData, buffer, position, comm);
|
||||
unpack(data.nodeData, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
unpack(data.solution, buffer, position, comm);
|
||||
unpack(data.wells, buffer, position, comm);
|
||||
unpack(data.grp_nwrk, buffer, position, comm);
|
||||
unpack(data.aquifer, buffer, position, comm);
|
||||
unpack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack([[maybe_unused]] Opm::time_point& data, std::vector<char>& buffer, int& position,
|
||||
Opm::Parallel::MPIComm comm)
|
||||
{
|
||||
|
@ -52,29 +52,6 @@ class SummaryState;
|
||||
class RestartKey;
|
||||
class RestartValue;
|
||||
|
||||
namespace data
|
||||
{
|
||||
struct AquiferData;
|
||||
struct CarterTracyData;
|
||||
struct CellData;
|
||||
struct Connection;
|
||||
struct CurrentControl;
|
||||
struct FetkovichData;
|
||||
class GroupAndNetworkValues;
|
||||
struct GroupConstraints;
|
||||
struct GroupData;
|
||||
struct GroupGuideRates;
|
||||
class GuideRateValue;
|
||||
struct NodeData;
|
||||
struct NumericAquiferData;
|
||||
class Rates;
|
||||
struct Segment;
|
||||
class SegmentPressures;
|
||||
class Solution;
|
||||
struct Well;
|
||||
class Wells;
|
||||
}
|
||||
|
||||
namespace Action
|
||||
{
|
||||
class State;
|
||||
@ -352,27 +329,6 @@ void unpack(std::bitset<Size>& data, std::vector<char>& buffer, int& position,
|
||||
void unpack(T& data, std::vector<char>& buffer, int& position, \
|
||||
Opm::Parallel::MPIComm comm);
|
||||
|
||||
ADD_PACK_PROTOTYPES(data::AquiferData)
|
||||
ADD_PACK_PROTOTYPES(data::CarterTracyData)
|
||||
ADD_PACK_PROTOTYPES(data::CellData)
|
||||
ADD_PACK_PROTOTYPES(data::Connection)
|
||||
ADD_PACK_PROTOTYPES(data::CurrentControl)
|
||||
ADD_PACK_PROTOTYPES(data::FetkovichData)
|
||||
ADD_PACK_PROTOTYPES(data::Rates)
|
||||
ADD_PACK_PROTOTYPES(data::Segment)
|
||||
ADD_PACK_PROTOTYPES(data::SegmentPressures)
|
||||
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::NodeData)
|
||||
ADD_PACK_PROTOTYPES(data::GroupAndNetworkValues)
|
||||
ADD_PACK_PROTOTYPES(data::NumericAquiferData)
|
||||
ADD_PACK_PROTOTYPES(data::Well)
|
||||
ADD_PACK_PROTOTYPES(data::Wells)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(time_point)
|
||||
|
||||
|
@ -128,214 +128,8 @@
|
||||
#include <ebos/eclmpiserializer.hh>
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
Opm::data::Solution getSolution()
|
||||
{
|
||||
Opm::data::Solution sol1;
|
||||
sol1.insert("testdata", Opm::UnitSystem::measure::length,
|
||||
{1.0, 2.0, 3.0}, Opm::data::TargetType::RESTART_SOLUTION);
|
||||
return sol1;
|
||||
}
|
||||
|
||||
|
||||
Opm::data::Rates getRates()
|
||||
{
|
||||
Opm::data::Rates rat1;
|
||||
rat1.set(Opm::data::Rates::opt::wat, 1.0);
|
||||
rat1.set(Opm::data::Rates::opt::oil, 2.0);
|
||||
rat1.set(Opm::data::Rates::opt::gas, 3.0);
|
||||
rat1.set(Opm::data::Rates::opt::polymer, 4.0);
|
||||
rat1.set(Opm::data::Rates::opt::solvent, 5.0);
|
||||
rat1.set(Opm::data::Rates::opt::energy, 6.0);
|
||||
rat1.set(Opm::data::Rates::opt::dissolved_gas, 7.0);
|
||||
rat1.set(Opm::data::Rates::opt::vaporized_oil, 8.0);
|
||||
rat1.set(Opm::data::Rates::opt::reservoir_water, 9.0);
|
||||
rat1.set(Opm::data::Rates::opt::reservoir_oil, 10.0);
|
||||
rat1.set(Opm::data::Rates::opt::reservoir_gas, 11.0);
|
||||
rat1.set(Opm::data::Rates::opt::productivity_index_water, 12.0);
|
||||
rat1.set(Opm::data::Rates::opt::productivity_index_oil, 13.0);
|
||||
rat1.set(Opm::data::Rates::opt::productivity_index_gas, 14.0);
|
||||
rat1.set(Opm::data::Rates::opt::well_potential_water, 15.0);
|
||||
rat1.set(Opm::data::Rates::opt::well_potential_oil, 16.0);
|
||||
rat1.set(Opm::data::Rates::opt::well_potential_gas, 17.0);
|
||||
|
||||
return rat1;
|
||||
}
|
||||
|
||||
|
||||
Opm::data::Connection getConnection()
|
||||
{
|
||||
Opm::data::Connection con1;
|
||||
con1.rates = getRates();
|
||||
con1.index = 1;
|
||||
con1.pressure = 2.0;
|
||||
con1.reservoir_rate = 3.0;
|
||||
con1.cell_pressure = 4.0;
|
||||
con1.cell_saturation_water = 5.0;
|
||||
con1.cell_saturation_gas = 6.0;
|
||||
con1.effective_Kh = 7.0;
|
||||
con1.trans_factor = 8.0;
|
||||
|
||||
return con1;
|
||||
}
|
||||
|
||||
|
||||
Opm::data::Segment getSegment()
|
||||
{
|
||||
Opm::data::Segment seg1;
|
||||
seg1.rates = getRates();
|
||||
seg1.segNumber = 1;
|
||||
const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure;
|
||||
seg1.pressures[pres_idx] = 2.0;
|
||||
return seg1;
|
||||
}
|
||||
|
||||
|
||||
Opm::data::CurrentControl getCurrentControl()
|
||||
{
|
||||
Opm::data::CurrentControl curr;
|
||||
curr.isProducer = true;
|
||||
curr.prod = ::Opm::Well::ProducerCMode::CRAT;
|
||||
return curr;
|
||||
}
|
||||
|
||||
Opm::data::GuideRateValue getWellGuideRate()
|
||||
{
|
||||
using Item = Opm::data::GuideRateValue::Item;
|
||||
|
||||
return Opm::data::GuideRateValue{}.set(Item::Oil , 1.23)
|
||||
.set(Item::Gas , 2.34)
|
||||
.set(Item::Water, 3.45)
|
||||
.set(Item::ResV , 4.56);
|
||||
}
|
||||
|
||||
Opm::data::Well getWell()
|
||||
{
|
||||
Opm::data::Well well1;
|
||||
well1.rates = getRates();
|
||||
well1.bhp = 1.0;
|
||||
well1.thp = 2.0;
|
||||
well1.temperature = 3.0;
|
||||
well1.control = 4;
|
||||
well1.connections.push_back(getConnection());
|
||||
well1.segments.insert({0, getSegment()});
|
||||
well1.current_control = getCurrentControl();
|
||||
well1.guide_rates = getWellGuideRate();
|
||||
return well1;
|
||||
}
|
||||
|
||||
Opm::data::GroupGuideRates getGroupGuideRates()
|
||||
{
|
||||
using Item = Opm::data::GuideRateValue::Item;
|
||||
|
||||
auto gr = Opm::data::GroupGuideRates{};
|
||||
|
||||
gr.production.set(Item::Oil , 999.888)
|
||||
.set(Item::Gas , 8888.777)
|
||||
.set(Item::ResV, 12345.678);
|
||||
|
||||
gr.injection.set(Item::Gas , 9876.543)
|
||||
.set(Item::Water, 2345.987);
|
||||
|
||||
return gr;
|
||||
}
|
||||
|
||||
Opm::data::GroupConstraints getGroupConstraints()
|
||||
{
|
||||
using PMode = ::Opm::Group::ProductionCMode;
|
||||
using IMode = ::Opm::Group::InjectionCMode;
|
||||
|
||||
return Opm::data::GroupConstraints{}
|
||||
.set(PMode::ORAT, // Production
|
||||
IMode::VREP, // Gas Injection
|
||||
IMode::NONE); // Water Injection
|
||||
}
|
||||
|
||||
Opm::data::GroupData getGroupData()
|
||||
{
|
||||
return Opm::data::GroupData {
|
||||
getGroupConstraints(),
|
||||
getGroupGuideRates()
|
||||
};
|
||||
}
|
||||
|
||||
Opm::data::NodeData getNodeData()
|
||||
{
|
||||
return Opm::data::NodeData {
|
||||
123.457
|
||||
};
|
||||
}
|
||||
|
||||
Opm::data::AquiferData getFetkovichAquifer(const int aquiferID = 1)
|
||||
{
|
||||
auto aquifer = Opm::data::AquiferData {
|
||||
aquiferID, 123.456, 56.78, 9.0e10, 290.0, 2515.5
|
||||
};
|
||||
|
||||
auto* aquFet = aquifer.typeData.create<Opm::data::AquiferType::Fetkovich>();
|
||||
|
||||
aquFet->initVolume = 1.23;
|
||||
aquFet->prodIndex = 45.67;
|
||||
aquFet->timeConstant = 890.123;
|
||||
|
||||
return aquifer;
|
||||
}
|
||||
|
||||
Opm::data::AquiferData getCarterTracyAquifer(const int aquiferID = 5)
|
||||
{
|
||||
auto aquifer = Opm::data::AquiferData {
|
||||
aquiferID, 123.456, 56.78, 9.0e10, 290.0, 2515.5
|
||||
};
|
||||
|
||||
auto* aquCT = aquifer.typeData.create<Opm::data::AquiferType::CarterTracy>();
|
||||
|
||||
aquCT->timeConstant = 987.65;
|
||||
aquCT->influxConstant = 43.21;
|
||||
aquCT->waterDensity = 1014.5;
|
||||
aquCT->waterViscosity = 0.00318;
|
||||
aquCT->dimensionless_time = 42.0;
|
||||
aquCT->dimensionless_pressure = 2.34;
|
||||
|
||||
return aquifer;
|
||||
}
|
||||
|
||||
Opm::data::AquiferData getNumericalAquifer(const int aquiferID = 2)
|
||||
{
|
||||
auto aquifer = Opm::data::AquiferData {
|
||||
aquiferID, 123.456, 56.78, 9.0e10, 290.0, 2515.5
|
||||
};
|
||||
|
||||
auto* aquNum = aquifer.typeData.create<Opm::data::AquiferType::Numerical>();
|
||||
|
||||
aquNum->initPressure.push_back(1.234);
|
||||
aquNum->initPressure.push_back(2.345);
|
||||
aquNum->initPressure.push_back(3.4);
|
||||
aquNum->initPressure.push_back(9.876);
|
||||
|
||||
return aquifer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
std::tuple<T,int,int> PackUnpack(const T& in)
|
||||
{
|
||||
auto comm = Dune::MPIHelper::getCollectiveCommunication();
|
||||
std::size_t packSize = Opm::Mpi::packSize(in, comm);
|
||||
std::vector<char> buffer(packSize);
|
||||
int pos1 = 0;
|
||||
Opm::Mpi::pack(in, buffer, pos1, comm);
|
||||
int pos2 = 0;
|
||||
T out;
|
||||
Opm::Mpi::unpack(out, buffer, pos2, comm);
|
||||
|
||||
return std::make_tuple(out, pos1, pos2);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
std::tuple<T,int,int> PackUnpack2(T& in)
|
||||
std::tuple<T,int,int> PackUnpack(T& in)
|
||||
{
|
||||
auto comm = Dune::MPIHelper::getCollectiveCommunication();
|
||||
Opm::EclMpiSerializer ser(comm);
|
||||
@ -349,206 +143,13 @@ std::tuple<T,int,int> PackUnpack2(T& in)
|
||||
}
|
||||
|
||||
|
||||
#define DO_CHECKS(TYPE_NAME) \
|
||||
BOOST_CHECK_MESSAGE(std::get<1>(val2) == std::get<2>(val2), "Packed size differ from unpack size for " #TYPE_NAME); \
|
||||
BOOST_CHECK_MESSAGE(val1 == std::get<0>(val2), "Deserialized " #TYPE_NAME " differ");
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Solution_)
|
||||
{
|
||||
Opm::data::Solution val1 = getSolution();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Solution)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Rates_)
|
||||
{
|
||||
Opm::data::Rates val1 = getRates();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Rates)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataFetkovichData)
|
||||
{
|
||||
const auto val1 = getFetkovichAquifer();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::FetkovichData)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataCarterTracyData)
|
||||
{
|
||||
const auto val1 = getCarterTracyAquifer();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::CarterTracyData)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataNumericAquiferData)
|
||||
{
|
||||
const auto val1 = getNumericalAquifer();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::NumericAquiferData)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataAquifers)
|
||||
{
|
||||
const auto val1 = Opm::data::Aquifers {
|
||||
{ 1, getFetkovichAquifer(1) },
|
||||
{ 4, getFetkovichAquifer(4) },
|
||||
{ 5, getCarterTracyAquifer(5) },
|
||||
{ 9, getNumericalAquifer(9) },
|
||||
};
|
||||
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::Aquifers)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataGuideRateValue)
|
||||
{
|
||||
using Item = Opm::data::GuideRateValue::Item;
|
||||
|
||||
const auto val1 = Opm::data::GuideRateValue{}
|
||||
.set(Item::Oil , 999.888)
|
||||
.set(Item::Gas , 8888.777)
|
||||
.set(Item::ResV, 12345.678);
|
||||
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
BOOST_CHECK_MESSAGE(! std::get<0>(val2).has(Item::Water),
|
||||
"Water Must Not Appear From "
|
||||
"Serializing GuideRateValues");
|
||||
|
||||
DO_CHECKS(data::GuideRateValue)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataConnection_)
|
||||
{
|
||||
Opm::data::Connection val1 = getConnection();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Connection)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataCurrentControl)
|
||||
{
|
||||
Opm::data::CurrentControl val1 = getCurrentControl();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::CurrentControl)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataSegment_)
|
||||
{
|
||||
Opm::data::Segment val1 = getSegment();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Segment)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataWell_)
|
||||
{
|
||||
Opm::data::Well val1 = getWell();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Well)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Wells_)
|
||||
{
|
||||
Opm::data::Wells val1;
|
||||
val1.insert({"test_well", getWell()});
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::Wells)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataGroupConstraints)
|
||||
{
|
||||
const auto val1 = getGroupConstraints();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::GroupConstraints)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataGroupGuideRates)
|
||||
{
|
||||
const auto val1 = getGroupData().guideRates;
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::GroupGuideRates)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataGroupData)
|
||||
{
|
||||
const auto val1 = getGroupData();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::GroupData)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dataNodeData)
|
||||
{
|
||||
const auto val1 = getNodeData();
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(data::NodeData)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CellData_)
|
||||
{
|
||||
Opm::data::CellData val1;
|
||||
val1.dim = Opm::UnitSystem::measure::length;
|
||||
val1.data = {1.0, 2.0, 3.0};
|
||||
val1.target = Opm::data::TargetType::RESTART_SOLUTION;
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(data::cellData)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RestartKey_)
|
||||
{
|
||||
Opm::RestartKey val1("key", Opm::UnitSystem::measure::length, true);
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(RestartKey)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RestartValue_)
|
||||
{
|
||||
auto wells1 = Opm::data::Wells {{
|
||||
{ "test_well", getWell() },
|
||||
}};
|
||||
auto grp_nwrk_1 = Opm::data::GroupAndNetworkValues {
|
||||
{ // .groupData
|
||||
{ "test_group1", getGroupData() },
|
||||
},
|
||||
{ // .nodeData
|
||||
{ "test_node1", getNodeData() },
|
||||
}
|
||||
};
|
||||
|
||||
auto aquifers = Opm::data::Aquifers {
|
||||
{ 2, getCarterTracyAquifer(2) },
|
||||
{11, getFetkovichAquifer(11) },
|
||||
};
|
||||
|
||||
const auto val1 = Opm::RestartValue {
|
||||
getSolution(), std::move(wells1), std::move(grp_nwrk_1), std::move(aquifers)
|
||||
};
|
||||
const auto val2 = PackUnpack(val1);
|
||||
|
||||
DO_CHECKS(RestartValue)
|
||||
}
|
||||
|
||||
#define TEST_FOR_TYPE_NAMED_OBJ(TYPE, NAME, OBJ) \
|
||||
BOOST_AUTO_TEST_CASE(NAME) \
|
||||
{ \
|
||||
auto val1 = Opm::TYPE::OBJ(); \
|
||||
auto val2 = PackUnpack2(val1); \
|
||||
DO_CHECKS(TYPE) \
|
||||
auto val2 = PackUnpack(val1); \
|
||||
BOOST_CHECK_MESSAGE(std::get<1>(val2) == std::get<2>(val2), "Packed size differ from unpack size for " #TYPE); \
|
||||
BOOST_CHECK_MESSAGE(val1 == std::get<0>(val2), "Deserialized " #TYPE " differ"); \
|
||||
}
|
||||
|
||||
#define TEST_FOR_TYPE_NAMED(TYPE, NAME) \
|
||||
|
Loading…
Reference in New Issue
Block a user