Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_EpetraLinearOp.hpp
1// @HEADER
2// *****************************************************************************
3// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4//
5// Copyright 2004 NTESS and the Thyra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef THYRA_EPETRA_LINEAR_OP_HPP
11#define THYRA_EPETRA_LINEAR_OP_HPP
12
13#include "Thyra_LinearOpBase.hpp"
14#include "Thyra_EpetraLinearOpBase.hpp"
15#include "Thyra_ScaledLinearOpBase.hpp"
16#include "Thyra_RowStatLinearOpBase.hpp"
17#include "Thyra_SpmdVectorSpaceBase.hpp"
18
19#include "Epetra_RowMatrix.h"
20
21
22namespace Thyra {
23
24
47 : virtual public LinearOpBase<double>,
48 virtual public ScaledLinearOpBase<double>,
49 virtual public RowStatLinearOpBase<double>,
50 virtual public EpetraLinearOpBase
51{
52public:
53
56
62
115 void initialize(
116 const RCP<Epetra_Operator> &op,
117 EOpTransp opTrans = NOTRANS,
122 );
123
173 const RCP<const VectorSpaceBase<double> > &range,
174 const RCP<const VectorSpaceBase<double> > &domain,
175 const RCP<Epetra_Operator> &op,
176 EOpTransp opTrans = NOTRANS,
179 );
180
189 void setFullyInitialized(bool isFullyInitialized = true);
190
198 void uninitialize(
199 RCP<Epetra_Operator> *op= NULL,
200 EOpTransp *opTrans = NULL,
201 EApplyEpetraOpAs *applyAs = NULL,
202 EAdjointEpetraOp *adjointSupport = NULL,
203 RCP<const VectorSpaceBase<double> > *range = NULL,
204 RCP<const VectorSpaceBase<double> > *domain = NULL
205 );
206
216
226
229
232
234
237
240 const Ptr<RCP<Epetra_Operator> > &epetraOp,
241 const Ptr<EOpTransp> &epetraOpTransp,
242 const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
243 const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
244 );
246 void getEpetraOpView(
247 const Ptr<RCP<const Epetra_Operator> > &epetraOp,
248 const Ptr<EOpTransp> &epetraOpTransp,
249 const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
250 const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport
251 ) const;
252
254
257
260
263
266
268
271
273 std::string description() const;
275 void describe(
276 FancyOStream &out,
277 const Teuchos::EVerbosityLevel verbLevel
278 ) const;
279
281
282protected:
283
286
288 bool opSupportedImpl(EOpTransp M_trans) const;
289
291 void applyImpl(
292 const EOpTransp M_trans,
294 const Ptr<MultiVectorBase<double> > &Y,
295 const double alpha,
296 const double beta
297 ) const;
298
300
303
305 virtual bool supportsScaleLeftImpl() const;
306
308 virtual bool supportsScaleRightImpl() const;
309
311 virtual void scaleLeftImpl(const VectorBase<double> &row_scaling);
312
314 virtual void scaleRightImpl(const VectorBase<double> &col_scaling);
315
317
320
322 virtual bool rowStatIsSupportedImpl(
323 const RowStatLinearOpBaseUtils::ERowStat rowStat) const;
324
326 virtual void getRowStatImpl(
327 const RowStatLinearOpBaseUtils::ERowStat rowStat,
328 const Ptr<VectorBase<double> > &rowStatVec) const;
329
331
334
347 const RCP<Epetra_Operator> &op,
348 EOpTransp op_trans
349 ) const;
350
363 const RCP<Epetra_Operator> &op,
364 EOpTransp op_trans
365 ) const;
366
368
369private:
370
371 // ////////////////////////////////////
372 // Private data members
373
374 bool isFullyInitialized_;
376 RCP<Epetra_RowMatrix> rowMatrix_;
377 EOpTransp opTrans_;
378 EApplyEpetraOpAs applyAs_;
379 EAdjointEpetraOp adjointSupport_;
382
383 // ////////////////////////////////////
384 // Private member functions
385
386 const Epetra_Map& getRangeMap() const;
387 const Epetra_Map& getDomainMap() const;
388
396 void computeAbsRowSum(Epetra_Vector & rowStatVec_in) const;
397
398}; // end class EpetraLinearOp
399
400
406
407
414 const RCP<const VectorSpaceBase<double> > &range,
415 const RCP<const VectorSpaceBase<double> > &domain,
416 const RCP<Epetra_Operator> &op,
417 EOpTransp opTrans = NOTRANS,
420 );
421
422
430 const RCP<Epetra_Operator> &op,
431 EOpTransp opTrans = NOTRANS,
434 const RCP< const VectorSpaceBase<double> > &range = Teuchos::null,
435 const RCP< const VectorSpaceBase<double> > &domain = Teuchos::null
436 );
437
438
447 EOpTransp opTrans = NOTRANS,
450 const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
451 const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
452 );
453
454
462 const RCP<Epetra_Operator> &op,
463 const std::string &label,
464 EOpTransp opTrans = NOTRANS,
467 const RCP<const VectorSpaceBase<double> > &range = Teuchos::null,
468 const RCP<const VectorSpaceBase<double> > &domain = Teuchos::null
469 );
470
471
480 const std::string &label,
481 EOpTransp opTrans = NOTRANS,
484 const RCP< const SpmdVectorSpaceBase<double> > &range = Teuchos::null,
485 const RCP< const SpmdVectorSpaceBase<double> > &domain = Teuchos::null
486 );
487
488
489} // end namespace Thyra
490
491
492#endif // THYRA_EPETRA_LINEAR_OP_HPP
493
494#if defined(Thyra_SHOW_DEPRECATED_WARNINGS)
495#ifdef __GNUC__
496#warning "The ThyraEpetraAdapters package is deprecated"
497#endif
498#endif
499
Abstract base class for all LinearOpBase objects that can return an Epetra_Operator view of themselve...
Concrete LinearOpBase adapter subclass for Epetra_Operator object.
RCP< const SpmdVectorSpaceBase< double > > spmdDomain() const
Return a smart pointer to the SpmdVectorSpaceBase object for the domain.
std::string description() const
virtual void scaleLeftImpl(const VectorBase< double > &row_scaling)
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< double > &X, const Ptr< MultiVectorBase< double > > &Y, const double alpha, const double beta) const
RCP< EpetraLinearOp > partialNonconstEpetraLinearOp(const RCP< const VectorSpaceBase< double > > &range, const RCP< const VectorSpaceBase< double > > &domain, const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED)
Partially initialized EpetraLinearOp.
RCP< EpetraLinearOp > nonconstEpetraLinearOp()
Default nonmember constructor.
virtual void scaleRightImpl(const VectorBase< double > &col_scaling)
void getNonconstEpetraOpView(const Ptr< RCP< Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport)
void getEpetraOpView(const Ptr< RCP< const Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport) const
void uninitialize(RCP< Epetra_Operator > *op=NULL, EOpTransp *opTrans=NULL, EApplyEpetraOpAs *applyAs=NULL, EAdjointEpetraOp *adjointSupport=NULL, RCP< const VectorSpaceBase< double > > *range=NULL, RCP< const VectorSpaceBase< double > > *domain=NULL)
Set to uninitialized and optionally return the current state.
EpetraLinearOp()
Construct to uninitialized.
virtual bool supportsScaleRightImpl() const
void setFullyInitialized(bool isFullyInitialized=true)
Set to fully initialized.
RCP< const EpetraLinearOp > epetraLinearOp(const RCP< const Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate a nonconst EpetraLinearOp to wrap a const Epetra_Operator object.
RCP< EpetraLinearOp > nonconstEpetraLinearOp(const RCP< Epetra_Operator > &op, const std::string &label, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate an const EpetraLinearOp to wrap a const Epetra_Operator object and give it a str...
virtual void getRowStatImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat, const Ptr< VectorBase< double > > &rowStatVec) const
void describe(FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual RCP< const SpmdVectorSpaceBase< double > > allocateRange(const RCP< Epetra_Operator > &op, EOpTransp op_trans) const
Allocate the range space of the operator.
RCP< EpetraLinearOp > nonconstEpetraLinearOp(const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate an const EpetraLinearOp to wrap a const Epetra_Operator object.
void initialize(const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Fully initialize.
RCP< const LinearOpBase< double > > clone() const
void partiallyInitialize(const RCP< const VectorSpaceBase< double > > &range, const RCP< const VectorSpaceBase< double > > &domain, const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED)
Partially initialize.
RCP< const SpmdVectorSpaceBase< double > > spmdRange() const
Return a smart pointer to the SpmdVectorSpaceBase object for the range.
virtual bool rowStatIsSupportedImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat) const
RCP< const EpetraLinearOp > epetraLinearOp(const RCP< const Epetra_Operator > &op, const std::string &label, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const SpmdVectorSpaceBase< double > > &range=Teuchos::null, const RCP< const SpmdVectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate a nonconst EpetraLinearOp to wrap a const Epetra_Operator object.
RCP< Epetra_Operator > epetra_op()
virtual RCP< const SpmdVectorSpaceBase< double > > allocateDomain(const RCP< Epetra_Operator > &op, EOpTransp op_trans) const
Allocate the domain space of the operator.
bool opSupportedImpl(EOpTransp M_trans) const
RCP< const VectorSpaceBase< double > > range() const
virtual bool supportsScaleLeftImpl() const
RCP< const VectorSpaceBase< double > > domain() const
Base class for all linear operators.
bool isFullyInitialized(const LinearOpBase< double > &M)
Determines if a linear operator is in the "Fully Initialized" state or not.
Interface for a collection of column vectors called a multi-vector.
Interface for exxtracting row statistics as a VectorBase from a supporting LinearOpBase object.
Applies left or right sclaing to the linear operator.
Base abstract VectorSpaceBase class for all SPMD-based vector spaces.
Abstract interface for finite-dimensional dense vectors.
Abstract interface for objects that represent a space for vectors.
EApplyEpetraOpAs
Determine how the apply an Epetra_Operator as a linear operator.
EAdjointEpetraOp
Determine if adjoints are supported on Epetra_Opeator or not.
@ EPETRA_OP_APPLY_APPLY
Apply using Epetra_Operator::Apply(...)
@ EPETRA_OP_ADJOINT_SUPPORTED
Adjoint supported.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
@ NOTRANS
Use the non-transposed operator.
T_To & dyn_cast(T_From &from)