TABLE OF CONTENTS
::pwtk::phi::load_fromPHI
SYNOPSIS
proc ::pwtk::phi::load_fromPHI {phi {clear_existing 1}} {
PURPOSE
Load the input data from existing ph.x input file.
If clear_existing == 1, then the current input will be cleared, but otherwise the data will be simply added to the existing data.
ARGUMENTS
- phi -- filename of the ph.x input file from which to extract the input data
- clear_existing -- [optional] should the current input data be cleared?
SOURCE
::pwtk::fileMustExist $phi "ph.x input" if { [::pwtk::is_true $clear_existing] } { # clear the current ph.x input data ... ::pwtk::phi::clear } set fid [open $phi r] # check if the first line is the title line set line [::pwtk::getNonEmptyLine $fid] set word1st [::pwtk::firstWord $line] if { [string match -nocase &INPUTPH $word1st] } { # it's an INPUTPH namelist, rewind $fid seek $fid 0 start } else { ::pwtk::input::card INPUTPH.titleLine $line } # ph.x input file must contain the INPUTPH namelist if { [catch {set res [::pwtk::readNml_w_affix $fid INPUTPH {} {} {} 1]}] } { ::pwtk::error "input file \"$phi\" does not appear to be a ph.x input file" 1 } close $fid eval $res variable input_flow_list ::pwtk::input::namelists_ityp2atmSymb_ $input_flow_list }