Jet  v1.3.3
fdm_jacobi_solver3.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_FDM_JACOBI_SOLVER3_H_
8 #define INCLUDE_JET_FDM_JACOBI_SOLVER3_H_
9 
11 
12 namespace jet {
13 
16  public:
19  unsigned int residualCheckInterval, double tolerance);
20 
22  bool solve(FdmLinearSystem3* system) override;
23 
26 
28  unsigned int maxNumberOfIterations() const;
29 
31  unsigned int lastNumberOfIterations() const;
32 
34  double tolerance() const;
35 
37  double lastResidual() const;
38 
40  static void relax(const FdmMatrix3& A, const FdmVector3& b, FdmVector3* x,
41  FdmVector3* xTemp);
42 
44  static void relax(const MatrixCsrD& A, const VectorND& b, VectorND* x,
45  VectorND* xTemp);
46 
47  private:
48  unsigned int _maxNumberOfIterations;
49  unsigned int _lastNumberOfIterations;
50  unsigned int _residualCheckInterval;
51  double _tolerance;
52  double _lastResidual;
53 
54  // Uncompressed vectors
55  FdmVector3 _xTemp;
56  FdmVector3 _residual;
57 
58  // Compressed vectors
59  VectorND _xTempComp;
60  VectorND _residualComp;
61 
62  void clearUncompressedVectors();
63  void clearCompressedVectors();
64 };
65 
67 typedef std::shared_ptr<FdmJacobiSolver3> FdmJacobiSolver3Ptr;
68 
69 } // namespace jet
70 
71 #endif // INCLUDE_JET_FDM_JACOBI_SOLVER3_H_
jet::VectorN< double >
jet::FdmJacobiSolver3::relax
static void relax(const MatrixCsrD &A, const VectorND &b, VectorND *x, VectorND *xTemp)
Performs single Jacobi relaxation step for compressed sys.
jet::FdmJacobiSolver3::lastNumberOfIterations
unsigned int lastNumberOfIterations() const
Returns the last number of Jacobi iterations the solver made.
jet::FdmJacobiSolver3Ptr
std::shared_ptr< FdmJacobiSolver3 > FdmJacobiSolver3Ptr
Shared pointer type for the FdmJacobiSolver3.
Definition: fdm_jacobi_solver3.h:67
jet::FdmJacobiSolver3::FdmJacobiSolver3
FdmJacobiSolver3(unsigned int maxNumberOfIterations, unsigned int residualCheckInterval, double tolerance)
Constructs the solver with given parameters.
jet::FdmJacobiSolver3::relax
static void relax(const FdmMatrix3 &A, const FdmVector3 &b, FdmVector3 *x, FdmVector3 *xTemp)
Performs single Jacobi relaxation step.
jet::MatrixCsr< double >
jet::FdmJacobiSolver3::solve
bool solve(FdmLinearSystem3 *system) override
Solves the given linear system.
jet
Definition: advection_solver2.h:18
jet::FdmLinearSystemSolver3
Abstract base class for 3-D finite difference-type linear system solver.
Definition: fdm_linear_system_solver3.h:17
jet::FdmCompressedLinearSystem3
Compressed linear system (Ax=b) for 3-D finite differencing.
Definition: fdm_linear_system3.h:57
jet::FdmLinearSystem3
Linear system (Ax=b) for 3-D finite differencing.
Definition: fdm_linear_system3.h:39
jet::FdmJacobiSolver3::lastResidual
double lastResidual() const
Returns the last residual after the Jacobi iterations.
fdm_linear_system_solver3.h
jet::FdmJacobiSolver3::solveCompressed
bool solveCompressed(FdmCompressedLinearSystem3 *system) override
Solves the given compressed linear system.
jet::FdmJacobiSolver3::maxNumberOfIterations
unsigned int maxNumberOfIterations() const
Returns the max number of Jacobi iterations.
jet::Array< T, 3 >
3-D array class.
Definition: array3.h:43
jet::FdmJacobiSolver3::tolerance
double tolerance() const
Returns the max residual tolerance for the Jacobi method.
jet::FdmJacobiSolver3
3-D finite difference-type linear system solver using Jacobi method.
Definition: fdm_jacobi_solver3.h:15