Documentation 6b54b78464
Loading...
Searching...
No Matches
ad_structure.hpp File Reference

Main routines for the algorithmic differentiation (AD) structure. More...

Go to the source code of this file.

Classes

struct  AD::DebugControl
 Struct to store information about errors during a tag debug run. More...
 

Namespaces

namespace  AD
 Contains routines for the reverse mode of AD. In case there is no reverse type configured, they have no effect at all, and so the real versions of the routined are after #else.
 

Typedefs

using AD::Identifier = int
 

Enumerations

enum class  AD::TAPE_DEBUG_OPTION {
  AD::ALLOW_PREACC , AD::ACTIVATE_PREACC , AD::ALLOW_ZONE , AD::ALLOW_ALL_ZONES ,
  AD::ACTIVATE_ALL_ZONES , AD::ACTIVATE_ALL_ERRORS , AD::MULTIZONE_TAGS , AD::INIT_RUN ,
  AD::CHECK_RUN
}
 

Functions

void AD::StartRecording ()
 Start the recording of the operations and involved variables. If called, the computational graph of all operations occuring after the call will be stored, starting with the variables registered with RegisterInput.
 
bool AD::PauseRecording ()
 Pause the recording of the operations and involved variables. If called, all operations occuring after the call will not be stored on the computational graph.
 
void AD::ResumeRecording (bool wasActive)
 Resume the recording of the operations and variables after the recording had been paused.
 
void AD::StopRecording ()
 Stops the recording of the operations and variables.
 
bool AD::TapeActive ()
 Check if the tape is active.
 
template<typename Comm >
void AD::PrintStatistics (Comm communicator, bool printingRank)
 Prints out tape statistics.
 
void AD::RegisterInput (su2double &data)
 Registers the variable as an input. I.e. as a leaf of the computational graph.
 
void AD::RegisterOutput (su2double &data)
 Registers the variable as an output. I.e. as the root of the computational graph.
 
void AD::ResizeAdjoints ()
 Resize the adjoint vector, for subsequent access without bounds checking.
 
void AD::BeginUseAdjoints ()
 Declare that the adjoints are being used, to protect against resizing.
 
void AD::EndUseAdjoints ()
 Declare that the adjoints are no longer being used.
 
void AD::SetDerivative (Identifier index, const double val)
 Sets the adjoint value at index to val.
 
double AD::GetDerivative (Identifier index)
 Extracts the adjoint value at index.
 
Identifier AD::GetPassiveIndex ()
 Returns the identifier that represents an inactive variable.
 
void AD::ClearAdjoints ()
 Clears the currently stored adjoints but keeps the computational graph.
 
void AD::ComputeAdjoint ()
 Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
 
void AD::ComputeAdjoint (unsigned short enter, unsigned short leave)
 Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
 
void AD::ComputeAdjointForward ()
 Computes the adjoints, i.e., the derivatives of the output with respect to the input variables, using forward tape evaluation.
 
void AD::Reset ()
 Reset the tape structure to be ready for a new recording.
 
void AD::ResetInput (su2double &data)
 Reset the variable (set index to zero).
 
template<class... Ts>
void AD::SetPreaccIn (Ts &&... data)
 Sets the scalar inputs of a preaccumulation section.
 
template<class T >
void AD::SetPreaccIn (const T &data, const int size)
 Sets the input variables of a preaccumulation section using a 1D array.
 
template<class T >
void AD::SetPreaccIn (const T &data, const int size_x, const int size_y)
 Sets the input variables of a preaccumulation section using a 2D array.
 
void AD::StartPreacc ()
 Starts a new preaccumulation section and sets the input variables.
 
template<class... Ts>
void AD::SetPreaccOut (Ts &&... data)
 Sets the scalar outputs of a preaccumulation section.
 
template<class T >
void AD::SetPreaccOut (T &&data, const int size)
 Sets the output variables of a preaccumulation section using a 1D array.
 
template<class T >
void AD::SetPreaccOut (T &&data, const int size_x, const int size_y)
 Sets the input variables of a preaccumulation section using a 2D array.
 
void AD::EndPreacc ()
 Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the variables set with SetLocalInput(), SetLocalOutput() and pushes a statement for each output variable to the AD tape.
 
void AD::SetExtFuncIn (su2double &data)
 Sets the scalar input of a externally differentiated function.
 
template<class T >
void AD::SetExtFuncIn (const T &data, const int size)
 Sets the input variables of a externally differentiated function using a 1D array.
 
template<class T >
void AD::SetExtFuncIn (const T &data, const int size_x, const int size_y)
 Sets the input variables of a externally differentiated function using a 2D array.
 
void AD::SetExtFuncOut (su2double &data)
 Sets the scalar output of a externally differentiated function.
 
template<class T >
void AD::SetExtFuncOut (T &&data, const int size)
 Sets the output variables of a externally differentiated function using a 1D array.
 
template<class T >
void AD::SetExtFuncOut (T &&data, const int size_x, const int size_y)
 Sets the output variables of a externally differentiated function using a 2D array.
 
void AD::SetIndex (Identifier &index, const su2double &data)
 Evaluates and saves gradient data from a variable.
 
void AD::SetTag (int tag)
 Sets the tag tape to a specific tag.
 
int AD::GetTag ()
 Gets the current tag.
 
int AD::ComputeTag (unsigned short iZone)
 Compute the zone-specific tag.
 
void AD::ClearTagOnVariable (su2double &v)
 Sets the tag of a variable to 0.
 
void AD::SetTagOnVariable (su2double &v, int zone_tag=0, int run_tag=0)
 Sets the tag of a variable to a specified value.
 
void AD::SetDebugControl (DebugControl *control)
 Set a pointer to the current DebugControl.
 
void AD::SetTapeDebugOption (TAPE_DEBUG_OPTION option, unsigned short izone=0)
 Set options which kind of tag mismatches are considered errors and written to file.
 
void AD::ActivateTagErrorCallback ()
 Activate the error callback by letting the tape call tagErrorCallback whenever a tag mismatch arises.
 
void AD::SetDebugReportFile (DebugControl &control, std::ostream *output_file)
 Set a pointer to the output file of a DebugControl.
 
void AD::ResetErrorCounter (DebugControl &control)
 Reset the error counter in a DebugControl.
 
unsigned long AD::GetErrorCount (const DebugControl &control)
 Get the error count of a DebugControl.
 
void AD::Push_TapePosition ()
 Pushes back the current tape position to the tape position's vector.
 
bool AD::BeginPassive ()
 Start a passive region, i.e. stop recording.
 
void AD::EndPassive (bool wasActive)
 End a passive region, i.e. start recording if we were recording before.
 
bool AD::PausePreaccumulation ()
 Pause the use of preaccumulation.
 
void AD::ResumePreaccumulation (bool wasActive)
 Resume the use of preaccumulation.
 
void AD::StartNoSharedReading ()
 Begin a hybrid parallel adjoint evaluation mode that assumes an inherently safe reverse path.
 
void AD::EndNoSharedReading ()
 End the "no shared reading" adjoint evaluation mode.
 
void AD::Initialize ()
 
void AD::Finalize ()
 

Detailed Description

Main routines for the algorithmic differentiation (AD) structure.

Author
T. Albring, J. Blühdorn, O. Burghardt
Version
8.5.0 "Harrier"

SU2 Project Website: https://su2code.github.io

The SU2 Project is maintained by the SU2 Foundation (http://su2foundation.org)

Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)

SU2 is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

SU2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with SU2. If not, see http://www.gnu.org/licenses/.