|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
arctica
Joined: 10 Sep 2006 Posts: 105 Location: United Kingdom
|
Posted: Sat Jul 27, 2013 1:38 pm Post subject: Converting a F95 program to Clearwin+ |
|
|
Hello,
I have a program that compiles and runs as needed via a terminal window (or double-click) but was wondering how tricky it is to convert it to a menu-driven style?
Basically it reads a parameters file which has these elements:
OPEN(10, file='parameters.dat', status='OLD')
!//////////////////INPUT/////////////////////////////
! Program inputs in parameters.dat:
! Perform a detailed topography calculation on the land areas
! present in the file topo_cart_det.xyz:
! det=1-->yes
! det=0-->no
! del_xd-->grid step Distant zone (km)
! del_xi-->grid step Intermediate zone (km)
! del_xBg-->grid step Bouguer output grid (km)
! rho_c-->crust reduction density (kg/m³)
! rho_w-->water reduction density (kg/m³)
! N-->number of nodes of elevation an FA input grids in x
! M-->number of nodes of elevation an FA input grids in y
! R_i-->Limit of the intermediate zone (km)
! R_d-->Limit of the distant zone (km)
! land='on'-->calculates Bouguer anomaly at land and sea points
! land='off'->calculates Bouguer anomaly only at sea points
! slab_Boug=1-->INPUT GRAVITY ANOMALY IS SLAB-CORRECTED BOUGUER
! slab_Boug=0-->INPUT GRAVITY ANOMALY IS FREE AIR
!If det=1, then, the input file must contain the following additional
!information:
! N_det-->number of nodes of topo_cart_det.xyz input grid in x
! M_det-->number of nodes of topo_cart_det.xyz input grid in y
! del_xdet-->grid step of the Detailed Intermediate zone (km)
opens up two existing files for data input (gravity and topography)
open(4,file='topo_cart.xyz', status='OLD')
open(5,file='gravi_cart.xyz',status='OLD')
Processes the data to write two output files (Bouguer anomaly and slab_correction)
open(15,file='bouguer.xyz',status='UNKNOWN')
open(17,file='bouguer_slab.xyz',status='UNKNOWN')
..........
OPEN(10, file='lat_ex.dat', status='UNKNOWN')
WRITE(10,*) L_x,L_y,rtio*del_xi
CLOSE(10)
write(*,*)'*****************************'
write(*,*)'BOUGUER ANOMALY CALCULATED'
write(*,*)'*****************************'
DEALLOCATE (E,FA,FA_strg)
IF (det==1) DEALLOCATE (E_det)
CLOSE(15)
CLOSE(17)
I am trying to simplify the usage of the program since at present if one needs to change a variable in the parameters file, that is done externally.
At the moment, input file names have to be standard and changed after computation.
I have not used Clearwin+ yet so kind of shooting in the dark a bit here!
Cheers
Lester |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Jul 29, 2013 3:47 pm Post subject: |
|
|
Incomplete, and far from elegant:
Code: | WINAPP
OPTIONS(INTL)
PROGRAM PARAMS
INCLUDE <WINDOWS.INS>
INTEGER DET, LAND, slab_Boug, N_det, M_det
real*8 del_xd, del_xi
DET = 0
LAND = 0
slab_Boug = 0
del_xd = 1.0
del_xi = 1.0
N_det = 0
M_det = 0
IA=WINIO@('%ca[Parameters]&')
IA=WINIO@('%`rb[detailed topo calc]&', DET)
IA=WINIO@('%2nl%`rb[use land as well as sea points]&', LAND)
IA=WINIO@('%2nl%`rb[Slab corrected?]&', slab_Boug)
IA=WINIO@('%2nl%rf[initially_blank] grid step Distant zone (km)&',
& del_xd)
IA=WINIO@('%2nl%rf[initially_blank] grid step Intermediate'//
& ' zone (km)&',
& del_xi)
IA=WINIO@('%2nl%rd[initially_blank] number of nodes in x&',
& N_det)
IA=WINIO@('%2nl%rd[initially_blank] number of nodes in y&',
& M_det)
IA=WINIO@('%ff%nl%6bt[Run] %6bt[Cancel]')
IF (IA .EQ. 0 .OR. IA .EQ. 2) STOP
! now check that no value is impermissible and proceed
END
RESOURCES
1 24 default.manifest |
learning Clearwin will enable you to introduce elegance, and to catch errors. For example, you could allow te user to press Run anytime, and catch errors after, or you could keep the Run button greyed-out until the set of parameters is cmplete and valid. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|