本文整理汇总了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 ,