CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
eventSystem.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35#pragma once
36
37#include <list>
38#include <map>
39
40#include "../config.h"
41#include "../tapes/interfaces/fullTapeInterface.hpp"
42#include "macros.hpp"
43
45namespace codi {
46
50 namespace EventHints {
52 enum class EvaluationKind {
53 Primal,
54 Forward,
55 Reverse
56 };
57
59 enum class Endpoint {
60 Begin,
61 End
62 };
63
65 enum class Statement {
66 Expression,
67 Copy,
68 Passive
69 };
70
72 enum class Reset {
73 Full,
74 Hard,
75 To
76 };
77 }
78
107 template<typename T_Tape>
109 public:
110 using Tape = CODI_DD(T_Tape, CODI_DEFAULT_TAPE);
111 using Real = typename Tape::Real;
112 using Identifier = typename Tape::Identifier;
113
114 using Handle = size_t;
115
116 protected:
118 enum class Event {
119 /* AD workflow */
120 TapeStartRecording,
121 TapeStopRecording,
122 TapeRegisterInput,
123 TapeRegisterOutput,
124 TapeEvaluate,
125 TapeReset,
126 /* preaccumulation */
127 PreaccStart,
128 PreaccFinish,
129 PreaccAddInput,
130 PreaccAddOutput,
131 /* statement events */
132 StatementPrimal,
133 StatementStoreOnTape,
134 StatementEvaluate,
135 StatementEvaluatePrimal,
136 /* index management events */
137 IndexCreate,
138 IndexAssign,
139 IndexFree,
140 IndexCopy,
141 /* total number of events */
142 Count
143 };
144
145 using Callback = void*;
147 using EventListenerMap = std::map<Event, std::list<std::pair<Handle, std::pair<Callback, void*>>>>;
148
158 static EventListenerMap* const listeners =
159 new EventListenerMap{{Event::TapeStartRecording, {}}, {Event::TapeStopRecording, {}},
160 {Event::TapeRegisterInput, {}}, {Event::TapeRegisterOutput, {}},
161 {Event::TapeEvaluate, {}}, {Event::TapeReset, {}},
162 {Event::PreaccStart, {}}, {Event::PreaccFinish, {}},
163 {Event::PreaccAddInput, {}}, {Event::PreaccAddOutput, {}},
164 {Event::StatementPrimal, {}}, {Event::StatementStoreOnTape, {}},
165 {Event::StatementEvaluate, {}}, {Event::StatementEvaluatePrimal, {}},
166 {Event::IndexCreate, {}}, {Event::IndexAssign, {}},
167 {Event::IndexFree, {}}, {Event::IndexCopy, {}}};
168
169 codiAssert(listeners->size() == (size_t)Event::Count);
170
171 return *listeners;
172 }
173
174 private:
175
176 static Handle nextHandle;
177
178 protected:
179
193 template<typename TypedCallback>
194 static CODI_INLINE Handle internalRegisterListener(bool const enabled, Event event, TypedCallback callback,
195 void* customData) {
196 if (enabled) {
197 nextHandle = nextHandle + 1;
198 Handle handle = nextHandle;
199 getListeners()[event].push_back(std::make_pair(handle, std::make_pair((void*)callback, customData)));
200 return handle;
201 }
202
203 return 0;
204 }
205
218 template<typename TypedCallback, typename... Args>
219 static CODI_INLINE void internalNotifyListeners(bool const enabled, Event event, Args&&... args) {
220 if (enabled) {
221 for (auto const& listener : getListeners()[event]) {
222 ((TypedCallback)listener.second.first)(std::forward<Args>(args)..., listener.second.second);
223 }
224 }
225 }
226
227 public:
228
229 /*******************************************************************************/
232
241 static CODI_INLINE Handle registerStatementPrimalListener(void (*callback)(Tape&, Real const&, Identifier const&,
243 void*),
244 void* customData = nullptr) {
245 return internalRegisterListener(Config::StatementEvents, Event::StatementPrimal, callback, customData);
246 }
247
264 static CODI_INLINE void notifyStatementPrimalListeners(Tape& tape, Real const& lhsValue,
265 Identifier const& lhsIdentifier, Real const& newValue,
266 EventHints::Statement statement) {
267 internalNotifyListeners<void (*)(Tape&, Real const&, Identifier const&, Real const&, EventHints::Statement,
268 void*)>(Config::StatementEvents, Event::StatementPrimal, tape, lhsValue,
269 lhsIdentifier, newValue, statement);
270 }
271
278 static CODI_INLINE void notifyStatementPrimalListeners(Tape&& tape, Real const& lhsValue,
279 Identifier const& lhsIdentifier, Real const& newValue,
280 EventHints::Statement statement) {
281 Tape localTape = tape;
282 notifyStatementPrimalListeners(localTape, lhsValue, lhsIdentifier, newValue, statement);
283 }
284
286 /*******************************************************************************/
289
297 static CODI_INLINE void deregisterListener(Handle const& handle) {
298 for (auto& listenersForEvent : getListeners()) {
299 auto iterator = listenersForEvent.second.begin();
300 for (; listenersForEvent.second.end() != iterator; ++iterator) {
301 if (handle == iterator->first) {
302 break;
303 }
304 }
305
306 if (listenersForEvent.second.end() != iterator) {
307 listenersForEvent.second.erase(iterator);
308 break;
309 }
310 }
311 }
312
314 };
315
316 template<typename Tape>
317 typename EventSystemBase<Tape>::Handle EventSystemBase<Tape>::nextHandle = 0;
318
328 template<typename T_Tape>
329 struct EventSystem : public EventSystemBase<T_Tape> {
330 public:
331 using Tape = CODI_DD(T_Tape, CODI_DEFAULT_TAPE);
332 using Real = typename Tape::Real;
333 using Gradient = typename Tape::Gradient;
334 using Identifier = typename Tape::Identifier;
335 using Index = typename Tape::Identifier;
336 using Position = typename Tape::Position;
339
341 using Event = typename Base::Event;
342 using Handle = typename Base::Handle;
343
344 /*******************************************************************************/
347
357 void* customData = nullptr) {
358 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeStartRecording, callback,
359 customData);
360 }
361
371 Base::template internalNotifyListeners<void (*)(Tape&, void*)>(Config::ADWorkflowEvents,
372 Event::TapeStartRecording, tape);
373 }
374
384 void* customData = nullptr) {
385 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeStopRecording, callback, customData);
386 }
387
397 Base::template internalNotifyListeners<void (*)(Tape&, void*)>(Config::ADWorkflowEvents,
398 Event::TapeStopRecording, tape);
399 }
400
410 void* customData = nullptr) {
411 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeRegisterInput, callback, customData);
412 }
413
424 static CODI_INLINE void notifyTapeRegisterInputListeners(Tape& tape, Real& value, Identifier& identifier) {
425 Base::template internalNotifyListeners<void (*)(Tape&, Real&, Identifier&, void*)>(
426 Config::ADWorkflowEvents, Event::TapeRegisterInput, tape, value, identifier);
427 }
428
438 void* customData = nullptr) {
439 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeRegisterOutput, callback,
440 customData);
441 }
442
453 static CODI_INLINE void notifyTapeRegisterOutputListeners(Tape& tape, Real& value, Identifier& identifier) {
454 Base::template internalNotifyListeners<void (*)(Tape&, Real&, Identifier&, void*)>(
455 Config::ADWorkflowEvents, Event::TapeRegisterOutput, tape, value, identifier);
456 }
457
466 static CODI_INLINE Handle registerTapeEvaluateListener(void (*callback)(Tape&, Position const&, Position const&,
468 EventHints::Endpoint, void*),
469 void* customData = nullptr) {
470 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeEvaluate, callback, customData);
471 }
472
486 static CODI_INLINE void notifyTapeEvaluateListeners(Tape& tape, Position const& start, Position const& end,
487 VectorAccess* adjoint, EventHints::EvaluationKind evalKind,
488 EventHints::Endpoint endpoint) {
489 Base::template internalNotifyListeners<void (*)(Tape&, Position const&, Position const&, VectorAccess*,
491 Config::ADWorkflowEvents, Event::TapeEvaluate, tape, start, end, adjoint, evalKind, endpoint);
492 }
493
503 bool, void*),
504 void* customData = nullptr) {
505 return Base::internalRegisterListener(Config::ADWorkflowEvents, Event::TapeReset, callback, customData);
506 }
507
521 static CODI_INLINE void notifyTapeResetListeners(Tape& tape, Position const& position, EventHints::Reset kind,
522 bool clearAdjoints) {
523 Base::template internalNotifyListeners<void (*)(Tape&, Position const&, EventHints::Reset, bool, void*)>(
524 Config::ADWorkflowEvents, Event::TapeReset, tape, position, kind, clearAdjoints);
525 }
526
528 /*******************************************************************************/
531
540 static CODI_INLINE Handle registerPreaccStartListener(void (*callback)(Tape&, void*),
541 void* customData = nullptr) {
542 return Base::internalRegisterListener(Config::PreaccEvents, Event::PreaccStart, callback, customData);
543 }
544
554 Base::template internalNotifyListeners<void (*)(Tape&, void*)>(Config::PreaccEvents, Event::PreaccStart, tape);
555 }
556
565 static CODI_INLINE Handle registerPreaccFinishListener(void (*callback)(Tape&, void*),
566 void* customData = nullptr) {
567 return Base::internalRegisterListener(Config::PreaccEvents, Event::PreaccFinish, callback, customData);
568 }
569
580 Base::template internalNotifyListeners<void (*)(Tape&, void*)>(Config::PreaccEvents, Event::PreaccFinish, tape);
581 }
582
591 static CODI_INLINE Handle registerPreaccAddInputListener(void (*callback)(Tape&, Real const&, Identifier const&,
592 void*),
593 void* customData = nullptr) {
594 return Base::internalRegisterListener(Config::PreaccEvents, Event::PreaccAddInput, callback, customData);
595 }
596
607 static CODI_INLINE void notifyPreaccAddInputListeners(Tape& tape, Real const& value,
608 Identifier const& identifier) {
609 Base::template internalNotifyListeners<void (*)(Tape&, Real const&, Identifier const&, void*)>(
610 Config::PreaccEvents, Event::PreaccAddInput, tape, value, identifier);
611 }
612
622 void* customData = nullptr) {
623 return Base::internalRegisterListener(Config::PreaccEvents, Event::PreaccAddOutput, callback, customData);
624 }
625
636 static CODI_INLINE void notifyPreaccAddOutputListeners(Tape& tape, Real& value, Identifier& identifier) {
637 Base::template internalNotifyListeners<void (*)(Tape&, Real&, Identifier&, void*)>(
638 Config::PreaccEvents, Event::PreaccAddOutput, tape, value, identifier);
639 }
640
642 /*******************************************************************************/
645
655 void (*callback)(Tape&, Identifier const&, Real const&, size_t, Identifier const*, Real const*, void*),
656 void* customData = nullptr) {
657 return Base::internalRegisterListener(Config::StatementEvents, Event::StatementStoreOnTape, callback,
658 customData);
659 }
660
676 static CODI_INLINE void notifyStatementStoreOnTapeListeners(Tape& tape, Identifier const& lhsIdentifier,
677 Real const& newValue, size_t numActiveVariables,
678 Identifier const* rhsIdentifiers,
679 Real const* jacobians) {
680 Base::template internalNotifyListeners<void (*)(Tape&, Identifier const&, Real const&, size_t,
681 Identifier const*, Real const*, void*)>(
682 Config::StatementEvents, Event::StatementStoreOnTape, tape, lhsIdentifier, newValue, numActiveVariables,
683 rhsIdentifiers, jacobians);
684 }
685
694 static CODI_INLINE Handle registerStatementEvaluateListener(void (*callback)(Tape&, Identifier const&, size_t,
695 Real const*, void*),
696 void* customData = nullptr) {
697 return Base::internalRegisterListener(Config::StatementEvents, Event::StatementEvaluate, callback, customData);
698 }
699
712 static CODI_INLINE void notifyStatementEvaluateListeners(Tape& tape, Identifier const& lhsIdentifier,
713 size_t sizeLhsAdjoint, Real const* lhsAdjoint) {
714 Base::template internalNotifyListeners<void (*)(Tape&, Identifier const&, size_t, Real const*, void*)>(
715 Config::StatementEvents, Event::StatementEvaluate, tape, lhsIdentifier, sizeLhsAdjoint, lhsAdjoint);
716 }
717
727 Real const&, void*),
728 void* customData = nullptr) {
729 return Base::internalRegisterListener(Config::StatementEvents, Event::StatementEvaluatePrimal, callback,
730 customData);
731 }
732
745 static CODI_INLINE void notifyStatementEvaluatePrimalListeners(Tape& tape, Identifier const& lhsIdentifier,
746 Real const& lhsValue) {
747 Base::template internalNotifyListeners<void (*)(Tape&, Identifier const&, Real const&, void*)>(
748 Config::StatementEvents, Event::StatementEvaluatePrimal, tape, lhsIdentifier, lhsValue);
749 }
750
752 /*******************************************************************************/
755
764 static CODI_INLINE Handle registerIndexAssignListener(void (*callback)(Index const&, void*),
765 void* customData = nullptr) {
766 return Base::internalRegisterListener(Config::IndexEvents, Event::IndexAssign, callback, customData);
767 }
768
778 static CODI_INLINE void notifyIndexAssignListeners(Index const& index) {
779 Base::template internalNotifyListeners<void (*)(Index const&, void*)>(Config::IndexEvents, Event::IndexAssign,
780 index);
781 }
782
791 static CODI_INLINE Handle registerIndexFreeListener(void (*callback)(Index const&, void*),
792 void* customData = nullptr) {
793 return Base::internalRegisterListener(Config::IndexEvents, Event::IndexFree, callback, customData);
794 }
795
806 static CODI_INLINE void notifyIndexFreeListeners(Index const& index) {
807 Base::template internalNotifyListeners<void (*)(Index const&, void*)>(Config::IndexEvents, Event::IndexFree,
808 index);
809 }
810
819 static CODI_INLINE Handle registerIndexCopyListener(void (*callback)(Index const&, void*),
820 void* customData = nullptr) {
821 return Base::internalRegisterListener(Config::IndexEvents, Event::IndexCopy, callback, customData);
822 }
823
833 static CODI_INLINE void notifyIndexCopyListeners(Index const& index) {
834 Base::template internalNotifyListeners<void (*)(Index const&, void*)>(Config::IndexEvents, Event::IndexCopy,
835 index);
836 }
837
839 };
840
841 /* forward declaration */
842 template<typename Real, typename Gradient>
843 struct ForwardEvaluation;
844
845#if !CODI_CUDA
854 template<typename Real, typename Gradient>
855 struct EventSystem<ForwardEvaluation<Real, Gradient>> : public EventSystemBase<ForwardEvaluation<Real, Gradient>> {};
856#else
865 template<typename T_Real, typename T_Gradient>
866 struct EventSystem<ForwardEvaluation<T_Real, T_Gradient>> {
867 public:
868 using Tape = CODI_DD(CODI_T(ForwardEvaluation<T_Real, T_Gradient>), CODI_DEFAULT_TAPE);
869 using Real = CODI_DD(T_Real, double);
870 using Identifier = CODI_DD(T_Gradient, double);
871
872 using Handle = size_t;
873
875 static CODI_INLINE Handle registerStatementPrimalListener(void (*callback)(Tape&, Real const&, Identifier const&,
877 void*),
878 void* customData = nullptr) {
879 CODI_UNUSED(callback, customData);
880
881 return 0;
882 }
883
885 static CODI_INLINE void notifyStatementPrimalListeners(Tape&& tape, Real const& lhsValue,
886 Identifier const& lhsIdentifier, Real const& newValue,
887 EventHints::Statement statement) {
888 CODI_UNUSED(tape, lhsValue, lhsIdentifier, newValue, statement);
889 }
890
892 static CODI_INLINE void deregisterListener(Handle const& handle) {
893 CODI_UNUSED(handle);
894 }
895
897 };
898#endif
899}
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define codiAssert(x)
See codi::Config::EnableAssert.
Definition config.h:432
#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
bool constexpr PreaccEvents
Enable preaccumulation events. Disabled by default.
Definition config.h:311
bool constexpr ADWorkflowEvents
Enable AD workflow events, also known as Tape* events. Enabled by default.
Definition config.h:303
bool constexpr IndexEvents
Enable index management events. Disabled by default.
Definition config.h:327
bool constexpr StatementEvents
Enable statement events. Disabled by default.
Definition config.h:319
Statement
Classify statements.
Definition eventSystem.hpp:65
Reset
Characterize a tape reset.
Definition eventSystem.hpp:72
EvaluationKind
Classify tape evaluations.
Definition eventSystem.hpp:52
Endpoint
Distinguish between beginning and end of tape evaluations.
Definition eventSystem.hpp:59
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:46
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Base class for the CoDiPack event system.
Definition eventSystem.hpp:108
size_t Handle
Handle that identifies a registered callback.
Definition eventSystem.hpp:114
std::map< Event, std::list< std::pair< Handle, std::pair< Callback, void * > > > > EventListenerMap
Map that links events to registered callbacks and their associated custom data.
Definition eventSystem.hpp:147
Event
Full set of events.
Definition eventSystem.hpp:118
static Handle registerStatementPrimalListener(void(*callback)(Tape &, Real const &, Identifier const &, Real const &, EventHints::Statement, void *), void *customData=nullptr)
Register callbacks for StatementPrimal events.
Definition eventSystem.hpp:241
static void notifyStatementPrimalListeners(Tape &tape, Real const &lhsValue, Identifier const &lhsIdentifier, Real const &newValue, EventHints::Statement statement)
Invoke callbacks for StatementPrimal events.
Definition eventSystem.hpp:264
T_Tape Tape
See EventSystemBase.
Definition eventSystem.hpp:110
static void deregisterListener(Handle const &handle)
Deregister a listener.
Definition eventSystem.hpp:297
typename Tape::Identifier Identifier
Identifier type used by the tape.
Definition eventSystem.hpp:112
void * Callback
Definition eventSystem.hpp:145
static void notifyStatementPrimalListeners(Tape &&tape, Real const &lhsValue, Identifier const &lhsIdentifier, Real const &newValue, EventHints::Statement statement)
Invoke callbacks for StatementPrimal events.
Definition eventSystem.hpp:278
static void internalNotifyListeners(bool const enabled, Event event, Args &&... args)
Internal method for callback invocation.
Definition eventSystem.hpp:219
static EventListenerMap & getListeners()
Access the static EventListenerMap.
Definition eventSystem.hpp:157
typename Tape::Real Real
Floating point type the tape is based on.
Definition eventSystem.hpp:111
static Handle internalRegisterListener(bool const enabled, Event event, TypedCallback callback, void *customData)
Internal method for callback registration.
Definition eventSystem.hpp:194
Full EventSystem implementation for reverse tapes.
Definition eventSystem.hpp:329
typename Tape::Identifier Identifier
Identifier type used by the tape.
Definition eventSystem.hpp:334
T_Tape Tape
See EventSystem.
Definition eventSystem.hpp:331
static Handle registerTapeStopRecordingListener(void(*callback)(Tape &, void *), void *customData=nullptr)
Register callbacks for TapeStopRecording events.
Definition eventSystem.hpp:383
static void notifyIndexAssignListeners(Index const &index)
Invoke callbacks for IndexAssign events.
Definition eventSystem.hpp:778
static Handle registerIndexAssignListener(void(*callback)(Index const &, void *), void *customData=nullptr)
Register callbacks for IndexAssign events.
Definition eventSystem.hpp:764
static Handle registerIndexFreeListener(void(*callback)(Index const &, void *), void *customData=nullptr)
Register callbacks for IndexFree events.
Definition eventSystem.hpp:791
typename Base::Event Event
See EventSystemBase.
Definition eventSystem.hpp:341
static Handle registerTapeRegisterInputListener(void(*callback)(Tape &, Real &, Identifier &, void *), void *customData=nullptr)
Register callbacks for TapeRegisterInput events.
Definition eventSystem.hpp:409
static Handle registerStatementEvaluatePrimalListener(void(*callback)(Tape &, Identifier const &, Real const &, void *), void *customData=nullptr)
Register callbacks for StatementEvaluatePrimal events.
Definition eventSystem.hpp:726
static Handle registerPreaccAddOutputListener(void(*callback)(Tape &, Real &, Identifier &, void *), void *customData=nullptr)
Register callbacks for PreaccAddOutput events.
Definition eventSystem.hpp:621
static void notifyStatementStoreOnTapeListeners(Tape &tape, Identifier const &lhsIdentifier, Real const &newValue, size_t numActiveVariables, Identifier const *rhsIdentifiers, Real const *jacobians)
Invoke callbacks for StatementStoreOnTape events.
Definition eventSystem.hpp:676
static void notifyTapeRegisterOutputListeners(Tape &tape, Real &value, Identifier &identifier)
Invoke callbacks for TapeRegisterOutput events.
Definition eventSystem.hpp:453
static Handle registerPreaccFinishListener(void(*callback)(Tape &, void *), void *customData=nullptr)
Register callbacks for PreaccFinish events.
Definition eventSystem.hpp:565
static void notifyTapeResetListeners(Tape &tape, Position const &position, EventHints::Reset kind, bool clearAdjoints)
Invoke callbacks for TapeReset events.
Definition eventSystem.hpp:521
static void notifyIndexFreeListeners(Index const &index)
Invoke callbacks for IndexFree events.
Definition eventSystem.hpp:806
static Handle registerStatementEvaluateListener(void(*callback)(Tape &, Identifier const &, size_t, Real const *, void *), void *customData=nullptr)
Register callbacks for StatementEvaluate events.
Definition eventSystem.hpp:694
static void notifyPreaccFinishListeners(Tape &tape)
Invoke callbacks for PreaccFinish events.
Definition eventSystem.hpp:579
static Handle registerIndexCopyListener(void(*callback)(Index const &, void *), void *customData=nullptr)
Register callbacks for IndexCopy events.
Definition eventSystem.hpp:819
static void notifyTapeStopRecordingListeners(Tape &tape)
Invoke callbacks for TapeStopRecording events.
Definition eventSystem.hpp:396
static Handle registerTapeStartRecordingListener(void(*callback)(Tape &, void *), void *customData=nullptr)
Register callbacks for TapeStartRecording events.
Definition eventSystem.hpp:356
static void notifyStatementEvaluatePrimalListeners(Tape &tape, Identifier const &lhsIdentifier, Real const &lhsValue)
Invoke callbacks for StatementEvaluatePrimal events.
Definition eventSystem.hpp:745
static Handle registerTapeRegisterOutputListener(void(*callback)(Tape &, Real &, Identifier &, void *), void *customData=nullptr)
Register callbacks for TapeRegisterOutput events.
Definition eventSystem.hpp:437
static void notifyIndexCopyListeners(Index const &index)
Invoke callbacks for IndexCopy events.
Definition eventSystem.hpp:833
typename Tape::Gradient Gradient
Gradient type used by the tape.
Definition eventSystem.hpp:333
static Handle registerTapeResetListener(void(*callback)(Tape &, Position const &, EventHints::Reset, bool, void *), void *customData=nullptr)
Register callbacks for TapeReset events.
Definition eventSystem.hpp:502
static void notifyTapeEvaluateListeners(Tape &tape, Position const &start, Position const &end, VectorAccess *adjoint, EventHints::EvaluationKind evalKind, EventHints::Endpoint endpoint)
Invoke callbacks for TapeEvaluate events.
Definition eventSystem.hpp:486
static void notifyPreaccAddOutputListeners(Tape &tape, Real &value, Identifier &identifier)
Invoke callbacks for PreaccAddOutput events.
Definition eventSystem.hpp:636
static Handle registerTapeEvaluateListener(void(*callback)(Tape &, Position const &, Position const &, VectorAccess *, EventHints::EvaluationKind, EventHints::Endpoint, void *), void *customData=nullptr)
Register callbacks for TapeEvaluate events.
Definition eventSystem.hpp:466
typename Base::Handle Handle
See EventSystemBase.
Definition eventSystem.hpp:342
typename Tape::Real Real
Floating point type the tape is based on.
Definition eventSystem.hpp:332
static void notifyPreaccAddInputListeners(Tape &tape, Real const &value, Identifier const &identifier)
Invoke callbacks for PreaccAddInput events.
Definition eventSystem.hpp:607
static void notifyPreaccStartListeners(Tape &tape)
Invoke callbacks for PreaccStart events.
Definition eventSystem.hpp:553
static void notifyStatementEvaluateListeners(Tape &tape, Identifier const &lhsIdentifier, size_t sizeLhsAdjoint, Real const *lhsAdjoint)
Invoke callbacks for StatementEvaluate events.
Definition eventSystem.hpp:712
static void notifyTapeStartRecordingListeners(Tape &tape)
Invoke callbacks for TapeStartRecording events.
Definition eventSystem.hpp:370
static void notifyTapeRegisterInputListeners(Tape &tape, Real &value, Identifier &identifier)
Invoke callbacks for TapeRegisterInput events.
Definition eventSystem.hpp:424
static Handle registerStatementStoreOnTapeListener(void(*callback)(Tape &, Identifier const &, Real const &, size_t, Identifier const *, Real const *, void *), void *customData=nullptr)
Register callbacks for StatementStoreOnTape events.
Definition eventSystem.hpp:654
static Handle registerPreaccStartListener(void(*callback)(Tape &, void *), void *customData=nullptr)
Register callbacks for PreaccStart events.
Definition eventSystem.hpp:540
typename Tape::Position Position
Definition eventSystem.hpp:336
typename Tape::Identifier Index
Index type used by the tape.
Definition eventSystem.hpp:335
static Handle registerPreaccAddInputListener(void(*callback)(Tape &, Real const &, Identifier const &, void *), void *customData=nullptr)
Register callbacks for PreaccAddInput events.
Definition eventSystem.hpp:591
Implementation of a tape-free forward AD mode through the internal expression interfaces.
Definition forwardEvaluation.hpp:72