Hex  2.2
Hydrogen-electron collision solver
lu-superlu.h
Go to the documentation of this file.
1 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2 // //
3 // / / / / __ \ \ / / //
4 // / /__ / / / _ \ \ \/ / //
5 // / ___ / | |/_/ / /\ \ //
6 // / / / / \_\ / / \ \ //
7 // //
8 // //
9 // Copyright (c) 2016, Jakub Benda, Charles University in Prague //
10 // //
11 // MIT License: //
12 // //
13 // Permission is hereby granted, free of charge, to any person obtaining a //
14 // copy of this software and associated documentation files (the "Software"), //
15 // to deal in the Software without restriction, including without limitation //
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense, //
17 // and/or sell copies of the Software, and to permit persons to whom the //
18 // Software is furnished to do so, subject to the following conditions: //
19 // //
20 // The above copyright notice and this permission notice shall be included //
21 // in all copies or substantial portions of the Software. //
22 // //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS //
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, //
27 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF //
28 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //
29 // //
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 #if (!defined(HEX_LU_SUPERLU_H) && defined(WITH_SUPERLU))
33 #define HEX_LU_SUPERLU_H
34 
35 // --------------------------------------------------------------------------------- //
36 
37 #include "hex-csrmatrix.h"
38 
39 // --------------------------------------------------------------------------------- //
40 
41 #include "luft.h"
42 
43 // --------------------------------------------------------------------------------- //
44 
45 #ifdef SINGLE
46  #include <slu_cdefs.h>
47 #else
48  #include <slu_zdefs.h>
49 #endif
50 
51 // --------------------------------------------------------------------------------- //
52 
60 class LUft_SUPERLU : public LUft
61 {
62  public:
63 
64  // run-time selection mechanism
65  factorizerRunTimeSelectionDefinitions(LUft_SUPERLU, "superlu")
66 
67 
68  LUft_SUPERLU ();
69 
71  virtual ~LUft_SUPERLU () { drop(); }
72 
73  // Disable bitwise copy
74  LUft_SUPERLU const & operator= (LUft_SUPERLU const &) = delete;
75 
77  virtual void factorize (CsrMatrix<LU_int_t,Complex> const & matrix, LUftData data);
78 
80  virtual bool valid () const;
81 
83  virtual std::size_t size () const { return size_; }
84 
86  virtual void solve (const cArrayView b, cArrayView x, int eqs) const;
87 
89  virtual void save (std::string name) const;
90 
92  virtual void load (std::string name, bool throw_on_io_failure = true);
93 
95  virtual void drop ();
96 
97  private:
98 
100  NumberArray<int_t> P_;
101  NumberArray<int_t> I_;
102  cArray X_;
103 
105  iArray perm_c_;
106 
108  iArray perm_r_;
109 
111  iArray etree_;
112 
114  char equed_;
115 
117  rArray R_;
118 
120  rArray C_;
121 
123  SuperMatrix L_;
124 
126  SuperMatrix U_;
127 
129  GlobalLU_t Glu_;
130 
132  std::size_t size_;
133 
135  Real droptol_;
136 };
137 
138 #endif // WITH_SUPERLU
virtual void factorize(CsrMatrix< LU_int_t, Complex > const &matrix, LUftData data=defaultLUftData)=0
Factorize.
virtual void solve(const cArrayView b, cArrayView x, int eqs) const =0
Solve equations.
virtual bool valid() const
Validity indicator.
Definition: luft.h:102
virtual std::size_t size() const
Size of the numerical data.
Definition: luft.h:117
LU factorization object.
Definition: luft.h:74
Definition: luft.h:42
#define factorizerRunTimeSelectionDefinitions(TYPE, NAME)
Definition: luft.h:198
virtual void drop()
Free memory.
Definition: luft.h:109
virtual void save() const
Definition: luft.h:181
virtual void load()
Definition: luft.h:187
Definition: luft.h:46