51 for (
int i = 0;
i <
n*
ny*len;
i++,
v++)
67 for (
int _s = 0;
_s < 1;
_s++)
74 for (
int _s = 0;
_s < 1;
_s++)
77 for (
int i = 0;
i <
n;
i++) {
79 for (
int j = 0;
j <
ny;
j++) {
84 for (
int _s = 0;
_s < 1;
_s++)
141 unsigned int len =
cn.x*
cn.y;
142 for (
int i = 0;
i < len;
i++)
168 for (
int j = 0;
j <
cn.y;
j++) {
172 for (
int i = 0;
i <
cn.x;
i++) {
175 for (
int j = 0;
j <
cn.y;
j++) {
203 i >= 111 ? -0.03125*(
i - 111) + 1. :
208 i >= 79 ? -0.03125*(
i - 111) :
209 i <= 46 ? 0.03125*(
i - 14) :
213 i >= 47 ? -0.03125*(
i - 79) :
214 i <= 14 ? 0.03125*(
i - 14) + 1.:
227 static double basemap[33][3] = {
228 {0.2298057, 0.298717966, 0.753683153},
229 {0.26623388, 0.353094838, 0.801466763},
230 {0.30386891, 0.406535296, 0.84495867},
231 {0.342804478, 0.458757618, 0.883725899},
232 {0.38301334, 0.50941904, 0.917387822},
233 {0.424369608, 0.558148092, 0.945619588},
234 {0.46666708, 0.604562568, 0.968154911},
235 {0.509635204, 0.648280772, 0.98478814},
236 {0.552953156, 0.688929332, 0.995375608},
237 {0.596262162, 0.726149107, 0.999836203},
238 {0.639176211, 0.759599947, 0.998151185},
239 {0.681291281, 0.788964712, 0.990363227},
240 {0.722193294, 0.813952739, 0.976574709},
241 {0.761464949, 0.834302879, 0.956945269},
242 {0.798691636, 0.849786142, 0.931688648},
243 {0.833466556, 0.860207984, 0.901068838},
244 {0.865395197, 0.86541021, 0.865395561},
245 {0.897787179, 0.848937047, 0.820880546},
246 {0.924127593, 0.827384882, 0.774508472},
247 {0.944468518, 0.800927443, 0.726736146},
248 {0.958852946, 0.769767752, 0.678007945},
249 {0.96732803, 0.734132809, 0.628751763},
250 {0.969954137, 0.694266682, 0.579375448},
251 {0.966811177, 0.650421156, 0.530263762},
252 {0.958003065, 0.602842431, 0.481775914},
253 {0.943660866, 0.551750968, 0.434243684},
254 {0.923944917, 0.49730856, 0.387970225},
255 {0.89904617, 0.439559467, 0.343229596},
256 {0.869186849, 0.378313092, 0.300267182},
257 {0.834620542, 0.312874446, 0.259301199},
258 {0.795631745, 0.24128379, 0.220525627},
259 {0.752534934, 0.157246067, 0.184115123},
260 {0.705673158, 0.01555616, 0.150232812}
264 double x =
i*(32 - 1
e-10)/(
NCMAP - 1);
266 for (
int k = 0;
k < 3;
k++)
274 for (
int k = 0;
k < 3;
k++)
282 for (
int k = 0;
k < 3;
k++)
288 for (
int i = 0;
i < (
NCMAP + 1)/2;
i++) {
293 for (
int i = 0;
i < (
NCMAP - 1)/2;
i++) {
305 unsigned char r,
g,
b;
329 return (
Color){99,55,43};
330 unsigned char *
c1 = (
unsigned char *) &
c;
331 for (
int j = 0;
j < 3;
j++)
451 "src/output.h:%d: warning: cannot find '%s' or 'ffmpeg'/'avconv'\n"
452 "src/output.h:%d: warning: falling back to raw PPM outputs\n",
460 static bool added =
false;
481 if (
which (
"convert"))
485 "src/output.h:%d: warning: cannot find 'convert'\n"
486 "src/output.h:%d: warning: falling back to raw PPM outputs\n",
516 else if (
which (
"convert"))
617 double avg =
s.sum/
s.volume;
626 if (((
int)
cn.y) % 2)
cn.y++;
629 unsigned char *
ppm0 = &
ppm[0][0].
r;
630 int len = 3*
cn.x*
cn.y;
743 for (
int j =
ny-1;
j >= 0;
j--) {
745 for (
int i = 0;
i <
nx;
i++) {
850 "1 0 GfsSimulation GfsBox GfsGEdge { binary = 1"
877 fprintf (
fp,
"}\nGfsBox { x = 0 y = 0 z = 0 } {\n");
882 perror (
"output_gfs(): error in header");
886 for (
int _s = 0;
_s < 1;
_s++)
902 perror (
"output_gfs(): error while seeking");
930 for (
int _s = 0;
_s < 1;
_s++)
937 if (
s.v.x.
i ==
s.
i) {
941 else if (
s.v.y.
i ==
s.
i) {
963 perror (
"output_gfs(): error while finishing");
984 unsigned char buffer[8192];
985 while ((
l =
fread (buffer, 1, 8192,
fp)) > 0)
1040 for (
int _s = 0;
_s < 1;
_s++)
1041 if (!
s.face && !
s.nodump &&
s.
i !=
cm.
i) {
1046 if (
ss.min != 0. ||
ss.max != 0.)
1057 perror (
"dump(): error while writing header");
1060 for (
int _s = 0;
_s < 1;
_s++) {
1061 unsigned len =
strlen(
s.name);
1062 if (
fwrite (&len,
sizeof(
unsigned), 1,
fp) < 1) {
1063 perror (
"dump(): error while writing len");
1066 if (
fwrite (
s.name,
sizeof(
char), len,
fp) < len) {
1067 perror (
"dump(): error while writing s.name");
1072 if (
fwrite (
o,
sizeof(
double), 4,
fp) < 4) {
1073 perror (
"dump(): error while writing coordinates");
1080void dump (
const char *
file =
"dump",
1114 for (
int _s = 0;
_s < 1;
_s++)
1121 perror (
"dump(): error while writing flags");
1124 for (
int _s = 0;
_s < 1;
_s++) {
1127 perror (
"dump(): error while writing scalars");
1145void dump (
const char *
file =
"dump",
1152 fprintf (
ferr,
"dump(): must specify a file name when using MPI\n");
1202 for (
int _s = 0;
_s < 1;
_s++)
1212 if (
pos != offset) {
1218 for (
int _s = 0;
_s < 1;
_s++) {
1248 fprintf (
ferr,
"restore(): error: expecting header\n");
1263 "restore(): error: the number of processes don't match:"
1279 if (
header.version == 161020) {
1282 "restore(): error: the list lengths don't match: "
1283 "%ld (file) != %d (code)\n",
1291 "restore(): error: file version mismatch: "
1292 "%d (file) != %d (code)\n",
1300 if (
fread (&len,
sizeof(
unsigned), 1,
fp) < 1) {
1301 fprintf (
ferr,
"restore(): error: expecting len\n");
1305 if (
fread (name,
sizeof(
char), len,
fp) < 1) {
1306 fprintf (
ferr,
"restore(): error: expecting s.name\n");
1313 for (
int _s = 0;
_s < 1;
_s++)
1316 found =
true;
break;
1334 if (
fread (
o,
sizeof(
double), 4,
fp) < 4) {
1335 fprintf (
ferr,
"restore(): error: expecting coordinates\n");
1347 perror (
"restore(): error while seeking");
1373 fprintf (
ferr,
"restore(): error: expecting 'flags'\n");
1378 for (
int _s = 0;
_s < 1;
_s++) {
1380 if (
fread (&
val,
sizeof(
double), 1,
fp) != 1) {
1381 fprintf (
ferr,
"restore(): error: expecting a scalar\n");
1393 for (
int _s = 0;
_s < 1;
_s++)
1397 for (
int _s = 0;
_s < 1;
_s++)
1402 for (
int _s = 0;
_s < 1;
_s++)
vector g[]
We store the combined pressure gradient and acceleration field in g*.
if TRASH define &&NewPid *& val(newpid, 0, 0, 0)) -> pid > 0) @else @ define is_newpid()(((NewPid *)&val(newpid, 0, 0, 0)) ->pid > 0) @endif Array *linear_tree(size_t size, scalar newpid)
trace double interpolate(scalar v, double xp=0., double yp=0., double zp=0., bool linear=true)
define double double char flags
static double interpolate_linear(Point point, scalar v, double xp=0., double yp=0., double zp=0.)
define m((k)==0 &&(l)==0 &&(m)==0) macro2 foreach_point(double _x=0.
define VT _attribute[s.i] v y scalar * list
double zero(double s0, double s1, double s2)
void free_solver_func_add(free_solver_func func)
scalar * list_concat(scalar *l1, scalar *l2)
scalar * list_add(scalar *list, scalar s)
int list_lookup(scalar *l, scalar s)
static uint32_t a32_hash(const Adler32Hash *hash)
void origin(double x=0., double y=0., double z=0.)
scalar * list_copy(scalar *l)
void matrix_free(void *m)
int list_len(scalar *list)
void * matrix_new(int n, int=(type *) realloc(p,(size) *sizeof(type)) p=(type *) realloc(p,(size) *sizeof(type)), size_t size)
static void a32_hash_add(Adler32Hash *hash, const void *data, size_t size)
scalar * list_append(scalar *list, scalar s)
static void a32_hash_init(Adler32Hash *hash)
scalar f[]
The primary fields are:
#define qmalloc(size, type)
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define file
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line line line strdup(s) @ define tracing(...) @ define end_tracing(...) @define tid() 0 @define pid() 0 @define npe() 1 @define mpi_all_reduce(v
macro translate(float x=0, float y=0., float z=0.)
trace bool box(bool notics=false, float lc[3]={0}, float lw=1.)
*cs[i, 0, 0] a *[i -1, 0, 0] j
scalar scalar coord coord double double * coef
For non-degenerate cases, the gradient is obtained using either second- or third-order estimates.
macro2 foreach_cell_restore(ivec d=Dimensions, int rootlevel=0)
static void gpu_cpu_sync(scalar *list, GLenum mode, const char *fname, int line)
void(* restriction)(Point, scalar)
void subtree_size(scalar size, bool leaves)
trace double z_indexing(scalar index, bool leaves)
define is_active() cell(true) @define is_leaf(cell)(point.level
trace void output_grd(scalar f, FILE *fp=stdout, double Delta=L0/N, bool linear=false, coord box[2]={{X0, Y0}, {X0+L0, Y0+L0 *Dimensions.y/Dimensions.x}}, scalar mask={-1})
FILE * open_image(const char *file, const char *options)
static void open_image_cleanup()
void gray(double cmap[127][3])
void(* Colormap)(double cmap[127][3])
Color colormap_color(double cmap[127][3], double val, double min, double max)
trace void output_field(scalar *list=all, FILE *fp=stdout, int n=N, bool linear=false, coord box[2]={{X0, Y0}, {X0+L0, Y0+L0 *Dimensions.y/Dimensions.x}})
static bool which(const char *command)
static const char * is_animation(const char *file)
void jet(double cmap[127][3])
trace void output_matrix(scalar f, FILE *fp=stdout, int n=N, bool linear=false, const char *file=NULL, coord box[2]={{X0, Y0}, {X0+L0, Y0+L0 *Dimensions.y/Dimensions.x}})
void randomap(double cmap[127][3])
static FILE * ppm_fallback(const char *file, const char *mode)
static const char * extension(const char *file, const char *ext)
void cool_warm(double cmap[127][3])
void blue_white_red(double cmap[127][3])
void close_image(const char *file, FILE *fp)
static FILE * open_image_lookup(const char *file)
static struct @15 open_image_data
def false def true def S_LINENO def true
static void set_dirty_stencil(scalar s)
Given a colormap and a minimum and maximum value, this function returns the red/green/blue triplet co...
The statsf() function returns the minimum, maximum, volume sum, standard deviation and volume for fie...
int refine_cell(Point point, scalar *list, int flag, Cache *refined)
void restore_mpi(FILE *fp, scalar *list1)