|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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_LINEAR_OP_WITH_SOLVE_BASE_DEF_HPP 00030 #define THYRA_LINEAR_OP_WITH_SOLVE_BASE_DEF_HPP 00031 00032 #include "Thyra_LinearOpWithSolveBase_decl.hpp" 00033 00034 00035 namespace Thyra { 00036 00037 00038 // Deprecated 00039 00040 00041 template<class Scalar> 00042 bool LinearOpWithSolveBase<Scalar>::solveSupportsConj(EConj conj) const 00043 { 00044 return solveSupports(applyConjToTrans(conj)); 00045 } 00046 00047 00048 template<class Scalar> 00049 bool LinearOpWithSolveBase<Scalar>::solveSupportsSolveMeasureType( 00050 EConj conj, const SolveMeasureType& solveMeasureType) const 00051 { 00052 return solveSupportsSolveMeasureType(applyConjToTrans(conj), solveMeasureType); 00053 } 00054 00055 00056 template<class Scalar> 00057 void LinearOpWithSolveBase<Scalar>::solve( 00058 const EConj conj, 00059 const MultiVectorBase<Scalar> &B, 00060 MultiVectorBase<Scalar> *X, 00061 const int numBlocks, 00062 const BlockSolveCriteria<Scalar> blockSolveCriteria[], 00063 SolveStatus<Scalar> blockSolveStatus[] 00064 ) const 00065 { 00066 const SolveStatus<Scalar> solveStatus = 00067 this->solve(applyConjToTrans(conj), B, Teuchos::ptr(X), 00068 convertBlockSolveCriteriaToSolveCritiera(numBlocks, blockSolveCriteria) 00069 ); 00070 if (numBlocks) { 00071 blockSolveStatus[0] = solveStatus; 00072 } 00073 } 00074 00075 00076 template<class Scalar> 00077 bool LinearOpWithSolveBase<Scalar>::solveTransposeSupportsConj(EConj conj) const 00078 { 00079 return solveSupports(applyTransposeConjToTrans(conj)); 00080 } 00081 00082 00083 template<class Scalar> 00084 bool LinearOpWithSolveBase<Scalar>::solveTransposeSupportsSolveMeasureType( 00085 EConj conj, const SolveMeasureType& solveMeasureType) const 00086 { 00087 return solveSupportsSolveMeasureType(applyTransposeConjToTrans(conj), 00088 solveMeasureType); 00089 } 00090 00091 00092 template<class Scalar> 00093 void LinearOpWithSolveBase<Scalar>::solveTranspose( 00094 const EConj conj, 00095 const MultiVectorBase<Scalar> &B, 00096 MultiVectorBase<Scalar> *X, 00097 const int numBlocks, 00098 const BlockSolveCriteria<Scalar> blockSolveCriteria[], 00099 SolveStatus<Scalar> blockSolveStatus[] 00100 ) const 00101 { 00102 const SolveStatus<Scalar> solveStatus = 00103 this->solve(applyTransposeConjToTrans(conj), B, Teuchos::ptr(X), 00104 convertBlockSolveCriteriaToSolveCritiera(numBlocks, blockSolveCriteria) 00105 ); 00106 if (numBlocks) { 00107 blockSolveStatus[0] = solveStatus; 00108 } 00109 } 00110 00111 00112 // Protected virtual functions to be overridden by subclasses 00113 00114 00115 template<class Scalar> 00116 bool 00117 LinearOpWithSolveBase<Scalar>::solveSupportsImpl( 00118 EOpTransp transp) const 00119 { 00120 return (transp == NOTRANS); 00121 } 00122 00123 00124 template<class Scalar> 00125 bool 00126 LinearOpWithSolveBase<Scalar>::solveSupportsSolveMeasureTypeImpl( 00127 EOpTransp transp, const SolveMeasureType& solveMeasureType) const 00128 { 00129 return (solveSupports(transp) && solveMeasureType.useDefault()); 00130 } 00131 00132 00133 // private: 00134 00135 00136 template<class Scalar> 00137 Ptr<const SolveCriteria<Scalar> > 00138 LinearOpWithSolveBase<Scalar>::convertBlockSolveCriteriaToSolveCritiera( 00139 const int numBlocks, 00140 const BlockSolveCriteria<Scalar> blockSolveCriteria[] 00141 ) 00142 { 00143 TEUCHOS_ASSERT(numBlocks == 0 || numBlocks == 1); 00144 if (numBlocks == 1) 00145 return Teuchos::ptrFromRef(blockSolveCriteria[0].solveCriteria); 00146 return Teuchos::null; 00147 } 00148 00149 00150 } // namespace Thyra 00151 00152 00153 #endif // THYRA_LINEAR_OP_WITH_SOLVE_BASE_DEF_HPP
1.7.4