/* Copyright 2019 Equinor AS. This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OPM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OPM. If not, see . */ #ifndef PARALLEL_RESTART_HPP #define PARALLEL_RESTART_HPP #if HAVE_MPI #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Opm { class Actdims; class Aqudims; class ColumnSchema; class Connection; class DENSITYRecord; class DensityTable; class Dimension; class EclHysterConfig; class Eqldims; class EDITNNC; class EndpointScaling; class Equil; class EquilRecord; class Events; class FoamConfig; class FoamData; class GuideRateModel; class InitConfig; class IOConfig; template class IOrderSet; class JFunc; class MessageLimits; class MLimits; class NNC; struct NNCdata; class OilVaporizationProperties; class Phases; class PlymwinjTable; class PolyInjTable; class PVCDORecord; class PvcdoTable; class PvtgTable; class PvtoTable; class PVTWRecord; class PvtwTable; class Regdims; class RestartConfig; class RestartSchedule; class ROCKRecord; class RockTable; class Rock2dTable; class Rock2dtrTable; class Runspec; class Segment; class SimulationConfig; class SimpleTable; class SkprpolyTable; class SkprwatTable; class SpiralICD; class Tabdims; class TableColumn; class TableContainer; class TableManager; class TableSchema; class ThresholdPressure; class UDAValue; class UDQASTNode; class UDQConfig; class UDQDefine; class UDQFunction; class UDQFunctionTable; class UDQIndex; class UDQParams; class UnitSystem; class Valve; class VFPInjTable; class VFPProdTable; class VISCREFRecord; class ViscrefTable; class WATDENTRecord; class WatdentTable; class WellConnections; class Welldims; class WellEconProductionLimits; class WellFoamProperties; class WellPolymerProperties; class WellSegmentDims; class WellSegments; class WellTracerProperties; class WList; class WListManager; namespace Mpi { template std::size_t packSize(const T*, std::size_t, Dune::MPIHelper::MPICommunicator, std::integral_constant); template std::size_t packSize(const T*, std::size_t l, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template std::size_t packSize(const T* data, std::size_t l, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const T&, Dune::MPIHelper::MPICommunicator, std::integral_constant); template std::size_t packSize(const T&, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template std::size_t packSize(const T& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::pair& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::vector& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::unordered_set& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::vector& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::tuple& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::shared_ptr& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::array& data, Dune::MPIHelper::MPICommunicator comm); std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm); std::size_t packSize(const std::string& str, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::map& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const std::unordered_map& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const OrderedMap& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const DynamicVector& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const DynamicState& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const Tabulated1DFunction& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const IntervalTabulated2DFunction& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const UniformXTabulated2DFunction& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const SolventPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const GasPvtMultiplexer& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const DryGasPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const GasPvtThermal& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const WetGasPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const OilPvtMultiplexer& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const ConstantCompressibilityOilPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const DeadOilPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const LiveOilPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const OilPvtThermal& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const WaterPvtMultiplexer& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const ConstantCompressibilityWaterPvt& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const WaterPvtThermal& data, Dune::MPIHelper::MPICommunicator comm); template std::size_t packSize(const IOrderSet& data, Dune::MPIHelper::MPICommunicator comm); ////// pack routines template void pack(const T*, std::size_t, std::vector&, int&, Dune::MPIHelper::MPICommunicator, std::integral_constant); template void pack(const T* data, std::size_t l, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template void pack(const T* data, std::size_t l, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const T&, std::vector&, int&, Dune::MPIHelper::MPICommunicator, std::integral_constant); template void pack(const T& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template void pack(const T& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::pair& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::vector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::vector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::tuple& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::unordered_set& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::shared_ptr& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::array& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const std::unordered_map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const OrderedMap& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const DynamicState& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const DynamicVector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const Tabulated1DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const IntervalTabulated2DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const UniformXTabulated2DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const SolventPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const GasPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const DryGasPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const GasPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const WetGasPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const OilPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const ConstantCompressibilityOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const DeadOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const LiveOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const WaterPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const ConstantCompressibilityWaterPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const WaterPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void pack(const IOrderSet& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); void pack(const char* str, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); /// unpack routines template void unpack(T*, const std::size_t&, std::vector&, int&, Dune::MPIHelper::MPICommunicator, std::integral_constant); template void unpack(T* data, const std::size_t& l, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template void unpack(T* data, const std::size_t& l, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(T&, std::vector&, int&, Dune::MPIHelper::MPICommunicator, std::integral_constant); template void unpack(T& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm, std::integral_constant); template void unpack(T& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::pair& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::vector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::vector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::tuple& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::unordered_set& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::shared_ptr& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::array& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(std::unordered_map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(OrderedMap& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(DynamicState& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(DynamicVector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(Tabulated1DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(IntervalTabulated2DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(UniformXTabulated2DFunction& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(SolventPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(GasPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(DryGasPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(GasPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(WetGasPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(OilPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(ConstantCompressibilityOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(DeadOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(LiveOilPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(OilPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(WaterPvtMultiplexer& data, const std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(WaterPvtThermal& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(ConstantCompressibilityWaterPvt& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); template void unpack(IOrderSet& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); void unpack(char* str, std::size_t length, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); /// prototypes for complex types #define ADD_PACK_PROTOTYPES(T) \ std::size_t packSize(const T& data, Dune::MPIHelper::MPICommunicator comm); \ void pack(const T& data, std::vector& buffer, int& position, \ Dune::MPIHelper::MPICommunicator comm); \ void unpack(T& data, std::vector& buffer, int& position, \ Dune::MPIHelper::MPICommunicator comm); ADD_PACK_PROTOTYPES(Actdims) ADD_PACK_PROTOTYPES(Aqudims) ADD_PACK_PROTOTYPES(ColumnSchema) ADD_PACK_PROTOTYPES(Connection) ADD_PACK_PROTOTYPES(data::CellData) ADD_PACK_PROTOTYPES(data::Connection) ADD_PACK_PROTOTYPES(data::Rates) ADD_PACK_PROTOTYPES(data::Segment) ADD_PACK_PROTOTYPES(data::Solution) ADD_PACK_PROTOTYPES(data::Well) ADD_PACK_PROTOTYPES(data::WellRates) ADD_PACK_PROTOTYPES(DENSITYRecord) ADD_PACK_PROTOTYPES(DensityTable) ADD_PACK_PROTOTYPES(Dimension) ADD_PACK_PROTOTYPES(EclHysterConfig) ADD_PACK_PROTOTYPES(EDITNNC) ADD_PACK_PROTOTYPES(EndpointScaling) ADD_PACK_PROTOTYPES(Equil) ADD_PACK_PROTOTYPES(Eqldims) ADD_PACK_PROTOTYPES(EquilRecord) ADD_PACK_PROTOTYPES(Events) ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(GuideRateModel) ADD_PACK_PROTOTYPES(Group) ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties) ADD_PACK_PROTOTYPES(Group::GroupProductionProperties) ADD_PACK_PROTOTYPES(InitConfig) ADD_PACK_PROTOTYPES(IOConfig) ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(MessageLimits) ADD_PACK_PROTOTYPES(MLimits) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(OilVaporizationProperties) ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(PlymwinjTable) ADD_PACK_PROTOTYPES(PolyInjTable) ADD_PACK_PROTOTYPES(PVCDORecord) ADD_PACK_PROTOTYPES(PvcdoTable) ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtoTable) ADD_PACK_PROTOTYPES(PVTWRecord) ADD_PACK_PROTOTYPES(PvtwTable) ADD_PACK_PROTOTYPES(Regdims) ADD_PACK_PROTOTYPES(RestartConfig) ADD_PACK_PROTOTYPES(RestartKey) ADD_PACK_PROTOTYPES(RestartSchedule) ADD_PACK_PROTOTYPES(RestartValue) ADD_PACK_PROTOTYPES(ROCKRecord) ADD_PACK_PROTOTYPES(RockTable) ADD_PACK_PROTOTYPES(Rock2dTable) ADD_PACK_PROTOTYPES(Rock2dtrTable) ADD_PACK_PROTOTYPES(Runspec) ADD_PACK_PROTOTYPES(std::string) ADD_PACK_PROTOTYPES(Segment) ADD_PACK_PROTOTYPES(SimulationConfig) ADD_PACK_PROTOTYPES(SimpleTable) ADD_PACK_PROTOTYPES(SkprpolyTable) ADD_PACK_PROTOTYPES(SkprwatTable) ADD_PACK_PROTOTYPES(SpiralICD) ADD_PACK_PROTOTYPES(Tabdims) ADD_PACK_PROTOTYPES(TableColumn) ADD_PACK_PROTOTYPES(TableContainer) ADD_PACK_PROTOTYPES(TableManager) ADD_PACK_PROTOTYPES(TableSchema) ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) ADD_PACK_PROTOTYPES(UDAValue) ADD_PACK_PROTOTYPES(UDQActive) ADD_PACK_PROTOTYPES(UDQActive::InputRecord) ADD_PACK_PROTOTYPES(UDQActive::Record) ADD_PACK_PROTOTYPES(UDQAssign) ADD_PACK_PROTOTYPES(UDQAssign::AssignRecord) ADD_PACK_PROTOTYPES(UDQASTNode) ADD_PACK_PROTOTYPES(UDQConfig) ADD_PACK_PROTOTYPES(UDQDefine) ADD_PACK_PROTOTYPES(UDQFunction) ADD_PACK_PROTOTYPES(UDQFunctionTable) ADD_PACK_PROTOTYPES(UDQIndex) ADD_PACK_PROTOTYPES(UDQParams) ADD_PACK_PROTOTYPES(UnitSystem) ADD_PACK_PROTOTYPES(Valve) ADD_PACK_PROTOTYPES(VFPInjTable) ADD_PACK_PROTOTYPES(VFPProdTable) ADD_PACK_PROTOTYPES(VISCREFRecord) ADD_PACK_PROTOTYPES(ViscrefTable) ADD_PACK_PROTOTYPES(WATDENTRecord) ADD_PACK_PROTOTYPES(WatdentTable) ADD_PACK_PROTOTYPES(Well) ADD_PACK_PROTOTYPES(Well::WellGuideRate) ADD_PACK_PROTOTYPES(Well::WellInjectionProperties) ADD_PACK_PROTOTYPES(Well::WellProductionProperties) ADD_PACK_PROTOTYPES(WellConnections) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellEconProductionLimits) ADD_PACK_PROTOTYPES(WellFoamProperties) ADD_PACK_PROTOTYPES(WellPolymerProperties) ADD_PACK_PROTOTYPES(WellSegmentDims) ADD_PACK_PROTOTYPES(WellSegments) ADD_PACK_PROTOTYPES(WellTestConfig) ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell) ADD_PACK_PROTOTYPES(WellTracerProperties) ADD_PACK_PROTOTYPES(WList) ADD_PACK_PROTOTYPES(WListManager) } // end namespace Mpi RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, const std::vector& solutionKeys, const std::vector& extraKeys, Dune::CollectiveCommunication comm); } // end namespace Opm #endif // PARALLEL_RESTART_HPP