The inputs every surface coupling reads: enable, engine, grid_ratio, anchor_level.
More...
#include <ERF_SurfaceCouplingNames.H>
#include <AMReX_ParmParse.H>
#include <string>
#include <vector>
Go to the source code of this file.
|
| std::string | surface_quoted_list (const std::vector< std::string > &v) |
| | "a", "b", "c" (each name in double quotes, comma separated) More...
|
| |
| void | read_surface_coupling_common (amrex::ParmParse &pp, const SurfaceCouplingNames &names, const std::vector< std::string > &engines, bool &enable, int &grid_ratio, int &anchor_level, std::string &engine) |
| | Read erf.<coupling>.enable, grid_ratio, anchor_level and engine. More...
|
| |
The inputs every surface coupling reads: enable, engine, grid_ratio, anchor_level.
◆ read_surface_coupling_common()
| void read_surface_coupling_common |
( |
amrex::ParmParse & |
pp, |
|
|
const SurfaceCouplingNames & |
names, |
|
|
const std::vector< std::string > & |
engines, |
|
|
bool & |
enable, |
|
|
int & |
grid_ratio, |
|
|
int & |
anchor_level, |
|
|
std::string & |
engine |
|
) |
| |
Read erf.<coupling>.enable, grid_ratio, anchor_level and engine.
- Parameters
-
| [in] | pp | ParmParse with the coupling's prefix (erf.fire, erf.flood) |
| [in] | names | The coupling's names |
| [in] | engines | The engines compiled into this executable, sorted |
| [in,out] | enable | erf.<coupling>.enable (default on entry) |
| [in,out] | grid_ratio | erf.<coupling>.grid_ratio (default on entry); aborts below 1 |
| [in,out] | anchor_level | erf.<coupling>.anchor_level (default on entry); aborts below -1 |
| [out] | engine | The engine: the only one compiled in, or the one the deck names. Aborts when the deck enables the coupling or names an engine and no engine, or no single one, fits. |
22 auto fail = [&](
const std::string& msg) { amrex::Abort(names.
tag() +
" " + msg); };
24 pp.query(
"enable", enable);
25 pp.query(
"grid_ratio", grid_ratio);
27 fail(names.
key(
"grid_ratio") +
" must be >= 1, got " + std::to_string(grid_ratio));
29 pp.query(
"anchor_level", anchor_level);
30 if (anchor_level < -1) {
31 fail(names.
key(
"anchor_level") +
" must be -1 (the finest level) or a level >= 0, got "
32 + std::to_string(anchor_level));
37 if (engines.size() == 1) { engine = engines.front(); }
38 const bool engine_given =
pp.query(
"engine", engine);
39 if (engine_given || enable) {
40 const std::string dir = std::string(
"Source/") + names.
title +
"Coupling";
41 if (engines.empty()) {
42 fail((enable ? names.
key(
"enable") +
" = true" : names.
key(
"engine") +
" is set")
43 +
", but no " + names.
lower +
" engine is compiled into this executable: " + dir
44 +
" holds only the coupling to the atmosphere. Build with an engine directory (GNU make "
45 + names.
upper +
"_HOME, CMake ERF_" + names.
upper +
"_ENGINE_DIRS); " + dir +
"/ERF_"
46 + names.
title +
"EngineTemplate.H lists what an engine provides.");
48 if (!engine_given && engines.size() > 1) {
49 fail(std::string(
"several ") + names.
lower +
" engines are compiled in ("
53 for (
const auto& a : engines) { known = known || (a == engine); }
std::string surface_quoted_list(const std::vector< std::string > &v)
"a", "b", "c" (each name in double quotes, comma separated)
Definition: ERF_SurfaceCouplingParams.cpp:5
const char * title
"Fire": Source/<title>Coupling, ERF_<title>EngineTemplate.H
Definition: ERF_SurfaceCouplingNames.H:20
std::string tag() const
"[FIRE]"
Definition: ERF_SurfaceCouplingNames.H:24
const char * upper
"FIRE": the message tag [<upper>], <upper>HOME, ERF<upper>_ENGINE_DIRS
Definition: ERF_SurfaceCouplingNames.H:21
const char * lower
"fire": input prefix erf.<lower>, "the <lower> grid", "<lower> engine"
Definition: ERF_SurfaceCouplingNames.H:19
std::string key(const std::string &k) const
"erf.fire." followed by key
Definition: ERF_SurfaceCouplingNames.H:26
Referenced by FireCouplingParams::read(), and FloodCouplingParams::read().
◆ surface_quoted_list()
| std::string surface_quoted_list |
( |
const std::vector< std::string > & |
v | ) |
|
"a", "b", "c" (each name in double quotes, comma separated)
8 for (
const auto& a : v) { list += (list.empty() ?
"" :
", ") + std::string(
"\"") + a +
"\""; }
Referenced by read_surface_coupling_common().