EPANET  3.0
EPANET Development Project
matrixsolver.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 MATRIXSOLVER_H_
12 #define MATRIXSOLVER_H_
13 
14 #include <string>
15 #include <ostream>
16 
26 
28 {
29  public:
30 
31  MatrixSolver();
32  virtual ~MatrixSolver();
33  static MatrixSolver* factory(const std::string solver, std::ostream& logger);
34 
35  virtual int init(int nRows, int nOffDiags, int offDiagRow[], int offDiagCol[])= 0;
36  virtual void reset() = 0;
37 
38  virtual double getDiag(int i) {return 0.0;}
39  virtual double getOffDiag(int i) {return 0.0;}
40  virtual double getRhs(int i) {return 0.0;}
41 
42  virtual void setDiag(int row, double a) = 0;
43  virtual void setRhs(int row, double b) = 0;
44  virtual void addToDiag(int row, double a) = 0;
45  virtual void addToOffDiag(int offDiag, double a) = 0;
46  virtual void addToRhs(int row, double b) = 0;
47  virtual int solve(int nRows, double x[]) = 0;
48 
49  virtual void debug(std::ostream& out) {}
50 };
51 
52 #endif
Abstract class for solving a set of linear equations.
Definition: matrixsolver.h:27