40#include "../../misc/byteDataView.hpp"
42#include "storeAndRestoreActions.hpp"
43#include "traits/activeArgumentStoreTraits.hpp"
44#include "traits/passiveArgumentStoreTraits.hpp"
127 template<
size_t T_ActiveArguments>
132 static_assert(
ActiveArguments <= 64,
"More than 64 active arguments are currently not supported.");
141 void>::type>::type>::type>::type;
149 template<
typename T,
typename S = T>
161 bool primalRequired) {
164 if (isInput && primalRequired) {
165 actions |= RestoreAction::PrimalRestore;
166 }
else if (isOutput) {
167 actions |= RestoreAction::PrimalCreate;
170 if (isInput && isInputActive) {
171 actions |= RestoreAction::InputIdentifierRestore | RestoreAction::InputGradientCreate;
174 actions |= RestoreAction::OutputIdentifierRestore | RestoreAction::OutputGradientCreate;
182 bool isInputActive,
bool primalRequired) {
185 if (tapeActive && isInput && primalRequired) {
186 actions |= StoreAction::PrimalCreateOnTape;
190 actions |= StoreAction::PrimalExtract;
194 if (isInput && isInputActive) {
195 actions |= StoreAction::InputIdentifierCreateAndStore;
198 actions |= StoreAction::OutputIdentifierCreate;
232 fixedStore->
write(activity);
#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
uint16_t LowLevelFunctionToken
Token type for low level functions in the tapes.
Definition config.h:108
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Traits for storing active arguments in byte streams.
Definition activeArgumentStoreTraits.hpp:204
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
A bitset with enum items as flags.
Definition enumBitset.hpp:64
Helper structure for storing low level functions and their arguments on a tape.
Definition lowLevelFunctionCreationUtilities.hpp:128
static size_t constexpr ActiveArguments
See LowLevelFunctionCreationUtilities.
Definition lowLevelFunctionCreationUtilities.hpp:129
static void storeActivity(ByteDataView *fixedStore, ActivityStoreType const &activity)
Store the activity structure in the data stream.
Definition lowLevelFunctionCreationUtilities.hpp:231
static StoreActions createStoreActions(bool tapeActive, bool isInput, bool isOutput, bool isInputActive, bool primalRequired)
Collect the store actions for an argument in a StoreActions instance.
Definition lowLevelFunctionCreationUtilities.hpp:181
static size_t countActivitySize()
Return the size of the activity structure.
Definition lowLevelFunctionCreationUtilities.hpp:211
static RestoreActions createRestoreActions(bool isInput, bool isOutput, bool isInputActive, bool primalRequired)
Collect the restore actions for an argument in a RestoreActions instance.
Definition lowLevelFunctionCreationUtilities.hpp:160
static bool getActivity(ActivityStoreType const &activity, size_t arg)
Check the activity structure for activity of a specific argument.
Definition lowLevelFunctionCreationUtilities.hpp:216
static size_t constexpr TokenSize
Token size for the low level function token.
Definition lowLevelFunctionCreationUtilities.hpp:153
static void restoreActivity(ByteDataView *fixedStore, ActivityStoreType &activity)
Restore the activity structure from the data stream.
Definition lowLevelFunctionCreationUtilities.hpp:221
static void setActivity(ActivityStoreType &activity, size_t arg, bool active)
Store the activity of an argument in the activity structure.
Definition lowLevelFunctionCreationUtilities.hpp:226
typename std::conditional< ActiveArguments<=8, uint8_t, typename std::conditional< ActiveArguments<=16, uint16_t, typename std::conditional< ActiveArguments<=32, uint32_t, typename std::conditional< ActiveArguments<=64, uint64_t, void >::type >::type >::type >::type ActivityStoreType
Type for the activity store. Currently limited to 64 variables.
Definition lowLevelFunctionCreationUtilities.hpp:136
Traits for storing passive arguments in byte streams.
Definition passiveArgumentStoreTraits.hpp:57