Marine systems simulation
PartialLinearSolver.h
1
2#pragma once
3
4/*#include "SparseMatrixBuilder.h"
5
6namespace CoRiBoDynamics
7{
8class PartialLinearSolver{
9public:
10 explicit PartialLinearSolver(SparseMatrixBuilder* matrix){
11 m_matrix = matrix;
12 }
13 virtual ~PartialLinearSolver(){}
14 virtual void Compute() = 0;
15 virtual void Solve(const Vector& B, Vector& X) = 0; /// Solve for A*X=B. Not inherintly thread safe.
16
17 mat6* MainDiagonal(){return m_matrix->m_A_0_diagonal;}
18 mat6* FirstDiagonal(){return m_matrix->m_A_1_diagonal;}
19 std::vector<Eigen::SparseVector<mat6*> >* OffDiagonal(){return &(m_matrix->m_A_off_diagonal);}
20
21private:
22 SparseMatrixBuilder* m_matrix;
23};
24
25
26class TriDiagonalSolver: public PartialLinearSolver {
27public:
28 TriDiagonalSolver( SparseMatrixBuilder* matrix, int start, int end);
29 //TriDiagonalSolver( SparseMatrixBuilder* matrix, std::vector<int> indices);
30
31 ~TriDiagonalSolver();
32 virtual void Compute();
33
34 virtual void Solve( const Vector& B, Vector& X );
35
36protected:
37 int m_start;
38 int m_end;
39 int m_num;
40 //std::vector<int> m_ix;
41
42 mat6* m_U_1;
43 mat6* m_U_0;
44};
45
46class SupergridSolver: public PartialLinearSolver {
47public:
48 SupergridSolver( SparseMatrixBuilder* matrix, int D);
49 ~SupergridSolver();
50 virtual void Compute();
51
52 virtual void Solve( const Vector& B, Vector& X );
53
54protected:
55 int m_D;
56 int m_num;
57
58 mat6* m_A_1;
59 mat6* m_A_0;
60 std::vector<Eigen::SparseVector<mat6*> > m_A_off;
61 ObjectFactoryStack<mat6> m_mat6_Factory;
62
63 mat6* m_U_1;
64 mat6* m_U_0;
65
66 mat6* m_W_0;
67 mat6* m_W_1;
68
69 Eigen::SimplicialLDLT<SparseMat, Eigen::Upper>* m_solver;
70};
71
72
73}*/