FEMTIC
ComplexSparseSquareMatrix.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_COMPLEX_SPARSE_SQUARE_MATRIX
25 #define DBLDEF_COMPLEX_SPARSE_SQUARE_MATRIX
26 
27 #include <complex>
28 
29 #include "PARDISOSolverComplex.h"
30 #include "ComplexSparseMatrix.h"
31 
33 
34 public:
35 
36  //Default Constructer
37  explicit ComplexSparseSquareMatrix();
38 
39  //Constructer
40  explicit ComplexSparseSquareMatrix( const int nEq, const int nRhs = 1 );
41 
42  //Destructer
44 
45  // Set number of rows and columns
46  virtual void setNumRowsAndColumns( const int nrows, const int ncols );
47 
48  // Set Degree of equation
49  void setDegreeOfEquation( const int nEq );
50 
52  //void setStructureByTripletFormat( const int row, const int col );
53 
55  //void convertToCRSFormat();
56 
58  //void addNonZeroValues( const int row, const int col, const std::complex<double> val );
59 
61  //void zeroClearNonZeroValues();
62 
64  //void addRightHandSideVector( const int row, const std::complex<double> val, const int irhs = 0 );
65 
67  //void zeroClearRightHandSideVector();
68 
69  //Initialize matrix and right-hand side vectors
70  void initializeMatrixAndRhsVectors( const int nEq, const int nRhs );
71 
72  //Initialize matrix solver
73  virtual void initializeMatrixSolver( const std::string& oocHeaderName, const int imode ) = 0;
74 
75  //Anaysis phase of matrix solver
77 
78  //Numerical factorization phase of matrix solver
80 
81  //Solve phase of matrix solver with a specified number of right-hand side
82  void solvePhaseMatrixSolver( std::complex<double>* solution, const long long iRhsStart ,const int nRhs );
83 
84  //Solve phase of matrix solver
85  void solvePhaseMatrixSolver( std::complex<double>* solution );
86 
87  //Release memory of matrix solver
89 
90  //Get memory required by matrix solver
92 
93  //Release memory
94  virtual void releaseMemory();
95 
96  //Get Degree of equation
97  int getDegreeOfEquation() const;
98 
100  //int getNumRightHandSideVectors() const;
101 
103  //bool hasConvertedToCRSFormat() const;
104 
106  //void reallocateMemoryForRightHandSideVectors( const int nrhs );
107 
109  //void setNumRightHandSideVectors( const int nrhs );
110 
112  //void multiplyMatrixByVectorAndAddResult( const std::complex<double>* vecIn, const int* convertArray, std::complex<double>* vecOut ) const;
113 
115  //void multiplyMatrixByVectorAndSubtractResult( const std::complex<double>* vecIn, const int* convertArray, std::complex<double>* vecOut ) const;
116 
119 
121  //void debugWriteMatrix() const;
122 
124  //void debugWriteRightHandSide() const;
125 
126 protected:
127  //PARDISO solver
129 
130 private:
131  //Copy constructer
133 
134  // Assignment operator
136 
138  //void deleteTripletMatrix();
139 
141  //int m_numEquations;
142 
144  //int m_numNonZeros;
145 
147  //int m_numRightHandSideVectors;
148 
155 
157  //std::set<int>* m_matrixTripletFormat;
158 
160  //bool m_hasConvertedToCRSFormat;
161 
163  //int* m_rowIndex;
164 
166  //int* m_columns;
167 
169  //std::complex<double>* m_values;
170 
172  //std::complex<double>* m_rightHandSideVector;
173 
174 };
175 
176 #endif
Definition: ComplexSparseMatrix.h:31
Definition: ComplexSparseSquareMatrix.h:32
ComplexSparseSquareMatrix & operator=(const ComplexSparseSquareMatrix &rhs)
Definition: ComplexSparseSquareMatrix.cpp:506
virtual void releaseMemory()
Definition: ComplexSparseSquareMatrix.cpp:373
void setDegreeOfEquation(const int nEq)
Definition: ComplexSparseSquareMatrix.cpp:78
void releaseMemoryMatrixSolver()
Definition: ComplexSparseSquareMatrix.cpp:359
void writeMemoryRequiredByMatrixSolver()
Definition: ComplexSparseSquareMatrix.cpp:368
void analysisPhaseMatrixSolver()
Definition: ComplexSparseSquareMatrix.cpp:308
PARDISOSolverComplex m_pardisoSolver
Definition: ComplexSparseSquareMatrix.h:128
void solvePhaseMatrixSolver(std::complex< double > *solution, const long long iRhsStart, const int nRhs)
Definition: ComplexSparseSquareMatrix.cpp:336
virtual void setNumRowsAndColumns(const int nrows, const int ncols)
Definition: ComplexSparseSquareMatrix.cpp:64
virtual void initializeMatrixSolver(const std::string &oocHeaderName, const int imode)=0
void initializeMatrixAndRhsVectors(const int nEq, const int nRhs)
Definition: ComplexSparseSquareMatrix.cpp:279
virtual ~ComplexSparseSquareMatrix()
Definition: ComplexSparseSquareMatrix.cpp:55
int getDegreeOfEquation() const
Definition: ComplexSparseSquareMatrix.cpp:383
void factorizationPhaseMatrixSolver()
Definition: ComplexSparseSquareMatrix.cpp:322
ComplexSparseSquareMatrix()
Definition: ComplexSparseSquareMatrix.cpp:32
Definition: PARDISOSolverComplex.h:31