Thyra_VecOpMacros.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef THYRA_VECOPMACROS_HPP
00030 #define THYRA_VECOPMACROS_HPP
00031 
00032 #include "Thyra_ConfigDefs.hpp"
00033 #include "Teuchos_ScalarTraits.hpp"
00034       
00038 #define THYRA_UNARY_VECTOR_OP_DECL(opName, intoOpName, thyraOpName, descr) \
00039   template <class Scalar>                                               \
00040   Vector<Scalar> opName(const Converter<Scalar, ConstVector<Scalar> >& x);      \
00041   template <class Scalar>                                               \
00042   void intoOpName(const Converter<Scalar, ConstVector<Scalar> >& donor,         \
00043                   Vector<Scalar>& acceptor)
00044 
00048 #define THYRA_UNARY_VECTOR_OP(opName, intoOpName, thyraOpName, descr)   \
00049   template <class Scalar> inline                                        \
00050   Thyra::Vector<Scalar> opName(const Converter<Scalar, ConstVector<Scalar> >& x) \
00051   {                                                                     \
00052     Thyra::ConstVector<Scalar> y=Thyra::toVector(x);                    \
00053     Thyra::Vector<Scalar> rtn = space(y).createMember();                \
00054     intoOpName(y, rtn);                                                 \
00055     return rtn;                                                         \
00056   }                                                                     \
00057   template <class Scalar> inline                                        \
00058   void intoOpName(const Converter<Scalar, ConstVector<Scalar> >& donorSource,   \
00059                   Vector<Scalar>& acceptor)                             \
00060   {                                                                     \
00061     Thyra::ConstVector<Scalar> donor=Thyra::toVector(donorSource);      \
00062     if (acceptor.ptr().get()==0)                                        \
00063       {                                                                 \
00064         acceptor = space(donor).createMember();                         \
00065       }                                                                 \
00066     Thyra::VectorBase<Scalar>* p = acceptor.ptr().get();                \
00067     const Thyra::VectorBase<Scalar>* px = donor.constPtr().get();            \
00068     Thyra::thyraOpName(p, *px);                                         \
00069   }      
00070 
00074 #define THYRA_UNARY_VECTOR_ROP_MAG_DECL(funcName, ROpName, descr) \
00075   template <class Scalar>                                     \
00076   typename Teuchos::ScalarTraits<Scalar>::magnitudeType funcName(const Converter<Scalar, ConstVector<Scalar> >& x)           
00077 
00081 #define THYRA_UNARY_VECTOR_ROP_MAG(funcName, ROpName, descr)    \
00082   template <class Scalar> inline                            \
00083   typename Teuchos::ScalarTraits<Scalar>::magnitudeType funcName(const Converter<Scalar, ConstVector<Scalar> >& x) \
00084   {                                                         \
00085     Thyra::ConstVector<Scalar> y = Thyra::toVector(x);      \
00086     return Thyra::ROpName(*(y.constPtr()));                      \
00087   }                                                                    
00088 
00092 #define THYRA_UNARY_VECTOR_ROP_DECL(funcName, ROpName, descr) \
00093   template <class Scalar>                                     \
00094   Scalar funcName(const Converter<Scalar, ConstVector<Scalar> >& x)           
00095 
00099 #define THYRA_UNARY_VECTOR_ROP(funcName, ROpName, descr)    \
00100   template <class Scalar> inline                            \
00101   Scalar funcName(const Converter<Scalar, ConstVector<Scalar> >& x) \
00102   {                                                         \
00103     Thyra::ConstVector<Scalar> y = Thyra::toVector(x);      \
00104     return Thyra::ROpName(*(y.constPtr()));                      \
00105   }                                                                    
00106 
00110 #define THYRA_BINARY_VECTOR_ROP_DECL(funcName, ROpName, descr) \
00111   template <class Scalar>                                     \
00112   Scalar funcName(const Converter<Scalar,ConstVector<Scalar> >& x, const Converter<Scalar,ConstVector<Scalar> >& y)           
00113 
00117 #define THYRA_BINARY_VECTOR_ROP(funcName, ROpName, descr) \
00118   template <class Scalar> inline \
00119   Scalar funcName(const Converter<Scalar,ConstVector<Scalar> >& x, const Converter<Scalar,ConstVector<Scalar> >& y) \
00120   { \
00121     Thyra::ConstVector<Scalar> _x = Thyra::toVector(x), _y = Thyra::toVector(y); \
00122     return Thyra::ROpName(*(_x.constPtr()),*(_y.constPtr())); \
00123   }                                                                    
00124 
00125 #endif

Generated on Thu Sep 18 12:33:03 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1