ParMooN
 All Classes Functions Variables Friends Pages
ParDirectSolver.h
1 // =======================================================================
2 // @(#)ParDirectSolver.h
3 //
4 // Class: TParDirectSolver
5 // Purpose: Class for interfacing ParMooN with MumpsSolver
6 //
7 // Author: Sashikumaar Ganesan & Abdus Shamim (27.04.15)
8 //
9 // History: Start of implementation 27.04.15 (Sashikumaar Ganesan & Abdus Shamim)
10 //
11 // =======================================================================
12 #ifdef _MPI
13 #include "mpi.h"
14 #include <SquareStructure3D.h>
15 #include <SquareMatrix3D.h>
16 #include <ParFECommunicator3D.h>
17 
18 #include <MumpsSolver.h>
19 
20 #ifndef __DIRECTSOLVER_MUMPS__
21 #define __DIRECTSOLVER_MUMPS__
22 
24 {
25 protected:
26  TParFECommunicator3D *ParComm;
27 
28  TParFECommunicator3D *ParComm_P;
29 
30  MPI_Comm Comm;
31 
32  TMumpsSolver *Mumps;
33 
34  //problem type: NSE 0, SCALAR 100
35  int SystemType;
36 
37  //Select ParDirectSolver type
38  int DSType;
39 
40  int NSEType;
41 
42  //Mumps Solver Parameters
43  int N_Master, NDof;
44  int N_Master_U, N_Master_P, NDof_U, NDof_P;
45 
46  //row ptr and col ptr of system matrix
47  int *RowPtr, *KCol, *RowPtr_global;
48  int *RowPtr_B, *KCol_B, *RowPtr_BT, *KCol_BT;
49 
50  // number of non zeroes in system matrix
51  int N_Nz, N_Nz_global;
52  int N_Nz_U, N_Nz_P;
53 
54  // number of global degrees of freedom over all ranks
55  int N_Eqns;
56 
57  // number of rhs, OwnRhs(only master dofs)
58  int N_rhs;
59  double *OwnRhs;
60  int Global_N_DOF_U;
61  double *GlobalRhs,*GlobalSol;
62  int GlobalRhsSize;
63 
64  //(I,J) for MUMPS input
65  int *I_rn, *J_cn;
66 
67  //SqMatrix
68  TSquareMatrix3D *Mat;
69  TMatrix3D *MatB, *MatBT;
70 
71  //for NSTYPE 4
72  TSquareMatrix3D *MatA11,*MatA12,*MatA13,
73  *MatA21,*MatA22,*MatA23,
74  *MatA31,*MatA32,*MatA33;
75 
76  TMatrix3D *MatB1, *MatB2, *MatB3,
77  *MatBT1,*MatBT2,*MatBT3;
78 
79  //MatLoc is the system matrix entry values(only master rows)
80  double *MatLoc;
81 
82  double *MatGlobal;
83 
84  int *all_Nnz;
85 
86  int offset;
87 
88 public:
89 
91 
93 
94  void AssembleMatrix();
95 
96  void AssembleMatrix_NSE2();
97 
98  void AssembleMatrix_NSE4();
99 
100  void InitMumps_Scalar();
101 
102  void InitMumps_NSE2();
103 
104  void InitMumps_NSE4();
105 
106  void InitPardiso();
107 
108  void GetRhs(double *Rhs);
109 
110  void UpdateSol(double *Sol);
111 
112  void Solve(double *Sol, double *Rhs, bool Factorize);
113 
114  void InitPardiso_test();
115 };
116 
117 #endif
118 #else
119 
120 //------------------------------------------------------------------------------------------------------//
121 #ifdef _OMPONLY
122 #include <SquareStructure3D.h>
123 #include <SquareMatrix3D.h>
124 #include <ParDiso.h>
125 
126 #ifndef __DIRECTSOLVER_MUMPS__
127 #define __DIRECTSOLVER_MUMPS__
128 
129 class TParDirectSolver
130 {
131 protected:
132  TParDiso *ParDiso;
133 
134  //Select ParDirectSolver type
135  int DSType;
136 
137  //Pardiso Solver Parameters
138  int NDof;
139 
140  //row ptr and col ptr of system matrix
141  int *RowPtr, *KCol;
142 
143  // number of non zeroes in system matrix
144  int N_Nz;
145 
146  // number of global degrees of freedom over all ranks
147  int N_Eqns;
148 
149  // number of rhs, OwnRhs(only master dofs)
150  int N_rhs;
151 
152  //SqMatrix
153  TSquareMatrix3D *Mat;
154 
155  //MatLoc is the system matrix entry values(only master rows)
156  double *Mat_Values;
157 
158 public:
160 
161  ~TParDirectSolver();
162 
163  void AssembleMatrix(TSquareMatrix3D *matrix);
164 
165  void InitPardiso();
166 
167  void Solve(double *Sol, double *Rhs, bool Factorize);
168 
169 };
170 
171 #endif
172 #endif
173 #endif
void InitMumps_NSE4()
Definition: ParDirectSolver.C:416
Definition: SquareMatrix3D.h:20
void InitMumps_NSE2()
Definition: ParDirectSolver.C:218
Definition: Matrix3D.h:20
Definition: ParDiso.h:25
Definition: ParFECommunicator3D.h:25
Definition: ParDirectSolver.h:23