Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
sacado
kokkos
pce
Sacado_UQ_PCE_Traits.hpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Stokhos Package
5
// Copyright (2009) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38
//
39
// ***********************************************************************
40
// @HEADER
41
42
#ifndef SACADO_UQ_PCE_TRAITS_HPP
43
#define SACADO_UQ_PCE_TRAITS_HPP
44
45
#include "Sacado_Traits.hpp"
46
#include "Sacado_mpl_apply.hpp"
47
48
// Forward declarations
49
namespace
Sacado
{
50
namespace
UQ
{
51
template
<
typename
S>
class
PCE
;
52
}
53
}
54
55
namespace
Sacado
{
56
58
SACADO_AD_PROMOTE_SPEC(
UQ
,
PCE
)
59
60
61
template
<
typename
S>
62
struct
ScalarType<
UQ
::
PCE
<S> > {
63
typedef
typename
ScalarType<typename UQ::PCE<S>::value_type>
::type
type
;
64
};
65
67
template
<
typename
S>
68
struct
ValueType<
UQ
::
PCE
<S> > {
69
typedef
typename
UQ::PCE<S>::value_type
type
;
70
};
71
73
template
<
typename
S>
74
struct
IsADType<
UQ
::
PCE
<S> > {
75
static
const
bool
value
=
true
;
76
};
77
79
template
<
typename
S>
80
struct
IsScalarType<
UQ
::
PCE
<S> > {
81
static
const
bool
value
=
false
;
82
};
83
85
template
<
typename
S>
86
struct
Value<
UQ
::
PCE
<S> > {
87
typedef
typename
ValueType< UQ::PCE<S> >::type
value_type
;
88
KOKKOS_INLINE_FUNCTION
89
static
const
value_type
&
eval
(
const
UQ::PCE<S>
& x) {
90
return
x.val(); }
91
};
92
94
template
<
typename
S>
95
struct
ScalarValue<
UQ
::
PCE
<S> > {
96
typedef
typename
ValueType< UQ::PCE<S> >::type
value_type
;
97
typedef
typename
ScalarType< UQ::PCE<S> >::type
scalar_type
;
98
KOKKOS_INLINE_FUNCTION
99
static
const
scalar_type
&
eval
(
const
UQ::PCE<S>
& x) {
100
return
ScalarValue<value_type>::eval(x.val()); }
101
};
102
104
template
<
typename
S>
105
struct
StringName<
UQ
::
PCE
<S> > {
106
static
std::string
eval
() {
107
return
std::string(
"Sacado::UQ::PCE< "
) +
108
StringName<S>::eval() +
" >"
; }
109
};
110
112
template
<
typename
S>
113
struct
IsEqual<
UQ
::
PCE
<S> > {
114
KOKKOS_INLINE_FUNCTION
115
static
bool
eval
(
const
UQ::PCE<S>
& x,
116
const
UQ::PCE<S>
& y) {
117
return
x.isEqualTo(y);
118
}
119
};
120
122
template
<
typename
S>
123
struct
IsStaticallySized<
UQ
::
PCE
<S> > {
124
static
const
bool
value
= S::is_static;
125
};
126
127
}
// namespace Sacado
128
129
// Define Teuchos traits classes
130
// Note Stokhos has required dependency on all Teuchos sub-packages
131
#include "Teuchos_PromotionTraits.hpp"
132
#include "Teuchos_ScalarTraits.hpp"
133
#include "
Sacado_UQ_PCE_ScalarTraitsImp.hpp
"
134
#include "Teuchos_SerializationTraits.hpp"
135
136
namespace
Teuchos
{
137
139
template
<
typename
S>
140
struct
PromotionTraits<
Sacado
::UQ::PCE<S>,
141
Sacado::UQ::PCE
<S> > {
142
typedef
typename
Sacado::Promote< Sacado::UQ::PCE<S>,
143
Sacado::UQ::PCE<S>
>::type
144
promote
;
145
};
146
148
template
<
typename
S,
typename
R>
149
struct
PromotionTraits<
Sacado
::UQ::PCE<S>, R > {
150
typedef
typename
Sacado::Promote< Sacado::UQ::PCE<S>, R >::type
151
promote
;
152
};
153
155
template
<
typename
L,
typename
S>
156
struct
PromotionTraits< L,
Sacado
::UQ::PCE<S> > {
157
public
:
158
typedef
typename
Sacado::Promote< L, Sacado::UQ::PCE<S> >::type
159
promote
;
160
};
161
163
template
<
typename
S>
164
struct
ScalarTraits<
Sacado
::UQ::PCE<S> > :
165
public
Sacado::UQ::PCEScalarTraitsImp
< Sacado::UQ::PCE<S> > {};
166
168
template
<
typename
TypeTo,
typename
S>
169
struct
ValueTypeConversionTraits< TypeTo,
Sacado
::UQ::PCE<S> > :
170
public
Sacado::UQ::PCEValueTypeConversionTraitsImp
< TypeTo,
171
Sacado::UQ::PCE<S> > {};
172
174
template
<
typename
Ordinal,
typename
S>
175
struct
SerializationTraits<Ordinal,
Sacado
::UQ::PCE<S> > :
176
public
Sacado::UQ::PCESerializationTraitsImp
< Ordinal,
177
Sacado::UQ::PCE<S> >
178
{};
179
181
template
<
typename
Ordinal,
typename
S>
182
struct
ValueTypeSerializer
<Ordinal,
Sacado
::UQ::PCE<S> > :
183
public
Sacado::UQ::PCESerializerImp
< Ordinal,
184
Sacado::UQ::PCE<S>,
185
ValueTypeSerializer<Ordinal,typename S::value_type> >
186
{
187
typedef
Sacado::UQ::PCE<S>
PCEType
;
188
typedef
ValueTypeSerializer<Ordinal,typename S::value_type>
ValueSerializer
;
189
typedef
Sacado::UQ::PCESerializerImp< Ordinal,PCEType,ValueSerializer>
Base
;
190
typedef
typename
Base::cijk_type
cijk_type
;
191
ValueTypeSerializer
(
const
cijk_type
&
cijk
,
192
const
Teuchos::RCP<const ValueSerializer>&
vs
) :
193
Base
(
cijk
,
vs
) {}
194
};
195
196
// Should also do TypeTo, and TypeTo,TypeFrom as UQ::PCE, but the real way
197
// to fix is to make sure it is never called at all (requires fixing
198
// magnitudeType)
199
200
}
201
202
#endif
// SACADO_UQ_PCE_TRAITS_HPP
Sacado_UQ_PCE_ScalarTraitsImp.hpp
Sacado::UQ::PCESerializationTraitsImp
Implementation of Teuchos::SerializationTraits for all PCE types.
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:188
Sacado::UQ::PCESerializerImp
Serializer object for all PCE types.
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:299
Sacado::UQ::PCESerializerImp::cijk_type
PCEType::cijk_type cijk_type
Typename of cijk.
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:307
Sacado::UQ::PCESerializerImp< Ordinal, Sacado::UQ::PCE< S >, ValueTypeSerializer< Ordinal, S::value_type > >::vs
Teuchos::RCP< const ValueTypeSerializer< Ordinal, S::value_type > > vs
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:316
Sacado::UQ::PCESerializerImp< Ordinal, Sacado::UQ::PCE< S >, ValueTypeSerializer< Ordinal, S::value_type > >::cijk
cijk_type cijk
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:315
Sacado::UQ::PCE
Definition
Kokkos_View_UQ_PCE_Fwd.hpp:65
Sacado::PCE
Definition
Sacado_PCE_OrthogPolyImp.hpp:47
Sacado::UQ
Definition
Kokkos_View_UQ_PCE_Fwd.hpp:63
Sacado
Definition
Kokkos_View_UQ_PCE_Fwd.hpp:62
Teuchos
Definition
Sacado_UQ_PCE_Traits.hpp:136
Sacado::IsADType< UQ::PCE< S > >::value
static const bool value
Definition
Sacado_UQ_PCE_Traits.hpp:75
Sacado::IsEqual< UQ::PCE< S > >::eval
static KOKKOS_INLINE_FUNCTION bool eval(const UQ::PCE< S > &x, const UQ::PCE< S > &y)
Definition
Sacado_UQ_PCE_Traits.hpp:115
Sacado::IsScalarType< UQ::PCE< S > >::value
static const bool value
Definition
Sacado_UQ_PCE_Traits.hpp:81
Sacado::IsStaticallySized< UQ::PCE< S > >::value
static const bool value
Definition
Sacado_UQ_PCE_Traits.hpp:124
Sacado::ScalarType< UQ::PCE< S > >::type
ScalarType< typenameUQ::PCE< S >::value_type >::type type
Definition
Sacado_UQ_PCE_Traits.hpp:63
Sacado::ScalarValue< UQ::PCE< S > >::eval
static KOKKOS_INLINE_FUNCTION const scalar_type & eval(const UQ::PCE< S > &x)
Definition
Sacado_UQ_PCE_Traits.hpp:99
Sacado::ScalarValue< UQ::PCE< S > >::value_type
ValueType< UQ::PCE< S > >::type value_type
Definition
Sacado_UQ_PCE_Traits.hpp:96
Sacado::ScalarValue< UQ::PCE< S > >::scalar_type
ScalarType< UQ::PCE< S > >::type scalar_type
Definition
Sacado_UQ_PCE_Traits.hpp:97
Sacado::StringName< UQ::PCE< S > >::eval
static std::string eval()
Definition
Sacado_UQ_PCE_Traits.hpp:106
Sacado::UQ::PCEScalarTraitsImp
Implementation for Teuchos::ScalarTraits for all PCE types.
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:60
Sacado::UQ::PCEValueTypeConversionTraitsImp
Implementation for Teuchos::ValueTypeConversionTraits for all PCE types.
Definition
Sacado_UQ_PCE_ScalarTraitsImp.hpp:175
Sacado::ValueType< UQ::PCE< S > >::type
UQ::PCE< S >::value_type type
Definition
Sacado_UQ_PCE_Traits.hpp:69
Sacado::Value< UQ::PCE< S > >::eval
static KOKKOS_INLINE_FUNCTION const value_type & eval(const UQ::PCE< S > &x)
Definition
Sacado_UQ_PCE_Traits.hpp:89
Sacado::Value< UQ::PCE< S > >::value_type
ValueType< UQ::PCE< S > >::type value_type
Definition
Sacado_UQ_PCE_Traits.hpp:87
Teuchos::PromotionTraits< L, Sacado::UQ::PCE< S > >::promote
Sacado::Promote< L, Sacado::UQ::PCE< S > >::type promote
Definition
Sacado_UQ_PCE_Traits.hpp:159
Teuchos::PromotionTraits< Sacado::UQ::PCE< S >, R >::promote
Sacado::Promote< Sacado::UQ::PCE< S >, R >::type promote
Definition
Sacado_UQ_PCE_Traits.hpp:151
Teuchos::PromotionTraits< Sacado::UQ::PCE< S >, Sacado::UQ::PCE< S > >::promote
Sacado::Promote< Sacado::UQ::PCE< S >, Sacado::UQ::PCE< S > >::type promote
Definition
Sacado_UQ_PCE_Traits.hpp:144
Teuchos::ValueTypeSerializer< Ordinal, Sacado::UQ::PCE< S > >::PCEType
Sacado::UQ::PCE< S > PCEType
Definition
Sacado_UQ_PCE_Traits.hpp:187
Teuchos::ValueTypeSerializer< Ordinal, Sacado::UQ::PCE< S > >::ValueTypeSerializer
ValueTypeSerializer(const cijk_type &cijk, const Teuchos::RCP< const ValueSerializer > &vs)
Definition
Sacado_UQ_PCE_Traits.hpp:191
Teuchos::ValueTypeSerializer< Ordinal, Sacado::UQ::PCE< S > >::Base
Sacado::UQ::PCESerializerImp< Ordinal, PCEType, ValueSerializer > Base
Definition
Sacado_UQ_PCE_Traits.hpp:189
Teuchos::ValueTypeSerializer< Ordinal, Sacado::UQ::PCE< S > >::cijk_type
Base::cijk_type cijk_type
Definition
Sacado_UQ_PCE_Traits.hpp:190
Teuchos::ValueTypeSerializer< Ordinal, Sacado::UQ::PCE< S > >::ValueSerializer
ValueTypeSerializer< Ordinal, typename S::value_type > ValueSerializer
Definition
Sacado_UQ_PCE_Traits.hpp:188
Generated by
1.17.0