/* ------------------------------------------------------------------------- * * ezscroll.h -- header file for EZ-Scroll * * Copyright (C) 1996 - 1998, 2006, 2007 Dwight Barkley and Matthew Dowle * * RCS Information * --------------------------- * $Revision: 1.5.1.1 $ * $Date: 2007/05/07 10:07:03 $ * ------------------------------------------------------------------------- */ /* Modifications for EZView: 2010, Vadim Biktashev vnb@liv.ac.uk */ #ifndef _EZSCROLL_ #define _EZSCROLL_ /* ------------------------------------------------------------------------- */ /* These are the main parameters affecting the compilation of EZ-Scroll. */ /* Define them according to your needs. */ /* */ typedef float Real; /* precision of Real variables (float or double) */ /* */ #define V_DIFF_ON 0 /* if 1 then v-field diffuses */ #define EXPLICIT 0 /* if 1 then explicit u-kinetics, else implicit */ #define SPLIT 1 /* if 1 then split diffusion and kinetics steps */ #define NINETEENPT 1 /* if 1 then 19 pt Laplacian formulas, else 7 pt */ #define PBC_x 0 /* if 1 then periodic BCs in x, else Neumann BCs */ #define PBC_y 0 /* if 1 then periodic BCs in y, else Neumann BCs */ #define PBC_z 0 /* if 1 then periodic BCs in z, else Neumann BCs */ #define GRAPHICS 1 /* if 1 then run with interactive graphics */ /* ------------------------------------------------------------------------- */ /* * I always define min, max, and make sure M_PI is defined * ------------------------------------------------------- */ #define min(a,b) ((a)>(b) ? (b) : (a)) #define max(a,b) ((a)>(b) ? (a) : (b)) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* --------------------------------------------------- * Global variables used throughout the EZ-Scroll Code * (I use lots of them) * --------------------------------------------------- */ extern char *fmt, *template; /* data files description */ extern Real *fields; /* arrays for concentration fields */ #define _(n,t,i) extern t n; #include "ezpar.h" #undef _(n,t,i) #define _(n,t,i) extern t body##n; #include "ezbody.h" #undef _(n,t,i) extern int nx, ny, nz, /* # of grid points per direction */ norm_res, rot_res, /* graphics resolutions */ verbose; /* verbosity level */ extern int field_size; /* array size for each field */ /* ------------------------------------------------------------------------- * All index ranges throughout the code are expressed in terms of NX, NY, * and NZ. The code is generally more efficient if these are known numbers * at compile time, but then one must recompile for each change. If the * values are known (eg specified on the compile line) then do nothing * here, otherwise define NX etc to be the *variables* nx, etc. * ------------------------------------------------------------------------- */ #ifndef NX #define NX nx #endif #ifndef NY #define NY ny #endif #ifndef NZ #define NZ nz #endif /* ------------------------------------------------------------------------- * Memory for the chemical fields (u and v) and the spatial sums (sigma_u * and sigma_v) is allocated in Allocate_memory() in ezscroll.c. These are * allocated as long (single dimensional) arrays. Here macros are defined * so that one can easily reference a value corresponding to a particular * grid point, i.e. macros are defined to treat all arrays as * multi-dimensional. If you don't like the way I do this, you should be * able to change it easily by making modifications here and in * AllocateMem(). Let me know if you find a significant improvement. * * INDEX(i,j,k) converts grid point (i,j,k) to the array index. * * Fields (f,i,j,k) -- array of fields: f=0 for u, f=1 for v and f=2 for w * (or whatever order is assigned to them by the user) * ------------------------------------------------------------------------- */ #define K_INC ((NX+2)*(NY+2)) #define J_INC (NX+2) #define I_INC 1 #define FIELD_SIZE ((NZ+2)*(NY+2)*(NX+2)) #define INDEX(i,j,k) ((i)*I_INC + (j)*J_INC + (k)*K_INC) #define U_FIELD 0 /* Symblic names */ #define V_FIELD 1 /* of field */ #define W_FIELD 2 /* components */ extern int layer[3]; /* #define ulayer (layer[U_FIELD]) */ /* #define vlayer (layer[V_FIELD]) */ /* #define wlayer (layer[W_FIELD]) */ #define LAYERS {layer[U_FIELD]=ulayer; layer[V_FIELD]=vlayer; layer[W_FIELD]=wlayer;} #define Fields(f,i,j,k) fields [(layer[f])*FIELD_SIZE + INDEX(i,j,k)] /* ------------------------------------------- * Prototypes for public functions defined in: * ------------------------------------------- */ /* ezscroll.c * ---------- */ void Write_filament_data (float x0, float y0, float z0, float x1, float y1, float z1); void Write_history (int wrt_step); void Write_fc (char *template); int Read_fmt (char *fmt,char *template,int m); /* ezgraph3d.c * ----------- */ void Draw (void); void Draw_ini (void); int Event_check (void); void Pause (void); void QuitX (void); /* ezmarching.c * ------------ */ void Marching_cubes (unsigned int resolution, int show_filament, int clipping, Real *plot_length); void Marching_ini (void); #endif /* _EZSCROLL_ */