ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_EBCutCell.H File Reference
#include <AMReX_REAL.H>
#include <AMReX_Array.H>
#include <AMReX_RealBox.H>
#include <AMReX_RealVect.H>
#include <AMReX_Algorithm.H>
#include <AMReX_EBCellFlag.H>
#include "ERF_EBPolygon.H"
Include dependency graph for ERF_EBCutCell.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  eb_cut_cell_
 
struct  eb_cut_cell_::path_data
 

Functions

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)
 

Function Documentation

◆ intersect_plane_edge()

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 
)
21 {
22  amrex::RealVect const edge(a_edge_point1 - a_edge_point0);
23  amrex::Real const edge_length = edge.vectorLength();
24 
25  AMREX_ALWAYS_ASSERT(edge_length > 0.);
26 
27  amrex::RealVect edge_normal = edge / edge_length;
28 
29  amrex::Real np_dot_ne = a_plane_normal.dotProduct(edge_normal);
30 
31  // if ( amrex::Math::abs(np_dot_ne) < std::numeric_limits<amrex::Real>::min() )
32  if ( amrex::Math::abs(np_dot_ne) < 10.0 * std::numeric_limits<amrex::Real>::epsilon() )
33  { return 0; }
34 
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;
38 
39  a_intersection_point = a_edge_point0 + a_intersection_dist*edge_normal;
40 
41  if (0. <= a_intersection_dist && a_intersection_dist <= edge_length) { return 1;}
42 
43  return 0;
44 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12

Referenced by eb_cut_cell_::calc_edge_intersections(), and eb_cut_cell_::path_data::set().

Here is the caller graph for this function: