
# This code is shared by all the ICEM CFD GUI's.
#
# Copyright (c) 1993 - 1995 Pacific Marketing and Consulting, Inc,
#       and ICEM Systems, GmbH.  All rights reserved.
# Author:  Wayne A. Christopher, wayne@icemcfd.com

# This returns a list of lists of the form FAM what num ...

proc family_topo_load {tfile} {
    set fp [open $tfile r]
    while {![eof $fp]} {
	set line [gets $fp]
	switch [string index $line 0] {
	    # - "" continue
	    \" {
		set famname [lindex $line 0]
		foreach ent [lrange $line 1 end] {
		    lappend ents($famname) $ent
		}
	    }
	    default {
		foreach ent $line {
		    lappend ents($famname) $ent
		}
	    }
	}
    }
    close $fp
    
    set fams ""
    foreach famname [array names ents] {
	set ff $famname
	foreach ent $ents($famname) {
	    switch -glob $ent {
		DOM* { lappend ff domain [string range $ent 3 end] }
		SF*  { lappend ff subface [string range $ent 2 end] }
		EN*  { lappend ff edge [string range $ent 2 end] }
		VX*  { lappend ff vertex [string range $ent 2 end] }
	    }
	}
	lappend fams $ff
    }
    return $fams
}
