COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
File29.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 __FILE29_H_
9 #define __FILE29_H_
10 
11 #include <covise/covise.h>
12 #include <util/coTypes.h>
13 
14 #include "istreamBLK.h"
15 #include "StarFile.h"
16 
17 namespace covise
18 {
19 
20 class STAREXPORT File29 : public StarFile
21 {
22 public:
23  typedef float float32;
24  typedef int int32;
25  struct DropRec
26  {
27  int32 iorg, idt, idc; // FORTRAN header later overwritten by index
28  float32 x, y, z, u, v, w;
29  float32 dens, diam, mass, coun, temp;
30  };
31 
32 private:
33  File29(const File29 &);
34  File29 &operator=(const File29 &);
35  File29();
37 
38  void analyseHeader();
39  long readHeader(long blockNo);
40  long actualHeaderBlock, nextHeaderBlock; //,blk_per_step;
41  int numSteps;
42 
43  // this is a function that dumps a text to somewhere;
44  void (*dumper)(const char *);
45 
46  // our default: print to stderr
47  static void printStderr(const char *text);
48 
49  // we need this to check whether file has changed
50  ino_t d_inode;
51  dev_t d_device;
52 
53  // Number of nroplets in timestep
54  int d_numDrops[50000];
55 
56  // we read Droplets in this structure
58 
59  // timestep in the structure
62 
63  // Size factor for elimination or 'bad' particles: eliminate all > fact*avgSize
65 
66 public:
67  // struct Header {
68 
69  int iter;
70  float time;
71  int ncell, // 1
72  nbc, // 2
73  nbw, // 3
74  nbs, // 4
75  nbb, // 5
76  nnode; // 6
77  char title[52]; // 7-
78  int nbcyc, // 22
79  nbcut, // 23
80  nsol, // 24
81  numcon, // 25
82  lvers, // 26
83  ndrop9_, // 27
84  ndrop9, // 28
85  ncitem, // 29
86  nvitem, // 30
87  nsitem, // 31
88  lmvgrd, // 32
89  lct_field1[12], // 33 - 44
90  field45_56[12], // 45 - 56
91  lsrf_field1[17], // 57 - 73
92  lct1_6, // 74
93  field75_90[16], // 75 - 90
94  lct_field2[3], // 91 - 73
95  field94_98[5], // 94 - 98
96  ntcell, // 99
97  field100, // 100
98  lct_field3[47], // 101 - 147
99  field148_199[52], // 148 - 199
100  nummat, // 200
101  nsmat; // 201
102  float materials[799]; // 202 - 1000
103  int lsrf_field2[47], // 1001 - 1047
104  lsrf_field3[47], // 1048 - 1094
105  field1095_1345[251], // 1095 - 1345
106  lct20, // 1346
107  field1347_1799[453], // 1347 - 1799
108  lstar[100], // 1800 - 1899 (FTN: lstar[1]->1801
109  field1900_1909[10], // 1900 - 1909
110  nbsio, // 1910
111  nwprsm, // 1911
112  nprsm, // 1912
113  nbsi, // 1913
114  ias, // 1914
115  itypen, // 1915
116  icoup, // 1916
117  mspin, // 1917
118  iunben, // 1918
119  field1919_2048[130]; // 1919 - 2048
120 
122 
123  // postconv fields
124  int lct[201], lsrf[201], ndata[201][4], ndrec, irasi, irpsm, ircnd;
125  /*
126  enum { VELOCITY = 1, // 1
127  VMAG, // 2
128  U,V,W, // 3 4 5
129  PRESSURE, // 6
130  TE,ED, // 7 8
131  TVIS,TEMPERATURE,DENSITY, // 9 10 11
132  LAMVIS,CP,COND, // 12 13 14
133  DROP_COORD, DROP_VEL, // 15 16
134  DROP_DENS, DROP_DIAM, // 17 18
135  DROP_TEMP, DROP_NO, // 19 20
136  DROP_MASS, // 21
137  SCALAR } ; // 22
138  // Scalar_1 = 22
139  // Scalar_6 = 27 ...
140  */
141 
142  ~File29();
143 
144  // see setDumper()
145  File29(int fd, void (*dumpFunct)(const char *) = NULL);
146 
147  int isValid()
148  {
149  return (ncell != 0);
150  }
151 
152  long skip_to_step(int stepNo);
153  int skip_to_time(float time);
154  int skip_to_field(int fieldNo);
155  long skip_to_next_field();
156 
157  float getRealTime(int step);
158 
159  int getVertexCoordinates(int step,
160  float *x, float *y, float *z,
161  int *len);
162  int readField(int step, int field,
163  int *starToCov, int elements,
164  float *f1, float *f2, float *f3);
165  // Header empty U V W Pressure TE ED VIS Temperature Density Lam_Vis CP COND Scalar
166  int headerBlock[50000];
167 
168  // get the choice list
169  virtual ChoiceList *get_choice(const char **, int) const;
170 
171  // number of steps in this file
173  {
174  return numSteps;
175  }
176 
177  // set the dump device: must be a pointer to 'void funct(const char *)'
178  void setDumper(void (*newDumper)(const char *));
179 
180  void findHeaders();
181 
183  // 1 = true
184  // 0 = false
185  // -1 = could not stat file
186  int isFile(const char *filename);
187 
189  // steps are counted 1...n
190  int getNumDrops(int step_no) const
191  {
192  return d_numDrops[step_no - 1];
193  }
194 };
195 }
196 #endif
GLenum GLsizei len
Definition: khronos-glext.h:7440
#define STAREXPORT
Definition: coExport.h:188
float32 z
Definition: File29.h:28
Definition: File29.h:25
float32 coun
Definition: File29.h:29
int isValid()
Definition: File29.h:147
int nwprsm
Definition: File29.h:103
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
int d_lastDropStep
Definition: File29.h:60
int ndrec
Definition: File29.h:124
int get_num_steps()
Definition: File29.h:172
dev_t d_device
Definition: File29.h:51
#define NULL
Definition: covise_list.h:22
GLdouble GLdouble z
Definition: khronos-glext.h:6565
float float32
Definition: File29.h:23
DropRec * d_actDrop
Definition: File29.h:57
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
Definition: istreamBLK.h:26
const GLdouble * v
Definition: khronos-glext.h:6442
long nextHeaderBlock
Definition: File29.h:40
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
int getNumDrops(int step_no) const
Definition: File29.h:190
GLubyte GLubyte GLubyte GLubyte w
Definition: khronos-glext.h:6793
int nvitem
Definition: File29.h:78
float d_elimSizeFactor
Definition: File29.h:64
float time
Definition: File29.h:70
istreamBLK input
Definition: File29.h:36
int iter
Definition: File29.h:69
int numSteps
Definition: File29.h:41
int int32
Definition: File29.h:24
int32 iorg
Definition: File29.h:27
int nnode
Definition: File29.h:71
ino_t d_inode
Definition: File29.h:50
int d_numActDrops
Definition: File29.h:61
Definition: ChoiceList.h:18
Definition: StarFile.h:17
Definition: File29.h:20