📄 fdtd.h
字号:
#ifndef FDTD_H
#define FDTD_H
#include <QtCore>
class Materials;
class FDTD;
class Boundary;
class Source;
class Materials
{
public:
Materials();
double *setGa();
double *setGb();
int setKE();
private:
int KE;
double ddx; /* Cell size */
double dt; /* Time steps */
double epsilon;
double sigma;
};
class FDTD
{
public:
~FDTD();
void initialize();
void readFile(QTextStream &stream);
void writeFile(QTextStream &stream);
void simulate();
private:
Materials *material;
double *Ex, *Hy, *ga, *gb, *Dx, *Ix;
int T; /* Initial step */
int NSTEPS; /* run step this time */
int KE; /* KE is the number of cells to be used */
int boundaryType;
Boundary *boundary;
int sourceType;
Source *source;
};
class Boundary
{
public:
Boundary();
void readFile(QTextStream &stream);
void writeFile(QTextStream &stream);
void setBoundary(double *Ex, int KE);
private:
double Ex_low_m1, Ex_low_m2, Ex_high_m1, Ex_high_m2;
};
class Source
{
public:
Source(int sourceType);
void readFile(QTextStream &stream);
void writeFile(QTextStream &stream);
void setSource(double *Dx, int T);
private:
int type;
/* for Sine Source */
double freq_in; /* frequency (Hz) */
double ddx; /* Set the cell size */
double dt; /* Calculate the time step */
void SineInit();
void SineRead(QTextStream &stream);
void SineWrite(QTextStream &stream);
double SinePulse(int T);
/* for Gaussian Source */
double t0; /* Center of the incident pulse */
double spread; /* Width of the incident pulse */
void GaussianInit();
void GaussianRead(QTextStream &stream);
void GaussianWrite(QTextStream &stream);
double GaussianPulse(int T);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -