17template <
typename Object>
18class FunctionWrapperHost;
39 KOKKOS_FUNCTION KOKKOS_VIRTUAL Real
value(Real ,
Real3 )
const
59 KOKKOS_FUNCTION KOKKOS_VIRTUAL Real
div(Real ,
Real3 )
const
76 KOKKOS_FUNCTION KOKKOS_VIRTUAL Real
integral()
const
81 KOKKOS_FUNCTION KOKKOS_VIRTUAL Real
average()
const
95template <
typename Object>
106 KOKKOS_FUNCTION Real
value(Real t,
Real3 p)
const KOKKOS_OVERRIDE
122 KOKKOS_FUNCTION Real
div(Real t,
Real3 p)
const KOKKOS_OVERRIDE {
return _function->div(t, p); }
129 return _function->timeIntegral(t1, t2, p);
173template <
typename Object>
209template <typename Object>
218 ::Kokkos::parallel_for(
223 static_cast<Object *
>(::Kokkos::kokkos_malloc<ExecSpace::memory_space>(
sizeof(Object)));
226 ::Kokkos::Impl::DeepCopy<MemSpace, ::Kokkos::HostSpace>(
229 return wrapper_device;
232template <
typename Object>
240 ::Kokkos::Impl::DeepCopy<MemSpace, ::Kokkos::HostSpace>(
244template <
typename Object>
251template <
typename Object>
Base class for device function wrapper.
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 gradient(Real, Real3) const
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real value(Real, Real3) const
Virtual shims that calls the corresponding methods of the actual stored function.
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real average() const
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real timeIntegral(Real, Real, Real3) const
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 vectorValue(Real, Real3) const
KOKKOS_FUNCTION KOKKOS_VIRTUAL ~FunctionWrapperDeviceBase()
Virtual destructor.
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real timeDerivative(Real, Real3) const
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real div(Real, Real3) const
KOKKOS_FUNCTION FunctionWrapperDeviceBase()
Constructor.
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 curl(Real, Real3) const
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real integral() const
Device function wrapper class that provides polymorphic interfaces for a function.
KOKKOS_FUNCTION Real3 gradient(Real t, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real3 vectorValue(Real t, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real average() const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real div(Real t, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real3 curl(Real t, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION FunctionWrapperDevice()
Constructor.
KOKKOS_FUNCTION Real value(Real t, Real3 p) const KOKKOS_OVERRIDE
Object * _function
Pointer to the function on device.
KOKKOS_FUNCTION Real timeDerivative(Real t, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real timeIntegral(Real t1, Real t2, Real3 p) const KOKKOS_OVERRIDE
KOKKOS_FUNCTION Real integral() const KOKKOS_OVERRIDE
Base class for host function wrapper.
virtual ~FunctionWrapperHostBase()
Virtual destructor.
virtual void freeFunction()=0
Free host and device copies of function.
virtual FunctionWrapperDeviceBase * allocate()=0
Allocate device function and wrapper.
virtual void copyFunction()=0
Copy function to device.
Host function wrapper class that allocates a function on device and creates its device wrapper.
FunctionWrapperDeviceBase * allocate() override final
Allocate device function and wrapper.
FunctionWrapperHost(const void *function)
Constructor.
const Object & _function_host
Reference of the function on host.
void freeFunction() override final
Free host and device copies of function.
std::unique_ptr< Object > _function_copy
Copy of the function on host.
void copyFunction() override final
Copy function to device.
Object * _function_device
Copy of the function on device.
~FunctionWrapperHost()
Destructor.