Block-Structured AMR Software Framework
AMReX_EB2_IF_Plane.H
Go to the documentation of this file.
1 #ifndef AMREX_EB2_IF_PLANE_H_
2 #define AMREX_EB2_IF_PLANE_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_Array.H>
6 #include <AMReX_EB2_IF_Base.H>
7 
8 namespace amrex::EB2 {
9 
10 // For all implicit functions, >0: body; =0: boundary; <0: fluid
11 
12 class PlaneIF
13  : GPUable
14 {
15 public:
16 
17  PlaneIF (const RealArray& a_point, const RealArray& a_normal, bool a_inside = true)
18  : m_point(makeXDim3(a_point)),
19  m_normal(makeXDim3(a_normal)),
20  m_sign( a_inside ? 1.0 : -1.0 )
21  {}
22 
23  [[nodiscard]] AMREX_GPU_HOST_DEVICE inline
24  Real operator() (AMREX_D_DECL(Real x, Real y, Real z)) const noexcept
25  {
27  +(y-m_point.y)*m_normal.y*m_sign,
28  +(z-m_point.z)*m_normal.z*m_sign );
29  }
30 
31  [[nodiscard]] inline Real operator() (const RealArray& p) const noexcept
32  {
33  return this->operator()(AMREX_D_DECL(p[0],p[1],p[2]));
34  }
35 
36 protected:
37 
40  //
41  Real m_sign;
42 
43 };
44 
45 }
46 
47 #endif
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_D_TERM(a, b, c)
Definition: AMReX_SPACE.H:129
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Definition: AMReX_EB2_IF_Plane.H:14
Real m_sign
Definition: AMReX_EB2_IF_Plane.H:41
PlaneIF(const RealArray &a_point, const RealArray &a_normal, bool a_inside=true)
Definition: AMReX_EB2_IF_Plane.H:17
XDim3 m_point
Definition: AMReX_EB2_IF_Plane.H:38
XDim3 m_normal
Definition: AMReX_EB2_IF_Plane.H:39
AMREX_GPU_HOST_DEVICE Real operator()(AMREX_D_DECL(Real x, Real y, Real z)) const noexcept
Definition: AMReX_EB2_IF_Plane.H:24
Definition: AMReX_FabArrayBase.H:32
XDim3 makeXDim3(const Array< Real, AMREX_SPACEDIM > &a) noexcept
Definition: AMReX_Array.H:885
Array< Real, AMREX_SPACEDIM > RealArray
Definition: AMReX_Array.H:26
Definition: AMReX_EB2_IF_Base.H:11
Definition: AMReX_Dim3.H:13
Real x
Definition: AMReX_Dim3.H:13
Real z
Definition: AMReX_Dim3.H:13
Real y
Definition: AMReX_Dim3.H:13