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 // This is the class that handles slide surface reduction 10 // ************************************************************************** 11 12 #ifndef __HYPRE_SLIDEREDUCTION__ 13 #define __HYPRE_SLIDEREDUCTION__ 14 15 // ************************************************************************** 16 // system libraries used 17 // -------------------------------------------------------------------------- 18 19 #include "utilities/_hypre_utilities.h" 20 #include "IJ_mv/_hypre_IJ_mv.h" 21 #include "parcsr_mv/_hypre_parcsr_mv.h" 22 23 // ************************************************************************** 24 // class definition 25 // -------------------------------------------------------------------------- 26 27 class HYPRE_SlideReduction 28 { 29 MPI_Comm mpiComm_; 30 HYPRE_IJMatrix Amat_; 31 HYPRE_IJMatrix A21mat_; 32 HYPRE_IJMatrix invA22mat_; 33 HYPRE_IJMatrix reducedAmat_; 34 HYPRE_IJVector reducedBvec_; 35 HYPRE_IJVector reducedXvec_; 36 HYPRE_IJVector reducedRvec_; 37 int outputLevel_; 38 int *procNConstr_; 39 int *slaveEqnList_; 40 int *slaveEqnListAux_; 41 int *gSlaveEqnList_; 42 int *gSlaveEqnListAux_; 43 int *constrBlkInfo_; 44 int *constrBlkSizes_; 45 int *eqnStatuses_; 46 double blockMinNorm_; 47 HYPRE_ParCSRMatrix hypreRAP_; 48 double truncTol_; 49 double *ADiagISqrts_; 50 int scaleMatrixFlag_; 51 int useSimpleScheme_; 52 53 public: 54 55 HYPRE_SlideReduction(MPI_Comm); 56 virtual ~HYPRE_SlideReduction(); 57 int setOutputLevel(int level); 58 int setUseSimpleScheme(); 59 int setTruncationThreshold(double trunc); 60 int setScaleMatrix(); 61 int setBlockMinNorm(double norm); 62 63 int getMatrixNumRows(); 64 double *getMatrixDiagonal(); 65 int getReducedMatrix(HYPRE_IJMatrix *mat); 66 int getReducedRHSVector(HYPRE_IJVector *rhs); 67 int getReducedSolnVector(HYPRE_IJVector *sol); 68 int getReducedAuxVector(HYPRE_IJVector *auxV); 69 int getProcConstraintMap(int **map); 70 int getSlaveEqnList(int **slist); 71 int getPerturbationMatrix(HYPRE_ParCSRMatrix *matrix); 72 int setup(HYPRE_IJMatrix , HYPRE_IJVector , HYPRE_IJVector ); 73 int buildReducedSolnVector(HYPRE_IJVector x, HYPRE_IJVector b); 74 int buildModifiedSolnVector(HYPRE_IJVector x); 75 76 private: 77 78 int findConstraints(); 79 int findSlaveEqns1(); 80 int findSlaveEqnsBlock(int blkSize); 81 int composeGlobalList(); 82 int buildSubMatrices(); 83 int buildModifiedRHSVector(HYPRE_IJVector, HYPRE_IJVector); 84 int buildReducedMatrix(); 85 int buildReducedRHSVector(HYPRE_IJVector); 86 int buildA21Mat(); 87 int buildInvA22Mat(); 88 int scaleMatrixVector(); 89 double matrixCondEst(int, int, int *, int); 90 91 int findSlaveEqns2(int **couplings); 92 int buildReducedMatrix2(); 93 }; 94 95 #endif 96 97