Sacado_LFad_LogicalSparseTraits.hpp

Go to the documentation of this file.
00001 // $Id$ 
00002 // $Source$ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00010 // the U.S. Government retains certain rights in this software.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #ifndef SACADO_LFAD_LOGICALSPARSERAITS_HPP
00033 #define SACADO_LFAD_LOGICALSPARSETRAITS_HPP
00034 
00035 #include "Sacado_Traits.hpp"
00036 
00037 // Forward declarations
00038 namespace Sacado {
00039   namespace LFad {
00040     template <typename T1, typename T2> class LogicalSparse;
00041   }
00042 }
00043 
00044 namespace Sacado {
00045 
00047   template <typename ValT, typename LogT>
00048   struct Promote< LFad::LogicalSparse<ValT,LogT>, 
00049       LFad::LogicalSparse<ValT,LogT> > {
00050     typedef LFad::LogicalSparse<ValT,LogT> type;
00051   };
00052 
00054   template <typename ValT, typename LogT, typename R>
00055   struct Promote< LFad::LogicalSparse<ValT,LogT>, R > {
00056     typedef typename ValueType< LFad::LogicalSparse<ValT,LogT> >::type value_type_l;
00057     typedef typename ValueType<R>::type value_type_r;
00058     typedef typename Promote<value_type_l,value_type_r>::type value_type;
00059 
00060     typedef LFad::LogicalSparse<value_type,LogT> type;
00061   };
00062 
00064   template <typename L, typename ValT, typename LogT>
00065   struct Promote< L, LFad::LogicalSparse<ValT, LogT> > {
00066   public:
00067 
00068     typedef typename ValueType<L>::type value_type_l;
00069     typedef typename ValueType< LFad::LogicalSparse<ValT,LogT> >::type value_type_r;
00070     typedef typename Promote<value_type_l,value_type_r>::type value_type;
00071 
00072     typedef LFad::LogicalSparse<value_type,LogT> type;
00073   };
00074 
00076   template <typename ValT, typename LogT>
00077   struct ScalarType< LFad::LogicalSparse<ValT,LogT> > {
00078     typedef typename ScalarType< typename LFad::LogicalSparse<ValT,LogT>::value_type >::type type;
00079   };
00080 
00082   template <typename ValT, typename LogT>
00083   struct ValueType< LFad::LogicalSparse<ValT,LogT> > {
00084     typedef typename LFad::LogicalSparse<ValT,LogT>::value_type type;
00085   };
00086 
00088   template <typename ValT, typename LogT>
00089   struct IsADType< LFad::LogicalSparse<ValT,LogT> > {
00090     static const bool value = true;
00091   };
00092 
00094   template <typename ValT, typename LogT>
00095   struct IsScalarType< LFad::LogicalSparse<ValT,LogT> > {
00096     static const bool value = false;
00097   };
00098 
00100   template <typename ValT, typename LogT>
00101   struct Value< LFad::LogicalSparse<ValT,LogT> > {
00102     typedef typename ValueType< LFad::LogicalSparse<ValT,LogT> >::type value_type;
00103     static const value_type& eval(const LFad::LogicalSparse<ValT,LogT>& x) { 
00104       return x.val(); }
00105   };
00106 
00108   template <typename ValT, typename LogT>
00109   struct ScalarValue< LFad::LogicalSparse<ValT,LogT> > {
00110     typedef typename ValueType< LFad::LogicalSparse<ValT,LogT> >::type value_type;
00111     typedef typename ScalarType< LFad::LogicalSparse<ValT,LogT> >::type scalar_type;
00112     static const scalar_type& eval(const LFad::LogicalSparse<ValT,LogT>& x) { 
00113       return ScalarValue<value_type>::eval(x.val()); }
00114   };
00115 
00117   template <typename ValT, typename LogT>
00118   struct StringName< LFad::LogicalSparse<ValT,LogT> > {
00119     static std::string eval() { 
00120       return std::string("Sacado::LFad::LoginalSparse< ") + 
00121   StringName<ValT>::eval() + ", " + 
00122   StringName<LogT>::eval() + " >"; }
00123   };
00124 
00125 } // namespace Sacado
00126 
00127 #endif // SACADO_FAD_DFADTRAITS_HPP

Generated on Wed May 12 21:39:34 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7