cgsolver.cpp

来自「有限元计算程序用于计算平面板结构单元的应力和位移。」· C++ 代码 · 共 41 行

CPP
41
字号
#include <iostream>
using namespace std;
#include "Plate.h"

//---------------------------------------------------------------------------

double* TPlate::Cal_CGSolver(){

        nmax = 0;
        nmax = count_nmax();

        sa = Allocate_1D_Matrix(sa, nmax);
        ija = Allocate_1D_Matrix(ija, nmax);
        b = Allocate_1D_Matrix(b, NEQ);
        x = Allocate_1D_Matrix(x, NEQ);

        sa = SetZero_1D_Matrix(sa, nmax);
        ija = SetZero_1D_Matrix(ija, nmax);
        b = SetZero_1D_Matrix(b, NEQ);
        x = SetZero_1D_Matrix(x, NEQ);

        b = U;

        // dsprsin (Banded Matrix --> Sparse Matrix);
        // Numerical Recipes In C++, Chapter 2 (Modified);
        dsprsin(sa, NEQ, MBAND, S, ija);

        // linbcg(Conjugate Gradient Solver);
        // Numerical Recipes In C++, Chapter 2;
        linbcg();

        U = x;
        
        return U;

}

//---------------------------------------------------------------------------


 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?