Read the Stage 6c geometry and the solution-migration debug switches once. Idempotent, so it is safe (and intended) to call from every path that consults a switch rather than relying on one caller having run first.
subroutine ResolveGeomDebug()
!! Read the Stage 6c geometry and the solution-migration debug switches once. Idempotent, so
!! it is safe (and intended) to call from every path that consults a switch rather than
!! relying on one caller having run first.
implicit none
character(8) :: envstr
integer :: envstat
if(geomDebugResolved) return
geomDebugResolved = .true.
call get_environment_variable("SELF_AMR_GEOM_NO_REUSE",envstr,status=envstat)
if(envstat == 0) geomNoReuse = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_GEOM_VERIFY",envstr,status=envstat)
if(envstat == 0) geomVerify = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_GEOM_FULL",envstr,status=envstat)
if(envstat == 0) geomFull = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_MIGRATE_GATHER",envstr,status=envstat)
if(envstat == 0) migrateGather = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_MIGRATE_VERIFY",envstr,status=envstat)
if(envstat == 0) migrateVerify = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_TRANSFER_HOST",envstr,status=envstat)
if(envstat == 0) transferHost = (trim(envstr) == "1")
call get_environment_variable("SELF_AMR_TRANSFER_VERIFY",envstr,status=envstat)
if(envstat == 0) transferVerify = (trim(envstr) == "1")
if(geomNoReuse) print*,"SELF_AMR_GEOM_NO_REUSE: geometry reuse disabled"
if(geomVerify) print*,"SELF_AMR_GEOM_VERIFY: cross-checking incremental geometry"
if(geomFull) print*,"SELF_AMR_GEOM_FULL: incremental geometry bypassed"
if(migrateGather) print*,"SELF_AMR_MIGRATE_GATHER: migrating through the v1 allgather"
if(transferHost) print*,"SELF_AMR_TRANSFER_HOST: migrating and applying on the host"
if(transferVerify) print*,"SELF_AMR_TRANSFER_VERIFY: cross-checking the windowed apply"
if(migrateVerify) print*,"SELF_AMR_MIGRATE_VERIFY: cross-checking the migrated window"
endsubroutine ResolveGeomDebug