1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 /*
9  * $Header: /src/master/dx/src/exec/dxmods/_getfield.h,v 1.5 2001/04/06 16:59:15 davidt Exp $
10  */
11 
12 #include <dxconfig.h>
13 
14 
15 #ifndef  __GETFIELD_H_
16 #define  __GETFIELD_H_
17 
18 #include <dx/dx.h>
19 
20 
21 typedef enum
22 {
23     LINES,
24     TRIANGLES,
25     QUADRILATERALS,
26     TETRAHEDRA,
27     CUBES,
28     PRISMS,
29     CUBES4D,
30     NONE,
31     ET_UNKNOWN
32 }
33 std_connection_element_types;
34 
35 
36 typedef enum
37 {
38     POSITIONS           = 0,
39     CONNECTIONS         = 1,
40     DATA                = 2,
41     COLORS              = 3,
42     OPACITY             = 4,
43     NORMALS             = 5,
44     NEIGHBORS           = 6,
45     BACK_COLORS         = 7,
46     FRONT_COLORS        = 8,
47     ORIGINAL_POSITIONS  = 9,
48     INVALID_POSITIONS   = 10,
49     INVALID_CONNECTIONS = 11,
50     COLOR_MAP           = 12,
51     NOT_A_STANDARD      = 99
52 }
53 std_component_names;
54 #define  STD_COMPONENT_LIM  13
55 
56 
57 typedef enum
58 {
59     DEP          = 0,
60     REF          = 1,
61     DER          = 2,
62     DX_ELEMENT_TYPE = 3
63 }
64 std_component_attribute_names;
65 #define  STD_COMPONENT_ATTRIBUTE_LIM  4
66 
67 
68 typedef enum
69 {
70     FFALSE = 0,
71     TTRUE  = 1
72 }
73 bboolean;
74 
75 
76 /* ------------------------------------------------------------------------- */
77 typedef struct  _attribute_info
78 {
79     /*
80      * XXX - field fuzz value is type float
81      */
82     char   *name;   /* DXGetEnumeratedAttribute */
83     char   *value;  /* DXGetString */
84 }
85 *attribute_info;
86 
87 
88 /* ------------------------------------------------------------------------- */
89 typedef struct  _array_info
90 {
91     /*
92      * array base class
93      *
94      *  This is a superclass which is interpreted as follows:
95      *
96      *  array class           grid    typecast to use
97      *  ------------------    ----    --------------------
98      *  CLASS_ARRAY:                  array_info
99      *  CLASS_REGULARARRAY:           regular_array_info
100      *  CLASS_PATHARRAY:              path_array_info
101      *  CLASS_PRODUCTARRAY:   FALSE:  product_array_info
102      *  CLASS_PRODUCTARRAY,   TRUE:   grid_positions_info
103      *  CLASS_MESHARRAY,      FALSE:  mesh_array_info
104      *  CLASS_MESHARRAY,      TRUE:   grid_connections_info
105      */
106 
107     Class     class;          /* DXGetArrayClass */
108     Array     array;
109     int       items;          /* DXGetArrayInfo */
110     Type      type;           /* DXGetArrayInfo */
111     Category  category;       /* DXGetArrayInfo */
112     int       rank;           /* DXGetArrayInfo */
113     int       *shape;         /* DXGetArrayInfo */
114     Pointer   data;           /* DXGetArrayData */
115     int       itemsize;       /* DXGetItemSize  */
116     int       original_items; /* DXQueryOriginalSizes (from DXGrow) */
117     Error     (*get_item) (); /* ( int, array_info, Pointer ); */
118     ArrayHandle  handle;      /* DXCreateArrayHandle */
119               /* requires component 'class' information to work */
120 #if 0
121     Pointer   data_local;     /* DXGetArrayDataLocal */
122 #endif
123 }
124 *array_info;
125 
126 
127 /* ------------------------------------------------------------------------- */
128 typedef struct  _regular_array_info
129 {
130     struct _array_info   array;  /* subclass of array */
131 
132     /*
133      * regular array subclass
134      *
135      * reminder: origin and delta can be Point, char, ...
136      *    since regular arrays aren't used just for positions
137      */
138 
139 #if 0
140     int      count;    /* DXGetRegularArrayInfo */
141 #endif
142     Pointer  origin;   /* DXGetRegularArrayInfo, DXQueryConstantArray */
143     Pointer  delta;    /* DXGetRegularArrayInfo */
144 }
145 *regular_array_info;
146 
147 
148 /* ------------------------------------------------------------------------- */
149 typedef struct  _path_array_info
150 {
151     struct _array_info   array;  /* subclass of array */
152 
153     /*
154      * path array subclass (connections)
155      */
156 
157 #if 0
158     int  count;   /* DXGetPathArrayInfo */
159 #endif
160     int  offset;  /* DXGetPathOffset */
161 }
162 *path_array_info;
163 
164 
165 /* ------------------------------------------------------------------------- */
166 typedef struct  _product_array_info
167 {
168     struct _array_info   array;  /* subclass of array */
169 
170     /*
171      * product array subclass (positions)
172      */
173 
174     bboolean    grid;   /* DXQueryGridPositions */
175     int         n;      /* DXGetProductArrayInfo, number of terms */
176     array_info  terms;  /* in_memory_array */
177 }
178 *product_array_info;
179 
180 
181 /* ------------------------------------------------------------------------- */
182 typedef struct  _mesh_array_info
183 {
184     struct _array_info   array;  /* subclass of array */
185 
186     /*
187      * mesh array subclass (connections product)
188      *
189      *   XXX - offsets are set for grids only
190      */
191 
192     bboolean    grid;          /* DXQueryGridConnections */
193     int         n;             /* DXGetMeshArrayInfo, number of terms */
194     array_info  terms;         /* in_memory_array */
195     int        *offsets;       /* DXGetMeshOffsets */
196     int        *grow_offsets;  /* DXQueryOriginalMeshExtents */
197 }
198 *mesh_array_info;
199 
200 
201 /* ------------------------------------------------------------------------- */
202 typedef struct  _grid_connections_info
203 {
204     struct _mesh_array_info   mesh;  /* subclass of mesh array */
205 
206     /*
207      * grid connections subclass
208      */
209 
210     int  *counts;  /* DXQueryGridConnections */
211 }
212 *grid_connections_info;
213 
214 
215 /* ------------------------------------------------------------------------- */
216 typedef struct  _grid_positions_info
217 {
218     struct _product_array_info   prod;  /* subclass of product array */
219 
220     /*
221      * grid positions subclass
222      */
223 
224 #if 0
225     int      grid_dim;  /* DXQueryGridPositions */
226 #endif
227     int      *counts;   /* DXQueryGridPositions */
228     Pointer  origin;    /* DXQueryGridPositions */
229     Pointer  deltas;    /* DXQueryGridPositions */
230 }
231 *grid_positions_info;
232 
233 
234 /* ------------------------------------------------------------------------- */
235 struct _array_allocator
236 {
237     /*
238      * The 'allocator' type is required for sub/super classed types.
239      * Be sure to allocate and increment using the full frame size,
240      *   based on the largest class in the hierarchy.
241      *
242      * XXX - the exact size of the pad should be carefully considered
243      */
244     struct _grid_positions_info  contents;   /* in_memory_array */
245     int  XXX_safety_pad[10];
246 };
247 
248 
249 /* ------------------------------------------------------------------------- */
250 typedef struct  _component_info
251 {
252     struct _array_allocator array; /* components contain arrays assumption */
253 
254     /*
255      * component
256      *
257      * Assumptions:
258      *   Component objects will always be Arrays.
259      *   Component attributes will always be Strings.
260      */
261     char       *name;         /* DXGetEnumeratedComponentValue  */
262     int        attrib_count;  /* DXGetEnumeratedComponentValue  */
263 
264     std_component_names           std_name;
265     attribute_info std_attribs [ STD_COMPONENT_ATTRIBUTE_LIM ];
266     std_connection_element_types  element_type;
267     attribute_info                attrib_list;   /* in_memory_attribute */
268 }
269 *component_info;
270 
271 
272 /* ------------------------------------------------------------------------- */
273 typedef struct  _field_info
274 {
275     /*
276      * field
277      *
278      * XXX - conveniently ignore field attributes
279      */
280     Field           field;
281     component_info  std_comps [ STD_COMPONENT_LIM ];
282     component_info  comp_list;   /* in_memory_component */
283     int             comp_count;  /* DXGetEnumeratedComponentValue */
284 }
285 *field_info;
286 
287 
288 /* ------------------------------------------------------------------------- */
289 
290 typedef struct { PointId  p, q, r, s, t, u; } Prism;
291 
292 typedef struct { float    x;          } Point1D;
293 typedef struct { float    x, y;       } Point2D;
294 typedef struct { Point1D  du;         } Deltas1D;
295 typedef struct { Point2D  du, dv;     } Deltas2D;
296 typedef struct { Point    du, dv, dw; } Deltas3D;
297 
298 /* XXX - Anyone for 4D ? */
299 
300 
301 typedef struct { int i[2]; } neighbor2;  /* Neighbors for Lines */
302 typedef struct { int i[3]; } neighbor3;  /* Neighbors for Triangles */
303 typedef struct { int i[4]; } neighbor4;  /* Neighbors for Quads, Tetrahedra */
304 typedef struct { int i[5]; } neighbor5;  /* Neighbors for Prisms */
305 typedef struct { int i[6]; } neighbor6;  /* Neighbors for Cubes */
306 
307 
308 typedef struct _mesh_bounds   /* augmented mesh offsets */
309 {
310     int  i_min, j_min, k_min;
311     int  i_max, j_max, k_max;
312 }
313 *mesh_bounds;
314 
315 /* ----------------------------- extern section ----------------------------- */
316 
317 
318 field_info     _dxf_InMemory     ( Field          input );
319 Error          _dxf_FreeInMemory ( field_info     input );
320 component_info _dxf_SetIterator  ( component_info input );
321 component_info _dxf_FindCompInfo ( field_info     input, char *locate );
322 
323 /* Isosurface data, cast to float */
324 component_info _dxf_SetIterator_i ( component_info input );
325 
326 /*
327  * Stupid Q:
328  *   If these are accessed by func ptr in struct, then can they be statics?
329  */
330 
331 Error _dxf_get_item_by_handle  ( int index, array_info d, Pointer out );
332 
333 /* Declarations of the Generics to be instantiated */
334 
335 Error _dxf_get_data_irr_BYTE   ( int index, array_info d, float *out );
336 Error _dxf_get_data_irr_DOUBLE ( int index, array_info d, float *out );
337 Error _dxf_get_data_irr_FLOAT  ( int index, array_info d, float *out );
338 Error _dxf_get_data_irr_HYPER  ( int index, array_info d, float *out );
339 Error _dxf_get_data_irr_INT    ( int index, array_info d, float *out );
340 Error _dxf_get_data_irr_SHORT  ( int index, array_info d, float *out );
341 Error _dxf_get_data_irr_UBYTE  ( int index, array_info d, float *out );
342 Error _dxf_get_data_irr_UINT   ( int index, array_info d, float *out );
343 Error _dxf_get_data_irr_USHORT ( int index, array_info d, float *out );
344 
345 Error _dxf_get_data_reg_BYTE   ( int index, array_info d, float *out );
346 Error _dxf_get_data_reg_DOUBLE ( int index, array_info d, float *out );
347 Error _dxf_get_data_reg_FLOAT  ( int index, array_info d, float *out );
348 Error _dxf_get_data_reg_HYPER  ( int index, array_info d, float *out );
349 Error _dxf_get_data_reg_INT    ( int index, array_info d, float *out );
350 Error _dxf_get_data_reg_SHORT  ( int index, array_info d, float *out );
351 Error _dxf_get_data_reg_UBYTE  ( int index, array_info d, float *out );
352 Error _dxf_get_data_reg_UINT   ( int index, array_info d, float *out );
353 Error _dxf_get_data_reg_USHORT ( int index, array_info d, float *out );
354 
355 Error _dxf_get_point_irr_1D  ( int index, array_info c, Point1D *out );
356 Error _dxf_get_point_grid_1D ( int index, array_info c, Point1D *out );
357 Error _dxf_get_point_irr_2D  ( int index, array_info c, Point2D *out );
358 Error _dxf_get_point_grid_2D ( int index, array_info c, Point2D *out );
359 Error _dxf_get_point_irr_3D  ( int index, array_info c, Point   *out );
360 Error _dxf_get_point_grid_3D ( int index, array_info c, Point   *out );
361 
362 Error _dxf_get_conn_grid_LINES
363                  ( int index, array_info c, Line          *out );
364 Error _dxf_get_conn_irr_LINES
365                  ( int index, array_info c, Line          *out );
366 Error _dxf_get_conn_grid_QUADS
367                  ( int index, array_info c, Quadrilateral *out );
368 Error _dxf_get_conn_irr_QUADS
369                  ( int index, array_info c, Quadrilateral *out );
370 Error _dxf_get_conn_irr_TRIS
371                  ( int index, array_info c, Triangle      *out );
372 Error _dxf_get_conn_grid_CUBES
373                  ( int index, array_info c, Cube          *out );
374 Error _dxf_get_conn_irr_CUBES
375                  ( int index, array_info c, Cube          *out );
376 Error _dxf_get_conn_irr_TETS
377                  ( int index, array_info c, Tetrahedron   *out );
378 Error _dxf_get_conn_irr_PRSMS
379                  ( int index, array_info c, Prism         *out );
380 
381 Error _dxf_get_neighb_irr_LINES
382                  ( int index, array_info n, neighbor2 *out );
383 Error _dxf_get_neighb_irr_QUADS
384                  ( int index, array_info n, neighbor4 *out );
385 Error _dxf_get_neighb_irr_TRIS
386                  ( int index, array_info n, neighbor3 *out );
387 Error _dxf_get_neighb_irr_TETS
388                  ( int index, array_info n, neighbor4 *out );
389 Error _dxf_get_neighb_irr_CUBES
390                  ( int index, array_info n, neighbor6 *out );
391 Error _dxf_get_neighb_irr_PRSMS
392                  ( int index, array_info n, neighbor5 *out );
393 
394 Error _dxf_get_neighb_grid_LINES
395                  ( int index, array_info c, mesh_bounds b, neighbor2 *out );
396 Error _dxf_get_neighb_grid_QUADS
397                  ( int index, array_info c, mesh_bounds b, neighbor4 *out );
398 Error _dxf_get_neighb_grid_CUBES
399                  ( int index, array_info c, mesh_bounds b, neighbor6 *out );
400 
401 #endif /* __GETFIELD_H_ */
402