343 using namespace amrex;
354 #ifndef AMREX_USE_GPU
355 constexpr
bool print_F1 =
false;
356 constexpr
bool print_F2 =
false;
357 constexpr
bool print_F3 =
false;
358 constexpr
bool print_F4 =
false;
359 constexpr
bool print_F5 =
false;
360 constexpr
bool print_F6 =
false;
361 constexpr
bool print_F7 =
false;
378 constexpr
Real tol = 1.e-15;
380 amrex::Array<bool, 8> vertex_intersected{};
385 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
391 if ( Math::abs(distIP) < tol ) {
403 if (!vertex_intersected[0]) {
404 vertex_intersected[0] =
true;
407 }
else if ( Math::abs(distIP - length) < tol ) {
419 if (!vertex_intersected[1]) {
420 vertex_intersected[1] =
true;
444 m_F1.
add_vertex(v1,
"Path 1: after v0--v1, cuts%2 == 0: add v1 -> F1",print_F1);
445 m_F2.
add_vertex(v1,
"Path 1: after v0--v1, cuts%2 == 0: add v1 -> F2",print_F2);
446 m_F5.
add_vertex(v1,
"Path 1: after v0--v1, cuts%2 == 0: add v1 -> F5",print_F5);
454 if ( Math::abs(distIP) < tol ) {
466 if (!vertex_intersected[1]) {
467 vertex_intersected[1] =
true;
470 }
else if ( Math::abs(distIP - length) < tol ) {
482 if (!vertex_intersected[4]) {
483 vertex_intersected[4] =
true;
507 m_F2.
add_vertex(v4,
"Path 1: after v1--v4, cuts%2 == 0: add v4 -> F2",print_F2);
508 m_F3.
add_vertex(v4,
"Path 1: after v1--v4, cuts%2 == 0: add v4 -> F3",print_F3);
509 m_F5.
add_vertex(v4,
"Path 1: after v1--v4, cuts%2 == 0: add v4 -> F5",print_F5);
517 if ( Math::abs(distIP) < tol) {
529 if (!vertex_intersected[4]) {
530 vertex_intersected[4] =
true;
533 }
else if ( Math::abs(distIP - length) < tol) {
545 if (!vertex_intersected[7]) {
546 vertex_intersected[7] =
true;
564 if (cuts == 2 && add_v7) {
571 m_F2.
add_vertex(v7,
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F2",print_F2);
572 m_F3.
add_vertex(v7,
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F3",print_F3);
573 m_F6.
add_vertex(v7,
"Path 1: after v4--v7, cuts == 2 && add_v7: add v7 -> F6",print_F6);
585 if ( Math::abs(distIP) < tol) {
597 }
else if ( Math::abs(distIP - length) < tol) {
624 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
630 if ( Math::abs(distIP) < tol ) {
642 if (!vertex_intersected[0]) {
643 vertex_intersected[0] =
true;
646 }
else if ( Math::abs(distIP - length) < tol ) {
658 if (!vertex_intersected[2]) {
659 vertex_intersected[2] =
true;
683 m_F1.
add_vertex(v2,
"Path 2: after v0--v2, cuts%2 == 0: add v2 -> F1",print_F1);
684 m_F4.
add_vertex(v2,
"Path 2: after v0--v2, cuts%2 == 0: add v2 -> F4",print_F4);
685 m_F6.
add_vertex(v2,
"Path 2: after v0--v2, cuts%2 == 0: add v2 -> F6",print_F6);
693 if ( Math::abs(distIP) < tol) {
705 if (!vertex_intersected[2]) {
706 vertex_intersected[2] =
true;
709 }
else if ( Math::abs(distIP - length) < tol) {
721 if (!vertex_intersected[5]) {
722 vertex_intersected[5] =
true;
745 m_F1.
add_vertex(v5,
"Path 2: after v2--v5, cuts%2 == 0: add v5 -> F1",print_F1);
746 m_F2.
add_vertex(v5,
"Path 2: after v2--v5, cuts%2 == 0: add v5 -> F2",print_F2);
747 m_F6.
add_vertex(v5,
"Path 2: after v2--v5, cuts%2 == 0: add v5 -> F6",print_F6);
755 if ( Math::abs(distIP) < tol) {
767 if (!vertex_intersected[5]) {
768 vertex_intersected[5] =
true;
771 }
else if ( Math::abs(distIP - length) < tol) {
783 if (!vertex_intersected[7]) {
784 vertex_intersected[7] =
true;
801 if (cuts == 2 && add_v7) {
808 m_F2.
add_vertex(v7,
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F2",print_F2);
809 m_F3.
add_vertex(v7,
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F3",print_F3);
810 m_F6.
add_vertex(v7,
"Path 2: after v5--v7, cuts == 2 && add_v7: add v7 -> F6",print_F6);
823 if ( Math::abs(distIP) < tol) {
835 }
else if ( Math::abs(distIP - length) < tol) {
863 for (
int i = 0; i < 8; ++i) vertex_intersected[i] =
false;
869 if ( Math::abs(distIP) < tol) {
881 if (!vertex_intersected[0]) {
882 vertex_intersected[0] =
true;
885 }
else if ( Math::abs(distIP - length) < tol) {
897 if (!vertex_intersected[3]) {
898 vertex_intersected[3] =
true;
922 m_F3.
add_vertex(v3,
"Path 3: after v0--v3, cuts%2 == 0: add v3 -> F3",print_F3);
923 m_F4.
add_vertex(v3,
"Path 3: after v0--v3, cuts%2 == 0: add v3 -> F4",print_F4);
924 m_F5.
add_vertex(v3,
"Path 3: after v0--v3, cuts%2 == 0: add v3 -> F5",print_F5);
932 if ( Math::abs(distIP) < tol) {
944 if (!vertex_intersected[3]) {
945 vertex_intersected[3] =
true;
948 }
else if ( Math::abs(distIP - length) < tol) {
960 if (!vertex_intersected[6]) {
961 vertex_intersected[6] =
true;
985 m_F3.
add_vertex(v6,
"Path 3: after v3--v6, cuts%2 == 0: add v6 -> F3",print_F3);
986 m_F4.
add_vertex(v6,
"Path 3: after v3--v6, cuts%2 == 0: add v6 -> F4",print_F4);
987 m_F6.
add_vertex(v6,
"Path 3: after v3--v6, cuts%2 == 0: add v6 -> F6",print_F6);
995 if ( Math::abs(distIP) < tol) {
1007 if (!vertex_intersected[6]) {
1008 vertex_intersected[6] =
true;
1011 }
else if ( Math::abs(distIP - length) < tol) {
1012 #ifdef AMREX_USE_GPU
1023 if (!vertex_intersected[7]) {
1024 vertex_intersected[7] =
true;
1028 #ifdef AMREX_USE_GPU
1041 if (cuts == 2 && add_v7) {
1043 #ifdef AMREX_USE_GPU
1048 m_F2.
add_vertex(v7,
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F2",print_F2);
1049 m_F3.
add_vertex(v7,
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F3",print_F3);
1050 m_F6.
add_vertex(v7,
"Path 3: after v6--v7, cuts == 2 && add_v7: add v7 -> F6",print_F6);
1063 if ( Math::abs(distIP) < tol) {
1064 #ifdef AMREX_USE_GPU
1075 }
else if ( Math::abs(distIP - length) < tol) {
1076 #ifdef AMREX_USE_GPU
1088 #ifdef AMREX_USE_GPU
1100 #ifndef AMREX_USE_GPU
1101 if (print_F1 || print_F2 || print_F3 || print_F4 || print_F5 || print_F6 || print_F7){
1102 amrex::Print()<<
"\n";
AMREX_GPU_HOST void add_vertex(amrex::RealVect const &a_v, const std::string &msg, bool print_msg=false)
Definition: ERF_EBPolygon.H:43
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_EBUtils.H:30