mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Removed ternary operator in inline initialization.
This made the code rather hard to read. Now we do the initialization in the constructor body if needed.
This commit is contained in:
parent
3eba3353d0
commit
747c93e898
@ -338,49 +338,58 @@ namespace Opm
|
|||||||
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
||||||
lastBackupReportStep_( -1 ),
|
lastBackupReportStep_( -1 ),
|
||||||
phaseUsage_( phaseUsage ),
|
phaseUsage_( phaseUsage ),
|
||||||
vtkWriter_( output_ && param.getDefault("output_vtk",false) ?
|
|
||||||
new BlackoilVTKWriter< Grid >( grid, outputDir_ ) : 0 ),
|
|
||||||
matlabWriter_( output_ && parallelOutput_->isIORank() &&
|
|
||||||
param.getDefault("output_matlab", false) ?
|
|
||||||
new BlackoilMatlabWriter< Grid >( grid, outputDir_ ) : 0 ),
|
|
||||||
eclWriter_( output_ && parallelOutput_->isIORank() &&
|
|
||||||
param.getDefault("output_ecl", true) ?
|
|
||||||
std::move(eclWriter)
|
|
||||||
: std::move(std::unique_ptr<EclipseWriter>()) ),
|
|
||||||
eclipseState_(eclipseState),
|
eclipseState_(eclipseState),
|
||||||
asyncOutput_()
|
asyncOutput_()
|
||||||
{
|
{
|
||||||
// For output.
|
// For output.
|
||||||
if (output_ && parallelOutput_->isIORank() ) {
|
if ( output_ )
|
||||||
// Ensure that output dir exists
|
{
|
||||||
boost::filesystem::path fpath(outputDir_);
|
if ( param.getDefault("output_vtk",false) )
|
||||||
try {
|
{
|
||||||
create_directories(fpath);
|
vtkWriter_
|
||||||
}
|
.reset(new BlackoilVTKWriter< Grid >( grid, outputDir_ ));
|
||||||
catch (...) {
|
|
||||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create output thread if enabled and rank is I/O rank
|
if( parallelOutput_->isIORank() ) {
|
||||||
// async output is enabled by default if pthread are enabled
|
|
||||||
#if HAVE_PTHREAD
|
|
||||||
const bool asyncOutputDefault = false;
|
|
||||||
#else
|
|
||||||
const bool asyncOutputDefault = false;
|
|
||||||
#endif
|
|
||||||
if( param.getDefault("async_output", asyncOutputDefault ) )
|
|
||||||
{
|
|
||||||
#if HAVE_PTHREAD
|
|
||||||
asyncOutput_.reset( new ThreadHandle() );
|
|
||||||
#else
|
|
||||||
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string backupfilename = param.getDefault("backupfile", std::string("") );
|
if ( param.getDefault("output_matlab", false ) )
|
||||||
if( ! backupfilename.empty() )
|
{
|
||||||
{
|
matlabWriter_
|
||||||
backupfile_.open( backupfilename.c_str() );
|
.reset(new BlackoilMatlabWriter< Grid >( grid, outputDir_ ));
|
||||||
|
}
|
||||||
|
|
||||||
|
eclWriter_ = std::move(eclWriter);
|
||||||
|
|
||||||
|
// Ensure that output dir exists
|
||||||
|
boost::filesystem::path fpath(outputDir_);
|
||||||
|
try {
|
||||||
|
create_directories(fpath);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create output thread if enabled and rank is I/O rank
|
||||||
|
// async output is enabled by default if pthread are enabled
|
||||||
|
#if HAVE_PTHREAD
|
||||||
|
const bool asyncOutputDefault = false;
|
||||||
|
#else
|
||||||
|
const bool asyncOutputDefault = false;
|
||||||
|
#endif
|
||||||
|
if( param.getDefault("async_output", asyncOutputDefault ) )
|
||||||
|
{
|
||||||
|
#if HAVE_PTHREAD
|
||||||
|
asyncOutput_.reset( new ThreadHandle() );
|
||||||
|
#else
|
||||||
|
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string backupfilename = param.getDefault("backupfile", std::string("") );
|
||||||
|
if( ! backupfilename.empty() )
|
||||||
|
{
|
||||||
|
backupfile_.open( backupfilename.c_str() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user