1 /*
2  * Automatically generated - DO NOT EDIT!
3  */
4 
5 #ifndef __objectClass
6 #define __objectClass
7 /***********************************************************************/
8 /* Open Visualization Data Explorer                                    */
9 /* (C) Copyright IBM Corp. 1989,1999                                   */
10 /* ALL RIGHTS RESERVED                                                 */
11 /* This code licensed under the                                        */
12 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
13 /***********************************************************************/
14 
15 /*
16 \section{Object class}
17 
18 Every object begins with an object preamble, which contains the class
19 number and a reference count.
20 */
21 
22 #include <dx/dx.h>
23 
24 /* the following make ANSI compilers happier */
25 struct shade;
26 struct buffer;
27 struct tile;
28 struct gather;
29 struct survey;
30 struct count;
31 
32 struct _root {
33     int size;
34     Class class;
35     char *name;
36 };
37 #define CLASS_SIZE(x) (((struct _root *)(x))->size)
38 #define CLASS_CLASS(x) (((struct _root *)(x))->class)
39 #define CLASS_NAME(x) (((struct _root *)(x))->name)
40 
41 
42 extern struct object_class _dxdobject_class;
43 Error _dxfDelete(Object);
44 Error _dxfno_Delete(Object);
45 Error _dxfShade(Object, struct shade *);
46 Error _dxfno_Shade(Object, struct shade *);
47 Object _dxfBoundingBox(Object, Point*, Matrix*, int);
48 Object _dxfno_BoundingBox(Object, Point*, Matrix*, int);
49 Object _dxfPaint(Object, struct buffer *, int, struct tile *);
50 Object _dxfno_Paint(Object, struct buffer *, int, struct tile *);
51 Object _dxfGather(Object, struct gather *, struct tile *);
52 Object _dxfno_Gather(Object, struct gather *, struct tile *);
53 Error _dxfPartition(Object, int*, int, Object*, int);
54 Error _dxfno_Partition(Object, int*, int, Object*, int);
55 Object _dxfGetType(Object, Type*, Category*, int*, int*);
56 Object _dxfno_GetType(Object, Type*, Category*, int*, int*);
57 Object _dxfCopy(Object, enum _dxd_copy);
58 Object _dxfno_Copy(Object, enum _dxd_copy);
59 Error _dxfObject_Delete(Object);
60 Object _dxfObject_BoundingBox(Object, Point*, Matrix*, int);
61 Error _dxfObject_Shade(Object, struct shade *);
62 
63 #define NATTRIBUTES 2			/* number of attributes in object */
64 
65 struct object {				/* object preamble */
66     struct object_class *class;		/* class vector */
67     Class class_id;			/* class id (for debugging only!) */
68     lock_type lock;			/* for Reference and Delete */
69     int count;				/* reference count */
70     int tag;				/* object tag */
71     struct attribute {			/* object attributes */
72 	char *name;			/* attribute name */
73 	Object value;			/* attribue value */
74     } local[NATTRIBUTES], *attributes;	/* the attributes */
75     int nattributes;			/* number of attributes */
76     int attr_alloc;			/* allocated space for attributes */
77 };
78 
79 #if 0 /* was if OPTIMIZED */
80 #define CHECK(obj, cls) { \
81     if (!obj) \
82 	return ERROR; \
83 }
84 #else
85 #define CHECK(obj, cls) { \
86     if (!obj) \
87         return ERROR; \
88     if (DXGetObjectClass((Object)(obj)) != cls) \
89         DXErrorReturn(ERROR_BAD_CLASS, "called with object of wrong class"); \
90 }
91 #endif
92 /**
93 This macro eases the task of checking argument class.  Note: This is not needed
94 when a method implementation is called, because {\tt o} and its class will
95 both have been checked by the method.
96 **/
97 
98 Object _dxf_NewObject(struct object_class *class);
99 /**
100 This internal routine is called only by other {\tt New...} routines to
101 create and initialize the object preamble.
102 **/
103 
104 Object _dxf_CopyObject(Object new, Object old, enum _dxd_copy copy);
105 /**
106 Copies the portion of the data of {\tt old} managed by the {\tt
107 Object} class to {\tt new}.  This is provided for subclasses of {\tt Object}
108 to use in their copy routines.  Copying works something like creating
109 an object.  Every class {\tt X} that implements copying should provide
110 an {\tt \_CopyX} routine that copies relevant data from an old object
111 to a new object, so that subclass copy routines may call this routine
112 to copy the superclass's data.  The {\tt CopyX} routine just creates a
113 new object of the appropriate type and then calls {\tt \_CopyX} to copy
114 the data.
115 **/
116 #endif
117 #ifndef __interpClass
118 #define __interpClass
119 /***********************************************************************/
120 /* Open Visualization Data Explorer                                    */
121 /* (C) Copyright IBM Corp. 1989,1999                                   */
122 /* ALL RIGHTS RESERVED                                                 */
123 /* This code licensed under the                                        */
124 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
125 /***********************************************************************/
126 
127 
128 
129 
130 
131 extern struct interpolator_class _dxdinterpolator_class;
132 Error _dxfInterpolate(Interpolator, int *, float **, Pointer *, Interpolator *, int);
133 Error _dxfno_Interpolate(Interpolator, int *, float **, Pointer *, Interpolator *, int);
134 Interpolator _dxfLocalizeInterpolator(Interpolator);
135 Interpolator _dxfno_LocalizeInterpolator(Interpolator);
136 Error _dxfInterpolator_Delete(Interpolator);
137 Object _dxfInterpolator_GetType(Interpolator, Type*, Category*, int*, int*);
138 
139 /*
140  * Fuzz factor for interpolation: interpolators should assume points
141  * within this proportion of an estimated primitive edge length from a
142  * primitive actually lie within that primitive.
143  */
144 #define FUZZ		0.0003
145 #define MAX_DIM		8
146 
147 struct interpolator
148 {
149     struct object	object;
150     Object		dataObject;
151     Object		rootObject;
152     float		min[MAX_DIM];
153     float		max[MAX_DIM];
154     int			nDim;
155     Type		type;
156     Category		category;
157     int			rank, shape[32];
158     float		fuzz;
159     Matrix		matrix;
160 };
161 
162 Interpolator	_dxfNewInterpolatorSwitch(Object,
163 				enum interp_init, float, Matrix *);
164 
165 Interpolator	_dxf_NewInterpolator(struct interpolator_class *, Object);
166 
167 Interpolator	_dxf_CopyInterpolator(Interpolator, Interpolator);
168 
169 #define FUZZ_ON	 1
170 #define FUZZ_OFF 0
171 #endif
172 #ifndef __fieldinterpClass
173 #define __fieldinterpClass
174 /***********************************************************************/
175 /* Open Visualization Data Explorer                                    */
176 /* (C) Copyright IBM Corp. 1989,1999                                   */
177 /* ALL RIGHTS RESERVED                                                 */
178 /* This code licensed under the                                        */
179 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
180 /***********************************************************************/
181 
182 
183 typedef struct fieldinterpolator *FieldInterpolator;
184 
185 
186 extern struct fieldinterpolator_class _dxdfieldinterpolator_class;
187 Error _dxfPrimitiveInterpolate(FieldInterpolator, int *, float **, Pointer *, int);
188 Error _dxfno_PrimitiveInterpolate(FieldInterpolator, int *, float **, Pointer *, int);
189 Error _dxfFieldInterpolator_Interpolate(FieldInterpolator, int *, float **, Pointer *, Interpolator *, int);
190 Error _dxfFieldInterpolator_Delete(FieldInterpolator);
191 
192 FieldInterpolator _dxfSelectFieldInterpolator(Field,
193 				enum interp_init, float, Matrix *);
194 
195 int _dxfRecognizeCubesII(Field);
196 int _dxfRecognizeCubesRR(Field);
197 int _dxfRecognizeLinesRR1D(Field);
198 int _dxfRecognizeQuadsRR2D(Field);
199 int _dxfRecognizeTetras(Field);
200 int _dxfRecognizeTrisRI2D(Field);
201 int _dxfRecognizeLinesRI1D(Field);
202 
203 #define DATA_POSITIONS_DEPENDENT	0x01
204 #define DATA_CONNECTIONS_DEPENDENT	0x02
205 #define DATA_FACES_DEPENDENT		0x03
206 
207 struct fieldinterpolator
208 {
209     struct interpolator	   interpolator;
210     int			   initialized;
211     int			   localized;
212     float		   fuzz;
213     int			   data_dependency;
214     InvalidComponentHandle invCon;
215     Pointer		   cstData;
216     Matrix 		   xform;
217     int			   xflag;
218 };
219 
220 FieldInterpolator _dxf_NewFieldInterpolator(Field, float, Matrix *,
221 				struct fieldinterpolator_class *);
222 
223 FieldInterpolator _dxf_CopyFieldInterpolator(FieldInterpolator,
224 				FieldInterpolator, enum _dxd_copy copy);
225 
226 #define ELT_TYPECHECK(field, name)					      \
227 {									      \
228     Object at = DXGetComponentValue(field, "connections");		      \
229     if (! at)								      \
230 	return 0;							      \
231 									      \
232     at = DXGetComponentAttribute(field, "connections", "element type");	      \
233     if (! at) {								      \
234 	DXSetError(ERROR_DATA_INVALID,					      \
235 		"#10255", "connections", "element type");		      \
236 	return 0;							      \
237     }									      \
238 									      \
239     if (DXGetObjectClass(at) != CLASS_STRING) {				      \
240 	DXSetError(ERROR_DATA_INVALID, "#10200", "element type attribute");   \
241 	return 0;							      \
242     }									      \
243 									      \
244     if (strcmp(name, DXGetString((String)at)))				      \
245 	return 0;							      \
246 }
247 #endif
248 #ifndef __cubesIIClass
249 #define __cubesIIClass
250 /***********************************************************************/
251 /* Open Visualization Data Explorer                                    */
252 /* (C) Copyright IBM Corp. 1989,1999                                   */
253 /* ALL RIGHTS RESERVED                                                 */
254 /* This code licensed under the                                        */
255 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
256 /***********************************************************************/
257 
258 
259 
260 typedef struct cubesiiinterpolator *CubesIIInterpolator;
261 
262 
263 extern struct cubesiiinterpolator_class _dxdcubesiiinterpolator_class;
264 Error _dxfCubesIIInterpolator_PrimitiveInterpolate(CubesIIInterpolator, int *, float **, Pointer *, int);
265 Error _dxfCubesIIInterpolator_Delete(CubesIIInterpolator);
266 Object _dxfCubesIIInterpolator_Copy(CubesIIInterpolator, enum _dxd_copy);
267 Interpolator _dxfCubesIIInterpolator_LocalizeInterpolator(CubesIIInterpolator);
268 
269 CubesIIInterpolator _dxfNewCubesIIInterpolator(Field,
270 			enum interp_init, double, Matrix *);
271 
272 int   RecognizeCubesII(Field);
273 
274 #include "binSort.h"
275 
276 struct cubesiiinterpolator
277 {
278     struct fieldinterpolator	fieldInterpolator;
279 
280     Array 		pointsArray;
281     ArrayHandle		pHandle;
282     int			nPoints;
283 
284     Array 		cubesArray;
285     ArrayHandle		cHandle;
286     int			nCubes;
287 
288     Array 		dataArray;
289     ArrayHandle		dHandle;
290     int			nElements;
291 
292     Array               nbrsArray;
293     int                 *nbrs;
294 
295     int			gridCounts[3];
296     int			Cyz, Cz;
297 
298     /*
299      * grid for fast search
300      */
301     int			gridFlag;
302     Grid		grid;
303 
304     int			*visited;
305     int			vCount;
306 
307     int			hint;			/* last cube interpolated */
308 };
309 
310 CubesIIInterpolator _dxf_NewCubesIIInterpolator(Field,
311 				enum interp_init, float, Matrix *,
312 				struct cubesiiinterpolator_class *);
313 
314 CubesIIInterpolator _dxf_CopyCubesIIInterpolator(CubesIIInterpolator,
315 				CubesIIInterpolator, enum _dxd_copy);
316 
317 #endif
318 
319 struct object_class {
320     struct _root root;
321     Class class;
322     char *name;
323     Error (*Delete)();
324     Error (*Shade)();
325     Object (*BoundingBox)();
326     Object (*Paint)();
327     Object (*Gather)();
328     Error (*Partition)();
329     Object (*GetType)();
330     Object (*Copy)();
331 };
332 
333 struct interpolator_class {
334     struct object_class super;
335     Class class;
336     char *name;
337     Error (*Interpolate)();
338     Interpolator (*LocalizeInterpolator)();
339 };
340 
341 struct fieldinterpolator_class {
342     struct interpolator_class super;
343     Class class;
344     char *name;
345     Error (*PrimitiveInterpolate)();
346 };
347 
348 struct cubesiiinterpolator_class {
349     struct fieldinterpolator_class super;
350     Class class;
351     char *name;
352 };
353 
354 struct cubesiiinterpolator_class _dxdcubesiiinterpolator_class = {
355     sizeof(struct cubesiiinterpolator),
356     CLASS_CUBESIIINTERPOLATOR,
357     "cubesiiinterpolator",
358     CLASS_INTERPOLATOR,
359     "interpolator",
360     _dxfCubesIIInterpolator_Delete,
361     _dxfObject_Shade,
362     _dxfObject_BoundingBox,
363     _dxfno_Paint,
364     _dxfno_Gather,
365     _dxfno_Partition,
366     _dxfInterpolator_GetType,
367     _dxfCubesIIInterpolator_Copy,
368     CLASS_FIELDINTERPOLATOR,
369     "fieldinterpolator",
370     _dxfFieldInterpolator_Interpolate,
371     _dxfCubesIIInterpolator_LocalizeInterpolator,
372     CLASS_CUBESIIINTERPOLATOR,
373     "cubesiiinterpolator",
374     _dxfCubesIIInterpolator_PrimitiveInterpolate,
375     CLASS_CUBESIIINTERPOLATOR,
376     "cubesiiinterpolator",
377 };
378 
DXGetCubesIIInterpolatorClass(CubesIIInterpolator o)379 Class DXGetCubesIIInterpolatorClass(CubesIIInterpolator o) {
380     return o? (*(struct cubesiiinterpolator_class **)o)->class: CLASS_MIN;
381 }
382 
383