tminres
TrilinosExample/EpetraOperatorAdapter.hpp
Go to the documentation of this file.
00001 // tminres is free software; you can redistribute it and/or modify it under the
00002 // terms of the GNU Lesser General Public License (as published by the Free
00003 // Software Foundation) version 2.1 dated February 1999.
00004 //
00005 // Authors:
00006 // - Umberto Villa, Emory University - uvilla@emory.edu
00007 // - Michael Saunders, Stanford University
00008 // - Santiago Akle, Stanford University
00009 
00016 #ifndef EPETRAOPERATORADAPTER_HPP_
00017 #define EPETRAOPERATORADAPTER_HPP_
00018 
00019 #include "EpetraVectorAdapter.hpp"
00020 #include <Epetra_Operator.h>
00021 
00023 
00026 class EpetraOperatorAdapter
00027 {
00028 public:
00030 
00033         EpetraOperatorAdapter(Epetra_Operator & op_) : op(op_) { };
00034 
00036         void Apply(const EpetraVectorAdapter & X, EpetraVectorAdapter & Y) const
00037         {
00038                 int ierr(0);
00039                 ierr = op.Apply(X.EpetraVector(), Y.EpetraVector() );
00040 
00041                 assert(0 == ierr);
00042         }
00043 
00044         virtual ~EpetraOperatorAdapter(){ };
00045 
00046 private:
00047         Epetra_Operator & op;
00048 };
00049 
00051 
00054 class EpetraPreconditionerAdapter
00055 {
00056 public:
00057 
00059 
00062         EpetraPreconditionerAdapter(Epetra_Operator & prec_) : prec(prec_) { };
00063 
00065         void Apply(const EpetraVectorAdapter & X, EpetraVectorAdapter & Y) const
00066         {
00067                 int ierr(0);
00068                 ierr = prec.ApplyInverse(X.EpetraVector(), Y.EpetraVector() );
00069 
00070                 assert( 0 == ierr );
00071         }
00072 
00073         virtual ~EpetraPreconditionerAdapter(){ };
00074 
00075 private:
00076         Epetra_Operator & prec;
00077 };
00078 
00079 
00080 #endif /* EPETRAOPERATORADAPTER_HPP_ */
 All Classes Files Functions Friends