45 real** offload_array,
int** int_offload_array) {
48 real xmin = (*offload_array)[0], xmax = (*offload_array)[0];
49 real ymin = (*offload_array)[1], ymax = (*offload_array)[1];
50 real zmin = (*offload_array)[2], zmax = (*offload_array)[2];
51 for(
int i=0; i<offload_data->
n*3; i++) {
52 xmin = fmin( xmin, (*offload_array)[i*3 + 0] );
53 xmax = fmax( xmax, (*offload_array)[i*3 + 0] );
54 ymin = fmin( ymin, (*offload_array)[i*3 + 1] );
55 ymax = fmax( ymax, (*offload_array)[i*3 + 1] );
56 zmin = fmin( zmin, (*offload_array)[i*3 + 2] );
57 zmax = fmax( zmax, (*offload_array)[i*3 + 2] );
62 offload_data->
xmin = xmin - 0.1;
63 offload_data->
xmax = xmax + 0.1;
64 offload_data->
ymin = ymin - 0.1;
65 offload_data->
ymax = ymax + 0.1;
66 offload_data->
zmin = zmin - 0.1;
67 offload_data->
zmax = zmax + 0.1;
72 for(
int i = 0; i < offload_data->
depth - 1; i++) {
75 offload_data->
ngrid = ngrid;
77 offload_data->
xgrid = (offload_data->
xmax - offload_data->
xmin)
78 / offload_data->
ngrid;
79 offload_data->
ygrid = (offload_data->
ymax - offload_data->
ymin)
80 / offload_data->
ngrid;
81 offload_data->
zgrid = (offload_data->
zmax - offload_data->
zmin)
82 / offload_data->
ngrid;
86 "Number of wall elements %d\n"
87 "Spanning xmin = %2.3f m, xmax = %2.3f m\n"
88 " ymin = %2.3f m, ymax = %2.3f m\n"
89 " zmin = %2.3f m, zmax = %2.3f m\n",
91 offload_data->
xmin, offload_data->
xmax, offload_data->
ymin,
92 offload_data->
ymax, offload_data->
zmin, offload_data->
zmax);
341 real rpz1[3], rpz2[3];
353 int ix1 = (int) floor((q1[0] - wdata->
xmin)
355 int iy1 = (int) floor((q1[1] - wdata->
ymin)
357 int iz1 = (int) floor((q1[2] - wdata->
zmin)
360 int ix2 = (int) floor((q2[0] - wdata->
xmin)
362 int iy2 = (int) floor((q2[1] - wdata->
ymin)
364 int iz2 = (int) floor((q2[2] - wdata->
zmin)
368 real smallest_w = 1.1;
370 for(
int i = 0; i <= abs(ix2-ix1); i++) {
371 for(
int j = 0; j <= abs(iy2-iy1); j++) {
372 for(
int k = 0; k <= abs(iz2-iz1); k++) {
373 int ix = ix1 + i*((int) copysign(1, ix2-ix1));
374 int iy = iy1 + j*((int) copysign(1, iy2-iy1));
375 int iz = iz1 + k*((int) copysign(1, iz2-iz1));
377 if(ix >= 0 && ix < wdata->ngrid && iy >= 0 && iy < wdata->ngrid
378 && iz >= 0 && iz < wdata->ngrid) {
381 + iy*wdata->
ngrid + iz];
383 for(
int l = 0; l < wdata->
tree_array[ilist]; l++) {
390 if(w >= 0 && w < smallest_w) {
399 *w_coll = smallest_w;
467 if(bb1[0] <= t1[0] && t1[0] <= bb2[0]
468 && bb1[1] <= t1[1] && t1[1] <= bb2[1]
469 && bb1[2] <= t1[2] && t1[2] <= bb2[2])
471 if(bb1[0] < t2[0] && t2[0] <= bb2[0]
472 && bb1[1] <= t2[1] && t2[1] <= bb2[1]
473 && bb1[2] <= t2[2] && t2[2] <= bb2[2])
475 if(bb1[0] <= t3[0] && t3[0] <= bb2[0]
476 && bb1[1] <= t3[1] && t3[1] <= bb2[1]
477 && bb1[2] <= t3[2] && t3[2] <= bb2[2])
481 real c000[3]; c000[0] = bb1[0]; c000[1] = bb1[1]; c000[2] = bb1[2];
482 real c100[3]; c100[0] = bb2[0]; c100[1] = bb1[1]; c100[2] = bb1[2];
483 real c010[3]; c010[0] = bb1[0]; c010[1] = bb2[1]; c010[2] = bb1[2];
484 real c110[3]; c110[0] = bb2[0]; c110[1] = bb2[1]; c110[2] = bb1[2];
485 real c001[3]; c001[0] = bb1[0]; c001[1] = bb1[1]; c001[2] = bb2[2];
486 real c101[3]; c101[0] = bb2[0]; c101[1] = bb1[1]; c101[2] = bb2[2];
487 real c011[3]; c011[0] = bb1[0]; c011[1] = bb2[1]; c011[2] = bb2[2];
488 real c111[3]; c111[0] = bb2[0]; c111[1] = bb2[1]; c111[2] = bb2[2];