Nalu
Nalu: a generalized unstructured massively parallel low Mach flow code designed to support a variety of energy applications of interest (most notably Wind ECP) built on the Sierra Toolkit and Trilinos solver Tpetra/Epetra stack. The open source BSD, clause 3 license model has been chosen for the code base. See LICENSE for more information. http://NaluCFD.org
LU.h
Go to the documentation of this file.
1 #ifndef LU_H
2 #define LU_H
3 
4 #include <stk_util/environment/ReportHandler.hpp>
5 
6 namespace sierra {
7 namespace nalu {
8 
16 class LU{
17  public:
18  LU( const int dim, const int bandwidth );
19  ~LU();
20 
21  // Writable element access
22  inline double & operator()( int row, int col ) {
23  ThrowRequire( row <= dim_ );
24  ThrowRequire( col <= dim_ );
25  isReady_ = false;
26  return AA_(row,col);
27  };
28 
29  // Read-only element access
30  inline double operator()( int row, int col ) const {
31  ThrowRequire( row <= dim_ );
32  ThrowRequire( col <= dim_ );
33  return AA_(row,col);
34  };
35 
36  // Read-only element access that works. Compiler refuses to use
37  // the overloaded const operator() when possible for some reason.
38  inline double value( int row, int col ) const {
39  ThrowRequire( row <= dim_ );
40  ThrowRequire( col <= dim_ );
41  return AA_(row,col);
42  };
43 
44  // perform the LU-factorization
45  void decompose();
46 
47  // perform back-substitution given the rhs.
48  // Over-writes the rhs with the solution vector.
49  void back_subs( double* rhs );
50 
51  void dump();
52 
53  private:
54 
55  LU(); // no default constructor.
56 
57  class SparseMatrix{
58 
59  public:
60  SparseMatrix( const int dim, const int bandwidth );
61  ~SparseMatrix();
62 
63  // Writable element access
64  inline double & operator()( int row, int col ) {
65  return AA_[row][col];
66  };
67 
68  // Read-only element access
69  inline double operator()( int row, int col ) const {
70  return AA_[row][col];
71  };
72 
73  void dump();
74 
75  private:
76  SparseMatrix();
77 
78  double **AA_;
79  const int dim_, band_;
80  };
81 
82  const int dim_;
83  bool isReady_;
85 
86 };
87 
88 } // end nalu namespace
89 } // end sierra namespace
90 
91 #endif
double ** AA_
Definition: LU.h:78
double & operator()(int row, int col)
Definition: LU.h:22
Definition: ABLForcingAlgorithm.C:26
SparseMatrix AA_
Definition: LU.h:84
bool isReady_
Definition: LU.h:83
const int band_
Definition: LU.h:79
const int dim_
Definition: LU.h:82
double & operator()(int row, int col)
Definition: LU.h:64
double value(int row, int col) const
Definition: LU.h:38
const int dim_
Definition: LU.h:79
~LU()
Definition: LU.C:21
static constexpr double rhs[8]
Definition: UnitTestContinuityAdvElem.C:18
double operator()(int row, int col) const
Definition: LU.h:30
~SparseMatrix()
Definition: LU.C:90
Supports LU-decompositon for a matrix.
Definition: LU.h:16
double operator()(int row, int col) const
Definition: LU.h:69
void decompose()
Definition: LU.C:26
void back_subs(double *rhs)
Definition: LU.C:50
void dump()
Definition: LU.C:97