• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            eryar

            PipeCAD - Plant Piping Design Software.
            RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
            posts - 603, comments - 590, trackbacks - 0, articles - 0

            Use Math Utilities in the OpenCASCADE

            OpenCASCADE由七個(gè)模塊組成,分別如下:

            • Module FoundationClasses; 基礎(chǔ)類;
            • Module ModelingData; 造型數(shù)據(jù);
            • Module ModelingAlgorihtms; 造型算法;
            • Module Visualization; 可視化;
            • Module ApplicationFramework; 程序框架;
            • Module DataExchange; 數(shù)據(jù)交換;
            • Module Draw;

            其中基礎(chǔ)類模塊有三個(gè)工具箱:

            • Toolkit TKAdvTools; 高級(jí)工具箱;
            • Toolkit TKMath; 數(shù)學(xué)工具箱;
            • Toolkit TKernel; 核心工具箱;

            根據(jù)OpenCASCADEReference文檔,查到math_Gauss類,描述如下:

            This class implements the Gauss LU decomposition (Crout algorithm) with partial pivoting (rows interchange) of a square matrix and the different possible derived calculation :

            • Solution of a set of linear equations.
            • Inverse of a matrix.
            • Determinant of a matrix.

            主要根據(jù)矩陣的三角分解中的LU分解方法,可作如下計(jì)算:

            • 線性方程組的求解;
            • 矩陣的逆;
            • 矩陣的行列式;

            為簡(jiǎn)單起見,先做個(gè)簡(jiǎn)單的測(cè)試,求以下方程組的解:

            Equation

            OpenCASCADEC++代碼如下:(新建一個(gè)控制臺(tái)程序,需要包含TKernel.lib;TKMath.lib兩個(gè)庫(kù);)

               1:  //------------------------------------------------------------------------------
               2:  //    Copyright (c) 2012 eryar All Rights Reserved.
               3:  //
               4:  //        File    : Main.cpp
               5:  //        Author  : eryar@163.com
               6:  //        Date    : 2012-6-20 20:06
               7:  //        Version : 1.0v
               8:  //
               9:  //    Description : Learn to use OpenCASCADE Math Utilities.
              10:  //
              11:  //==============================================================================
              12:   
              13:  #include <math_Gauss.hxx>
              14:   
              15:  int main(int argc, char* argv[])
              16:  {
              17:      math_Matrix aMatrix(1, 3, 1, 3);
              18:      math_Vector b1(1, 3);
              22:   
              23:      //aMatrix, b1 and b2 are set here to the appropriate values
              24:      aMatrix(1, 1)   = 10;
              25:      aMatrix(2, 2)   = 2;
              26:      aMatrix(3, 3)   = 8;
              27:   
              28:      b1.Init(1);
              29:   
              30:      // Use Gause method
              31:      math_Gauss  sol(aMatrix);
              32:   
              33:      // LU decomposition of A
              34:      if (sol.IsDone())
              35:      {
              36:          sol.Solve(b1, x1);
              37:      }
              38:      else
              39:      {
              40:          // Fix up
              41:          try 
              42:          {
              43:              sol.Solve(b1, x1);
              44:          }
              45:          catch (Standard_Failure)
              46:          {
              47:              Handle(Standard_Failure) error = Standard_Failure::Caught();
              48:              cout<<error<<endl;
              49:          }
              50:      }
              51:   
              52:      cout<<aMatrix;
              53:      cout<<b1;
              54:      cout<<x1;
              55:   
              56:      return 0;
              57:  }

            輸出結(jié)果如下所示:

               1:  math_Matrix of RowNumber = 3 and ColNumber = 3
               2:  math_Matrix ( 1, 1 ) = 10
               3:  math_Matrix ( 1, 2 ) = 0
               4:  math_Matrix ( 1, 3 ) = 0
               5:  math_Matrix ( 2, 1 ) = 0
               6:  math_Matrix ( 2, 2 ) = 2
               7:  math_Matrix ( 2, 3 ) = 0
               8:  math_Matrix ( 3, 1 ) = 0
               9:  math_Matrix ( 3, 2 ) = 0
              10:  math_Matrix ( 3, 3 ) = 8
              11:  math_Vector of Length = 3
              12:  math_Vector(1) = 1
              13:  math_Vector(2) = 1
              14:  math_Vector(3) = 1
              15:  math_Vector of Length = 3
              16:  math_Vector(1) = 0.1
              17:  math_Vector(2) = 0.5
              18:  math_Vector(3) = 0.125
              19:  Press any key to continue . . .

            結(jié)論

            通過對(duì)基礎(chǔ)類模塊中數(shù)學(xué)工具箱的使用,對(duì)OpenCASCADE慢慢進(jìn)行了解。

            Feedback

            # re: 使用OpenCASCADE的Math功能解線性方程組  回復(fù)  更多評(píng)論   

            2012-11-19 14:05 by liangquan
            謝謝您的文章

            # re: 使用OpenCASCADE的Math功能解線性方程組  回復(fù)  更多評(píng)論   

            2012-11-19 17:35 by eryar
            @liangquan
            客氣了。。。

            # re: 使用OpenCASCADE的Math功能解線性方程組  回復(fù)  更多評(píng)論   

            2014-03-19 20:56 by near
            X1是什么類型,也是VECTOR么?怎么定義了X1結(jié)果也不對(duì)。。。

            # re: 使用OpenCASCADE的Math功能解線性方程組  回復(fù)  更多評(píng)論   

            2014-03-19 20:58 by eryar
            嗯,x1和b1的一樣,也是個(gè)Vector。
            是不是你的aMatrix沒有初始化,用aMatrix.Init(0.0)初始化來看看……@near

            # re: 使用OpenCASCADE的Math功能解線性方程組  回復(fù)  更多評(píng)論   

            2014-03-19 21:22 by near
            問題解決了,果然如此...@eryar
            亚洲国产一成久久精品国产成人综合 | 久久综合九色综合97_久久久| av无码久久久久久不卡网站| 国内精品久久久久久久coent| 久久久久久曰本AV免费免费| 久久夜色精品国产亚洲| 久久福利资源国产精品999| 国产精品一久久香蕉国产线看| 久久无码精品一区二区三区| 少妇久久久久久久久久| 久久精品国产只有精品66| 久久精品国产亚洲av水果派| 久久香蕉国产线看观看猫咪?v| 国产精品久久久久影视不卡| 久久人人添人人爽添人人片牛牛| 18岁日韩内射颜射午夜久久成人 | 国产精品久久久久国产A级| 亚洲人成网站999久久久综合| 久久婷婷国产麻豆91天堂| 久久婷婷五月综合97色直播| 色播久久人人爽人人爽人人片aV| AV无码久久久久不卡蜜桃| 亚洲色欲久久久综合网| 女人高潮久久久叫人喷水| 久久久久亚洲AV成人网| 伊人久久大香线蕉精品| 69国产成人综合久久精品| 蜜臀久久99精品久久久久久小说| 香蕉久久久久久狠狠色| 久久精品国产亚洲Aⅴ蜜臀色欲| 久久香蕉一级毛片| 久久99国产精品二区不卡| avtt天堂网久久精品| 精品久久久久久国产潘金莲| 久久夜色精品国产亚洲| 国色天香久久久久久久小说 | 亚洲精品无码久久久影院相关影片 | 久久九九亚洲精品| 99精品国产在热久久| 国内精品伊人久久久久| 久久综合综合久久97色|