Thyra_OperatorVectorTypes.hpp

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_OPERATOR_VECTOR_TYPES_HPP
00030 #define THYRA_OPERATOR_VECTOR_TYPES_HPP
00031 
00032 #include "Thyra_ConfigDefs.hpp"
00033 #include "RTOpPack_Types.hpp"
00034 #include "Teuchos_Range1D.hpp"
00035 #include "Teuchos_RCP.hpp"
00036 #include "Teuchos_FancyOStream.hpp"
00037 #include "Teuchos_Array.hpp"
00038 #include "Teuchos_ArrayRCP.hpp"
00039 #include "Teuchos_ArrayView.hpp"
00040 #include "Teuchos_Tuple.hpp"
00041 #include "Teuchos_ParameterList.hpp"
00042 #include "Teuchos_ScalarTraits.hpp"
00043 #include "Teuchos_TypeNameTraits.hpp"
00044 
00045 
00046 namespace Thyra {
00047 
00048 // Using declarations from Teuchos
00049 
00054 using Teuchos::Ptr;
00059 using Teuchos::RCP;
00064 using Teuchos::Array;
00069 using Teuchos::ArrayView;
00074 using Teuchos::ArrayRCP;
00079 using Teuchos::Tuple;
00084 typedef Teuchos::Range1D Range1D;
00089 using Teuchos::FancyOStream;
00094 using Teuchos::ParameterList;
00099 using Teuchos::ScalarTraits;
00104 using Teuchos::typeName;
00109 using Teuchos::TypeNameTraits;
00114 typedef Teuchos::Ordinal Ordinal;
00115 
00120 THYRA_DEPRECATED typedef Ordinal Index;
00121 
00122 
00127 enum EConj {
00128   NONCONJ_ELE     
00129   ,CONJ_ELE       
00130 };
00131 
00132 
00137 inline
00138 const char* toString(EConj conj)
00139 {
00140   switch(conj) {
00141     case NONCONJ_ELE:    return "NONCONJ_ELE";
00142     case CONJ_ELE:       return "CONJ_ELE";
00143     default: TEST_FOR_EXCEPT(true);
00144   }
00145   return "BAD"; // Should never be called!
00146 }
00147 
00148 
00153 enum EOpTransp {
00155   NOTRANS,
00159   CONJ,
00161   TRANS,
00165   CONJTRANS
00166 };
00167 
00168 
00173 THYRA_DEPRECATED typedef EOpTransp ETransp;
00174 
00175 
00180 inline
00181 const char* toString(EOpTransp transp)
00182 {
00183   switch(transp) {
00184     case NOTRANS:    return "NOTRANS";
00185     case CONJ:       return "CONJ";
00186     case TRANS:      return "TRANS";
00187     case CONJTRANS:  return "CONJTRANS";
00188     default: TEST_FOR_EXCEPT(true);
00189   }
00190   return "BAD"; // Should never be called!
00191 }
00192 
00193 
00199 inline
00200 EOpTransp real_trans(EOpTransp transp)
00201 {
00202   switch(transp) {
00203     case NOTRANS:    return NOTRANS;
00204     case CONJ:       return NOTRANS;
00205     case TRANS:      return TRANS;
00206     case CONJTRANS:  return TRANS;
00207     default: TEST_FOR_EXCEPT(true);
00208   }
00209   return NOTRANS; // Will never be called!
00210 }
00211 
00212 
00217 inline 
00218 EOpTransp not_trans( EOpTransp transp )
00219 {
00220   switch(transp) {
00221     case NOTRANS:    return TRANS;
00222     case CONJ:       return CONJTRANS;
00223     case TRANS:      return CONJ;
00224     case CONJTRANS:  return NOTRANS;
00225     default: TEST_FOR_EXCEPT(true);
00226   }
00227   return NOTRANS; // Will never be called!
00228 }
00229 
00230 
00235 inline
00236 EOpTransp trans_trans( EOpTransp trans1, EOpTransp trans2 )
00237 {
00238   if( trans1 == trans2 )
00239     return NOTRANS;
00240   if( trans1 == NOTRANS )
00241     return trans2;
00242   if( trans2 == NOTRANS )
00243     return trans1;
00244   if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
00245     return CONJTRANS;
00246   if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
00247     return CONJ;
00248   if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
00249     return TRANS;
00250   else
00251     TEST_FOR_EXCEPT(true);
00252   return NOTRANS; // Will never be executed!
00253 }
00254 
00255 
00260 inline
00261 EConj transToConj( EOpTransp trans )
00262 {
00263   switch(trans) {
00264     case NOTRANS:    return NONCONJ_ELE;
00265     case CONJ:       return CONJ_ELE;
00266     case TRANS:      return NONCONJ_ELE;
00267     case CONJTRANS:  return CONJ_ELE;
00268     default: TEST_FOR_EXCEPT(true);
00269   }
00270   return NONCONJ_ELE; // Will never be called!
00271 }
00272 
00277 inline
00278 EOpTransp applyConjToTrans( EConj conj )
00279 {
00280   switch(conj) {
00281     case NONCONJ_ELE: return NOTRANS;
00282     case CONJ_ELE:    return CONJ;
00283     default: TEST_FOR_EXCEPT(true);
00284   }
00285   return NOTRANS; // Will never be called!
00286 }
00287 
00288 
00293 inline
00294 EOpTransp applyTransposeConjToTrans( EConj conj )
00295 {
00296   switch(conj) {
00297     case NONCONJ_ELE: return TRANS;
00298     case CONJ_ELE:    return CONJTRANS;
00299     default: TEST_FOR_EXCEPT(true);
00300   }
00301   return NOTRANS; // Will never be called!
00302 }
00303 
00309 enum EViewType {
00310   VIEW_TYPE_DIRECT   
00311   ,VIEW_TYPE_DETACHED  
00312 };
00313 
00314 
00319 enum EStrideType {
00321   STRIDE_TYPE_UNIT,
00323   STRIDE_TYPE_NONUNIT
00324 };
00325 
00326 
00327 namespace Exceptions {
00328 
00329 
00335 class UnInitialized : public std::logic_error
00336 {public: UnInitialized(const std::string& what_arg)
00337    : std::logic_error(what_arg) {}};
00338 
00339 
00344 class IncompatibleVectorSpaces : public std::logic_error
00345 {public:
00346   IncompatibleVectorSpaces(const std::string& what_arg)
00347     : std::logic_error(what_arg) {}
00348 };
00349 
00350 
00355 class OpNotSupported : public std::logic_error
00356 {public: OpNotSupported(const std::string& what_arg)
00357    : std::logic_error(what_arg) {}};
00358 
00359 
00360 } // namespace Exceptions
00361 
00362 
00363 // Fundamental ANA operator/vector interface classes
00364 
00365 
00366 template<class Scalar> class VectorSpaceFactoryBase;
00367 template<class Scalar> class VectorSpaceBase;
00368 template<class Scalar> class LinearOpBase;
00369 template<class Scalar> class MultiVectorBase;
00370 template<class Scalar> class VectorBase;
00371 
00372 
00373 } // end namespace Thyra
00374 
00375 
00376 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP

Generated on Tue Jul 13 09:26:23 2010 for Thyra by  doxygen 1.4.7