Skip to content

Commit 8b1dd95

Browse files
committed
Updates for the tagging tape.
1 parent 0dc6ac0 commit 8b1dd95

3 files changed

Lines changed: 50 additions & 7 deletions

File tree

include/codi/tapes/tagging/tagTapeReverse.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ namespace codi {
269269

270270
/// Verify tag.
271271
bool isIdentifierActive(Identifier const& index) const {
272-
Base::verifyTag(index.tag);
273-
274272
return index.tag != Base::PassiveTag;
275273
}
276274

include/codi/tools/helpers/preaccumulationHelper.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,7 @@ namespace codi {
560560
* and the outputs.
561561
*/
562562
template<typename T_Type>
563-
struct PreaccumulationHelper<
564-
T_Type, typename enable_if_same<typename T_Type::Tape,
565-
TagTapeReverse<typename T_Type::Real, typename T_Type::Tape::Tag>>::type> {
563+
struct PreaccumulationHelper<T_Type, TapeTraits::EnableIfTagTapeReverse<typename T_Type::Tape>> {
566564
public:
567565

568566
using Type = CODI_DD(T_Type, CODI_DEFAULT_LHS_EXPRESSION); ///< See PreaccumulationHelper.
@@ -668,8 +666,10 @@ namespace codi {
668666
}
669667

670668
void handleInput(Type const& input) {
671-
inputLocations.push_back(&input);
672-
getTape().setTagOnVariable(input);
669+
if (Type::getTape().getPassiveIndex() != input.getIdentifier()) {
670+
inputLocations.push_back(&input);
671+
getTape().setTagOnVariable(input);
672+
}
673673
}
674674

675675
/// Terminator for the recursive implementation.

include/codi/traits/tapeTraits.hpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,51 @@ namespace codi {
183183
template<typename Tape>
184184
using EnableIfNoEditing = typename std::enable_if<!SupportsEditing<Tape>::value>::type;
185185

186+
187+
/// If the tape inherits from TagTapeBase.
188+
template<typename Tape, typename = void>
189+
struct IsTagTape : std::false_type {};
190+
191+
#ifndef DOXYGEN_DISABLE
192+
template<typename Tape>
193+
struct IsTagTape<Tape, typename enable_if_base_of<TagTapeReverse<typename Tape::Real, typename Tape::Tag>, Tape>::type>
194+
: std::true_type {};
195+
196+
template<typename Tape>
197+
struct IsTagTape<Tape, typename enable_if_base_of<TagTapeForward<typename Tape::Real, typename Tape::Tag>, Tape>::type>
198+
: std::true_type {};
199+
#endif
200+
201+
#if CODI_IS_CPP14
202+
/// Value entry of IsTagTape
203+
template<typename Tape>
204+
bool constexpr isTagTape = IsTagTape<Tape>::value;
205+
#endif
206+
207+
/// Enable if wrapper for IsTagTape
208+
template<typename Tape>
209+
using EnableIfTagTape = typename std::enable_if<IsTagTape<Tape>::value>::type;
210+
211+
/// If the tape inherits from TagTapeReverse.
212+
template<typename Tape, typename = void>
213+
struct IsTagTapeReverse : std::false_type {};
214+
215+
#ifndef DOXYGEN_DISABLE
216+
template<typename Tape>
217+
struct IsTagTapeReverse<Tape, typename enable_if_base_of<TagTapeReverse<typename Tape::Real, typename Tape::Tag>, Tape>::type>
218+
: std::true_type {};
219+
#endif
220+
221+
#if CODI_IS_CPP14
222+
/// Value entry of IsTagTape
223+
template<typename Tape>
224+
bool constexpr isTagTapeReverse = IsTagTapeReverse<Tape>::value;
225+
#endif
226+
227+
/// Enable if wrapper for IsTagTape
228+
template<typename Tape>
229+
using EnableIfTagTapeReverse = typename std::enable_if<IsTagTapeReverse<Tape>::value>::type;
230+
186231
/// @}
187232
}
188233
}

0 commit comments

Comments
 (0)