fdtd2.h

来自「国外一大学教授讲章」· C头文件 代码 · 共 43 行

H
43
字号
#define _FDTD2_H    #ifndef _STDIO_H#include <stdio.h>#endif#ifndef _STDLIB_H#include <stdlib.h>#endifstruct Grid {  double *ez;  double *hy;  int sizeX;  int time, maxTime;  double cdtds;};typedef struct Grid Grid;/* memory allocation macro */#define ALLOC_1D(name,nx,type)                                      \    name = (type *)calloc(nx,sizeof(type));                         \    if (!name) {                                                    \      perror("ALLOC_1D");                                           \      fprintf(stderr,                                               \              "Allocation failed for " #name ". Terminating...\n"); \      exit(-1);                                                     \    }/* macros for accessing arrays and such */#define Hy(MM)    g->hy[MM]   #define Ez(MM)    g->ez[MM]   #define SizeX     g->sizeX    #define Time      g->time     #define MaxTime   g->maxTime  #define Cdtds     g->cdtds    /* function prototypes */void gridInit2(Grid *g);      void updateH2(Grid *g);       void updateE2(Grid *g);  

⌨️ 快捷键说明

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