Base class for boundary conditions with spatially variable arrays.
More...
#include <BoundaryCondition.h>
|
| | BoundaryCondition ()=default |
| | Default constructor - creates an empty BC.
|
| | BoundaryCondition (const std::string &vtp_file_path, const std::vector< std::string > &array_names, const StringBoolMap &flags, const faceType &face, SimulationLogger &logger) |
| | Constructor - reads data from VTP file.
|
| | BoundaryCondition (const StringDoubleMap &uniform_values, const StringBoolMap &flags, const faceType &face, SimulationLogger &logger) |
| | Constructor for uniform values.
|
| | BoundaryCondition (const BoundaryCondition &other) |
| | Copy constructor.
|
| BoundaryCondition & | operator= (BoundaryCondition other) |
| | Unified assignment operator (handles both copy and move).
|
| | BoundaryCondition (BoundaryCondition &&other) noexcept |
| | Move constructor.
|
| virtual | ~BoundaryCondition () noexcept=default |
| | Virtual destructor.
|
| double | get_value (const std::string &array_name, int node_id) const |
| | Get value for a specific array and node.
|
| bool | get_flag (const std::string &name) const |
| | Get a boolean flag by name.
|
| std::string | flags_to_string () const |
| | Get a string representation of the flags.
|
| int | get_global_num_nodes () const noexcept |
| | Get global number of nodes.
|
| int | get_local_num_nodes () const noexcept |
| | Get local number of nodes.
|
| int | get_local_index (int global_node_id) const |
| | Get local array index for a global node ID.
|
| bool | is_from_vtp () const noexcept |
| | Check if data is loaded from VTP file.
|
| const std::string & | get_vtp_path () const noexcept |
| | Get the VTP file path (empty if using uniform values).
|
| bool | is_initialized () const noexcept |
| | Check if this BC has been properly initialized with data.
|
| void | distribute (const ComMod &com_mod, const CmMod &cm_mod, const cmType &cm, const faceType &face) |
| | Distribute BC data from the master process to the slave processes.
|
|
| using | StringArrayMap = std::map<std::string, Array<double>> |
| | Type alias for map of array names to array data.
|
|
using | StringBoolMap = std::map<std::string, bool> |
|
using | StringDoubleMap = std::map<std::string, double> |
|
| StringArrayMap | read_data_from_vtp_file (const std::string &vtp_file_path, const std::vector< std::string > &array_names) |
| | Read data from VTP file.
|
| int | find_vtp_point_index (double x, double y, double z, const Array< double > &vtp_points, double mesh_scale_factor) const |
| | Find index of a point in the VTP points array.
|
| virtual void | validate_array_value (const std::string &array_name, double value) const |
| | Hook for derived classes to validate array values.
|
|
void | distribute_metadata (const CmMod &cm_mod, const cmType &cm, bool is_slave) |
|
void | distribute_spatially_variable (const ComMod &com_mod, const CmMod &cm_mod, const cmType &cm, bool is_slave) |
|
void | distribute_uniform (const CmMod &cm_mod, const cmType &cm, bool is_slave) |
|
void | distribute_flags (const CmMod &cm_mod, const cmType &cm, bool is_slave) |
Base class for boundary conditions with spatially variable arrays.
This class provides common functionality for boundary conditions that need to read and manage arrays of values from VTP files or uniform values. It handles distribution of data across processes and provides efficient access to values.
This class is intended to be subclassed by specific boundary condition types.
Development note: this class is intended to eventually be an object-oriented replacement of the existing bcType, although it is not yet complete.
Example usage:
public:
MyBoundaryCondition(
const std::string& vtp_file_path,
const std::vector<std::string>& array_names,
const faceType& face)
MyBoundaryCondition(
const std::map<std::string, double>& uniform_values,
const faceType& face)
};
Base class for boundary conditions with spatially variable arrays.
Definition BoundaryCondition.h:48
BoundaryCondition()=default
Default constructor - creates an empty BC.
The face type containing mesh at boundary.
Definition ComMod.h:470
◆ StringArrayMap
Type alias for map of array names to array data.
◆ BoundaryCondition() [1/5]
| BoundaryCondition::BoundaryCondition |
( |
| ) |
|
|
default |
Default constructor - creates an empty BC.
◆ BoundaryCondition() [2/5]
| BoundaryCondition::BoundaryCondition |
( |
const std::string & | vtp_file_path, |
|
|
const std::vector< std::string > & | array_names, |
|
|
const StringBoolMap & | flags, |
|
|
const faceType & | face, |
|
|
SimulationLogger & | logger ) |
Constructor - reads data from VTP file.
- Parameters
-
| vtp_file_path | Path to VTP file containing arrays |
| array_names | Names of arrays to read from VTP file |
| face | Face associated with the BC |
| logger | Simulation logger used to write warnings |
- Exceptions
-
| std::runtime_error | if file cannot be read or arrays are missing |
◆ BoundaryCondition() [3/5]
| BoundaryCondition::BoundaryCondition |
( |
const StringDoubleMap & | uniform_values, |
|
|
const StringBoolMap & | flags, |
|
|
const faceType & | face, |
|
|
SimulationLogger & | logger ) |
Constructor for uniform values.
- Parameters
-
| uniform_values | Map of array names to uniform values |
| face | Face associated with the BC |
| logger | Simulation logger used to write warnings |
◆ BoundaryCondition() [4/5]
◆ BoundaryCondition() [5/5]
◆ ~BoundaryCondition()
| virtual BoundaryCondition::~BoundaryCondition |
( |
| ) |
|
|
virtualdefaultnoexcept |
◆ distribute()
| void BoundaryCondition::distribute |
( |
const ComMod & | com_mod, |
|
|
const CmMod & | cm_mod, |
|
|
const cmType & | cm, |
|
|
const faceType & | face ) |
Distribute BC data from the master process to the slave processes.
- Parameters
-
| com_mod | Reference to ComMod object for global coordinates |
| cm_mod | Reference to CmMod object for MPI communication |
| cm | Reference to cmType object for MPI communication |
| face | Face associated with the BC |
◆ find_vtp_point_index()
| int BoundaryCondition::find_vtp_point_index |
( |
double | x, |
|
|
double | y, |
|
|
double | z, |
|
|
const Array< double > & | vtp_points, |
|
|
double | mesh_scale_factor ) const |
|
protected |
Find index of a point in the VTP points array.
- Parameters
-
| x | X coordinate |
| y | Y coordinate |
| z | Z coordinate |
| vtp_points | VTP points array |
| mesh_scale_factor | Scale factor applied to mesh coordinates |
- Returns
- Index of the matching point in the VTP array
- Exceptions
-
| std::runtime_error | if no matching point is found |
◆ flags_to_string()
| std::string BoundaryCondition::flags_to_string |
( |
| ) |
const |
Get a string representation of the flags.
- Returns
- String representation of the flags
◆ get_flag()
| bool BoundaryCondition::get_flag |
( |
const std::string & | name | ) |
const |
Get a boolean flag by name.
- Parameters
-
- Returns
- Value of the flag
- Exceptions
-
| std::runtime_error | if flag is not found |
◆ get_global_num_nodes()
| int BoundaryCondition::get_global_num_nodes |
( |
| ) |
const |
|
inlinenoexcept |
Get global number of nodes.
- Returns
- Global number of nodes on the face
◆ get_local_index()
| int BoundaryCondition::get_local_index |
( |
int | global_node_id | ) |
const |
Get local array index for a global node ID.
- Parameters
-
| global_node_id | The global node ID defined on the face |
- Returns
- Local array index for data arrays
- Exceptions
-
| std::runtime_error | if global_node_id is not found in the map |
◆ get_local_num_nodes()
| int BoundaryCondition::get_local_num_nodes |
( |
| ) |
const |
|
inlinenoexcept |
Get local number of nodes.
- Returns
- Local number of nodes on the face on this processor
◆ get_value()
| double BoundaryCondition::get_value |
( |
const std::string & | array_name, |
|
|
int | node_id ) const |
Get value for a specific array and node.
- Parameters
-
| array_name | Name of the array |
| node_id | Node index on the face |
- Returns
- Value for the array at the specified node
- Exceptions
-
| std::runtime_error | if array_name is not found |
◆ get_vtp_path()
| const std::string & BoundaryCondition::get_vtp_path |
( |
| ) |
const |
|
inlinenoexcept |
Get the VTP file path (empty if using uniform values).
- Returns
- VTP file path
◆ is_from_vtp()
| bool BoundaryCondition::is_from_vtp |
( |
| ) |
const |
|
inlinenoexcept |
Check if data is loaded from VTP file.
- Returns
- true if loaded from VTP, false if using uniform values
◆ is_initialized()
| bool BoundaryCondition::is_initialized |
( |
| ) |
const |
|
inlinenoexcept |
Check if this BC has been properly initialized with data.
- Returns
- true if BC has data (either global or local arrays are populated)
◆ operator=()
Unified assignment operator (handles both copy and move).
◆ read_data_from_vtp_file()
Read data from VTP file.
- Parameters
-
| vtp_file_path | Path to VTP file |
| array_names | Names of arrays to read |
- Returns
- Map of array names to array data
◆ validate_array_value()
| virtual void BoundaryCondition::validate_array_value |
( |
const std::string & | array_name, |
|
|
double | value ) const |
|
inlineprotectedvirtual |
Hook for derived classes to validate array values.
- Parameters
-
| array_name | Name of the array being validated |
| value | Value to validate |
- Exceptions
-
| std::runtime_error | if validation fails |
Reimplemented in RobinBoundaryCondition.
◆ array_names_
| std::vector<std::string> BoundaryCondition::array_names_ |
|
protected |
Names of arrays to read from VTP file.
◆ face_
| const faceType* BoundaryCondition::face_ = nullptr |
|
protected |
◆ flags_
| StringBoolMap BoundaryCondition::flags_ |
|
protected |
Named boolean flags for BC behavior.
◆ global_data_
Global array values (only populated on master).
◆ global_node_map_
| std::map<int, int> BoundaryCondition::global_node_map_ |
|
protected |
Maps global node IDs to local array indices.
◆ global_num_nodes_
| int BoundaryCondition::global_num_nodes_ = 0 |
|
protected |
Global number of nodes on the face.
◆ local_data_
Local array values for each node on this processor.
◆ local_num_nodes_
| int BoundaryCondition::local_num_nodes_ = 0 |
|
protected |
Local number of nodes on this processor.
◆ logger_
◆ POINT_MATCH_TOLERANCE
| double BoundaryCondition::POINT_MATCH_TOLERANCE = 1e-12 |
|
staticconstexpr |
Tolerance for point matching in VTP files.
◆ spatially_variable
| bool BoundaryCondition::spatially_variable = false |
|
protected |
Flag indicating if data is from VTP file.
◆ vtp_data_
| std::unique_ptr<VtkVtpData> BoundaryCondition::vtp_data_ |
|
protected |
◆ vtp_file_path_
| std::string BoundaryCondition::vtp_file_path_ |
|
protected |
Path to VTP file (empty if uniform).
The documentation for this class was generated from the following files: