0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / FEmTool / FEmTool_ProfileMatrix.hxx
1 // Created on: 1997-10-29
2 // Created by: Roman BORISOV
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _FEmTool_ProfileMatrix_HeaderFile
18 #define _FEmTool_ProfileMatrix_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TColStd_Array2OfInteger.hxx>
24 #include <TColStd_HArray1OfReal.hxx>
25 #include <TColStd_HArray1OfInteger.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <FEmTool_SparseMatrix.hxx>
28 #include <TColStd_Array1OfInteger.hxx>
29 #include <Standard_Real.hxx>
30 #include <Standard_Integer.hxx>
31 #include <math_Vector.hxx>
32 class StdFail_NotDone;
33 class Standard_NotImplemented;
34 class Standard_OutOfRange;
35
36
37 class FEmTool_ProfileMatrix;
38 DEFINE_STANDARD_HANDLE(FEmTool_ProfileMatrix, FEmTool_SparseMatrix)
39
40 //! Symmetric Sparse ProfileMatrix useful  for 1D Finite
41 //! Element methods
42 class FEmTool_ProfileMatrix : public FEmTool_SparseMatrix
43 {
44
45 public:
46
47   
48   Standard_EXPORT FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& FirstIndexes);
49   
50   Standard_EXPORT void Init (const Standard_Real Value) Standard_OVERRIDE;
51   
52   Standard_EXPORT Standard_Real& ChangeValue (const Standard_Integer I, const Standard_Integer J) Standard_OVERRIDE;
53   
54   //! To make a Factorization of <me>
55   Standard_EXPORT Standard_Boolean Decompose() Standard_OVERRIDE;
56   
57   //! Direct Solve of AX = B
58   Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X) const Standard_OVERRIDE;
59   
60   //! Make Preparation to iterative solve
61   Standard_EXPORT Standard_Boolean Prepare() Standard_OVERRIDE;
62   
63   //! Iterative solve  of AX = B
64   Standard_EXPORT void Solve (const math_Vector& B, const math_Vector& Init, math_Vector& X, math_Vector& Residual, const Standard_Real Tolerance = 1.0e-8, const Standard_Integer NbIterations = 50) const Standard_OVERRIDE;
65   
66   //! returns the product of a SparseMatrix by a vector.
67   //! An exception is raised if the dimensions are different
68   Standard_EXPORT void Multiplied (const math_Vector& X, math_Vector& MX) const Standard_OVERRIDE;
69   
70   //! returns the row range of a matrix.
71   Standard_EXPORT Standard_Integer RowNumber() const Standard_OVERRIDE;
72   
73   //! returns the column range of the matrix.
74   Standard_EXPORT Standard_Integer ColNumber() const Standard_OVERRIDE;
75   
76   Standard_EXPORT Standard_Boolean IsInProfile (const Standard_Integer i, const Standard_Integer j) const;
77   
78   Standard_EXPORT void OutM() const;
79   
80   Standard_EXPORT void OutS() const;
81
82
83
84
85   DEFINE_STANDARD_RTTIEXT(FEmTool_ProfileMatrix,FEmTool_SparseMatrix)
86
87 protected:
88
89
90
91
92 private:
93
94
95   TColStd_Array2OfInteger profile;
96   Handle(TColStd_HArray1OfReal) ProfileMatrix;
97   Handle(TColStd_HArray1OfReal) SMatrix;
98   Handle(TColStd_HArray1OfInteger) NextCoeff;
99   Standard_Boolean IsDecomp;
100
101
102 };
103
104
105
106
107
108
109
110 #endif // _FEmTool_ProfileMatrix_HeaderFile