Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Sacado_Fad_DVFadTraits.hpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Sacado Package
5
// Copyright (2006) Sandia Corporation
6
//
7
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8
// the U.S. Government retains certain rights in this software.
9
//
10
// This library is free software; you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as
12
// published by the Free Software Foundation; either version 2.1 of the
13
// License, or (at your option) any later version.
14
//
15
// This library is distributed in the hope that it will be useful, but
16
// WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
// Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public
21
// License along with this library; if not, write to the Free Software
22
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23
// USA
24
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25
// (etphipp@sandia.gov).
26
//
27
// ***********************************************************************
28
//
29
// The forward-mode AD classes in Sacado are a derivative work of the
30
// expression template classes in the Fad package by Nicolas Di Cesare.
31
// The following banner is included in the original Fad source code:
32
//
33
// ************ DO NOT REMOVE THIS BANNER ****************
34
//
35
// Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
36
// http://www.ann.jussieu.fr/~dicesare
37
//
38
// CEMRACS 98 : C++ courses,
39
// templates : new C++ techniques
40
// for scientific computing
41
//
42
//********************************************************
43
//
44
// NumericalTraits class to illustrate TRAITS
45
//
46
//********************************************************
47
// @HEADER
48
49
#ifndef SACADO_FAD_DVFADTRAITS_HPP
50
#define SACADO_FAD_DVFADTRAITS_HPP
51
52
#include "
Sacado_ConfigDefs.h
"
53
54
#ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
55
56
#include "
Sacado_Fad_Exp_GeneralFadTraits.hpp
"
57
58
#else
59
60
#include "
Sacado_Traits.hpp
"
61
62
// Forward declarations
63
namespace
Sacado
{
64
namespace
Fad
{
65
template
<
typename
T>
class
DVFad
;
66
}
67
}
68
69
namespace
Sacado
{
70
72
SACADO_FAD_PROMOTE_SPEC
(
Fad
, DVFad )
73
74
75
template
<
typename
ValueT>
76
struct
ScalarType
<
Fad
::DVFad<ValueT> > {
77
typedef
typename
Fad::DVFad<ValueT>::ScalarT
type
;
78
};
79
81
template
<
typename
ValueT>
82
struct
ValueType
<
Fad
::DVFad<ValueT> > {
83
typedef
ValueT
type
;
84
};
85
87
template
<
typename
ValueT>
88
struct
IsADType
<
Fad
::DVFad<ValueT> > {
89
static
const
bool
value
=
true
;
90
};
91
93
template
<
typename
ValueT>
94
struct
IsScalarType
<
Fad
::DVFad<ValueT> > {
95
static
const
bool
value
=
false
;
96
};
97
99
template
<
typename
ValueT>
100
struct
IsSimdType
<
Fad
::DVFad<ValueT> > {
101
static
const
bool
value
=
IsSimdType<ValueT>::value
;
102
};
103
105
template
<
typename
ValueT>
106
struct
Value
<
Fad
::DVFad<ValueT> > {
107
typedef
typename
ValueType< Fad::DVFad<ValueT>
>
::type
value_type
;
108
static
const
value_type
&
eval
(
const
Fad::DVFad<ValueT>
& x) {
109
return
x.val(); }
110
};
111
113
template
<
typename
ValueT>
114
struct
ScalarValue
<
Fad
::DVFad<ValueT> > {
115
typedef
typename
ValueType< Fad::DVFad<ValueT>
>
::type
value_type
;
116
typedef
typename
ScalarType< Fad::DVFad<ValueT>
>
::type
scalar_type
;
117
static
const
scalar_type
&
eval
(
const
Fad::DVFad<ValueT>
& x) {
118
return
ScalarValue<value_type>::eval
(x.val()); }
119
};
120
122
template
<
typename
ValueT>
123
struct
StringName
<
Fad
::DVFad<ValueT> > {
124
static
std::string
eval
() {
125
return
std::string(
"Sacado::Fad::DVFad< "
) +
126
StringName<ValueT>::eval
() +
" >"
; }
127
};
128
130
template
<
typename
ValueT>
131
struct
IsEqual
<
Fad
::DVFad<ValueT> > {
132
static
bool
eval
(
const
Fad::DVFad<ValueT>
& x,
const
Fad::DVFad<ValueT>
& y) {
133
return
x.isEqualTo(y);
134
}
135
};
136
138
template
<
typename
ValueT>
139
struct
IsStaticallySized
<
Fad
::DVFad<ValueT> > {
140
static
const
bool
value
=
false
;
141
};
142
143
template
<
typename
T>
144
struct
IsFad
<
Fad
::DVFad<T> > {
145
static
const
bool
value
=
true
;
146
};
147
148
}
// namespace Sacado
149
150
//
151
// Define Teuchos traits classes
152
//
153
154
// Promotion traits
155
#ifdef HAVE_SACADO_TEUCHOSNUMERICS
156
#include "Teuchos_PromotionTraits.hpp"
157
namespace
Teuchos
{
158
template
<
typename
ValueT>
159
struct
PromotionTraits<
Sacado
::Fad::DVFad<ValueT>,
160
Sacado::Fad::DVFad
<ValueT> > {
161
typedef
typename
Sacado::Promote< Sacado::Fad::DVFad<ValueT>
,
162
Sacado::Fad::DVFad<ValueT>
>
::type
163
promote;
164
};
165
166
template
<
typename
ValueT,
typename
R>
167
struct
PromotionTraits< Sacado::Fad::DVFad<ValueT>,
R
> {
168
typedef
typename
Sacado::Promote< Sacado::Fad::DVFad<ValueT>,
R
>::type
169
promote;
170
};
171
172
template
<
typename
L,
typename
ValueT>
173
struct
PromotionTraits< L, Sacado::Fad::DVFad<ValueT> > {
174
public
:
175
typedef
typename
Sacado::Promote< L, Sacado::Fad::DVFad<ValueT> >::type
176
promote;
177
};
178
}
179
#endif
180
181
// Scalar traits
182
#ifdef HAVE_SACADO_TEUCHOSCORE
183
#include "
Sacado_Fad_ScalarTraitsImp.hpp
"
184
namespace
Teuchos
{
185
template
<
typename
ValueT>
186
struct
ScalarTraits< Sacado::Fad::DVFad<ValueT> > :
187
public
Sacado::Fad::ScalarTraitsImp< Sacado::Fad::DVFad<ValueT> >
188
{};
189
}
190
#endif
191
192
#endif
// SACADO_NEW_FAD_DESIGN_IS_DEFAULT
193
194
#endif
// SACADO_FAD_DVFADTRAITS_HPP
Sacado_ConfigDefs.h
Sacado_Fad_Exp_GeneralFadTraits.hpp
Sacado_Fad_ScalarTraitsImp.hpp
Sacado_Traits.hpp
SACADO_FAD_PROMOTE_SPEC
#define SACADO_FAD_PROMOTE_SPEC(NS, FAD)
Definition
Sacado_Traits.hpp:239
R
#define R
Definition
Sacado_rad.hpp:181
Sacado::Fad::DVFad
Forward-mode AD class using dynamic memory allocation and expression templates.
Definition
Sacado_Fad_DVFad.hpp:68
Sacado::Fad::DVFad::ScalarT
ScalarType< ValueT >::type ScalarT
Typename of scalar's (which may be different from ValueT).
Definition
Sacado_Fad_DVFad.hpp:84
Sacado::Fad
Namespace for forward-mode AD classes.
Definition
Sacado_Fad_Exp_DFad.hpp:38
Sacado
Definition
Sacado_mpl_apply.hpp:39
Teuchos
Definition
Sacado_Fad_LAPACK.hpp:145
type
Sacado::IsADType< Fad::DVFad< ValueT > >::value
static const bool value
Definition
Sacado_Fad_DVFadTraits.hpp:89
Sacado::IsADType
Base template specification for IsADType.
Definition
Sacado_Traits.hpp:337
Sacado::IsEqual< Fad::DVFad< ValueT > >::eval
static bool eval(const Fad::DVFad< ValueT > &x, const Fad::DVFad< ValueT > &y)
Definition
Sacado_Fad_DVFadTraits.hpp:132
Sacado::IsEqual
Base template specification for testing equivalence.
Definition
Sacado_Traits.hpp:415
Sacado::IsFad< Fad::DVFad< T > >::value
static const bool value
Definition
Sacado_Fad_DVFadTraits.hpp:145
Sacado::IsFad
Base template specification for whether a type is a Fad type.
Definition
Sacado_Traits.hpp:439
Sacado::IsScalarType< Fad::DVFad< ValueT > >::value
static const bool value
Definition
Sacado_Fad_DVFadTraits.hpp:95
Sacado::IsScalarType
Base template specification for IsScalarType.
Definition
Sacado_Traits.hpp:346
Sacado::IsSimdType< Fad::DVFad< ValueT > >::value
static const bool value
Definition
Sacado_Fad_DVFadTraits.hpp:101
Sacado::IsSimdType
Base template specification for IsSimdType.
Definition
Sacado_Traits.hpp:355
Sacado::IsSimdType::value
static const bool value
Definition
Sacado_Traits.hpp:356
Sacado::IsStaticallySized< Fad::DVFad< ValueT > >::value
static const bool value
Definition
Sacado_Fad_DVFadTraits.hpp:140
Sacado::IsStaticallySized
Base template specification for testing whether type is statically sized.
Definition
Sacado_Traits.hpp:421
Sacado::type
Sacado::ScalarType< Fad::DVFad< ValueT > >::type
Fad::DVFad< ValueT >::ScalarT type
Definition
Sacado_Fad_DVFadTraits.hpp:77
Sacado::ScalarType
Base template specification for ScalarType.
Definition
Sacado_Traits.hpp:303
Sacado::ScalarValue< Fad::DVFad< ValueT > >::scalar_type
ScalarType< Fad::DVFad< ValueT > >::type scalar_type
Definition
Sacado_Fad_DVFadTraits.hpp:116
Sacado::ScalarValue< Fad::DVFad< ValueT > >::eval
static const scalar_type & eval(const Fad::DVFad< ValueT > &x)
Definition
Sacado_Fad_DVFadTraits.hpp:117
Sacado::ScalarValue< Fad::DVFad< ValueT > >::value_type
ValueType< Fad::DVFad< ValueT > >::type value_type
Definition
Sacado_Fad_DVFadTraits.hpp:115
Sacado::ScalarValue
Base template specification for ScalarValue.
Definition
Sacado_Traits.hpp:382
Sacado::ScalarValue::eval
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
Definition
Sacado_Traits.hpp:384
Sacado::StringName< Fad::DVFad< ValueT > >::eval
static std::string eval()
Definition
Sacado_Fad_DVFadTraits.hpp:124
Sacado::StringName
Base template specification for string names of types.
Definition
Sacado_Traits.hpp:410
Sacado::StringName::eval
static std::string eval()
Definition
Sacado_Traits.hpp:411
Sacado::ValueType< Fad::DVFad< ValueT > >::type
ValueT type
Definition
Sacado_Fad_DVFadTraits.hpp:83
Sacado::ValueType
Base template specification for ValueType.
Definition
Sacado_Traits.hpp:320
Sacado::Value< Fad::DVFad< ValueT > >::eval
static const value_type & eval(const Fad::DVFad< ValueT > &x)
Definition
Sacado_Fad_DVFadTraits.hpp:108
Sacado::Value< Fad::DVFad< ValueT > >::value_type
ValueType< Fad::DVFad< ValueT > >::type value_type
Definition
Sacado_Fad_DVFadTraits.hpp:107
Sacado::Value
Base template specification for Value.
Definition
Sacado_Traits.hpp:363
Generated by
1.17.0