Skip to content

Commit d693a9c

Browse files
committed
source code cleaning
1 parent 4d304e0 commit d693a9c

14 files changed

+161
-161
lines changed

src/generate_databases/read_parameters.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,16 @@ subroutine read_parameters()
196196
! else
197197
! write(IMAIN,*) 'using a CMTSOLUTION source'
198198
! endif
199-
if(.not. USE_CMT_AND_FORCE_SOURCE) then
199+
if (.not. USE_CMT_AND_FORCE_SOURCE) then
200200
if (USE_FORCE_POINT_SOURCE) then
201201
write(IMAIN,*) 'using a FORCESOLUTION source instead of a CMTSOLUTION source'
202202
else
203203
write(IMAIN,*) 'using a CMTSOLUTION source'
204204
endif
205-
else
205+
else
206206
write(IMAIN,*) 'using both a FORCESOLUTION and a CMTSOLUTION source'
207207
endif
208-
208+
209209
if (USE_RICKER_TIME_FUNCTION) then
210210
write(IMAIN,*) ' with a Ricker source time function'
211211
else
@@ -215,13 +215,13 @@ subroutine read_parameters()
215215
! else
216216
! write(IMAIN,*) ' with a Gaussian source time function'
217217
! endif
218-
if(USE_CMT_AND_FORCE_SOURCE) then
218+
if (USE_CMT_AND_FORCE_SOURCE) then
219219
write(IMAIN,*) ' CMTSOLUTION with a quasi-Heaviside source time function'
220220
write(IMAIN,*) ' FORCESOLUTION with a Gaussian source time function'
221-
else
221+
else
222222
if (USE_FORCE_POINT_SOURCE) then
223223
write(IMAIN,*) ' with a quasi-Heaviside source time function'
224-
else
224+
else
225225
write(IMAIN,*) ' with a Gaussian source time function'
226226
endif
227227
endif

src/gpu/smooth_pde_cuda.cu

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void FC_FUNC_(prepare_smooth_pde_gpu,
1717
Mesh* mp = (Mesh*)(*Mesh_pointer);
1818
Smooth_pde_data* sp = (Smooth_pde_data*) malloc(sizeof(Smooth_pde_data));
1919
*Container_smooth_pde = (long)sp;
20-
20+
2121
gpuCreateCopy_todevice_realw((void**)&sp->d_dat_smooth_glob, dat_smooth_glob, mp->NGLOB_AB);
2222
gpuMalloc_field((void**)&sp->d_ddat_smooth_glob, mp->NGLOB_AB);
2323
// initializes values to zero
@@ -70,8 +70,8 @@ void FC_FUNC_(compute_update_element_smooth_pde_gpu,
7070
mp->xix_regular,mp->jacobian_regular,
7171
mp->d_hprime_xx,
7272
mp->d_hprimewgll_xx,
73-
mp->d_wgllwgll_xy,
74-
mp->d_wgllwgll_xz,
73+
mp->d_wgllwgll_xy,
74+
mp->d_wgllwgll_xz,
7575
mp->d_wgllwgll_yz,
7676
sp->cv, sp->ch
7777
);
@@ -94,8 +94,8 @@ void FC_FUNC_(compute_update_element_smooth_pde_gpu,
9494
mp->xix_regular,mp->jacobian_regular,
9595
mp->d_hprime_xx,
9696
mp->d_hprimewgll_xx,
97-
mp->d_wgllwgll_xy,
98-
mp->d_wgllwgll_xz,
97+
mp->d_wgllwgll_xy,
98+
mp->d_wgllwgll_xz,
9999
mp->d_wgllwgll_yz,
100100
sp->cv, sp->ch
101101
);
@@ -114,7 +114,7 @@ void FC_FUNC_(transfer_boun_dat_smooth_pde_from_device,
114114
TRACE("transfer_boun_dat_smooth_pde_from_device");
115115
Mesh* mp = (Mesh*)(*Mesh_pointer);
116116
Smooth_pde_data* sp = (Smooth_pde_data*)(*Container_smooth_pde);
117-
117+
118118
if (sp->size_mpi_buffer_smooth > 0) {
119119
int blocksize = BLOCKSIZE_TRANSFER;
120120
int size_padded = ((int)ceil(((double)(mp->max_nibool_interfaces_ext_mesh))/((double)blocksize)))*blocksize;
@@ -152,7 +152,7 @@ void FC_FUNC_(transfer_boun_dat_smooth_pde_from_device,
152152
// copies buffer to CPU
153153
gpuMemcpy_tohost_field(send_buffer_smooth,sp->d_send_buffer,sp->size_mpi_buffer_smooth);
154154
}
155-
155+
156156
GPU_ERROR_CHECKING("transfer_boun_dat_smooth_pde_from_device");
157157
}
158158

@@ -162,7 +162,7 @@ void FC_FUNC_(transfer_asmbl_dat_smooth_pde_from_device,
162162
long * Container_smooth_pde,
163163
field * recv_buffer_smooth){
164164
TRACE("transfer_asmbl_dat_smooth_pde_from_device");
165-
165+
166166
Mesh* mp = (Mesh*)(*Mesh_pointer);
167167
Smooth_pde_data* sp = (Smooth_pde_data*)(*Container_smooth_pde);
168168

@@ -244,7 +244,7 @@ void FC_FUNC_(kernel_3_smooth_pde_cuda,
244244
sp->d_rvol,
245245
size);
246246
}
247-
#endif
247+
#endif
248248

249249
GPU_ERROR_CHECKING("kernel_3_smooth_pde_cuda");
250250
}
@@ -295,7 +295,7 @@ void FC_FUNC_(zero_pml_smooth_pde_cuda,
295295
ZERO_PML_SMOOTH_PDE_CUDA)(long * Mesh_pointer,
296296
long * Container_smooth_pde) {
297297
TRACE("zero_pml_smooth_pde_cuda");
298-
298+
299299
Mesh* mp = (Mesh*)(*Mesh_pointer);
300300
Smooth_pde_data* sp = (Smooth_pde_data*)(*Container_smooth_pde);
301301

@@ -325,7 +325,7 @@ void FC_FUNC_(zero_pml_smooth_pde_cuda,
325325
mp->d_ibool,
326326
sp->d_CPML_to_spec);
327327
}
328-
#endif
328+
#endif
329329

330330
GPU_ERROR_CHECKING("zero_pml_smooth_pde_cuda");
331331
}
@@ -429,5 +429,5 @@ void FC_FUNC_(transfer_dat_smooth_pde_from_device,
429429
gpuMemcpy_tohost_realw(dat_smooth_glob, sp->d_dat_smooth_glob, mp->NGLOB_AB);
430430

431431
GPU_ERROR_CHECKING("transfer_dat_smooth_pde_from_device");
432-
432+
433433
}

src/shared/count_number_of_sources.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ subroutine count_number_of_sources_by_type(NSOURCES,sources_filename,source_is_f
197197

198198
! get the number of lines describing the sources
199199
!if (USE_FORCE_POINT_SOURCE) then
200-
if(source_is_force) then
200+
if (source_is_force) then
201201
! FORCESOLUTION
202202
nlines_per_source = NLINES_PER_FORCESOLUTION_SOURCE
203203
else
@@ -233,7 +233,7 @@ subroutine count_number_of_sources_by_type(NSOURCES,sources_filename,source_is_f
233233
! checks lines are a multiple
234234
if (mod(icounter,nlines_per_source) /= 0) then
235235
!if (USE_FORCE_POINT_SOURCE) then
236-
if(source_is_force) then
236+
if (source_is_force) then
237237
print *,'Error: total number of lines in FORCESOLUTION file should be a multiple of ',nlines_per_source
238238
stop 'Error total number of lines in FORCESOLUTION file should be a multiple of NLINES_PER_FORCESOLUTION_SOURCE'
239239
else
@@ -261,15 +261,15 @@ end subroutine count_number_of_sources_by_type
261261

262262
! NQDU for binary source file
263263
subroutine count_number_of_sources_binary(ns_cmt,ns_force,sources_filename)
264-
use constants, only : MAX_STRING_LEN
264+
use constants, only: MAX_STRING_LEN
265265
implicit none
266266
integer,intent(inout) :: ns_cmt,ns_force
267-
character(len=MAX_STRING_LEN),intent(in) :: sources_filename
267+
character(len=MAX_STRING_LEN),intent(in) :: sources_filename
268268

269269
! local
270270
integer,parameter :: IO_SOURCE = 12341
271271

272-
open(IO_SOURCE,file=trim(sources_filename),form='unformatted',&
272+
open(IO_SOURCE,file=trim(sources_filename),form='unformatted', &
273273
action='read',access='stream')
274274
read(IO_SOURCE) ns_cmt
275275
read(IO_SOURCE) ns_force

src/shared/read_parameter_file.F90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,14 @@ subroutine read_parameter_file(BROADCAST_AFTER_READ)
426426
! read two flags in CMT + FORCE simulation
427427
call read_value_logical(USE_CMT_AND_FORCE_SOURCE, 'USE_CMT_AND_FORCE_SOURCE', ier)
428428
ier = 0
429-
if (USE_CMT_AND_FORCE_SOURCE) then
429+
if (USE_CMT_AND_FORCE_SOURCE) then
430430
! write(*,'(a)') 'cmt + force simulation is enabled'
431431
USE_FORCE_POINT_SOURCE = .true.
432432
endif
433433

434434
call read_value_logical(USE_BINARY_SOURCE_FILE, 'USE_BINARY_SOURCE_FILE', ier)
435435
ier = 0
436-
if(.not. USE_CMT_AND_FORCE_SOURCE) USE_BINARY_SOURCE_FILE = .false. ! binary file is disabled
436+
if (.not. USE_CMT_AND_FORCE_SOURCE) USE_BINARY_SOURCE_FILE = .false. ! binary file is disabled
437437

438438
call read_value_logical(USE_RICKER_TIME_FUNCTION, 'USE_RICKER_TIME_FUNCTION', ier)
439439
if (ier /= 0) then
@@ -850,8 +850,8 @@ subroutine read_parameter_file(BROADCAST_AFTER_READ)
850850
endif
851851

852852
! inverse problem is enabled, disable USE_CMT_AND_FORCE/USE_BINARY_SOURCE_FILE
853-
if(INVERSE_FWI_FULL_PROBLEM .and. (USE_CMT_AND_FORCE_SOURCE)) then
854-
if(myrank == 0) then
853+
if (INVERSE_FWI_FULL_PROBLEM .and. (USE_CMT_AND_FORCE_SOURCE)) then
854+
if (myrank == 0) then
855855
write(*,'(a)') 'INVERSE_FWI_FULL_PROBLEM is enabled, disabling USE_CMT_AND_FORCE_SOURCE'
856856
write(*,*)
857857
endif
@@ -1258,8 +1258,8 @@ subroutine read_compute_parameters()
12581258
else
12591259
! gets number of sources
12601260
!NQDU call count_number_of_sources(NSOURCES,sources_filename)
1261-
if(USE_CMT_AND_FORCE_SOURCE) then
1262-
if(.not. USE_BINARY_SOURCE_FILE) then
1261+
if (USE_CMT_AND_FORCE_SOURCE) then
1262+
if (.not. USE_BINARY_SOURCE_FILE) then
12631263
! Force
12641264
sources_filename = path_to_add(1:len_trim(path_to_add)) // &
12651265
IN_DATA_FILES(1:len_trim(IN_DATA_FILES))//'FORCESOLUTION'
@@ -1269,17 +1269,17 @@ subroutine read_compute_parameters()
12691269
sources_filename = path_to_add(1:len_trim(path_to_add)) // &
12701270
IN_DATA_FILES(1:len_trim(IN_DATA_FILES))//'CMTSOLUTION'
12711271
call count_number_of_sources_by_type(NSOURCES_CMT,sources_filename,.false.)
1272-
else
1272+
else
12731273
sources_filename = path_to_add(1:len_trim(path_to_add)) // &
12741274
IN_DATA_FILES(1:len_trim(IN_DATA_FILES))//'SOLUTION.bin'
12751275
call count_number_of_sources_binary(NSOURCES_CMT,NSOURCES_FORCE,sources_filename)
12761276
endif
12771277
NSOURCES = NSOURCES_CMT + NSOURCES_FORCE
1278-
else
1278+
else
12791279
NSOURCES_CMT = 0
12801280
NSOURCES_FORCE = 0
12811281
call count_number_of_sources_by_type(NSOURCES,sources_filename,USE_FORCE_POINT_SOURCE)
1282-
if(USE_FORCE_POINT_SOURCE) then
1282+
if (USE_FORCE_POINT_SOURCE) then
12831283
NSOURCES_FORCE = NSOURCES
12841284
else
12851285
NSOURCES_CMT = NSOURCES

src/shared/shared_par.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ module shared_input_parameters
169169
logical :: HAS_FINITE_FAULT_SOURCE
170170

171171
! cmt + point force simulation
172-
logical :: USE_CMT_AND_FORCE_SOURCE = .false.
172+
logical :: USE_CMT_AND_FORCE_SOURCE = .false.
173173
logical :: USE_BINARY_SOURCE_FILE = .false.
174174

175175
! external source time function
@@ -234,7 +234,7 @@ module shared_compute_parameters
234234
integer :: NSOURCES
235235

236236
!number of sources in CMTSOLUTION/FORCESOLUTION
237-
integer :: NSOURCES_CMT, NSOURCES_FORCE
237+
integer :: NSOURCES_CMT, NSOURCES_FORCE
238238

239239
! anchor points
240240
integer :: NGNOD2D

src/specfem3D/comp_source_time_function.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ end function comp_source_time_function_mono
400400
double precision function comp_source_time_function_ext(it_index,isource)
401401

402402
use specfem_par, only: myrank, NSTEP, user_source_time_function
403-
use specfem_par, only : USE_BINARY_SOURCE_FILE,isource_glob2loc
403+
use specfem_par, only: USE_BINARY_SOURCE_FILE,isource_glob2loc
404404

405405
implicit none
406406

@@ -418,7 +418,7 @@ double precision function comp_source_time_function_ext(it_index,isource)
418418
endif
419419

420420
! gets stored STF
421-
if(.not. USE_BINARY_SOURCE_FILE) then
421+
if (.not. USE_BINARY_SOURCE_FILE) then
422422
comp_source_time_function_ext = user_source_time_function(it_index,isource)
423423
else
424424
comp_source_time_function_ext = user_source_time_function(it_index,isource_glob2loc(isource))

src/specfem3D/compute_add_sources_acoustic.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ subroutine compute_add_sources_acoustic_GPU()
437437
use specfem_par, only: FAULT_SIMULATION
438438

439439
!
440-
use specfem_par,only : islice_selected_source
440+
use specfem_par, only: islice_selected_source
441441

442442
implicit none
443443

@@ -483,7 +483,7 @@ subroutine compute_add_sources_acoustic_GPU()
483483

484484
! determines source time function value
485485
stf = 0.
486-
if(myrank == islice_selected_source(isource)) &
486+
if (myrank == islice_selected_source(isource)) &
487487
stf = get_stf_acoustic(time_source_dble,isource,it)
488488

489489
! stores precomputed source time function factor
@@ -602,7 +602,7 @@ subroutine compute_add_sources_acoustic_backward_GPU()
602602
! faults
603603
use specfem_par, only: FAULT_SIMULATION
604604

605-
use specfem_par,only: islice_selected_source
605+
use specfem_par, only: islice_selected_source
606606

607607
implicit none
608608

@@ -703,8 +703,8 @@ subroutine compute_add_sources_acoustic_backward_GPU()
703703
time_source_dble = time_t - tshift_src(isource)
704704

705705
! determines source time function value
706-
stf = 0.0d0
707-
if(myrank == islice_selected_source(isource)) &
706+
stf = 0.0d0
707+
if (myrank == islice_selected_source(isource)) &
708708
stf = get_stf_acoustic(time_source_dble,isource,NSTEP-it_tmp+1)
709709

710710
! stores precomputed source time function factor
@@ -762,7 +762,7 @@ double precision function get_stf_acoustic(time_source_dble,isource,it_tmp_ext)
762762

763763
! determines source time function value
764764
!NQDU if (USE_FORCE_POINT_SOURCE) then
765-
if(is_POINTFORCE(isource)) then
765+
if (is_POINTFORCE(isource)) then
766766
! single point force
767767
select case(force_stf(isource))
768768
case (0)

src/specfem3D/compute_add_sources_poroelastic.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ subroutine compute_add_sources_poroelastic()
135135
! we distinguish between a single force which can be applied both in fluid and solid
136136
! and a moment-tensor source which only makes sense for a solid
137137
!if (USE_FORCE_POINT_SOURCE) then
138-
if(is_POINTFORCE(isource)) then
138+
if (is_POINTFORCE(isource)) then
139139
! single point force
140140
! the source is applied to both solid and fluid phase: bulk source.
141141
fac_s = 1._CUSTOM_REAL - phil/tortl
@@ -363,7 +363,7 @@ subroutine compute_add_sources_poroelastic()
363363
! we distinguish between a single force which can be applied both in fluid and solid
364364
! and a moment-tensor source which only makes sense for a solid
365365
!if (USE_FORCE_POINT_SOURCE) then
366-
if(is_POINTFORCE(isource)) then
366+
if (is_POINTFORCE(isource)) then
367367
! single point force
368368
! the source is applied to both solid and fluid phase: bulk source.
369369
fac_s = 1._CUSTOM_REAL - phil/tortl
@@ -434,7 +434,7 @@ double precision function get_stf_poroelastic(time_source_dble,isource,it_tmp_ex
434434

435435
! determines source time function value
436436
!if (USE_FORCE_POINT_SOURCE) then
437-
if(is_POINTFORCE(isource)) then
437+
if (is_POINTFORCE(isource)) then
438438
! single point force
439439
select case(force_stf(isource))
440440
case (0)

src/specfem3D/compute_add_sources_viscoelastic.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ subroutine compute_add_sources_viscoelastic_GPU()
495495
islice_selected_rec, &
496496
nadj_rec_local,source_adjoint,nadj_rec_local,number_adjsources_global, &
497497
Mesh_pointer
498-
499-
use specfem_par,only : islice_selected_source
498+
499+
use specfem_par, only: islice_selected_source
500500

501501
use specfem_par_noise, only: irec_main_noise,noise_surface_movie
502502

@@ -572,7 +572,7 @@ subroutine compute_add_sources_viscoelastic_GPU()
572572

573573
! determines source time function value
574574
stf = 0.0d0
575-
if(myrank == islice_selected_source(isource)) &
575+
if (myrank == islice_selected_source(isource)) &
576576
stf = get_stf_viscoelastic(time_source_dble,isource,it)
577577

578578
! LTS
@@ -733,7 +733,7 @@ subroutine compute_add_sources_viscoelastic_backward_GPU()
733733
! faults
734734
use specfem_par, only: FAULT_SIMULATION
735735

736-
use specfem_par,only : islice_selected_source
736+
use specfem_par, only: islice_selected_source
737737

738738
implicit none
739739

@@ -807,7 +807,7 @@ subroutine compute_add_sources_viscoelastic_backward_GPU()
807807

808808
! determines source time function value
809809
stf = 0.0d0
810-
if(myrank == islice_selected_source(isource)) &
810+
if (myrank == islice_selected_source(isource)) &
811811
stf = get_stf_viscoelastic(time_source_dble,isource,NSTEP-it_tmp+1)
812812

813813
! stores precomputed source time function factor
@@ -880,7 +880,7 @@ double precision function get_stf_viscoelastic(time_source_dble,isource,it_tmp_e
880880

881881
! determines source time function value
882882
!if (USE_FORCE_POINT_SOURCE) then
883-
if(is_POINTFORCE(isource)) then
883+
if (is_POINTFORCE(isource)) then
884884
! single point force
885885
select case(force_stf(isource))
886886
case (0)

src/specfem3D/finalize_simulation.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ subroutine finalize_simulation_cleanup()
184184
deallocate(utm_x_source,utm_y_source)
185185
deallocate(nu_source)
186186
deallocate(user_source_time_function)
187-
if(allocated(is_POINTFORCE)) deallocate(is_POINTFORCE)
188-
if(allocated(isource_glob2loc)) deallocate(isource_glob2loc)
187+
if (allocated(is_POINTFORCE)) deallocate(is_POINTFORCE)
188+
if (allocated(isource_glob2loc)) deallocate(isource_glob2loc)
189189
endif
190190

191191
! receivers

0 commit comments

Comments
 (0)