COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
covWriteFiles.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 /**************************************************************************
9  * Libary to create files in COVISE format *
10  * *
11  * (C) 2001 *
12  * VirCinity IT-Consulting GmbH *
13  * Nobelstrasse 15 *
14  * D-70569 Stuttgart *
15  * Germany *
16  * *
17  * Author: Sven Kufer( sk@viricinity.com) *
18  * Date: 28. Juli 2001 *
19  **************************************************************************/
20 
21 #ifndef _COVISE_WRITEFILELIB
22 #define _COVISE_WRITEFILELIB
23 
24 #include "coFileExport.h"
25 
26 /* COVISE unstructured grid types
27  * See ProgrammingGuide Chapter 3 COVISE DataObjects, Unstructered Grid Types
28  */
29 
30 #if 0
31 #define CELL_TYPES_ONLY
33 #undef CELL_TYPES_ONLY
34 #endif
35 
36 /*************************************************************************
37  * *
38  * 1. Attributes *
39  * *
40  *************************************************************************/
41 
42 /* Every data object in COVISE has attributes. An attribute has a string to store its name
43  * and a string to store the value.
44  *
45  * Most used attributes are : TIMESTEP to indicate a series of timesteps, PART to
46  * put an ID to an object, vertexOrder to control the lightning in the Renderer. See
47  * libtest.cpp for examples.
48  *
49  * Attributes are set by following fields:
50  *
51  * attrNam: list of pointers to attribute names
52  * NOTE: either you give the number of attributes or
53  * this list must be terminated by NULL( set numAttr=COUNT_ATTR in this case)
54  *
55  * attrVal: list of pointers to attribute values
56  * NOTE: see attrName conditions
57  */
58 
59 const int COUNT_ATTR = -1;
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /*************************************************************************
66  * *
67  * 2. Return Values *
68  * *
69  *************************************************************************/
70 
71 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72  * all following functions return 0 in case of an error
73  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74  */
75 
76 /*************************************************************************
77  * *
78  * 3. Open/Close output file *
79  * *
80  *************************************************************************/
81 
82 /* create a .covise output file: returns descriptor for the file */
83 int FILEEXPORT covOpenOutFile(const char *filename);
84 
85 /* close output file */
86 int FILEEXPORT covCloseOutFile(int fd);
87 
88 /*************************************************************************
89  * *
90  * 4. COVISE objects *
91  * *
92  *************************************************************************/
93 
94 /********************************************************************
95  * *
96  * Following functions allow you to write out all kind of *
97  * COVISE data types. *
98  * *
99  * See ProgrammingGuide for detailed description. *
100  * *
101  * Common parameters: *
102  * int fd - file descriptor *
103  * which was returned by covOpenOutFile *
104  * *
105  * char **attrNam, char **attrVal, int numAttr - *
106  * see Chapter Attributes *
107  * *
108  ********************************************************************/
109 
110 /* Unstructured Grid */
111 int FILEEXPORT covWriteUNSGRD(int fd, int numElem, int numConn, int numVert,
112  int *elemList, int *connList, int *typeList,
113  float *xCoord, float *yCoord, float *zCoord,
114  char **attrNam, char **attrVal, int numAttr);
115 
116 /* Unstructured Float Scalar Data */
117 int FILEEXPORT covWriteUSTSDT(int fd, int numElem, float *values,
118  char **attrNam, char **attrVal, int numAttr);
119 
120 /* Unstructured Integer Scalar Data */
121 int FILEEXPORT covWriteINTDT(int fd, int numElem, int *values,
122  char **attrNam, char **attrVal, int numAttr);
123 
124 /* Unstructured Byte Scalar Data */
125 int FILEEXPORT covWriteBYTEDT(int fd, int numElem, unsigned char *values,
126  char **attrNam, char **attrVal, int numAttr);
127 
128 /* Unstructured Vector Data*/
129 int FILEEXPORT covWriteUSTVDT(int fd, int numElem,
130  float *comp1, float *comp2, float *comp3,
131  char **attrNam, char **attrVal, int numAttr);
132 
133 /* Unstructured Tensor Data */
134 int FILEEXPORT covWriteUSTTDT(int fd, int numElem, int type, float *values,
135  char **attrNam, char **attrVal, int numAttr);
136 
137 /* Points */
138 int FILEEXPORT covWritePOINTS(int fd, int numPoints,
139  float *xCoord, float *yCoord, float *zCoord,
140  char **attrNam, char **attrVal, int numAttr);
141 
142 /* Spheres */
143 int FILEEXPORT covWriteSPHERES(int fd, int numSpheres,
144  float *xCoord, float *yCoord, float *zCoord, float *radius,
145  char **attrNam, char **attrVal, int numAttr);
146 
147 /* String object */
148 int FILEEXPORT covWriteDOTEXT(int fd, int numElem, char *data,
149  char **attrNam, char **attrVal, int numAttr);
150 
151 /* Polygon */
152 int FILEEXPORT covWritePOLYGN(int fd, int numPolygons, int *polyList,
153  int numCorners, int *cornerList, int numPoints,
154  float *xCoord, float *yCoord, float *zCoord,
155  char **attrNam, char **attrVal, int numAttr);
156 
157 /* Lines */
158 int FILEEXPORT covWriteLINES(int fd, int numLines, int *lineList,
159  int numCorners, int *cornerList, int numPoints,
160  float *xCoord, float *yCoord, float *zCoord,
161  char **attrNam, char **attrVal, int numAttr);
162 
163 /* Triangles */
164 int FILEEXPORT covWriteTRI(int fd,
165  int numCorners, int *cornerList, int numPoints,
166  float *xCoord, float *yCoord, float *zCoord,
167  char **attrNam, char **attrVal, int numAttr);
168 
169 /* Quads */
170 int FILEEXPORT covWriteQUADS(int fd,
171  int numCorners, int *cornerList, int numPoints,
172  float *xCoord, float *yCoord, float *zCoord,
173  char **attrNam, char **attrVal, int numAttr);
174 
175 /* Triangle Strips */
176 int FILEEXPORT covWriteTRIANG(int fd, int numStrips, int *stripList,
177  int numCorners, int *cornerList, int numPoints,
178  float *xCoord, float *yCoord, float *zCoord,
179  char **attrNam, char **attrVal, int numAttr);
180 
181 /* Uniform Grid */
182 int FILEEXPORT covWriteUNIGRD(int fd, int xsize, int ysize, int zsize,
183  float xmin, float xmax,
184  float ymin, float ymax,
185  float zmin, float zmax,
186  char **attrNam, char **attrVal, int numAttr);
187 
188 /* Rectilinear Grid */
189 int FILEEXPORT covWriteRCTGRD(int fd, int xsize, int ysize, int zsize,
190  float *xCoord, float *yCoord, float *zCoord,
191  char **attrNam, char **attrVal, int numAttr);
192 
193 /* Structured Grid */
194 int FILEEXPORT covWriteSTRGRD(int fd, int xsize, int ysize, int zsize,
195  float *xCoord, float *yCoord, float *zCoord,
196  char **attrNam, char **attrVal, int numAttr);
197 
198 /* Structured Scalar Data */
199 int FILEEXPORT covWriteSTRSDT(int fd, int numElem, float *data,
200  int xsize, int ysize, int zsize,
201  char **attrNam, char **attrVal, int numAttr);
202 
203 /* Structured Vector Data */
204 int FILEEXPORT covWriteSTRVDT(int fd, int numElem,
205  float *data_x, float *data_y, float *data_z,
206  int xsize, int ysize, int zsize,
207  char **attrNam, char **attrVal, int numAttr);
208 
209 /* RGBA Data */
210 int FILEEXPORT covWriteRGBADT(int fd, int numElem, int *colors,
211  char **attrNam, char **attrVal, int numAttr);
212 
213 /* Multi-dimensional Integer Array*/
214 int FILEEXPORT covWriteINTARR(int fd, int numDim, int numElem, int *dim_array, int *data,
215  char **attrNam, char **attrVal, int numAttr);
216 
217 /* Texture */
218 int FILEEXPORT covWriteTEXTUR(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize,
219  int PixelImageFormatId, char *PixelImageBuffer,
220  char **ImageattrNam, char **ImageattrVal, int numImageAttr,
221  int NumberOfBorderPixels, int NumberOfComponents, int Level,
222  int NumberOfCoordinates, int NumberOfVertices, int *VertexIndices,
223  float **Coords, char **TextattrNam, char **TextattrVal, int numAttr);
224 
225 /* Pixel Image */
226 int FILEEXPORT covWriteIMAGE(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize,
227  int PixelImageFormatId, char *PixelImageBuffer,
228  char **ImageattrNam, char **ImageattrVal, int numAttr);
229 
230 /* OCT Tree */
231 int FILEEXPORT covWriteOCTREE(int fd,
232  int numCellLists,
233  int numMacroCellLists,
234  int numCellBBoxes,
235  int numGridBBoxes,
236  int *cellLists,
237  int *macroCellLists,
238  float *cellBBoxes,
239  float *gridBBoxes,
240  int fX,
241  int fY,
242  int fZ,
243  int max_no_levels);
244 
245 /*************************************************************************
246  * *
247  * 5. Grouping objects *
248  * *
249  *************************************************************************/
250 
251 /********************************************************************
252  * *
253  * 5. 1. Sets *
254  * *
255  ********************************************************************/
256 
257 /* Grouping objects is done by a set. For example, you define an object which contains several parts
258  * by set of these parts. Or you define a series of time steps by a set of all time steps.
259  * See libtest.cpp for an example.
260  *
261  * You have to use the following order to write a set of elements into a COVISE file:
262  *
263  * covWriteSetBegin
264  * <write all elements of the set>
265  * covWriteSetEnd
266  *
267  * NOTE: every element can be an COVISE data object or a set of elements.
268  *
269  */
270 
271 /* Start a set of "numElem" elements */
272 int FILEEXPORT covWriteSetBegin(int fd, int numElem);
273 
274 /* End a set by its attributes */
275 int FILEEXPORT covWriteSetEnd(int fd, char **attrNam, char **attrVal, int numAttr);
276 
277 /********************************************************************
278  * *
279  * 5. 2. Geometry Container *
280  * *
281  ********************************************************************/
282 
283 /* The Geometry container is a special set to give the Renderer the object information
284  * in a structured way. In general this set is filled by the module Collect.
285  *
286  * A geometry object is required for every Geometry container. The geometry
287  * object at the end of the pipeline normally consists of either polygons or lines.
288  * Optional you can add: color information( given by the Colors module), normals and textures.
289  *
290  * Content sum:
291  * geometry: required
292  * colors(RGBADT): optional
293  * normals(USTVDT): optional
294  * textures(TEXTUR): optional
295  * If you want to use an additional part set has_xxx to 1. Else set has_xxx to 0.
296  *
297  * NOTE: The Geometry container is a top level set. It musn't be included in another set.
298  *
299  */
300 int FILEEXPORT covWriteGeometryBegin(int fd, int has_colors, int has_normals, int has_texture);
301 
302 /* end with attributes of Geometry container */
303 int FILEEXPORT covWriteGeometryEnd(int fd, char **attrNam, char **attrVal, int numAttr);
304 
305 /* write reference to object */
306 extern int FILEEXPORT covWriteOBJREF(int fd, int num);
307 #ifdef __cplusplus
308 }
309 #endif
310 #endif
int covWriteGeometryBegin(int fd, int has_colors, int has_normals, int has_texture)
Definition: covFiles.c:419
int covWriteSTRSDT(int fd, int numElem, float *data, int xsize, int ysize, int zsize, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1362
int covWriteLINES(int fd, int numLines, int *lineList, int numCorners, int *cornerList, int numPoints, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:888
GLboolean GLenum GLenum GLvoid * values
Definition: khronos-glext.h:6369
int covOpenOutFile(const char *filename)
Definition: covFiles.c:166
int covWriteRCTGRD(int fd, int xsize, int ysize, int zsize, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1086
int covWriteBYTEDT(int fd, int numElem, unsigned char *x, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1768
int covWriteGeometryEnd(int fd, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:437
GLclampd zmax
Definition: khronos-glext.h:11392
int covCloseOutFile(int fd)
Definition: covFiles.c:232
int covWriteINTDT(int fd, int numElem, int *x, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1727
#define FILEEXPORT
Definition: coExport.h:87
int covWriteTEXTUR(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize, int PixelImageFormatId, char *PixelImageBuffer, char **ImageatNam, char **ImageatVal, int numImageAttr, int NumberOfBorderPixels, int NumberOfComponents, int Level, int NumberOfCoordinates, int NumberOfVertices, int *VertexIndices, float **Coords, char **TextatNam, char **TextatVal, int numTextAttr)
Definition: covFiles.c:1603
int covWriteOCTREE(int fd, int numCellLists, int numMacroCellLists, int numCellBBoxes, int numGridBBoxes, int *cellLists, int *macroCellLists, float *cellBBoxes, float *gridBBoxes, int fX, int fY, int fZ, int max_no_levels)
Definition: covFiles.c:1858
int covWriteSTRGRD(int fd, int xsize, int ysize, int zsize, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1142
int covWriteTRI(int fd, int numCorners, int *cornerList, int numPoints, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:918
int covWriteQUADS(int fd, int numCorners, int *cornerList, int numPoints, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:942
int covWriteUSTTDT(int fd, int numElem, int type, float *x, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1244
int covWriteUNIGRD(int fd, int xsize, int ysize, int zsize, float xmin, float xmax, float ymin, float ymax, float zmin, float zmax, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1032
int covWriteSPHERES(int fd, int numSphere, float *x, float *y, float *z, float *radius, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:631
int covWriteSetEnd(int fd, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:480
int covWriteSetBegin(int fd, int numElem)
Definition: covFiles.c:470
int covWriteUNSGRD(int fd, int numElem, int numConn, int numVert, int *el, int *cl, int *tl, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:555
GLenum type
Definition: khronos-glext.h:6279
int covWriteUSTSDT(int fd, int numElem, float *x, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1193
int covWritePOLYGN(int fd, int numPolygons, int *polyList, int numCorners, int *cornerList, int numPoints, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:859
int covWriteTRIANG(int fd, int numStrips, int *stripList, int numCorners, int *cornerList, int numPoints, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:966
int covWriteUSTVDT(int fd, int numElem, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1304
int covWritePOINTS(int fd, int numElem, float *x, float *y, float *z, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:694
int covWriteRGBADT(int fd, int numElem, int *colors, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1468
int covWriteINTARR(int fd, int numDim, int numElem, int *dim_array, int *data, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1678
GLuint GLuint num
Definition: khronos-glext.h:10593
int covWriteSTRVDT(int fd, int numElem, float *data_x, float *data_y, float *data_z, int xsize, int ysize, int zsize, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:1421
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
const int COUNT_ATTR
Definition: covWriteFiles.h:59
int covWriteIMAGE(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize, int PixelImageFormatId, char *PixelImageBuffer, char **ImageatNam, char **ImageatVal, int numAttr)
Definition: covFiles.c:1526
int covWriteDOTEXT(int fd, int numElem, char *data, char **atNam, char **atVal, int numAttr)
Definition: covFiles.c:741
int covWriteOBJREF(int fd, int objNum)
Definition: covFiles.c:1926