Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/utilities/bmi/mass_balance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,9 @@ auto NgenMassBalance::check_support(const ModelPtr& model) -> expected<void, Pro

auto NgenMassBalance::initialize(const ModelPtr& model, const Properties& properties) -> expected<void, ProtocolError>
{
//Ensure the model is capable of mass balance using the protocol
check_support(model).or_else( error_or_warning );

//now check if the user has requested to use mass balance
auto protocol_it = properties.find(CONFIGURATION_KEY);
if ( supported && protocol_it != properties.end() ) {
if ( protocol_it != properties.end() ) {
geojson::PropertyMap mass_bal = protocol_it->second.get_values();

auto _it = mass_bal.find(TOLERANCE_KEY);
Expand Down Expand Up @@ -184,11 +181,15 @@ auto NgenMassBalance::initialize(const ModelPtr& model, const Properties& proper
//no mass balance requested, or not supported, so don't check it
check = false;
}
if ( check ) {
//Ensure the model is capable of mass balance using the protocol
check_support(model).or_else( error_or_warning );
}
return {}; // important to return for the expected to be properly created!
}

bool NgenMassBalance::is_supported() const {
return this->supported;
}

}}} // end namespace models::bmi::protocols
}}} // end namespace models::bmi::protocols
Loading