Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_EB2_IF_Complement.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_IF_COMPLEMENT_H_
2#define AMREX_EB2_IF_COMPLEMENT_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
18namespace amrex::EB2 {
19
20template <class F>
23{
24public:
25
27 ComplementIF (F a_f) : m_f(std::move(a_f)) {}
28
30 [[nodiscard]] AMREX_FORCE_INLINE Real operator() (const RealArray& p) const noexcept
31 {
32 return -m_f(p);
33 }
34
35
37 template<class U=F, std::enable_if_t<IsGPUable<U>::value,int> = 0>
40 {
41 return -m_f(AMREX_D_DECL(x,y,z));
42 }
43
44protected:
45
47};
48
49template <class F>
50struct IsGPUable<ComplementIF<F>, std::enable_if_t<IsGPUable<F>::value>>
51 : std::true_type {};
52
53template <class F>
57{
58 return ComplementIF<std::decay_t<F>>(std::forward<F>(f));
59}
60
61}
62
63#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
Implicit function wrapper that swaps interior/exterior.
Definition AMReX_EB2_IF_Complement.H:23
F m_f
Definition AMReX_EB2_IF_Complement.H:46
Real operator()(const RealArray &p) const noexcept
Evaluate the complement in array form.
Definition AMReX_EB2_IF_Complement.H:30
ComplementIF(F a_f)
Store the child implicit function to be complemented.
Definition AMReX_EB2_IF_Complement.H:27
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Definition AMReX_FabArrayBase.H:33
constexpr ComplementIF< std::decay_t< F > > makeComplement(F &&f)
Helper that constructs a complement operator.
Definition AMReX_EB2_IF_Complement.H:56
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