/usr/include/trilinos/Sacado_Traits.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | // $Id$
// $Source$
// @HEADER
// ***********************************************************************
//
// Sacado Package
// Copyright (2006) Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
// (etphipp@sandia.gov).
//
// ***********************************************************************
//
// The forward-mode AD classes in Sacado are a derivative work of the
// expression template classes in the Fad package by Nicolas Di Cesare.
// The following banner is included in the original Fad source code:
//
// ************ DO NOT REMOVE THIS BANNER ****************
//
// Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
// http://www.ann.jussieu.fr/~dicesare
//
// CEMRACS 98 : C++ courses,
// templates : new C++ techniques
// for scientific computing
//
//********************************************************
//
// NumericalTraits class to illustrate TRAITS
//
//********************************************************
// @HEADER
#ifndef SACADO_TRAITS_HPP
#define SACADO_TRAITS_HPP
#include "Sacado_ConfigDefs.h"
#include <string>
#ifdef HAVE_SACADO_COMPLEX
#include <complex>
#endif
namespace Sacado {
//! Base template specification for %Promote
/*!
* The %Promote classes provide a mechanism for computing the
* promoted type of a binary operation.
*/
template <typename A, typename B> struct Promote {};
//! Specialization of %Promote for a single type
template <typename A> struct Promote<A,A> {
typedef A type;
};
//! Specialization of %Promote to builtin types
#define SACADO_PROMOTE_SPECIALIZATION(type1,type2,type3) \
template <> struct Promote< type1, type2 > { \
typedef type3 type; \
}; \
template <> struct Promote< type2, type1 > { \
typedef type3 type; \
};
SACADO_PROMOTE_SPECIALIZATION(double,float,double)
SACADO_PROMOTE_SPECIALIZATION(double,long,double)
SACADO_PROMOTE_SPECIALIZATION(double,int,double)
SACADO_PROMOTE_SPECIALIZATION(float,long,float)
SACADO_PROMOTE_SPECIALIZATION(float,int,float)
#ifdef HAVE_SACADO_COMPLEX
SACADO_PROMOTE_SPECIALIZATION(std::complex<double>,std::complex<float>,std::complex<double>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<double>,double,std::complex<double>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<double>,float,std::complex<double>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<double>,long,std::complex<double>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<double>,int,std::complex<double>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<float>,float,std::complex<float>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<float>,long,std::complex<float>)
SACADO_PROMOTE_SPECIALIZATION(std::complex<float>,int,std::complex<float>)
#endif // HAVE_SACADO_COMPLEX
#undef SACADO_PROMOTE_SPECIALIZATION
//! Base template specification for %ScalarType
/*!
* The %ScalarType classes provide a mechanism for computing the
* base underlying type of nested AD classes
*/
template <typename T> struct ScalarType {};
//! Base template specification for %ValueType
/*!
* The %ValueType classes provide a mechanism for computing the
* the type stored in AD classes
*/
template <typename T> struct ValueType {};
//! Base template specification for %IsADType
/*!
* The %IsADType classes provide a mechanism for computing the
* determining whether a type is an AD type
*/
template <typename T> struct IsADType {};
//! Base template specification for %IsScalarType
/*!
* The %IsScalarType classes provide a mechanism for computing the
* determining whether a type is a scalar type (float, double, etc...)
*/
template <typename T> struct IsScalarType {};
//! Base template specification for %Value
/*!
* The %Value functor returns the value of an AD type.
*/
template <typename T> struct Value {};
//! Base template specification for %ScalarValue
/*!
* The %ScalarValue functor returns the base scalar value of an AD type,
* i.e., something that isn't an AD type.
*/
template <typename T> struct ScalarValue {};
//! Base template specification for marking constants
template <typename T> struct MarkConstant {
static void eval(T& x) {}
};
//! Base template specification for string names of types
template <typename T> struct StringName {};
//! Specialization of above classes to builtin types
#define SACADO_BUILTIN_SPECIALIZATION(t,NAME) \
template <> struct ScalarType< t > { \
typedef t type; \
}; \
template <> struct ValueType< t > { \
typedef t type; \
}; \
template <> struct IsADType< t > { \
static const bool value = false; \
}; \
template <> struct IsScalarType< t > { \
static const bool value = true; \
}; \
template <> struct Value< t > { \
static const t& eval(const t& x) { return x; } \
}; \
template <> struct ScalarValue< t > { \
static const t& eval(const t& x) { return x; } \
}; \
template <> struct StringName< t > { \
static std::string eval() { return NAME; } \
};
SACADO_BUILTIN_SPECIALIZATION(char,"char")
SACADO_BUILTIN_SPECIALIZATION(float,"float")
SACADO_BUILTIN_SPECIALIZATION(double,"double")
SACADO_BUILTIN_SPECIALIZATION(int,"int")
SACADO_BUILTIN_SPECIALIZATION(unsigned int,"unsigned int")
SACADO_BUILTIN_SPECIALIZATION(long,"long")
SACADO_BUILTIN_SPECIALIZATION(unsigned long,"unsigned long")
SACADO_BUILTIN_SPECIALIZATION(bool,"bool")
#ifdef HAVE_SACADO_COMPLEX
SACADO_BUILTIN_SPECIALIZATION(std::complex<double>,"std::complex<double>")
SACADO_BUILTIN_SPECIALIZATION(std::complex<float>,"std::complex<float>")
#endif
#undef SACADO_BUILTIN_SPECIALIZATION
} // namespace Sacado
#endif // SACADO_TRAITS_HPP
|