Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:46

0001 // Created on: 1997-10-29
0002 // Created by: Roman BORISOV
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _FEmTool_ProfileMatrix_HeaderFile
0018 #define _FEmTool_ProfileMatrix_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <NCollection_Array2.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <FEmTool_SparseMatrix.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <math_Vector.hxx>
0029 
0030 //! Symmetric Sparse ProfileMatrix useful for 1D Finite
0031 //! Element methods
0032 class FEmTool_ProfileMatrix : public FEmTool_SparseMatrix
0033 {
0034 
0035 public:
0036   Standard_EXPORT FEmTool_ProfileMatrix(const NCollection_Array1<int>& FirstIndexes);
0037 
0038   Standard_EXPORT void Init(const double Value) override;
0039 
0040   Standard_EXPORT double& ChangeValue(const int I, const int J) override;
0041 
0042   //! To make a Factorization of <me>
0043   Standard_EXPORT bool Decompose() override;
0044 
0045   //! Direct Solve of AX = B
0046   Standard_EXPORT void Solve(const math_Vector& B, math_Vector& X) const override;
0047 
0048   //! Make Preparation to iterative solve
0049   Standard_EXPORT bool Prepare() override;
0050 
0051   //! Iterative solve of AX = B
0052   Standard_EXPORT void Solve(const math_Vector& B,
0053                              const math_Vector& Init,
0054                              math_Vector&       X,
0055                              math_Vector&       Residual,
0056                              const double       Tolerance    = 1.0e-8,
0057                              const int          NbIterations = 50) const override;
0058 
0059   //! returns the product of a SparseMatrix by a vector.
0060   //! An exception is raised if the dimensions are different
0061   Standard_EXPORT void Multiplied(const math_Vector& X, math_Vector& MX) const override;
0062 
0063   //! returns the row range of a matrix.
0064   Standard_EXPORT int RowNumber() const override;
0065 
0066   //! returns the column range of the matrix.
0067   Standard_EXPORT int ColNumber() const override;
0068 
0069   Standard_EXPORT bool IsInProfile(const int i, const int j) const;
0070 
0071   Standard_EXPORT void OutM() const;
0072 
0073   Standard_EXPORT void OutS() const;
0074 
0075   DEFINE_STANDARD_RTTIEXT(FEmTool_ProfileMatrix, FEmTool_SparseMatrix)
0076 
0077 private:
0078   NCollection_Array2<int>                  profile;
0079   occ::handle<NCollection_HArray1<double>> ProfileMatrix;
0080   occ::handle<NCollection_HArray1<double>> SMatrix;
0081   occ::handle<NCollection_HArray1<int>>    NextCoeff;
0082   bool                                     IsDecomp;
0083 };
0084 
0085 #endif // _FEmTool_ProfileMatrix_HeaderFile