42 #ifndef SACADO_UQ_PCE_SCALARTRAITSIMP_HPP
43 #define SACADO_UQ_PCE_SCALARTRAITSIMP_HPP
49 #include "Sacado_mpl_apply.hpp"
59 template <
typename PCEType>
70 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_mag_type>::type
storage_mag_type;
71 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_half_type>::type
storage_half_type;
72 typedef typename Sacado::mpl::apply<storage_type,ordinal_type,value_double_type>::type
storage_double_type;
75 typedef typename Sacado::mpl::apply<PCEType, storage_half_type>::type
halfPrecision;
76 typedef typename Sacado::mpl::apply<PCEType, storage_double_type>::type
doublePrecision;
111 return a.inner_product(b);
149 for (
int i=0; i<x.size(); i++)
159 static const char *
name() {
return "Sacado::UQ::PCE<>"; }
174 template <
typename TypeTo,
typename PCEType>
176 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
187 template <
typename Ordinal,
typename PCEType>
189 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
206 for (
Ordinal i=0; i<count; i++) {
207 int sz = buffer[i].size();
221 for (
Ordinal i=0; i<count; i++) {
223 int sz = buffer[i].size();
240 const char charBuffer[]) {
243 while (bytes_used < bytes) {
265 const char charBuffer[],
268 for (
Ordinal i=0; i<count; i++) {
278 if (buffer[i].size() != *sz)
279 buffer[i].reset(buffer[i].
cijk(), *sz);
280 buffer[i].copyForWrite();
298 template <
typename Ordinal,
typename PCEType,
typename ValueSerializer>
311 typedef typename Sacado::ValueType<PCEType>::type
ValueT;
340 const PCEType buffer[])
const {
344 for (
Ordinal i=0; i<count; i++) {
345 int my_sz = buffer[i].size();
356 Ordinal b2 =
vs->fromCountToIndirectBytes(
sz, cx->coeff());
369 char charBuffer[])
const {
372 for (
Ordinal i=0; i<count; i++) {
374 int my_sz = buffer[i].size();
389 Ordinal b2 =
vs->fromCountToIndirectBytes(
sz, cx->coeff());
393 vs->serialize(
sz, cx->coeff(), b2, charBuffer);
402 const char charBuffer[])
const {
405 while (bytes_used < bytes) {
427 const char charBuffer[],
430 for (
Ordinal i=0; i<count; i++) {
438 buffer[i].reset(
cijk);
444 vs->deserialize(*b2, charBuffer, *my_sz, buffer[i].coeff());
458 #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)