mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use string to enum helper.
This commit is contained in:
parent
7578fbf144
commit
6f04c31c7c
@ -620,7 +620,7 @@ namespace Opm
|
||||
use_average_density_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseAverageDensityMsWells);
|
||||
local_well_solver_control_switching_ = EWOMS_GET_PARAM(TypeTag, bool, LocalWellSolveControlSwitching);
|
||||
nonlinear_solver_ = EWOMS_GET_PARAM(TypeTag, std::string, NonlinearSolver);
|
||||
std::string approach = EWOMS_GET_PARAM(TypeTag, std::string, LocalSolveApproach);
|
||||
const auto approach = EWOMS_GET_PARAM(TypeTag, std::string, LocalSolveApproach);
|
||||
if (approach == "jacobi") {
|
||||
local_solve_approach_ = DomainSolveApproach::Jacobi;
|
||||
} else if (approach == "gauss-seidel") {
|
||||
@ -639,17 +639,7 @@ namespace Opm
|
||||
deck_file_name_ = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
|
||||
network_max_strict_iterations_ = EWOMS_GET_PARAM(TypeTag, int, NetworkMaxStrictIterations);
|
||||
network_max_iterations_ = EWOMS_GET_PARAM(TypeTag, int, NetworkMaxIterations);
|
||||
std::string measure = EWOMS_GET_PARAM(TypeTag, std::string, LocalDomainsOrderingMeasure);
|
||||
if (measure == "residual") {
|
||||
local_domain_ordering_ = DomainOrderingMeasure::Residual;
|
||||
} else if (measure == "maxpressure") {
|
||||
local_domain_ordering_ = DomainOrderingMeasure::MaxPressure;
|
||||
} else if (measure == "averagepressure") {
|
||||
local_domain_ordering_ = DomainOrderingMeasure::AveragePressure;
|
||||
} else {
|
||||
throw std::runtime_error("Invalid domain ordering '" + measure + "' specified.");
|
||||
}
|
||||
|
||||
local_domain_ordering_ = domainOrderingMeasureFromString(EWOMS_GET_PARAM(TypeTag, std::string, LocalDomainsOrderingMeasure));
|
||||
write_partitions_ = EWOMS_GET_PARAM(TypeTag, bool, DebugEmitCellPartition);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <opm/grid/common/SubGridPart.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -40,6 +42,19 @@ namespace Opm
|
||||
Residual
|
||||
};
|
||||
|
||||
inline DomainOrderingMeasure domainOrderingMeasureFromString(const std::string_view measure)
|
||||
{
|
||||
if (measure == "residual") {
|
||||
return DomainOrderingMeasure::Residual;
|
||||
} else if (measure == "maxpressure") {
|
||||
return DomainOrderingMeasure::MaxPressure;
|
||||
} else if (measure == "averagepressure") {
|
||||
return DomainOrderingMeasure::AveragePressure;
|
||||
} else {
|
||||
throw std::runtime_error(fmt::format("Invalid domain ordering '{}' specified", measure));
|
||||
}
|
||||
}
|
||||
|
||||
/// Representing a part of a grid, in a way suitable for performing
|
||||
/// local solves.
|
||||
template <class Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user