Skip to content

Commit

Permalink
Extend comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jblueh committed Nov 3, 2023
1 parent fb364ea commit eb844d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Common/include/basic_types/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getI

// WARNING: For performance reasons, this method does not perform bounds checking.
// When using it, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
// This method does not perform locking either.
// It should be safeguarded by calls to AD::BeginUseAdjoints() and AD::EndUseAdjoints().
FORCEINLINE void SetDerivative(int index, const double val) {
if (index == 0) // Allow multiple threads to "set the derivative" of passive variables without causing data races.
return;
Expand All @@ -406,6 +408,8 @@ FORCEINLINE void SetDerivative(int index, const double val) {
// WARNING: For performance reasons, this method does not perform bounds checking.
// If called after tape evaluations, the adjoints should exist.
// Otherwise, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
// This method does not perform locking either.
// It should be safeguarded by calls to AD::BeginUseAdjoints() and AD::EndUseAdjoints().
FORCEINLINE double GetDerivative(int index) {
return AD::getTape().getGradient(index, codi::AdjointsManagement::Manual);
}
Expand Down

0 comments on commit eb844d4

Please sign in to comment.