|
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_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP 00030 #define THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP 00031 00032 00033 #include "Thyra_PhysicallyBlockedLinearOpWithSolveBase.hpp" 00034 #include "Thyra_PhysicallyBlockedLinearOpBase.hpp" 00035 #include "Thyra_ProductVectorSpaceBase.hpp" 00036 #include "Teuchos_ConstNonconstObjectContainer.hpp" 00037 #include "Teuchos_Array.hpp" 00038 00039 00040 namespace Thyra { 00041 00042 00098 template<class Scalar> 00099 class DefaultBlockedTriangularLinearOpWithSolve 00100 : virtual public PhysicallyBlockedLinearOpWithSolveBase<Scalar> 00101 { 00102 public: 00103 00106 00108 DefaultBlockedTriangularLinearOpWithSolve(); 00109 00111 void setNonconstBlocks( const RCP<PhysicallyBlockedLinearOpBase<Scalar> > &blocks ); 00112 00114 void setBlocks( const RCP<const PhysicallyBlockedLinearOpBase<Scalar> > &blocks ); 00115 00117 RCP<PhysicallyBlockedLinearOpBase<Scalar> > getNonconstBlocks(); 00118 00120 RCP<const PhysicallyBlockedLinearOpBase<Scalar> > getBlocks(); 00121 00123 00126 00128 bool acceptsLOWSBlock(const int i, const int j) const; 00130 void setNonconstLOWSBlock( 00131 const int i, const int j, 00132 const RCP<LinearOpWithSolveBase<Scalar> > &block 00133 ); 00135 void setLOWSBlock( 00136 const int i, const int j, 00137 const RCP<const LinearOpWithSolveBase<Scalar> > &block 00138 ); 00139 00141 00144 00146 void beginBlockFill(); 00148 void beginBlockFill( 00149 const int numRowBlocks, const int numColBlocks 00150 ); 00152 void beginBlockFill( 00153 const RCP<const ProductVectorSpaceBase<Scalar> > &productRange, 00154 const RCP<const ProductVectorSpaceBase<Scalar> > &productDomain 00155 ); 00157 bool blockFillIsActive() const; 00159 bool acceptsBlock(const int i, const int j) const; 00161 void setNonconstBlock( 00162 const int i, const int j, 00163 const RCP<LinearOpBase<Scalar> > &block 00164 ); 00166 void setBlock( 00167 const int i, const int j, 00168 const RCP<const LinearOpBase<Scalar> > &block 00169 ); 00171 void endBlockFill(); 00173 void uninitialize(); 00174 00176 00179 00181 RCP<LinearOpWithSolveBase<Scalar> > 00182 getNonconstLOWSBlock(const int i, const int j); 00184 RCP<const LinearOpWithSolveBase<Scalar> > 00185 getLOWSBlock(const int i, const int j) const; 00186 00188 00191 00193 RCP<const ProductVectorSpaceBase<Scalar> > 00194 productRange() const; 00196 RCP<const ProductVectorSpaceBase<Scalar> > 00197 productDomain() const; 00199 bool blockExists(const int i, const int j) const; 00201 bool blockIsConst(const int i, const int j) const; 00203 RCP<LinearOpBase<Scalar> > 00204 getNonconstBlock(const int i, const int j); 00206 RCP<const LinearOpBase<Scalar> > 00207 getBlock(const int i, const int j) const; 00208 00210 00213 00215 RCP<const VectorSpaceBase<Scalar> > range() const; 00217 RCP<const VectorSpaceBase<Scalar> > domain() const; 00219 RCP<const LinearOpBase<Scalar> > clone() const; 00220 00222 00225 00230 std::string description() const; 00231 00239 void describe( 00240 Teuchos::FancyOStream &out, 00241 const Teuchos::EVerbosityLevel verbLevel 00242 ) const; 00243 00245 00246 protected: 00247 00251 bool opSupportedImpl(EOpTransp M_trans) const; 00253 void applyImpl( 00254 const EOpTransp M_trans, 00255 const MultiVectorBase<Scalar> &X, 00256 const Ptr<MultiVectorBase<Scalar> > &Y, 00257 const Scalar alpha, 00258 const Scalar beta 00259 ) const; 00261 00265 bool solveSupportsImpl(EOpTransp M_trans) const; 00267 bool solveSupportsSolveMeasureTypeImpl( 00268 EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const; 00270 SolveStatus<Scalar> solveImpl( 00271 const EOpTransp transp, 00272 const MultiVectorBase<Scalar> &B, 00273 const Ptr<MultiVectorBase<Scalar> > &X, 00274 const Ptr<const SolveCriteria<Scalar> > solveCriteria 00275 ) const; 00277 00278 private: 00279 00280 // ////////////////////////// 00281 // Private types 00282 00283 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveBase<Scalar> > 00284 CNCLOWS; 00285 00286 typedef Teuchos::ConstNonconstObjectContainer<PhysicallyBlockedLinearOpBase<Scalar> > 00287 CNCPBLOB; 00288 00289 // ///////////////////////// 00290 // Private data members 00291 00292 bool blockFillIsActive_; 00293 00294 RCP<const ProductVectorSpaceBase<Scalar> > productRange_; 00295 RCP<const ProductVectorSpaceBase<Scalar> > productDomain_; 00296 int numDiagBlocks_; 00297 00298 Array<CNCLOWS> diagonalBlocks_; 00299 00300 // All blocks (including LOB form of diagonals) 00301 CNCPBLOB blocks_; 00302 00303 // ///////////////////////// 00304 // Private member functions 00305 00306 void assertBlockFillIsActive(bool) const; 00307 00308 void assertBlockRowCol(const int i, const int j) const; 00309 00310 template<class LinearOpWithSolveType> 00311 void setLOWSBlockImpl( const int i, const int j, 00312 const RCP<LinearOpWithSolveType> &block ); 00313 00314 void assertAndSetBlockStructure(const PhysicallyBlockedLinearOpBase<Scalar>& blocks); 00315 00316 // Not defined and not to be called 00317 00318 DefaultBlockedTriangularLinearOpWithSolve( 00319 const DefaultBlockedTriangularLinearOpWithSolve&); 00320 00321 DefaultBlockedTriangularLinearOpWithSolve& 00322 operator=(const DefaultBlockedTriangularLinearOpWithSolve&); 00323 00324 }; 00325 00326 00331 template<class Scalar> 00332 RCP<DefaultBlockedTriangularLinearOpWithSolve<Scalar> > 00333 defaultBlockedTriangularLinearOpWithSolve() 00334 { 00335 return Teuchos::rcp(new DefaultBlockedTriangularLinearOpWithSolve<Scalar>); 00336 } 00337 00338 00339 } // namespace Thyra 00340 00341 00342 #endif // THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
1.7.4