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 "RTOpPack_Types.hpp"
00033 #include "Teuchos_Range1D.hpp"
00034 #include "Teuchos_RefCountPtr.hpp"
00035 
00036 namespace Thyra {
00037 
00042 
00043 //
00044 // Basic types
00045 //
00046 
00048 typedef Teuchos::Range1D::Index  Index;
00049 
00051 typedef Teuchos::Range1D   Range1D;
00052 
00055 enum EConj {
00056   NONCONJ_ELE     
00057   ,CONJ_ELE       
00058 };
00059 
00062 inline
00063 const char* toString(EConj conj)
00064 {
00065   switch(conj) {
00066     case NONCONJ_ELE:    return "NONCONJ_ELE";
00067     case CONJ_ELE:       return "CONJ_ELE";
00068     default: TEST_FOR_EXCEPT(true);
00069   }
00070   return "BAD"; // Should never be called!
00071 }
00072 
00076 enum ETransp {
00077   NOTRANS     
00078   ,CONJ       
00079   ,TRANS      
00080   ,CONJTRANS  
00081 };
00082 
00085 inline
00086 const char* toString(ETransp transp)
00087 {
00088   switch(transp) {
00089     case NOTRANS:    return "NOTRANS";
00090     case CONJ:       return "CONJ";
00091     case TRANS:      return "TRANS";
00092     case CONJTRANS:  return "CONJTRANS";
00093     default: TEST_FOR_EXCEPT(true);
00094   }
00095   return "BAD"; // Should never be called!
00096 }
00097 
00101 inline
00102 ETransp real_trans(ETransp transp)
00103 {
00104   switch(transp) {
00105     case NOTRANS:    return NOTRANS;
00106     case CONJ:       return NOTRANS;
00107     case TRANS:      return TRANS;
00108     case CONJTRANS:  return TRANS;
00109     default: TEST_FOR_EXCEPT(true);
00110   }
00111   return NOTRANS; // Will never be called!
00112 }
00113 
00116 inline 
00117 ETransp not_trans( ETransp transp )
00118 {
00119   switch(transp) {
00120     case NOTRANS:    return TRANS;
00121     case CONJ:       return CONJTRANS;
00122     case TRANS:      return CONJ;
00123     case CONJTRANS:  return NOTRANS;
00124     default: TEST_FOR_EXCEPT(true);
00125   }
00126   return NOTRANS; // Will never be called!
00127 }
00128 
00131 inline
00132 ETransp trans_trans( ETransp trans1, ETransp trans2 )
00133 {
00134   if( trans1 == trans2 )
00135     return NOTRANS;
00136   if( trans1 == NOTRANS )
00137     return trans2;
00138   if( trans2 == NOTRANS )
00139     return trans1;
00140   if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
00141     return CONJTRANS;
00142   if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
00143     return CONJ;
00144   if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
00145     return TRANS;
00146   else
00147     TEST_FOR_EXCEPT(true);
00148   return NOTRANS; // Will never be executed!
00149 }
00150 
00153 inline
00154 EConj transToConj( ETransp trans )
00155 {
00156   switch(trans) {
00157     case NOTRANS:    return NONCONJ_ELE;
00158     case CONJ:       return CONJ_ELE;
00159     case TRANS:      return NONCONJ_ELE;
00160     case CONJTRANS:  return CONJ_ELE;
00161     default: TEST_FOR_EXCEPT(true);
00162   }
00163   return NONCONJ_ELE; // Will never be called!
00164 }
00165 
00168 inline
00169 ETransp applyConjToTrans( EConj conj ) {
00170   switch(conj) {
00171     case NONCONJ_ELE: return NOTRANS;
00172     case CONJ_ELE:    return CONJ;
00173     default: TEST_FOR_EXCEPT(true);
00174   }
00175   return NOTRANS; // Will never be called!
00176 }
00177 
00180 inline
00181 ETransp applyTransposeConjToTrans( EConj conj ) {
00182   switch(conj) {
00183     case NONCONJ_ELE: return TRANS;
00184     case CONJ_ELE:    return CONJTRANS;
00185     default: TEST_FOR_EXCEPT(true);
00186   }
00187   return NOTRANS; // Will never be called!
00188 }
00189 
00193 enum EViewType {
00194   VIEW_TYPE_DIRECT   
00195   ,VIEW_TYPE_DETACHED  
00196 };
00197 
00199 enum EStrideType {
00200   STRIDE_TYPE_UNIT      
00201   ,STRIDE_TYPE_NONUNIT   
00202 };
00203 
00205 
00206 namespace Exceptions {
00207 
00212 
00214 class UnInitialized : public std::logic_error
00215 {public: UnInitialized(const std::string& what_arg) : std::logic_error(what_arg) {}};
00216 
00218 class IncompatibleVectorSpaces : public std::logic_error
00219 {public:
00220   IncompatibleVectorSpaces(const std::string& what_arg) : std::logic_error(what_arg) {}
00221 //  IncompatibleVectorSpaces(const IncompatibleVectorSpaces& ivs) : std::logic_error(ivs.what()) {}
00222 };
00223 
00225 class OpNotSupported : public std::logic_error
00226 {public: OpNotSupported(const std::string& what_arg) : std::logic_error(what_arg) {}};
00227 
00229 
00230 } // namespace Exceptions
00231 
00232 // Fundamental ANA operator/vector interface classes
00233 
00234 template<class Scalar>                                        class VectorSpaceFactoryBase;
00235 template<class Scalar>                                        class VectorSpaceBase;
00236 template<class RangeScalar, class DomainScalar = RangeScalar> class LinearOpBase;
00237 template<class Scalar>                                        class MultiVectorBase;
00238 template<class Scalar>                                        class VectorBase;
00239 
00240 } // end namespace Thyra
00241 
00242 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP

Generated on Thu Sep 18 12:32:11 2008 for Fundamental Thyra ANA Operator/Vector Interfaces by doxygen 1.3.9.1