User-defined evaluation functions for the taping process. More...
#include <externalFunction.hpp>
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. | |
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:
registerExternalFunction
(ExternalFunctionTapeInterface)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.
T_Tape | The associated tape type. |
using codi::ExternalFunction< T_Tape >::Tape |
See ExternalFunction.
using codi::ExternalFunction< T_Tape >::VectorAccess |
Shortcut for VectorAccessInterface.