IFPACK Development
Ifpack_DiagPreconditioner.h
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) 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 
00030 #ifndef IFPACK_DIAG_PRECONDITIONER_H
00031 #define IFPACK_DIAG_PRECONDITIONER_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Epetra_Operator.h"
00035 #include "Epetra_Vector.h"
00036 class Epetra_BlockMap;
00037 class Epetra_Map;
00038 class Epetra_MultiVector;
00039 class Epetra_Comm;
00040 
00041 using namespace std;
00042 
00044 /*
00045 Ifpack_DiagPreconditioner: a class to wrap a vector as diagonal preconditioner. The preconditioner is simply defined by
00046 \f[
00047 z_i = D_i r_i,
00048 \f]
00049 where \f$r,z\f$ are the vector to be preconditioned and the preconditioned vector, and \f$D_i\f$ is the i-th element of the scaling vector.
00050 
00051 \author Marzio Sala, ETHZ/D-INFK
00052 
00053 \date Last updated on 17-Apr-06
00054 
00055  */
00056 class Ifpack_DiagPreconditioner : public Epetra_Operator
00057 {
00058   public:
00059 
00061     Ifpack_DiagPreconditioner(const Epetra_Map& DomainMap,
00062                               const Epetra_Map& RangeMap,
00063                               const Epetra_Vector& diag);
00064 
00066     ~Ifpack_DiagPreconditioner();
00067 
00068     int SetUseTranspose(bool UseTranspose_in)
00069     {
00070       UseTranspose_ = UseTranspose_in;
00071       return(0);
00072     }
00073 
00074     int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00075 
00076     int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00077 
00078     double NormInf() const
00079     {
00080       return(-1.0);
00081     }
00082 
00083     const char* Label() const
00084     {
00085       return("Ifpack_DiagPreconditioner");
00086     }
00087 
00088     bool UseTranspose() const
00089     {
00090       return(UseTranspose_);
00091     }
00092 
00093     bool HasNormInf() const
00094     {
00095       return(false);
00096     }
00097 
00098     const Epetra_Comm& Comm() const
00099     {
00100       return(diag_.Comm());
00101     }
00102 
00103     const Epetra_Map& OperatorDomainMap() const
00104     {
00105       return(RangeMap_);
00106     }
00107 
00108     const Epetra_Map& OperatorRangeMap() const
00109     {
00110       return(DomainMap_);
00111     }
00112 
00113     const Epetra_BlockMap& Map() const
00114     {
00115       return(diag_.Map());
00116     }
00117 
00118   private:
00119     bool UseTranspose_;
00120     const Epetra_Map& DomainMap_;
00121     const Epetra_Map& RangeMap_;
00122     const Epetra_Vector& diag_;
00123 };
00124 
00125 #endif
 All Classes Files Functions Variables Enumerations Friends