10 #ifndef SACADO_UQ_PCE_SCALARTRAITSIMP_HPP
11 #define SACADO_UQ_PCE_SCALARTRAITSIMP_HPP
17 #include "Sacado_mpl_apply.hpp"
27 template <
typename PCEType>
38 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_mag_type>::type
storage_mag_type;
39 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_half_type>::type
storage_half_type;
40 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_double_type>::type
storage_double_type;
43 typedef typename Sacado::mpl::apply<PCEType, storage_half_type>::type
halfPrecision;
44 typedef typename Sacado::mpl::apply<PCEType, storage_double_type>::type
doublePrecision;
79 return a.inner_product(b);
117 for (
int i=0; i<x.size(); i++)
127 static const char *
name() {
return "Sacado::UQ::PCE<>"; }
142 template <
typename TypeTo,
typename PCEType>
144 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
155 template <
typename Ordinal,
typename PCEType>
157 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
174 for (
Ordinal i=0; i<count; i++) {
175 int sz = buffer[i].size();
189 for (
Ordinal i=0; i<count; i++) {
191 int sz = buffer[i].size();
208 const char charBuffer[]) {
211 while (bytes_used < bytes) {
233 const char charBuffer[],
236 for (
Ordinal i=0; i<count; i++) {
246 if (buffer[i].size() != *sz)
247 buffer[i].reset(buffer[i].
cijk(), *sz);
248 buffer[i].copyForWrite();
266 template <
typename Ordinal,
typename PCEType,
typename ValueSerializer>
279 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
308 const PCEType buffer[])
const {
312 for (
Ordinal i=0; i<count; i++) {
313 int my_sz = buffer[i].size();
324 Ordinal b2 =
vs->fromCountToIndirectBytes(
sz, cx->coeff());
337 char charBuffer[])
const {
340 for (
Ordinal i=0; i<count; i++) {
342 int my_sz = buffer[i].size();
357 Ordinal b2 =
vs->fromCountToIndirectBytes(
sz, cx->coeff());
361 vs->serialize(
sz, cx->coeff(), b2, charBuffer);
370 const char charBuffer[])
const {
373 while (bytes_used < bytes) {
395 const char charBuffer[],
398 for (
Ordinal i=0; i<count; i++) {
406 buffer[i].reset(
cijk);
412 vs->deserialize(*b2, charBuffer, *my_sz, buffer[i].coeff());
426 #endif // SACADO_FAD_SCALARTRAITSIMP_HPP
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
static Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[])
Return the number of objects for bytes of storage.
static void serialize(const Ordinal count, const intbuffer[], const Ordinal bytes, char charBuffer[])
Sacado::mpl::apply< storage_type, ordinal_type, value_half_type >::type storage_half_type
Stokhos::StandardStorage< int, double > storage_type
static Ordinal fromCountToIndirectBytes(const Ordinal count, const intbuffer[])
static Ordinal fromCountToDirectBytes(const Ordinal count)
static void serialize(const Ordinal count, const PCEType buffer[], const Ordinal bytes, char charBuffer[])
Serialize to an indirect char[] buffer.
Teuchos::SerializationTraits< Ordinal, Ordinal > oSerT
static magnitudeType eps()
Serializer object for all PCE types.
cijk_type getSerializerCijk() const
Return specified serializer size.
Implementation for Teuchos::ScalarTraits for all PCE types.
static PCEType log10(const PCEType &x)
TVT::halfPrecision value_half_type
TVT::coordinateType coordinateType
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
PCESerializerImp(const cijk_type &cijk_, const Teuchos::RCP< const ValueSerializer > &vs_)
static TypeTo safeConvert(const TypeFrom t)
static Ordinal fromCountToIndirectBytes(const Ordinal count, const T buffer[])
Implementation for Teuchos::ValueTypeConversionTraits for all PCE types.
static value_mag_type rmin()
static const bool isOrdinal
static magnitudeType real(const PCEType &x)
Sacado::mpl::apply< PCEType, storage_half_type >::type halfPrecision
static TypeTo convert(const TypeFrom t)
static const bool isComparable
Teuchos::SerializationTraits< Ordinal, int > iSerT
static magnitudeType real(value_typea)
static value_mag_type base()
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, T buffer[])
static bool isnaninf(const PCEType &x)
Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[]) const
Return the number of objects for bytes of storage.
static value_mag_type t()
static value_mag_type rnd()
static magnitudeType emax()
static PCEType conjugate(const PCEType &x)
static magnitudeType base()
Teuchos::ValueTypeConversionTraits< TypeTo, ValueT > VTCT
static const bool hasMachineParameters
TVT::doublePrecision value_double_type
static value_mag_type rmax()
static magnitudeType rmax()
static value_mag_type eps()
static magnitudeType sfmin()
Sacado::ValueType< PCEType >::type ValueT
static const bool isComplex
static const bool hasMachineParameters
static magnitudeType imag(const PCEType &x)
Sacado::mpl::apply< storage_type, ordinal_type, value_double_type >::type storage_double_type
value_type coordinateType
static value_type conjugate(value_typea)
static int * convertFromCharPtr(char *ptr)
static const bool isOrdinal
PCEType::storage_type storage_type
PCEType::cijk_type cijk_type
Typename of cijk.
storage_type::ordinal_type ordinal_type
static const bool isComparable
ValueSerializer value_serializer_type
Typename of value serializer.
static PCEType squareroot(const PCEType &x)
static PCEType log(const PCEType &x)
static magnitudeType prec()
static innerProductType innerProduct(const PCEType &a, const PCEType &b)
static TypeTo safeConvert(const PCEType t)
static value_mag_type sfmin()
static T * convertFromCharPtr(char *ptr)
Sacado::ValueType< PCEType >::type ValueT
Sacado::ValueType< PCEType >::type ValueT
static void seedrandom(unsigned int s)
static magnitudeType rmin()
value_type doublePrecision
Teuchos::RCP< const value_serializer_type > getValueSerializer() const
Get nested value serializer.
void serialize(const Ordinal count, const PCEType buffer[], const Ordinal bytes, char charBuffer[]) const
Serialize to an indirect char[] buffer.
Sacado::mpl::apply< storage_type, ordinal_type, value_mag_type >::type storage_mag_type
static void seedrandom(unsigned int s)
storage_type::value_type value_type
Teuchos::ScalarTraits< value_type > TVT
static magnitudeType imag(value_typea)
static bool isnaninf(const value_type &x)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, typename CijkType< view_type >::type >::type cijk(const view_type &view)
static const bool supportsDirectSerialization
Whether the type T supports direct serialization.
static const char * name()
Teuchos::SerializationTraits< Ordinal, Ordinal > oSerT
static const bool supportsDirectSerialization
Whether the type T supports direct serialization.
Sacado::UQ::PCE< storage_type > PCEType
Teuchos::SerializationTraits< Ordinal, ValueT > vSerT
static value_mag_type emax()
static PCEType pow(const PCEType &x, const PCEType &y)
Teuchos::SerializationTraits< Ordinal, int > iSerT
static Ordinal fromCountToIndirectBytes(const Ordinal count, const PCEType buffer[])
Return the number of bytes for count objects.
static TypeTo convert(const PCEType t)
static value_type random()
Implementation of Teuchos::SerializationTraits for all PCE types.
TVT::magnitudeType value_mag_type
void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, PCEType buffer[]) const
Deserialize from an indirect char[] buffer.
Ordinal fromCountToIndirectBytes(const Ordinal count, const PCEType buffer[]) const
Return the number of bytes for count objects.
static const bool isComplex
static value_mag_type emin()
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
value_mag_type magnitudeType
Sacado::mpl::apply< PCEType, storage_double_type >::type doublePrecision
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
static magnitudeType emin()
static magnitudeType rnd()
value_type innerProductType
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, PCEType buffer[])
Deserialize from an indirect char[] buffer.
static void serialize(const Ordinal count, const T buffer[], const Ordinal bytes, char charBuffer[])
static Ordinal fromCountToDirectBytes(const Ordinal count)
Teuchos::RCP< const ValueSerializer > vs
static value_mag_type prec()
static magnitudeType magnitude(const PCEType &a)