38#include "../../expressions/lhsExpressionInterface.hpp"
39#include "../../misc/exceptions.hpp"
41#include "../data/position.hpp"
42#include "../interfaces/externalFunctionTapeInterface.hpp"
43#include "../misc/vectorAccessInterface.hpp"
44#include "lowLevelFunctionEntry.hpp"
53 void* adjointInterface);
101 template<
typename T_Tape>
143 "Calling an external function in reverse mode without providing a reverse evaluation function.");
153 "Calling an external function in forward mode without providing a forward evaluation function.");
162 CODI_EXCEPTION(
"Calling an external function in primal mode without providing a primal evaluation function.");
177 template<
typename T_Tape,
typename T_Real,
typename T_Identifier>
214 tape.pushLowLevelFunction(token,
sizeof(
ExtFunc), data);
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
uint16_t LowLevelFunctionToken
Token type for low level functions in the tapes.
Definition config.h:108
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Definition byteDataView.hpp:51
T * read(size_t size)
Read an array of length size of types T.
Definition byteDataView.hpp:85
T * write(T const &data)
Write a single entry of type T.
Definition byteDataView.hpp:114
Internal untyped data for an external function.
Definition externalFunction.hpp:50
ExternalFunctionInternalData()
Constructor.
Definition externalFunction.hpp:66
ExternalFunctionInternalData(CallFunctionUntyped funcReverse, CallFunctionUntyped funcForward, CallFunctionUntyped funcPrimal, DeleteFunctionUntyped funcDelete, void *data)
Constructor.
Definition externalFunction.hpp:72
CallFunctionUntyped funcForward
Forward evaluation function pointer.
Definition externalFunction.hpp:57
void(* DeleteFunctionUntyped)(void *tape, void *data)
Delete function definition.
Definition externalFunction.hpp:54
DeleteFunctionUntyped funcDelete
User data deletion function pointer.
Definition externalFunction.hpp:59
void * data
User data pointer.
Definition externalFunction.hpp:61
void(* CallFunctionUntyped)(void *tape, void *data, void *adjointInterface)
Call function definition.
Definition externalFunction.hpp:52
CallFunctionUntyped funcReverse
Reverse evaluation function pointer.
Definition externalFunction.hpp:56
CallFunctionUntyped funcPrimal
Primal evaluation function pointer.
Definition externalFunction.hpp:58
Low level function entry implementation for external functions.
Definition externalFunction.hpp:178
T_Tape Tape
See ExternalFunctionLowLevelEntryMapper.
Definition externalFunction.hpp:179
static void del(Tape *tape, ByteDataView &data)
Recovers the external function data and calls deleteData on it.
Definition externalFunction.hpp:206
static void primal(Tape *tape, ByteDataView &data, VectorAccess *access)
Recovers the external function data and calls evaluatePrimal on it.
Definition externalFunction.hpp:194
static void store(Tape &tape, Config::LowLevelFunctionToken token, ExtFunc const &extFunc)
Store an external function on the tape.
Definition externalFunction.hpp:212
T_Identifier Identifier
See ExternalFunctionLowLevelEntryMapper.
Definition externalFunction.hpp:181
static LowLevelFunctionEntry< Tape, Real, Identifier > create()
Create the function entry for the tape registration.
Definition externalFunction.hpp:220
static void reverse(Tape *tape, ByteDataView &data, VectorAccess *access)
Recovers the external function data and calls evaluateReverse on it.
Definition externalFunction.hpp:200
static void forward(Tape *tape, ByteDataView &data, VectorAccess *access)
Recovers the external function data and calls evaluateForward on it.
Definition externalFunction.hpp:188
T_Real Real
See ExternalFunctionLowLevelEntryMapper.
Definition externalFunction.hpp:180
Add user defined functions to the tape evaluation.
Definition externalFunctionTapeInterface.hpp:76
User-defined evaluation functions for the taping process.
Definition externalFunction.hpp:102
T_Tape Tape
See ExternalFunction.
Definition externalFunction.hpp:105
ExternalFunction(CallFunction funcReverse, CallFunction funcForward, CallFunction funcPrimal, void *data, DeleteFunction funcDelete)
Any arguments can be nullptr if not required.
Definition externalFunction.hpp:116
void evaluatePrimal(Tape *tape, VectorAccess *adjointInterface) const
Calls the primal function if not nullptr, otherwise throws a CODI_EXCEPTION.
Definition externalFunction.hpp:158
void(* DeleteFunction)(Tape *tape, void *data)
Delete function definition.
Definition externalFunction.hpp:113
static ExternalFunction create(CallFunction funcReverse, void *data, DeleteFunction funcDelete, CallFunction funcForward=nullptr, CallFunction funcPrimal=nullptr)
Helper function for the creation of an ExternalFunction object.
Definition externalFunction.hpp:124
void deleteData(Tape *tape)
Calls the delete function if not nullptr.
Definition externalFunction.hpp:130
void evaluateReverse(Tape *tape, VectorAccess *adjointInterface) const
Calls the reverse function if not nullptr, otherwise throws a CODI_EXCEPTION.
Definition externalFunction.hpp:138
void evaluateForward(Tape *tape, VectorAccess *adjointInterface) const
Calls the forward function if not nullptr, otherwise throws a CODI_EXCEPTION.
Definition externalFunction.hpp:148
void(* CallFunction)(Tape *tape, void *data, VectorAccess *adjointInterface)
Call function definition.
Definition externalFunction.hpp:111
Low level function entry on the tape. See LowLevelFunctionTapeInterface for details.
Definition lowLevelFunctionEntry.hpp:67
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition vectorAccessInterface.hpp:91