Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/adjust_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ subroutine adjust_data_codeunits
dat(:,1,1) = dat(:,1,1) - period*int(dat(:,1,1)/period)
endif

get_h = lenvironment('SPLASH_GETH')
if (.not.get_h) get_h = lenvironment('SPLASH_GET_H')
!
!--recompute smoothing lengths (--geth / --get_h)
!
get_h = get_command_flag('geth')
if (.not.get_h) get_h = get_command_flag('get_h')
if (ndim >= 1 .and. get_h) then
call get_h_on_all_particles(dat,npartoftype,nstepsinfile(ifileopen),ndim,ncolumns)
endif
Expand Down Expand Up @@ -619,4 +622,4 @@ subroutine get_h_on_all_particles(dat,npartoftype,nsteps,ndim,ncol)

end subroutine get_h_on_all_particles

end module adjustdata
end module adjustdata
8 changes: 4 additions & 4 deletions src/allocate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ subroutine alloc(npartin,nstep,ncolumnsin,mixedtypes)
!
!--type array if necessary
!
if (.not.allocated(iamtypetemp)) allocate(iamtypetemp(0,0)) ! to avoid compiler warning
if (present(mixedtypes)) then
if (mixedtypes .and. .not.allocated(iamtype)) then
allocate(iamtype(maxpart,maxstep), stat=ierr)
Expand All @@ -189,7 +190,6 @@ subroutine alloc(npartin,nstep,ncolumnsin,mixedtypes)
!--copy contents if reallocating
if (reallocate_itype) then
iamtype(1:maxpartold,1:maxstepold) = iamtypetemp(1:maxpartold,1:maxstepold)
deallocate(iamtypetemp)
endif
elseif (.not.mixedtypes) then
!--if called with mixedtypes explictly false, deallocate itype array
Expand All @@ -202,8 +202,8 @@ subroutine alloc(npartin,nstep,ncolumnsin,mixedtypes)
iamtype = 1

iamtype(1:maxpartold,1:maxstepold) = iamtypetemp(1:maxpartold,1:maxstepold)
deallocate(iamtypetemp)
endif
if (allocated(iamtypetemp)) deallocate(iamtypetemp)
!--make sure iamtype is always allocated for safety, just with size=1 if not used
if (.not.allocated(iamtype)) then
allocate(iamtype(1,maxstep),stat=ierr)
Expand Down Expand Up @@ -248,8 +248,8 @@ subroutine alloc(npartin,nstep,ncolumnsin,mixedtypes)
npartoftype(:,1:maxstepold) = npartoftypetemp(:,1:maxstepold)
masstype(:,1:maxstepold) = masstypetemp(:,1:maxstepold)
time(1:maxstepold) = timetemp(1:maxstepold)
gamma(1:maxstepold) = gammatemp(1:maxstepold)
headervals(:,1:maxstepold) = headervalstemp(:,1:maxstepold)
if (allocated(gammatemp)) gamma(1:maxstepold) = gammatemp(1:maxstepold)
if (allocated(headervalstemp)) headervals(:,1:maxstepold) = headervalstemp(:,1:maxstepold)
deallocate(npartoftypetemp,masstypetemp)
deallocate(timetemp,gammatemp)
deallocate(headervalstemp)
Expand Down
20 changes: 10 additions & 10 deletions src/asciiutils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module asciiutils
public :: string_replace,string_delete,get_nheaderlines,string_sub
public :: ucase,lcase,strip
public :: get_line_containing
public :: enumerate,isdigit,get_digits,integer_to_string,split
public :: enumerate,isdigit,get_digits,integer_to_string,split_string
public :: get_column_labels,read_column_labels
public :: match_tag,match_taglist,append_number,make_tags_unique,get_value
public :: match_column,match_tag_start,match_integer,match_lists
Expand Down Expand Up @@ -537,7 +537,7 @@ integer function ncolumnsline_csv(line,ntot) result(ncols)
real :: dum

! split line by commas
call split(line,',',fields,nfields)
call split_string(line,',',fields,nfields)

! report how many columns contain real numbers
! or blank (non-text) entries
Expand Down Expand Up @@ -573,7 +573,7 @@ subroutine readline_csv(line,ncols,datcol)
integer :: nfields,i,icol,ierr

! split line by commas
call split(line,',',fields,nfields)
call split_string(line,',',fields,nfields)

! read only columns that contain real numbers
icol = 0
Expand Down Expand Up @@ -1013,7 +1013,7 @@ end function enumerate
! Split a string into substrings based on a delimiter
!
!---------------------------------------------------------------------------
pure subroutine split(string,delim,stringarr,nsplit)
pure subroutine split_string(string,delim,stringarr,nsplit)
character(len=*), intent(in) :: string
character(len=*), intent(in) :: delim
character(len=*), intent(out), dimension(:), optional :: stringarr
Expand Down Expand Up @@ -1050,7 +1050,7 @@ pure subroutine split(string,delim,stringarr,nsplit)
i = iend + len(delim) + 1
enddo

end subroutine split
end subroutine split_string

!---------------------------------------------------------------------------
!
Expand Down Expand Up @@ -1095,15 +1095,15 @@ subroutine get_column_labels(line,nlabels,labels,method,ndesired,csv)
i1 = max(index(line,'[')+1,i1) ! strip leading square bracket
! try with different number of spaces between brackets (if labels not found)
over_spaces1: do i=4,0,-1
call split(line(i1:),']'//spaces(1:i)//'[',labels,nlabels)
call split_string(line(i1:),']'//spaces(1:i)//'[',labels,nlabels)
if (nlabels > 1) exit over_spaces1
enddo over_spaces1
elseif (index(line,',') > 1 .or. is_csv) then
!
! format style 2: mylabel1,mylabel2,mylabel3
!
istyle = 2
call split(line(i1:),',',labels,nlabelstmp)
call split_string(line(i1:),',',labels,nlabelstmp)
if (is_csv) then
nlabels = nlabelstmp ! allow blank/arbitrary labels in csv format
else
Expand All @@ -1117,7 +1117,7 @@ subroutine get_column_labels(line,nlabels,labels,method,ndesired,csv)
! try splitting with 4, then 3, then 2 spaces until the number of labels decreases
nlabels_prev = 0
over_spaces: do i=4,2,-1
call split(line(i1:),spaces(1:i),labels,nlabelstmp)
call split_string(line(i1:),spaces(1:i),labels,nlabelstmp)
! quit if we already have the target number of labels
if (nlabelstmp == ntarget) exit over_spaces

Expand All @@ -1126,7 +1126,7 @@ subroutine get_column_labels(line,nlabels,labels,method,ndesired,csv)
if ((nlabelstmp < nlabels_prev .or. nlabelstmp >= max(nlabels_prev,2) &
.and. i < 4 .and. .not. (ntarget > 0 .and. nlabelstmp > ntarget))) then
! take the answer with the previous number of spaces
call split(line(i1:),spaces(1:i+1),labels,nlabelstmp)
call split_string(line(i1:),spaces(1:i+1),labels,nlabelstmp)
exit over_spaces
endif
nlabels_prev = nlabelstmp
Expand All @@ -1142,7 +1142,7 @@ subroutine get_column_labels(line,nlabels,labels,method,ndesired,csv)
! (this style is also dangerous)
!
istyle = 4
call split(line(i1:),' ',labels,nlabelstmp)
call split_string(line(i1:),' ',labels,nlabelstmp)
nlabels = count_sensible_labels(nlabelstmp,labels)
endif
endif
Expand Down
22 changes: 13 additions & 9 deletions src/defaults.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ subroutine defaults_set(use_evdefaults)
use settings_xsecrot, only:defaults_set_xsecrotate
use settings_powerspec, only:defaults_set_powerspec
use settings_units, only:defaults_set_units
use settings_data, only:iverbose
use titles, only:pagetitles,steplegend
logical, intent(in) :: use_evdefaults
integer :: i
integer :: i,iverbose_save
!
!--set defaults for submenu options
!
iverbose_save = iverbose
call defaults_set_data
call defaults_set_limits
call defaults_set_page
Expand All @@ -66,7 +68,7 @@ subroutine defaults_set(use_evdefaults)
!--if using evsplash, override some default options
!
if (use_evdefaults) then
print "(a)",' ** ev mode: using default settings for .ev files **'
if (iverbose_save >= 0) print "(a)",' ** ev mode: using default settings for .ev files **'
call defaults_set_page_ev
call defaults_set_part_ev
endif
Expand Down Expand Up @@ -170,7 +172,7 @@ end subroutine defaults_write
subroutine defaults_read(filename)
use filenames, only:rootname,maxfile
use multiplot, only:multi
use settings_data, only:dataopts,idustfrac_plot,idefaults_file_read
use settings_data, only:dataopts,idustfrac_plot,idefaults_file_read,iverbose
use settings_part, only:plotopts
use settings_page, only:pageopts
use settings_render, only:renderopts
Expand Down Expand Up @@ -251,19 +253,21 @@ subroutine defaults_read(filename)
66 continue

close(unit=iunit)
if (nerr > 0) then
print "(a)",' WARNING: '//trim(filename)//' incomplete (from old code version)'
else
print*,'read '//trim(filename)
if (iverbose >= 0) then
if (nerr > 0) then
print "(a)",' WARNING: '//trim(filename)//' incomplete (from old code version)'
else
print*,'read '//trim(filename)
endif
endif
return
else
print*,trim(filename)//' not found: using default settings'
if (iverbose >= 0) print*,trim(filename)//' not found: using default settings'
return
endif

88 continue
print "(a)",' *** error opening defaults file '//trim(filename)//': using default settings'
if (iverbose >= 0) print "(a)",' *** error opening defaults file '//trim(filename)//': using default settings'

return
end subroutine defaults_read
Expand Down
25 changes: 14 additions & 11 deletions src/get_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ subroutine get_data(ireadfile,gotfilenames,firsttime,iposinfile)
if (present(firsttime)) isfirsttime = firsttime
if (debugmode) then
iverbose = 2
elseif (isfirsttime) then
iverbose = 1
else
iverbose = 0
elseif (iverbose >= 0) then
if (isfirsttime) then
iverbose = 1
else
iverbose = 0
endif
endif

! ipos is the offset for *which* timestep to read from files containing multiple steps
Expand Down Expand Up @@ -122,7 +124,7 @@ subroutine get_data(ireadfile,gotfilenames,firsttime,iposinfile)
!
nstepsinfile(1:nfiles) = 0
required = .true.
print "(/a)",' reading ALL dumpfiles into memory'
if (iverbose >= 0) print "(/a)",' reading ALL dumpfiles into memory'
!call endian_info()

do i=1,nfiles
Expand All @@ -132,7 +134,7 @@ subroutine get_data(ireadfile,gotfilenames,firsttime,iposinfile)
if (nstepsinfile(i) > 0 .and. ncolumnsfirst==0 .and. ncolumns > 0) then
ncolumnsfirst = ncolumns
elseif (nstepsinfile(i) > 0 .and. ncolumns /= ncolumnsfirst) then
print "(a,i2,a,i2,a)",' WARNING: file contains ',ncolumns, &
if (iverbose >= 0) print "(a,i2,a,i2,a)",' WARNING: file contains ',ncolumns, &
' columns (',ncolumnsfirst,' previously)'
ncolumns = max(ncolumns,ncolumnsfirst)
endif
Expand All @@ -144,7 +146,7 @@ subroutine get_data(ireadfile,gotfilenames,firsttime,iposinfile)
else
ncolumns = 0
endif
print "(a,i6,a,i3)",' >> Finished data read, nsteps = ',nsteps,' ncolumns = ',ncolumns
if (iverbose >= 0) print "(a,i6,a,i3)",' >> Finished data read, nsteps = ',nsteps,' ncolumns = ',ncolumns

!
!--set labels (and units) for each column of data
Expand Down Expand Up @@ -204,7 +206,7 @@ subroutine get_data(ireadfile,gotfilenames,firsttime,iposinfile)
! print "(a)",' trying different endian'
! call read_data_otherendian(rootname(ireadfile),istart,nstepsinfile(ireadfile))
!endif
if (dotiming) then
if (dotiming .and. iverbose >= 0) then
call wall_time(t2)
if (t2-t1 > 1.) then
if (ipartialread) then
Expand Down Expand Up @@ -319,7 +321,7 @@ subroutine get_labels
use asciiutils, only:read_asciifile
use filenames, only:fileprefix
use labels, only:label
use settings_data, only:ncolumns
use settings_data, only:ncolumns,iverbose
use particle_data, only:maxcol
use params, only:maxplot
use readdata, only:set_labels
Expand All @@ -339,7 +341,7 @@ subroutine get_labels
nlabelsread = 0
if (iexist) then
call read_asciifile(trim(fileprefix)//'.columns',nlabelsread,label(1:min(ncolumns,maxcol,maxplot)))
if (nlabelsread < ncolumns) &
if (nlabelsread < ncolumns .and. iverbose >= 0) &
print "(a,i3)",' end of file in '//trim(fileprefix)//'.columns file: labels read to column ',nlabelsread
endif

Expand Down Expand Up @@ -382,7 +384,8 @@ subroutine rescale_data(firsttime,nsteps_read)
if (firsttime) call read_unitsfile(trim(unitsfile),ncolumns,ierr,iverbose)

if (firsttime) then
labelorig = ''
! save bare column labels before units are appended
labelorig = label
labelreq = ''
endif

Expand Down
8 changes: 4 additions & 4 deletions src/interpolate3D.f90
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ subroutine interpolate3D(x,y,z,hh,weight,dat,itype,npart,&
!$omp private(pixint,wint,negflag,dfac,threadid) &
!$omp firstprivate(iprintnext) &
!$omp reduction(+:nwarn,usedpart)
!$omp master
!$omp masked
!$ print "(1x,a,i3,a)",'Using ',omp_get_num_threads(),' cpus'
!$omp end master
!$omp end masked

!$omp do schedule (guided, 2)
over_parts: do i=1,npart
Expand Down Expand Up @@ -471,9 +471,9 @@ subroutine interpolate3D_vec(x,y,z,hh,weight,datvec,itype,npart,&
!$omp private(ipix,jpix,kpix,ipixi,jpixi,kpixi) &
!$omp private(dx2i,nxpix,zpix,dz,dz2,dyz2,dy,ypix,q2,wab) &
!$omp reduction(+:nwarn)
!$omp master
!$omp masked
!$ print "(1x,a,i3,a)",'Using ',omp_get_num_threads(),' cpus'
!$omp end master
!$omp end masked
!
!--loop over particles
!
Expand Down
8 changes: 4 additions & 4 deletions src/interpolate3D_geom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ subroutine interpolate3Dgeom(igeom,x,y,z,hh,weight,dat,itype,npart,&
!$omp private(dx,q2,wab,isub,jsub,ksub,nsubpix,dsubpix) &
!$omp reduction(+:nsub,meansubpix,ncount) &
!$omp reduction(max:maxsubpix)
!$omp master
!$omp masked
!$ print "(1x,a,i3,a)",'Using ',omp_get_num_threads(),' cpus'
!$omp end master
!$omp end masked

!$omp do schedule (guided, 2)
over_parts: do i=1,npart
Expand Down Expand Up @@ -354,9 +354,9 @@ subroutine interpolate3Dgeom_vec(igeom,x,y,z,hh,weight,datvec,itype,npart,&
!$omp private(dx,q2,wab,isub,jsub,ksub,nsubpix,dsubpix) &
!$omp reduction(+:nsub,meansubpix,ncount) &
!$omp reduction(max:maxsubpix)
!$omp master
!$omp masked
!$ print "(1x,a,i3,a)",'Using ',omp_get_num_threads(),' cpus'
!$omp end master
!$omp end masked

!$omp do schedule (guided, 2)
over_parts: do i=1,npart
Expand Down
4 changes: 2 additions & 2 deletions src/interpolate3D_proj_geom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ subroutine interpolate3D_proj_geom(x,y,z,hh,weight,dat,itype,npart, &
endif
ncpus = 0
!$omp parallel
!$omp master
!$omp masked
!$ ncpus = omp_get_num_threads()
!$omp end master
!$omp end masked
!$omp end parallel

if (ncpus > 0) then
Expand Down
4 changes: 2 additions & 2 deletions src/interpolate3D_projection.f90
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ subroutine interpolate3D_projection(x,y,z,hh,weight,dat,itype,npart, &

ncpus = 0
!$omp parallel
!$omp master
!$omp masked
!$ ncpus = omp_get_num_threads()
!$omp end master
!$omp end masked
!$omp end parallel

if (ncpus > 0 .and. iverbose >= 0) then
Expand Down
Loading
Loading