diff --git a/simpa/core/simulation_modules/acoustic_forward_module/simulate_2D.m b/simpa/core/simulation_modules/acoustic_forward_module/simulate_2D.m index e1255e16..55ebd510 100644 --- a/simpa/core/simulation_modules/acoustic_forward_module/simulate_2D.m +++ b/simpa/core/simulation_modules/acoustic_forward_module/simulate_2D.m @@ -147,11 +147,26 @@ datacast = 'single'; end +% Extract the filename from the optical path, add the current time in milliseconds, +% and add the process id to make the filename unique + +% Extract basename from the optical path +[~, basename, ~] = fileparts(optical_path); + +% Get current time in HH-mm-ss-SSS format +date_str = char(datetime('now', 'Format', 'HH-mm-ss-SSS')); + +% Get the process id +pid = feature('GetPid'); + +% Construct the unique temporary path name +tmp_path_name = sprintf('kwave__%s__%s__%d', basename, date_str, pid); + input_args = {'DataCast', datacast, 'PMLInside', settings.pml_inside, ... 'PMLAlpha', settings.pml_alpha, 'PMLSize', 'auto', ... 'PlotPML', settings.plot_pml, 'RecordMovie', settings.record_movie, ... 'MovieName', settings.movie_name, 'PlotScale', [-1, 1], 'LogScale', settings.acoustic_log_scale, ... - 'Smooth', p0_smoothing}; + 'Smooth', p0_smoothing, 'DataName', tmp_path_name}; if settings.gpu == true time_series_data = kspaceFirstOrder2DG(kgrid, medium, source, sensor, input_args{:}); diff --git a/simpa/core/simulation_modules/acoustic_forward_module/simulate_3D.m b/simpa/core/simulation_modules/acoustic_forward_module/simulate_3D.m index 1772c0c8..6b0fe934 100644 --- a/simpa/core/simulation_modules/acoustic_forward_module/simulate_3D.m +++ b/simpa/core/simulation_modules/acoustic_forward_module/simulate_3D.m @@ -148,11 +148,26 @@ datacast = 'single'; end +% Extract the filename from the optical path, add the current time in milliseconds, +% and add the process id to make the filename unique + +% Extract basename from the optical path +[~, basename, ~] = fileparts(optical_path); + +% Get current time in HH-mm-ss-SSS format +date_str = char(datetime('now', 'Format', 'HH-mm-ss-SSS')); + +% Get the process id +pid = feature('GetPid'); + +% Construct the unique temporary path name +tmp_path_name = sprintf('kwave__%s__%s__%d', basename, date_str, pid); + input_args = {'DataCast', datacast, 'PMLInside', settings.pml_inside, ... 'PMLAlpha', double(settings.pml_alpha), 'PMLSize', 'auto', ... 'PlotPML', settings.plot_pml, 'RecordMovie', settings.record_movie, ... 'MovieName', settings.movie_name, 'PlotScale', [-1, 1], 'LogScale', settings.acoustic_log_scale, ... - 'Smooth', p0_smoothing}; + 'Smooth', p0_smoothing, 'DataName', tmp_path_name}; if settings.gpu == true time_series_data = kspaceFirstOrder3DG(kgrid, medium, source, sensor, input_args{:});