DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::Euler::BoundaryHandler< model > Class Template Reference

Per-zone boundary condition handler for Euler/Navier-Stokes solvers. More...

#include <EulerBC.hpp>

Public Types

using TU_R = Eigen::Vector< real, nVarsFixed >
 Fixed-size (read-only) state vector type.
 
using TU = Eigen::VectorFMTSafe< real, nVarsFixed >
 fmt-printable state vector type.
 
using TFlags = std::map< std::string, uint32_t >
 Per-zone option flag map (key → integer flag).
 
using json = nlohmann::ordered_json
 

Public Member Functions

 BoundaryHandler (int _nVars)
 Construct a BoundaryHandler and pre-populate default BC zones.
 
std::vector< std::string > GetAllNames ()
 Return the names of all registered BC zones, ordered by internal ID.
 
Geom::t_index size ()
 Return the number of registered BC zones (including default slots).
 
void RenewID2name ()
 Rebuild the reverse map (ID2name) from the current name2ID map.
 
void PushBCWithJson (const json &gS)
 Push a new BC zone from a JSON sub-object (not yet implemented).
 
Geom::t_index GetIDFromName (const std::string &name)
 Look up the internal BC index for a given zone name.
 
auto GetNameFormID (Geom::t_index id)
 Look up the zone name for a given internal BC index.
 
EulerBCType GetTypeFromID (Geom::t_index id)
 Retrieve the BC type for a given zone index.
 
TU GetValueFromID (Geom::t_index id)
 Retrieve the BC state vector for a given zone index.
 
Eigen::Vector< real, Eigen::Dynamic > GetValueExtraFromID (Geom::t_index id)
 Retrieve the extra BC value vector for a given zone index.
 
uint32_t GetFlagFromID (Geom::t_index id, const std::string &key)
 Retrieve an option flag for a given zone index (strict).
 
uint32_t GetFlagFromIDSoft (Geom::t_index id, const std::string &key)
 Retrieve an option flag for a given zone index (lenient).
 

Static Public Attributes

static const int nVarsFixed = getnVarsFixed(model)
 Compile-time variable count (or Eigen::Dynamic).
 

Friends

void from_json (const json &j, BoundaryHandler< model > &bc)
 Deserialize an array of BC entries from JSON into bc.
 
void to_json (json &j, const BoundaryHandler< model > &bc)
 Serialize user-defined BC zones (those beyond the default slots) to JSON.
 

Detailed Description

template<EulerModel model>
class DNDS::Euler::BoundaryHandler< model >

Per-zone boundary condition handler for Euler/Navier-Stokes solvers.

Stores the BC type, state vector (value), option flags, and extra values for every boundary zone in the mesh. Zones are identified by name; the internal name2ID map translates mesh zone names to sequential BC indices.

Default zones (far-field, wall, special test-case walls, etc.) are pre-populated during construction from Geom::GetFaceName2IDDefault().

Supports JSON round-trip serialization via ADL from_json / to_json.

Template Parameters
modelThe EulerModel tag that determines nVarsFixed and the conservative variable layout.

Definition at line 211 of file EulerBC.hpp.

Member Typedef Documentation

◆ json

template<EulerModel model>
using DNDS::Euler::BoundaryHandler< model >::json = nlohmann::ordered_json

Definition at line 288 of file EulerBC.hpp.

◆ TFlags

template<EulerModel model>
using DNDS::Euler::BoundaryHandler< model >::TFlags = std::map<std::string, uint32_t>

Per-zone option flag map (key → integer flag).

Definition at line 219 of file EulerBC.hpp.

◆ TU

fmt-printable state vector type.

Definition at line 218 of file EulerBC.hpp.

◆ TU_R

template<EulerModel model>
using DNDS::Euler::BoundaryHandler< model >::TU_R = Eigen::Vector<real, nVarsFixed>

Fixed-size (read-only) state vector type.

Definition at line 217 of file EulerBC.hpp.

Constructor & Destructor Documentation

◆ BoundaryHandler()

template<EulerModel model>
DNDS::Euler::BoundaryHandler< model >::BoundaryHandler ( int  _nVars)
inline

Construct a BoundaryHandler and pre-populate default BC zones.

Allocates storage for Geom::BC_ID_DEFAULT_MAX zones with uninitialized values and populates the default zone names and types (far-field, wall, special test-case boundaries) from Geom::GetFaceName2IDDefault().

Parameters
_nVarsNumber of conservative variables (must match model).

Definition at line 239 of file EulerBC.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ GetAllNames()

template<EulerModel model>
std::vector< std::string > DNDS::Euler::BoundaryHandler< model >::GetAllNames ( )
inline

Return the names of all registered BC zones, ordered by internal ID.

Returns
Vector of zone name strings.

Definition at line 265 of file EulerBC.hpp.

◆ GetFlagFromID()

template<EulerModel model>
uint32_t DNDS::Euler::BoundaryHandler< model >::GetFlagFromID ( Geom::t_index  id,
const std::string &  key 
)
inline

Retrieve an option flag for a given zone index (strict).

Aborts if key is not present in the zone's flag map.

Parameters
idInternal BC index.
keyFlag key string (e.g. "frameOpt", "anchorOpt").
Returns
The flag value, or 0 if id is not an external BC face.

Definition at line 555 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GetFlagFromIDSoft()

template<EulerModel model>
uint32_t DNDS::Euler::BoundaryHandler< model >::GetFlagFromIDSoft ( Geom::t_index  id,
const std::string &  key 
)
inline

Retrieve an option flag for a given zone index (lenient).

Returns 0 instead of aborting when key is absent.

Parameters
idInternal BC index.
keyFlag key string.
Returns
The flag value, or 0 if the key is missing or id is not external.

Definition at line 571 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GetIDFromName()

template<EulerModel model>
Geom::t_index DNDS::Euler::BoundaryHandler< model >::GetIDFromName ( const std::string &  name)
inline

Look up the internal BC index for a given zone name.

If periodic, the returned index is negative (by convention).

Parameters
nameMesh zone name string.
Returns
The BC index, or Geom::BC_ID_NULL if the name is not registered.

Definition at line 489 of file EulerBC.hpp.

◆ GetNameFormID()

template<EulerModel model>
auto DNDS::Euler::BoundaryHandler< model >::GetNameFormID ( Geom::t_index  id)
inline

Look up the zone name for a given internal BC index.

Parameters
idInternal BC index.
Returns
The zone name, or "UnNamedBC" if the index has no associated name.

Definition at line 502 of file EulerBC.hpp.

◆ GetTypeFromID()

template<EulerModel model>
EulerBCType DNDS::Euler::BoundaryHandler< model >::GetTypeFromID ( Geom::t_index  id)
inline

Retrieve the BC type for a given zone index.

Parameters
idInternal BC index.
Returns
The EulerBCType, or BCUnknown if id is not an external BC face.

Definition at line 514 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GetValueExtraFromID()

template<EulerModel model>
Eigen::Vector< real, Eigen::Dynamic > DNDS::Euler::BoundaryHandler< model >::GetValueExtraFromID ( Geom::t_index  id)
inline

Retrieve the extra BC value vector for a given zone index.

Parameters
idInternal BC index.
Returns
The extra value vector (e.g. anchor coordinates), or default if not an external BC.

Definition at line 539 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GetValueFromID()

template<EulerModel model>
TU DNDS::Euler::BoundaryHandler< model >::GetValueFromID ( Geom::t_index  id)
inline

Retrieve the BC state vector for a given zone index.

Parameters
idInternal BC index.
Returns
The state vector, or the default (index 0) vector if id is not an external BC.

Definition at line 527 of file EulerBC.hpp.

Here is the call graph for this function:

◆ PushBCWithJson()

template<EulerModel model>
void DNDS::Euler::BoundaryHandler< model >::PushBCWithJson ( const json gS)
inline

Push a new BC zone from a JSON sub-object (not yet implemented).

Parameters
gSJSON object describing the boundary condition.

Definition at line 292 of file EulerBC.hpp.

◆ RenewID2name()

template<EulerModel model>
void DNDS::Euler::BoundaryHandler< model >::RenewID2name ( )
inline

Rebuild the reverse map (ID2name) from the current name2ID map.

Definition at line 281 of file EulerBC.hpp.

Here is the caller graph for this function:

◆ size()

template<EulerModel model>
Geom::t_index DNDS::Euler::BoundaryHandler< model >::size ( )
inline

Return the number of registered BC zones (including default slots).

Definition at line 275 of file EulerBC.hpp.

Friends And Related Symbol Documentation

◆ from_json

template<EulerModel model>
void from_json ( const json j,
BoundaryHandler< model > &  bc 
)
friend

Deserialize an array of BC entries from JSON into bc.

Each JSON element must contain at least "type" and "name". Additional keys depend on the BC group (flow, wall, symmetry). Validates that the value vector dimension matches nVars and that zone names are unique.

Parameters
jJSON array of BC objects.
bcTarget BoundaryHandler to populate.

Definition at line 307 of file EulerBC.hpp.

◆ to_json

template<EulerModel model>
void to_json ( json j,
const BoundaryHandler< model > &  bc 
)
friend

Serialize user-defined BC zones (those beyond the default slots) to JSON.

Zones with index < Geom::BC_ID_DEFAULT_MAX are built-in defaults and are not emitted. The output is a JSON array suitable for round-trip with from_json().

Parameters
jOutput JSON array.
bcSource BoundaryHandler to serialize.

TODO: make bcId arbitrary not sequential?

Definition at line 428 of file EulerBC.hpp.

Member Data Documentation

◆ nVarsFixed

template<EulerModel model>
const int DNDS::Euler::BoundaryHandler< model >::nVarsFixed = getnVarsFixed(model)
static

Compile-time variable count (or Eigen::Dynamic).

Definition at line 216 of file EulerBC.hpp.


The documentation for this class was generated from the following file: