25 long long int tmp1, tmp1_vx, tmp1_vy, tmp1_vz;
26 double tmp, tmp_vx, tmp_vy, tmp_vz;
28 sprintf(filename,
"%srho_%i.vtk",
output_dir, counter);
29 fd = fopen(filename,
"wb");
31 printf(
"-----------------------------------\n");
32 printf(
"The output directory does not exist\n");
33 printf(
"-----------------------------------\n");
36 fprintf(fd,
"# vtk DataFile Version 3.0\n");
38 fprintf(fd,
"BINARY\n");
39 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
40 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
41 fprintf(fd,
"X_COORDINATES %i double\n", x);
42 for (i = 0; i <
x; i++) {
43 tmp = ((double)
xmax / (
double)
x) * (
double) i;
44 tmp1 =
ntohll(*((
long long int*) & tmp));
45 fwrite(&tmp1, 1,
sizeof (
double), fd);
47 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
48 for (i = 0; i <
y; i++) {
49 tmp = ((double)
ymax / (
double)
y) * (
double) i;
50 tmp1 =
ntohll(*((
long long int*) & tmp));
51 fwrite(&tmp1, 1,
sizeof (
double), fd);
53 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
54 for (i = 0; i <
z; i++) {
55 tmp = ((double)
zmax / (
double)
z) * (
double) i;
56 tmp1 =
ntohll(*((
long long int*) & tmp));
57 fwrite(&tmp1, 1,
sizeof (
double), fd);
59 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
60 fprintf(fd,
"SCALARS density double 1\n");
61 fprintf(fd,
"LOOKUP_TABLE default\n");
62 for (k = 0; k <
z; k++) {
63 for (j = 0; j <
y; j++) {
64 for (i = 0; i <
x; i++) {
66 tmp1 =
ntohll(*((
long long int*) & tmp));
67 fwrite(&tmp1, 1,
sizeof (
double), fd);
73 sprintf(filename,
"%stemp_%i.vtk",
output_dir, counter);
74 fd = fopen(filename,
"wb");
76 printf(
"-----------------------------------\n");
77 printf(
"The output directory does not exist\n");
78 printf(
"-----------------------------------\n");
81 fprintf(fd,
"# vtk DataFile Version 3.0\n");
83 fprintf(fd,
"BINARY\n");
84 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
85 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
86 fprintf(fd,
"X_COORDINATES %i double\n", x);
87 for (i = 0; i <
x; i++) {
88 tmp = ((double)
xmax / (
double)
x) * (
double) i;
89 tmp1 =
ntohll(*((
long long int*) & tmp));
90 fwrite(&tmp1, 1,
sizeof (
double), fd);
92 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
93 for (i = 0; i <
y; i++) {
94 tmp = ((double)
ymax / (
double)
y) * (
double) i;
95 tmp1 =
ntohll(*((
long long int*) & tmp));
96 fwrite(&tmp1, 1,
sizeof (
double), fd);
98 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
99 for (i = 0; i <
z; i++) {
100 tmp = ((double)
zmax / (
double)
z) * (
double) i;
101 tmp1 =
ntohll(*((
long long int*) & tmp));
102 fwrite(&tmp1, 1,
sizeof (
double), fd);
104 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
105 fprintf(fd,
"SCALARS temperature double 1\n");
106 fprintf(fd,
"LOOKUP_TABLE default\n");
107 for (k = 0; k <
z; k++) {
108 for (j = 0; j <
y; j++) {
109 for (i = 0; i <
x; i++) {
111 tmp1 =
ntohll(*((
long long int*) & tmp));
112 fwrite(&tmp1, 1,
sizeof (
double), fd);
118 sprintf(filename,
"%spressure_%i.vtk",
output_dir, counter);
119 fd = fopen(filename,
"wb");
121 printf(
"-----------------------------------\n");
122 printf(
"The output directory does not exist\n");
123 printf(
"-----------------------------------\n");
126 fprintf(fd,
"# vtk DataFile Version 3.0\n");
128 fprintf(fd,
"BINARY\n");
129 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
130 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
131 fprintf(fd,
"X_COORDINATES %i double\n", x);
132 for (i = 0; i <
x; i++) {
133 tmp = ((double)
xmax / (
double)
x) * (
double) i;
134 tmp1 =
ntohll(*((
long long int*) & tmp));
135 fwrite(&tmp1, 1,
sizeof (
double), fd);
137 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
138 for (i = 0; i <
y; i++) {
139 tmp = ((double)
ymax / (
double)
y) * (
double) i;
140 tmp1 =
ntohll(*((
long long int*) & tmp));
141 fwrite(&tmp1, 1,
sizeof (
double), fd);
143 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
144 for (i = 0; i <
z; i++) {
145 tmp = ((double)
zmax / (
double)
z) * (
double) i;
146 tmp1 =
ntohll(*((
long long int*) & tmp));
147 fwrite(&tmp1, 1,
sizeof (
double), fd);
149 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
150 fprintf(fd,
"SCALARS pressure double 1\n");
151 fprintf(fd,
"LOOKUP_TABLE default\n");
152 for (k = 0; k <
z; k++) {
153 for (j = 0; j <
y; j++) {
154 for (i = 0; i <
x; i++) {
155 if (
dom[i][j][k] == 0) tmp =
pre[i][j][k];
156 if (
dom[i][j][k] == 1) tmp = 0.0;
157 tmp1 =
ntohll(*((
long long int*) & tmp));
158 fwrite(&tmp1, 1,
sizeof (
double), fd);
164 sprintf(filename,
"%svel_%i.vtk",
output_dir, counter);
165 fd = fopen(filename,
"wb");
167 printf(
"-----------------------------------\n");
168 printf(
"The output directory does not exist\n");
169 printf(
"-----------------------------------\n");
172 fprintf(fd,
"# vtk DataFile Version 3.0\n");
174 fprintf(fd,
"BINARY\n");
175 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
176 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
177 fprintf(fd,
"X_COORDINATES %i double\n", x);
178 for (i = 0; i <
x; i++) {
179 tmp = ((double)
xmax / (
double)
x) * (
double) i;
180 tmp1 =
ntohll(*((
long long int*) & tmp));
181 fwrite(&tmp1, 1,
sizeof (
double), fd);
183 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
184 for (i = 0; i <
y; i++) {
185 tmp = ((double)
ymax / (
double)
y) * (
double) i;
186 tmp1 =
ntohll(*((
long long int*) & tmp));
187 fwrite(&tmp1, 1,
sizeof (
double), fd);
189 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
190 for (i = 0; i <
z; i++) {
191 tmp = ((double)
zmax / (
double)
z) * (
double) i;
192 tmp1 =
ntohll(*((
long long int*) & tmp));
193 fwrite(&tmp1, 1,
sizeof (
double), fd);
195 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
196 fprintf(fd,
"VECTORS velocity double 1\n");
197 for (k = 0; k <
z; k++) {
198 for (j = 0; j <
y; j++) {
199 for (i = 0; i <
x; i++) {
200 tmp_vx =
vx[i][j][k];
201 tmp1_vx =
ntohll(*((
long long int*) & tmp_vx));
202 tmp_vy =
vy[i][j][k];
203 tmp1_vy =
ntohll(*((
long long int*) & tmp_vy));
204 tmp_vz =
vz[i][j][k];
205 tmp1_vz =
ntohll(*((
long long int*) & tmp_vz));
207 fwrite(&tmp1_vx, 1,
sizeof (
double), fd);
208 fwrite(&tmp1_vy, 1,
sizeof (
double), fd);
209 fwrite(&tmp1_vz, 1,
sizeof (
double), fd);
216 sprintf(filename,
"%spressure_on_solid_%i.vtk",
output_dir, counter);
217 fd = fopen(filename,
"wb");
219 printf(
"-----------------------------------\n");
220 printf(
"The output directory does not exist\n");
221 printf(
"-----------------------------------\n");
224 fprintf(fd,
"# vtk DataFile Version 3.0\n");
226 fprintf(fd,
"BINARY\n");
227 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
228 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
229 fprintf(fd,
"X_COORDINATES %i double\n", x);
230 for (i = 0; i <
x; i++) {
231 tmp = ((double)
xmax / (
double)
x) * (
double) i;
232 tmp1 =
ntohll(*((
long long int*) & tmp));
233 fwrite(&tmp1, 1,
sizeof (
double), fd);
235 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
236 for (i = 0; i <
y; i++) {
237 tmp = ((double)
ymax / (
double)
y) * (
double) i;
238 tmp1 =
ntohll(*((
long long int*) & tmp));
239 fwrite(&tmp1, 1,
sizeof (
double), fd);
241 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
242 for (i = 0; i <
z; i++) {
243 tmp = ((double)
zmax / (
double)
z) * (
double) i;
244 tmp1 =
ntohll(*((
long long int*) & tmp));
245 fwrite(&tmp1, 1,
sizeof (
double), fd);
247 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
248 fprintf(fd,
"SCALARS pressure_on_solid double 1\n");
249 fprintf(fd,
"LOOKUP_TABLE default\n");
250 for (k = 0; k <
z; k++) {
251 for (j = 0; j <
y; j++) {
252 for (i = 0; i <
x; i++) {
254 tmp1 =
ntohll(*((
long long int*) & tmp));
255 fwrite(&tmp1, 1,
sizeof (
double), fd);
262 sprintf(filename,
"%TYCHO dB_map_%i.vtk",
output_dir, counter);
263 fd = fopen(filename,
"wb");
265 printf(
"-----------------------------------\n");
266 printf(
"The output directory does not exist\n");
267 printf(
"-----------------------------------\n");
270 fprintf(fd,
"# vtk DataFile Version 3.0\n");
272 fprintf(fd,
"BINARY\n");
273 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
274 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
275 fprintf(fd,
"X_COORDINATES %i double\n", x);
276 for (i = 0; i <
x; i++) {
277 tmp = ((double)
xmax / (
double)
x) * (
double) i;
278 tmp1 =
ntohll(*((
long long int*) & tmp));
279 fwrite(&tmp1, 1,
sizeof (
double), fd);
281 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
282 for (i = 0; i <
y; i++) {
283 tmp = ((double)
ymax / (
double)
y) * (
double) i;
284 tmp1 =
ntohll(*((
long long int*) & tmp));
285 fwrite(&tmp1, 1,
sizeof (
double), fd);
287 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
288 for (i = 0; i <
z; i++) {
289 tmp = ((double)
zmax / (
double)
z) * (
double) i;
290 tmp1 =
ntohll(*((
long long int*) & tmp));
291 fwrite(&tmp1, 1,
sizeof (
double), fd);
293 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
294 fprintf(fd,
"SCALARS pressure_on_solid double 1\n");
295 fprintf(fd,
"LOOKUP_TABLE default\n");
296 for (k = 0; k <
z; k++) {
297 for (j = 0; j <
y; j++) {
298 for (i = 0; i <
x; i++) {
300 tmp1 =
ntohll(*((
long long int*) & tmp));
301 fwrite(&tmp1, 1,
sizeof (
double), fd);
311 sprintf(filename,
"%smarker_%i.vtk",
output_dir, counter);
312 fd = fopen(filename,
"wb");
314 printf(
"-----------------------------------\n");
315 printf(
"The output directory does not exist\n");
316 printf(
"-----------------------------------\n");
319 fprintf(fd,
"# vtk DataFile Version 3.0\n");
321 fprintf(fd,
"BINARY\n");
322 fprintf(fd,
"DATASET RECTILINEAR_GRID\n");
323 fprintf(fd,
"DIMENSIONS %i %i %i\n", x, y, z);
324 fprintf(fd,
"X_COORDINATES %i double\n", x);
325 for (i = 0; i <
x; i++) {
326 tmp = ((double)
xmax / (
double)
x) * (
double) i;
327 tmp1 =
ntohll(*((
long long int*) & tmp));
328 fwrite(&tmp1, 1,
sizeof (
double), fd);
330 fprintf(fd,
"\nY_COORDINATES %i double\n", y);
331 for (i = 0; i <
y; i++) {
332 tmp = ((double)
ymax / (
double)
y) * (
double) i;
333 tmp1 =
ntohll(*((
long long int*) & tmp));
334 fwrite(&tmp1, 1,
sizeof (
double), fd);
336 fprintf(fd,
"\nZ_COORDINATES %i double\n", z);
337 for (i = 0; i <
z; i++) {
338 tmp = ((double)
zmax / (
double)
z) * (
double) i;
339 tmp1 =
ntohll(*((
long long int*) & tmp));
340 fwrite(&tmp1, 1,
sizeof (
double), fd);
342 fprintf(fd,
"\nPOINT_DATA %i\n", x * y * z);
343 fprintf(fd,
"SCALARS marker_density double 1\n");
344 fprintf(fd,
"LOOKUP_TABLE default\n");
345 for (k = 0; k <
z; k++) {
346 for (j = 0; j <
y; j++) {
347 for (i = 0; i <
x; i++) {
349 tmp1 =
ntohll(*((
long long int*) & tmp));
350 fwrite(&tmp1, 1,
sizeof (
double), fd);