1 /******************************************************************************
2  * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
3  * HYPRE Project Developers. See the top-level COPYRIGHT file for details.
4  *
5  * SPDX-License-Identifier: (Apache-2.0 OR MIT)
6  ******************************************************************************/
7 
8 /******************************************************************************
9  *
10  * Header info for the Ruge Stuben AMG data structure
11  *
12  *****************************************************************************/
13 
14 #ifndef __MLIMETHODAMGRSH__
15 #define __MLIMETHODAMGRSH__
16 
17 #include "_hypre_utilities.h"
18 #include "_hypre_parcsr_mv.h"
19 #include "mli.h"
20 #include "mli_matrix.h"
21 #include "mli_method.h"
22 
23 #define MLI_METHOD_AMGRS_CLJP    0
24 #define MLI_METHOD_AMGRS_RUGE    1
25 #define MLI_METHOD_AMGRS_FALGOUT 2
26 #define MLI_METHOD_AMGRS_CR      3
27 
28 /* ***********************************************************************
29  * definition of the classical Ruge Stuben AMG data structure
30  * ----------------------------------------------------------------------*/
31 
32 class MLI_Method_AMGRS : public MLI_Method
33 {
34    int      maxLevels_;              /* the finest level is 0            */
35    int      numLevels_;              /* number of levels requested       */
36    int      currLevel_;              /* current level being processed    */
37    int      outputLevel_;            /* for diagnostics                  */
38    int      coarsenScheme_;          /* coarsening scheme                */
39    int      measureType_;            /* local or local measure           */
40    double   threshold_;              /* strength threshold               */
41    double   truncFactor_;            /* truncation factor                */
42    int      mxelmtsP_;               /* max no. of elmts per row for P   */
43    int      nodeDOF_;                /* equation block size (fixed)      */
44    int      minCoarseSize_;          /* tell when to stop coarsening     */
45    double   maxRowSum_;              /* used in Boomeramg                */
46    int      symmetric_;              /* symmetric or nonsymmetric amg    */
47    int      useInjectionForR_;       /* how R is to be constructed       */
48    char     smoother_[20];           /* denote which pre-smoother to use */
49    int      smootherNSweeps_;        /* number of pre-smoother sweeps    */
50    double   *smootherWeights_;       /* number of postsmoother sweeps    */
51    int      smootherPrintRNorm_;     /* tell smoother to print rnorm     */
52    int      smootherFindOmega_;      /* tell smoother to find omega      */
53    char     coarseSolver_[20];       /* denote which coarse solver to use*/
54    int      coarseSolverNSweeps_;    /* number of coarse solver sweeps   */
55    double   *coarseSolverWeights_;   /* weight used in coarse solver     */
56    double   RAPTime_;
57    double   totalTime_;
58 
59 public :
60 
61    MLI_Method_AMGRS( MPI_Comm comm );
62    ~MLI_Method_AMGRS();
63    int    setup( MLI *mli );
64    int    setParams(char *name, int argc, char *argv[]);
65 
66    int    setOutputLevel( int outputLevel );
67    int    setNumLevels( int nlevels );
68    int    setCoarsenScheme( int scheme );
69    int    setMeasureType( int measure );
70    int    setStrengthThreshold( double thresh );
71    int    setMinCoarseSize( int minSize );
72    int    setNodeDOF( int dof );
73    int    setSmoother( char *stype, int num, double *wgt );
74    int    setCoarseSolver( char *stype, int num, double *wgt );
75    int    print();
76    int    printStatistics(MLI *mli);
77    MLI_Matrix *performCR(MLI_Matrix *, int *, MLI_Matrix **,int,
78                          hypre_ParCSRMatrix *);
79    MLI_Matrix *createPmat(int *, MLI_Matrix *, MLI_Matrix *, MLI_Matrix *);
80 };
81 
82 #endif
83 
84