COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 
19 Element indices: Cov = continuous , SAMMs split
20  Star = continuous , incl. SAMM
21  Pro = non-continuous , SAMMs split
22 *****************************/
23 
24 namespace covise
25 {
26 
28 {
29 private:
30  File16(const File16 &);
31  File16 &operator=(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
41  int *covToStar;
42  int *covToPro;
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 
50 public:
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  }
92  int getVersion()
93  {
94  return jvers;
95  }
96  int getNumMat()
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,
117  TRIANGLE = 2,
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+
140  int ncpdmf;
141  };
142 
143  int ncydmf;
144  int ncpdmf;
145 
146  struct TitleRead
147  {
148  char main[80], sub1[80], sub2[80];
149  } title;
150 
151  struct CellTabEntry *cellTab;
152  struct SammTabEntry *sammTab;
153  struct BounTabEntry *bounTab;
155  struct VertexTabEntry *vertexTab;
156 
157  struct LSRecord
158  {
159  int LS[29];
160  int IS[99];
161  int LS30;
162  int nprsf[3];
163  int nprobs;
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 
190  struct CellTypeEntry *cellType;
191 
193  {
194  int master;
195  int slave[24];
196  } *cp22;
197 
199  {
200  int master;
201  int slave[50];
202  } *cp23;
203 
204  enum
205  {
206  MAX_CP = 128
207  };
209  {
210  int master;
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
int rmsize
Definition: File16.h:127
int jvers
Definition: File16.h:133
#define STAREXPORT
Definition: coExport.h:188
int * oldOfNewCell
Definition: File16.h:40
int rmsize
Definition: File16.h:134
int getNumMat()
Definition: File16.h:96
struct RegionSize * regionSize
Definition: File16.h:219
struct SammTabEntry * sammTab
Definition: File16.h:152
static Repl dummy("","")
Definition: File16.h:208
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
int ncydmf
Definition: File16.h:139
int nprobs
Definition: File16.h:163
int numRealCP
Definition: File16.h:217
struct CellTypeEntry * cellType
Definition: File16.h:190
Definition: IsoSurfaceGPMUtil.h:41
int LS30
Definition: File16.h:161
Definition: File16.h:175
int master
Definition: File16.h:200
#define NULL
Definition: covise_list.h:22
Definition: File16.h:27
float scale8
Definition: File16.h:185
int * covToStar
Definition: File16.h:41
int pbtol
Definition: File16.h:186
int master
Definition: File16.h:210
GLdouble GLdouble z
Definition: khronos-glext.h:6565
const int * getCovToStar()
Definition: File16.h:238
Definition: File16.h:198
const int * getCovToPro()
Definition: File16.h:244
int setadd
Definition: File16.h:184
Definition: File16.h:146
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
Definition: File16.h:137
int * regionType
Definition: File16.h:154
int * cellShapeArr
Definition: File16.h:225
int jvers
Definition: File16.h:126
int maxn
Definition: File16.h:124
float scale8
Definition: File16.h:178
Definition: File16.h:157
char masterSide
Definition: File16.h:212
int is
Definition: File16.h:169
struct VertexTabEntry * vertexTab
Definition: File16.h:155
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
ino_t d_inode
Definition: File16.h:35
Definition: File16.h:122
int maxn
Definition: File16.h:131
int main()
Definition: libexample.c:11
float getScale()
Definition: File16.h:88
int * cells_used
Definition: File16.h:227
int ncpdmf
Definition: File16.h:144
int numMaterials
Definition: File16.h:229
char ** scalName
Definition: File16.h:221
Definition: StarFile.h:93
int getNumSAMM()
Definition: File16.h:252
Definition: File16.h:192
struct BounTabEntry * bounTab
Definition: File16.h:153
int pbtol
Definition: File16.h:179
Definition: StarFile.h:62
int getNumScal()
Definition: File16.h:100
int ncydmf
Definition: File16.h:143
struct CellTabEntry * cellTab
Definition: File16.h:151
int master
Definition: File16.h:194
int ncpdmf
Definition: File16.h:140
dev_t d_device
Definition: File16.h:36
Definition: File16.h:167
int setadd
Definition: File16.h:177
int * covToPro
Definition: File16.h:42
int getVersion()
Definition: File16.h:92
int numOrigStarCells
Definition: File16.h:223
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279