28 double xx,xxa,xxb,xxc;
29 double mini[3],maxi[3];
30 double xmin=0,xmax=
nx;
31 double ymin=0,ymax=
ny;
32 double zmin=0,zmax=
nz;
34 double a0[3],b0[3],
c0[3];
36 double pa[3],pb[3],
pc[3];
37 double pap[3],pbp[3],pcp[3];
40 cout <<
"creating struts at cell edges..." <<
dedge << endl;
42 for (i=0; i<sv; i++) {
43 if (
in_domain(vert[i][0],vert[i][1],vert[i][2])) {
45 de=sqrt(pow(vert[i][0]-vert[vinc[i][j]][0],2)+\
46 pow(vert[i][1]-vert[vinc[i][j]][1],2)+\
47 pow(vert[i][2]-vert[vinc[i][j]][2],2));
51 n0[k]=vert[vinc[i][j]][k]-vert[i][k];
52 a0[k]=vert[vinc[i][(j+1)%4]][k];
53 b0[k]=vert[vinc[i][(j+2)%4]][k];
54 c0[k]=vert[vinc[i][(j+3)%4]][k];
63 da=abs(n0[0]*a0[0]+n0[1]*a0[1]+n0[2]*a0[2]-\
64 n0[0]*vert[i][0]-n0[1]*vert[i][1]-n0[2]*vert[i][2]);
72 if (abs(n0[0]*a0[0]+n0[1]*a0[1]+n0[2]*a0[2]-\
73 n0[0]*vert[i][0]-n0[1]*vert[i][1]-\
74 n0[2]*vert[i][2])>1e-2) {
79 db=abs(n0[0]*b0[0]+n0[1]*b0[1]+n0[2]*b0[2]-\
80 n0[0]*vert[i][0]-n0[1]*vert[i][1]-n0[2]*vert[i][2]);
84 if (abs(n0[0]*b0[0]+n0[1]*b0[1]+n0[2]*b0[2]-\
85 n0[0]*vert[i][0]-n0[1]*vert[i][1]-\
86 n0[2]*vert[i][2])>1e-2) {
91 dc=abs(n0[0]*c0[0]+n0[1]*c0[1]+n0[2]*c0[2]-\
92 n0[0]*vert[i][0]-n0[1]*vert[i][1]-n0[2]*vert[i][2]);
96 if (abs(n0[0]*c0[0]+n0[1]*c0[1]+n0[2]*c0[2]-\
97 n0[0]*vert[i][0]-n0[1]*vert[i][1]-\
98 n0[2]*vert[i][2])>1e-2) {
103 for (k=0; k<3; k++) {
111 for (k=0; k<3; k++) {
116 for (k=0; k<3; k++) {
121 for (k=0; k<3; k++) {
123 pa[k]=vert[i][k]+a0[k]*
dedge;
124 pb[k]=vert[i][k]+b0[k]*
dedge;
125 pc[k]=vert[i][k]+c0[k]*
dedge;
128 mini[0]=2*xmax; maxi[0]=-2*xmax;
129 mini[1]=2*ymax; maxi[1]=-2*ymax;
130 mini[2]=2*zmax; maxi[2]=-2*zmax;
131 for (k=0; k<3; k++) {
132 if (vert[vinc[i][j]][k]<mini[k]) {
133 mini[k]=vert[vinc[i][j]][k];
135 if (vert[i][k]<mini[k]) mini[k]=vert[i][k];
136 if (vert[vinc[i][j]][k]>maxi[k]) {
137 maxi[k]=vert[vinc[i][j]][k];
139 if (vert[i][k]>maxi[k]) maxi[k]=vert[i][k];
141 for (k=0; k<3; k++) {
145 for (k=(
int) floor(mini[0]); k<=ceil(maxi[0]); k++)
146 for (l=(
int) floor(mini[1]); l<=ceil(maxi[1]); l++)
147 for (m=(
int) floor(mini[2]); m<=ceil(maxi[2]); m++){
151 da=sqrt(pow(vert[i][0]-k,2)+pow(vert[i][1]-\
152 l,2)+pow(vert[i][2]-m,2));
153 db=sqrt(pow(k-vert[vinc[i][j]][0],2)+\
154 pow(l-vert[vinc[i][j]][1],2)+\
155 pow(m-vert[vinc[i][j]][2],2));
156 if (da<de && db<de) {
160 da=abs(n0[0]*pa[0]+n0[1]*pa[1]+n0[2]*\
161 pa[2]-n0[0]*k-n0[1]*l-n0[2]*m);
163 pp[0]=k; pp[1]=l; pp[2]=
m;
164 for (n=0; n<3; n++) {
167 pap[n]=pa[n]+da*n0[n];
168 pbp[n]=pb[n]+da*n0[n];
169 pcp[n]=pc[n]+da*n0[n];
171 if (abs(n0[0]*pap[0]+n0[1]*pap[1]+\
172 n0[2]*pap[2]-n0[0]*k-n0[1]*l-\
174 for (n=0; n<3; n++) {
177 pap[n]=pa[n]-da*n0[n];
178 pbp[n]=pb[n]-da*n0[n];
179 pcp[n]=pc[n]-da*n0[n];
182 if (abs(n0[0]*pap[0]+n0[1]*pap[1]+\
183 n0[2]*pap[2]-n0[0]*k-n0[1]*l-\
185 cout <<
"not in plane" << endl;
double dedge
parameter influencing size of struts in cell edges
real(dp), parameter c0
speed of light in vacuum
Defines global variables, macros, templates and namespace.
void makeEdgeStruts(int ***amat, int sv, double **vert, int **vinc, bool report)
bool in_domain(double x, double y, double z)
True if the point is in the domain, False otherwise.
m
Bubble Growth Application Recipe.
real(dp), dimension(4) pc
critical pressure
#define CONFINEZ(x)
Periodic boundary conditions in z.
bool PointInTriangle(double p[], double a[], double b[], double c[])
True if point lies in the triangle.
#define CONFINEY(x)
Periodic boundary conditions in y.
integer nz
spatial discretization
namespace with global variables
#define CONFINEX(x)
Periodic boundary conditions in x.