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

root/gliderproc/trunk/MATLAB/opnml/FEM/is_valid_struct2.m

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

Initial import of Stark code.

Line 
1 % IS_VALID_STRUCT2 - Determine if the input structure is "valid"
2 %
3 %     IS_VALID_STRUCT2 determines whether or not the input
4 %     structure contains additional field data beyond the
5 %     minimum valid fields checked for by  IS_VALID_STRUCT.
6 %     Recall that a valid FEM_GRID_STRUCT contains (atleast)
7 %     the following (NOT EMPTY) fields:
8 %
9 %       .name,.e,.x,.y,.z,.bnd 
10 %
11 %     IS_VALID_STRUCT2 verifies the existence of .A, .B, .A0,
12 %     and .T which are filled by BELINT, and of .ar filled by
13 %     EL_AREAS.  These additional FEM fields are needed by
14 %     OPNML/MATLAB element-finding, basis  and interpotion
15 %     routines.
16 %
17 % CALL: errflag=is_valid_struct2(fem_grid_struct)
18 %       
19 % Written by : Brian O. Blanton
20 % Summer 1998
21 %
22 function errflag=is_valid_struct2(fem_grid_struct)
23
24 errflag=0;
25
26 % Make sure input argument is actually a structure
27 %
28 if ~isstruct(fem_grid_struct)
29    disp('    Argument to IS_VALID_STRUCT2 must be a structure.');return
30 end
31
32 % now, make sure the structure contains the additional fields,
33 % as above
34 if ~isfield(fem_grid_struct,'A')
35    disp('    "A" field not part of fem_grid_struct; run BELINT');return
36 elseif ~isfield(fem_grid_struct,'B')
37    disp('    "B" field not part of fem_grid_struct; run BELINT');return
38 elseif ~isfield(fem_grid_struct,'A0')
39    disp('    "A0" field not part of fem_grid_struct; run BELINT');return
40 elseif ~isfield(fem_grid_struct,'T')
41    disp('    "T" field not part of fem_grid_struct; run BELINT');return
42 elseif ~isfield(fem_grid_struct,'ar')
43    disp('    "ar" field not part of fem_grid_struct; run ');return
44 end
45
46 % now, make sure these additional fields are NOT EMPTY
47 %
48 if isempty(fem_grid_struct.A)
49    disp('    "A" field in fem_grid_struct is EMPTY');return
50 elseif isempty(fem_grid_struct.B)
51    disp('    "B" field in fem_grid_struct is EMPTY');return
52 elseif isempty(fem_grid_struct.A0)
53    disp('    "A0" field in fem_grid_struct is EMPTY');return
54 elseif isempty(fem_grid_struct.T)
55    disp('    "T" field in fem_grid_struct is EMPTY');return
56 elseif isempty(fem_grid_struct.ar)
57    disp('    "ar" field in fem_grid_struct is EMPTY');return
58 end
59
60 errflag=1;
61
62 %
63 %        Brian O. Blanton
64 %        Curr. in Marine Science
65 %        15-1A Venable Hall
66 %        CB# 3300
67 %        Uni. of North Carolina
68 %        Chapel Hill, NC
69 %                 27599-3300
70 %
71 %        919-962-4466
72 %        blanton@marine.unc.edu
73 %
74 %        Summer 1998
Note: See TracBrowser for help on using the browser.