COVISE Core
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
59const int COUNT_ATTR = -1;
60
61#ifdef __cplusplus
62extern "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 */
83int FILEEXPORT covOpenOutFile(const char *filename);
84
85/* close output file */
86int 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 */
111int 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 */
117int FILEEXPORT covWriteUSTSDT(int fd, int numElem, float *values,
118 char **attrNam, char **attrVal, int numAttr);
119
120/* Unstructured Integer Scalar Data */
121int FILEEXPORT covWriteINTDT(int fd, int numElem, int *values,
122 char **attrNam, char **attrVal, int numAttr);
123
124/* Unstructured Byte Scalar Data */
125int FILEEXPORT covWriteBYTEDT(int fd, int numElem, unsigned char *values,
126 char **attrNam, char **attrVal, int numAttr);
127
128/* Unstructured Vector Data*/
129int 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 */
134int FILEEXPORT covWriteUSTTDT(int fd, int numElem, int type, float *values,
135 char **attrNam, char **attrVal, int numAttr);
136
137/* Points */
138int FILEEXPORT covWritePOINTS(int fd, int numPoints,
139 float *xCoord, float *yCoord, float *zCoord,
140 char **attrNam, char **attrVal, int numAttr);
141
142/* Spheres */
143int 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 */
148int FILEEXPORT covWriteDOTEXT(int fd, int numElem, char *data,
149 char **attrNam, char **attrVal, int numAttr);
150
151/* Polygon */
152int 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 */
158int 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 */
164int 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 */
170int 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 */
176int 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 */
182int 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 */
189int 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 */
194int 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 */
199int 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 */
204int 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 */
210int FILEEXPORT covWriteRGBADT(int fd, int numElem, int *colors,
211 char **attrNam, char **attrVal, int numAttr);
212
213/* Multi-dimensional Integer Array*/
214int FILEEXPORT covWriteINTARR(int fd, int numDim, int numElem, int *dim_array, int *data,
215 char **attrNam, char **attrVal, int numAttr);
216
217/* Texture */
218int 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 */
226int 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 */
231int 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 */
272int FILEEXPORT covWriteSetBegin(int fd, int numElem);
273
274/* End a set by its attributes */
275int 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 */
300int FILEEXPORT covWriteGeometryBegin(int fd, int has_colors, int has_normals, int has_texture);
301
302/* end with attributes of Geometry container */
303int FILEEXPORT covWriteGeometryEnd(int fd, char **attrNam, char **attrVal, int numAttr);
304
305/* write reference to object */
306extern int FILEEXPORT covWriteOBJREF(int fd, int num);
307#ifdef __cplusplus
308}
309#endif
310#endif
#define FILEEXPORT
Definition: coExport.h:105
GLclampd zmax
Definition: khronos-glext.h:11392
GLboolean GLenum GLenum GLvoid * values
Definition: khronos-glext.h:6369
GLuint GLuint num
Definition: khronos-glext.h:10593
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
GLenum type
Definition: khronos-glext.h:6279
int FILEEXPORT covWriteTRIANG(int fd, int numStrips, int *stripList, int numCorners, int *cornerList, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1013
int FILEEXPORT covWriteINTDT(int fd, int numElem, int *values, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1830
int FILEEXPORT covWriteRCTGRD(int fd, int xsize, int ysize, int zsize, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1142
int FILEEXPORT covWritePOLYGN(int fd, int numPolygons, int *polyList, int numCorners, int *cornerList, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:906
int FILEEXPORT covWriteTRI(int fd, int numCorners, int *cornerList, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:965
int FILEEXPORT covWriteOBJREF(int fd, int num)
Definition: covFiles.c:2029
const int COUNT_ATTR
Definition: covWriteFiles.h:59
int FILEEXPORT covWriteTEXTUR(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize, int PixelImageFormatId, char *PixelImageBuffer, char **ImageattrNam, char **ImageattrVal, int numImageAttr, int NumberOfBorderPixels, int NumberOfComponents, int Level, int NumberOfCoordinates, int NumberOfVertices, int *VertexIndices, float **Coords, char **TextattrNam, char **TextattrVal, int numAttr)
Definition: covFiles.c:1706
int FILEEXPORT covWriteUSTVDT(int fd, int numElem, float *comp1, float *comp2, float *comp3, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1380
int FILEEXPORT covWriteSTRVDT(int fd, int numElem, float *data_x, float *data_y, float *data_z, int xsize, int ysize, int zsize, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1518
int FILEEXPORT covWriteSTRGRD(int fd, int xsize, int ysize, int zsize, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1213
int FILEEXPORT covWriteSTRSDT(int fd, int numElem, float *data, int xsize, int ysize, int zsize, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1445
int FILEEXPORT covWriteQUADS(int fd, int numCorners, int *cornerList, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:989
int FILEEXPORT covWriteBYTEDT(int fd, int numElem, unsigned char *values, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1871
int FILEEXPORT covWriteRGBADT(int fd, int numElem, int *colors, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1571
int FILEEXPORT 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:1961
int FILEEXPORT covWriteDOTEXT(int fd, int numElem, char *data, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:788
int FILEEXPORT covWritePOINTS(int fd, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:741
int FILEEXPORT covWriteUSTSDT(int fd, int numElem, float *values, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1269
int FILEEXPORT covWriteSetBegin(int fd, int numElem)
Definition: covFiles.c:517
int FILEEXPORT covWriteUSTTDT(int fd, int numElem, int type, float *values, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1320
int FILEEXPORT covWriteINTARR(int fd, int numDim, int numElem, int *dim_array, int *data, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1781
int FILEEXPORT covWriteUNSGRD(int fd, int numElem, int numConn, int numVert, int *elemList, int *connList, int *typeList, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:602
int FILEEXPORT covWriteSetEnd(int fd, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:527
int FILEEXPORT covOpenOutFile(const char *filename)
Definition: covFiles.c:195
int FILEEXPORT covWriteSPHERES(int fd, int numSpheres, float *xCoord, float *yCoord, float *zCoord, float *radius, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:678
int FILEEXPORT covWriteUNIGRD(int fd, int xsize, int ysize, int zsize, float xmin, float xmax, float ymin, float ymax, float zmin, float zmax, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:1079
int FILEEXPORT covWriteIMAGE(int fd, int PixelImageWidth, int PixelImageHeight, int PixelImageSize, int PixelImageFormatId, char *PixelImageBuffer, char **ImageattrNam, char **ImageattrVal, int numAttr)
Definition: covFiles.c:1629
int FILEEXPORT covWriteGeometryEnd(int fd, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:484
int FILEEXPORT covWriteLINES(int fd, int numLines, int *lineList, int numCorners, int *cornerList, int numPoints, float *xCoord, float *yCoord, float *zCoord, char **attrNam, char **attrVal, int numAttr)
Definition: covFiles.c:935
int FILEEXPORT covCloseOutFile(int fd)
Definition: covFiles.c:271
int FILEEXPORT covWriteGeometryBegin(int fd, int has_colors, int has_normals, int has_texture)
Definition: covFiles.c:466