Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_EpetraLinearOp.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //               Thyra: Trilinos Solver Framework Core
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_EPETRA_LINEAR_OP_HPP
00030 #define THYRA_EPETRA_LINEAR_OP_HPP
00031 
00032 #include "Thyra_LinearOpBase.hpp"
00033 #include "Thyra_EpetraLinearOpBase.hpp"
00034 #include "Thyra_SpmdVectorSpaceBase.hpp"
00035 
00036 
00037 namespace Thyra {
00038 
00039 
00061 class EpetraLinearOp
00062   : virtual public LinearOpBase<double>,
00063     virtual public EpetraLinearOpBase
00064 {
00065 public:
00066 
00069 
00074   EpetraLinearOp();
00075 
00128   void initialize(
00129     const RCP<Epetra_Operator> &op,
00130     EOpTransp opTrans = NOTRANS,
00131     EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00132     EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00133     const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00134     const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00135     );
00136 
00185   void partiallyInitialize(
00186     const RCP<const VectorSpaceBase<double> > &range,
00187     const RCP<const VectorSpaceBase<double> > &domain,
00188     const RCP<Epetra_Operator> &op,
00189     EOpTransp opTrans = NOTRANS,
00190     EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00191     EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED
00192     );
00193 
00202   void setFullyInitialized(bool isFullyInitialized = true);
00203   
00211   void uninitialize(
00212     RCP<Epetra_Operator> *op= NULL,
00213     EOpTransp *opTrans = NULL,
00214     EApplyEpetraOpAs *applyAs = NULL,
00215     EAdjointEpetraOp *adjointSupport = NULL,
00216     RCP<const VectorSpaceBase<double> > *range = NULL,
00217     RCP<const VectorSpaceBase<double> > *domain = NULL
00218     );
00219 
00228   RCP<const SpmdVectorSpaceBase<double> > spmdRange() const;
00229 
00238   RCP<const SpmdVectorSpaceBase<double> > spmdDomain() const;
00239 
00241   RCP<Epetra_Operator> epetra_op();
00242 
00244   RCP<const Epetra_Operator> epetra_op() const;
00245 
00247 
00250 
00252   void getNonconstEpetraOpView(
00253     const Ptr<RCP<Epetra_Operator> > &epetraOp,
00254     const Ptr<EOpTransp> &epetraOpTransp,
00255     const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
00256     const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
00257     );
00259   void getEpetraOpView(
00260     const Ptr<RCP<const Epetra_Operator> > &epetraOp,
00261     const Ptr<EOpTransp> &epetraOpTransp,
00262     const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
00263     const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
00264     ) const;
00265 
00267 
00270 
00272   RCP<const VectorSpaceBase<double> > range() const;
00273 
00275   RCP<const VectorSpaceBase<double> > domain() const;
00276 
00278   RCP<const LinearOpBase<double> > clone() const;
00279 
00281 
00284   
00286   std::string description() const;
00288   void describe(
00289     FancyOStream &out,
00290     const Teuchos::EVerbosityLevel verbLevel
00291     ) const;
00292   
00294   
00295 protected:
00296 
00299 
00301   bool opSupportedImpl(EOpTransp M_trans) const;
00302 
00304   void applyImpl(
00305     const EOpTransp M_trans,
00306     const MultiVectorBase<double> &X,
00307     const Ptr<MultiVectorBase<double> > &Y,
00308     const double alpha,
00309     const double beta
00310     ) const;
00311 
00313 
00316 
00327   virtual RCP< const SpmdVectorSpaceBase<double> > 
00328   allocateDomain(
00329     const RCP<Epetra_Operator> &op, 
00330     EOpTransp op_trans 
00331     ) const; 
00332   
00343   virtual RCP< const SpmdVectorSpaceBase<double> >
00344   allocateRange( 
00345     const RCP<Epetra_Operator> &op, 
00346     EOpTransp op_trans 
00347     ) const; 
00348 
00350 
00351 private:
00352 
00353   // ////////////////////////////////////
00354   // Private data members
00355 
00356   bool isFullyInitialized_;
00357   RCP<Epetra_Operator> op_;
00358   EOpTransp opTrans_;
00359   EApplyEpetraOpAs applyAs_;
00360   EAdjointEpetraOp adjointSupport_;
00361   RCP<const SpmdVectorSpaceBase<double> > range_;
00362   RCP<const SpmdVectorSpaceBase<double> > domain_;
00363 
00364   // ////////////////////////////////////
00365   // Private member functions
00366 
00367   const Epetra_Map& getRangeMap() const;
00368   const Epetra_Map& getDomainMap() const;
00369 
00370 };  // end class EpetraLinearOp
00371 
00372 
00377 RCP<EpetraLinearOp> nonconstEpetraLinearOp();
00378 
00379 
00384 RCP<EpetraLinearOp>
00385 partialNonconstEpetraLinearOp(
00386   const RCP<const VectorSpaceBase<double> > &range,
00387   const RCP<const VectorSpaceBase<double> > &domain,
00388   const RCP<Epetra_Operator> &op,
00389   EOpTransp opTrans = NOTRANS,
00390   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00391   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED
00392   );
00393 
00394 
00400 RCP<EpetraLinearOp>
00401 nonconstEpetraLinearOp(
00402   const RCP<Epetra_Operator> &op,
00403   EOpTransp opTrans = NOTRANS,
00404   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00405   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00406   const RCP< const VectorSpaceBase<double> > &range = Teuchos::null,
00407   const RCP< const VectorSpaceBase<double> > &domain = Teuchos::null
00408   );
00409 
00410 
00416 RCP<const EpetraLinearOp>
00417 epetraLinearOp(
00418   const RCP<const Epetra_Operator> &op,
00419   EOpTransp opTrans = NOTRANS,
00420   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00421   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00422   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00423   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00424   );
00425 
00426 
00432 RCP<EpetraLinearOp>
00433 nonconstEpetraLinearOp(
00434   const RCP<Epetra_Operator> &op,
00435   const std::string &label,
00436   EOpTransp opTrans = NOTRANS,
00437   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00438   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00439   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00440   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00441   );
00442 
00443 
00449 RCP<const EpetraLinearOp>
00450 epetraLinearOp(
00451   const RCP<const Epetra_Operator> &op,
00452   const std::string &label,
00453   EOpTransp opTrans = NOTRANS,
00454   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00455   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00456   const RCP< const SpmdVectorSpaceBase<double> > &range = Teuchos::null,
00457   const RCP< const SpmdVectorSpaceBase<double> > &domain = Teuchos::null
00458   );
00459 
00460 
00461 } // end namespace Thyra
00462 
00463 
00464 #endif  // THYRA_EPETRA_LINEAR_OP_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines