np2d_gs.cc

来自「Flens库-一个在C++的矩阵运算库」· CC 代码 · 共 36 行

CC
36
字号
#include <poisson_solver/flens_impl.h>#include <dirichlet_poisson.h>using namespace flens;using namespace std;typedef NeumannPoisson2D                    MatType;typedef StaggeredGridVector2D<true, true>   VecType;typedef GaussSeidelRedBlack<MatType, VecType>  Smoother;intmain(){    int l = 3;    int rh = (1<<l);    MatType A(rh);    VecType f(rh), u(rh), solution(rh);    problem2(f, u, solution);    cerr << "solution = " << solution << endl;    Smoother S(A, f);    errorStat(0, A, f, u, solution);    for (int it=1; it<=666; ++it) {        u = S*u;        errorStat(it, A, f, u, solution);    }    cerr << "solution = " << solution << endl;}

⌨️ 快捷键说明

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