Thyra Version of the Day
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 // 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 Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_OPERATOR_VECTOR_TYPES_HPP
00043 #define THYRA_OPERATOR_VECTOR_TYPES_HPP
00044 
00045 #include "Thyra_ConfigDefs.hpp"
00046 #include "RTOpPack_Types.hpp"
00047 #include "Teuchos_Range1D.hpp"
00048 #include "Teuchos_RCP.hpp"
00049 #include "Teuchos_FancyOStream.hpp"
00050 #include "Teuchos_Array.hpp"
00051 #include "Teuchos_ArrayRCP.hpp"
00052 #include "Teuchos_ArrayView.hpp"
00053 #include "Teuchos_Tuple.hpp"
00054 #include "Teuchos_ParameterList.hpp"
00055 #include "Teuchos_ScalarTraits.hpp"
00056 #include "Teuchos_TypeNameTraits.hpp"
00057 
00058 
00059 namespace Thyra {
00060 
00061 // Using declarations from Teuchos
00062 
00067 using Teuchos::Ptr;
00072 using Teuchos::RCP;
00077 using Teuchos::Array;
00082 using Teuchos::ArrayView;
00087 using Teuchos::ArrayRCP;
00092 using Teuchos::Tuple;
00097 typedef Teuchos::Range1D Range1D;
00102 using Teuchos::FancyOStream;
00107 using Teuchos::ParameterList;
00112 using Teuchos::ScalarTraits;
00117 using Teuchos::typeName;
00122 using Teuchos::TypeNameTraits;
00127 typedef Teuchos::Ordinal Ordinal;
00128 
00133 THYRA_DEPRECATED typedef Ordinal Index;
00134 
00135 
00140 enum EConj {
00141   NONCONJ_ELE     
00142   ,CONJ_ELE       
00143 };
00144 
00145 
00150 inline
00151 const char* toString(EConj conj)
00152 {
00153   switch(conj) {
00154     case NONCONJ_ELE:    return "NONCONJ_ELE";
00155     case CONJ_ELE:       return "CONJ_ELE";
00156     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00157   }
00158   return "BAD"; // Should never be called!
00159 }
00160 
00161 
00166 enum EOpTransp {
00168   NOTRANS,
00172   CONJ,
00174   TRANS,
00178   CONJTRANS
00179 };
00180 
00181 
00186 THYRA_DEPRECATED typedef EOpTransp ETransp;
00187 
00188 
00193 inline
00194 const char* toString(EOpTransp transp)
00195 {
00196   switch(transp) {
00197     case NOTRANS:    return "NOTRANS";
00198     case CONJ:       return "CONJ";
00199     case TRANS:      return "TRANS";
00200     case CONJTRANS:  return "CONJTRANS";
00201     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00202   }
00203   return "BAD"; // Should never be called!
00204 }
00205 
00206 
00212 inline
00213 EOpTransp real_trans(EOpTransp transp)
00214 {
00215   switch(transp) {
00216     case NOTRANS:    return NOTRANS;
00217     case CONJ:       return NOTRANS;
00218     case TRANS:      return TRANS;
00219     case CONJTRANS:  return TRANS;
00220     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00221   }
00222   return NOTRANS; // Will never be called!
00223 }
00224 
00225 
00230 inline 
00231 EOpTransp not_trans( EOpTransp transp )
00232 {
00233   switch(transp) {
00234     case NOTRANS:    return TRANS;
00235     case CONJ:       return CONJTRANS;
00236     case TRANS:      return CONJ;
00237     case CONJTRANS:  return NOTRANS;
00238     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00239   }
00240   return NOTRANS; // Will never be called!
00241 }
00242 
00243 
00248 inline
00249 EOpTransp trans_trans( EOpTransp trans1, EOpTransp trans2 )
00250 {
00251   if( trans1 == trans2 )
00252     return NOTRANS;
00253   if( trans1 == NOTRANS )
00254     return trans2;
00255   if( trans2 == NOTRANS )
00256     return trans1;
00257   if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
00258     return CONJTRANS;
00259   if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
00260     return CONJ;
00261   if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
00262     return TRANS;
00263   else
00264     TEUCHOS_TEST_FOR_EXCEPT(true);
00265   return NOTRANS; // Will never be executed!
00266 }
00267 
00268 
00273 inline
00274 EConj transToConj( EOpTransp trans )
00275 {
00276   switch(trans) {
00277     case NOTRANS:    return NONCONJ_ELE;
00278     case CONJ:       return CONJ_ELE;
00279     case TRANS:      return NONCONJ_ELE;
00280     case CONJTRANS:  return CONJ_ELE;
00281     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00282   }
00283   return NONCONJ_ELE; // Will never be called!
00284 }
00285 
00290 inline
00291 EOpTransp applyConjToTrans( EConj conj )
00292 {
00293   switch(conj) {
00294     case NONCONJ_ELE: return NOTRANS;
00295     case CONJ_ELE:    return CONJ;
00296     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00297   }
00298   return NOTRANS; // Will never be called!
00299 }
00300 
00301 
00306 inline
00307 EOpTransp applyTransposeConjToTrans( EConj conj )
00308 {
00309   switch(conj) {
00310     case NONCONJ_ELE: return TRANS;
00311     case CONJ_ELE:    return CONJTRANS;
00312     default: TEUCHOS_TEST_FOR_EXCEPT(true);
00313   }
00314   return NOTRANS; // Will never be called!
00315 }
00316 
00322 enum EViewType {
00323   VIEW_TYPE_DIRECT   
00324   ,VIEW_TYPE_DETACHED  
00325 };
00326 
00327 
00332 enum EStrideType {
00334   STRIDE_TYPE_UNIT,
00336   STRIDE_TYPE_NONUNIT
00337 };
00338 
00339 
00340 namespace Exceptions {
00341 
00342 
00348 class UnInitialized : public std::logic_error
00349 {public: UnInitialized(const std::string& what_arg)
00350    : std::logic_error(what_arg) {}};
00351 
00352 
00357 class IncompatibleVectorSpaces : public std::logic_error
00358 {public:
00359   IncompatibleVectorSpaces(const std::string& what_arg)
00360     : std::logic_error(what_arg) {}
00361 };
00362 
00363 
00368 class OpNotSupported : public std::logic_error
00369 {public: OpNotSupported(const std::string& what_arg)
00370    : std::logic_error(what_arg) {}};
00371 
00372 
00373 } // namespace Exceptions
00374 
00375 
00376 // Fundamental ANA operator/vector interface classes
00377 
00378 
00379 template<class Scalar> class VectorSpaceFactoryBase;
00380 template<class Scalar> class VectorSpaceBase;
00381 template<class Scalar> class LinearOpBase;
00382 template<class Scalar> class MultiVectorBase;
00383 template<class Scalar> class VectorBase;
00384 
00385 
00386 } // end namespace Thyra
00387 
00388 
00389 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines