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_ParameterList.hpp" 00038 #include "Teuchos_ScalarTraits.hpp" 00039 #include "Teuchos_TypeNameTraits.hpp" 00040 00041 00042 namespace Thyra { 00043 00044 00045 // Using declarations from Teuchos 00046 00048 using Teuchos::RCP; 00050 using Teuchos::FancyOStream; 00052 using Teuchos::Array; 00054 using Teuchos::ParameterList; 00056 using Teuchos::ScalarTraits; 00058 using Teuchos::typeName; 00060 using Teuchos::TypeNameTraits; 00061 00066 00067 // 00068 // Basic types 00069 // 00070 00072 typedef Teuchos::Range1D::Index Index; 00073 00075 typedef Teuchos::Range1D Range1D; 00076 00079 enum EConj { 00080 NONCONJ_ELE 00081 ,CONJ_ELE 00082 }; 00083 00086 inline 00087 const char* toString(EConj conj) 00088 { 00089 switch(conj) { 00090 case NONCONJ_ELE: return "NONCONJ_ELE"; 00091 case CONJ_ELE: return "CONJ_ELE"; 00092 default: TEST_FOR_EXCEPT(true); 00093 } 00094 return "BAD"; // Should never be called! 00095 } 00096 00100 enum ETransp { 00101 NOTRANS 00102 ,CONJ 00103 ,TRANS 00104 ,CONJTRANS 00105 }; 00106 00109 inline 00110 const char* toString(ETransp transp) 00111 { 00112 switch(transp) { 00113 case NOTRANS: return "NOTRANS"; 00114 case CONJ: return "CONJ"; 00115 case TRANS: return "TRANS"; 00116 case CONJTRANS: return "CONJTRANS"; 00117 default: TEST_FOR_EXCEPT(true); 00118 } 00119 return "BAD"; // Should never be called! 00120 } 00121 00125 inline 00126 ETransp real_trans(ETransp transp) 00127 { 00128 switch(transp) { 00129 case NOTRANS: return NOTRANS; 00130 case CONJ: return NOTRANS; 00131 case TRANS: return TRANS; 00132 case CONJTRANS: return TRANS; 00133 default: TEST_FOR_EXCEPT(true); 00134 } 00135 return NOTRANS; // Will never be called! 00136 } 00137 00140 inline 00141 ETransp not_trans( ETransp transp ) 00142 { 00143 switch(transp) { 00144 case NOTRANS: return TRANS; 00145 case CONJ: return CONJTRANS; 00146 case TRANS: return CONJ; 00147 case CONJTRANS: return NOTRANS; 00148 default: TEST_FOR_EXCEPT(true); 00149 } 00150 return NOTRANS; // Will never be called! 00151 } 00152 00155 inline 00156 ETransp trans_trans( ETransp trans1, ETransp trans2 ) 00157 { 00158 if( trans1 == trans2 ) 00159 return NOTRANS; 00160 if( trans1 == NOTRANS ) 00161 return trans2; 00162 if( trans2 == NOTRANS ) 00163 return trans1; 00164 if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) ) 00165 return CONJTRANS; 00166 if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) ) 00167 return CONJ; 00168 if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) ) 00169 return TRANS; 00170 else 00171 TEST_FOR_EXCEPT(true); 00172 return NOTRANS; // Will never be executed! 00173 } 00174 00177 inline 00178 EConj transToConj( ETransp trans ) 00179 { 00180 switch(trans) { 00181 case NOTRANS: return NONCONJ_ELE; 00182 case CONJ: return CONJ_ELE; 00183 case TRANS: return NONCONJ_ELE; 00184 case CONJTRANS: return CONJ_ELE; 00185 default: TEST_FOR_EXCEPT(true); 00186 } 00187 return NONCONJ_ELE; // Will never be called! 00188 } 00189 00192 inline 00193 ETransp applyConjToTrans( EConj conj ) { 00194 switch(conj) { 00195 case NONCONJ_ELE: return NOTRANS; 00196 case CONJ_ELE: return CONJ; 00197 default: TEST_FOR_EXCEPT(true); 00198 } 00199 return NOTRANS; // Will never be called! 00200 } 00201 00204 inline 00205 ETransp applyTransposeConjToTrans( EConj conj ) { 00206 switch(conj) { 00207 case NONCONJ_ELE: return TRANS; 00208 case CONJ_ELE: return CONJTRANS; 00209 default: TEST_FOR_EXCEPT(true); 00210 } 00211 return NOTRANS; // Will never be called! 00212 } 00213 00217 enum EViewType { 00218 VIEW_TYPE_DIRECT 00219 ,VIEW_TYPE_DETACHED 00220 }; 00221 00223 enum EStrideType { 00224 STRIDE_TYPE_UNIT 00225 ,STRIDE_TYPE_NONUNIT 00226 }; 00227 00229 00230 namespace Exceptions { 00231 00236 00238 class UnInitialized : public std::logic_error 00239 {public: UnInitialized(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00240 00242 class IncompatibleVectorSpaces : public std::logic_error 00243 {public: 00244 IncompatibleVectorSpaces(const std::string& what_arg) : std::logic_error(what_arg) {} 00245 // IncompatibleVectorSpaces(const IncompatibleVectorSpaces& ivs) : std::logic_error(ivs.what()) {} 00246 }; 00247 00249 class OpNotSupported : public std::logic_error 00250 {public: OpNotSupported(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00251 00253 00254 } // namespace Exceptions 00255 00256 // Fundamental ANA operator/vector interface classes 00257 00258 template<class Scalar> class VectorSpaceFactoryBase; 00259 template<class Scalar> class VectorSpaceBase; 00260 template<class RangeScalar, class DomainScalar = RangeScalar> class LinearOpBase; 00261 template<class Scalar> class MultiVectorBase; 00262 template<class Scalar> class VectorBase; 00263 00264 } // end namespace Thyra 00265 00266 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP
1.4.7