fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

Keeping the Directory Structure

A Recommended Directory Structure

A large Fortran project may contain many hundreds of files organised in hierarchially structured directories. fpt may be instructed to read the files and to re-write them into a copy of the directory structure, preserving the organisation.

The authors recommend creating a top-level directory structure:

original_source A copy of the complete project with all directories and files modified_source A copy of the original directories which are initially empty. This stucture will contain any files modified during project development. fpt_output A copy of the original directories which are initially empty fpt The fpt specification (fsp) files for the project

The script fpt_directory_setup in the main fpt installation directory will set this up automatically.

For example, a helicopter simulation. Two files have already been modified and are now in modified_source.

/home/chris/helisim/original_source/ initial/ heli_init.f90, atm_init.f90, module_atm.f90 dynamic/ kinematic.f90, module_rkrt2.f90, control.f90 terminal/ heli_term.f90 inc/ const.i90 /home/chris/helisim/modified_source/ initial/ module_atm.f90 dynamic/ kinematic.f90 terminal/ <Empty> inc/ <Empty> /home/chris/helisim/fpt_output/ initial/ <Empty> dynamic/ <Empty> terminal/ <Empty> inc/ <Empty> /home/chris/helisim/fpt/ helisim.fsp

We want to keep the directory structure and to merge the original_source/ and modified_source/ files. We work in the directory /home/chris/helisim/fpt/. That is the current working directory. The input file specification for the project, written in helisim.fsp, is set up with specifications, for example:

% primary input path: "../modified_source/initial" "../original_source/initial" heli_init.f90 atm_init.f90 module_atm.f90 % primary input path: "../modified_source/dynamic" "../original_source/dynamic" kinematic.f90 module_rkrt2.f90 control.f90 % primary input path: "../modified_source/terminal" "../original_source/terminal" heli_term.f90

Please see "Running Command-line fpt" for a description of these commands.

fpt will read kinematic.f90 from the modified_source/ directory and module_rkrt2.f90 and control.f90 from the original_source/ directory.

We want to write the output files with the same directory organisation, but under the new base directory fpt_output/. The output directory handling is therefore written:

% keep output directories % edit output file names: replace "modified_source" by "fpt_output" % edit output file names: replace "original_source" by "fpt_output" % keep file name extensions

The output files are written to:

/home/chris/helisim/fpt/ helisim.fpl (The listing file) /home/chris/helisim/fpt_output/ initial/ heli_init.f90, atm_init.f90, module_atm.f90 dynamic/ kinematic.f90, module_rkrt2.f90, control.f90 terminal/ heli_term.f90 inc/ const.i90

When setting the fsp file up we recommend starting without the % keep file name extensions command. fpt will then use the default extensions .fpt and .fpi and cannot accidentally overwrite anything. When all the files are written to the expected locations restore the command. It is easy to remove the .fpt and .fpi files with a command of the form:

find ../fpt_output "*.fp*" -delete

Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.