CoDiPack  3.1.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
tagTapeForward.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2026 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 "../../config.h"
38#include "../../expressions/lhsExpressionInterface.hpp"
39#include "../../misc/macros.hpp"
40#include "../../traits/realTraits.hpp"
41#include "../interfaces/gradientAccessTapeInterface.hpp"
42#include "../interfaces/internalStatementRecordingTapeInterface.hpp"
43#include "tagData.hpp"
44#include "tagTapeBase.hpp"
45
47namespace codi {
48
59 template<typename T_Real, typename T_Tag>
61 public GradientAccessTapeInterface<T_Tag, T_Tag>,
62 public TagTapeBase<T_Real, T_Tag, TagData<T_Tag>, TagTapeForward<T_Real, T_Tag>> {
63 public:
64
65 using Real = CODI_DD(T_Real, double);
66 using Tag = CODI_DD(T_Tag, double);
67
69 struct TapeTypes {
71 struct IndexManager {
73 using Index = int;
74 };
75 };
76
81
83
85
86 private:
87
89 Gradient tempGradient;
90
91 public:
92
94 TagTapeForward() : Base(), tempGradient() {}
95
100 using Base::store;
101
102 /*******************************************************************************/
105
107 void setGradient(Identifier& identifier, Gradient const& gradient) {
108 CODI_UNUSED(identifier, gradient);
109 }
110
112 Gradient const& getGradient(Identifier const& identifier) const {
113 CODI_UNUSED(identifier);
114
115 return tempGradient;
116 }
117
120 CODI_UNUSED(identifier);
121
122 return tempGradient;
123 }
124
126 Gradient const& gradient(Identifier const& identifier) const {
127 CODI_UNUSED(identifier);
128
129 return tempGradient;
130 }
131
133 void setGradient(Identifier const& identifier, Gradient const& gradient) = delete;
134
136 Gradient& gradient(Identifier const& identifier) = delete;
137
139 };
140}
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:97
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type that was used in the application.
Definition realTraits.hpp:123
CoDiPack - Code Differentiation Package.
Definition codi.hpp:97
inlinevoid CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:55
Empty Position with no nested data.
Definition position.hpp:47
Allow for a direct access to the gradient information computed by the tape.
Definition gradientAccessTapeInterface.hpp:67
Internal tape interface that is used by active types to trigger the storing of an expression.
Definition internalStatementRecordingTapeInterface.hpp:66
Data for a tag.
Definition tagData.hpp:56
static bool constexpr AllowJacobianOptimization
Definition tagTapeBase.hpp:169
void destroyTapeData(Real &value, ActiveTypeTapeData &data)
Definition tagTapeBase.hpp:180
inlineIdentifier const & getIdentifier(ActiveTypeTapeData const &data)
Definition tagTapeBase.hpp:150
void initTapeData(Real &value, ActiveTypeTapeData &data)
Definition tagTapeBase.hpp:173
Required definition for event system.
Definition tagTapeForward.hpp:71
int Index
Required definition for event system.
Definition tagTapeForward.hpp:73
Required definition for event system.
Definition tagTapeForward.hpp:69
T_Real Real
See TagTapeForward.
Definition tagTapeForward.hpp:65
Gradient & gradient(Identifier const &identifier)=delete
Do not allow.
Gradient const & getGradient(Identifier const &identifier) const
Do nothing.
Definition tagTapeForward.hpp:112
TagTapeForward()
Constructor.
Definition tagTapeForward.hpp:94
void setGradient(Identifier const &identifier, Gradient const &gradient)=delete
Do not allow.
TagData< Tag > ActiveTypeTapeData
See TapeTypesInterface.
Definition tagTapeForward.hpp:79
EmptyPosition Position
See TapeTypesInterface.
Definition tagTapeForward.hpp:80
Gradient & gradient(Identifier &identifier)
Do nothing.
Definition tagTapeForward.hpp:119
T_Tag Tag
See TagTapeForward.
Definition tagTapeForward.hpp:66
TagData< Tag > Gradient
See TapeTypesInterface.
Definition tagTapeForward.hpp:77
void setGradient(Identifier &identifier, Gradient const &gradient)
Do nothing.
Definition tagTapeForward.hpp:107
TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward > Base
Base class abbreviation.
Definition tagTapeForward.hpp:84
Gradient const & gradient(Identifier const &identifier) const
Do nothing.
Definition tagTapeForward.hpp:126
Gradient Identifier
Same as the gradient type. Tangent data is stored in the active types.
Definition tagTapeForward.hpp:78
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition tagTapeForward.hpp:82