TABLE OF CONTENTS


::pwtk::q2ri::load_fromQ2RI

SYNOPSIS

proc ::pwtk::q2ri::load_fromQ2RI {q2ri {clear_existing 1}} {

PURPOSE

Load the input data from existing q2r.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

SOURCE

    ::pwtk::fileMustExist $q2ri "q2r.x input"

    if { [::pwtk::is_true $clear_existing] } {
        # clear the current q2r.x input data ...
        ::pwtk::input::clear Q2R
    }
    
    set fid [open $q2ri r]
    
    # q2r.x input file must contain the INPUT namelist
    
    if { [catch {set nml [::pwtk::readNml $fid INPUT]}] } {
        ::pwtk::error "input file \"$q2ri\" does not appear to be a q2r.x input file" 1
    }
    # replace INPUT with Q2R
    eval [regsub INPUT $nml Q2R]
    ::pwtk::input::namelists_ityp2atmSymb_ $::pwtk::q2ri::input_flow_list
    
    # read the rest of the q2r.x input file
    while { ! [eof $fid] } {
        ::pwtk::input::cardAppend Q2R.affixCards [gets $fid]
    }
    close $fid
}