22 const int GRID_CUBIC=1,GRID_HEXAG_AB=2,GRID_HEXAG_ABC=3;
26 if (
grid == GRID_CUBIC ) {
27 printf(
"Cubic grid.\n");
28 }
else if (
grid == GRID_HEXAG_AB ) {
29 printf(
"Hexagonal grid ABABAB...\n");
30 }
else if (
grid == GRID_HEXAG_ABC ) {
31 printf(
"Hexagonal grid ABCABCABC...\n");
33 printf(
"Matrix of %d x %d x %d voxels.\n",
nx,
ny,
nz);
34 printf(
"Spacing of the grid is %d, %d, %d\n",
sx,
sy,
sz);
35 printf(
"Maximum number of cells, ncell = %d\n", ncell);
37 if (
grid == GRID_CUBIC ) {
39 for (i = 0; i <
nx; i++)
40 for (j = 0; j <
ny; j++)
41 for (k = 0; k <
nz; k++)
42 if ((i %
sx == 0) && (j %
sy == 0) && \
49 }
else if (
grid == GRID_HEXAG_AB ) {
51 for (i = 0; i <
nx; i++)
52 for (j = 0; j <
ny; j++)
53 for (k = 0; k <
nz; k++)
61 }
else if ((i %
sx == (
sx/2)) &&
62 (j % (2*
sy) ==
sy ) &&
63 (k % (2*
sz) == 0 ) ) {
68 }
else if ((i %
sx == (
sx/2) ) &&
69 (j % (2*
sy) == 1 +
sy/3) &&
70 (k % (2*
sz) ==
sz ) ) {
75 }
else if ((i %
sx == 0 ) &&
76 (j % (2*
sy) ==
sy + 1 +
sy/3) &&
77 (k % (2*
sz) ==
sz ) ) {
83 }
else if (
grid == GRID_HEXAG_ABC ) {
85 for (i = 0; i <
nx; i++)
86 for (j = 0; j <
ny; j++)
87 for (k = 0; k <
nz; k++)
95 }
else if ((i %
sx == (
sx/2)) &&
96 (j % (2*
sy) ==
sy ) &&
97 (k % (3*
sz) == 0 ) ) {
102 }
else if ((i %
sx == (
sx/2) ) &&
103 (j % (2*
sy) == 1 +
sy/3) &&
104 (k % (3*
sz) ==
sz ) ) {
109 }
else if ((i %
sx == 0 ) &&
110 (j % (2*
sy) ==
sy + 1 +
sy/3) &&
111 (k % (3*
sz) ==
sz ) ) {
116 }
else if ((i %
sx == 0 ) &&
117 (j % (2*
sy) == 1 + (2*
sy)/3) &&
118 (k % (3*
sz) == (2*
sz) ) ) {
123 }
else if ((i %
sx == (
sx/2) ) &&
124 (j % (2*
sy) ==
sy + 1 + (2*
sy)/3) &&
125 (k % (3*
sz) == (2*
sz) ) ) {
133 printf(
"Number of initialized centers of cells = %d\n", m);
140 for (m = 0; m <
ncell; m++) {
146 if (ttt < RAND_MAX/2) {
148 (
double)ttt / (double)RAND_MAX *
151 ttt = ttt - RAND_MAX/2;
153 (
double)ttt / (double)RAND_MAX *
162 if (ttt < RAND_MAX/2) {
164 (
double)ttt / (double)RAND_MAX *
167 ttt = ttt - RAND_MAX/2;
169 (
double)ttt / (double)RAND_MAX *
178 if (ttt < RAND_MAX/2) {
180 (
double)ttt / (double)RAND_MAX *
183 ttt = ttt - RAND_MAX/2;
185 (
double)ttt / (double)RAND_MAX *
Defines global variables, macros, templates and namespace.
m
Bubble Growth Application Recipe.
#define CONFINEZ(x)
Periodic boundary conditions in z.
integer ncell
number of cells
#define CONFINEY(x)
Periodic boundary conditions in y.
namespace with global variables
#define CONFINEX(x)
Periodic boundary conditions in x.
void createSeeds(int &ncell, int *center_x, int *center_y, int *center_z, bool report)
Initialization of seeds. Stores positions of seeds.