using template instead of pointer to function

for functions checkMaxRatioLimitWell and checkMaxRatioLimitCompletions
This commit is contained in:
Kai Bao 2019-06-24 14:02:08 +02:00
parent b27a646b98
commit e0bd33db43
2 changed files with 8 additions and 4 deletions

View File

@ -392,13 +392,15 @@ namespace Opm
const WellState& well_state,
Opm::DeferredLogger& deferred_logger) const;
template <typename RatioFunc>
bool checkMaxRatioLimitWell(const WellState& well_state,
const double max_ratio_limit,
double (*ratioFunc)(const std::vector<double>&, const PhaseUsage&) ) const;
const RatioFunc& ratioFunc) const;
template <typename RatioFunc>
void checkMaxRatioLimitCompletions(const WellState& well_state,
const double max_ratio_limit,
double (*ratioFunc)(const std::vector<double>&, const PhaseUsage&),
const RatioFunc& ratioFunc,
int& worst_offending_completion,
double& violation_extent) const;

View File

@ -706,11 +706,12 @@ namespace Opm
template<typename TypeTag>
template<typename RatioFunc>
bool
WellInterface<TypeTag>::
checkMaxRatioLimitWell(const WellState& well_state,
const double max_ratio_limit,
double (*ratioFunc)(const std::vector<double>&, const PhaseUsage&)) const
const RatioFunc& ratioFunc) const
{
const int np = number_of_phases_;
@ -729,11 +730,12 @@ namespace Opm
template<typename TypeTag>
template<typename RatioFunc>
void
WellInterface<TypeTag>::
checkMaxRatioLimitCompletions(const WellState& well_state,
const double max_ratio_limit,
double (*ratioFunc)(const std::vector<double>&, const PhaseUsage&),
const RatioFunc& ratioFunc,
int& worst_offending_completion,
double& violation_extent) const
{