• <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

            OpenCASCADE Gauss Integration

            Posted on 2014-09-11 21:52 eryar 閱讀(2813) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            OpenCASCADE Gauss Integration

            eryar@163.com

            Abstract. Numerical integration is the approximate computation of an integral using numerical techniques. The numerical computation of an integral is sometimes called quadrature. The most straightforward numerical integration technique uses the Newton-Cotes formulas(also called quadrature formulas), which approximate a function tabulated sequence of regularly spaced intervals by various degree polynomials. If the functions are known analytically instead of being tabulated at equally spaced intervals, the best numerical method of integrations is called Gauss Integration(Gaussian quadrature). By picking the abscissas at which to evaluate the function, Gaussian quadrature produces the most accurate approximations possible. In OpenCASCADE math package it implement the Gauss-Legendre integration. So I will focus on the usage of the class in OpenCASCADE.

            Key Words. OpenCASCADE, Gauss Integration, Gauss-Legendre, Numerical Analysis

            1. Introduction

            在科學(xué)和工程計算問題中,經(jīng)常要計算一些定積分或微分,它們的精確值無法算出或計算量太大,只能用數(shù)值的方法給出具有指定誤差限的近似值。最直觀的數(shù)值積分方法有Newton-Cotes,其將積分區(qū)間等分之,并取分點為積分節(jié)點。這種做法雖然簡化了計算,但卻降低了所得公式的代數(shù)精度。

            Gauss型求積公式是一種高精度的數(shù)值積分公式。在求積節(jié)點數(shù)相同的情況下,即計算工作量相近的情況下,利用Gauss型求積公式往往可以獲得準(zhǔn)確程序較高的積分結(jié)果,只是它在不等距的無理數(shù)上計算被積函數(shù)。

            OpenCASCADE的math包中實現(xiàn)了Gauss-Legendre積分算法。本文主要介紹其使用方法,進而對其應(yīng)用進行理解。

            2. The Gauss-Legendre Integration

            Gauss型求積公式是數(shù)值穩(wěn)定的,且對有限閉區(qū)間上的連續(xù)函數(shù),Gauss求積的數(shù)值隨節(jié)點數(shù)目的增加而收斂到準(zhǔn)確積分值。

            常用的Gauss型求積公式有Gauss-Legendre求積公式,Gauss-Chebyshev求積公式,Gauss-Laguerre求積公式和Gauss-Hermite求積公式等。

            對于一般區(qū)間[a, b]上的Gauss型求積公式,可通過變量變換,由Gauss-Legendre求積公式得到:

            wps_clip_image-12252其中:

            wps_clip_image-28519

            OpenCASCADE中對應(yīng)的類有math_GaussSingleIntegration,主要實現(xiàn)的函數(shù)為Perform(),計算過程如下:

            v 查表求得Gauss點及求積系數(shù);

            //Recuperation des points de Gauss dans le fichier GaussPoints.
              math::GaussPoints(Order,GaussP);
              math::GaussWeights(Order,GaussW);

            v 根據(jù)Gauss-Legendre求積公式計算;

             

            // Changement de variable pour la mise a l'echelle [Lower, Upper] :
              xm = 0.5*(Upper + Lower);
              xr 
            = 0.5*(Upper - Lower);
              Val 
            = 0.;

              Standard_Integer ind 
            = Order/2, ind1 = (Order+1)/2;
              
            if(ind1 > ind) { // odder case
                Ok1 = F.Value(xm, Val);
                
            if (!Ok1) return;
                Val 
            *= GaussW(ind1);
              }
            // Sommation sur tous les points de Gauss: avec utilisation de la symetrie.
              for (j = 1; j <= ind; j++) {
                dx 
            = xr*GaussP(j);
                Ok1 
            = F.Value(xm-dx, F1);
                
            if(!Ok1) return;
                Ok1 
            = F.Value(xm+dx, F2);
                
            if(!Ok1) return;
                
            // Multiplication par les poids de Gauss.
                Standard_Real FT = F1+F2;
                Val 
            += GaussW(j)*FT;  
              }
              
            // Mise a l'echelle de l'intervalle [Lower, Upper]
              Val *= xr;

            對比Gauss-Legendre求積公式來理解上述代碼還是比較清晰的。下面給出使用此類的一個具體實例:

             

            /*
            *    Copyright (c) 2014 eryar All Rights Reserved.
            *
            *        File    : Main.cpp
            *        Author  : eryar@163.com
            *        Date    : 2014-09-11 20:46
            *        Version : 1.0v
            *
            *    Description : Demo for Gauss-Legendre Integration usage.
            *
            *      Key words : OpenCascade, Gauss-Legendre Integration
            */

            #define WNT
            #include 
            <math_Function.hxx>
            #include 
            <math_GaussSingleIntegration.hxx>

            #pragma comment(lib, 
            "TKernel.lib")
            #pragma comment(lib, 
            "TKMath.lib")

            class Test_GaussFunction : public math_Function
            {
            public:
                
            virtual Standard_Boolean Value(const Standard_Real x, Standard_Real &y)
                {
                    y 
            = x;

                    
            return Standard_True;
                }

            private:
            };

            void TestGaussIntegration(void)
            {
                Test_GaussFunction aFunction;
                math_GaussSingleIntegration aSolver(aFunction, 
            11010);

                std::cout 
            << aSolver << std::endl;
            }

            int main(int argc, char* argv[])
            {
                TestGaussIntegration();

                
            return 0;
            }

            主要是從math_Function派生一個類來在虛函數(shù)Value()中重定義求積函數(shù)即可。上述實例中計算的是如下積分:

            wps_clip_image-4533

            計算結(jié)果如下圖所示:

            wps_clip_image-15082

            Figure 2.1 Gauss-Legendre Integtation Result

            3. Application

            由高等數(shù)學(xué)知識可知,積分的應(yīng)用主要用于計算圖形面積,體積及曲線的弧長,功等。

            積分在OpenCASCADE中的主要應(yīng)用有計算曲線長度,曲面面積及實體的體積等。如下圖所示:

            wps_clip_image-13853

            Figure 3.1 Compute Area of a Surface

            示例代碼如下所示:

            TopoDS_Shape S = BRepBuilderAPI_MakeFace(BSS, Precision::Confusion()).Face();

            GProp_GProps System;
            BRepGProp::SurfaceProperties(S,System);
            gp_Pnt G 
            = System.CentreOfMass ();
            Standard_Real Area 
            = System.Mass();
            gp_Mat I 
            = System.MatrixOfInertia();


             


            4. Conclusion

            OpenCASCADE中實現(xiàn)的Gauss-Legendre求積算法,由于是查表求得Gauss點及求積系數(shù),所以計算速度快。唯一不足是對高斯點數(shù)有限制。

            綜上所述,可知數(shù)值計算在OpenCASCADE中重要作用。一個TKMath庫相當(dāng)于實現(xiàn)了一本《數(shù)值分析》課本中的大部分內(nèi)容。所以有興趣的朋友可結(jié)合《數(shù)值分析》或《計算方法》之類的書籍,來對OpenCASCADE的數(shù)學(xué)庫TKMath進行理論聯(lián)系實際的深入理解。

            5. References

            1. Wolfram MathWorld, Numerical Integration, 

            http://mathworld.wolfram.com/NumericalIntegration.html

            2. 易大義,沈云寶,李有法編. 計算方法. 浙江大學(xué)出版社. 2002

            3. 易大義,陳道琦編. 數(shù)值分析引論. 浙江大學(xué)出版社. 1998

            4. 李慶楊,王能超,易大義.數(shù)值分析.華中理工大學(xué)出版社. 1986

            5. 同濟大學(xué)數(shù)學(xué)教研室. 高等數(shù)學(xué)(第四版). 高等教育出版社. 1996

            久久精品国产亚洲AV忘忧草18| 精品99久久aaa一级毛片| 久久婷婷五月综合色奶水99啪| 亚洲人成电影网站久久| 久久人做人爽一区二区三区| 97r久久精品国产99国产精| 91精品国产91热久久久久福利| 久久影视综合亚洲| 久久一日本道色综合久久| 91精品国产色综久久| 久久国产色av免费看| 狠狠狠色丁香婷婷综合久久俺| 亚洲а∨天堂久久精品| www.久久热.com| 性做久久久久久久| 久久青青草原精品国产不卡| 69国产成人综合久久精品| 青青久久精品国产免费看| 久久精品国产免费一区| 久久精品国产亚洲AV久| 久久99精品免费一区二区| 久久久久久国产精品无码超碰| 亚洲性久久久影院| 久久久久无码专区亚洲av| 久久久久免费看成人影片| 亚洲乱码日产精品a级毛片久久| 91久久精品国产91性色也| 久久精品国产亚洲av麻豆小说| 久久无码AV一区二区三区| 亚洲综合久久夜AV | 久久综合久久伊人| 久久精品国产亚洲Aⅴ蜜臀色欲| 国产精品一久久香蕉国产线看观看| 波多野结衣久久| 久久精品国产99国产精品导航 | 久久青青国产| 婷婷综合久久中文字幕| 久久亚洲国产欧洲精品一| 精品久久777| 久久99精品久久久久久野外| 久久中文字幕一区二区|