MolSim
Loading...
Searching...
No Matches
Functions | Variables
CellUtils Namespace Reference

Namespace containing utility functions for Cell and CellContainer objects. More...

Functions

static std::string fromBoundaryCondition (BoundaryCondition type)
 Converts a BoundaryCondition to a string.
 
static BoundaryCondition toBoundaryCondition (const std::string &type)
 Converts a string to a BoundaryCondition enum using a dedicated map.
 
static std::string fromType (CellType type)
 Converts a CellType to a string.
 
static CellType toType (const std::string &type)
 Converts a string to a CellType enum using a dedicated map.
 
static std::string fromHalo (HaloLocation type)
 Converts a HaloLocation to a string.
 
static std::string fromHaloVec (const std::vector< HaloLocation > &vec)
 Converts a vector of HaloLocation enums to a truncated, concatenated string.
 
static std::string fromBoundaryConditionArray (const std::array< BoundaryCondition, 6 > &arr)
 Converts an array of BoundaryCondition enums to a truncated, concatenated string.
 
static HaloLocation toHalo (const std::string &type)
 Converts a string to a HaloLocation enum using a dedicated map.
 
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.
 

Variables

static const std::unordered_map< std::string, BoundaryConditionconditionTable
 Map containing conversion information for converting a string to a BoundaryCondition enum.
 
static const std::unordered_map< std::string, CellTypetypeTable
 Map containing conversion information for converting a string to a CellType enum.
 
static const std::unordered_map< std::string, HaloLocationhaloTable
 Map containing conversion information for converting a string to a HaloLocation enum.
 
static const std::unordered_map< BoundaryCondition, std::string > conditionStringTable
 Reverse map containing conversion information for converting a BoundaryCondition enum to a string.
 
static const std::unordered_map< CellType, std::string > typeStringTable
 Reverse map containing conversion information for converting a CellType enum to a string.
 
static const std::unordered_map< HaloLocation, std::string > haloStringTable
 Reverse map containing conversion information for converting a HaloLocation enum to a string.
 

Detailed Description

Namespace containing utility functions for Cell and CellContainer objects.

Function Documentation

◆ fromBoundaryCondition()

static std::string CellUtils::fromBoundaryCondition ( BoundaryCondition  type)
inlinestatic

Converts a BoundaryCondition to a string.

Parameters
typeAn instance of the BoundaryCondition enum to be converted.
Returns
The resulting string.

◆ fromBoundaryConditionArray()

static std::string CellUtils::fromBoundaryConditionArray ( const std::array< BoundaryCondition, 6 > &  arr)
inlinestatic

Converts an array of BoundaryCondition enums to a truncated, concatenated string.

For each type, the first letter is chosen and appended to the final string.

Parameters
arrThe array of BoundaryCondition enums.
Returns
A string containing the initials of all elements, in order.

◆ fromHalo()

static std::string CellUtils::fromHalo ( HaloLocation  type)
inlinestatic

Converts a HaloLocation to a string.

Parameters
typeAn instance of the HaloLocation enum to be converted.
Returns
The resulting string.

◆ fromHaloVec()

static std::string CellUtils::fromHaloVec ( const std::vector< HaloLocation > &  vec)
inlinestatic

Converts a vector of HaloLocation enums to a truncated, concatenated string.

For each type, the first letter is chosen and appended to the final string.

Parameters
vecThe vector of HaloLocation enums.
Returns
A string containing the initials of all elements, in order.

◆ fromType()

static std::string CellUtils::fromType ( CellType  type)
inlinestatic

Converts a CellType to a string.

Parameters
typeAn instance of the CellType enum to be converted.
Returns
The resulting string.

◆ stringToBoundaryConditions()

static std::array< BoundaryCondition, 6 > CellUtils::stringToBoundaryConditions ( const std::string &  str)
inlinestatic

Converts a string of length 6 to an array of boundary conditions for each boundary.

The characters correspond to the boundary condition for the following directions (in this order): north, south, east, west, above, below. The string may only contain the characters described in the help string.

Parameters
strThe string to parse.
Returns
An array of boundary conditions for each boundary.

◆ toBoundaryCondition()

static BoundaryCondition CellUtils::toBoundaryCondition ( const std::string &  type)
inlinestatic

Converts a string to a BoundaryCondition enum using a dedicated map.

Parameters
typeThe string containing the desired BoundaryCondition.
Returns
The desired BoundaryCondition enum if the type string is valid, otherwise terminates with error.

◆ toHalo()

static HaloLocation CellUtils::toHalo ( const std::string &  type)
inlinestatic

Converts a string to a HaloLocation enum using a dedicated map.

Parameters
typeThe string containing the desired HaloLocation.
Returns
The desired HaloLocation enum if the type string is valid, otherwise terminates with error.

◆ toType()

static CellType CellUtils::toType ( const std::string &  type)
inlinestatic

Converts a string to a CellType enum using a dedicated map.

Parameters
typeThe string containing the desired CellType.
Returns
The desired CellType enum if the type string is valid, otherwise terminates with error.

Variable Documentation

◆ conditionStringTable

const std::unordered_map<BoundaryCondition, std::string> CellUtils::conditionStringTable
inlinestatic
Initial value:
= []() {
std::unordered_map<BoundaryCondition, std::string> reverseMap;
for (const auto &pair : conditionTable)
reverseMap[pair.second] = pair.first;
return reverseMap;
}()
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

Reverse map containing conversion information for converting a BoundaryCondition enum to a string.

◆ conditionTable

const std::unordered_map<std::string, BoundaryCondition> CellUtils::conditionTable
inlinestatic
Initial value:

Map containing conversion information for converting a string to a BoundaryCondition enum.

◆ haloStringTable

const std::unordered_map<HaloLocation, std::string> CellUtils::haloStringTable
inlinestatic
Initial value:
= []() {
std::unordered_map<HaloLocation, std::string> reverseMap;
for (const auto &pair : haloTable)
reverseMap[pair.second] = pair.first;
return reverseMap;
}()
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

Reverse map containing conversion information for converting a HaloLocation enum to a string.

◆ haloTable

const std::unordered_map<std::string, HaloLocation> CellUtils::haloTable
inlinestatic
Initial value:

Map containing conversion information for converting a string to a HaloLocation enum.

◆ typeStringTable

const std::unordered_map<CellType, std::string> CellUtils::typeStringTable
inlinestatic
Initial value:
= []() {
std::unordered_map<CellType, std::string> reverseMap;
for (const auto &pair : typeTable)
reverseMap[pair.second] = pair.first;
return reverseMap;
}()
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

Reverse map containing conversion information for converting a CellType enum to a string.

◆ typeTable

const std::unordered_map<std::string, CellType> CellUtils::typeTable
inlinestatic
Initial value:
= {
{"inner", CellType::INNER}, {"border", CellType::BORDER}, {"halo", CellType::HALO}}

Map containing conversion information for converting a string to a CellType enum.