Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_EB2_IF_Extrusion.H
Go to the documentation of this file.
1
#ifndef AMREX_EB2_IF_EXTRUSION_H_
2
#define AMREX_EB2_IF_EXTRUSION_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
16
// For all implicit functions, >0: body; =0: boundary; <0: fluid
17
18
namespace
amrex::EB2
{
19
20
template
<
class
F>
22
class
ExtrusionIF
23
{
24
public
:
25
27
ExtrusionIF
(
F
a_f,
int
direction)
28
:
m_f
(std::move(a_f)),
29
m_direction
(direction)
30
{}
31
32
[[nodiscard]]
AMREX_FORCE_INLINE
Real
operator()
(
const
RealArray
&
p
)
const
33
{
34
RealArray
x
=
p
;
35
x
[
m_direction
] = 0.0;
36
return
m_f
(
x
);
37
}
38
39
[[nodiscard]]
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
40
Real
operator()
(
AMREX_D_DECL
(
Real
x
,
Real
y
,
Real
z
))
const
noexcept
41
requires
(
IsGPUable<F>::value
)
42
{
43
switch
(
m_direction
)
44
{
45
case
0:
46
return
m_f
(
AMREX_D_DECL
(0.0,
y
,
z
));
47
case
1:
48
return
m_f
(
AMREX_D_DECL
(
x
, 0.0,
z
));
49
default
:
50
return
m_f
(
AMREX_D_DECL
(
x
,
y
, 0.0));
51
}
52
}
53
54
protected
:
55
56
F
m_f
;
57
int
m_direction
;
58
};
59
60
template
<
class
F>
61
requires
(
IsGPUable<F>::value
)
62
struct
IsGPUable
<
ExtrusionIF<F>
>
63
: std::true_type {};
64
65
template
<
class
F>
66
constexpr
ExtrusionIF<std::decay_t<F>
>
67
extrude
(
F
&&f,
int
direction)
68
{
69
return
ExtrusionIF<std::decay_t<F>
>(std::forward<F>(f),direction);
70
}
71
72
}
73
74
#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::ExtrusionIF
Extrude a 2-D implicit function uniformly along a coordinate direction.
Definition
AMReX_EB2_IF_Extrusion.H:23
amrex::EB2::ExtrusionIF::operator()
Real operator()(const RealArray &p) const
Definition
AMReX_EB2_IF_Extrusion.H:32
amrex::EB2::ExtrusionIF::m_f
F m_f
Definition
AMReX_EB2_IF_Extrusion.H:56
amrex::EB2::ExtrusionIF::m_direction
int m_direction
Definition
AMReX_EB2_IF_Extrusion.H:57
amrex::EB2::ExtrusionIF::ExtrusionIF
ExtrusionIF(F a_f, int direction)
Store the child implicit function and the axis to extrude (0/1/2).
Definition
AMReX_EB2_IF_Extrusion.H:27
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::extrude
constexpr ExtrusionIF< std::decay_t< F > > extrude(F &&f, int direction)
Definition
AMReX_EB2_IF_Extrusion.H:67
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_Extrusion.H
Generated by
1.9.8