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_RCP.hpp"
00035 #include "Teuchos_FancyOStream.hpp"
00036 #include "Teuchos_Array.hpp"
00037 #include "Teuchos_ArrayRCP.hpp"
00038 #include "Teuchos_ArrayView.hpp"
00039 #include "Teuchos_ParameterList.hpp"
00040 #include "Teuchos_ScalarTraits.hpp"
00041 #include "Teuchos_TypeNameTraits.hpp"
00042 
00043 
00044 namespace Thyra {
00045 
00046 
00047 // Using declarations from Teuchos
00048 
00050 using Teuchos::Ptr;
00052 using Teuchos::RCP;
00054 using Teuchos::Array;
00056 using Teuchos::ArrayView;
00058 using Teuchos::ArrayRCP;
00060 using Teuchos::FancyOStream;
00062 using Teuchos::ParameterList;
00064 using Teuchos::ScalarTraits;
00066 using Teuchos::typeName;
00068 using Teuchos::TypeNameTraits;
00069 
00074 
00075 //
00076 // Basic types
00077 //
00078 
00079 
00081 typedef Teuchos::Range1D::Index  Index;
00082 
00083 
00085 typedef Teuchos::Range1D   Range1D;
00086 
00087 
00090 enum EConj {
00091   NONCONJ_ELE     
00092   ,CONJ_ELE       
00093 };
00094 
00095 
00098 inline
00099 const char* toString(EConj conj)
00100 {
00101   switch(conj) {
00102     case NONCONJ_ELE:    return "NONCONJ_ELE";
00103     case CONJ_ELE:       return "CONJ_ELE";
00104     default: TEST_FOR_EXCEPT(true);
00105   }
00106   return "BAD"; // Should never be called!
00107 }
00108 
00109 
00112 enum EOpTransp {
00114   NOTRANS,
00118   CONJ,
00120   TRANS,
00124   CONJTRANS
00125 };
00126 
00127 
00129 typedef EOpTransp ETransp;
00130 
00131 
00134 inline
00135 const char* toString(EOpTransp transp)
00136 {
00137   switch(transp) {
00138     case NOTRANS:    return "NOTRANS";
00139     case CONJ:       return "CONJ";
00140     case TRANS:      return "TRANS";
00141     case CONJTRANS:  return "CONJTRANS";
00142     default: TEST_FOR_EXCEPT(true);
00143   }
00144   return "BAD"; // Should never be called!
00145 }
00146 
00147 
00151 inline
00152 EOpTransp real_trans(EOpTransp transp)
00153 {
00154   switch(transp) {
00155     case NOTRANS:    return NOTRANS;
00156     case CONJ:       return NOTRANS;
00157     case TRANS:      return TRANS;
00158     case CONJTRANS:  return TRANS;
00159     default: TEST_FOR_EXCEPT(true);
00160   }
00161   return NOTRANS; // Will never be called!
00162 }
00163 
00164 
00167 inline 
00168 EOpTransp not_trans( EOpTransp transp )
00169 {
00170   switch(transp) {
00171     case NOTRANS:    return TRANS;
00172     case CONJ:       return CONJTRANS;
00173     case TRANS:      return CONJ;
00174     case CONJTRANS:  return NOTRANS;
00175     default: TEST_FOR_EXCEPT(true);
00176   }
00177   return NOTRANS; // Will never be called!
00178 }
00179 
00180 
00183 inline
00184 EOpTransp trans_trans( EOpTransp trans1, EOpTransp trans2 )
00185 {
00186   if( trans1 == trans2 )
00187     return NOTRANS;
00188   if( trans1 == NOTRANS )
00189     return trans2;
00190   if( trans2 == NOTRANS )
00191     return trans1;
00192   if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
00193     return CONJTRANS;
00194   if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
00195     return CONJ;
00196   if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
00197     return TRANS;
00198   else
00199     TEST_FOR_EXCEPT(true);
00200   return NOTRANS; // Will never be executed!
00201 }
00202 
00203 
00206 inline
00207 EConj transToConj( EOpTransp trans )
00208 {
00209   switch(trans) {
00210     case NOTRANS:    return NONCONJ_ELE;
00211     case CONJ:       return CONJ_ELE;
00212     case TRANS:      return NONCONJ_ELE;
00213     case CONJTRANS:  return CONJ_ELE;
00214     default: TEST_FOR_EXCEPT(true);
00215   }
00216   return NONCONJ_ELE; // Will never be called!
00217 }
00218 
00221 inline
00222 EOpTransp applyConjToTrans( EConj conj ) {
00223   switch(conj) {
00224     case NONCONJ_ELE: return NOTRANS;
00225     case CONJ_ELE:    return CONJ;
00226     default: TEST_FOR_EXCEPT(true);
00227   }
00228   return NOTRANS; // Will never be called!
00229 }
00230 
00231 
00234 inline
00235 EOpTransp applyTransposeConjToTrans( EConj conj ) {
00236   switch(conj) {
00237     case NONCONJ_ELE: return TRANS;
00238     case CONJ_ELE:    return CONJTRANS;
00239     default: TEST_FOR_EXCEPT(true);
00240   }
00241   return NOTRANS; // Will never be called!
00242 }
00243 
00247 enum EViewType {
00248   VIEW_TYPE_DIRECT   
00249   ,VIEW_TYPE_DETACHED  
00250 };
00251 
00252 
00254 enum EStrideType {
00255   STRIDE_TYPE_UNIT      
00256   ,STRIDE_TYPE_NONUNIT   
00257 };
00258 
00259 
00261 
00262 
00263 namespace Exceptions {
00264 
00265 
00270 
00271 
00273 class UnInitialized : public std::logic_error
00274 {public: UnInitialized(const std::string& what_arg) : std::logic_error(what_arg) {}};
00275 
00276 
00278 class IncompatibleVectorSpaces : public std::logic_error
00279 {public:
00280   IncompatibleVectorSpaces(const std::string& what_arg) : std::logic_error(what_arg) {}
00281 //  IncompatibleVectorSpaces(const IncompatibleVectorSpaces& ivs) : std::logic_error(ivs.what()) {}
00282 };
00283 
00284 
00286 class OpNotSupported : public std::logic_error
00287 {public: OpNotSupported(const std::string& what_arg) : std::logic_error(what_arg) {}};
00288 
00289 
00291 
00292 
00293 } // namespace Exceptions
00294 
00295 
00296 // Fundamental ANA operator/vector interface classes
00297 
00298 
00299 template<class Scalar> class VectorSpaceFactoryBase;
00300 template<class Scalar> class VectorSpaceBase;
00301 template<class RangeScalar, class DomainScalar = RangeScalar> class LinearOpBase;
00302 template<class Scalar> class MultiVectorBase;
00303 template<class Scalar> class VectorBase;
00304 
00305 
00306 } // end namespace Thyra
00307 
00308 
00309 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP

Generated on Wed May 12 21:42:09 2010 for Fundamental Thyra ANA Operator/Vector Interfaces by  doxygen 1.4.7