Peano
Loading...
Searching...
No Matches
ccz4-component-names.h
Go to the documentation of this file.
1#ifndef APPARENT_HORIZON_FINDER_TEST_CCZ4_COMPONENT_NAMES_H_
2#define APPARENT_HORIZON_FINDER_TEST_CCZ4_COMPONENT_NAMES_H_
3
4#include <string>
5#include <utility>
6#include <vector>
7
9
10// Component names as Peano's patch-file converter writes them: one name per
11// unknown, v[0], ..., v[k-1] for a variable of multiplicity k, and a trailing
12// subdomain component.
13inline std::vector<std::string> UnknownNames(
14 const std::vector<std::pair<std::string, int>>& unknowns
15) {
16 std::vector<std::string> names;
17 for (const auto& [name, multiplicity] : unknowns) {
18 if (multiplicity == 1) {
19 names.push_back(name);
20 } else {
21 for (int i = 0; i < multiplicity; ++i) {
22 names.push_back(name + "[" + std::to_string(i) + "]");
23 }
24 }
25 }
26 names.push_back("subdomain");
27 return names;
28}
29
30// FOCCZ4Solver.Unknowns (src/exagrype/api/FOCCZ4Solver.py).
31inline std::vector<std::string> ExaGRyPEComponentNames() {
32 return UnknownNames({
33 {"G", 6}, {"K", 6}, {"theta", 1}, {"Z", 3}, {"lapse", 1}, {"shift", 3},
34 {"b", 3}, {"traceK", 1}, {"phi", 1}, {"dLapse", 3}, {"dxShift", 3},
35 {"dyShift", 3}, {"dzShift", 3}, {"dxG", 6}, {"dyG", 6}, {"dzG", 6},
36 {"P", 3}, {"K0", 1}
37 });
38}
39
40// The unknowns of the legacy applications/exahype2/ccz4/ccz4.py.
41inline std::vector<std::string> LegacyCCZ4ComponentNames() {
42 return UnknownNames({
43 {"G", 6}, {"K", 6}, {"theta", 1}, {"Z", 3}, {"lapse", 1}, {"shift", 3},
44 {"b", 3}, {"dLapse", 3}, {"dxShift", 3}, {"dyShift", 3}, {"dzShift", 3},
45 {"dxG", 6}, {"dyG", 6}, {"dzG", 6}, {"traceK", 1}, {"phi", 1},
46 {"P", 3}, {"K0", 1}
47 });
48}
49
50} // namespace exahype2::ccz4::ahf::tests
51
52#endif // APPARENT_HORIZON_FINDER_TEST_CCZ4_COMPONENT_NAMES_H_
std::vector< std::string > LegacyCCZ4ComponentNames()
std::vector< std::string > ExaGRyPEComponentNames()
std::vector< std::string > UnknownNames(const std::vector< std::pair< std::string, int > > &unknowns)