File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -213,8 +213,9 @@ class Variable
213213 * the generator to create the UUID for a specific variable instance.
214214 *
215215 * @param[in] uuid The unique ID number for this variable
216+ * @param[in] hold_constant Whether or not to mark variable as constant during optimization
216217 */
217- explicit Variable (const UUID& uuid);
218+ explicit Variable (const UUID& uuid, const bool hold_constant = false );
218219
219220 /* *
220221 * @brief Destructor
@@ -383,11 +384,20 @@ class Variable
383384 }
384385
385386 /* *
386- * @brief Specifies if the value of the variable should not be changed during optimization
387+ * @brief Retrieve whether or not the variable should be held constant during optimization
387388 */
388389 virtual bool holdConstant () const
389390 {
390- return false ;
391+ return hold_constant_;
392+ }
393+ /* *
394+ * @brief Set whether or not to consider variable as constant during optimization
395+ *
396+ * @param[in] hold_constant If true, variable will not change during optimization, false otherwise
397+ */
398+ virtual void setHoldConstant (const bool hold_constant)
399+ {
400+ hold_constant_ = hold_constant;
391401 }
392402
393403 /* *
@@ -440,7 +450,7 @@ class Variable
440450
441451private:
442452 fuse_core::UUID uuid_; // !< The unique ID number for this variable
443-
453+ bool hold_constant_ { false }; // !< Flag whether a variable should not be changed during optimization
444454 // Allow Boost Serialization access to private methods
445455 friend class boost ::serialization::access;
446456
Original file line number Diff line number Diff line change 3939namespace fuse_core
4040{
4141
42- Variable::Variable (const UUID& uuid) :
43- uuid_ (uuid)
42+ Variable::Variable (const UUID& uuid, const bool hold_constant) :
43+ uuid_ (uuid),
44+ hold_constant_ (hold_constant)
4445{
4546}
4647
You can’t perform that action at this time.
0 commit comments