mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Added documentation and added minimumNumberOfComponents template
argument.
This commit is contained in:
parent
bc2c37757d
commit
cf50957924
@ -307,21 +307,38 @@ struct EnableThermalFluxBoundaries<TypeTag, TTag::FlowExpCompProblem> {
|
|||||||
|
|
||||||
} // namespace Opm::Properties
|
} // namespace Opm::Properties
|
||||||
|
|
||||||
template <int numComponentsCompileTime>
|
//! @brief Runs the simulator with the correct number of components
|
||||||
|
//!
|
||||||
|
//! This function will compile-time recurse from numComponentsCompileTime
|
||||||
|
//! down to (inclusive) minimumNumberOfComponents and check if
|
||||||
|
//!
|
||||||
|
//! numComponentsCompileTime == numComponentsRuntime
|
||||||
|
//!
|
||||||
|
//! and if this is the case, it will star the simulator with numComponentsRuntime.
|
||||||
|
//!
|
||||||
|
//! @tparam minimumNumberOfComponents the minimum number of components supported
|
||||||
|
//! @tparam numCompnentsCompileTime the maximum number of components supported
|
||||||
|
//! @param numComponentsRuntime the number of components found the in the deck file
|
||||||
|
//! @param argc argc argument from CLI
|
||||||
|
//! @param argv argv argument from CLI
|
||||||
|
//!
|
||||||
|
//! @return error code
|
||||||
|
template <int minimumNumberOfComponents, int numComponentsCompileTime>
|
||||||
int
|
int
|
||||||
startSimulationComponents(int numComponentsRuntime, int argc, char** argv)
|
startSimulationComponents(int numComponentsRuntime, int argc, char** argv)
|
||||||
{
|
{
|
||||||
OPM_ERROR_IF(numComponentsCompileTime < numComponentsRuntime || numComponentsRuntime <= 0,
|
OPM_ERROR_IF(numComponentsCompileTime < numComponentsRuntime || numComponentsRuntime < minimumNumberOfComponents,
|
||||||
fmt::format("Deck has {} components, not supported. We support a maximum of {} components, "
|
fmt::format("Deck has {} components, not supported. We support a maximum of {} components, "
|
||||||
"and a minimum of 1.",
|
"and a minimum of {}.",
|
||||||
numComponentsRuntime,
|
numComponentsRuntime,
|
||||||
numComponentsCompileTime));
|
numComponentsCompileTime,
|
||||||
|
minimumNumberOfComponents));
|
||||||
|
|
||||||
if (numComponentsCompileTime == numComponentsRuntime) {
|
if (numComponentsCompileTime == numComponentsRuntime) {
|
||||||
return Opm::start<Opm::Properties::TTag::FlowExpCompProblem<numComponentsCompileTime>>(argc, argv, false);
|
return Opm::start<Opm::Properties::TTag::FlowExpCompProblem<numComponentsCompileTime>>(argc, argv, false);
|
||||||
}
|
}
|
||||||
if constexpr (numComponentsCompileTime > 1) {
|
if constexpr (numComponentsCompileTime > minimumNumberOfComponents) {
|
||||||
return startSimulationComponents<numComponentsCompileTime - 1>(numComponentsRuntime, argc, argv);
|
return startSimulationComponents<minimumNumberOfComponents, numComponentsCompileTime - 1>(numComponentsRuntime, argc, argv);
|
||||||
}
|
}
|
||||||
// It will never actually reach this, but the compiler does not seem to realize, so keeping
|
// It will never actually reach this, but the compiler does not seem to realize, so keeping
|
||||||
// this to avoid warnings.
|
// this to avoid warnings.
|
||||||
@ -349,6 +366,6 @@ main(int argc, char** argv)
|
|||||||
Opm::FlowGenericVanguard::readDeck(inputFilename);
|
Opm::FlowGenericVanguard::readDeck(inputFilename);
|
||||||
Opm::FlowGenericVanguard vanguard;
|
Opm::FlowGenericVanguard vanguard;
|
||||||
const auto numComps = vanguard.eclState().compositionalConfig().numComps();
|
const auto numComps = vanguard.eclState().compositionalConfig().numComps();
|
||||||
return startSimulationComponents<10>(numComps, argc, argv);
|
return startSimulationComponents<2, 7>(numComps, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user