@@ -249,6 +249,16 @@ namespace AD{
249249 */
250250 inline void Push_TapePosition () {}
251251
252+ /* !
253+ * \brief Start a passive region, i.e. stop recording.
254+ */
255+ inline void BeginPassive () {}
256+
257+ /* !
258+ * \brief End a passive region, i.e. start recording if we were recording before.
259+ */
260+ inline void EndPassive () {}
261+
252262#else
253263 using CheckpointHandler = codi::DataStore;
254264
@@ -488,27 +498,23 @@ namespace AD{
488498
489499 FORCEINLINE void EndExtFunc () { delete FuncHelper; }
490500
491- #endif // CODI_REVERSE_TYPE
501+ FORCEINLINE void BeginPassive () {
502+ if (AD::globalTape.isActive ()) {
503+ AD::globalTape.setPassive ();
504+ AD::Status = true ;
505+ }
506+ }
492507
493- } // namespace AD
508+ FORCEINLINE void EndPassive () {
509+ if (AD::Status) {
510+ AD::globalTape.setActive ();
511+ AD::Status = false ;
512+ }
513+ }
494514
495- /* --- Macro to begin and end sections with a passive tape --- */
515+ # endif // CODI_REVERSE_TYPE
496516
497- #ifdef CODI_REVERSE_TYPE
498- #define AD_BEGIN_PASSIVE \
499- if (AD::globalTape.isActive()) {\
500- AD::globalTape.setPassive ();\
501- AD::Status = true ; \
502- }
503- #define AD_END_PASSIVE \
504- if (AD::Status) { \
505- AD::globalTape.setActive (); \
506- AD::Status = false ; \
507- }
508- #else
509- #define AD_BEGIN_PASSIVE
510- #define AD_END_PASSIVE
511- #endif
517+ } // namespace AD
512518
513519
514520/* --- If we compile under OSX we have to overload some of the operators for
0 commit comments