COVISE Core
File16.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#ifndef __FILE16_H_
9#define __FILE16_H_
10
11#include "istreamFTN.h"
12#include "StarFile.h"
13
14#include <covise/covise.h>
15#include <util/coTypes.h>
16
17/****************************
18
19Element indices: Cov = continuous , SAMMs split
20 Star = continuous , incl. SAMM
21 Pro = non-continuous , SAMMs split
22*****************************/
23
24namespace covise
25{
26
28{
29private:
30 File16(const File16 &);
32 void unblank(char *str, int length);
33
34 // we need this to check whether file has changed
35 ino_t d_inode;
36 dev_t d_device;
37
38 // if this exists, it gives original index of given new cell
39 // index for SAMM conversion
43
44 // this is a function that dumps a text to somewhere;
45 void (*dumper)(const char *);
46
47 // our default: print to stderr
48 static void printStderr(const char *text);
49
50public:
51 // read File16 from a file
52 File16(int fd, void (*dumpFunct)(const char *) = NULL);
53
54 // destructor
55 ~File16();
56
57 // check whether constructed File16 object is valid
58 int isValid();
59
60 // get the sizes for allocation
61 void getMeshSize(int &numCells, int &numConn, int &numVert);
62
63 void getMesh(int *elPtr, int *clPtr, int *tlPtr,
64 float *xPtr, float *yPtr, float *zPtr,
65 int *typPtr);
66
67 void getReducedMesh(
68 int *el, int *cl, int *tl,
69 int *starToCov,
70 float *vx, float *vy, float *vz,
71 int *eLenPtr, int *cLenPtr, int *vLenPtr,
72 int *typPtr);
73
74 // get the sizes for Region patches
75 void getRegionPatchSize(int region, int &numPoly, int &numConn, int &numVert);
76
77 // get the patches for this region
78 void getRegionPatch(int region, int *elPtr, int *clPtr,
79 float *xPtr, float *yPtr, float *zPtr);
80
81 // Access translation table Covise->Prostar
82 int getMaxProstarIdx();
83
84 // create the Mapping covise-prostar
85 void createMap(int calcSolids);
86
87 // get some info about the data set
88 float getScale()
89 {
90 return scale8;
91 }
93 {
94 return jvers;
95 }
97 {
98 return numMaterials;
99 }
101 {
102 return maxscl;
103 }
104 const char *getScalName(int i);
105
106 // number of vertices for given cell shape
107 static const int numVert[8];
108
109 // Numbers for part of USG
110 enum
111 {
112 HEXAGON = 7,
113 PRISM = 6,
114 PYRAMID = 5,
115 TETRAHEDRON = 4,
116 QUAD = 3,
118 BAR = 1,
119 SAMM = 12
120 };
121
122 struct Header1
123 {
124 int maxn, maxe;
125 int is[3];
126 int jvers;
127 int numw, ni, nj, nk, nf, maxb, ibfill, novice, maxr, nline, maxcy,
128 lsctype, rmsize, inpech, isver, maxs, mxbl, istop;
129 };
130
131 int maxn, maxe;
132 int is[3];
133 int jvers;
134 int numw, ni, nj, nk, nf, maxb, ibfill, novice, maxr, nline, maxcy,
135 lsctype, rmsize, inpech, isver, maxs, mxbl, istop;
136
137 struct CycCoup // Max Number of Cells in Cyclic
138 {
139 int ncydmf; // and coupled Cells V3000+
141 };
142
145
147 {
148 char main[80], sub1[80], sub2[80];
149 } title;
150
156
157 struct LSRecord
158 {
159 int LS[29];
160 int IS[99];
161 int LS30;
162 int nprsf[3];
164 int dummy[128]; // make sure we have some space...
165 } LSrec;
166
167 struct PropInfo
168 {
169 int is;
170 int lmdef[99];
171 } propInfo;
172
173 int nbnd[6];
174
175 struct Header2
176 {
177 int mxtb, lturbi, lturbp, setadd, nsens, npart;
178 float scale8;
179 int maxcp, loc180, mver, maxscl, istype, mxstb, numcp, ioptbc,
180 lturbf, lturbt, maxcrs, pbtol;
181 float keysd[6];
182 };
183
184 int mxtb, lturbi, lturbp, setadd, nsens, npart;
185 float scale8;
186 int maxcp, loc180, mver, maxscl, istype, mxstb, numcp, ioptbc,
187 lturbf, lturbt, maxcrs, pbtol;
188 float keysd[6];
189
191
193 {
195 int slave[24];
196 } *cp22;
197
199 {
201 int slave[50];
202 } *cp23;
203
204 enum
205 {
206 MAX_CP = 128
207 };
209 {
211 int slave[MAX_CP];
213 char slaveSide[MAX_CP];
214 } *cp30; // compressed: fills gaps
215
216 // how many CPs are really saved
218
220
221 char **scalName;
222
223 int calcSolids, numCovCells, numCovConn,
224 numOrigStarCells; // how many cells in the original Star data set
226
228
230
232 // 1 = true
233 // 0 = false
234 // -1 = could not stat file
235 int isFile(const char *filename);
236
237 // Data file index [Covise cell number]
238 const int *getCovToStar()
239 {
240 return covToStar;
241 }
242
243 // split Prostar index [Covise cell number]
244 const int *getCovToPro()
245 {
246 return covToPro;
247 };
248
249 // set the dump device: must be a pointer to 'void funct(const char *)'
250 void setDumper(void (*newDumper)(const char *));
251
253 {
254 return (jvers > 2310) ? pbtol : 0;
255 }
256
257 // access CP list:
258
259 // get
260 void getCPsizes(int &numVert, int &numConn, int &numPoly);
261
262 // get a specified face from a certain cell:
263 // RETURN shape (0/3/4)=(none/Tri/Quad) + 0-4 vertices
264 void getface(int cellNo, int faceNo, int &shape, int vert[4]);
265
266 int findNewCell(int oldCell);
267
268 void getCPPoly(float *xVert, float *yVert, float *zVert,
269 float *xPoly, float *yPoly, float *zPoly,
270 int *polyTab, int *connTab);
271
272 void getMovedRegionPatch(int reqRegion, float *xv, float *yv, float *zv,
273 int *polyPtr, int *connPtr,
274 float *x, float *y, float *z);
275};
276}
277#endif
#define STAREXPORT
Definition: coExport.h:212
#define NULL
Definition: covise_list.h:22
GLdouble GLdouble z
Definition: khronos-glext.h:6565
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
static Repl dummy("", "")
int main()
Definition: libexample.c:11
list of all chemical elements
Definition: coConfig.h:27
Definition: IsoSurfaceGPMUtil.h:42
Definition: File16.h:28
int ibfill
Definition: File16.h:134
struct VertexTabEntry * vertexTab
Definition: File16.h:155
float getScale()
Definition: File16.h:88
File16 & operator=(const File16 &)
struct CellTabEntry * cellTab
Definition: File16.h:151
int ioptbc
Definition: File16.h:186
int getVersion()
Definition: File16.h:92
File16(const File16 &)
const int * getCovToPro()
Definition: File16.h:244
int numMaterials
Definition: File16.h:229
int * oldOfNewCell
Definition: File16.h:40
float scale8
Definition: File16.h:185
int getNumSAMM()
Definition: File16.h:252
int getNumMat()
Definition: File16.h:96
int * covToStar
Definition: File16.h:41
int lturbi
Definition: File16.h:184
dev_t d_device
Definition: File16.h:36
struct RegionSize * regionSize
Definition: File16.h:219
char ** scalName
Definition: File16.h:221
struct BounTabEntry * bounTab
Definition: File16.h:153
ino_t d_inode
Definition: File16.h:35
void unblank(char *str, int length)
int ncpdmf
Definition: File16.h:144
int numRealCP
Definition: File16.h:217
int numOrigStarCells
Definition: File16.h:224
struct CellTypeEntry * cellType
Definition: File16.h:190
int * covToPro
Definition: File16.h:42
int * cells_used
Definition: File16.h:227
const int * getCovToStar()
Definition: File16.h:238
int calcSolids
Definition: File16.h:223
int getNumScal()
Definition: File16.h:100
int lturbf
Definition: File16.h:187
int ncydmf
Definition: File16.h:143
int jvers
Definition: File16.h:133
struct SammTabEntry * sammTab
Definition: File16.h:152
int * cellShapeArr
Definition: File16.h:225
int * regionType
Definition: File16.h:154
int maxe
Definition: File16.h:131
int inpech
Definition: File16.h:135
Definition: File16.h:123
int maxe
Definition: File16.h:124
int jvers
Definition: File16.h:126
int inpech
Definition: File16.h:128
int ibfill
Definition: File16.h:127
Definition: File16.h:138
int ncpdmf
Definition: File16.h:140
int ncydmf
Definition: File16.h:139
Definition: File16.h:147
Definition: File16.h:158
int LS30
Definition: File16.h:161
int nprobs
Definition: File16.h:163
Definition: File16.h:168
int is
Definition: File16.h:169
Definition: File16.h:176
int ioptbc
Definition: File16.h:179
int lturbi
Definition: File16.h:177
float scale8
Definition: File16.h:178
int lturbf
Definition: File16.h:180
Definition: File16.h:193
int master
Definition: File16.h:194
Definition: File16.h:199
int master
Definition: File16.h:200
Definition: File16.h:209
char masterSide
Definition: File16.h:212
int master
Definition: File16.h:210
Definition: StarFile.h:63
Definition: StarFile.h:66
Definition: StarFile.h:72
Definition: StarFile.h:78
Definition: StarFile.h:84
Definition: StarFile.h:89
Definition: StarFile.h:94