static inline bool write_egrid_file( const GRIDSection& grid ) { if( grid.hasKeyword( "NOGGF" ) ) return false; if( !grid.hasKeyword( "GRIDFILE" ) ) return true; const auto& keyword = grid.getKeyword( "GRIDFILE" ); const auto& rec = keyword.getRecord( 0 ); { const auto& grid_item = rec.getItem( 0 ); if (grid_item.get<int>(0) != 0) { std::cerr << "IOConfig: Reading GRIDFILE keyword from GRID section: " << "Output of GRID file is not supported. " << "Supported format: EGRID" << std::endl; // It was asked for GRID file - that output is not // supported, but we will output EGRID file; // irrespective of whether that was actually // requested. return true; } } { const auto& egrid_item = rec.getItem( 1 ); return (egrid_item.get<int>(0) == 1); } }
static inline bool write_egrid_file( const GRIDSection& grid ) { if( grid.hasKeyword( "NOGGF" ) ) return false; if( !grid.hasKeyword( "GRIDFILE" ) ) return true; const auto& keyword = grid.getKeyword( "GRIDFILE" ); if( keyword.size() == 0 ) return false; const auto& rec = keyword.getRecord( 0 ); const auto& item1 = rec.getItem( 0 ); if( item1.hasValue( 0 ) && item1.get< int >( 0 ) != 0 ) { std::cerr << "IOConfig: Reading GRIDFILE keyword from GRID section: " << "Output of GRID file is not supported. " << "Supported format: EGRID" << std::endl; return true; } if( rec.size() < 1 ) return true; const auto& item2 = rec.getItem( 1 ); return !item2.hasValue( 0 ) || item2.get< int >( 0 ) != 0; }
IOConfig::IOConfig( const GRIDSection& grid, const RUNSPECSection& runspec, bool nosim, const std::string& input_path ) : m_write_INIT_file( grid.hasKeyword( "INIT" ) ), m_write_EGRID_file( write_egrid_file( grid ) ), m_UNIFIN( runspec.hasKeyword( "UNIFIN" ) ), m_UNIFOUT( runspec.hasKeyword( "UNIFOUT" ) ), m_FMTIN( runspec.hasKeyword( "FMTIN" ) ), m_FMTOUT( runspec.hasKeyword( "FMTOUT" ) ), m_deck_filename( input_path ), m_output_dir( outputdir( input_path ) ), m_base_name( basename( input_path ) ), m_nosim( nosim ) {}