Make IOConfig no longer use shared_ptr
This commit is contained in:
@@ -39,13 +39,13 @@ namespace Opm {
|
||||
const GridDims& inputGrid,
|
||||
const Schedule& schedule,
|
||||
const ParseContext& parseContext) :
|
||||
m_ioConfig( std::make_shared<IOConfig>(deck)),
|
||||
m_ioConfig( deck),
|
||||
m_initConfig( deck),
|
||||
m_simulationConfig(deck, eclipse3DProperties),
|
||||
m_summaryConfig( deck, schedule, eclipse3DProperties, parseContext , inputGrid.getNXYZ()),
|
||||
m_restartConfig( deck )
|
||||
{
|
||||
m_ioConfig->initFirstRFTOutput(schedule);
|
||||
this->m_ioConfig.initFirstRFTOutput(schedule);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,11 +54,11 @@ namespace Opm {
|
||||
}
|
||||
|
||||
const IOConfig& EclipseConfig::io() const {
|
||||
return *m_ioConfig;
|
||||
return m_ioConfig;
|
||||
}
|
||||
|
||||
IOConfig& EclipseConfig::io() {
|
||||
return *m_ioConfig;
|
||||
return m_ioConfig;
|
||||
}
|
||||
|
||||
const SimulationConfig& EclipseConfig::simulation() const {
|
||||
@@ -83,14 +83,6 @@ namespace Opm {
|
||||
return this->restart();
|
||||
}
|
||||
|
||||
IOConfigConstPtr EclipseConfig::getIOConfigConst() const {
|
||||
return m_ioConfig;
|
||||
}
|
||||
|
||||
IOConfigPtr EclipseConfig::getIOConfig() const {
|
||||
return m_ioConfig;
|
||||
}
|
||||
|
||||
// [[deprecated]] --- use init()
|
||||
const InitConfig& EclipseConfig::getInitConfig() const {
|
||||
return init();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -51,15 +52,13 @@ namespace Opm {
|
||||
const SummaryConfig& summary() const;
|
||||
const RestartConfig& restart() const;
|
||||
|
||||
std::shared_ptr<const IOConfig> getIOConfigConst() const;
|
||||
std::shared_ptr<IOConfig> getIOConfig() const;
|
||||
const InitConfig& getInitConfig() const;
|
||||
const SimulationConfig & getSimulationConfig() const;
|
||||
const SummaryConfig& getSummaryConfig() const;
|
||||
const RestartConfig& getRestartConfig() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<IOConfig> m_ioConfig;
|
||||
IOConfig m_ioConfig;
|
||||
const InitConfig m_initConfig;
|
||||
const SimulationConfig m_simulationConfig;
|
||||
SummaryConfig m_summaryConfig;
|
||||
|
||||
@@ -145,13 +145,13 @@ namespace Opm {
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().io()
|
||||
IOConfigConstPtr EclipseState::getIOConfigConst() const {
|
||||
return m_eclipseConfig.getIOConfigConst();
|
||||
const IOConfig& EclipseState::getIOConfig() const {
|
||||
return m_eclipseConfig.io();
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().io()
|
||||
IOConfigPtr EclipseState::getIOConfig() const {
|
||||
return m_eclipseConfig.getIOConfig();
|
||||
IOConfig& EclipseState::getIOConfig() {
|
||||
return m_eclipseConfig.io();
|
||||
}
|
||||
|
||||
/// [[deprecated]] --- use cfg().init()
|
||||
|
||||
@@ -71,8 +71,8 @@ namespace Opm {
|
||||
const ParseContext& getParseContext() const;
|
||||
|
||||
const Schedule& getSchedule() const;
|
||||
std::shared_ptr< const IOConfig > getIOConfigConst() const;
|
||||
std::shared_ptr< IOConfig > getIOConfig() const;
|
||||
const IOConfig& getIOConfig() const;
|
||||
IOConfig& getIOConfig();
|
||||
|
||||
const InitConfig& getInitConfig() const;
|
||||
const SimulationConfig& getSimulationConfig() const;
|
||||
|
||||
@@ -59,12 +59,13 @@ namespace Opm {
|
||||
IOConfig::IOConfig( const Deck& deck ) :
|
||||
IOConfig( GRIDSection( deck ),
|
||||
RUNSPECSection( deck ),
|
||||
std::make_shared< const TimeMap >( deck ),
|
||||
TimeMap( deck ),
|
||||
deck.hasKeyword("NOSIM"),
|
||||
deck.getDataFile() )
|
||||
{}
|
||||
|
||||
IOConfig::IOConfig( const std::string& input_path ) :
|
||||
m_timemap( TimeMap{ Deck{} } ),
|
||||
m_deck_filename( input_path ),
|
||||
m_output_dir( outputdir( input_path ) ),
|
||||
m_base_name( basename( input_path ) )
|
||||
@@ -97,10 +98,10 @@ namespace Opm {
|
||||
|
||||
IOConfig::IOConfig( const GRIDSection& grid,
|
||||
const RUNSPECSection& runspec,
|
||||
std::shared_ptr< const TimeMap > timemap,
|
||||
TimeMap timemap,
|
||||
bool nosim,
|
||||
const std::string& input_path ) :
|
||||
m_timemap( timemap ),
|
||||
m_timemap( std::move( timemap ) ),
|
||||
m_write_INIT_file( grid.hasKeyword( "INIT" ) ),
|
||||
m_write_EGRID_file( write_egrid_file( grid ) ),
|
||||
m_UNIFIN( runspec.hasKeyword( "UNIFIN" ) ),
|
||||
@@ -170,7 +171,7 @@ namespace Opm {
|
||||
|
||||
|
||||
boost::gregorian::date IOConfig::getTimestepDate(size_t reportStep) const {
|
||||
auto time = (*m_timemap)[reportStep];
|
||||
const auto& time = m_timemap[reportStep];
|
||||
return time.date();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,15 +22,13 @@
|
||||
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template< typename > class DynamicState;
|
||||
|
||||
class Deck;
|
||||
class DeckKeyword;
|
||||
class GRIDSection;
|
||||
class RUNSPECSection;
|
||||
class TimeMap;
|
||||
class Schedule;
|
||||
|
||||
/*The IOConfig class holds data about input / ouput configurations
|
||||
@@ -163,7 +161,7 @@ namespace Opm {
|
||||
void setWriteInitialRestartFile(bool writeInitialRestartFile);
|
||||
|
||||
private:
|
||||
std::shared_ptr< const TimeMap > m_timemap;
|
||||
TimeMap m_timemap;
|
||||
bool m_write_INIT_file = false;
|
||||
bool m_write_EGRID_file = true;
|
||||
bool m_UNIFIN = false;
|
||||
@@ -180,16 +178,12 @@ namespace Opm {
|
||||
|
||||
IOConfig( const GRIDSection&,
|
||||
const RUNSPECSection&,
|
||||
std::shared_ptr< const TimeMap >,
|
||||
TimeMap,
|
||||
bool nosim,
|
||||
const std::string& input_path );
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef std::shared_ptr<IOConfig> IOConfigPtr;
|
||||
typedef std::shared_ptr<const IOConfig> IOConfigConstPtr;
|
||||
|
||||
} //namespace Opm
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user