34 #ifndef TKSPACE3DSOLVER_H
35 #define TKSPACE3DSOLVER_H
71 virtual void AllocateMemory();
73 virtual void FreeMemory();
76 virtual void LoadInputData();
79 virtual void Compute();
82 virtual void PrintParametersOfSimulation(FILE * file);
85 virtual size_t ShowMemoryUsageInMB();
88 string GetCodeName() {
return "kspaceFirstOrder3D-OMP v1.1"; };
91 void PrintFullNameCodeAndLicense(FILE * file);
94 void SetProcessorAffinity();
97 double GetTotalTime()
const {
return TotalTime.GetElapsedTime(); };
130 void InitializeFFTWPlans();
133 void PreProcessingPhase();
136 void Compute_MainLoop();
139 void PostPorcessing();
142 void StoreSensorData();
145 void SaveCheckpointData();
148 void WriteOutputDataInfo();
155 void Compute_duxyz();
159 void Compute_rhoxyz_nonlinear();
161 void Compute_rhoxyz_linear();
171 void Generate_kappa();
174 void Generate_kappa_absorb_nabla1_absorb_nabla2();
177 void Generate_absorb_tau_absorb_eta_matrix();
180 void Calculate_dt_rho0_non_uniform();
183 void Calculate_p0_source();
189 void Compute_ddx_kappa_fft_p(
TRealMatrix& X_Matrix,
199 void Compute_new_p_nonlinear();
201 void Compute_new_p_linear();
205 void Calculate_SumRho_BonA_SumDu_SSE2(
TRealMatrix& RHO_Temp,
209 void Calculate_SumRho_SumRhoDu(
TRealMatrix& Sum_rhoxyz,
217 void Sum_Subterms_nonlinear(
TRealMatrix& Absorb_tau_temp,
222 void Sum_Subterms_linear(
TRealMatrix& Absorb_tau_temp,
227 void Sum_new_p_nonlinear_lossless();
229 void Sum_new_p_linear_lossless();
232 void Calculate_shifted_velocity();
235 void PrintStatisitcs();
238 void PrintOtputHeader();
241 bool IsTimeToCheckpoint();
246 return (Parameters->Get_t_index() != Parameters->Get_Nt());
250 void CheckOutputFile();
252 void RestoreCumulatedElapsedFromOutputFile();
255 void CheckCheckpointFile();
262 return MatrixContainer.GetMatrix<
TRealMatrix>(kappa);
311 return MatrixContainer.GetMatrix<
TRealMatrix>(duxdx);
316 return MatrixContainer.GetMatrix<
TRealMatrix>(duydy);
321 return MatrixContainer.GetMatrix<
TRealMatrix>(duzdz);
327 return MatrixContainer.GetMatrix<
TRealMatrix>(dt_rho0_sgx);
332 return MatrixContainer.GetMatrix<
TRealMatrix>(dt_rho0_sgy);
337 return MatrixContainer.GetMatrix<
TRealMatrix>(dt_rho0_sgz);
343 return MatrixContainer.GetMatrix<
TRealMatrix>(rhox);
348 return MatrixContainer.GetMatrix<
TRealMatrix>(rhoy);
353 return MatrixContainer.GetMatrix<
TRealMatrix>(rhoz);
358 return MatrixContainer.GetMatrix<
TRealMatrix>(rho0);
364 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddx_k_shift_pos);
369 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddy_k_shift_pos);
374 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddz_k_shift_pos);
379 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddx_k_shift_neg);
384 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddy_k_shift_neg);
389 return MatrixContainer.GetMatrix<
TComplexMatrix>(ddz_k_shift_neg);
411 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_x_sgx);
416 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_y_sgy);
421 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_z_sgz);
427 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_x);
432 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_y);
437 return MatrixContainer.GetMatrix<
TRealMatrix>(pml_z);
444 return MatrixContainer.GetMatrix<
TRealMatrix>(dxudxn);
449 return MatrixContainer.GetMatrix<
TRealMatrix>(dyudyn);
454 return MatrixContainer.GetMatrix<
TRealMatrix>(dzudzn);
460 return MatrixContainer.GetMatrix<
TRealMatrix>(dxudxn_sgx);
465 return MatrixContainer.GetMatrix<
TRealMatrix>(dyudyn_sgy);
470 return MatrixContainer.GetMatrix<
TRealMatrix>(dzudzn_sgz);
477 return MatrixContainer.GetMatrix<
TRealMatrix>(BonA);
482 return MatrixContainer.GetMatrix<
TRealMatrix>(absorb_tau);
487 return MatrixContainer.GetMatrix<
TRealMatrix>(absorb_eta);
493 return MatrixContainer.GetMatrix<
TRealMatrix>(absorb_nabla1);
498 return MatrixContainer.GetMatrix<
TRealMatrix>(absorb_nabla2);
507 return MatrixContainer.GetMatrix<
TIndexMatrix>(sensor_mask_index);
512 return MatrixContainer.GetMatrix<
TIndexMatrix>(sensor_mask_corners);
518 return MatrixContainer.GetMatrix<
TIndexMatrix>(u_source_index);
523 return MatrixContainer.GetMatrix<
TIndexMatrix>(p_source_index);
528 return MatrixContainer.GetMatrix<
TIndexMatrix>(delay_mask);
537 return MatrixContainer.GetMatrix<
TRealMatrix>(transducer_source_input);
543 return MatrixContainer.GetMatrix<
TRealMatrix>(p_source_input);
549 return MatrixContainer.GetMatrix<
TRealMatrix>(p0_source_input);
556 return MatrixContainer.GetMatrix<
TRealMatrix>(ux_source_input);
561 return MatrixContainer.GetMatrix<
TRealMatrix>(uy_source_input);
566 return MatrixContainer.GetMatrix<
TRealMatrix>(uz_source_input);
575 return MatrixContainer.GetMatrix<
TRealMatrix>(Temp_1_RS3D);
580 return MatrixContainer.GetMatrix<
TRealMatrix>(Temp_2_RS3D);
585 return MatrixContainer.GetMatrix<
TRealMatrix>(Temp_3_RS3D);
TRealMatrix & Get_absorb_nabla1()
Get the absorb_nabla1 matrix from the container.
TRealMatrix & Get_dt_rho0_sgy()
Get the dt.*rho0_sgy matrix from the container.
TTimeMeasure TotalTime
Total time of the simulation.
double GetTotalTime() const
Get total simulation time.
TFFTWComplexMatrix & Get_FFT_X_temp()
Get the FFT_X_temp from the container.
TRealMatrix & Get_ux_source_input()
Get the ux_source_input matrix from the container.
TRealMatrix & Get_Temp_3_RS3D()
Get the Temp_3_RS3D matrix from the container.
TRealMatrix & Get_absorb_tau()
Get the absorb_tau matrix from the container.
TComplexMatrix & Get_x_shift_neg_r()
Get the x_shift_neg_r matrix from the container.
TRealMatrix & Get_duydy()
Get the duydy matrix from the container.
TRealMatrix & Get_pml_x()
Get the pml_x matrix from the container.
bool IsCheckpointInterruption() const
Was the loop interrupted to checkpoint?
TRealMatrix & Get_dzudzn_sgz()
Get the dzudzn_sgz matrix from the container.
TComplexMatrix & Get_ddz_k_shift_neg()
Get the ddz_k_shift_neg matrix from the container.
TRealMatrix & Get_kappa()
Get the kappa matrix from the container.
TTimeMeasure SimulationTime
Simulation time of the simulation.
TTimeMeasure PostProcessingTime
Post-processing time of the simulation.
TRealMatrix & Get_pml_z()
Get the pml_z matrix from the container.
TComplexMatrix & Get_ddz_k_shift_pos()
Get the ddz_k_shift_pos matrix from the container.
TRealMatrix & Get_dxudxn_sgx()
Get the dxudxn_sgx matrix from the container.
TRealMatrix & Get_pml_z_sgz()
Get the pml_z_sgz matrix from the container.
The header file containing the class for real matrices.
TOutputStreamContainer OutputStreamContainer
Output stream container.
Tuxyz_sgxyzMatrix & Get_ux_sgx()
Get the ux_sgx matrix from the container.
TParameters * Parameters
Global parameters of the simulation.
TRealMatrix & Get_c2()
Get the c^2 matrix from the container.
Tuxyz_sgxyzMatrix & Get_uy_sgy()
Get the uy_sgy matrix from the container.
The header file containing the particle velocity matrix.
Tuxyz_sgxyzMatrix & Get_uy_shifted()
Get the uy_shifted matrix from the container.
double GetPreProcessingTime() const
Get pre-processing time.
TRealMatrix & Get_dyudyn_sgy()
Get the dyudyn_sgy matrix from the container.
TRealMatrix & Get_p_source_input()
Get the p_source_input matrix from the container.
TRealMatrix & Get_transducer_source_input()
Get the transducer_source_input matrix from the container.
The header file containing the parameters of the simulation.
TComplexMatrix & Get_z_shift_neg_r()
Get the y_shift_neg_r from the container.
Tuxyz_sgxyzMatrix & Get_uz_sgz()
Get the uz_sgz matrix from the container.
TRealMatrix & Get_p0_source_input()
Get the p0_source_input from the container.
TRealMatrix & Get_p()
Get the p matrix from the container.
TComplexMatrix & Get_ddy_k_shift_pos()
Get the ddy_k_shift_pos matrix from the container.
TTimeMeasure DataLoadTime
Data load time of the simulation.
TRealMatrix & Get_BonA()
Get the BonA matrix from the container.
TRealMatrix & Get_dxudxn()
Get the dxudxn matrix from the container.
The header file containing the class measuring elapsed time.
Class implementing 3D Real-To-Complex and Complex-To-Real transforms using FFTW interface.
TRealMatrix & Get_dzudzn()
Get the dzudzn matrix from the container.
double GetSimulationTime() const
Get simulation time (time loop).
TRealMatrix & Get_absorb_nabla2()
Get the absorb_nabla2 matrix from the container.
TRealMatrix & Get_rho0()
Get the rho0 matrix from the container.
TRealMatrix & Get_uz_source_input()
Get the uz_source_input matrix from the container.
The header file of classes responsible for storing output quantities into the output HDF5 file...
Tuxyz_sgxyzMatrix & Get_uz_shifted()
Get the uz_shifted matrix from the container.
TIndexMatrix & Get_sensor_mask_index()
Get the sensor_mask_index matrix from the container.
TFFTWComplexMatrix & Get_FFT_shift_temp()
Get the FFT_shift_temp the container.
Class storing all parameters of the simulation.
TIndexMatrix & Get_delay_mask()
Get the delay_mask matrix from the container.
The header file containing the class for 64b integer matrices.
TRealMatrix & Get_dt_rho0_sgz()
Get the dt.*rho0_sgz matrix from the container.
TIndexMatrix & Get_p_source_index()
Get the p_source_index matrix from the container.
TRealMatrix & Get_dyudyn()
Get the dyudyn matrix from the container.
TRealMatrix & Get_pml_y_sgy()
Get the pml_y_sgy matrix from the container.
TRealMatrix & Get_pml_y()
Get the pml_y matrix from the container.
TIndexMatrix & Get_u_source_index()
Get the u_source_index matrix from the container.
double GetCumulatedTotalTime() const
Get total simulation time cumulated over all legs.
TIndexMatrix & Get_sensor_mask_corners()
Get the sensor_mask_corners matrix from the container.
TRealMatrix & Get_duxdx()
Get the duxdx matrix from the container.
Class implementing the matrix container.
TRealMatrix & Get_Temp_1_RS3D()
Get the Temp_1_RS3D matrix from the container.
The header file with the class for complex matrices.
TFFTWComplexMatrix & Get_FFT_Z_temp()
Get the FFT_Z_temp from the container.
The class for real matrices.
TRealMatrix & Get_dt_rho0_sgx()
Get the dt.*rho0_sgx matrix from the container.
double GetCumulatedPostProcessingTime() const
Get post-processing time cumulated over all legs.
The class for 64b unsigned integers (indices). It is used for sensor_mask_index or sensor_corners_mas...
Class measuring elapsed time.
TTimeMeasure PreProcessingTime
Pre-processing time of the simulation.
string GetCodeName()
Get code name.
The header file containing the matrix container.
double GetCumulatedSimulationTime() const
Get simulation time (time loop) cumulated over all legs.
TFFTWComplexMatrix & Get_FFT_Y_temp()
Get the FFT_Y_temp from the container.
TTimeMeasure IterationTime
Iteration time of the simulation.
TRealMatrix & Get_duzdz()
Get the duzdz matrix from the container.
TRealMatrix & Get_Temp_2_RS3D()
Get the Temp_2_RS3D matrix from the container.
TRealMatrix & Get_rhoz()
Get the rhoz matrix from the container.
TComplexMatrix & Get_ddx_k_shift_neg()
Get the ddx_k_shift_neg matrix from the container.
double GetCumulatedDataLoadTime() const
Get data load time cumulated over all legs.
double GetPostProcessingTime() const
Get post-processing time.
TComplexMatrix & Get_ddy_k_shift_neg()
Get the ddy_k_shift_neg matrix from the container.
double GetCumulatedPreProcessingTime() const
Get pre-processing time cumulated over all legs.
TComplexMatrix & Get_ddx_k_shift_pos()
Get the ddx_k_shift_pos matrix from the container.
Tuxyz_sgxyzMatrix & Get_ux_shifted()
Get the ux_shifted matrix from the container.
TRealMatrix & Get_pml_x_sgx()
Get the pml_x_sgx matrix from the container.
double GetDataLoadTime() const
Get data load time.
TRealMatrix & Get_rhox()
Get the rhox matrix from the container.
The class for complex matrices.
size_t ActPercent
Percentage of the simulation done.
Class responsible for running the k-space first order 3D method.
TComplexMatrix & Get_y_shift_neg_r()
Get the y_shift_neg_r from the container.
TRealMatrix & Get_rhoy()
Get the rhoy matrix from the container.
A container for output streams.
TRealMatrix & Get_absorb_eta()
Get the absorb_eta matrix from the container.
The header file containing the class that implements 3D FFT using the FFTW interface.
TRealMatrix & Get_uy_source_input()
Get the uy_source_input matrix from the container.