Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_LFad_LogicalSparseTraits.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// @HEADER
29
30#ifndef SACADO_LFAD_LOGICALSPARSETRAITS_HPP
31#define SACADO_LFAD_LOGICALSPARSETRAITS_HPP
32
33#include "Sacado_Traits.hpp"
34
35// Forward declarations
36namespace Sacado {
37 namespace LFad {
38 template <typename T1, typename T2> class LogicalSparse;
39 }
40}
41
42namespace Sacado {
43
44 namespace LFad {
45 template <typename T> class Expr;
46 }
47
49 SACADO_AD_PROMOTE_SPEC2( LFad, LogicalSparse )
50
51
52 template <typename ValT, typename LogT>
53 struct ScalarType< LFad::LogicalSparse<ValT,LogT> > {
55 };
56
58 template <typename ValT, typename LogT>
59 struct ValueType< LFad::LogicalSparse<ValT,LogT> > {
61 };
62
64 template <typename ValT, typename LogT>
65 struct IsADType< LFad::LogicalSparse<ValT,LogT> > {
66 static const bool value = true;
67 };
68
70 template <typename ValT, typename LogT>
71 struct IsScalarType< LFad::LogicalSparse<ValT,LogT> > {
72 static const bool value = false;
73 };
74
76 template <typename ValT, typename LogT>
77 struct Value< LFad::LogicalSparse<ValT,LogT> > {
80 return x.val(); }
81 };
82
84 template <typename ValT, typename LogT>
85 struct ScalarValue< LFad::LogicalSparse<ValT,LogT> > {
90 };
91
93 template <typename ValT, typename LogT>
94 struct StringName< LFad::LogicalSparse<ValT,LogT> > {
95 static std::string eval() {
96 return std::string("Sacado::LFad::LoginalSparse< ") +
97 StringName<ValT>::eval() + ", " +
98 StringName<LogT>::eval() + " >"; }
99 };
100
102 template <typename ValT, typename LogT>
103 struct IsEqual< LFad::LogicalSparse<ValT,LogT> > {
106 return x.isEqualTo(y);
107 }
108 };
109
111 template <typename ValT, typename LogT>
112 struct IsStaticallySized< LFad::LogicalSparse<ValT,LogT> > {
113 static const bool value = false;
114 };
115
116} // namespace Sacado
117
118//
119// Define Teuchos traits classes
120//
121
122// Promotion traits
123#ifdef HAVE_SACADO_TEUCHOSNUMERICS
124#include "Teuchos_PromotionTraits.hpp"
125namespace Teuchos {
126 template <typename ValT, typename LogT>
127 struct PromotionTraits< Sacado::LFad::LogicalSparse<ValT,LogT>,
128 Sacado::LFad::LogicalSparse<ValT,LogT> > {
131 promote;
132 };
133
134 template <typename ValT, typename LogT, typename R>
135 struct PromotionTraits< Sacado::LFad::LogicalSparse<ValT,LogT>, R > {
137 promote;
138 };
139
140 template <typename L, typename ValT, typename LogT>
141 struct PromotionTraits< L, Sacado::LFad::LogicalSparse<ValT,LogT> > {
142 public:
144 promote;
145 };
146}
147#endif
148
149//
150// These specialization implementations don't work for LFad because
151// the value type (e.g., double) is different from the dx() type (e.g., bool)
152//
153
154// // Scalar traits
155// #ifdef HAVE_SACADO_TEUCHOSCORE
156// #include "Sacado_Fad_ScalarTraitsImp.hpp"
157// namespace Teuchos {
158 // template <typename ValT, typename LogT>
159 // struct ScalarTraits< Sacado::LFad::LogicalSparse<ValT,LogT> > :
160 // public Sacado::Fad::ScalarTraitsImp< Sacado::LFad::LogicalSparse<ValT,LogT> >
161 // {};
162// }
163// #endif
164
165// // Serialization traits
166// #ifdef HAVE_SACADO_TEUCHOSCOMM
167// #include "Sacado_Fad_SerializationTraitsImp.hpp"
168// namespace Teuchos {
169 // template <typename Ordinal, typename ValT, typename LogT>
170 // struct SerializationTraits<Ordinal, Sacado::LFad::LogicalSparse<ValT,LogT> > :
171 // public Sacado::Fad::SerializationTraitsImp< Ordinal,
172 // Sacado::LFad::LogicalSparse<ValT,LogT> >
173 // {};
174// }
175// #endif
176
177#endif // SACADO_LFAD_LOGICALSPARSETRAITS_HPP
#define SACADO_AD_PROMOTE_SPEC2(NS, AD)
User inteface class for computing the logical sparsity pattern of a derivative via forward-mode AD.
ExprType::value_type value_type
Typename of values.
const double y
Base template specification for IsADType.
static const bool value
static bool eval(const LFad::LogicalSparse< ValT, LogT > &x, const LFad::LogicalSparse< ValT, LogT > &y)
Base template specification for testing equivalence.
Base template specification for IsScalarType.
static const bool value
Base template specification for testing whether type is statically sized.
Base template specification for Promote.
ScalarType< typenameLFad::LogicalSparse< ValT, LogT >::value_type >::type type
Base template specification for ScalarType.
ScalarType< LFad::LogicalSparse< ValT, LogT > >::type scalar_type
static const scalar_type & eval(const LFad::LogicalSparse< ValT, LogT > &x)
ValueType< LFad::LogicalSparse< ValT, LogT > >::type value_type
Base template specification for ScalarValue.
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
Base template specification for string names of types.
static std::string eval()
Base template specification for ValueType.
static const value_type & eval(const LFad::LogicalSparse< ValT, LogT > &x)
ValueType< LFad::LogicalSparse< ValT, LogT > >::type value_type
Base template specification for Value.