NeoPZ
TPZPardisoControl.h
Go to the documentation of this file.
1 //
2 // TPZPardisoControl.hpp
3 // PZ
4 //
5 // Created by Philippe Devloo on 5/5/16.
6 //
7 //
8 
9 #ifndef TPZPardisoControl_hpp
10 #define TPZPardisoControl_hpp
11 
12 #include "pz_config.h"
13 
14 #ifdef USING_MKL
15 
16 #include <stdio.h>
17 
18 //#include "mkl_pardiso.h"
19 #include "pzmanvector.h"
20 #include "tpzautopointer.h"
21 #include "pzfmatrix.h"
22 template<class TVar>
23 class TPZSYsmpMatrix;
24 
25 template<class TVar>
26 class TPZFYsmpMatrix;
27 
29 // inspired by PardisoSolver by Armando Duarte
30 template<class TVar>
31 class TPZPardisoControl
32 {
33 public:
34  enum MSystemType {ESymmetric, EHermitian, ENonSymmetric};
35 
36  enum MStructure {EStructureSymmetric, EStructureNonSymmetric};
37 
38  enum MProperty {EPositiveDefinite, EIndefinite};
39 
41  TPZPardisoControl();
42 
43 public:
45  TPZPardisoControl(MSystemType systemtype, MProperty prop);
46 
47  TPZPardisoControl(const TPZPardisoControl &copy);
48 
49  TPZPardisoControl &operator=(const TPZPardisoControl &copy);
50 
51  virtual ~TPZPardisoControl();
52 
54  // this method should only be called if the pardiso control is zero (non initialized)
55  void SetMatrixType(MSystemType systemtype, MProperty prop);
56 
58  void SetMatrix(TPZFYsmpMatrix<TVar> *matrix)
59  {
60  fNonSymmetricSystem = matrix;
61  }
62 
64  void SetMatrix(TPZSYsmpMatrix<TVar> *matrix)
65  {
66  fSymmetricSystem = matrix;
67  }
68 
70  void Decompose();
71 
73  void Solve(TPZFMatrix<TVar> &rhs, TPZFMatrix<TVar> &sol) const;
74 
75 protected:
76 
77  MSystemType fSystemType;
78 
79  MStructure fStructure;
80 
81  MProperty fProperty;
82 
83  // Solver internal data address pointers
84  // 32-bit: int pt[64]; 64-bit: long long pt[64]
85  // or void *pt[64] should be OK on both architectures
86  // this datastructure should not be copied or duplicated, therefore the "autopointer" protection
87 
89 
90  // adress of the first element of pt;
91  long long *fHandle;
92 
93  // Array used to pass parameters to Pardiso
95 
96  // Maximum number of factors we will pass to the solver
97  long long fMax_num_factors;
98 
99  // Factor number we are using
100  long long fMatrix_num;
101 
102  // Message level information
103  long long fMessageLevel;
104 
105  // error flag from Pardiso
106  long long fError;
107 
109  TPZVec<long long> fPermutation;
110 
111  // matrix type, computed based on the structural information and TVar
112  long long fMatrixType;
113 
115  long long MatrixType();
116 
118  TPZFYsmpMatrix<TVar> *fNonSymmetricSystem;
119 
121  TPZSYsmpMatrix<TVar> *fSymmetricSystem;
122 
124  void Error_check(int error) const;
125 
126 };
127 
128 #endif
129 #endif /* TPZPardisoControl_hpp */
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
Implements a non symmetric sparse matrix (Yale Sparse Matrix Storage). Matrix.
Definition: pzysmp.h:45
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
TPZSkylMatrix< REAL > matrix
Definition: numatst.cpp:255
void error(char *string)
Definition: testShape.cc:7
Contains TPZMatrixclass which implements full matrix (using column major representation).
Free store vector implementation.
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
Implements a symmetric sparse matrix. Matrix.
Definition: pzsysmp.h:22
This class implements a reference counter mechanism to administer a dynamically allocated object...