Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_UniversalMultiVectorRandomizer.hpp
Go to the documentation of this file.
00001 // ***********************************************************************
00002 // 
00003 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00004 //                 Copyright (2004) Sandia Corporation
00005 // 
00006 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00007 // license for use of this work by or on behalf of the U.S. Government.
00008 // 
00009 // This library is free software; you can redistribute it and/or modify
00010 // it under the terms of the GNU Lesser General Public License as
00011 // published by the Free Software Foundation; either version 2.1 of the
00012 // License, or (at your option) any later version.
00013 //  
00014 // This library is distributed in the hope that it will be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 //  
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022 // USA
00023 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00024 // 
00025 // ***********************************************************************
00026 // @HEADER
00027 
00028 #ifndef THYRA_UNIVERSAL_MULTI_VECTOR_RANDOMIZER_HPP
00029 #define THYRA_UNIVERSAL_MULTI_VECTOR_RANDOMIZER_HPP
00030 
00031 
00032 #include "Thyra_MultiVectorRandomizerBase.hpp"
00033 #include "Thyra_MultiVectorStdOps.hpp"
00034 
00035 
00036 namespace Thyra {
00037 
00038 
00047 template<class Scalar>
00048 class UniversalMultiVectorRandomizer : public MultiVectorRandomizerBase<Scalar> {
00049 public:
00050 
00053 
00055   bool isCompatible( const VectorSpaceBase<Scalar> &space ) const;
00057   void randomize( MultiVectorBase<Scalar> *mv );
00058 
00060   
00061 };
00062 
00063 
00068 template<class Scalar>
00069 RCP<UniversalMultiVectorRandomizer<Scalar> >
00070 universalMultiVectorRandomizer()
00071 {
00072   return Teuchos::rcp(new UniversalMultiVectorRandomizer<Scalar>());
00073 }
00074 
00075 
00076 // //////////////////////////////
00077 // Definitions
00078 
00079 
00080 template<class Scalar>
00081 bool UniversalMultiVectorRandomizer<Scalar>::isCompatible( const VectorSpaceBase<Scalar> &space ) const
00082 {
00083   return true;
00084 }
00085 
00086 
00087 template<class Scalar>
00088 void UniversalMultiVectorRandomizer<Scalar>::randomize( MultiVectorBase<Scalar> *mv )
00089 {
00090   typedef Teuchos::ScalarTraits<Scalar> ST;
00091   Thyra::randomize(Scalar(-ST::one()),Scalar(+ST::one()),mv);
00092 }
00093 
00094 
00095 } // namespace Thyra
00096 
00097 
00098 #endif // THYRA_UNIVERSAL_MULTI_VECTOR_RANDOMIZER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines