src/eigsolv/BlockPCGSolver.h

Go to the documentation of this file.
00001 //**************************************************************************
00002 //
00003 //                                 NOTICE
00004 //
00005 // This software is a result of the research described in the report
00006 //
00007 // " A comparison of algorithms for modal analysis in the absence 
00008 //   of a sparse direct method", P. Arbenz, R. Lehoucq, and U. Hetmaniuk,
00009 //  Sandia National Laboratories, Technical report SAND2003-1028J.
00010 //
00011 // It is based on the Epetra, AztecOO, and ML packages defined in the Trilinos
00012 // framework ( http://software.sandia.gov/trilinos/ ).
00013 //
00014 // The distribution of this software follows also the rules defined in Trilinos.
00015 // This notice shall be marked on any reproduction of this software, in whole or
00016 // in part.
00017 //
00018 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00019 // license for use of this work by or on behalf of the U.S. Government.
00020 //
00021 // This program is distributed in the hope that it will be useful, but
00022 // WITHOUT ANY WARRANTY; without even the implied warranty of
00023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00024 //
00025 // Code Authors: U. Hetmaniuk (ulhetma@sandia.gov), R. Lehoucq (rblehou@sandia.gov)
00026 //
00027 //**************************************************************************
00028 
00029 #ifndef BLOCK_PCG_SOLVER_H
00030 #define BLOCK_PCG_SOLVER_H
00031 
00032 #include "Epetra_ConfigDefs.h"
00033 
00034 #include "AztecOO.h"
00035 
00036 #include "ml_include.h"
00037 #include "ml_epetra_operator.h"
00038 #include "ml_epetra_utils.h"
00039 
00040 #include "Epetra_BLAS.h"
00041 #include "Epetra_Comm.h"
00042 #include "Epetra_LAPACK.h"
00043 #include "Epetra_Map.h"
00044 #include "Epetra_MultiVector.h"
00045 #include "Epetra_Operator.h"
00046 #include "Epetra_RowMatrix.h"
00047 
00048 #include "FortranRoutines.h"
00049 
00050 
00051 class BlockPCGSolver : public virtual Epetra_Operator {
00052 
00053 private:
00054 
00055     const Epetra_Comm &MyComm;
00056     const Epetra_BLAS callBLAS;
00057     const Epetra_LAPACK callLAPACK;
00058     const FortranRoutines callFortran;
00059 
00060     const Epetra_Operator *K;
00061     Epetra_Operator *Prec;
00062 
00063     bool mlPrec;
00064     ML *ml_handle;
00065     ML_Aggregate *ml_agg;
00066 
00067     mutable AztecOO *vectorPCG;
00068 
00069     double tolCG;
00070     int iterMax;
00071 
00072     int verbose;
00073 
00074     int AMG_NLevels;
00075 
00076     mutable double *workSpace;
00077 
00078     mutable int numSolve;
00079     mutable int maxIter;
00080     mutable int sumIter; 
00081     mutable int minIter;
00082 
00083     // Don't define these functions
00084     BlockPCGSolver(const BlockPCGSolver &ref);
00085     BlockPCGSolver& operator=(const BlockPCGSolver &ref);
00086 
00087 public:
00088 
00089     BlockPCGSolver(const Epetra_Comm& _Com, const Epetra_Operator *KK,
00090                    double _tol = 0.0, int _iMax = 0, int _verb = 0);
00091 
00092     BlockPCGSolver(const Epetra_Comm& _Com, const Epetra_Operator *KK,
00093                    Epetra_Operator *PP, 
00094                    double _tol = 0.0, int _iMax = 0, int _verb = 0);
00095 
00096     ~BlockPCGSolver();
00097 
00098     const char * Label() const { return "Epetra_Operator for Block PCG solver"; };
00099 
00100     bool UseTranspose() const { return (false); };
00101     int SetUseTranspose(bool UseTranspose) { return 0; };
00102 
00103     bool HasNormInf() const { return (false); };
00104     double NormInf() const  { return (-1.0); };
00105 
00106     int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const;
00107     int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const;
00108 
00109     const Epetra_Comm& Comm() const { return MyComm; };
00110 
00111     const Epetra_Map& OperatorDomainMap() const { return K->OperatorDomainMap(); };
00112     const Epetra_Map& OperatorRangeMap() const { return K->OperatorRangeMap(); };
00113 
00114     int Solve(const Epetra_MultiVector &X, Epetra_MultiVector &Y, int blkSize) const;
00115 
00116     const Epetra_Operator* getPreconditioner() const { return Prec; };
00117     void setPreconditioner(Epetra_Operator *PP);
00118 
00119     void setAMGPreconditioner(int smoother = 1, int degree = 2, int numDofs = 1, 
00120                               const Epetra_MultiVector *Z = 0);
00121     int getAMG_NLevels() const { return AMG_NLevels; };
00122 
00123     void setIterMax(int _iMax) { iterMax = (_iMax > 0) ? _iMax : 0; };
00124 
00125     int getMaxIter() const { return maxIter; };
00126     double getAvgIter() const { return sumIter/((double) numSolve); };
00127     int getMinIter() const { return minIter; };
00128 
00129 };
00130 
00131 #endif

Generated on Fri Oct 26 13:35:11 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7