CppADCodeGen 2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
Loading...
Searching...
No Matches
dae_var_info.hpp
1#ifndef CPPAD_CG_DAE_VAR_INFO_INCLUDED
2#define CPPAD_CG_DAE_VAR_INFO_INCLUDED
3/* --------------------------------------------------------------------------
4 * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5 * Copyright (C) 2012 Ciengis
6 *
7 * CppADCodeGen is distributed under multiple licenses:
8 *
9 * - Eclipse Public License Version 1.0 (EPL1), and
10 * - GNU General Public License Version 3 (GPL3).
11 *
12 * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13 * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14 * ----------------------------------------------------------------------------
15 * Author: Joao Leal
16 */
17
18namespace CppAD {
19namespace cg {
20
25private:
29 size_t id_;
35 int antiDerivative_;
40 int derivative_;
45 bool integratedDependent_;
50 bool integratedVariable_;
55 std::string name_;
59 int originalIndex_;
65 int order_;
71 int originalAntiDerivative_;
72public:
73
81 inline DaeVarInfo(const std::string& name = "",
82 size_t id = 0) :
83 id_(id),
84 antiDerivative_(-1),
85 derivative_(-1),
86 integratedDependent_(true),
87 integratedVariable_(false),
88 name_(name),
89 originalIndex_(-1),
90 order_(0),
91 originalAntiDerivative_(-1) {
92 }
93
94 inline DaeVarInfo(int derivativeOf,
95 const std::string& name = "",
96 size_t id = 0) :
97 id_(id),
98 antiDerivative_(derivativeOf),
99 derivative_(-1),
100 integratedDependent_(true),
101 integratedVariable_(false),
102 name_(name),
103 originalIndex_(-1),
104 order_(0),
105 originalAntiDerivative_(-1) {
106 }
107
113 inline size_t getId() const {
114 return id_;
115 }
116
117 inline void setId(size_t id) {
118 id_ = id;
119 }
120
129 inline int getAntiDerivative() const {
130 return antiDerivative_;
131 }
132
133 inline void setAntiDerivative(int derivativeOf) {
134 antiDerivative_ = derivativeOf;
135 }
136
143 inline int getDerivative() const {
144 return derivative_;
145 }
146
153 inline void setDerivative(int derivative) {
154 derivative_ = derivative;
155 }
156
164 inline bool isFunctionOfIntegrated() const {
165 return integratedDependent_;
166 }
167
172 inline void makeConstant() {
173 integratedVariable_ = false;
174 integratedDependent_ = false;
175 antiDerivative_ = -1;
176 order_ = -1;
177 originalAntiDerivative_ = -1;
178 }
179
186 integratedVariable_ = true;
187 integratedDependent_ = false;
188 antiDerivative_ = -1;
189 order_ = -1;
190 originalAntiDerivative_ = -1;
191 }
192
199 inline bool isIntegratedVariable() const {
200 return integratedVariable_;
201 }
202
209 inline const std::string& getName() const {
210 return name_;
211 }
212
219 inline void setName(const std::string& name) {
220 name_ = name;
221 }
222
230 inline int getOriginalIndex() const {
231 return originalIndex_;
232 }
233
241 inline void setOriginalIndex(int originalIndex) {
242 originalIndex_ = originalIndex;
243 }
244
257 inline int getOriginalAntiDerivative() const {
258 return originalAntiDerivative_;
259 }
260
274 inline void setOriginalAntiDerivative(int originalAntiDerivative) {
275 originalAntiDerivative_ = originalAntiDerivative;
276 }
277
287 inline int getOrder() const {
288 return order_;
289 }
290
300 inline void setOrder(int order) {
301 order_ = order;
302 }
303
304 inline void printInfo(std::ostream& out = std::cout) const {
305 out << name_ << ":\n";
306 if (antiDerivative_ >= 0)
307 out << " derivative-of: " << antiDerivative_ << "\n";
308 if (derivative_ >= 0)
309 out << " derivative: " << derivative_ << "\n";
310 if (integratedDependent_)
311 out << " integrated dependent\n";
312 else if (integratedVariable_)
313 out << " integrated variable\n";
314 out.flush();
315 }
316
317 inline virtual ~DaeVarInfo() {
318 }
319};
320
321} // END cg namespace
322} // END CppAD namespace
323
324#endif
void setName(const std::string &name)
bool isFunctionOfIntegrated() const
void setDerivative(int derivative)
void setOrder(int order)
void setOriginalAntiDerivative(int originalAntiDerivative)
const std::string & getName() const
bool isIntegratedVariable() const
DaeVarInfo(const std::string &name="", size_t id=0)
void setOriginalIndex(int originalIndex)
int getOriginalAntiDerivative() const
int getAntiDerivative() const