Skip to content

Commit

Permalink
bugfix: Correctly disable tidal constituents from the model
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Jul 8, 2024
1 parent 058ec77 commit c2cafe1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions include/fes/tide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ static auto build_wave_table(const AbstractTidalModel<T>* const tidal_model,
// Add the constituents provided by the model.
for (const auto& item : tidal_model->data()) {
auto& wave = result[item.first];
wave->dynamic(true);
wave->admittance(false);
auto it = std::find(disable.begin(), disable.end(), item.first);
// Set the wave as dynamic and not provided by the model only if it is not
// in the list of disabled constituents.
if (it == disable.end()) {
wave->dynamic(true);
wave->admittance(false);
}
}

// Add the constituents to be be considered as dynamic but not provided by
Expand All @@ -81,13 +86,6 @@ static auto build_wave_table(const AbstractTidalModel<T>* const tidal_model,
wave->admittance(false);
}

// Finally, exclude the constituents from the model requested by the user.
for (const auto& item : disable) {
auto& wave = result[item];
wave->dynamic(false);
wave->admittance(true);
}

return result;
}

Expand Down

0 comments on commit c2cafe1

Please sign in to comment.