EndpointScaling: will create default is SWATINIT

This commit is contained in:
Joakim Hove
2017-03-15 15:32:14 +01:00
parent 3cc14028e9
commit 0fdde95759
2 changed files with 33 additions and 10 deletions

View File

@@ -96,17 +96,22 @@ bool endscale_revers( const DeckKeyword& kw ) {
}
EndpointScaling::EndpointScaling( const Deck& deck ) {
if( !deck.hasKeyword( "ENDSCALE" ) ) return;
if( deck.hasKeyword( "ENDSCALE" ) || deck.hasKeyword("SWATINIT")) {
const bool threep = threepoint_scaling( deck );
bool direct = false;
bool reversible = true;
const auto& endscale = deck.getKeyword( "ENDSCALE" );
const bool direct = !endscale_nodir( endscale );
const bool revers = endscale_revers( endscale );
const bool threep = threepoint_scaling( deck );
if (deck.hasKeyword("ENDSCALE")) {
const auto& endscale = deck.getKeyword( "ENDSCALE" );
direct = !endscale_nodir( endscale );
reversible = endscale_revers( endscale );
}
this->options.set( static_cast< ue >( option::any ), true );
this->options.set( static_cast< ue >( option::directional ), direct );
this->options.set( static_cast< ue >( option::reversible ), revers );
this->options.set( static_cast< ue >( option::threepoint ), threep );
this->options.set( static_cast< ue >( option::any ), true );
this->options.set( static_cast< ue >( option::directional ), direct );
this->options.set( static_cast< ue >( option::reversible ), reversible );
this->options.set( static_cast< ue >( option::threepoint ), threep );
}
}
}

View File

@@ -125,6 +125,8 @@ BOOST_AUTO_TEST_CASE( EndpointScalingWithoutENDSCALE ) {
BOOST_CHECK( !endscale.irreversible() );
}
BOOST_AUTO_TEST_CASE( EndpointScalingDefaulted ) {
const std::string input = R"(
RUNSPEC
@@ -264,7 +266,23 @@ BOOST_AUTO_TEST_CASE( endpoint_scaling_throw_invalid_argument ) {
for( auto&& input : inputs ) {
auto deck = Parser{}.parseString( input, ParseContext{} );
std::cout << input << std::endl;
BOOST_CHECK_THROW( Runspec{ deck }, std::invalid_argument );
}
}
BOOST_AUTO_TEST_CASE( SWATINIT ) {
const std::string input = R"(
SWATINIT
1000*0.25 /
)";
Runspec runspec( Parser{}.parseString( input, ParseContext{} ) );
const auto& endscale = runspec.endpointScaling();
BOOST_CHECK( endscale );
BOOST_CHECK( !endscale.directional() );
BOOST_CHECK( endscale.nondirectional() );
BOOST_CHECK( endscale.reversible() );
BOOST_CHECK( !endscale.irreversible() );
}