NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/IO_Functions/read_ucd.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function ret_struct=read_ucd(inpname);
2 %READ_UCD read an .inp file, an AVS-Unstructured Cell Data file with
3 %         uniform cell topology of type TRI.
4 %
5 %         For an unknown reason, AVS uses the suffix '.inp' to indicate
6 %         a input file for a UCD structure and not the obvious '.ucd',
7 %         even though the AVS routines which use UCD structures are called
8 %         UCD routines.  OPNML will adhere to this convention as well.
9 %         This unfortunately conflicts with the filename suffix for
10 %         the FUNDY series of FEM models.
11 %
12 %         This routine is provided as an "interface" between the
13 %         AVS-UCD datatype and OPNML/MATLAB in the loosest sense.
14 %         Currently, only the TRANSECT code and the transect routines
15 %         in QUODDY3.3 and later output a UCD-structure file.
16 %         The .trn (transect) filetype is obsolete.
17 %
18 % Input:   If inpname is omitted, READ_UCD enables a file browser
19 %          with which the user can specify the .inp file.
20 %
21 %          Otherwise, READ_UCD takes as input the filename of the
22 %          transect data file, including the .inp suffix.
23 %
24 % Output:  The output of READ_UCD is a fem_grid_struct containing the
25 %          transect information.  The output structure can be passed
26 %          directly to OPNML routines like COLORMESH2D, LCONTOUR, etc.
27 %          The actual data for the transect is attached to the structure
28 %          in the field .data.  This .data field  is as wide
29 %          as the number of columns in the node-data specification
30 %          part of the .inp file.  Vector components will be returned
31 %          as three scalars, NOT 1 vector.
32 %
33 %          Read the "man" page for TRANSECT (type "man transect" at a UNIX
34 %          prompt) for more information on the transect output formats.
35 %
36 %          Make sure a semi-colon is used at the end of the command;
37 %          otherwise READ_UCD will return the output arrays to the screen.
38 %
39 %          Since OPNML/MATLAB routines are based on linear triangular
40 %          finite elements in 2-D, READ_UCD only reads UCD structures
41 %          with cell-topologies of type TRI.  No other cell-types, or
42 %          mixtures of cell-types, are allowed into OPNML/MATLAB through
43 %          this routine.  THIS CLEARLY DOES NOT APPLY TO AVS.
44 %
45 % Call as: transdata=read_ucd(inpname);         
46 %
47 % Written by : Brian O. Blanton (Jun 98)
48 %
49
50 err1=['READ_UCD requires 0 or 1 input arguments.'];
51 err2=['READ_UCD requires exactly 1 output arguments.'];
52 err3=['Argument to READ_UCD must be a string (filename)'];
53
54 if nargin==0 & nargout==0
55    disp('Call as: transdata=read_ucd(inpname);')
56    return
57 end
58
59 if nargin > 1
60    error(err1)
61 end
62
63 if nargout ~=1
64    error(err2)
65 end
66
67 if ~exist('inpname')
68    [inpname,fpath]=uigetfile('*.inp','Which .inp');
69    if inpname==0,return,end
70 else
71    if ~isstr(inpname),error(err3),end
72    fpath=[];
73 end
74
75 [et,xt,yt,zt,data]=read_ucd_mex5(inpname);
76 keyboard
77 % Generate a fem_grid_struct for return
78 ret_struct.name='trans';
79 ret_struct.x=xt;
80 ret_struct.y=yt;
81 ret_struct.z=zt;
82 ret_struct.e=et;
83 ret_struct.bnd=detbndy(et);
84 ret_struct.data=data;
85
86
87
88 return
89
90
91 %
92 %        Brian O. Blanton
93 %        Department of Marine Sciences
94 %        15-1A Venable Hall
95 %        CB# 3300
96 %        Uni. of North Carolina
97 %        Chapel Hill, NC
98 %                 27599-3300
99 %
100 %        919-962-4466
101 %        blanton@marine.unc.edu
102 %
103
Note: See TracBrowser for help on using the browser.