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
19
namespace
amrex::EB2
{
20
21
template
<
class
F>
23
class
LatheIF
24
{
25
public
:
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
[[nodiscard]]
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
41
Real
operator()
(
AMREX_D_DECL
(
Real
x
,
Real
y
,
Real
z
))
const
noexcept
42
requires
(
IsGPUable<F>::value
)
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
52
protected
:
53
54
F
m_f
;
55
};
56
57
template
<
class
F>
58
requires
(
IsGPUable<F>::value
)
59
struct
IsGPUable
<
LatheIF<F>
> : std::true_type {};
60
61
template
<
class
F>
62
constexpr
LatheIF<std::decay_t<F>
>
63
lathe
(
F
&& f)
64
{
65
return
LatheIF<std::decay_t<F>
>(std::forward<F>(f));
66
}
67
68
}
69
70
#endif
AMReX_Array.H
Fixed-size array types for use on GPU and CPU.
AMReX_EB2_IF_Base.H
AMREX_FORCE_INLINE
#define AMREX_FORCE_INLINE
Definition
AMReX_Extension.H:124
AMREX_GPU_HOST_DEVICE
#define AMREX_GPU_HOST_DEVICE
Definition
AMReX_GpuQualifiers.H:20
p
while parser_exe_t p
Definition
AMReX_Parser_Exe_Body.H:33
AMREX_D_DECL
#define AMREX_D_DECL(a, b, c)
Definition
AMReX_SPACE.H:171
amrex::EB2::LatheIF
Lathe an implicit curve around the z axis to build a surface of revolution.
Definition
AMReX_EB2_IF_Lathe.H:24
amrex::EB2::LatheIF::LatheIF
LatheIF(F a_f)
Store the curve implicit function prior to rotation.
Definition
AMReX_EB2_IF_Lathe.H:28
amrex::EB2::LatheIF::m_f
F m_f
Definition
AMReX_EB2_IF_Lathe.H:54
amrex::EB2::LatheIF::operator()
Real operator()(const RealArray &p) const noexcept
Definition
AMReX_EB2_IF_Lathe.H:30
amrex::Real
amrex_real Real
Floating Point Type for Fields.
Definition
AMReX_REAL.H:80
amrex::RealArray
Array< Real, 3 > RealArray
Definition
AMReX_Array.H:35
amrex::EB2
Definition
AMReX_FabArrayBase.H:38
amrex::EB2::lathe
constexpr LatheIF< std::decay_t< F > > lathe(F &&f)
Definition
AMReX_EB2_IF_Lathe.H:63
amrex::Order::F
@ F
amrex::Direction::y
@ y
amrex::Direction::x
@ x
amrex::Direction::z
@ z
amrex::EB2::IsGPUable
Type trait that reports whether a functor derives from GPUable.
Definition
AMReX_EB2_IF_Base.H:24
Src
EB
AMReX_EB2_IF_Lathe.H
Generated by
1.9.8