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

📄 read_input_file.h

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

using namespace std;

#ifndef _Struct3_
	typedef struct
	{
		#ifdef _OPENMP
			int num_threads; //nr of threads 
		#endif

		//total number of cells in x, y and z direction
		long nx, ny, nz; 

		//division of the comp space 
		long nr_DIV_x, nr_DIV_y, nr_DIV_z;
		
		//[cells] the size of the PML zone
		long n_PML;

		//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
		
		char *path_name_Wigner_Cell; //the location of the Wigner-Seitz cell

		//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;

		//Bragg diffraction
		int jel_aver_Bragg_WignerUC;
		char *path_name_Gxy;
        long nz_Bragg, n_Gxy;

		//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
		
		//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_Ez; //Ez point source
		int pt_source_Hz; //Hz point source

		//plane wave
		long n_TS; //the dimension of the Scattered Field zone
		//Parameters of the pulse
		double X0, tw, t0, omega, phase, 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_z_1, PML_mu_r_z_1, PML_eps_r_z_2, PML_mu_r_z_2;

		//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 + -