Debian Codegraph @

3rdparty/dissection/src/Driver/TridiagQueue.hpp

raw
1 /*! \file TridiagQueue.hpp
2 \brief task mangemanet of tridiagonal factorization algorithm
3 \author Atsushi Suzuki, Laboratoire Jacques-Louis Lions
4 \date Jun. 20th 2014
5 \date Jul. 12th 2015
6 \date Nov. 30th 2016
7 */
8
9 // This file is part of Dissection
10 //
11 // Dissection is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // Linking Dissection statically or dynamically with other modules is making
17 // a combined work based on Disssection. Thus, the terms and conditions of
18 // the GNU General Public License cover the whole combination.
19 //
20 // As a special exception, the copyright holders of Dissection give you
21 // permission to combine Dissection program with free software programs or
22 // libraries that are released under the GNU LGPL and with independent modules
23 // that communicate with Dissection solely through the Dissection-fortran
24 // interface. You may copy and distribute such a system following the terms of
25 // the GNU GPL for Dissection and the licenses of the other code concerned,
26 // provided that you include the source code of that other code when and as
27 // the GNU GPL requires distribution of source code and provided that you do
28 // not modify the Dissection-fortran interface.
29 //
30 // Note that people who make modified versions of Dissection are not obligated
31 // to grant this special exception for their modified versions; it is their
32 // choice whether to do so. The GNU General Public License gives permission to
33 // release a modified version without this exception; this exception also makes
34 // it possible to release a modified version which carries forward this
35 // exception. If you modify the Dissection-fortran interface, this exception
36 // does not apply to your modified version of Dissection, and you must remove
37 // this exception when you distribute your modified version.
38 //
39 // This exception is an additional permission under section 7 of the GNU
40 // General Public License, version 3 ("GPLv3")
41 //
42 // Dissection is distributed in the hope that it will be useful,
43 // but WITHOUT ANY WARRANTY; without even the implied warranty of
44 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 // GNU General Public License for more details.
46 //
47 // You should have received a copy of the GNU General Public License
48 // along with Dissection. If not, see <http://www.gnu.org/licenses/>.
49 //
50
51 # ifndef _DRIVER_TRIDIAGQUEUE_
52 # define _DRIVER_TRIDIAGQUEUE_
53 #include <complex>
54 #include <vector>
55 #include "Driver/C_threads_tasks.hpp"
56 // #include "Driver/TridiagMatrix.hpp"
57
58 using std::vector;
59
60 template<typename T, typename U = T>
61 class TridiagQueue
62 {
63 public:
64 TridiagQueue(bool tridiag_solver, bool verbose, FILE *fp) :
65 _tridiag_solver(tridiag_solver), _verbose(verbose), _fp(fp)
66 {
67 _allocated = false;
68 }
69
70 void generate_queue(TridiagBlockMatrix<T, U> *tridiag,
71 const int dim,
72 const int nnz,
73 const bool isMapped,
74 int *remap_eqn,
75 int *ptUnsymRows,
76 int *indUnsymCol,
77 int *indVals,
78 T *coef);
79
80 void exec_symb_fact();
81
82 void generate_queue_fwbw();
83
84 void exec_num_fact(const int called,
85 const double eps_pivot,
86 const bool kernel_detection_all,
87 const int aug_dim,
88 const U eps_machine,
89 const bool higher_precision = false);
90
91 void exec_fwbw(T *x, const int nrhs, bool isTrans);
92
93 bool tridiagSolver() {
94 return _tridiag_solver;
95 }
96
97 ~TridiagQueue() {
98 if (_allocated) {
99 delete [] _remap_eqn;
100 delete [] _ptRows;
101 delete [] _indCols;
102 delete [] _indVals;
103 }
104 }
105
106 bool tridiag_solver() const { return _tridiag_solver; }
107 bool isMapped() const {return _isMapped; }
108 int dimension() const {return _dim; }
109 int nnz() const {return _nnz; }
110 int *remap_eqn() {return _remap_eqn; }
111 int *ptRows() { return _ptRows; }
112 int *indCols() { return _indCols; }
113 int *indVals() { return _indVals; }
114
115 private:
116 bool _tridiag_solver;
117 TridiagBlockMatrix<T, U> *_tridiag;
118 bool _isMapped;
119 int _dim;
120 int _nnz;
121 int *_remap_eqn;
122 int *_ptRows;
123 int *_indCols;
124 int *_indVals;
125 T *_coef;
126 bool _verbose;
127 FILE *_fp;
128 bool _allocated;
129 };
130
131 #endif