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: 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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_EPETRA_LINEAR_OP_HPP
00043 #define THYRA_EPETRA_LINEAR_OP_HPP
00044 
00045 #include "Thyra_LinearOpBase.hpp"
00046 #include "Thyra_EpetraLinearOpBase.hpp"
00047 #include "Thyra_ScaledLinearOpBase.hpp"
00048 #include "Thyra_RowStatLinearOpBase.hpp"
00049 #include "Thyra_SpmdVectorSpaceBase.hpp"
00050 
00051 #include "Epetra_RowMatrix.h"
00052 
00053 
00054 namespace Thyra {
00055 
00056 
00078 class EpetraLinearOp
00079   : virtual public LinearOpBase<double>,
00080     virtual public ScaledLinearOpBase<double>,
00081     virtual public RowStatLinearOpBase<double>,
00082     virtual public EpetraLinearOpBase
00083 {
00084 public:
00085 
00088 
00093   EpetraLinearOp();
00094 
00147   void initialize(
00148     const RCP<Epetra_Operator> &op,
00149     EOpTransp opTrans = NOTRANS,
00150     EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00151     EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00152     const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00153     const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00154     );
00155 
00204   void partiallyInitialize(
00205     const RCP<const VectorSpaceBase<double> > &range,
00206     const RCP<const VectorSpaceBase<double> > &domain,
00207     const RCP<Epetra_Operator> &op,
00208     EOpTransp opTrans = NOTRANS,
00209     EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00210     EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED
00211     );
00212 
00221   void setFullyInitialized(bool isFullyInitialized = true);
00222   
00230   void uninitialize(
00231     RCP<Epetra_Operator> *op= NULL,
00232     EOpTransp *opTrans = NULL,
00233     EApplyEpetraOpAs *applyAs = NULL,
00234     EAdjointEpetraOp *adjointSupport = NULL,
00235     RCP<const VectorSpaceBase<double> > *range = NULL,
00236     RCP<const VectorSpaceBase<double> > *domain = NULL
00237     );
00238 
00247   RCP<const SpmdVectorSpaceBase<double> > spmdRange() const;
00248 
00257   RCP<const SpmdVectorSpaceBase<double> > spmdDomain() const;
00258 
00260   RCP<Epetra_Operator> epetra_op();
00261 
00263   RCP<const Epetra_Operator> epetra_op() const;
00264 
00266 
00269 
00271   void getNonconstEpetraOpView(
00272     const Ptr<RCP<Epetra_Operator> > &epetraOp,
00273     const Ptr<EOpTransp> &epetraOpTransp,
00274     const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
00275     const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
00276     );
00278   void getEpetraOpView(
00279     const Ptr<RCP<const Epetra_Operator> > &epetraOp,
00280     const Ptr<EOpTransp> &epetraOpTransp,
00281     const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
00282     const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
00283     ) const;
00284 
00286 
00289 
00291   RCP<const VectorSpaceBase<double> > range() const;
00292 
00294   RCP<const VectorSpaceBase<double> > domain() const;
00295 
00297   RCP<const LinearOpBase<double> > clone() const;
00298 
00300 
00303   
00305   std::string description() const;
00307   void describe(
00308     FancyOStream &out,
00309     const Teuchos::EVerbosityLevel verbLevel
00310     ) const;
00311   
00313   
00314 protected:
00315 
00318 
00320   bool opSupportedImpl(EOpTransp M_trans) const;
00321 
00323   void applyImpl(
00324     const EOpTransp M_trans,
00325     const MultiVectorBase<double> &X,
00326     const Ptr<MultiVectorBase<double> > &Y,
00327     const double alpha,
00328     const double beta
00329     ) const;
00330 
00332 
00335 
00337   virtual bool supportsScaleLeftImpl() const;
00338 
00340   virtual bool supportsScaleRightImpl() const;
00341 
00343   virtual void scaleLeftImpl(const VectorBase<double> &row_scaling);
00344 
00346   virtual void scaleRightImpl(const VectorBase<double> &col_scaling);
00347   
00349 
00352 
00354   virtual bool rowStatIsSupportedImpl(
00355     const RowStatLinearOpBaseUtils::ERowStat rowStat) const;
00356 
00358   virtual void getRowStatImpl(
00359     const RowStatLinearOpBaseUtils::ERowStat rowStat,
00360     const Ptr<VectorBase<double> > &rowStatVec) const;
00361 
00363 
00366 
00377   virtual RCP< const SpmdVectorSpaceBase<double> > 
00378   allocateDomain(
00379     const RCP<Epetra_Operator> &op, 
00380     EOpTransp op_trans 
00381     ) const; 
00382   
00393   virtual RCP< const SpmdVectorSpaceBase<double> >
00394   allocateRange( 
00395     const RCP<Epetra_Operator> &op, 
00396     EOpTransp op_trans 
00397     ) const; 
00398 
00400 
00401 private:
00402 
00403   // ////////////////////////////////////
00404   // Private data members
00405 
00406   bool isFullyInitialized_;
00407   RCP<Epetra_Operator> op_;
00408   RCP<Epetra_RowMatrix> rowMatrix_;
00409   EOpTransp opTrans_;
00410   EApplyEpetraOpAs applyAs_;
00411   EAdjointEpetraOp adjointSupport_;
00412   RCP<const SpmdVectorSpaceBase<double> > range_;
00413   RCP<const SpmdVectorSpaceBase<double> > domain_;
00414 
00415   // ////////////////////////////////////
00416   // Private member functions
00417 
00418   const Epetra_Map& getRangeMap() const;
00419   const Epetra_Map& getDomainMap() const;
00420 
00421 };  // end class EpetraLinearOp
00422 
00423 
00428 RCP<EpetraLinearOp> nonconstEpetraLinearOp();
00429 
00430 
00435 RCP<EpetraLinearOp>
00436 partialNonconstEpetraLinearOp(
00437   const RCP<const VectorSpaceBase<double> > &range,
00438   const RCP<const VectorSpaceBase<double> > &domain,
00439   const RCP<Epetra_Operator> &op,
00440   EOpTransp opTrans = NOTRANS,
00441   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00442   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED
00443   );
00444 
00445 
00451 RCP<EpetraLinearOp>
00452 nonconstEpetraLinearOp(
00453   const RCP<Epetra_Operator> &op,
00454   EOpTransp opTrans = NOTRANS,
00455   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00456   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00457   const RCP< const VectorSpaceBase<double> > &range = Teuchos::null,
00458   const RCP< const VectorSpaceBase<double> > &domain = Teuchos::null
00459   );
00460 
00461 
00467 RCP<const EpetraLinearOp>
00468 epetraLinearOp(
00469   const RCP<const Epetra_Operator> &op,
00470   EOpTransp opTrans = NOTRANS,
00471   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00472   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00473   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00474   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00475   );
00476 
00477 
00483 RCP<EpetraLinearOp>
00484 nonconstEpetraLinearOp(
00485   const RCP<Epetra_Operator> &op,
00486   const std::string &label,
00487   EOpTransp opTrans = NOTRANS,
00488   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00489   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00490   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00491   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00492   );
00493 
00494 
00500 RCP<const EpetraLinearOp>
00501 epetraLinearOp(
00502   const RCP<const Epetra_Operator> &op,
00503   const std::string &label,
00504   EOpTransp opTrans = NOTRANS,
00505   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00506   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00507   const RCP< const SpmdVectorSpaceBase<double> > &range = Teuchos::null,
00508   const RCP< const SpmdVectorSpaceBase<double> > &domain = Teuchos::null
00509   );
00510 
00511 
00512 } // end namespace Thyra
00513 
00514 
00515 #endif  // THYRA_EPETRA_LINEAR_OP_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines