forked from N-BodyShop/gasoline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdumpframe.h
328 lines (281 loc) · 9.08 KB
/
dumpframe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#ifndef DUMPFRAME_HINCLUDED
#define DUMPFRAME_HINCLUDED
#define DF_NXPIXMAX 1024
#define DF_NYPIXMAX 1024
/* PST */
#ifdef USE_PNG
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "writepng.h" /* typedefs, common macros, public prototypes */
#endif
#ifdef GSS_DUMPFRAME
#include "pkd.h"
#endif
typedef struct dfImage {
float r,g,b;
} DFIMAGE;
#define DF_NBYTEDUMPFRAME (sizeof(DFIMAGE)*DF_NXPIXMAX*DF_NYPIXMAX)
#ifdef GSS_DUMPFRAME
typedef struct dfColorVal {
float fVal;
DFIMAGE dfColor;
} DFCOLORVAL;
typedef struct dfColorTable {
int iProperty;
int nColors;
float fPropMin, fPropMax;
DFCOLORVAL dfColors[20];
} DFCOLORTABLE;
#endif
/*
Projection can be 2D or voxels
In principle you can render voxels
and encode them in different ways.
I will just build a treezip every time.
*/
enum df_dimension {
DF_2D, /* Generic 2D */
DF_3D /* Voxel */
};
enum df_projectstyle {
DF_PROJECT_NULL,
DF_PROJECT_ORTHO,
DF_PROJECT_PERSPECTIVE
};
/* in principle voxels can have encoding options
For now it will be treezip
*/
enum df_encodestyle {
DF_ENCODE_NULL,
DF_ENCODE_PPM,
DF_ENCODE_PNG,
DF_ENCODE_RLE,
DF_ENCODE_TREEZIP
};
/* in principle voxels can have rendering options
For now this is ignored
*/
enum df_renderstyle {
DF_RENDER_NULL,
DF_RENDER_POINT,
DF_RENDER_TSC,
DF_RENDER_SOLID,
DF_RENDER_SHINE
};
enum df_numbering {
DF_NUMBERING_FRAME,
DF_NUMBERING_STEP,
DF_NUMBERING_TIME
};
enum df_target {
DF_TARGET_USER,
DF_TARGET_COM_GAS,
DF_TARGET_COM_DARK,
DF_TARGET_COM_STAR,
DF_TARGET_COM_ALL,
DF_TARGET_OLDEST_STAR,
DF_TARGET_PHOTOGENIC
};
enum df_log {
DF_LOG_NULL,
DF_LOG_SATURATE,
DF_LOG_COLOURSAFE
};
enum df_star_age_colour {
DF_STAR_AGE_BASIC,
DF_STAR_AGE_BRIGHT,
DF_STAR_AGE_COLOUR,
DF_STAR_AGE_BRIGHT_COLOUR
};
/* PST */
/* There is a common subset with framesetup that needs it's own structure -- parent class even */
struct inDumpFrame {
double dTime;
double dStep;
double dExp;
/* 2D Projection info */
double r[3]; /* Centre */
double x[3]; /* Projection vectors */
double y[3];
double z[3];
double zClipNear,zClipFar,zEye;
int bExpansion; /* Rescale lengths into physical units with Expansion factor? */
int bPeriodic; /* Is it periodic? */
int nxRepNeg,nxRepPos; /* Replicas for Periodic */
int nyRepNeg,nyRepPos;
int nzRepNeg,nzRepPos;
int nxPix,nyPix; /* Pixmap dimensions */
int iProject; /* Projection */
/* Rendering */
double pScale1,pScale2;
double dGasSoftMul,dDarkSoftMul,dStarSoftMul;
double xlim,ylim,hmul;
double dYearUnit;
float dColStar[10],dColGas[10],dColDark[10];
DFIMAGE ColStar[10],ColGas[10],ColDark[10];
int nColStar,nColGas,nColDark;
#ifdef GSS_DUMPFRAME
float ColGasPropMin, ColGasPropMax;
int ColGasProperty, ColDarkProperty, ColStarProperty;
#endif
int bColMassWeight;
int bGasSph;
int iColStarAge;
int bColLogInterp;
int iLogScale;
int iTarget;
int iRender;
/* Render Particle interface */
int offsetp_r,offsetp_fMass,offsetp_fSoft,offsetp_fBall2,offsetp_iActive,offsetp_fDensity,offsetp_fTimeForm;
int sizeofp;
int iTypeGas,iTypeDark,iTypeStar;
double dMassGasMin, dMassGasMax;
double dMassDarkMin,dMassDarkMax;
double dMassStarMin,dMassStarMax;
#ifdef GSS_DUMPFRAME
double dMinGasMass;
#endif
int bNonLocal; /* Is this data going non-local? */
int bVDetails;
};
/* This is a table entry for later interpolation,
changing properties of frames */
struct dfFrameSetup {
double dTime;
double dYearUnit;
/* Projection info */
double target[3]; /* Centre */
double eye[3]; /* Eye Position */
double up[3]; /* up vector */
double FOV;
double zEye1,zEye2,zEye;
double zClipNear,zClipFar; /* clipping */
double eye2[3]; /* a second vector to add to the eye vector */
int bEye2;
int bzClipFrac; /* Is z clipping a fraction of eye to target distance? */
int bzEye,bzEye1,bzEye2; /* Is zEye a fixed distance? */
int bEyeAbsolute; /* Eye position is in absolute coordinates (default relative to target point) */
int bAnchor;
int nxPix,nyPix; /* Pixmap dimensions */
int bExpansion; /* Rescale lengths into physical units with Expansion factor? */
int bPeriodic; /* Is it periodic? */
int iProject; /* Projection */
/* Rendering controllers */
double pScale1,pScale2;
float dColStar[10],dColGas[10],dColDark[10];
DFIMAGE ColStar[10],ColGas[10],ColDark[10];
int nColStar,nColGas,nColDark;
int bColMassWeight;
#ifdef GSS_DUMPFRAME
float ColGasPropMin, ColGasPropMax;
int ColGasProperty, ColDarkProperty, ColStarProperty;
#endif
int bGasSph;
int iColStarAge;
int bColLogInterp;
int iLogScale;
int iTarget;
double dGasSoftMul,dDarkSoftMul,dStarSoftMul;
int iRender; /* Rendering */
int bNonLocal; /* Is this data going non-local? */
};
/* MSR */
struct DumpFrameContext {
int bAllocated; /* Was this malloc'ed? */
int nFrame;
int iMaxRung;
double dStep;
double dTime;
double dDumpFrameStep;
double dDumpFrameTime;
double dYearUnit;
/* Particle Filters */
double dMassGasMin, dMassGasMax;
double dMassDarkMin,dMassDarkMax;
double dMassStarMin,dMassStarMax;
/* Time dependent Frame setup data */
int iFrameSetup;
int nFrameSetup;
struct dfFrameSetup *fs;
struct dfFrameSetup a;
struct dfFrameSetup b;
struct dfFrameSetup c;
struct dfFrameSetup d;
double rdt;
double dTimeMod;
double dTimeLoop,dPeriodLoop;
int bLoop;
int bGetCentreOfMass;
int bGetOldestStar;
int bGetPhotogenic;
int iDimension; /* 2D Pixel or 3D Voxel */
int iEncode;
int iNumbering;
int bVDetails;
char FileName[161];
};
#ifdef GSS_DUMPFRAME
void dfInitialize( struct DumpFrameContext **pdf, double dYearUnit,
double dTime,double dDumpFrameTime, double dStep,
double dDumpFrameStep,double dDelta, int iMaxRung,
int bVDetails, char*);
#else
void dfInitialize( struct DumpFrameContext **pdf, double dYearUnit, double dTime,
double dDumpFrameTime, double dStep, double dDumpFrameStep,
double dDelta, int iMaxRung, int bVDetails, char* );
#endif
void dfFinalize( struct DumpFrameContext *df );
void *dfAllocateImage( int nxPix, int nyPix );
void dfFreeImage( void *Image );
void dfParseOptions( struct DumpFrameContext *df, char * filename );
void dfParseCameraDirections( struct DumpFrameContext *df, char * filename );
#ifdef GSS_DUMPFRAME
void dfSetupFrame(struct DumpFrameContext *df,double dTime,double dStep,
double dExp,double *com,double dMinGasMass,
struct inDumpFrame *in );
#else
void dfSetupFrame( struct DumpFrameContext *df, double dTime, double dStep, double dExp, double *com, struct inDumpFrame *in );
#endif
void dfMergeImage( struct inDumpFrame *in, void *Image1, int *nImage1, void *Image2, int *nImage2 );
void dfClearImage( struct inDumpFrame *in, void *Image, int *nImage );
#ifdef GSS_DUMPFRAME
void dfRenderParticlePoint( struct inDumpFrame *in, void *vImage,PKD pkd,
PARTICLE *p);
void dfRenderParticleTSC( struct inDumpFrame *in, void *vImage, PKD pkd,
PARTICLE *p);
void dfRenderParticleSolid( struct inDumpFrame *in, void *vImage, PKD pkd,
PARTICLE *p);
void pkdDumpFrame( PKD pkd, struct inDumpFrame *in, void *vImage);
#else
void dfRenderParticlePoint( struct inDumpFrame *in, void *vImage,
double *r, double fMass, double fSoft, double fBall2, int iActive,
double fDensity, double fAge );
void dfRenderParticleTSC( struct inDumpFrame *in, void *vImage,
double *r, double fMass, double fSoft, double fBall2, int iActive,
double fDensity, double fAge );
void dfRenderParticleSolid( struct inDumpFrame *in, void *vImage,
double *r, double fMass, double fSoft, double fBall2, int iActive,
double fDensity, double fAge );
void dfRenderParticleInit( struct inDumpFrame *in, int iTypeGas, int iTypeDark, int iTypeStar );
void dfRenderParticle( struct inDumpFrame *in, void *vImage,
double *r, double fMass, double fSoft, double fBall2, int iActive,
double fDensity, double fTimeForm );
void dfRenderParticlesInit( struct inDumpFrame *in, int iTypeGas, int iTypeDark, int iTypeStar,
double *pr, double *pfMass, double *pfSoft, double *pfBall2, unsigned int *piActive,
double *pfDensity, double *pfTimeForm, void *p, int sizeofp );
void dfRenderParticles( struct inDumpFrame *in, void *vImage, void *pStore, int n );
#endif
/* Relies on PKD definition -- not portable */
#ifdef PKD_HINCLUDED
void dfRenderImage( PKD pkd, struct inDumpFrame *in, void *vImage );
void dfRenderImageOld( PKD pkd, struct inDumpFrame *in, void *Image );
#endif
void dfFinishFrame( struct DumpFrameContext *df, double dTime, double dStep, struct inDumpFrame *in, void *Image );
/* Interpolation Functions */
void dfGetCoeff4( struct DumpFrameContext *df, int ifs );
void dfGetCoeff3L( struct DumpFrameContext *df, int ifs );
void dfGetCoeff3R( struct DumpFrameContext *df, int ifs );
void dfGetCoeff2( struct DumpFrameContext *df, int ifs );
void dfGetCoeff( struct DumpFrameContext *df, int ifs );
void dfInterp( struct DumpFrameContext *df, struct dfFrameSetup *pfs, double x );
/* #include "dumpvoxel.h" */
#endif