changa 3.5
Loading...
Searching...
No Matches
dumpframe.h
1#ifndef DUMPFRAME_HINCLUDED
2#define DUMPFRAME_HINCLUDED
3/*
4 ** @file dumpframe.h
5 *
6 * Image dumping routines for movies from PKDGRAV
7 * Original author: James Wadsley, 2002
8 */
9
10#include "GravityParticle.h"
11#include "cosmoType.h"
12
13/* PST */
14
15#ifdef USE_PNG
16#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
17#include "writepng.h" /* typedefs, common macros, public prototypes */
18#endif
19
21typedef struct dfImage {
22 float r,g,b;
23 } DFIMAGE;
24
26typedef struct dfColorVal {
27 float fVal;
28 DFIMAGE dfColor;
29 } DFCOLORVAL;
30
31const int DF_MAX_COLORENTRIES = 20;
32
34typedef struct dfColorTable {
35 int iProperty;
36 int nColors;
37 float fPropMin, fPropMax;
38 DFCOLORVAL dfColors[DF_MAX_COLORENTRIES];
39 } DFCOLORTABLE;
40
41/*
42 Projection can be 2D or voxels
43
44 In principle you can render voxels
45 and encode them in different ways.
46 I will just build a treezip every time.
47 */
48
49enum df_dimension {
50 DF_2D, /* Generic 2D */
51 DF_3D /* Voxel */
52 };
53
54enum df_projectstyle {
55 DF_PROJECT_NULL,
56 DF_PROJECT_ORTHO,
57 DF_PROJECT_PERSPECTIVE
58 };
59
60/* in principle voxels can have encoding options
61 For now it will be treezip
62 */
63enum df_encodestyle {
64 DF_ENCODE_NULL,
65 DF_ENCODE_PPM,
66 DF_ENCODE_PNG,
67 DF_ENCODE_RLE,
68 DF_ENCODE_TREEZIP
69 };
70
71/* in principle voxels can have rendering options
72 For now this is ignored
73 */
74enum df_renderstyle {
75 DF_RENDER_NULL,
76 DF_RENDER_POINT,
77 DF_RENDER_TSC,
78 DF_RENDER_SOLID,
79 DF_RENDER_SHINE
80 };
81
82enum df_numbering {
83 DF_NUMBERING_FRAME,
84 DF_NUMBERING_STEP,
85 DF_NUMBERING_TIME
86 };
87
88enum df_target {
89 DF_TARGET_USER,
90 DF_TARGET_COM_GAS,
91 DF_TARGET_COM_DARK,
92 DF_TARGET_COM_STAR,
93 DF_TARGET_COM_ALL,
94 DF_TARGET_OLDEST_STAR,
95 DF_TARGET_PHOTOGENIC
96 };
97
98enum df_log {
99 DF_LOG_NULL,
100 DF_LOG_SATURATE,
101 DF_LOG_COLOURSAFE
102 };
103
104enum df_star_age_colour {
105 DF_STAR_AGE_BASIC,
106 DF_STAR_AGE_BRIGHT,
107 DF_STAR_AGE_COLOUR,
108 DF_STAR_AGE_BRIGHT_COLOUR
109 };
110
111/* PST */
112/* There is a common subset with framesetup that needs it's own structure -- parent class even */
116typedef
117struct inDumpFrame {
118 double dTime;
119 double dStep;
120 double duTFac;
121 double dExp;
122 /* 2D Projection info */
123 double r[3]; /* Centre */
124 double x[3]; /* Projection vectors */
125 double y[3];
126 double z[3];
127 double zClipNear,zClipFar,zEye;
128 int bExpansion; /* Rescale lengths into physical units with Expansion factor? */
129 int bPeriodic; /* Is it periodic? */
130 double fPeriod[3];
131 int nxPix,nyPix; /* Pixmap dimensions */
132 int iProject; /* Projection */
133
134 /* Rendering */
135 double pScale1,pScale2;
136 double dGasSoftMul,dDarkSoftMul,dStarSoftMul;
137 double xlim,ylim,hmul;
138 double dYearUnit;
139 DFCOLORTABLE dfGasCT, dfDarkCT, dfStarCT;
140 int bColMassWeight;
141 int bGasSph;
142 int iColStarAge;
143 int bColLogInterp;
144 int iLogScale;
145 int iTarget;
146 int iRender;
147 /* Render Particle interface */
148 int offsetp_r,offsetp_fMass,offsetp_fSoft,offsetp_fBall2,offsetp_iActive,offsetp_fTimeForm;
149 int sizeofp;
150 int iTypeGas,iTypeDark,iTypeStar;
151
152 double dMassGasMin, dMassGasMax;
153 double dMassDarkMin,dMassDarkMax;
154 double dMassStarMin,dMassStarMax;
155 double dMinGasMass;
156
157 int bNonLocal; /* Is this data going non-local? */
158 int bVDetails;
159 } InDumpFrame;
160
165 double dTime;
166 double duTFac;
167 int bCooling;
168 double dYearUnit;
169 /* Projection info */
170 double target[3]; /* Centre */
171 double eye[3]; /* Eye Position */
172 double up[3]; /* up vector */
173 double FOV;
174 double zEye1,zEye2,zEye;
175 double zClipNear,zClipFar; /* clipping */
176 double eye2[3]; /* a second vector to add to the eye vector */
177 int bEye2;
178 int bzClipFrac; /* Is z clipping a fraction of eye to target distance? */
179 int bzEye,bzEye1,bzEye2; /* Is zEye a fixed distance? */
180 int bEyeAbsolute; /* Eye position is in absolute coordinates (default relative to target point) */
181 int bAnchor;
182 int nxPix,nyPix; /* Pixmap dimensions */
183 int bExpansion; /* Rescale lengths into physical units with Expansion factor? */
184 int bPeriodic; /* Is it periodic? */
185 double fPeriod[3];
186 int iProject; /* Projection */
187
188 /* Rendering controllers */
189 double pScale1,pScale2;
190 DFCOLORTABLE dfGasCT, dfDarkCT, dfStarCT;
191 int bColMassWeight;
192 int bGasSph;
193 int iColStarAge;
194 int bColLogInterp;
195 int iLogScale;
196 int iTarget;
197 double dGasSoftMul,dDarkSoftMul,dStarSoftMul;
198 int iRender; /* Rendering */
199
200
201
202 int bNonLocal; /* Is this data going non-local? */
203 };
204
205/* MSR level in PKDGRAV */
206
210 int bAllocated; /* Was this malloc'ed? */
211
212 int nFrame;
213 int iMaxRung;
214 double dStep;
215 double dTime;
216 double duTFac;
217 int bCooling;
218 double dDumpFrameStep;
219 double dDumpFrameTime;
220 double dYearUnit;
221 /* Particle Filters */
222 double dMassGasMin, dMassGasMax;
223 double dMassDarkMin,dMassDarkMax;
224 double dMassStarMin,dMassStarMax;
225
226 /* Time dependent Frame setup data */
227 int iFrameSetup;
228 int nFrameSetup;
229 struct dfFrameSetup *fs;
230 struct dfFrameSetup a;
231 struct dfFrameSetup b;
232 struct dfFrameSetup c;
233 struct dfFrameSetup d;
234 double rdt;
235 double dTimeMod;
236 double dTimeLoop,dPeriodLoop;
237 int bLoop;
238 int bGetCentreOfMass;
239 int bGetOldestStar;
240 int bGetPhotogenic;
241
242 int iDimension; /* 2D Pixel or 3D Voxel */
243 int iEncode;
244 int iNumbering;
245 int bVDetails;
246 char FileName[161];
247 };
248
249enum arraytypes {
250 OUT_TEMP_ARRAY,
251 OUT_DENSITY_ARRAY,
252 OUT_UDOT_ARRAY,
253 OUT_U_ARRAY,
254 OUT_METALS_ARRAY,
255 OUT_TIMEFORM_ARRAY,
256 OUT_GROUP_ARRAY,
257 OUT_AGE_ARRAY
258};
259std::string VecFilename(int iType);
260
261void dfInitialize( struct DumpFrameContext **pdf, double dYearUnit, double dTime,
262 double dDumpFrameTime, double dStep, double dDumpFrameStep,
263 double dDelta, int iMaxRung, int bVDetails, char*,
264 int bPeriodic, Vector3D<double> vPeriod);
265void dfFinalize( struct DumpFrameContext *df );
266
267void *dfAllocateImage( int nxPix, int nyPix );
268void dfFreeImage( void *Image );
269
270void dfParseOptions( struct DumpFrameContext *df, char * filename );
271
272void dfParseCameraDirections( struct DumpFrameContext *df, char * filename );
273
274void dfSetupFrame( struct DumpFrameContext *df, double dTime, double dStep, double dExp, double *com, struct inDumpFrame *in, int nxPix, int nyPix);
275
276void dfMergeImage( struct inDumpFrame *in, void *Image1, int *nImage1, void *Image2, int *nImage2 );
277void dfClearImage( struct inDumpFrame *in, void *Image, int *nImage );
278
279class DataManager;
280void dfRenderParticlePoint( struct inDumpFrame *in, void *vImage,
282void dfRenderParticleTSC( struct inDumpFrame *in, void *vImage,
284void dfRenderParticleSolid( struct inDumpFrame *in, void *vImage,
286
287void dfFinishFrame( struct DumpFrameContext *df, double dTime, double dStep, struct inDumpFrame *in, void *Image, int liveViz, unsigned char **outgray);
288
289/* Interpolation Functions */
290
291void dfGetCoeff4( struct DumpFrameContext *df, int ifs );
292void dfGetCoeff3L( struct DumpFrameContext *df, int ifs );
293void dfGetCoeff3R( struct DumpFrameContext *df, int ifs );
294void dfGetCoeff2( struct DumpFrameContext *df, int ifs );
295
296void dfGetCoeff( struct DumpFrameContext *df, int ifs );
297
298void dfInterp( struct DumpFrameContext *df, struct dfFrameSetup *pfs, double x );
299
300/* #include "dumpvoxel.h" */
301
302#endif
Definition DataManager.h:60
Fundamental type for a particle.
Definition GravityParticle.h:364
Global simulation parameters for dumpframe.
Definition dumpframe.h:209
Table of colors for a particle property.
Definition dumpframe.h:34
Associate floating point value with color.
Definition dumpframe.h:26
Higher level information describing a frame. This is a table entry for later interpolation,...
Definition dumpframe.h:164
pixel of a dumpframe image
Definition dumpframe.h:21
Data needed for a TreePiece to render its part of the image.
Definition dumpframe.h:117