improved2.c

来自「国外一大学教授讲章」· C语言 代码 · 共 35 行

C
35
字号
/* Further improved bare-bones 1D FDTD simulation. */#include "fdtd2.h"#include "ezincarg.h"int main(){  Grid *g;                               ALLOC_1D(g,1,Grid); // allocate memory for Grid    /* Initialize the grid. */  gridInit2(g);                          /* initialize source function */  ezIncArgInit(1.0,30.0,10.0);  /* do time stepping */  for (Time=0; Time<MaxTime; Time++) {     /* update magnetic field */    updateH2(g);                           /* update electric field */    updateE2(g);                           /* apply source function at time "Time" and location zero */    Ez(0) = ezInc(Time,0.0);    printf("%g\n",Ez(50));               } /* end of time-stepping */  return 0;}

⌨️ 快捷键说明

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