⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read_input_file.h

📁 利用c++语言写的三维FDTD
💻 H
字号:
#include <iostream>
#include <fstream>
#include <malloc.h>
#include <new>

using namespace std;

#ifndef _Struct3_
	typedef struct
	{
		//total number of cells in x, y and z direction
		long nx, ny, nz; 

		long n_kxkykz;
		char *Path_Kx_Ky_Kz;

		//[cells] the sizes of PML zone
		long n_PML_x_1, n_PML_y_1, n_PML_z_1;
		long n_PML_x_2, n_PML_y_2, n_PML_z_2;

		//Specifies the symmetric or anti-symmetric boundary conditions
		int jel_Symmetric_ia, jel_Symmetric_ib, jel_Symmetric_ja;
	    int jel_Symmetric_jb, jel_Symmetric_ka, jel_Symmetric_kb;
		int jel_Anti_Symmetric_ia, jel_Anti_Symmetric_ib, jel_Anti_Symmetric_ja;
	    int jel_Anti_Symmetric_jb, jel_Anti_Symmetric_ka, jel_Anti_Symmetric_kb;
		
		//the space divisions in x, y and z
		double dx, dy, dz;

		long num_iter; //the number of FDTD iterations
		double limit_time;//the running time in [s], after it saves out all workspace data in binary

		int load_workspace_data; //true - load the workspace data and continue computations
		char *Path_Load_Workspace_Data; //the location of workspace data from the previous run

		//Save Data
		int save_field; //to save data - Ex, Ey, Ez, Hx, Hy, Hz slices
		long nr_Save; //save with this increment
		long saveFROMinst, saveTOinst; //between these iteration steeps
		long n_x_a, n_x_b, n_y_a, n_y_b, n_z_a, n_z_b; //the volume from which planes will be saved

		//Average field components in a specified subvolume
		int aver_field_volume;
		long nx_a_av, nx_b_av;
		long ny_a_av, ny_b_av;
		long nz_a_av, nz_b_av;

		//Fourier transform
		int fourier_transf_vol;
		long nx_a_f, nx_b_f, ny_a_f, ny_b_f, nz_a_f, nz_b_f; //the volume 
		//between these frequencies
		double frec_1, frec_2;
		long n_frec;
		long start_fourier;

		//the electromagnetic energy
		//division - for computing with threads
		long nr_W_DIV_x, nr_W_DIV_y, nr_W_DIV_z;
		
		//defines the volume where the energy will be computed
		long nx_W_a, nx_W_b; 
		long ny_W_a, ny_W_b; 
		long nz_W_a, nz_W_b;

		//compute the energy between the instants
		long eval_W_FROMinst, eval_W_TOinst;

		//save slices from W
		int save_W; //to save W
		long nr_W_Save; //to save at
		long save_W_FROMinst; //>= eval_W_FROMinst
		long save_W_TOinst; //<= eval_W_TOinst
		
		//defines the volume where the energy will be saved
		//take into consideration nx_W_a, nx_W_b, ... nz_W_b
		long n_x_W_a, n_x_W_b; 
		long n_y_W_a, n_y_W_b; 
		long n_z_W_a, n_z_W_b;

		//division - for saving W with threads
		long Save_nr_W_DIV_x, Save_nr_W_DIV_y, Save_nr_W_DIV_z;
		
		//the excitation
		long source_type; // 1- Gauss; 2- Sin; 3- Gauss-Sin
		long jel_plane_wave; //the type of the excitation 0 - point  source
							//                           1 - plane wave
		
		//point  source
		int readFile_Param_Pt_Source;//in case of point source read from file or directly the pulse param
		long n_Coord; //nr of point sources
		char *path_name_CoordPointSource; //the coordinates of point sources
		char *path_name_ParamPointSource; //the Param of Point sources
		int pt_source_Ex, pt_source_Ey, pt_source_Ez; //E point source
		int pt_source_Hx, pt_source_Hy, pt_source_Hz; //H point source

		//plane wave
		long n_TS; //the dimension of the Scattered Field zone
		long nPML_1D; //[cells] the sizes of the 1D FDTD PML zone
		double PML_eps_r_1D, PML_mu_r_1D;
		int jel_TS_xa, jel_TS_xb, jel_TS_ya, jel_TS_yb, jel_TS_za, jel_TS_zb;

		double teta, phi, gamma;  //angles which determine the direction and polarization of the plane wave
						          //teta - polar angle ( 0 - pi ) (related to z axis)
			                      //phi  - azimuth angle ( 0 - 2*pi ) (related to x axis)
		//Parameters of the pulse
		double X0, tw, t0, omega, const_alfa;
		
		//the file which describe the geometry
		char *path_name_Index; 
		//the file with material parameters
		long n_Mat;//nr of materials
		char *path_name_MatParam;

		//the followed points
		int load_foll_field_points; //1 load the followed point from file
		long n_Ind_F; //nr of followed point
		char *path_name_foll_field_points; //path

		//the PML parameters in x,y and z direction
		double PML_eps_r_x1, PML_mu_r_x1, PML_eps_r_x2, PML_mu_r_x2;
		double PML_eps_r_y1, PML_mu_r_y1, PML_eps_r_y2, PML_mu_r_y2;
		double PML_eps_r_z1, PML_mu_r_z1, PML_eps_r_z2, PML_mu_r_z2;
        		
		//save the data
		char *path_save_data; //the path where the output data will be saved
	}Input_Data;

	#define _Struct3_
#endif

int readFile_fdtd_data(Input_Data *Inp_D, char *ut_nev);
template <class T>int ReadFileVar(ifstream *inClientFile, char var_name[], T *var);
int ReadFileVarString(ifstream *inClientFile, char var_name[], char **var);

⌨️ 快捷键说明

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