func Begin() { /* Number of lines in flat file containing RecInd & elevations */ num = 300; } func OnLineHeader() { output(LH); /* flatfile called "geoph_elev" contains RecInd and elevation (2 columns). */ stream= fopen("geoph_elev","r"); /* read in each line to get the string tokens[0], tokens[1] for each line Then convert the string tokens to vector values While also setting up an indexing scheme in vector p to select the proper line in the flat file */ for (i=1; i<=num;i++) { tokens = getTokenLine(stream); if (tokens == Nothing) { print("Nothing read from geometry file"); } else n[i]=strtonum(tokens[0]); m[i]=strtonum(tokens[1]); index = n[i]; p[index]=i; print("Group Number",n[i],"Elevation",m[i],"Index",p[index],"\n"); } } func OnTrace() { /* Read a trace find the GI index; use this to find which line to use from flat file, i.e. the p[] vector; and then find the line k; finally set the grpelevation equal to the proper elevation read from the flat file */ jndex = Tr.RecInd; if (jndex > 100 && jndex < 401 ) { k = p[jndex]; Tr.GrpElv = m[k]; } output(Tr); } func End() { fclose(stream); }