Belos Version of the Day
BelosMultiVecTraits.hpp
Go to the documentation of this file.
00001 //@HEADER
00002 // ************************************************************************
00003 //
00004 //                 Belos: Block Linear Solvers Package
00005 //                  Copyright 2004 Sandia Corporation
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ************************************************************************
00040 //@HEADER
00041 //
00042 #ifndef BELOS_MULTI_VEC_TRAITS_HPP
00043 #define BELOS_MULTI_VEC_TRAITS_HPP
00044 
00055 
00056 #include "BelosTypes.hpp"
00057 #include "BelosStubTsqrAdapter.hpp"
00058 #include "Teuchos_Range1D.hpp"
00059 #include "Teuchos_RCP.hpp"
00060 #include "Teuchos_SerialDenseMatrix.hpp"
00061 
00062 namespace Belos {
00063 
00070   template<class ScalarType, class MV>
00071   struct UndefinedMultiVecTraits
00072   {
00079     static inline ScalarType notDefined() { 
00080       return MV::this_type_is_missing_a_specialization(); 
00081     }
00082   };
00083 
00128   template<class ScalarType, class MV>
00129   class MultiVecTraits {
00130   public:
00132 
00133 
00138     static Teuchos::RCP<MV> Clone( const MV& mv, const int numvecs )
00139     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00140 
00145     static Teuchos::RCP<MV> CloneCopy( const MV& mv )
00146     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00147 
00153     static Teuchos::RCP<MV> CloneCopy( const MV& mv, const std::vector<int>& index )
00154     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00155 
00165     static Teuchos::RCP<MV> CloneCopy( const MV& mv, const Teuchos::Range1D& index )
00166     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00167 
00173     static Teuchos::RCP<MV> CloneViewNonConst( MV& mv, const std::vector<int>& index )
00174     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00175 
00184     static Teuchos::RCP<MV> CloneViewNonConst( MV& mv, const Teuchos::Range1D& index )
00185     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00186 
00192     static Teuchos::RCP<const MV> CloneView( const MV& mv, const std::vector<int>& index )
00193     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00194 
00203     static Teuchos::RCP<MV> CloneView( MV& mv, const Teuchos::Range1D& index )
00204     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }     
00205 
00207 
00209 
00210 
00212     static int GetVecLength( const MV& mv )
00213     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return 0; }     
00214 
00216     static int GetNumberVecs( const MV& mv )
00217     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return 0; }     
00218 
00241     static bool HasConstantStride( const MV& mv )
00242     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return false; }
00243 
00245 
00247 
00248 
00251     static void MvTimesMatAddMv( const ScalarType alpha, const MV& A, 
00252                                  const Teuchos::SerialDenseMatrix<int,ScalarType>& B, 
00253                                  const ScalarType beta, MV& mv )
00254     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00255 
00258     static void MvAddMv( const ScalarType alpha, const MV& A, const ScalarType beta, const MV& B, MV& mv )
00259     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00260 
00263     static void MvScale ( MV& mv, const ScalarType alpha )
00264     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }
00265     
00268     static void MvScale ( MV& mv, const std::vector<ScalarType>& alpha )
00269     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }
00270 
00273     static void MvTransMv( const ScalarType alpha, const MV& A, const MV& mv, Teuchos::SerialDenseMatrix<int,ScalarType>& B)
00274     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00275 
00278     static void MvDot ( const MV& mv, const MV& A, std::vector<ScalarType> &b) 
00279     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00280 
00282 
00283 
00284 
00288     static void MvNorm( const MV& mv, std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>& normvec, NormType type = TwoNorm )
00289     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00290 
00292 
00294 
00295 
00300     static void SetBlock( const MV& A, const std::vector<int>& index, MV& mv )
00301     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00302 
00315     static void SetBlock( const MV& A, const Teuchos::Range1D& index, MV& mv )
00316     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00317 
00321     static void Assign( const MV& A, MV& mv )
00322     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00323 
00326     static void MvRandom( MV& mv )
00327     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00328 
00331     static void MvInit( MV& mv, const ScalarType alpha = Teuchos::ScalarTraits<ScalarType>::zero() )
00332     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00333 
00335 
00337 
00338 
00341     static void MvPrint( const MV& mv, std::ostream& os )
00342     { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); }     
00343 
00345 
00346 #ifdef HAVE_BELOS_TSQR
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359     typedef Belos::details::StubTsqrAdapter<MV> tsqr_adaptor_type;
00360 #endif // HAVE_BELOS_TSQR
00361   };
00362   
00363 } // namespace Belos
00364 
00365 #endif // BELOS_MULTI_VEC_TRAITS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines