File tree Expand file tree Collapse file tree
Common/include/basic_types Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,19 @@ inline void RegisterOutput(su2double& data) {}
7878 */
7979inline void ResizeAdjoints () {}
8080
81+ /* !
82+ * \brief Declare that the adjoints are being used, to protect against resizing.
83+ *
84+ * Should be used together with AD::EndUseAdjoints() to protect AD::SetDerivative() and AD::GetDerivative() calls,
85+ * multiple at once if possible.
86+ */
87+ inline void BeginUseAdjoints () {}
88+
89+ /* !
90+ * \brief Declare that the adjoints are no longer being used.
91+ */
92+ inline void EndUseAdjoints () {}
93+
8194/* !
8295 * \brief Sets the adjoint value at index to val
8396 * \param[in] index - Position in the adjoint vector.
@@ -375,6 +388,10 @@ FORCEINLINE void Reset() {
375388
376389FORCEINLINE void ResizeAdjoints () { AD::getTape ().resizeAdjointVector (); }
377390
391+ FORCEINLINE void BeginUseAdjoints () { AD::getTape ().beginUseAdjointVector (); }
392+
393+ FORCEINLINE void EndUseAdjoints () { AD::getTape ().beginUseAdjointVector (); }
394+
378395FORCEINLINE void SetIndex (int & index, const su2double& data) { index = data.getIdentifier (); }
379396
380397// WARNING: For performance reasons, this method does not perform bounds checking.
You can’t perform that action at this time.
0 commit comments