From e8e2578186267f5d5db3be2254e706020dcf24fc Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 20:47:41 +0100 Subject: [PATCH 1/6] Store the filepath for hidden files in hiddenext --- src/global.f90 | 3 ++- src/xspech.f90 | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/global.f90 b/src/global.f90 index 1429473f..5ca4667a 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -246,7 +246,8 @@ module allglobal !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! - CHARACTER(LEN=1000) :: ext ! extension of input filename, i.e., "G3V01L1Fi.001" for an input file G3V01L1Fi.001.sp + CHARACTER(LEN=1000) :: ext ! extension of input filename, i.e., "path/G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp + CHARACTER(LEN=1000) :: hiddenext ! ext with a "." prefix added to the basename "path/.G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp REAL :: ForceErr !< total force-imbalance REAL :: Energy !< MHD energy diff --git a/src/xspech.f90 b/src/xspech.f90 index 0ceb417c..b1ea98dc 100644 --- a/src/xspech.f90 +++ b/src/xspech.f90 @@ -204,12 +204,12 @@ subroutine read_command_args use fileunits, only: ounit use inputlist, only: Wreadin - use allglobal, only: cpus, myid, ext, MPI_COMM_SPEC, write_spec_namelist + use allglobal, only: cpus, myid, ext, hiddenext, MPI_COMM_SPEC, write_spec_namelist LOCALS LOGICAL :: Lspexist - INTEGER :: iargc, iarg, numargs, extlen, sppos + INTEGER :: iargc, iarg, numargs, extlen, sppos, basenamestart CHARACTER(len=100) :: arg @@ -243,6 +243,11 @@ subroutine read_command_args endif ext = trim(arg) + ! Prepare the "hidden" ext filepath that has a "." prefix. + ! Split ext into directory path and basename using INDEX function, then concatenate them again with a "." inbetween + basenamestart = INDEX(ext, '/', .TRUE.) + hiddenext = trim(ext(1:basenamestart))//"."//trim(ext(basenamestart+1:)) + write(ounit,'("rdcmdl : ", 10x ," : ")') write(ounit,'("rdcmdl : ",f10.2," : ext = ",a100)') cput-cpus, ext end select From 9a24970511871d01a75758e7ce2d8cb2d9189055 Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 20:48:20 +0100 Subject: [PATCH 2/6] Refactor all routines using hidden files --- src/dfp200.f90 | 4 ++-- src/hesian.f90 | 10 +++++----- src/newton.f90 | 14 ++++++++------ src/pp00aa.f90 | 4 ++-- src/ra00aa.f90 | 8 ++++---- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/dfp200.f90 b/src/dfp200.f90 index 2015b3b6..bdebe88a 100644 --- a/src/dfp200.f90 +++ b/src/dfp200.f90 @@ -2110,12 +2110,12 @@ subroutine hessian3D_dFFdRZ(lvol, idof, innout, issym, irz, ii, dBB, XX, YY, len !write(ounit,1000) 'values are:' Mvol, efcol1mn(1:mn) !write(90,1000) efcol1mn(1:mn) !1000 format(" "10x" "es23.15" ") - !open(nm1unit, file="."//trim(ext)//".GF.hcol1", status="unknown", form="unformatted") + !open(nm1unit, file=hiddenext//".GF.hcol1", status="unknown", form="unformatted") !write(nm1unit) NGdof, Mvol !write(nm1unit) efcol1mn(1:Ntz) !close(nm1unit) - !open(nm2unit, file="."//trim(ext)//".GF.hcol2", status="unknown", form="unformatted") + !open(nm2unit, file=hiddenext//".GF.hcol2", status="unknown", form="unformatted") !!write(nm2unit) NGdof, Mvol !write(nm2unit) efcol2mn(1:Ntz) !close(nm2unit) diff --git a/src/hesian.f90 b/src/hesian.f90 index 2ea18d90..265619e6 100644 --- a/src/hesian.f90 +++ b/src/hesian.f90 @@ -26,7 +26,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) use cputiming, only : Thesian - use allglobal, only : ncpu, myid, cpus, MPI_COMM_SPEC, ext, & + use allglobal, only : ncpu, myid, cpus, MPI_COMM_SPEC, ext, hiddenext, & im, in, & iRbc, iZbs, iRbs, iZbc, & dRbc, dZbs, dRbs, dZbc, & @@ -260,7 +260,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) xx(0,-2:2)= zero ; dRZ = 1.0E-04 write(svol,'(i3.3)')myid -! open(lunit+myid,file="."//trim(ext)//".hessian."//svol,status="unknown") +! open(lunit+myid,file=hiddenext//".hessian."//svol,status="unknown") ! lmu(1:Nvol) = mu(1:Nvol) ; lpflux(1:Nvol) = pflux(1:Nvol) ; lhelicity(1:Nvol) = helicity(1:Nvol) ! save original profile information; 20 Jun 14; @@ -402,7 +402,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) !>
  • The eigenvalues and eigenvectors (if required) are written to the file \c .ext.GF.ev as follows: !> !> ``` -!> open(hunit,file="."//trim(ext)//".GF.ev",status="unknown",form="unformatted") +!> open(hunit,file=hiddenext//".GF.ev",status="unknown",form="unformatted") !> write(hunit)NGdof,Ldvr,Ldvi ! integers; if only the eigenvalues were computed then Ldvr=Ldvi=1; !> write(hunit)evalr(1:NGdof) ! reals ; real part of eigenvalues; !> write(hunit)evali(1:NGdof) ! reals ; imaginary part of eigenvalues; @@ -419,7 +419,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) if( LHmatrix ) then if( myid.eq.0 ) then ; cput = GETTIME ; write(ounit,'("hesian : ",f10.2," : LHmatrix="L2" ;")')cput-cpus, LHmatrix ; - open(munit, file="."//trim(ext)//".GF.ma", status="unknown", form="unformatted") + open(munit, file=hiddenext//".GF.ma", status="unknown", form="unformatted") write(munit) NGdof write(munit) ohessian(1:NGdof,1:NGdof) close(munit) @@ -574,7 +574,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) if( myid.eq.0 ) then ! write to file; 04 Dec 14; - open(hunit, file="."//trim(ext)//".GF.ev", status="unknown", form="unformatted") + open(hunit, file=hiddenext//".GF.ev", status="unknown", form="unformatted") write(hunit) NGdof, Ldvr, Ldvi write(hunit) evalr write(hunit) evali diff --git a/src/newton.f90 b/src/newton.f90 index 7bd26216..dfb2d3bf 100644 --- a/src/newton.f90 +++ b/src/newton.f90 @@ -64,7 +64,7 @@ subroutine newton( NGdof, position, ihybrd ) use cputiming, only : Tnewton - use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, & + use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, & NOTstellsym, & ForceErr, Energy, & mn, im, in, iRbc, iZbs, iRbs, iZbc, Mvol, & @@ -313,7 +313,7 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) use cputiming, only : Tnewton - use allglobal, only : myid, cpus, MPI_COMM_SPEC, ext, & + use allglobal, only : myid, cpus, MPI_COMM_SPEC, ext, hiddenext, & mn, im, in, hessian, Lhessianallocated LOCALS @@ -329,6 +329,8 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) ireadhessian = 0 ! set default intent out; + print *, "hiddenext = ", hiddenext + select case( readorwrite ) case( 'W' ) ! will write derivative matrix to file; @@ -336,7 +338,7 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) ! reset I/O state ios = 0 - open( dunit, file="."//trim(ext)//".sp.DF", status="replace", form="unformatted", iostat=ios ) ! save derivative matrix to file; + open( dunit, file=hiddenext//".sp.DF", status="replace", form="unformatted", iostat=ios ) ! save derivative matrix to file; FATAL( newton, ios.ne.0, error opening derivative matrix file ) write( dunit, iostat=ios ) Igeometry, Istellsym, Lfreebound, Nvol, Mpol, Ntor, NGdof ! enable resolution consistency check; @@ -352,11 +354,11 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) cput = GETTIME - inquire( file="."//trim(ext)//".sp.DF", exist=exist ) ! the derivative matrix; + inquire( file=hiddenext//".sp.DF", exist=exist ) ! the derivative matrix; if( exist ) then ! 01234567890123456789012345678901 write(ounit,2000) cput-cpus, myid, "reading .ext.sp.DF ; " - open( dunit, file="."//trim(ext)//".sp.DF", status="old", form="unformatted", iostat=ios ) + open( dunit, file=hiddenext//".sp.DF", status="old", form="unformatted", iostat=ios ) else ! 01234567890123456789012345678901 write(ounit,2000) cput-cpus, myid, ".ext.sp.DF does not exist ; " inquire( file=".sp.DF", exist=exist ) ! the derivative matrix; @@ -442,7 +444,7 @@ subroutine fcn1( NGdof, xx, fvec, irevcm ) use cputiming, only : Tnewton - use allglobal, only : wrtend, myid, ncpu, cpus, MPI_COMM_SPEC, ext, & + use allglobal, only : wrtend, myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, & NOTstellsym, & ForceErr, Energy, & mn, im, in, iRbc, iZbs, iRbs, iZbc, Mvol, & diff --git a/src/pp00aa.f90 b/src/pp00aa.f90 index dc91ff31..8df977ee 100644 --- a/src/pp00aa.f90 +++ b/src/pp00aa.f90 @@ -25,7 +25,7 @@ !> !>~~~~~~~~~~~~ !> write(svol,'(i4.4)')lvol ! lvol labels volume; -!> open(lunit+myid,file="."//trim(ext)//".poincare."//svol,status="unknown",form="unformatted") +!> open(lunit+myid,file=hiddenext//".poincare."//svol,status="unknown",form="unformatted") !> do until end of file !> write(lunit+myid) Nz, nPpts ! integers !> write(lunit+myid) data(1:4,0:Nz-1,1:nPpts) ! doubles @@ -55,7 +55,7 @@ !>
  • The rotational-transform data is written to \c .ext.transform:xxxx , where \c xxxx is an integer indicating the volume. !> The format of this file is as follows: !> ``` -!> open(lunit+myid,file="."//trim(ext)//".sp.t."//svol,status="unknown",form="unformatted") +!> open(lunit+myid,file=hiddenext//".sp.t."//svol,status="unknown",form="unformatted") !> write(lunit+myid) lnPtrj-ioff+1 ! integer !> write(lunit+myid) diotadxup(0:1,0,lvol) ! doubles !> write(lunit+myid) ( fiota(itrj,1:2), itrj = ioff, lnPtrj ) ! doubles diff --git a/src/ra00aa.f90 b/src/ra00aa.f90 index 81553e76..92cb6395 100644 --- a/src/ra00aa.f90 +++ b/src/ra00aa.f90 @@ -24,7 +24,7 @@ !>
      !>
    • The format of the files containing the vector potential is as follows: !> ``` -!> open(aunit, file="."//trim(ext)//".sp.A", status="replace", form="unformatted" ) +!> open(aunit, file=hiddenext//".sp.A", status="replace", form="unformatted" ) !> write(aunit) Mvol, Mpol, Ntor, mn, Nfp ! integers; !> write(aunit) im(1:mn) ! integers; poloidal modes; !> write(aunit) in(1:mn) ! integers; toroidal modes; @@ -57,7 +57,7 @@ subroutine ra00aa( writeorread ) use cputiming, only : Tra00aa - use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, Mvol, mn, im, in, Ate, Aze, Ato, Azo + use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, Mvol, mn, im, in, Ate, Aze, Ato, Azo use sphdf5, only : write_vector_potential @@ -148,12 +148,12 @@ subroutine ra00aa( writeorread ) if( myid.eq.0 ) then - inquire(file="."//trim(ext)//".sp.A",exist=exist) + inquire(file=hiddenext//".sp.A",exist=exist) if( .not.exist ) then ; write(ounit,'("ra00aa : ",f10.2," : myid=",i3," ; error ; .ext.sp.A does not exist ;")') cput-cpus, myid ; goto 9998 endif - open(aunit,file="."//trim(ext)//".sp.A",status="old",form="unformatted",iostat=ios) ! this will contain initial guess for vector potential; + open(aunit,file=hiddenext//".sp.A",status="old",form="unformatted",iostat=ios) ! this will contain initial guess for vector potential; if( ios.ne.0 ) then ; write(ounit,'("ra00aa : ",f10.2," : myid=",i3," ; error ; opening .ext.sp.A ;")') cput-cpus, myid ; goto 9997 endif From b617a0cc62c05724cbf8b733da1f958cad449bbf Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 20:49:41 +0100 Subject: [PATCH 3/6] Cross platform path handling --- src/xspech.f90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xspech.f90 b/src/xspech.f90 index b1ea98dc..1708b894 100644 --- a/src/xspech.f90 +++ b/src/xspech.f90 @@ -245,7 +245,12 @@ subroutine read_command_args ! Prepare the "hidden" ext filepath that has a "." prefix. ! Split ext into directory path and basename using INDEX function, then concatenate them again with a "." inbetween - basenamestart = INDEX(ext, '/', .TRUE.) + #ifdef _WIN32 + basenamestart = INDEX(ext, '\', .TRUE.) + #else + basenamestart = INDEX(ext, '/', .TRUE.) + #endif + ! folder + . + filename hiddenext = trim(ext(1:basenamestart))//"."//trim(ext(basenamestart+1:)) write(ounit,'("rdcmdl : ", 10x ," : ")') From 9650e023bae446442f5626db2be61581bae56bea Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 20:59:52 +0100 Subject: [PATCH 4/6] removed debugging print statement --- src/newton.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/newton.f90 b/src/newton.f90 index dfb2d3bf..d2e9ecab 100644 --- a/src/newton.f90 +++ b/src/newton.f90 @@ -329,8 +329,6 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) ireadhessian = 0 ! set default intent out; - print *, "hiddenext = ", hiddenext - select case( readorwrite ) case( 'W' ) ! will write derivative matrix to file; From 4b615bc7851ff92721f0f076c5182ce8bcb23b54 Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 21:00:12 +0100 Subject: [PATCH 5/6] Fixed preprocessor indent --- src/xspech.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xspech.f90 b/src/xspech.f90 index 1708b894..316e9eb9 100644 --- a/src/xspech.f90 +++ b/src/xspech.f90 @@ -245,11 +245,11 @@ subroutine read_command_args ! Prepare the "hidden" ext filepath that has a "." prefix. ! Split ext into directory path and basename using INDEX function, then concatenate them again with a "." inbetween - #ifdef _WIN32 +#ifdef _WIN32 basenamestart = INDEX(ext, '\', .TRUE.) - #else +#else basenamestart = INDEX(ext, '/', .TRUE.) - #endif +#endif ! folder + . + filename hiddenext = trim(ext(1:basenamestart))//"."//trim(ext(basenamestart+1:)) From 92d03e46ca5c6823146c6e34a172107403de4da4 Mon Sep 17 00:00:00 2001 From: Philipp Jurasic Date: Thu, 14 Nov 2024 21:16:54 +0100 Subject: [PATCH 6/6] trimming and variable renaming --- src/dfp200.f90 | 4 ++-- src/global.f90 | 2 +- src/hesian.f90 | 10 +++++----- src/newton.f90 | 12 ++++++------ src/pp00aa.f90 | 4 ++-- src/ra00aa.f90 | 8 ++++---- src/xspech.f90 | 10 +++++----- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/dfp200.f90 b/src/dfp200.f90 index bdebe88a..7c73253c 100644 --- a/src/dfp200.f90 +++ b/src/dfp200.f90 @@ -2110,12 +2110,12 @@ subroutine hessian3D_dFFdRZ(lvol, idof, innout, issym, irz, ii, dBB, XX, YY, len !write(ounit,1000) 'values are:' Mvol, efcol1mn(1:mn) !write(90,1000) efcol1mn(1:mn) !1000 format(" "10x" "es23.15" ") - !open(nm1unit, file=hiddenext//".GF.hcol1", status="unknown", form="unformatted") + !open(nm1unit, file=trim(hidden_ext)//".GF.hcol1", status="unknown", form="unformatted") !write(nm1unit) NGdof, Mvol !write(nm1unit) efcol1mn(1:Ntz) !close(nm1unit) - !open(nm2unit, file=hiddenext//".GF.hcol2", status="unknown", form="unformatted") + !open(nm2unit, file=trim(hidden_ext)//".GF.hcol2", status="unknown", form="unformatted") !!write(nm2unit) NGdof, Mvol !write(nm2unit) efcol2mn(1:Ntz) !close(nm2unit) diff --git a/src/global.f90 b/src/global.f90 index 5ca4667a..503963c8 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -247,7 +247,7 @@ module allglobal !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-! CHARACTER(LEN=1000) :: ext ! extension of input filename, i.e., "path/G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp - CHARACTER(LEN=1000) :: hiddenext ! ext with a "." prefix added to the basename "path/.G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp + CHARACTER(LEN=1000) :: hidden_ext ! ext with a "." prefix added to the basename "path/.G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp REAL :: ForceErr !< total force-imbalance REAL :: Energy !< MHD energy diff --git a/src/hesian.f90 b/src/hesian.f90 index 265619e6..dd49506f 100644 --- a/src/hesian.f90 +++ b/src/hesian.f90 @@ -26,7 +26,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) use cputiming, only : Thesian - use allglobal, only : ncpu, myid, cpus, MPI_COMM_SPEC, ext, hiddenext, & + use allglobal, only : ncpu, myid, cpus, MPI_COMM_SPEC, ext, hidden_ext, & im, in, & iRbc, iZbs, iRbs, iZbc, & dRbc, dZbs, dRbs, dZbc, & @@ -260,7 +260,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) xx(0,-2:2)= zero ; dRZ = 1.0E-04 write(svol,'(i3.3)')myid -! open(lunit+myid,file=hiddenext//".hessian."//svol,status="unknown") +! open(lunit+myid,file=trim(hidden_ext)//".hessian."//svol,status="unknown") ! lmu(1:Nvol) = mu(1:Nvol) ; lpflux(1:Nvol) = pflux(1:Nvol) ; lhelicity(1:Nvol) = helicity(1:Nvol) ! save original profile information; 20 Jun 14; @@ -402,7 +402,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) !>
    • The eigenvalues and eigenvectors (if required) are written to the file \c .ext.GF.ev as follows: !> !> ``` -!> open(hunit,file=hiddenext//".GF.ev",status="unknown",form="unformatted") +!> open(hunit,file=trim(hidden_ext)//".GF.ev",status="unknown",form="unformatted") !> write(hunit)NGdof,Ldvr,Ldvi ! integers; if only the eigenvalues were computed then Ldvr=Ldvi=1; !> write(hunit)evalr(1:NGdof) ! reals ; real part of eigenvalues; !> write(hunit)evali(1:NGdof) ! reals ; imaginary part of eigenvalues; @@ -419,7 +419,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) if( LHmatrix ) then if( myid.eq.0 ) then ; cput = GETTIME ; write(ounit,'("hesian : ",f10.2," : LHmatrix="L2" ;")')cput-cpus, LHmatrix ; - open(munit, file=hiddenext//".GF.ma", status="unknown", form="unformatted") + open(munit, file=trim(hidden_ext)//".GF.ma", status="unknown", form="unformatted") write(munit) NGdof write(munit) ohessian(1:NGdof,1:NGdof) close(munit) @@ -574,7 +574,7 @@ subroutine hesian( NGdof, position, Mvol, mn, LGdof ) if( myid.eq.0 ) then ! write to file; 04 Dec 14; - open(hunit, file=hiddenext//".GF.ev", status="unknown", form="unformatted") + open(hunit, file=trim(hidden_ext)//".GF.ev", status="unknown", form="unformatted") write(hunit) NGdof, Ldvr, Ldvi write(hunit) evalr write(hunit) evali diff --git a/src/newton.f90 b/src/newton.f90 index d2e9ecab..77573670 100644 --- a/src/newton.f90 +++ b/src/newton.f90 @@ -64,7 +64,7 @@ subroutine newton( NGdof, position, ihybrd ) use cputiming, only : Tnewton - use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, & + use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hidden_ext, & NOTstellsym, & ForceErr, Energy, & mn, im, in, iRbc, iZbs, iRbs, iZbc, Mvol, & @@ -313,7 +313,7 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) use cputiming, only : Tnewton - use allglobal, only : myid, cpus, MPI_COMM_SPEC, ext, hiddenext, & + use allglobal, only : myid, cpus, MPI_COMM_SPEC, ext, hidden_ext, & mn, im, in, hessian, Lhessianallocated LOCALS @@ -336,7 +336,7 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) ! reset I/O state ios = 0 - open( dunit, file=hiddenext//".sp.DF", status="replace", form="unformatted", iostat=ios ) ! save derivative matrix to file; + open( dunit, file=trim(hidden_ext)//".sp.DF", status="replace", form="unformatted", iostat=ios ) ! save derivative matrix to file; FATAL( newton, ios.ne.0, error opening derivative matrix file ) write( dunit, iostat=ios ) Igeometry, Istellsym, Lfreebound, Nvol, Mpol, Ntor, NGdof ! enable resolution consistency check; @@ -352,11 +352,11 @@ subroutine writereadgf( readorwrite, NGdof , ireadhessian ) cput = GETTIME - inquire( file=hiddenext//".sp.DF", exist=exist ) ! the derivative matrix; + inquire( file=trim(hidden_ext)//".sp.DF", exist=exist ) ! the derivative matrix; if( exist ) then ! 01234567890123456789012345678901 write(ounit,2000) cput-cpus, myid, "reading .ext.sp.DF ; " - open( dunit, file=hiddenext//".sp.DF", status="old", form="unformatted", iostat=ios ) + open( dunit, file=trim(hidden_ext)//".sp.DF", status="old", form="unformatted", iostat=ios ) else ! 01234567890123456789012345678901 write(ounit,2000) cput-cpus, myid, ".ext.sp.DF does not exist ; " inquire( file=".sp.DF", exist=exist ) ! the derivative matrix; @@ -442,7 +442,7 @@ subroutine fcn1( NGdof, xx, fvec, irevcm ) use cputiming, only : Tnewton - use allglobal, only : wrtend, myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, & + use allglobal, only : wrtend, myid, ncpu, cpus, MPI_COMM_SPEC, ext, hidden_ext, & NOTstellsym, & ForceErr, Energy, & mn, im, in, iRbc, iZbs, iRbs, iZbc, Mvol, & diff --git a/src/pp00aa.f90 b/src/pp00aa.f90 index 8df977ee..6c0fb2f2 100644 --- a/src/pp00aa.f90 +++ b/src/pp00aa.f90 @@ -25,7 +25,7 @@ !> !>~~~~~~~~~~~~ !> write(svol,'(i4.4)')lvol ! lvol labels volume; -!> open(lunit+myid,file=hiddenext//".poincare."//svol,status="unknown",form="unformatted") +!> open(lunit+myid,file=trim(hidden_ext)//".poincare."//svol,status="unknown",form="unformatted") !> do until end of file !> write(lunit+myid) Nz, nPpts ! integers !> write(lunit+myid) data(1:4,0:Nz-1,1:nPpts) ! doubles @@ -55,7 +55,7 @@ !>
    • The rotational-transform data is written to \c .ext.transform:xxxx , where \c xxxx is an integer indicating the volume. !> The format of this file is as follows: !> ``` -!> open(lunit+myid,file=hiddenext//".sp.t."//svol,status="unknown",form="unformatted") +!> open(lunit+myid,file=trim(hidden_ext)//".sp.t."//svol,status="unknown",form="unformatted") !> write(lunit+myid) lnPtrj-ioff+1 ! integer !> write(lunit+myid) diotadxup(0:1,0,lvol) ! doubles !> write(lunit+myid) ( fiota(itrj,1:2), itrj = ioff, lnPtrj ) ! doubles diff --git a/src/ra00aa.f90 b/src/ra00aa.f90 index 92cb6395..15ccaf82 100644 --- a/src/ra00aa.f90 +++ b/src/ra00aa.f90 @@ -24,7 +24,7 @@ !>
        !>
      • The format of the files containing the vector potential is as follows: !> ``` -!> open(aunit, file=hiddenext//".sp.A", status="replace", form="unformatted" ) +!> open(aunit, file=trim(hidden_ext)//".sp.A", status="replace", form="unformatted" ) !> write(aunit) Mvol, Mpol, Ntor, mn, Nfp ! integers; !> write(aunit) im(1:mn) ! integers; poloidal modes; !> write(aunit) in(1:mn) ! integers; toroidal modes; @@ -57,7 +57,7 @@ subroutine ra00aa( writeorread ) use cputiming, only : Tra00aa - use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hiddenext, Mvol, mn, im, in, Ate, Aze, Ato, Azo + use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, ext, hidden_ext, Mvol, mn, im, in, Ate, Aze, Ato, Azo use sphdf5, only : write_vector_potential @@ -148,12 +148,12 @@ subroutine ra00aa( writeorread ) if( myid.eq.0 ) then - inquire(file=hiddenext//".sp.A",exist=exist) + inquire(file=trim(hidden_ext)//".sp.A",exist=exist) if( .not.exist ) then ; write(ounit,'("ra00aa : ",f10.2," : myid=",i3," ; error ; .ext.sp.A does not exist ;")') cput-cpus, myid ; goto 9998 endif - open(aunit,file=hiddenext//".sp.A",status="old",form="unformatted",iostat=ios) ! this will contain initial guess for vector potential; + open(aunit,file=trim(hidden_ext)//".sp.A",status="old",form="unformatted",iostat=ios) ! this will contain initial guess for vector potential; if( ios.ne.0 ) then ; write(ounit,'("ra00aa : ",f10.2," : myid=",i3," ; error ; opening .ext.sp.A ;")') cput-cpus, myid ; goto 9997 endif diff --git a/src/xspech.f90 b/src/xspech.f90 index 316e9eb9..26f0e1ee 100644 --- a/src/xspech.f90 +++ b/src/xspech.f90 @@ -204,12 +204,12 @@ subroutine read_command_args use fileunits, only: ounit use inputlist, only: Wreadin - use allglobal, only: cpus, myid, ext, hiddenext, MPI_COMM_SPEC, write_spec_namelist + use allglobal, only: cpus, myid, ext, hidden_ext, MPI_COMM_SPEC, write_spec_namelist LOCALS LOGICAL :: Lspexist - INTEGER :: iargc, iarg, numargs, extlen, sppos, basenamestart + INTEGER :: iargc, iarg, numargs, extlen, sppos, basename_start_index CHARACTER(len=100) :: arg @@ -246,12 +246,12 @@ subroutine read_command_args ! Prepare the "hidden" ext filepath that has a "." prefix. ! Split ext into directory path and basename using INDEX function, then concatenate them again with a "." inbetween #ifdef _WIN32 - basenamestart = INDEX(ext, '\', .TRUE.) + basename_start_index = INDEX(ext, '\', .TRUE.) #else - basenamestart = INDEX(ext, '/', .TRUE.) + basename_start_index = INDEX(ext, '/', .TRUE.) #endif ! folder + . + filename - hiddenext = trim(ext(1:basenamestart))//"."//trim(ext(basenamestart+1:)) + hidden_ext = trim(ext(1:basename_start_index))//"."//trim(ext(basename_start_index+1:)) write(ounit,'("rdcmdl : ", 10x ," : ")') write(ounit,'("rdcmdl : ",f10.2," : ext = ",a100)') cput-cpus, ext