1 #ifndef ERF_EB_CUT_CELL_H_
2 #define ERF_EB_CUT_CELL_H_
4 #include <AMReX_REAL.H>
5 #include <AMReX_Array.H>
6 #include <AMReX_RealBox.H>
7 #include <AMReX_RealVect.H>
8 #include <AMReX_Algorithm.H>
9 #include <AMReX_EBCellFlag.H>
13 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
16 amrex::RealVect
const& a_plane_normal,
17 amrex::RealVect
const& a_edge_point0,
18 amrex::RealVect
const& a_edge_point1,
19 amrex::RealVect& a_intersection_point,
22 amrex::RealVect
const edge(a_edge_point1 - a_edge_point0);
23 amrex::Real const edge_length = edge.vectorLength();
25 AMREX_ALWAYS_ASSERT(edge_length > 0.);
27 amrex::RealVect edge_normal = edge / edge_length;
29 amrex::Real np_dot_ne = a_plane_normal.dotProduct(edge_normal);
35 a_intersection_dist = a_plane_normal.dotProduct(a_plane_point)
36 - a_plane_normal.dotProduct(a_edge_point0);
37 a_intersection_dist /= np_dot_ne;
39 a_intersection_point = a_edge_point0 + a_intersection_dist*edge_normal;
41 if (0. <= a_intersection_dist && a_intersection_dist <= edge_length) {
return 1;}
52 amrex::RealBox
const& a_rbox,
53 amrex::RealVect
const& a_point,
54 amrex::RealVect
const& a_normal );
56 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
59 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
62 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
65 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
70 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
88 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
91 if (
m_flag.isCovered() ) {
return 0.; }
97 amrex::RealVect v0(lo[0], lo[1], lo[2]);
109 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
111 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
112 if (
m_flag.isCovered() ) {
return 0.; }
118 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
120 AMREX_ASSERT( idir >= 0 && idir < AMREX_SPACEDIM );
121 if (
m_flag.isCovered() ) {
return 0.; }
127 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
132 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
133 amrex::RealVect
centLo (
int const idir )
const noexcept {
134 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
140 if (amrex::almostEqual(area_R,0.0) || amrex::almostEqual(area_R,
m_rbox_area[idir]) ){
143 amrex::RealVect cent_O = cent;
144 amrex::RealVect cent_R =
m_lo_faces[idir]->get_centroid();
146 cent =
m_invert * cent_R + (1.-
m_invert) * ((1.+area_R/area_C)*cent_O - area_R/area_C*cent_R);
152 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
153 amrex::RealVect
centHi (
int const idir )
const noexcept {
154 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
160 if (amrex::almostEqual(area_R,0.0) || amrex::almostEqual(area_R,
m_rbox_area[idir]) ){
163 amrex::RealVect cent_O = cent;
164 amrex::RealVect cent_R =
m_hi_faces[idir]->get_centroid();
166 cent =
m_invert * cent_R + (1.-
m_invert) * ((1.+area_R/area_C)*cent_O - area_R/area_C*cent_R);
172 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
174 amrex::RealVect cent{0.,0.,0.};
175 if (
m_flag.isSingleValued()) {
181 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
183 amrex::RealVect normal{0.,0.,0.};
184 if (
m_flag.isSingleValued()) {
190 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
193 if (
m_flag.isSingleValued()) {
213 vcent[0] = 0.5 * ( - xm * xm * axm + xp * xp * axp + bcent[0] * bcent[0] *
m_eb_normal[0] * barea ) / vol;
214 vcent[1] = 0.5 * ( - ym * ym * aym + yp * yp * ayp + bcent[1] * bcent[1] *
m_eb_normal[1] * barea ) / vol;
215 vcent[2] = 0.5 * ( - zm * zm * azm + zp * zp * azp + bcent[2] * bcent[2] *
m_eb_normal[2] * barea ) / vol;
220 void debug (
int const a_face = -1 );
259 AMREX_GPU_HOST_DEVICE
262 AMREX_GPU_HOST_DEVICE
266 AMREX_GPU_HOST_DEVICE
270 amrex::RealBox
const& a_rbox,
271 amrex::RealVect
const& a_point,
272 amrex::RealVect
const& a_normal )
274 , m_eb_point(a_point)
275 , m_eb_normal(a_normal)
277 , m_F1(a_point, a_normal)
278 , m_F2(a_point, a_normal)
279 , m_F3(a_point, a_normal)
280 , m_F4(a_point, a_normal)
281 , m_F5(a_point, a_normal)
282 , m_F6(a_point, a_normal)
283 , m_cellface_cent({amrex::RealVect(0.), amrex::RealVect(0.), amrex::RealVect(0.),
284 amrex::RealVect(0.), amrex::RealVect(0.), amrex::RealVect(0.)})
286 using namespace amrex;
288 m_rbox_area[0] = m_rbox.length(1)*m_rbox.length(2);
289 m_rbox_area[1] = m_rbox.length(0)*m_rbox.length(2);
290 m_rbox_area[2] = m_rbox.length(0)*m_rbox.length(1);
292 amrex::RealVect v0(m_rbox.lo(0), m_rbox.lo(1), m_rbox.lo(2));
293 amrex::RealVect v1(m_rbox.hi(0), m_rbox.lo(1), m_rbox.lo(2));
294 amrex::RealVect v2(m_rbox.lo(0), m_rbox.hi(1), m_rbox.lo(2));
295 amrex::RealVect v3(m_rbox.lo(0), m_rbox.lo(1), m_rbox.hi(2));
296 amrex::RealVect v4(m_rbox.hi(0), m_rbox.lo(1), m_rbox.hi(2));
297 amrex::RealVect v5(m_rbox.hi(0), m_rbox.hi(1), m_rbox.lo(2));
298 amrex::RealVect v6(m_rbox.lo(0), m_rbox.hi(1), m_rbox.hi(2));
299 amrex::RealVect v7(m_rbox.hi(0), m_rbox.hi(1), m_rbox.hi(2));
303 m_cellface_cent[0] = 0.25 * ( v0 + v2 + v5 + v1 );
304 m_cellface_cent[1] = 0.25 * ( v1 + v5 + v7 + v4 );
305 m_cellface_cent[2] = 0.25 * ( v3 + v4 + v7 + v6 );
306 m_cellface_cent[3] = 0.25 * ( v0 + v3 + v6 + v2 );
307 m_cellface_cent[4] = 0.25 * ( v0 + v1 + v4 + v3 );
308 m_cellface_cent[5] = 0.25 * ( v2 + v5 + v7 + v6 );
312 m_cell_cent[0] = 0.5 * ( m_rbox.lo(0) + m_rbox.hi(0) );
313 m_cell_cent[1] = 0.5 * ( m_rbox.lo(1) + m_rbox.hi(1) );
314 m_cell_cent[2] = 0.5 * ( m_rbox.lo(2) + m_rbox.hi(2) );
318 m_dx[0] = m_rbox.hi(0) - m_rbox.lo(0);
319 m_dx[1] = m_rbox.hi(1) - m_rbox.lo(1);
320 m_dx[2] = m_rbox.hi(2) - m_rbox.lo(2);
322 if (a_flag.isCovered() ) {
326 }
else if (a_flag.isRegular() ) {
332 amrex::RealVect c = 0.5*(v0 + v7);
333 amrex::RealVect e = v7 - c;
335 amrex::Real r = e[0]*amrex::Math::abs(a_normal[0]) +
336 e[1]*amrex::Math::abs(a_normal[1]) +
337 e[2]*amrex::Math::abs(a_normal[2]);
339 amrex::Real s = amrex::Math::abs(c.dotProduct(a_normal)
340 - a_point.dotProduct(a_normal));
343 if ((a_normal.dotProduct(v0) - a_normal.dotProduct(a_point)) > 0.)
344 { set_covered(); }
else { set_regular(); }
345 }
else { m_flag.setSingleValued(); }
348 if ( m_flag.isSingleValued() ) {
350 m_invert = ((m_eb_normal.dotProduct(v0) - m_eb_normal.dotProduct(m_eb_point)) > 0.) ? 0.0 : 1.0;
352 calc_edge_intersections();
365 if ( !m_flag.isSingleValued() ) {
366 set_covered_regular_cell_vertices();
373 AMREX_GPU_HOST_DEVICE
384 AMREX_GPU_HOST_DEVICE
386 void set(
const amrex::RealVect& eb_point,
387 const amrex::RealVect& eb_normal,
388 const amrex::RealVect& v_start,
389 const amrex::RealVect& v_end)
392 amrex::RealVect v_intersect;
395 eb_point, eb_normal, v_start, v_end, v_intersect, dist_intersect
406 AMREX_GPU_HOST_DEVICE
412 using namespace amrex;
425 bool print_initial = ( Math::abs(
m_eb_point[0]-1.666667e-01)<1.e-4 &&
426 Math::abs(
m_eb_point[1]+4.194018e-01)<1.e-4 &&
427 Math::abs(
m_eb_point[2]+1.666667e-01)<1.e-4 );
428 const bool print_F1 = print_initial &&
false;
429 const bool print_F2 = print_initial &&
false;
430 const bool print_F3 = print_initial &&
false;
431 const bool print_F4 = print_initial &&
false;
432 const bool print_F5 = print_initial &&
false;
433 const bool print_F6 = print_initial &&
false;
434 const bool print_F7 = print_initial &&
false;
437 m_F1.
add_vertex(v0);
if(print_F1) printf(
"Initial: add v0 -> F1\n");
438 m_F4.
add_vertex(v0);
if(print_F4) printf(
"Initial: add v0 -> F4\n");
439 m_F5.
add_vertex(v0);
if(print_F5) printf(
"Initial: add v0 -> F5\n");
446 amrex::Array<bool,8> vertex_intersected{};
454 amrex::Array<path_data,3> p1, p2, p3;
488 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
490 if (p1[0].intersected) {
491 if (p1[0].intersected_start) {
492 m_F1.
add_vertex(v0);
if(print_F1) printf(
"Path 1: v0--v1: add v0 -> F1\n");
493 m_F4.
add_vertex(v0);
if(print_F4) printf(
"Path 1: v0--v1: add v0 -> F4\n");
494 m_F5.
add_vertex(v0);
if(print_F5) printf(
"Path 1: v0--v1: add v0 -> F5\n");
495 m_F7.
add_vertex(v0);
if(print_F7) printf(
"Path 1: v0--v1: add v0 -> F7\n");
496 if (!vertex_intersected[0]) {
497 vertex_intersected[0] =
true;
500 }
else if (p1[0].intersected_end) {
501 m_F1.
add_vertex(v1);
if(print_F1) printf(
"Path 1: v0--v1: add v1 -> F1\n");
502 m_F2.
add_vertex(v1);
if(print_F2) printf(
"Path 1: v0--v1: add v1 -> F2\n");
503 m_F5.
add_vertex(v1);
if(print_F5) printf(
"Path 1: v0--v1: add v1 -> F5\n");
504 m_F7.
add_vertex(v1);
if(print_F7) printf(
"Path 1: v0--v1: add v1 -> F7\n");
505 if (!vertex_intersected[1]) {
506 vertex_intersected[1] =
true;
510 m_F1.
add_vertex(p1[0].vIP);
if(print_F1) printf(
"Path 1: v0--v1: add vIP -> F1\n");
511 m_F5.
add_vertex(p1[0].vIP);
if(print_F5) printf(
"Path 1: v0--v1: add vIP -> F5\n");
512 m_F7.
add_vertex(p1[0].vIP);
if(print_F7) printf(
"Path 1: v0--v1: add vIP -> F7\n");
519 m_F1.
add_vertex(v1);
if(print_F1) printf(
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F1\n");
520 m_F2.
add_vertex(v1);
if(print_F2) printf(
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F2\n");
521 m_F5.
add_vertex(v1);
if(print_F5) printf(
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F5\n");
524 if (p1[1].intersected) {
525 if (p1[1].intersected_start) {
526 m_F1.
add_vertex(v1);
if(print_F1) printf(
"Path 1: v1--v4: add v1 -> F1\n");
527 m_F2.
add_vertex(v1);
if(print_F2) printf(
"Path 1: v1--v4: add v1 -> F2\n");
528 m_F5.
add_vertex(v1);
if(print_F5) printf(
"Path 1: v1--v4: add v1 -> F5\n");
529 m_F7.
add_vertex(v1);
if(print_F7) printf(
"Path 1: v1--v4: add v1 -> F7\n");
530 if (!vertex_intersected[1]) {
531 vertex_intersected[1] =
true;
534 }
else if (p1[1].intersected_end) {
535 m_F2.
add_vertex(v4);
if(print_F2) printf(
"Path 1: v1--v4: add v4 -> F2\n");
536 m_F3.
add_vertex(v4);
if(print_F3) printf(
"Path 1: v1--v4: add v4 -> F3\n");
537 m_F5.
add_vertex(v4);
if(print_F5) printf(
"Path 1: v1--v4: add v4 -> F5\n");
538 m_F7.
add_vertex(v4);
if(print_F7) printf(
"Path 1: v1--v4: add v4 -> F7\n");
539 if (!vertex_intersected[4]) {
540 vertex_intersected[4] =
true;
544 m_F2.
add_vertex(p1[1].vIP);
if(print_F2) printf(
"Path 1: v1--v4: add vIP -> F2\n");
545 m_F5.
add_vertex(p1[1].vIP);
if(print_F5) printf(
"Path 1: v1--v4: add vIP -> F5\n");
546 m_F7.
add_vertex(p1[1].vIP);
if(print_F7) printf(
"Path 1: v1--v4: add vIP -> F7\n");
553 m_F2.
add_vertex(v4);
if(print_F2) printf(
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F2\n");
554 m_F3.
add_vertex(v4);
if(print_F3) printf(
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F3\n");
555 m_F5.
add_vertex(v4);
if(print_F5) printf(
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F5\n");
558 if (p1[2].intersected) {
559 if (p1[2].intersected_start) {
560 m_F2.
add_vertex(v4);
if(print_F2) printf(
"Path 1: v4--v7: add v4 -> F2\n");
561 m_F3.
add_vertex(v4);
if(print_F3) printf(
"Path 1: v4--v7: add v4 -> F3\n");
562 m_F5.
add_vertex(v4);
if(print_F5) printf(
"Path 1: v4--v7: add v4 -> F5\n");
563 m_F7.
add_vertex(v4);
if(print_F7) printf(
"Path 1: v4--v7: add v4 -> F7\n");
564 if (!vertex_intersected[4]) {
565 vertex_intersected[4] =
true;
568 }
else if (p1[2].intersected_end) {
569 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 1: v4--v7: add v7 -> F2\n");
570 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 1: v4--v7: add v7 -> F3\n");
571 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 1: v4--v7: add v7 -> F6\n");
572 m_F7.
add_vertex(v7);
if(print_F7) printf(
"Path 1: v4--v7: add v7 -> F7\n");
573 if (!vertex_intersected[7]) {
574 vertex_intersected[7] =
true;
578 m_F2.
add_vertex(p1[2].vIP);
if(print_F2) printf(
"Path 1: v4--v7: add vIP -> F2\n");
579 m_F3.
add_vertex(p1[2].vIP);
if(print_F3) printf(
"Path 1: v4--v7: add vIP -> F3\n");
580 m_F7.
add_vertex(p1[2].vIP);
if(print_F7) printf(
"Path 1: v4--v7: add vIP -> F7\n");
586 if (cuts == 2 && add_v7) {
588 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F2\n");
589 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F3\n");
590 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F6\n");
599 m_F1.
add_vertex(v1);
if(print_F1) printf(
"Path 4: v1--v5: add v1 -> F1\n");
600 m_F2.
add_vertex(v1);
if(print_F2) printf(
"Path 4: v1--v5: add v1 -> F2\n");
601 m_F5.
add_vertex(v1);
if(print_F5) printf(
"Path 4: v1--v5: add v1 -> F5\n");
602 m_F7.
add_vertex(v1);
if(print_F7) printf(
"Path 4: v1--v5: add v1 -> F7\n");
604 m_F1.
add_vertex(v5);
if(print_F1) printf(
"Path 4: v1--v5: add v5 -> F1\n");
605 m_F2.
add_vertex(v5);
if(print_F2) printf(
"Path 4: v1--v5: add v5 -> F2\n");
606 m_F6.
add_vertex(v5);
if(print_F6) printf(
"Path 4: v1--v5: add v5 -> F6\n");
607 m_F7.
add_vertex(v5);
if(print_F7) printf(
"Path 4: v1--v5: add v5 -> F7\n");
617 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
619 if (p2[0].intersected) {
620 if (p2[0].intersected_start) {
621 m_F1.
add_vertex(v0);
if(print_F1) printf(
"Path 2: v0--v2: add v0 -> F1\n");
622 m_F4.
add_vertex(v0);
if(print_F4) printf(
"Path 2: v0--v2: add v0 -> F4\n");
623 m_F5.
add_vertex(v0);
if(print_F5) printf(
"Path 2: v0--v2: add v0 -> F5\n");
624 m_F7.
add_vertex(v0);
if(print_F7) printf(
"Path 2: v0--v2: add v0 -> F7\n");
625 if (!vertex_intersected[0]) {
626 vertex_intersected[0] =
true;
629 }
else if (p2[0].intersected_end) {
630 m_F1.
add_vertex(v2);
if(print_F1) printf(
"Path 2: v0--v2: add v2 -> F1\n");
631 m_F4.
add_vertex(v2);
if(print_F4) printf(
"Path 2: v0--v2: add v2 -> F4\n");
632 m_F6.
add_vertex(v2);
if(print_F6) printf(
"Path 2: v0--v2: add v2 -> F6\n");
633 m_F7.
add_vertex(v2);
if(print_F7) printf(
"Path 2: v0--v2: add v2 -> F7\n");
634 if (!vertex_intersected[2]) {
635 vertex_intersected[2] =
true;
639 m_F1.
add_vertex(p2[0].vIP);
if(print_F1) printf(
"Path 2: v0--v2: add vIP -> F1\n");
640 m_F4.
add_vertex(p2[0].vIP);
if(print_F4) printf(
"Path 2: v0--v2: add vIP -> F4\n");
641 m_F7.
add_vertex(p2[0].vIP);
if(print_F7) printf(
"Path 2: v0--v2: add vIP -> F7\n");
648 m_F1.
add_vertex(v2);
if(print_F1) printf(
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F1\n");
649 m_F4.
add_vertex(v2);
if(print_F4) printf(
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F4\n");
650 m_F6.
add_vertex(v2);
if(print_F6) printf(
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F6\n");
653 if (p2[1].intersected) {
654 if (p2[1].intersected_start) {
655 m_F1.
add_vertex(v2);
if(print_F1) printf(
"Path 2: v2--v5: add v2 -> F1\n");
656 m_F4.
add_vertex(v2);
if(print_F4) printf(
"Path 2: v2--v5: add v2 -> F4\n");
657 m_F6.
add_vertex(v2);
if(print_F6) printf(
"Path 2: v2--v5: add v2 -> F6\n");
658 m_F7.
add_vertex(v2);
if(print_F7) printf(
"Path 2: v2--v5: add v2 -> F7\n");
659 if (!vertex_intersected[2]) {
660 vertex_intersected[2] =
true;
663 }
else if (p2[1].intersected_end) {
664 m_F1.
add_vertex(v5);
if(print_F1) printf(
"Path 2: v2--v5: add v5 -> F1\n");
665 m_F2.
add_vertex(v5);
if(print_F2) printf(
"Path 2: v2--v5: add v5 -> F2\n");
666 m_F6.
add_vertex(v5);
if(print_F6) printf(
"Path 2: v2--v5: add v5 -> F6\n");
667 m_F7.
add_vertex(v5);
if(print_F7) printf(
"Path 2: v2--v5: add v5 -> F7\n");
668 if (!vertex_intersected[5]) {
669 vertex_intersected[5] =
true;
673 m_F1.
add_vertex(p2[1].vIP);
if(print_F1) printf(
"Path 2: v2--v5: add vIP -> F1\n");
674 m_F6.
add_vertex(p2[1].vIP);
if(print_F6) printf(
"Path 2: v2--v5: add vIP -> F6\n");
675 m_F7.
add_vertex(p2[1].vIP);
if(print_F7) printf(
"Path 2: v2--v5: add vIP -> F7\n");
681 m_F1.
add_vertex(v5);
if(print_F1) printf(
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F1\n");
682 m_F2.
add_vertex(v5);
if(print_F2) printf(
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F2\n");
683 m_F6.
add_vertex(v5);
if(print_F6) printf(
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F6\n");
686 if (p2[2].intersected) {
687 if (p2[2].intersected_start) {
688 m_F1.
add_vertex(v5);
if(print_F1) printf(
"Path 2: v5--v7: add v5 -> F1\n");
689 m_F2.
add_vertex(v5);
if(print_F2) printf(
"Path 2: v5--v7: add v5 -> F2\n");
690 m_F6.
add_vertex(v5);
if(print_F6) printf(
"Path 2: v5--v7: add v5 -> F6\n");
691 m_F7.
add_vertex(v5);
if(print_F7) printf(
"Path 2: v5--v7: add v5 -> F7\n");
692 if (!vertex_intersected[5]) {
693 vertex_intersected[5] =
true;
696 }
else if (p2[2].intersected_end) {
697 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 2: v5--v7: add v7 -> F2\n");
698 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 2: v5--v7: add v7 -> F3\n");
699 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 2: v5--v7: add v7 -> F6\n");
700 m_F7.
add_vertex(v7);
if(print_F7) printf(
"Path 2: v5--v7: add v7 -> F7\n");
701 if (!vertex_intersected[7]) {
702 vertex_intersected[7] =
true;
706 m_F2.
add_vertex(p2[2].vIP);
if(print_F2) printf(
"Path 2: v5--v7: add vIP -> F2\n");
707 m_F6.
add_vertex(p2[2].vIP);
if(print_F6) printf(
"Path 2: v5--v7: add vIP -> F6\n");
708 m_F7.
add_vertex(p2[2].vIP);
if(print_F7) printf(
"Path 2: v5--v7: add vIP -> F7\n");
713 if (cuts == 2 && add_v7) {
715 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F2\n");
716 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F3\n");
717 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F6\n");
727 m_F1.
add_vertex(v2);
if(print_F1) printf(
"Path 5: v2--v6: add v2 -> F1\n");
728 m_F4.
add_vertex(v2);
if(print_F4) printf(
"Path 5: v2--v6: add v2 -> F4\n");
729 m_F6.
add_vertex(v2);
if(print_F6) printf(
"Path 5: v2--v6: add v2 -> F6\n");
730 m_F7.
add_vertex(v2);
if(print_F7) printf(
"Path 5: v2--v6: add v2 -> F7\n");
732 m_F3.
add_vertex(v6);
if(print_F3) printf(
"Path 5: v2--v6: add v6 -> F3\n");
733 m_F4.
add_vertex(v6);
if(print_F4) printf(
"Path 5: v2--v6: add v6 -> F4\n");
734 m_F6.
add_vertex(v6);
if(print_F6) printf(
"Path 5: v2--v6: add v6 -> F6\n");
735 m_F7.
add_vertex(v6);
if(print_F7) printf(
"Path 5: v2--v6: add v6 -> F7\n");
746 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
748 if (p3[0].intersected) {
749 if (p3[0].intersected_start) {
750 m_F1.
add_vertex(v0);
if(print_F1) printf(
"Path 3: v0--v3: add v0 -> F1\n");
751 m_F4.
add_vertex(v0);
if(print_F4) printf(
"Path 3: v0--v3: add v0 -> F4\n");
752 m_F5.
add_vertex(v0);
if(print_F5) printf(
"Path 3: v0--v3: add v0 -> F5\n");
753 m_F7.
add_vertex(v0);
if(print_F7) printf(
"Path 3: v0--v3: add v0 -> F7\n");
754 if (!vertex_intersected[0]) {
755 vertex_intersected[0] =
true;
758 }
else if (p3[0].intersected_end) {
759 m_F3.
add_vertex(v3);
if(print_F3) printf(
"Path 3: v0--v3: add v3 -> F3\n");
760 m_F4.
add_vertex(v3);
if(print_F4) printf(
"Path 3: v0--v3: add v3 -> F4\n");
761 m_F5.
add_vertex(v3);
if(print_F5) printf(
"Path 3: v0--v3: add v3 -> F5\n");
762 m_F7.
add_vertex(v3);
if(print_F7) printf(
"Path 3: v0--v3: add v3 -> F7\n");
763 if (!vertex_intersected[3]) {
764 vertex_intersected[3] =
true;
768 m_F4.
add_vertex(p3[0].vIP);
if(print_F4) printf(
"Path 3: v0--v3: add vIP -> F4\n");
769 m_F5.
add_vertex(p3[0].vIP);
if(print_F5) printf(
"Path 3: v0--v3: add vIP -> F5\n");
770 m_F7.
add_vertex(p3[0].vIP);
if(print_F7) printf(
"Path 3: v0--v3: add vIP -> F7\n");
777 m_F3.
add_vertex(v3);
if(print_F3) printf(
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F3\n");
778 m_F4.
add_vertex(v3);
if(print_F4) printf(
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F4\n");
779 m_F5.
add_vertex(v3);
if(print_F5) printf(
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F5\n");
782 if (p3[1].intersected) {
783 if (p3[1].intersected_start) {
784 m_F3.
add_vertex(v3);
if(print_F3) printf(
"Path 3: v3--v6: add v3 -> F3\n");
785 m_F4.
add_vertex(v3);
if(print_F4) printf(
"Path 3: v3--v6: add v3 -> F4\n");
786 m_F5.
add_vertex(v3);
if(print_F5) printf(
"Path 3: v3--v6: add v3 -> F5\n");
787 m_F7.
add_vertex(v3);
if(print_F7) printf(
"Path 3: v3--v6: add v3 -> F7\n");
788 if (!vertex_intersected[3]) {
789 vertex_intersected[3] =
true;
792 }
else if (p3[1].intersected_end) {
793 m_F3.
add_vertex(v6);
if(print_F3) printf(
"Path 3: v3--v6: add v6 -> F3\n");
794 m_F4.
add_vertex(v6);
if(print_F4) printf(
"Path 3: v3--v6: add v6 -> F4\n");
795 m_F6.
add_vertex(v6);
if(print_F6) printf(
"Path 3: v3--v6: add v6 -> F6\n");
796 m_F7.
add_vertex(v6);
if(print_F7) printf(
"Path 3: v3--v6: add v6 -> F7\n");
797 if (!vertex_intersected[6]) {
798 vertex_intersected[6] =
true;
802 m_F3.
add_vertex(p3[1].vIP);
if(print_F3) printf(
"Path 3: v3--v6: add vIP -> F3\n");
803 m_F4.
add_vertex(p3[1].vIP);
if(print_F4) printf(
"Path 3: v3--v6: add vIP -> F4\n");
804 m_F7.
add_vertex(p3[1].vIP);
if(print_F7) printf(
"Path 3: v3--v6: add vIP -> F7\n");
811 m_F3.
add_vertex(v6);
if(print_F3) printf(
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F3\n");
812 m_F4.
add_vertex(v6);
if(print_F4) printf(
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F4\n");
813 m_F6.
add_vertex(v6);
if(print_F6) printf(
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F6\n");
816 if (p3[2].intersected) {
817 if (p3[2].intersected_start) {
818 m_F3.
add_vertex(v6);
if(print_F3) printf(
"Path 3: v6--v7: add v6 -> F3\n");
819 m_F4.
add_vertex(v6);
if(print_F4) printf(
"Path 3: v6--v7: add v6 -> F4\n");
820 m_F6.
add_vertex(v6);
if(print_F6) printf(
"Path 3: v6--v7: add v6 -> F6\n");
821 m_F7.
add_vertex(v6);
if(print_F7) printf(
"Path 3: v6--v7: add v6 -> F7\n");
822 if (!vertex_intersected[6]) {
823 vertex_intersected[6] =
true;
826 }
else if (p3[2].intersected_end) {
827 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 3: v6--v7: add v7 -> F2\n");
828 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 3: v6--v7: add v7 -> F3\n");
829 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 3: v6--v7: add v7 -> F6\n");
830 m_F7.
add_vertex(v7);
if(print_F7) printf(
"Path 3: v6--v7: add v7 -> F7\n");
831 if (!vertex_intersected[7]) {
832 vertex_intersected[7] =
true;
836 m_F3.
add_vertex(p3[2].vIP);
if(print_F3) printf(
"Path 3: v6--v7: add vIP -> F3\n");
837 m_F6.
add_vertex(p3[2].vIP);
if(print_F6) printf(
"Path 3: v6--v7: add vIP -> F6\n");
838 m_F7.
add_vertex(p3[2].vIP);
if(print_F7) printf(
"Path 3: v6--v7: add vIP -> F7\n");
843 if (cuts == 2 && add_v7) {
845 m_F2.
add_vertex(v7);
if(print_F2) printf(
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F2\n");
846 m_F3.
add_vertex(v7);
if(print_F3) printf(
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F3\n");
847 m_F6.
add_vertex(v7);
if(print_F6) printf(
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F6\n");
857 m_F3.
add_vertex(v3);
if(print_F3) printf(
"Path 6: v3--v4: add v3 -> F3\n");
858 m_F4.
add_vertex(v3);
if(print_F4) printf(
"Path 6: v3--v4: add v3 -> F4\n");
859 m_F5.
add_vertex(v3);
if(print_F5) printf(
"Path 6: v3--v4: add v3 -> F5\n");
860 m_F7.
add_vertex(v3);
if(print_F7) printf(
"Path 6: v3--v4: add v3 -> F7\n");
862 m_F2.
add_vertex(v4);
if(print_F2) printf(
"Path 6: v3--v4: add v4 -> F2\n");
863 m_F3.
add_vertex(v4);
if(print_F3) printf(
"Path 6: v3--v4: add v4 -> F3\n");
864 m_F5.
add_vertex(v4);
if(print_F5) printf(
"Path 6: v3--v4: add v4 -> F5\n");
865 m_F7.
add_vertex(v4);
if(print_F7) printf(
"Path 6: v3--v4: add v4 -> F7\n");
873 if (print_F1 || print_F2 || print_F3 || print_F4 || print_F5 || print_F6 || print_F7){
879 AMREX_GPU_HOST_DEVICE
885 using namespace amrex;
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int intersect_plane_edge(amrex::RealVect const &a_plane_point, amrex::RealVect const &a_plane_normal, amrex::RealVect const &a_edge_point0, amrex::RealVect const &a_edge_point1, amrex::RealVect &a_intersection_point, amrex::Real &a_intersection_dist)
Definition: ERF_EBCutCell.H:15
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_EBCutCell.H:46
AMREX_GPU_HOST_DEVICE void calc_edge_intersections()
Definition: ERF_EBCutCell.H:410
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real volume() const
Definition: ERF_EBCutCell.H:89
polygon_ m_F6
Definition: ERF_EBCutCell.H:241
amrex::Array< polygon_ const *const, 3 > m_lo_faces
Definition: ERF_EBCutCell.H:251
amrex::RealVect m_rbox_area
Definition: ERF_EBCutCell.H:230
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isRegular() const noexcept
Definition: ERF_EBCutCell.H:60
amrex::RealVect m_cell_cent
Definition: ERF_EBCutCell.H:245
amrex::RealVect m_dx
Definition: ERF_EBCutCell.H:246
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaLo(int const idir) const noexcept
Definition: ERF_EBCutCell.H:110
amrex::RealVect const m_eb_point
Definition: ERF_EBCutCell.H:225
amrex::Real m_invert
Definition: ERF_EBCutCell.H:228
amrex::RealBox const m_rbox
Definition: ERF_EBCutCell.H:224
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaHi(int const idir) const noexcept
Definition: ERF_EBCutCell.H:119
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centBoun() const noexcept
Definition: ERF_EBCutCell.H:173
AMREX_GPU_HOST_DEVICE void set_covered_regular_cell_vertices()
Definition: ERF_EBCutCell.H:883
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_regular()
Definition: ERF_EBCutCell.H:71
polygon_ m_F1
Definition: ERF_EBCutCell.H:236
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaBoun() const noexcept
Definition: ERF_EBCutCell.H:128
polygon_ m_F3
Definition: ERF_EBCutCell.H:238
amrex::EBCellFlag m_flag
Definition: ERF_EBCutCell.H:232
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centHi(int const idir) const noexcept
Definition: ERF_EBCutCell.H:153
polygon_ m_F5
Definition: ERF_EBCutCell.H:240
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centVol() const noexcept
Definition: ERF_EBCutCell.H:191
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_covered()
Definition: ERF_EBCutCell.H:66
polygon_ m_F7
Definition: ERF_EBCutCell.H:249
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect normBoun() const noexcept
Definition: ERF_EBCutCell.H:182
amrex::Array< int const, 3 > m_hi_faces_id
Definition: ERF_EBCutCell.H:255
AMREX_GPU_HOST_DEVICE eb_cut_cell_(amrex::EBCellFlag const &a_flag, amrex::RealBox const &a_rbox, amrex::RealVect const &a_point, amrex::RealVect const &a_normal)
Definition: ERF_EBCutCell.H:269
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isSingleValued() const noexcept
Definition: ERF_EBCutCell.H:63
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isCovered() const noexcept
Definition: ERF_EBCutCell.H:57
void debug(int const a_face=-1)
Definition: ERF_EBCutCell.cpp:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centLo(int const idir) const noexcept
Definition: ERF_EBCutCell.H:133
static constexpr int m_max_faces
Definition: ERF_EBCutCell.H:243
amrex::RealVect const m_eb_normal
Definition: ERF_EBCutCell.H:226
amrex::Array< int const, 3 > m_lo_faces_id
Definition: ERF_EBCutCell.H:254
polygon_ m_F2
Definition: ERF_EBCutCell.H:237
amrex::Array< polygon_ const *const, 3 > m_hi_faces
Definition: ERF_EBCutCell.H:252
polygon_ m_F4
Definition: ERF_EBCutCell.H:239
amrex::Array< amrex::RealVect, m_max_faces > m_cellface_cent
Definition: ERF_EBCutCell.H:244
Definition: ERF_EBPolygon.H:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect get_centroid() const noexcept
Definition: ERF_EBPolygon.H:169
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int ok() const noexcept
Definition: ERF_EBPolygon.H:150
AMREX_GPU_HOST_DEVICE void add_vertex(amrex::RealVect const &a_v)
Definition: ERF_EBPolygon.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real distance(amrex::RealVect const &a_point) const noexcept
Definition: ERF_EBPolygon.H:161
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real area() const noexcept
Definition: ERF_EBPolygon.H:154
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_area(amrex::Real const &a_area)
Definition: ERF_EBPolygon.H:62
Definition: ERF_ConsoleIO.cpp:12
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
Definition: ERF_EBCutCell.H:372
amrex::RealVect vIP
Definition: ERF_EBCutCell.H:380
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE path_data()=default
amrex::Real distIP
Definition: ERF_EBCutCell.H:381
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set(const amrex::RealVect &eb_point, const amrex::RealVect &eb_normal, const amrex::RealVect &v_start, const amrex::RealVect &v_end)
Definition: ERF_EBCutCell.H:386
amrex::Real edge_length
Definition: ERF_EBCutCell.H:382
bool intersected_end
Definition: ERF_EBCutCell.H:379
bool intersected
Definition: ERF_EBCutCell.H:377
bool intersected_start
Definition: ERF_EBCutCell.H:378