CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::ExternalFunction< T_Tape > Struct Template Reference

User-defined evaluation functions for the taping process. More...

#include <externalFunction.hpp>

Inheritance diagram for codi::ExternalFunction< T_Tape >:

Public Types

typedef void(* CallFunction) (Tape *tape, void *data, VectorAccess *adjointInterface)
 Call function definition.
 
typedef void(* DeleteFunction) (Tape *tape, void *data)
 Delete function definition.
 
using Tape
 See ExternalFunction.
 
using VectorAccess
 

Public Member Functions

void deleteData (Tape *tape)
 Calls the delete function if not nullptr.
 
void evaluateForward (Tape *tape, VectorAccess *adjointInterface) const
 Calls the forward function if not nullptr, otherwise throws a CODI_EXCEPTION.
 
void evaluatePrimal (Tape *tape, VectorAccess *adjointInterface) const
 Calls the primal function if not nullptr, otherwise throws a CODI_EXCEPTION.
 
void evaluateReverse (Tape *tape, VectorAccess *adjointInterface) const
 Calls the reverse function if not nullptr, otherwise throws a CODI_EXCEPTION.
 
 ExternalFunction (CallFunction funcReverse, CallFunction funcForward, CallFunction funcPrimal, void *data, DeleteFunction funcDelete)
 Any arguments can be nullptr if not required.
 
- Public Member Functions inherited from codi::ExternalFunctionInternalData
 ExternalFunctionInternalData ()
 Constructor.
 

Static Public Member Functions

static ExternalFunction create (CallFunction funcReverse, void *data, DeleteFunction funcDelete, CallFunction funcForward=nullptr, CallFunction funcPrimal=nullptr)
 Helper function for the creation of an ExternalFunction object.
 

Additional Inherited Members

- Protected Types inherited from codi::ExternalFunctionInternalData
typedef void(* CallFunctionUntyped) (void *tape, void *data, void *adjointInterface)
 Call function definition.
 
typedef void(* DeleteFunctionUntyped) (void *tape, void *data)
 Delete function definition.
 
- Protected Member Functions inherited from codi::ExternalFunctionInternalData
 ExternalFunctionInternalData (CallFunctionUntyped funcReverse, CallFunctionUntyped funcForward, CallFunctionUntyped funcPrimal, DeleteFunctionUntyped funcDelete, void *data)
 Constructor.
 
- Protected Attributes inherited from codi::ExternalFunctionInternalData
void * data
 User data pointer.
 
DeleteFunctionUntyped funcDelete
 User data deletion function pointer.
 
CallFunctionUntyped funcForward
 Forward evaluation function pointer.
 
CallFunctionUntyped funcPrimal
 Primal evaluation function pointer.
 
CallFunctionUntyped funcReverse
 Reverse evaluation function pointer.
 

Detailed Description

template<typename T_Tape>
struct codi::ExternalFunction< T_Tape >

User-defined evaluation functions for the taping process.

See ExternalFunctionTapeInterface for details.

The user can provide call functions for the reverse, forward and primal evaluation of a tape. These need to be of the type CallFunction which has the tree arguments:

  • tape: The type of the tape on which this object was registered with registerExternalFunction (ExternalFunctionTapeInterface)
  • data: User-provided data, type is known by the user.
  • adjointInterface: VectorAccessInterface instantiated with <typename Tape::Real, typename Tape::Identifier>

The tape pointer can be used for general access to the tape. For each access to the gradient data, the adjointInterface should be used. If no custom adjoint vectors are used in the application, then the tape pointer can also be used for the gradient data access.

The delete function is called when the entry of the tape for the external function is deleted.

Template Parameters
T_TapeThe associated tape type.

Member Typedef Documentation

◆ Tape

template<typename T_Tape >
using codi::ExternalFunction< T_Tape >::Tape
Initial value:
T_Tape

See ExternalFunction.

◆ VectorAccess

template<typename T_Tape >
using codi::ExternalFunction< T_Tape >::VectorAccess
Initial value:
VectorAccessInterface<typename Tape::Real, typename Tape::Identifier>

Shortcut for VectorAccessInterface.


The documentation for this struct was generated from the following files: