| kspaceFirstOrder3D-OMP 1.0 The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Classes
- Files

- File List
- File Members

KSpaceSolver/KSpaceFirstOrder3DSolver.h
Go to the documentation of this file.

    00001
    00030 #ifndef TKSPACE3DSOLVER_H
    00031 #define  TKSPACE3DSOLVER_H
    00032
    00033 #include <fftw3.h>
    00034
    00035 #include <Parameters/Parameters.h>
    00036
    00037 #include <MatrixClasses/MatrixContainer.h>
    00038 #include <MatrixClasses/RealMatrix.h>
    00039 #include <MatrixClasses/ComplexMatrix.h>
    00040 #include <MatrixClasses/LongMatrix.h>
    00041 #include <MatrixClasses/OutputHDF5Stream.h>
    00042 #include <MatrixClasses/UXYZ_SGXYZMatrix.h>
    00043 #include <MatrixClasses/FFTWComplexMatrix.h>
    00044
    00045 #include <Utils/TimeMeasure.h>
    00046
    00047 using namespace std;
    00048
    00049
    00050
    00056 class TKSpaceFirstOrder3DSolver {
    00057 public:
    00059     TKSpaceFirstOrder3DSolver();
    00060
    00062     virtual ~TKSpaceFirstOrder3DSolver();
    00063
    00064
    00066     virtual void AllocateMemory();
    00068     virtual void FreeMemory();
    00069
    00071     virtual void LoadInputData();
    00072
    00074     virtual void Compute();
    00075
    00077     virtual void PrintParametersOfSimulation(FILE * file);
    00078
    00080     virtual size_t ShowMemoryUsageInMB();
    00081
    00083     string GetCodeName() {return "kspaceFirstOrder3D-OMP v1.0"; };
    00084
    00086     void   PrintFullNameCodeAndLicense(FILE * file);
    00087
    00089     double GetTotalTime()          const { return TotalTime.GetElapsedTime();         };
    00090
    00092     double GetPreProcessingTime()  const { return PreProcessingTime.GetElapsedTime();   };
    00093
    00095     double GetDataLoadTime()       const { return DataLoadTime.GetElapsedTime();      };
    00096
    00098     double GetSimulationTime()     const { return SimulationTime.GetElapsedTime();    };
    00099
    00101     double GetPostProcessingTime() const { return PostProcessingTime.GetElapsedTime();};
    00102
    00103
    00104 protected:
    00105
    00107     TKSpaceFirstOrder3DSolver(const TKSpaceFirstOrder3DSolver& src);
    00109     TKSpaceFirstOrder3DSolver& operator = (const TKSpaceFirstOrder3DSolver & src);
    00110
    00112     void InitializeFFTWPlans();
    00113
    00115     void PreProcessingPhase();
    00116
    00118     void Compute_MainLoop();
    00119
    00121     void PostPorcessing();
    00122
    00124     void StoreSensorData();
    00126     void StoreIntensityData();
    00127
    00129     void WriteOutputDataInfo();
    00130
    00131
    00133     void Compute_uxyz();
    00134
    00136     void Compute_duxyz();
    00137
    00138
    00140     void Compute_rhoxyz_nonlinear();
    00142     void Compute_rhoxyz_linear();
    00143
    00145     void Add_u_source();
    00146
    00148     void Add_p_source();
    00149
    00150
    00152     void Generate_kappa();
    00153
    00155     void Generate_kappa_absorb_nabla1_absorb_nabla2();
    00156
    00158     void Generate_absorb_tau_absorb_eta_matrix();
    00159
    00161     void Caclucalte_dt_rho0_non_uniform();
    00162
    00164     void Calculate_p0_source();
    00165
    00167     void Compute_c2();
    00168
    00170     void Compute_ddx_kappa_fft_p(TRealMatrix& X_Matrix,
    00171                                  TFFTWComplexMatrix& FFT_X, TFFTWComplexMatrix& FFT_Y, TFFTWComplexMatrix& FFT_Z,
    00172                                  TRealMatrix& kappa,
    00173                                  TComplexMatrix & ddx, TComplexMatrix & ddy, TComplexMatrix & ddz);
    00174
    00176     void Compute_new_p_nonlinear();
    00178     void Compute_new_p_linear();
    00179
    00180
    00182     void Calculate_SumRho_BonA_SumDu_SSE2(TRealMatrix & RHO_Temp, TRealMatrix & BonA_Temp, TRealMatrix & Sum_du);
    00184     void Calculate_SumRho_SumRhoDu(TRealMatrix & Sum_rhoxyz, TRealMatrix & Sum_rho0_du);
    00185
    00187     void Compute_Absorb_nabla1_2_SSE2(TFFTWComplexMatrix& FFT_1, TFFTWComplexMatrix& FFT_2);
    00188
    00190     void Sum_Subterms_nonlinear(TRealMatrix& Absorb_tau_temp, TRealMatrix& Absorb_eta_temp, TRealMatrix& BonA_temp);
    00191
    00193     void Sum_Subterms_linear(TRealMatrix& Absorb_tau_temp, TRealMatrix& Absorb_eta_temp, TRealMatrix& Sum_rhoxyz);
    00194
    00196     void Sum_new_p_nonlinear_lossless();
    00198     void Sum_new_p_linear_lossless();
    00199
    00200
    00202     void PrintStatisitcs();
    00203
    00205     void PrintOtputHeader();
    00206
    00207
    00208
    00209      //------------------------- Get matrices --------------------------------//
    00211     TRealMatrix       & Get_kappa()
    00212                 {return MatrixContainer.GetRealMatrix(kappa);};
    00214     TRealMatrix       & Get_c2()
    00215                 {return MatrixContainer.GetRealMatrix(c2);};
    00217     TRealMatrix       & Get_p()
    00218                 {return MatrixContainer.GetRealMatrix(p);};
    00219
    00221     Tuxyz_sgxyzMatrix & Get_ux_sgx()
    00222                 {return MatrixContainer.GetUxyz_sgxyzMatrix(ux_sgx);};
    00224     Tuxyz_sgxyzMatrix & Get_uy_sgy()
    00225                 {return MatrixContainer.GetUxyz_sgxyzMatrix(uy_sgy);};
    00227     Tuxyz_sgxyzMatrix & Get_uz_sgz()
    00228                 {return MatrixContainer.GetUxyz_sgxyzMatrix(uz_sgz);};
    00229
    00231     TRealMatrix       & Get_duxdx()
    00232                 {return MatrixContainer.GetRealMatrix(duxdx);};
    00234     TRealMatrix       & Get_duydy()
    00235                 {return MatrixContainer.GetRealMatrix(duydy);};
    00237     TRealMatrix       & Get_duzdz()
    00238                 {return MatrixContainer.GetRealMatrix(duzdz);};
    00239
    00241     TRealMatrix       & Get_dt_rho0_sgx()
    00242                 {return MatrixContainer.GetRealMatrix(dt_rho0_sgx);};
    00244     TRealMatrix       & Get_dt_rho0_sgy()
    00245                 {return MatrixContainer.GetRealMatrix(dt_rho0_sgy);};
    00247     TRealMatrix       & Get_dt_rho0_sgz()
    00248                 {return MatrixContainer.GetRealMatrix(dt_rho0_sgz);};
    00249
    00250
    00251
    00253     TRealMatrix        & Get_rhox()
    00254                 {return MatrixContainer.GetRealMatrix(rhox);};
    00256     TRealMatrix        & Get_rhoy()
    00257                 {return MatrixContainer.GetRealMatrix(rhoy);};
    00259     TRealMatrix        & Get_rhoz()
    00260                 {return MatrixContainer.GetRealMatrix(rhoz);};
    00262     TRealMatrix        & Get_rho0()
    00263                 {return MatrixContainer.GetRealMatrix(rho0);};
    00264
    00266     TComplexMatrix     & Get_ddx_k_shift_pos()
    00267                 {return MatrixContainer.GetComplexMatrix(ddx_k_shift_pos);};
    00269     TComplexMatrix     & Get_ddy_k_shift_pos()
    00270                 {return MatrixContainer.GetComplexMatrix(ddy_k_shift_pos);};
    00272     TComplexMatrix     & Get_ddz_k_shift_pos()
    00273                 {return MatrixContainer.GetComplexMatrix(ddz_k_shift_pos);};
    00275     TComplexMatrix     & Get_ddx_k_shift_neg()
    00276                 {return MatrixContainer.GetComplexMatrix(ddx_k_shift_neg);};
    00278     TComplexMatrix     & Get_ddy_k_shift_neg()
    00279                 {return MatrixContainer.GetComplexMatrix(ddy_k_shift_neg);};
    00281     TComplexMatrix     & Get_ddz_k_shift_neg()
    00282                 {return MatrixContainer.GetComplexMatrix(ddz_k_shift_neg);};
    00283
    00284
    00286     TRealMatrix        & Get_pml_x_sgx()
    00287                 {return MatrixContainer.GetRealMatrix(pml_x_sgx);};
    00289     TRealMatrix        & Get_pml_y_sgy()
    00290                 {return MatrixContainer.GetRealMatrix(pml_y_sgy);};
    00292     TRealMatrix        & Get_pml_z_sgz()
    00293                 {return MatrixContainer.GetRealMatrix(pml_z_sgz);};
    00294
    00296     TRealMatrix        & Get_pml_x()
    00297                 {return MatrixContainer.GetRealMatrix(pml_x);};
    00299     TRealMatrix        & Get_pml_y()
    00300                 {return MatrixContainer.GetRealMatrix(pml_y);};
    00302     TRealMatrix        & Get_pml_z()
    00303                 {return MatrixContainer.GetRealMatrix(pml_z);};
    00304
    00305
    00307     TRealMatrix        & Get_dxudxn()
    00308                 {return MatrixContainer.GetRealMatrix(dxudxn);};
    00310     TRealMatrix        & Get_dyudyn()
    00311                 {return MatrixContainer.GetRealMatrix(dyudyn);};
    00313     TRealMatrix        & Get_dzudzn()
    00314                 {return MatrixContainer.GetRealMatrix(dzudzn);};
    00315
    00317     TRealMatrix        & Get_dxudxn_sgx()
    00318                 {return MatrixContainer.GetRealMatrix(dxudxn_sgx);};
    00320     TRealMatrix        & Get_dyudyn_sgy()
    00321                 {return MatrixContainer.GetRealMatrix(dyudyn_sgy);};
    00323     TRealMatrix        & Get_dzudzn_sgz()
    00324                 {return MatrixContainer.GetRealMatrix(dzudzn_sgz);};
    00325
    00326
    00328     TRealMatrix        & Get_BonA()
    00329                 {return MatrixContainer.GetRealMatrix(BonA);};
    00331     TRealMatrix        & Get_absorb_tau()
    00332                 {return MatrixContainer.GetRealMatrix(absorb_tau);};
    00334     TRealMatrix        & Get_absorb_eta()
    00335                 {return MatrixContainer.GetRealMatrix(absorb_eta);};
    00336
    00338     TRealMatrix        & Get_absorb_nabla1()
    00339                 {return MatrixContainer.GetRealMatrix(absorb_nabla1);};
    00341     TRealMatrix        & Get_absorb_nabla2()
    00342                 {return MatrixContainer.GetRealMatrix(absorb_nabla2);};
    00343
    00344
    00345    //-- Index matrices --//
    00346
    00348     TLongMatrix         & Get_sensor_mask_ind()
    00349                 {return MatrixContainer.GetLongMatrix(sensor_mask_ind);};
    00351     TLongMatrix         & Get_u_source_index()
    00352                 {return MatrixContainer.GetLongMatrix(u_source_index);};
    00354     TLongMatrix         & Get_p_source_index()
    00355                 {return MatrixContainer.GetLongMatrix(p_source_index);};
    00357     TLongMatrix         & Get_delay_mask(){
    00358          {return MatrixContainer.GetLongMatrix(delay_mask);};
    00359     }
    00360
    00361
    00362     //-- sources  --//
    00363
    00365     TRealMatrix         & Get_transducer_source_input()
    00366          {return MatrixContainer.GetRealMatrix(transducer_source_input);};
    00367
    00369     TRealMatrix         & Get_p_source_input()
    00370          {return MatrixContainer.GetRealMatrix(p_source_input);};
    00371
    00373     TRealMatrix          & Get_p0_source_input()
    00374                 {return MatrixContainer.GetRealMatrix(p0_source_input);};
    00375
    00376
    00378     TRealMatrix         & Get_ux_source_input()
    00379          {return MatrixContainer.GetRealMatrix(ux_source_input);};
    00381     TRealMatrix         & Get_uy_source_input()
    00382          {return MatrixContainer.GetRealMatrix(uy_source_input);};
    00384     TRealMatrix         & Get_uz_source_input()
    00385          {return MatrixContainer.GetRealMatrix(uz_source_input);};
    00386
    00387
    00388
    00389       //--Temporary matrices --//
    00390
    00392     TRealMatrix         & Get_Temp_1_RS3D()
    00393                 {return MatrixContainer.GetRealMatrix(Temp_1_RS3D);};
    00395     TRealMatrix         & Get_Temp_2_RS3D()
    00396                 {return MatrixContainer.GetRealMatrix(Temp_2_RS3D);};
    00398     TRealMatrix         & Get_Temp_3_RS3D()
    00399                 {return MatrixContainer.GetRealMatrix(Temp_3_RS3D);};
    00400
    00401         //--Sensor matrices --//
    00402
    00404     TRealMatrix         & Get_p_sensor_rms()
    00405                 {return MatrixContainer.GetRealMatrix(p_sensor_rms);};
    00407     TRealMatrix         & Get_p_sensor_max()
    00408                 {return MatrixContainer.GetRealMatrix(p_sensor_max);};
    00409
    00411     TRealMatrix         & Get_ux_sensor_rms()
    00412                 {return MatrixContainer.GetRealMatrix(ux_sensor_rms);};
    00414     TRealMatrix         & Get_uy_sensor_rms()
    00415                 {return MatrixContainer.GetRealMatrix(uy_sensor_rms);};
    00417     TRealMatrix         & Get_uz_sensor_rms()
    00418                 {return MatrixContainer.GetRealMatrix(uz_sensor_rms);};
    00419
    00421     TRealMatrix         & Get_ux_sensor_max()
    00422                 {return MatrixContainer.GetRealMatrix(ux_sensor_max);};
    00424     TRealMatrix         & Get_uy_sensor_max()
    00425                 {return MatrixContainer.GetRealMatrix(uy_sensor_max);};
    00427     TRealMatrix         & Get_uz_sensor_max()
    00428                 {return MatrixContainer.GetRealMatrix(uz_sensor_max);};
    00429
    00431     TRealMatrix         & Get_Ix_sensor_avg()
    00432                 {return MatrixContainer.GetRealMatrix(Ix_sensor_avg);};
    00434     TRealMatrix         & Get_Iy_sensor_avg()
    00435                 {return MatrixContainer.GetRealMatrix(Iy_sensor_avg);};
    00437     TRealMatrix         & Get_Iz_sensor_avg()
    00438                 {return MatrixContainer.GetRealMatrix(Iz_sensor_avg);};
    00439
    00441     TRealMatrix         & Get_Ix_sensor_max()
    00442                 {return MatrixContainer.GetRealMatrix(Ix_sensor_max);}
    00444     TRealMatrix         & Get_Iy_sensor_max()
    00445                 {return MatrixContainer.GetRealMatrix(Iy_sensor_max);}
    00447     TRealMatrix         & Get_Iz_sensor_max()
    00448                 {return MatrixContainer.GetRealMatrix(Iz_sensor_max);}
    00449
    00451     TRealMatrix         & Get_p_sensor_i_1_raw()
    00452                 {return MatrixContainer.GetRealMatrix(p_sensor_i_1_raw);}
    00454     TRealMatrix         & Get_ux_sensor_i_1_agr_2()
    00455                 {return MatrixContainer.GetRealMatrix(ux_sensor_i_1_agr_2);}
    00457     TRealMatrix         & Get_uy_sensor_i_1_agr_2()
    00458                 {return MatrixContainer.GetRealMatrix(uy_sensor_i_1_agr_2);}
    00460     TRealMatrix         & Get_uz_sensor_i_1_agr_2()
    00461                 {return MatrixContainer.GetRealMatrix(uz_sensor_i_1_agr_2);}
    00462
    00464     TFFTWComplexMatrix  & Get_FFT_X_temp()
    00465                 {return MatrixContainer.GetFFTWComplexMatrix(FFT_X_temp);};
    00467     TFFTWComplexMatrix  & Get_FFT_Y_temp()
    00468                 {return MatrixContainer.GetFFTWComplexMatrix(FFT_Y_temp);};
    00470     TFFTWComplexMatrix  & Get_FFT_Z_temp()
    00471                 {return MatrixContainer.GetFFTWComplexMatrix(FFT_Z_temp);};
    00472
    00473
    00474
    00475
    00477     TOutputHDF5Stream*  p_sensor_raw_OutputStream;
    00478
    00480     TOutputHDF5Stream*  ux_sensor_raw_OutputStream;
    00482     TOutputHDF5Stream*  uy_sensor_raw_OutputStream;
    00484     TOutputHDF5Stream*  uz_sensor_raw_OutputStream;
    00485
    00486
    00487
    00488
    00489 private:
    00490
    00492     TMatrixContainer MatrixContainer;
    00493
    00495     int                t_index;
    00496
    00498     int                ActPercent;
    00499
    00501     TParameters *      Parameters;
    00502
    00504     TTimeMesssure       TotalTime;
    00506     TTimeMesssure       PreProcessingTime;
    00508     TTimeMesssure       DataLoadTime;
    00510     TTimeMesssure       SimulationTime;
    00512     TTimeMesssure       PostProcessingTime;
    00514     TTimeMesssure       IterationTime;
    00515
    00516
    00517 };// end of  TKSpace3DSolver
    00518 //------------------------------------------------------------------------------
    00519
    00520 #endif   /* TKSPACE3DSOLVER_H */
    00521

All Classes Files Functions Variables Typedefs Enumerations