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 00049 // Using declarations from Teuchos 00050 00052 using Teuchos::Ptr; 00054 using Teuchos::RCP; 00056 using Teuchos::Array; 00058 using Teuchos::ArrayView; 00060 using Teuchos::ArrayRCP; 00062 using Teuchos::Tuple; 00064 using Teuchos::FancyOStream; 00066 using Teuchos::ParameterList; 00068 using Teuchos::ScalarTraits; 00070 using Teuchos::typeName; 00072 using Teuchos::TypeNameTraits; 00073 00078 00079 // 00080 // Basic types 00081 // 00082 00083 00085 typedef Teuchos::Ordinal Ordinal; 00086 00088 THYRA_DEPRECATED typedef Ordinal Index; 00089 00091 typedef Teuchos::Range1D Range1D; 00092 00093 00096 enum EConj { 00097 NONCONJ_ELE 00098 ,CONJ_ELE 00099 }; 00100 00101 00104 inline 00105 const char* toString(EConj conj) 00106 { 00107 switch(conj) { 00108 case NONCONJ_ELE: return "NONCONJ_ELE"; 00109 case CONJ_ELE: return "CONJ_ELE"; 00110 default: TEST_FOR_EXCEPT(true); 00111 } 00112 return "BAD"; // Should never be called! 00113 } 00114 00115 00118 enum EOpTransp { 00120 NOTRANS, 00124 CONJ, 00126 TRANS, 00130 CONJTRANS 00131 }; 00132 00133 00135 THYRA_DEPRECATED typedef EOpTransp ETransp; 00136 00137 00140 inline 00141 const char* toString(EOpTransp transp) 00142 { 00143 switch(transp) { 00144 case NOTRANS: return "NOTRANS"; 00145 case CONJ: return "CONJ"; 00146 case TRANS: return "TRANS"; 00147 case CONJTRANS: return "CONJTRANS"; 00148 default: TEST_FOR_EXCEPT(true); 00149 } 00150 return "BAD"; // Should never be called! 00151 } 00152 00153 00157 inline 00158 EOpTransp real_trans(EOpTransp transp) 00159 { 00160 switch(transp) { 00161 case NOTRANS: return NOTRANS; 00162 case CONJ: return NOTRANS; 00163 case TRANS: return TRANS; 00164 case CONJTRANS: return TRANS; 00165 default: TEST_FOR_EXCEPT(true); 00166 } 00167 return NOTRANS; // Will never be called! 00168 } 00169 00170 00173 inline 00174 EOpTransp not_trans( EOpTransp transp ) 00175 { 00176 switch(transp) { 00177 case NOTRANS: return TRANS; 00178 case CONJ: return CONJTRANS; 00179 case TRANS: return CONJ; 00180 case CONJTRANS: return NOTRANS; 00181 default: TEST_FOR_EXCEPT(true); 00182 } 00183 return NOTRANS; // Will never be called! 00184 } 00185 00186 00189 inline 00190 EOpTransp trans_trans( EOpTransp trans1, EOpTransp trans2 ) 00191 { 00192 if( trans1 == trans2 ) 00193 return NOTRANS; 00194 if( trans1 == NOTRANS ) 00195 return trans2; 00196 if( trans2 == NOTRANS ) 00197 return trans1; 00198 if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) ) 00199 return CONJTRANS; 00200 if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) ) 00201 return CONJ; 00202 if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) ) 00203 return TRANS; 00204 else 00205 TEST_FOR_EXCEPT(true); 00206 return NOTRANS; // Will never be executed! 00207 } 00208 00209 00212 inline 00213 EConj transToConj( EOpTransp trans ) 00214 { 00215 switch(trans) { 00216 case NOTRANS: return NONCONJ_ELE; 00217 case CONJ: return CONJ_ELE; 00218 case TRANS: return NONCONJ_ELE; 00219 case CONJTRANS: return CONJ_ELE; 00220 default: TEST_FOR_EXCEPT(true); 00221 } 00222 return NONCONJ_ELE; // Will never be called! 00223 } 00224 00227 inline 00228 EOpTransp applyConjToTrans( EConj conj ) 00229 { 00230 switch(conj) { 00231 case NONCONJ_ELE: return NOTRANS; 00232 case CONJ_ELE: return CONJ; 00233 default: TEST_FOR_EXCEPT(true); 00234 } 00235 return NOTRANS; // Will never be called! 00236 } 00237 00238 00241 inline 00242 EOpTransp applyTransposeConjToTrans( EConj conj ) 00243 { 00244 switch(conj) { 00245 case NONCONJ_ELE: return TRANS; 00246 case CONJ_ELE: return CONJTRANS; 00247 default: TEST_FOR_EXCEPT(true); 00248 } 00249 return NOTRANS; // Will never be called! 00250 } 00251 00255 enum EViewType { 00256 VIEW_TYPE_DIRECT 00257 ,VIEW_TYPE_DETACHED 00258 }; 00259 00260 00262 enum EStrideType { 00263 STRIDE_TYPE_UNIT 00264 ,STRIDE_TYPE_NONUNIT 00265 }; 00266 00267 00269 00270 00271 namespace Exceptions { 00272 00273 00278 00279 00281 class UnInitialized : public std::logic_error 00282 {public: UnInitialized(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00283 00284 00286 class IncompatibleVectorSpaces : public std::logic_error 00287 {public: 00288 IncompatibleVectorSpaces(const std::string& what_arg) : std::logic_error(what_arg) {} 00289 // IncompatibleVectorSpaces(const IncompatibleVectorSpaces& ivs) : std::logic_error(ivs.what()) {} 00290 }; 00291 00292 00294 class OpNotSupported : public std::logic_error 00295 {public: OpNotSupported(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00296 00297 00299 00300 00301 } // namespace Exceptions 00302 00303 00304 // Fundamental ANA operator/vector interface classes 00305 00306 00307 template<class Scalar> class VectorSpaceFactoryBase; 00308 template<class Scalar> class VectorSpaceBase; 00309 template<class Scalar> class LinearOpBase; 00310 template<class Scalar> class MultiVectorBase; 00311 template<class Scalar> class VectorBase; 00312 00313 00314 } // end namespace Thyra 00315 00316 00317 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP
1.4.7