Skip to content

Commit 626788c

Browse files
Initialize members with default values and use default default constructor
1 parent f894ef8 commit 626788c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Code/Source/solver/BoundaryCondition.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,25 @@ class BoundaryCondition {
7979
using StringDoubleMap = std::map<std::string, double>;
8080

8181
/// @brief Data members for BC
82-
const faceType* face_; ///< Face associated with the BC (can be null)
83-
int global_num_nodes_; ///< Global number of nodes on the face
84-
int local_num_nodes_; ///< Local number of nodes on this processor
82+
const faceType* face_ = nullptr; ///< Face associated with the BC (can be null)
83+
int global_num_nodes_ = 0; ///< Global number of nodes on the face
84+
int local_num_nodes_ = 0; ///< Local number of nodes on this processor
8585
std::vector<std::string> array_names_; ///< Names of arrays to read from VTP file
8686
StringArrayMap local_data_; ///< Local array values for each node on this processor
8787
StringArrayMap global_data_; ///< Global array values (only populated on master)
8888
StringBoolMap flags_; ///< Named boolean flags for BC behavior
89-
bool spatially_variable; ///< Flag indicating if data is from VTP file
89+
bool spatially_variable = false; ///< Flag indicating if data is from VTP file
9090
std::string vtp_file_path_; ///< Path to VTP file (empty if uniform)
9191
std::map<int, int> global_node_map_; ///< Maps global node IDs to local array indices
9292
std::unique_ptr<VtkVtpData> vtp_data_; ///< VTP data object
93-
bool defined_; ///< Whether this BC has been properly initialized
93+
bool defined_ = false; ///< Whether this BC has been properly initialized
9494

9595
public:
9696
/// @brief Tolerance for point matching in VTP files
9797
static constexpr double POINT_MATCH_TOLERANCE = 1e-12;
9898

9999
/// @brief Default constructor - creates an empty BC
100-
BoundaryCondition() : face_(nullptr), global_num_nodes_(0), local_num_nodes_(0), spatially_variable(false), defined_(false) {}
100+
BoundaryCondition() = default;
101101

102102
/// @brief Constructor - reads data from VTP file
103103
/// @param vtp_file_path Path to VTP file containing arrays
@@ -218,6 +218,9 @@ class BoundaryCondition {
218218
};
219219

220220
/// @brief Base exception class for BC errors
221+
///
222+
/// These exceptions indicate fatal errors that should terminate the solver.
223+
/// They should not be caught and handled gracefully - the solver should exit.
221224
class BoundaryConditionBaseException : public std::exception {
222225
public:
223226
/// @brief Constructor

0 commit comments

Comments
 (0)