14#include <unordered_map>
29static inline const std::unordered_map<std::string, BoundaryCondition>
conditionTable = {
35static inline const std::unordered_map<std::string, CellType>
typeTable = {
39static inline const std::unordered_map<std::string, HaloLocation>
haloTable = {
46 std::unordered_map<BoundaryCondition, std::string> reverseMap;
48 reverseMap[pair.second] = pair.first;
53static inline const std::unordered_map<CellType, std::string>
typeStringTable = []() {
54 std::unordered_map<CellType, std::string> reverseMap;
56 reverseMap[pair.second] = pair.first;
61static inline const std::unordered_map<HaloLocation, std::string>
haloStringTable = []() {
62 std::unordered_map<HaloLocation, std::string> reverseMap;
64 reverseMap[pair.second] = pair.first;
130static inline std::string
fromHaloVec(
const std::vector<HaloLocation> &vec) {
131 std::stringstream ss;
153 SPDLOG_WARN(
"This shouldn't happen! (haloVec)");
169 std::stringstream ss;
182 SPDLOG_WARN(
"This shouldn't happen! (fromBoundaryConditionArray)");
216 std::array<BoundaryCondition, 6> arr;
218 for (
auto &c : str) {
230 CLIUtils::error(
"Invalid boundary condition character (must be one of: o, r)!");
Utility functions for console input / output.
CellType
Enum containing the possible types of cells.
Definition CellUtils.h:20
HaloLocation
Enum containing the possible corner and edge directions of halo cells.
Definition CellUtils.h:22
BoundaryCondition
Enum containing the possible types of boundary conditions.
Definition CellUtils.h:18
BorderLocation
Enum containing the possible corner and edge directions of border cells.
Definition CellUtils.h:24
Enumeration class corresponding to the type schema type.
Definition vtk-unstructured.h:2125
static void error(const char *msg, const std::string &opt="", bool usage=true, bool close=true)
Prints an error message to stderr with the prefix "ERROR: ", optionally prints the usage string and e...
Definition CLIUtils.h:149
Namespace containing utility functions for Cell and CellContainer objects.
Definition CellUtils.h:27
static const std::unordered_map< CellType, std::string > typeStringTable
Reverse map containing conversion information for converting a CellType enum to a string.
Definition CellUtils.h:53
static const std::unordered_map< HaloLocation, std::string > haloStringTable
Reverse map containing conversion information for converting a HaloLocation enum to a string.
Definition CellUtils.h:61
static std::string fromType(CellType type)
Converts a CellType to a string.
Definition CellUtils.h:97
static HaloLocation toHalo(const std::string &type)
Converts a string to a HaloLocation enum using a dedicated map.
Definition CellUtils.h:195
static std::string fromBoundaryCondition(BoundaryCondition type)
Converts a BoundaryCondition to a string.
Definition CellUtils.h:74
static const std::unordered_map< BoundaryCondition, std::string > conditionStringTable
Reverse map containing conversion information for converting a BoundaryCondition enum to a string.
Definition CellUtils.h:45
static const std::unordered_map< std::string, BoundaryCondition > conditionTable
Map containing conversion information for converting a string to a BoundaryCondition enum.
Definition CellUtils.h:29
static std::string fromHaloVec(const std::vector< HaloLocation > &vec)
Converts a vector of HaloLocation enums to a truncated, concatenated string.
Definition CellUtils.h:130
static const std::unordered_map< std::string, HaloLocation > haloTable
Map containing conversion information for converting a string to a HaloLocation enum.
Definition CellUtils.h:39
static std::array< BoundaryCondition, 6 > stringToBoundaryConditions(const std::string &str)
Converts a string of length 6 to an array of boundary conditions for each boundary.
Definition CellUtils.h:213
static CellType toType(const std::string &type)
Converts a string to a CellType enum using a dedicated map.
Definition CellUtils.h:105
static std::string fromBoundaryConditionArray(const std::array< BoundaryCondition, 6 > &arr)
Converts an array of BoundaryCondition enums to a truncated, concatenated string.
Definition CellUtils.h:168
static std::string fromHalo(HaloLocation type)
Converts a HaloLocation to a string.
Definition CellUtils.h:120
static const std::unordered_map< std::string, CellType > typeTable
Map containing conversion information for converting a string to a CellType enum.
Definition CellUtils.h:35
static BoundaryCondition toBoundaryCondition(const std::string &type)
Converts a string to a BoundaryCondition enum using a dedicated map.
Definition CellUtils.h:82