Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_EB2_IF_Lathe.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_IF_LATHE_H_
2#define AMREX_EB2_IF_LATHE_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_Array.H>
6#include <AMReX_EB2_IF_Base.H>
7
8#include <type_traits>
9#include <cmath>
10
17// For all implicit functions, >0: body; =0: boundary; <0: fluid
18
19namespace amrex::EB2 {
20
21template <class F>
24{
25public:
26
28 LatheIF (F a_f) : m_f(std::move(a_f)) {}
29
30 [[nodiscard]] AMREX_FORCE_INLINE Real operator() (const RealArray& p) const noexcept
31 {
32 Real r = std::hypot(p[0],p[1]);
33#if (AMREX_SPACEDIM == 2)
34 return m_f({r,0.0});
35#else
36 return m_f({r,p[2],0.0});
37#endif
38 }
39
40 template <class U=F, std::enable_if_t<IsGPUable<U>::value,int> = 0>
43 {
44 Real r = std::hypot(x,y);
45#if (AMREX_SPACEDIM == 2)
46 return m_f(r,0.0);
47#else
48 return m_f(r,z,0.0);
49#endif
50 }
51
52protected:
53
55};
56
57template <class F>
58struct IsGPUable<LatheIF<F>, std::enable_if_t<IsGPUable<F>::value>>
59 : std::true_type {};
60
61template <class F>
63lathe (F&& f)
64{
65 return LatheIF<std::decay_t<F>>(std::forward<F>(f));
66}
67
68}
69
70#endif
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Lathe an implicit curve around the z axis to build a surface of revolution.
Definition AMReX_EB2_IF_Lathe.H:24
LatheIF(F a_f)
Store the curve implicit function prior to rotation.
Definition AMReX_EB2_IF_Lathe.H:28
F m_f
Definition AMReX_EB2_IF_Lathe.H:54
Real operator()(const RealArray &p) const noexcept
Definition AMReX_EB2_IF_Lathe.H:30
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Definition AMReX_FabArrayBase.H:33
constexpr LatheIF< std::decay_t< F > > lathe(F &&f)
Definition AMReX_EB2_IF_Lathe.H:63
Array< Real, 3 > RealArray
Definition AMReX_Array.H:28
Type trait that reports whether a functor derives from GPUable.
Definition AMReX_EB2_IF_Base.H:24