4040#include < map>
4141#include < vector>
4242#include < stdexcept>
43+ #include < utility>
4344
4445// Forward declarations. These are needed because including ComMod.h causes a
4546// circular header dependency.
@@ -113,23 +114,24 @@ class BoundaryCondition {
113114 // / @brief Copy constructor
114115 BoundaryCondition (const BoundaryCondition& other);
115116
116- // / @brief Copy assignment operator
117- BoundaryCondition& operator =(const BoundaryCondition& other);
117+ // / @brief Unified assignment operator (handles both copy and move)
118+ BoundaryCondition& operator =(BoundaryCondition other);
118119
119120 // / @brief Move constructor
120121 BoundaryCondition (BoundaryCondition&& other) noexcept ;
121122
122- // / @brief Move assignment operator
123- BoundaryCondition& operator =(BoundaryCondition&& other) noexcept ;
124-
125123 // / @brief Virtual destructor
126- virtual ~BoundaryCondition () = default ;
124+ virtual ~BoundaryCondition () noexcept = default ;
125+
126+ // / @brief Swap function for copy-and-swap idiom (friend function)
127+ friend void swap (BoundaryCondition& lhs, BoundaryCondition& rhs) noexcept ;
127128
128129
129130 // / @brief Get value for a specific array and node
130131 // / @param array_name Name of the array
131132 // / @param node_id Node index on the face
132133 // / @return Value for the array at the specified node
134+ // / @throws std::runtime_error if array_name is not found
133135 double get_value (const std::string& array_name, int node_id) const ;
134136
135137 // / @brief Get a boolean flag by name
@@ -144,13 +146,13 @@ class BoundaryCondition {
144146
145147 // / @brief Get global number of nodes
146148 // / @return Global number of nodes on the face
147- int get_global_num_nodes () const {
149+ int get_global_num_nodes () const noexcept {
148150 return global_num_nodes_;
149151 }
150152
151153 // / @brief Get local number of nodes
152154 // / @return Local number of nodes on the face on this processor
153- int get_local_num_nodes () const {
155+ int get_local_num_nodes () const noexcept {
154156 return local_num_nodes_;
155157 }
156158
@@ -162,19 +164,19 @@ class BoundaryCondition {
162164
163165 // / @brief Check if data is loaded from VTP file
164166 // / @return true if loaded from VTP, false if using uniform values
165- bool is_from_vtp () const {
167+ bool is_from_vtp () const noexcept {
166168 return spatially_variable;
167169 }
168170
169171 // / @brief Get the VTP file path (empty if using uniform values)
170172 // / @return VTP file path
171- const std::string& get_vtp_path () const {
173+ const std::string& get_vtp_path () const noexcept {
172174 return vtp_file_path_;
173175 }
174176
175177 // / @brief Check if this BC is properly defined
176178 // / @return true if BC has been initialized with either VTP data or uniform values
177- bool is_defined () const {
179+ bool is_defined () const noexcept {
178180 return defined_;
179181 }
180182
0 commit comments