当前位置: 首页>>代码示例>>C#>>正文


C# DenseMatrix.CopyInPlace方法代码示例

本文整理汇总了C#中DenseMatrix.CopyInPlace方法的典型用法代码示例。如果您正苦于以下问题:C# DenseMatrix.CopyInPlace方法的具体用法?C# DenseMatrix.CopyInPlace怎么用?C# DenseMatrix.CopyInPlace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DenseMatrix的用法示例。


在下文中一共展示了DenseMatrix.CopyInPlace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RFEM


//.........这里部分代码省略.........
                /* gstif[nnet - 1, nnet - 2] += (Kt - Kn) * cos * sin; */
                gstif[nnet - 1 , nnet - 1] += Kn * cos2 + Kt * sin2;

                // obtain Cholesky decomposition of the (initial) global stiffness matrix
                gstif_chol = gstif.Cholesky;

                if ( gstif_chol == null ) continue;

                // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                /* TESTING MATRIX SOLVER */

                //BandSymMatrix.SolveInPlaceCholesky(gstif_chol, gload, ref gdisp);

                //gstif.PrintFullToFile("C:\\Users\\Brandon\\Documents\\School\\Slope 2011\\gstif.txt");
                //gstif_chol[0].PrintFullToFile("C:\\Users\\Brandon\\Documents\\School\\Slope 2011\\gstif_chol[0].txt");
                //gstif_chol[1].PrintFullToFile("C:\\Users\\Brandon\\Documents\\School\\Slope 2011\\gstif_chol[1].txt");
                //gload.PrintToFile("C:\\Users\\Brandon\\Documents\\School\\Slope 2011\\gload.txt");
                //gdisp.PrintToFile("C:\\Users\\Brandon\\Documents\\School\\Slope 2011\\gdisp.txt");

                /* MATRIX SOLVER TESTING COMPLETE */
                // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                // NON-LINEAR SOLVER FOR RFEM (MODIFIED NEWTON-RAPHSON)
                double eps_s = 1e-5 , eps_a , iresid , gresid;
                int niter = 5000 , iter;
                int nstep = (int) Math.Ceiling( Math.Log( 1 / eps_s ) / Math.Log( 2 ) + 1 );
                double relax = 0.25;
                double dfact = 1.0 , fact0 = 0.0 , factor = 0.0;
                /*bool converge;*/

                for ( int istep = 0 ; istep < nstep ; istep++ )
                {
                    factor = fact0 + dfact;             // Set load scaling factor for current step
                    gdisp0.CopyInPlace( ref gdisp );      // Put current displacements and loads into
                    dload0.CopyInPlace( ref dload );      //      solver matrices

                    eps_a = 1; iter = 0; /* converge = false;*/

                    while ( eps_a > eps_s && iter < niter && factor <= 1 )
                    {
                        iter++;

                        // Determine global load vector for this iteration
                        DenseMatrix.MultiplyInPlace( factor , gload , ref iload );
                        DenseMatrix.AddInPlace( iload , dload , ref iload );

                        // --------------------------------------
                        // SOLVE THE STIFFNESS EQUATION
                        // --------------------------------------

                        // solve gstif*idisp = iload
                        BandSymMatrix.SolveInPlaceCholesky( gstif_chol , iload , ref idisp );

                        // compute update global displacements, ddisp = gdisp + idisp
                        DenseMatrix.AddInPlace( gdisp , idisp , ref ddisp );

                        // apply relaxation factor, gdisp = (1-relax)*gdisp + relax*ddisp
                        DenseMatrix.MultiplyInPlace( 1 - relax , gdisp , ref gdisp );
                        DenseMatrix.MultiplyInPlace( relax , ddisp , ref ddisp );
                        DenseMatrix.AddInPlace( gdisp , ddisp , ref gdisp );

                        // compute actual load (non-linear load-displacement curve)
                        ComputeDLoadRFEM( ref dload , gdisp ,
                                            n , /* kappa = */ 1.0 , /*acoef = */ 1e-5 ,
                                            yg , hg ,
                                            alpha , blength ,
开发者ID:karcheba,项目名称:SlopeFEA,代码行数:67,代码来源:SlopeCanvasAnalysis.cs


注:本文中的DenseMatrix.CopyInPlace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。