CppADCodeGen
2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
Loading...
Searching...
No Matches
evaluator_adcg.hpp
1
#ifndef CPPAD_CG_EVALUATOR_ADCG_INCLUDED
2
#define CPPAD_CG_EVALUATOR_ADCG_INCLUDED
3
/* --------------------------------------------------------------------------
4
* CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5
* Copyright (C) 2016 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
18
namespace
CppAD
{
19
namespace
cg {
20
24
template
<
class
ScalarIn,
class
BaseOut>
25
class
Evaluator
<ScalarIn,
CG
<BaseOut>,
CppAD
::
AD
<CG<BaseOut> > > :
public
EvaluatorAD
<ScalarIn, CG<BaseOut>, Evaluator<ScalarIn, CG<BaseOut>, CppAD::AD<CG<BaseOut> > > > {
30
friend
EvaluatorBase<ScalarIn, CG<BaseOut>
,
CppAD::AD<CG<BaseOut>
>,
Evaluator<ScalarIn, CG<BaseOut>
,
CppAD::AD<CG<BaseOut>
> > >;
31
public
:
32
using
ScalarOut
=
CG<BaseOut>
;
33
using
ActiveOut
=
CppAD::AD<ScalarOut>
;
34
using
Super
=
EvaluatorAD<ScalarIn, ScalarOut, Evaluator<ScalarIn, CG<BaseOut>
,
CppAD::AD<CG<BaseOut>
> > >;
35
protected
:
36
using
Super::evalsAtomic_;
37
using
Super::atomicFunctions_;
38
using
Super::handler_;
39
using
Super::evalArrayCreationOperation;
40
protected
:
46
bool
printFor_
;
50
ActiveOut
printForPos_
;
55
bool
adcgName_
;
56
public
:
57
58
inline
Evaluator
(
CodeHandler<ScalarIn>
& handler) :
59
Super
(handler),
60
printFor_(false),
61
printForPos_(0),
62
adcgName_(true) {
63
}
64
65
inline
virtual
~Evaluator
() {
66
}
67
73
inline
void
setPrintFor
(
bool
printFor) {
74
printFor_ = printFor;
75
}
76
83
inline
bool
isPrintFor
()
const
{
84
return
printFor_;
85
}
86
94
inline
void
setPrintForPos
(
const
ActiveOut
& pos) {
95
printForPos_ = pos;
96
}
97
105
inline
const
ActiveOut
&
getPrintForPos
()
const
{
106
return
printForPos_;
107
}
108
113
inline
void
setCopyAdCgName
(
bool
adcgName) {
114
adcgName_ = adcgName;
115
}
116
122
inline
bool
isCopyAdCgName
()
const
{
123
return
adcgName_;
124
}
125
126
protected
:
127
132
void
processActiveOut
(
const
OperationNode<ScalarIn>
& node,
133
ActiveOut
& a) {
134
if
(node.
getName
() !=
nullptr
) {
135
if
(adcgName_ && CppAD::Variable(a)) {
136
ScalarOut
a2(CppAD::Value(CppAD::Var2Par(a)));
137
if
(a2.getOperationNode() !=
nullptr
) {
138
a2.getOperationNode()->setName(*node.
getName
());
139
}
140
}
141
142
if
(printFor_) {
143
CppAD::PrintFor(printForPos_,
""
, a, node.
getName
()->c_str());
144
}
145
}
146
}
147
148
};
149
150
}
// END cg namespace
151
}
// END CppAD namespace
152
153
#endif
CppAD::AD
Definition
declare_cg.hpp:25
CppAD::cg::CG
Definition
declare_cg.hpp:60
CppAD::cg::CodeHandler
Definition
declare_cg.hpp:51
CppAD::cg::EvaluatorAD
Definition
evaluator_ad.hpp:27
CppAD::cg::EvaluatorBase
Definition
evaluator.hpp:45
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::printFor_
bool printFor_
Definition
evaluator_adcg.hpp:46
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::printForPos_
ActiveOut printForPos_
Definition
evaluator_adcg.hpp:50
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::setCopyAdCgName
void setCopyAdCgName(bool adcgName)
Definition
evaluator_adcg.hpp:113
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::setPrintForPos
void setPrintForPos(const ActiveOut &pos)
Definition
evaluator_adcg.hpp:94
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::isPrintFor
bool isPrintFor() const
Definition
evaluator_adcg.hpp:83
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::getPrintForPos
const ActiveOut & getPrintForPos() const
Definition
evaluator_adcg.hpp:105
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::setPrintFor
void setPrintFor(bool printFor)
Definition
evaluator_adcg.hpp:73
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::isCopyAdCgName
bool isCopyAdCgName() const
Definition
evaluator_adcg.hpp:122
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::adcgName_
bool adcgName_
Definition
evaluator_adcg.hpp:55
CppAD::cg::Evaluator< ScalarIn, CG< BaseOut >, CppAD::AD< CG< BaseOut > > >::processActiveOut
void processActiveOut(const OperationNode< ScalarIn > &node, ActiveOut &a)
Definition
evaluator_adcg.hpp:132
CppAD::cg::Evaluator
Definition
evaluator.hpp:694
CppAD::cg::OperationNode
Definition
operation_node.hpp:28
CppAD::cg::OperationNode::getName
const std::string * getName() const
Definition
operation_node.hpp:151
CppAD
Definition
abstract_atomic_fun.hpp:19
include
cppad
cg
evaluator
evaluator_adcg.hpp
Generated on Mon Aug 5 2024 20:23:40 for CppADCodeGen by
1.11.0