Thyra Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
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 
00428   void computeAbsRowSum(Epetra_Vector & rowStatVec_in) const;
00429 
00430 };  // end class EpetraLinearOp
00431 
00432 
00437 RCP<EpetraLinearOp> nonconstEpetraLinearOp();
00438 
00439 
00444 RCP<EpetraLinearOp>
00445 partialNonconstEpetraLinearOp(
00446   const RCP<const VectorSpaceBase<double> > &range,
00447   const RCP<const VectorSpaceBase<double> > &domain,
00448   const RCP<Epetra_Operator> &op,
00449   EOpTransp opTrans = NOTRANS,
00450   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00451   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED
00452   );
00453 
00454 
00460 RCP<EpetraLinearOp>
00461 nonconstEpetraLinearOp(
00462   const RCP<Epetra_Operator> &op,
00463   EOpTransp opTrans = NOTRANS,
00464   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00465   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00466   const RCP< const VectorSpaceBase<double> > &range = Teuchos::null,
00467   const RCP< const VectorSpaceBase<double> > &domain = Teuchos::null
00468   );
00469 
00470 
00476 RCP<const EpetraLinearOp>
00477 epetraLinearOp(
00478   const RCP<const Epetra_Operator> &op,
00479   EOpTransp opTrans = NOTRANS,
00480   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00481   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00482   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00483   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00484   );
00485 
00486 
00492 RCP<EpetraLinearOp>
00493 nonconstEpetraLinearOp(
00494   const RCP<Epetra_Operator> &op,
00495   const std::string &label,
00496   EOpTransp opTrans = NOTRANS,
00497   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00498   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00499   const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
00500   const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
00501   );
00502 
00503 
00509 RCP<const EpetraLinearOp>
00510 epetraLinearOp(
00511   const RCP<const Epetra_Operator> &op,
00512   const std::string &label,
00513   EOpTransp opTrans = NOTRANS,
00514   EApplyEpetraOpAs applyAs = EPETRA_OP_APPLY_APPLY,
00515   EAdjointEpetraOp adjointSupport = EPETRA_OP_ADJOINT_SUPPORTED,
00516   const RCP< const SpmdVectorSpaceBase<double> > &range = Teuchos::null,
00517   const RCP< const SpmdVectorSpaceBase<double> > &domain = Teuchos::null
00518   );
00519 
00520 
00521 } // end namespace Thyra
00522 
00523 
00524 #endif  // THYRA_EPETRA_LINEAR_OP_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines