EPANET  3.0
EPANET Development Project
sparspaksolver.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Licensed under the terms of the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef SPARSPAKSOLVER_H_
12 #define SPARSPAKSOLVER_H_
13 
14 #include "matrixsolver.h"
15 
24 
26 {
27  public:
28 
29  // Constructor/Destructor
30 
31  SparspakSolver(std::ostream& logger);
32  ~SparspakSolver();
33 
34  // Methods
35 
36  int init(int nrows, int nnz, int* xrow, int* xcol);
37  void reset();
38 
39  double getDiag(int i);
40  double getOffDiag(int i);
41  double getRhs(int i);
42 
43  void setDiag(int i, double a);
44  void setRhs(int i, double b);
45  void addToDiag(int i, double a);
46  void addToOffDiag(int j, double a);
47  void addToRhs(int i, double b);
48  int solve(int n, double x[]);
49 
50  private:
51 
52  int nrows; // number of rows in system Ax = b
53  int nnz; // number of non-zero off-diag. coeffs. in A
54  int nnzl; // number of non-zero off-diag. coeffs. in factorized matrix L
55  int* perm; // permutation of rows in A
56  int* invp; // inverse row permutation
57  int* xlnz; // index vector for non-zero entries in L
58  int* xnzsub; // index vector for entries of nzsub
59  int* nzsub; // column indexes for non-zero entries in each row of L
60  int* xaij; // maps off-diag. coeffs. of A to lnz
61  int* link; // work array
62  int* first; // work array
63  double* lnz; // off-diag. coeffs. of factorized matrix L
64  double* diag; // diagonal coeffs. of A
65  double* rhs; // right hand side vector
66  double* temp; // work array
67  std::ostream& msgLog;
68 };
69 
70 #endif
Abstract class for solving a set of linear equations.
Definition: matrixsolver.h:27
Description of the MatrixSolver class.
Solves Ax = b using the SPARSPAK routines.
Definition: sparspaksolver.h:25