5 #ifndef ERF_EB_CUT_CELL_H_
6 #define ERF_EB_CUT_CELL_H_
8 #include <AMReX_REAL.H>
9 #include <AMReX_Array.H>
10 #include <AMReX_RealBox.H>
11 #include <AMReX_RealVect.H>
12 #include <AMReX_Algorithm.H>
13 #include <AMReX_EBCellFlag.H>
14 #include <AMReX_GpuPrint.H>
28 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
31 amrex::RealVect
const& a_plane_normal,
32 amrex::RealVect
const& a_edge_point0,
33 amrex::RealVect
const& a_edge_point1,
34 amrex::RealVect& a_intersection_point,
37 amrex::RealVect
const edge(a_edge_point1 - a_edge_point0);
38 amrex::Real const edge_length = edge.vectorLength();
42 amrex::RealVect edge_normal = edge / edge_length;
44 amrex::Real np_dot_ne = a_plane_normal.dotProduct(edge_normal);
50 a_intersection_dist = a_plane_normal.dotProduct(a_plane_point)
51 - a_plane_normal.dotProduct(a_edge_point0);
52 a_intersection_dist /= np_dot_ne;
54 a_intersection_point = a_edge_point0 + a_intersection_dist*edge_normal;
56 if (
zero <= a_intersection_dist && a_intersection_dist <= edge_length) {
return 1;}
81 amrex::RealBox
const& a_rbox,
82 amrex::RealVect
const& a_point,
83 amrex::RealVect
const& a_normal );
86 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
90 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
94 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
98 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
104 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
123 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
132 amrex::RealVect v0(lo[0], lo[1], lo[2]);
148 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
150 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
161 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
163 AMREX_ASSERT( idir >= 0 && idir < AMREX_SPACEDIM );
171 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
180 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
181 amrex::RealVect
centLo (
int const idir )
const noexcept {
182 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
188 if (amrex::almostEqual(area_R,
zero) || amrex::almostEqual(area_R,
m_rbox_area[idir]) ){
191 amrex::RealVect cent_O = cent;
192 amrex::RealVect cent_R =
m_lo_faces[idir]->get_centroid();
204 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
205 amrex::RealVect
centHi (
int const idir )
const noexcept {
206 AMREX_ASSERT( idir >=0 && idir < AMREX_SPACEDIM );
212 if (amrex::almostEqual(area_R,
zero) || amrex::almostEqual(area_R,
m_rbox_area[idir]) ){
215 amrex::RealVect cent_O = cent;
216 amrex::RealVect cent_R =
m_hi_faces[idir]->get_centroid();
225 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
228 if (
m_flag.isSingleValued()) {
235 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
238 if (
m_flag.isSingleValued()) {
245 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
248 if (
m_flag.isSingleValued()) {
268 vcent[0] =
myhalf * ( - xm * xm * axm + xp * xp * axp + bcent[0] * bcent[0] *
m_eb_normal[0] * barea ) / vol;
269 vcent[1] =
myhalf * ( - ym * ym * aym + yp * yp * ayp + bcent[1] * bcent[1] *
m_eb_normal[1] * barea ) / vol;
270 vcent[2] =
myhalf * ( - zm * zm * azm + zp * zp * azp + bcent[2] * bcent[2] *
m_eb_normal[2] * barea ) / vol;
279 void debug (
int const a_face = -1 );
320 AMREX_GPU_HOST_DEVICE
324 AMREX_GPU_HOST_DEVICE
328 AMREX_GPU_HOST_DEVICE
332 amrex::RealBox
const& a_rbox,
333 amrex::RealVect
const& a_point,
334 amrex::RealVect
const& a_normal )
336 , m_eb_point(a_point)
337 , m_eb_normal(a_normal)
339 , m_F1(a_point, a_normal)
340 , m_F2(a_point, a_normal)
341 , m_F3(a_point, a_normal)
342 , m_F4(a_point, a_normal)
343 , m_F5(a_point, a_normal)
344 , m_F6(a_point, a_normal)
345 , m_cellface_cent({amrex::RealVect(
zero), amrex::RealVect(
zero), amrex::RealVect(
zero),
346 amrex::RealVect(
zero), amrex::RealVect(
zero), amrex::RealVect(
zero)})
348 using namespace amrex;
350 m_rbox_area[0] = m_rbox.length(1)*m_rbox.length(2);
351 m_rbox_area[1] = m_rbox.length(0)*m_rbox.length(2);
352 m_rbox_area[2] = m_rbox.length(0)*m_rbox.length(1);
354 amrex::RealVect v0(m_rbox.lo(0), m_rbox.lo(1), m_rbox.lo(2));
355 amrex::RealVect v1(m_rbox.hi(0), m_rbox.lo(1), m_rbox.lo(2));
356 amrex::RealVect v2(m_rbox.lo(0), m_rbox.hi(1), m_rbox.lo(2));
357 amrex::RealVect v3(m_rbox.lo(0), m_rbox.lo(1), m_rbox.hi(2));
358 amrex::RealVect v4(m_rbox.hi(0), m_rbox.lo(1), m_rbox.hi(2));
359 amrex::RealVect v5(m_rbox.hi(0), m_rbox.hi(1), m_rbox.lo(2));
360 amrex::RealVect v6(m_rbox.lo(0), m_rbox.hi(1), m_rbox.hi(2));
361 amrex::RealVect v7(m_rbox.hi(0), m_rbox.hi(1), m_rbox.hi(2));
365 m_cellface_cent[0] =
fourth * ( v0 + v2 + v5 + v1 );
366 m_cellface_cent[1] =
fourth * ( v1 + v5 + v7 + v4 );
367 m_cellface_cent[2] =
fourth * ( v3 + v4 + v7 + v6 );
368 m_cellface_cent[3] =
fourth * ( v0 + v3 + v6 + v2 );
369 m_cellface_cent[4] =
fourth * ( v0 + v1 + v4 + v3 );
370 m_cellface_cent[5] =
fourth * ( v2 + v5 + v7 + v6 );
374 m_cell_cent[0] =
myhalf * ( m_rbox.lo(0) + m_rbox.hi(0) );
375 m_cell_cent[1] =
myhalf * ( m_rbox.lo(1) + m_rbox.hi(1) );
376 m_cell_cent[2] =
myhalf * ( m_rbox.lo(2) + m_rbox.hi(2) );
380 m_dx[0] = m_rbox.hi(0) - m_rbox.lo(0);
381 m_dx[1] = m_rbox.hi(1) - m_rbox.lo(1);
382 m_dx[2] = m_rbox.hi(2) - m_rbox.lo(2);
384 if (a_flag.isCovered() ) {
388 }
else if (a_flag.isRegular() ) {
394 amrex::RealVect c =
myhalf*(v0 + v7);
395 amrex::RealVect e = v7 - c;
397 amrex::Real r = e[0]*amrex::Math::abs(a_normal[0]) +
398 e[1]*amrex::Math::abs(a_normal[1]) +
399 e[2]*amrex::Math::abs(a_normal[2]);
401 amrex::Real s = amrex::Math::abs(c.dotProduct(a_normal)
402 - a_point.dotProduct(a_normal));
405 if ((a_normal.dotProduct(v0) - a_normal.dotProduct(a_point)) >
zero)
406 { set_covered(); }
else { set_regular(); }
407 }
else { m_flag.setSingleValued(); }
410 if ( m_flag.isSingleValued() ) {
412 m_invert = ((m_eb_normal.dotProduct(v0) - m_eb_normal.dotProduct(m_eb_point)) >
zero) ?
zero :
one;
414 calc_edge_intersections();
427 if ( !m_flag.isSingleValued() ) {
428 set_covered_regular_cell_vertices();
439 AMREX_GPU_HOST_DEVICE
463 AMREX_GPU_HOST_DEVICE
465 void set(
const amrex::RealVect& eb_point,
466 const amrex::RealVect& eb_normal,
467 const amrex::RealVect& v_start,
468 const amrex::RealVect& v_end)
471 amrex::RealVect v_intersect{v_start};
472 amrex::Real dist_intersect = std::numeric_limits<amrex::Real>::quiet_NaN();
474 eb_point, eb_normal, v_start, v_end, v_intersect, dist_intersect
491 AMREX_GPU_HOST_DEVICE
497 using namespace amrex;
513 const bool print_F1 = print_initial &&
false;
514 const bool print_F2 = print_initial &&
false;
515 const bool print_F3 = print_initial &&
false;
516 const bool print_F4 = print_initial &&
false;
517 const bool print_F5 = print_initial &&
false;
518 const bool print_F6 = print_initial &&
false;
519 const bool print_F7 = print_initial &&
false;
522 m_F1.
add_vertex(v0);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Initial: add v0 -> F1");
523 m_F4.
add_vertex(v0);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Initial: add v0 -> F4");
524 m_F5.
add_vertex(v0);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Initial: add v0 -> F5");
531 amrex::Array<bool,8> vertex_intersected{};
539 amrex::Array<path_data,3> p1, p2, p3;
573 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
575 if (p1[0].intersected) {
576 if (p1[0].intersected_start) {
577 m_F1.
add_vertex(v0);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v0 -> F1");
578 m_F4.
add_vertex(v0);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v0 -> F4");
579 m_F5.
add_vertex(v0);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v0 -> F5");
580 m_F7.
add_vertex(v0);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v0 -> F7");
581 if (!vertex_intersected[0]) {
582 vertex_intersected[0] =
true;
585 }
else if (p1[0].intersected_end) {
586 m_F1.
add_vertex(v1);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v1 -> F1");
587 m_F2.
add_vertex(v1);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v1 -> F2");
588 m_F5.
add_vertex(v1);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v1 -> F5");
589 m_F7.
add_vertex(v1);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add v1 -> F7");
590 if (!vertex_intersected[1]) {
591 vertex_intersected[1] =
true;
595 m_F1.
add_vertex(p1[0].vIP);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add vIP -> F1");
596 m_F5.
add_vertex(p1[0].vIP);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add vIP -> F5");
597 m_F7.
add_vertex(p1[0].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v0--v1: add vIP -> F7");
604 m_F1.
add_vertex(v1);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F1");
605 m_F2.
add_vertex(v1);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F2");
606 m_F5.
add_vertex(v1);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v0--v1, cuts-mod-2==0: add v1 -> F5");
609 if (p1[1].intersected) {
610 if (p1[1].intersected_start) {
611 m_F1.
add_vertex(v1);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v1 -> F1");
612 m_F2.
add_vertex(v1);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v1 -> F2");
613 m_F5.
add_vertex(v1);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v1 -> F5");
614 m_F7.
add_vertex(v1);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v1 -> F7");
615 if (!vertex_intersected[1]) {
616 vertex_intersected[1] =
true;
619 }
else if (p1[1].intersected_end) {
620 m_F2.
add_vertex(v4);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v4 -> F2");
621 m_F3.
add_vertex(v4);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v4 -> F3");
622 m_F5.
add_vertex(v4);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v4 -> F5");
623 m_F7.
add_vertex(v4);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add v4 -> F7");
624 if (!vertex_intersected[4]) {
625 vertex_intersected[4] =
true;
629 m_F2.
add_vertex(p1[1].vIP);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add vIP -> F2");
630 m_F5.
add_vertex(p1[1].vIP);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add vIP -> F5");
631 m_F7.
add_vertex(p1[1].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v1--v4: add vIP -> F7");
638 m_F2.
add_vertex(v4);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F2");
639 m_F3.
add_vertex(v4);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F3");
640 m_F5.
add_vertex(v4);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v1--v4, cuts-mod-2==0: add v4 -> F5");
643 if (p1[2].intersected) {
644 if (p1[2].intersected_start) {
645 m_F2.
add_vertex(v4);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v4 -> F2");
646 m_F3.
add_vertex(v4);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v4 -> F3");
647 m_F5.
add_vertex(v4);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v4 -> F5");
648 m_F7.
add_vertex(v4);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v4 -> F7");
649 if (!vertex_intersected[4]) {
650 vertex_intersected[4] =
true;
653 }
else if (p1[2].intersected_end) {
654 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v7 -> F2");
655 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v7 -> F3");
656 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v7 -> F6");
657 m_F7.
add_vertex(v7);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add v7 -> F7");
658 if (!vertex_intersected[7]) {
659 vertex_intersected[7] =
true;
663 m_F2.
add_vertex(p1[2].vIP);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add vIP -> F2");
664 m_F3.
add_vertex(p1[2].vIP);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add vIP -> F3");
665 m_F7.
add_vertex(p1[2].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: v4--v7: add vIP -> F7");
671 if (cuts == 2 && add_v7) {
673 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F2");
674 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F3");
675 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F6");
684 m_F1.
add_vertex(v1);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v1 -> F1");
685 m_F2.
add_vertex(v1);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v1 -> F2");
686 m_F5.
add_vertex(v1);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v1 -> F5");
687 m_F7.
add_vertex(v1);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v1 -> F7");
689 m_F1.
add_vertex(v5);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v5 -> F1");
690 m_F2.
add_vertex(v5);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v5 -> F2");
691 m_F6.
add_vertex(v5);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v5 -> F6");
692 m_F7.
add_vertex(v5);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add v5 -> F7");
694 m_F1.
add_vertex(p4.
vIP);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add vIP -> F1");
695 m_F2.
add_vertex(p4.
vIP);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add vIP -> F2");
696 m_F7.
add_vertex(p4.
vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 4: v1--v5: add vIP -> F7");
702 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
704 if (p2[0].intersected) {
705 if (p2[0].intersected_start) {
706 m_F1.
add_vertex(v0);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v0 -> F1");
707 m_F4.
add_vertex(v0);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v0 -> F4");
708 m_F5.
add_vertex(v0);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v0 -> F5");
709 m_F7.
add_vertex(v0);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v0 -> F7");
710 if (!vertex_intersected[0]) {
711 vertex_intersected[0] =
true;
714 }
else if (p2[0].intersected_end) {
715 m_F1.
add_vertex(v2);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v2 -> F1");
716 m_F4.
add_vertex(v2);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v2 -> F4");
717 m_F6.
add_vertex(v2);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v2 -> F6");
718 m_F7.
add_vertex(v2);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add v2 -> F7");
719 if (!vertex_intersected[2]) {
720 vertex_intersected[2] =
true;
724 m_F1.
add_vertex(p2[0].vIP);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add vIP -> F1");
725 m_F4.
add_vertex(p2[0].vIP);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add vIP -> F4");
726 m_F7.
add_vertex(p2[0].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v0--v2: add vIP -> F7");
733 m_F1.
add_vertex(v2);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F1");
734 m_F4.
add_vertex(v2);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F4");
735 m_F6.
add_vertex(v2);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v0--v2, cuts-mod-2==0: add v2 -> F6");
738 if (p2[1].intersected) {
739 if (p2[1].intersected_start) {
740 m_F1.
add_vertex(v2);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v2 -> F1");
741 m_F4.
add_vertex(v2);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v2 -> F4");
742 m_F6.
add_vertex(v2);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v2 -> F6");
743 m_F7.
add_vertex(v2);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v2 -> F7");
744 if (!vertex_intersected[2]) {
745 vertex_intersected[2] =
true;
748 }
else if (p2[1].intersected_end) {
749 m_F1.
add_vertex(v5);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v5 -> F1");
750 m_F2.
add_vertex(v5);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v5 -> F2");
751 m_F6.
add_vertex(v5);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v5 -> F6");
752 m_F7.
add_vertex(v5);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add v5 -> F7");
753 if (!vertex_intersected[5]) {
754 vertex_intersected[5] =
true;
758 m_F1.
add_vertex(p2[1].vIP);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add vIP -> F1");
759 m_F6.
add_vertex(p2[1].vIP);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add vIP -> F6");
760 m_F7.
add_vertex(p2[1].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v2--v5: add vIP -> F7");
766 m_F1.
add_vertex(v5);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F1");
767 m_F2.
add_vertex(v5);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F2");
768 m_F6.
add_vertex(v5);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v2--v5, cuts-mod-2==0: add v5 -> F6");
771 if (p2[2].intersected) {
772 if (p2[2].intersected_start) {
773 m_F1.
add_vertex(v5);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v5 -> F1");
774 m_F2.
add_vertex(v5);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v5 -> F2");
775 m_F6.
add_vertex(v5);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v5 -> F6");
776 m_F7.
add_vertex(v5);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v5 -> F7");
777 if (!vertex_intersected[5]) {
778 vertex_intersected[5] =
true;
781 }
else if (p2[2].intersected_end) {
782 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v7 -> F2");
783 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v7 -> F3");
784 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v7 -> F6");
785 m_F7.
add_vertex(v7);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add v7 -> F7");
786 if (!vertex_intersected[7]) {
787 vertex_intersected[7] =
true;
791 m_F2.
add_vertex(p2[2].vIP);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add vIP -> F2");
792 m_F6.
add_vertex(p2[2].vIP);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add vIP -> F6");
793 m_F7.
add_vertex(p2[2].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: v5--v7: add vIP -> F7");
798 if (cuts == 2 && add_v7) {
800 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F2");
801 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F3");
802 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F6");
812 m_F1.
add_vertex(v2);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v2 -> F1");
813 m_F4.
add_vertex(v2);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v2 -> F4");
814 m_F6.
add_vertex(v2);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v2 -> F6");
815 m_F7.
add_vertex(v2);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v2 -> F7");
817 m_F3.
add_vertex(v6);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v6 -> F3");
818 m_F4.
add_vertex(v6);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v6 -> F4");
819 m_F6.
add_vertex(v6);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v6 -> F6");
820 m_F7.
add_vertex(v6);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add v6 -> F7");
822 m_F4.
add_vertex(p5.
vIP);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add vIP -> F4");
823 m_F6.
add_vertex(p5.
vIP);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add vIP -> F6");
824 m_F7.
add_vertex(p5.
vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 5: v2--v6: add vIP -> F7");
831 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
833 if (p3[0].intersected) {
834 if (p3[0].intersected_start) {
835 m_F1.
add_vertex(v0);
if(print_F1) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v0 -> F1");
836 m_F4.
add_vertex(v0);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v0 -> F4");
837 m_F5.
add_vertex(v0);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v0 -> F5");
838 m_F7.
add_vertex(v0);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v0 -> F7");
839 if (!vertex_intersected[0]) {
840 vertex_intersected[0] =
true;
843 }
else if (p3[0].intersected_end) {
844 m_F3.
add_vertex(v3);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v3 -> F3");
845 m_F4.
add_vertex(v3);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v3 -> F4");
846 m_F5.
add_vertex(v3);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v3 -> F5");
847 m_F7.
add_vertex(v3);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add v3 -> F7");
848 if (!vertex_intersected[3]) {
849 vertex_intersected[3] =
true;
853 m_F4.
add_vertex(p3[0].vIP);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add vIP -> F4");
854 m_F5.
add_vertex(p3[0].vIP);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add vIP -> F5");
855 m_F7.
add_vertex(p3[0].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v0--v3: add vIP -> F7");
862 m_F3.
add_vertex(v3);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F3");
863 m_F4.
add_vertex(v3);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F4");
864 m_F5.
add_vertex(v3);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v0--v3, cuts-mod-2 == 0: add v3 -> F5");
867 if (p3[1].intersected) {
868 if (p3[1].intersected_start) {
869 m_F3.
add_vertex(v3);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v3 -> F3");
870 m_F4.
add_vertex(v3);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v3 -> F4");
871 m_F5.
add_vertex(v3);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v3 -> F5");
872 m_F7.
add_vertex(v3);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v3 -> F7");
873 if (!vertex_intersected[3]) {
874 vertex_intersected[3] =
true;
877 }
else if (p3[1].intersected_end) {
878 m_F3.
add_vertex(v6);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v6 -> F3");
879 m_F4.
add_vertex(v6);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v6 -> F4");
880 m_F6.
add_vertex(v6);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v6 -> F6");
881 m_F7.
add_vertex(v6);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add v6 -> F7");
882 if (!vertex_intersected[6]) {
883 vertex_intersected[6] =
true;
887 m_F3.
add_vertex(p3[1].vIP);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add vIP -> F3");
888 m_F4.
add_vertex(p3[1].vIP);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add vIP -> F4");
889 m_F7.
add_vertex(p3[1].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v3--v6: add vIP -> F7");
896 m_F3.
add_vertex(v6);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F3");
897 m_F4.
add_vertex(v6);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F4");
898 m_F6.
add_vertex(v6);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v3--v6, cuts-mod-2 == 0: add v6 -> F6");
901 if (p3[2].intersected) {
902 if (p3[2].intersected_start) {
903 m_F3.
add_vertex(v6);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v6 -> F3");
904 m_F4.
add_vertex(v6);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v6 -> F4");
905 m_F6.
add_vertex(v6);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v6 -> F6");
906 m_F7.
add_vertex(v6);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v6 -> F7");
907 if (!vertex_intersected[6]) {
908 vertex_intersected[6] =
true;
911 }
else if (p3[2].intersected_end) {
912 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v7 -> F2");
913 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v7 -> F3");
914 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v7 -> F6");
915 m_F7.
add_vertex(v7);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add v7 -> F7");
916 if (!vertex_intersected[7]) {
917 vertex_intersected[7] =
true;
921 m_F3.
add_vertex(p3[2].vIP);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add vIP -> F3");
922 m_F6.
add_vertex(p3[2].vIP);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add vIP -> F6");
923 m_F7.
add_vertex(p3[2].vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: v6--v7: add vIP -> F7");
928 if (cuts == 2 && add_v7) {
930 m_F2.
add_vertex(v7);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F2");
931 m_F3.
add_vertex(v7);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F3");
932 m_F6.
add_vertex(v7);
if(print_F6) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F6");
942 m_F3.
add_vertex(v3);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v3 -> F3");
943 m_F4.
add_vertex(v3);
if(print_F4) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v3 -> F4");
944 m_F5.
add_vertex(v3);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v3 -> F5");
945 m_F7.
add_vertex(v3);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v3 -> F7");
947 m_F2.
add_vertex(v4);
if(print_F2) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v4 -> F2");
948 m_F3.
add_vertex(v4);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v4 -> F3\n");
949 m_F5.
add_vertex(v4);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v4 -> F5");
950 m_F7.
add_vertex(v4);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add v4 -> F7");
952 m_F3.
add_vertex(p6.
vIP);
if(print_F3) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add vIP -> F3");
953 m_F5.
add_vertex(p6.
vIP);
if(print_F5) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add vIP -> F5");
954 m_F7.
add_vertex(p6.
vIP);
if(print_F7) AMREX_DEVICE_PRINTF(
"%s \n",
"Path 6: v3--v4: add vIP -> F7");
958 if (print_F1 || print_F2 || print_F3 || print_F4 || print_F5 || print_F6 || print_F7) {
959 AMREX_DEVICE_PRINTF(
"%s \n",
" ");
964 AMREX_GPU_HOST_DEVICE
970 using namespace amrex;
constexpr amrex::Real three
Definition: ERF_Constants.H:11
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real fourth
Definition: ERF_Constants.H:14
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
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)
Intersect a plane with a line segment.
Definition: ERF_EBCutCell.H:30
Defines polygon geometry utilities for EB cut-cell reconstruction.
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Reconstructs geometric moments for one EB cut cell.
Definition: ERF_EBCutCell.H:68
AMREX_GPU_HOST_DEVICE void calc_edge_intersections()
Compute all edge-plane intersections and populate polygon vertices.
Definition: ERF_EBCutCell.H:495
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real volume() const
Return the physical volume of the reconstructed cell.
Definition: ERF_EBCutCell.H:124
polygon_ m_F6
Definition: ERF_EBCutCell.H:300
amrex::Array< polygon_ const *const, 3 > m_lo_faces
Definition: ERF_EBCutCell.H:310
amrex::RealVect m_rbox_area
Definition: ERF_EBCutCell.H:289
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isRegular() const noexcept
Return true if the reconstructed cell is regular.
Definition: ERF_EBCutCell.H:91
amrex::RealVect m_cell_cent
Definition: ERF_EBCutCell.H:304
amrex::RealVect m_dx
Definition: ERF_EBCutCell.H:305
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaLo(int const idir) const noexcept
Return the low-side face area in one coordinate direction.
Definition: ERF_EBCutCell.H:149
amrex::RealVect const m_eb_point
Definition: ERF_EBCutCell.H:284
amrex::Real m_invert
Definition: ERF_EBCutCell.H:287
amrex::RealBox const m_rbox
Definition: ERF_EBCutCell.H:283
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaHi(int const idir) const noexcept
Return the high-side face area in one coordinate direction.
Definition: ERF_EBCutCell.H:162
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centBoun() const noexcept
Return the EB boundary centroid.
Definition: ERF_EBCutCell.H:226
AMREX_GPU_HOST_DEVICE void set_covered_regular_cell_vertices()
Populate polygon vertices for cells that are fully covered or regular.
Definition: ERF_EBCutCell.H:968
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_regular()
Mark the reconstructed cell as regular and fill regular face areas.
Definition: ERF_EBCutCell.H:105
polygon_ m_F1
Definition: ERF_EBCutCell.H:295
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real areaBoun() const noexcept
Return the EB boundary area inside the cell.
Definition: ERF_EBCutCell.H:172
polygon_ m_F3
Definition: ERF_EBCutCell.H:297
amrex::EBCellFlag m_flag
Definition: ERF_EBCutCell.H:291
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centHi(int const idir) const noexcept
Return the high-side face centroid in one coordinate direction.
Definition: ERF_EBCutCell.H:205
polygon_ m_F5
Definition: ERF_EBCutCell.H:299
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centVol() const noexcept
Return the volume centroid of the reconstructed cell.
Definition: ERF_EBCutCell.H:246
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_covered()
Mark the reconstructed cell as covered.
Definition: ERF_EBCutCell.H:99
polygon_ m_F7
Definition: ERF_EBCutCell.H:308
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect normBoun() const noexcept
Return the EB boundary normal.
Definition: ERF_EBCutCell.H:236
amrex::Array< int const, 3 > m_hi_faces_id
Definition: ERF_EBCutCell.H:314
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)
Construct cut-cell geometry from a cell flag, box, EB point, and EB normal.
Definition: ERF_EBCutCell.H:331
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isSingleValued() const noexcept
Return true if the reconstructed cell is single-valued.
Definition: ERF_EBCutCell.H:95
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isCovered() const noexcept
Return true if the reconstructed cell is covered.
Definition: ERF_EBCutCell.H:87
void debug(int const a_face=-1)
Print cut-cell diagnostics on CPU builds.
Definition: ERF_EBCutCell.cpp:13
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect centLo(int const idir) const noexcept
Return the low-side face centroid in one coordinate direction.
Definition: ERF_EBCutCell.H:181
static constexpr int m_max_faces
Definition: ERF_EBCutCell.H:302
amrex::RealVect const m_eb_normal
Definition: ERF_EBCutCell.H:285
amrex::Array< int const, 3 > m_lo_faces_id
Definition: ERF_EBCutCell.H:313
polygon_ m_F2
Definition: ERF_EBCutCell.H:296
amrex::Array< polygon_ const *const, 3 > m_hi_faces
Definition: ERF_EBCutCell.H:311
polygon_ m_F4
Definition: ERF_EBCutCell.H:298
amrex::Array< amrex::RealVect, m_max_faces > m_cellface_cent
Definition: ERF_EBCutCell.H:303
Polygon helper used to accumulate cut-cell face geometry.
Definition: ERF_EBPolygon.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::RealVect get_centroid() const noexcept
Return the polygon centroid from its sub-triangulation.
Definition: ERF_EBPolygon.H:205
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int ok() const noexcept
Return whether the polygon has been defined with a valid area state.
Definition: ERF_EBPolygon.H:182
AMREX_GPU_HOST_DEVICE void add_vertex(amrex::RealVect const &a_v)
Add a unique vertex to the polygon.
Definition: ERF_EBPolygon.H:63
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real distance(amrex::RealVect const &a_point) const noexcept
Return the perpendicular distance from this polygon to a point.
Definition: ERF_EBPolygon.H:197
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real area() const noexcept
Return the polygon area.
Definition: ERF_EBPolygon.H:187
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void set_area(amrex::Real const &a_area)
Set the polygon area directly.
Definition: ERF_EBPolygon.H:87
Definition: ERF_ConsoleIO.cpp:15
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
Intersection metadata for one ordered edge path in the cut-cell box.
Definition: ERF_EBCutCell.H:437
amrex::RealVect vIP
Coordinates of the intersection point.
Definition: ERF_EBCutCell.H:450
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE path_data()=default
Construct empty path data.
amrex::Real distIP
Distance from the start vertex to the intersection point.
Definition: ERF_EBCutCell.H:452
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)
Compute and store the intersection data for one edge.
Definition: ERF_EBCutCell.H:465
amrex::Real edge_length
Physical length of the edge.
Definition: ERF_EBCutCell.H:454
bool intersected_end
Whether the intersection lies on the end vertex.
Definition: ERF_EBCutCell.H:448
bool intersected
Whether the edge intersects the EB plane.
Definition: ERF_EBCutCell.H:444
bool intersected_start
Whether the intersection lies on the start vertex.
Definition: ERF_EBCutCell.H:446