https://mooseframework.inl.gov
Public Member Functions | Private Attributes | List of all members
Moose::Kokkos::Function Class Referencefinal

The abstract class that provides polymorphic interfaces for a function. More...

#include <KokkosFunction.h>

Public Member Functions

 Function ()=default
 Default constructor. More...
 
 Function (std::shared_ptr< FunctionWrapperHostBase > wrapper)
 Constructor. More...
 
 Function (const Function &function)
 Copy constructor for parallel dispatch. More...
 
 ~Function ()
 Destructor. More...
 
KOKKOS_FUNCTION operator bool () const
 Get whether the function wrapper is valid. More...
 
KOKKOS_FUNCTION Real value (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real3 vectorValue (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real3 gradient (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real3 curl (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real div (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real timeDerivative (Real t, Real3 p) const
 
KOKKOS_FUNCTION Real timeIntegral (Real t1, Real t2, Real3 p) const
 
KOKKOS_FUNCTION Real integral () const
 
KOKKOS_FUNCTION Real average () const
 

Private Attributes

std::shared_ptr< FunctionWrapperHostBase_wrapper_host
 Pointer to the host function wrapper. More...
 
FunctionWrapperDeviceBase_wrapper_device = nullptr
 Pointer to the device function wrapper. More...
 

Detailed Description

The abstract class that provides polymorphic interfaces for a function.

NOTE: This class is not the base class for a Kokkos function derivation. The user should derive their own function from Moose::Kokkos::FunctionBase.

Definition at line 147 of file KokkosFunction.h.

Constructor & Destructor Documentation

◆ Function() [1/3]

Moose::Kokkos::Function::Function ( )
default

Default constructor.

◆ Function() [2/3]

Moose::Kokkos::Function::Function ( std::shared_ptr< FunctionWrapperHostBase wrapper)

Constructor.

Parameters
wrapperThe host function wrapper

◆ Function() [3/3]

Moose::Kokkos::Function::Function ( const Function function)

Copy constructor for parallel dispatch.

◆ ~Function()

Moose::Kokkos::Function::~Function ( )

Destructor.

Member Function Documentation

◆ average()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::average ( ) const
inline

Definition at line 227 of file KokkosFunction.h.

228  {
229  KOKKOS_ASSERT(_wrapper_device);
230 
231  return _wrapper_device->average();
232  }
KOKKOS_VIRTUAL_FUNCTION Real average() const =0
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.

◆ curl()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Function::curl ( Real  t,
Real3  p 
) const
inline

Definition at line 197 of file KokkosFunction.h.

198  {
199  KOKKOS_ASSERT(_wrapper_device);
200 
201  return _wrapper_device->curl(t, p);
202  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
KOKKOS_VIRTUAL_FUNCTION Real3 curl(Real t, Real3 p) const =0

◆ div()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::div ( Real  t,
Real3  p 
) const
inline

Definition at line 203 of file KokkosFunction.h.

204  {
205  KOKKOS_ASSERT(_wrapper_device);
206 
207  return _wrapper_device->div(t, p);
208  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
KOKKOS_VIRTUAL_FUNCTION Real div(Real t, Real3 p) const =0

◆ gradient()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Function::gradient ( Real  t,
Real3  p 
) const
inline

Definition at line 191 of file KokkosFunction.h.

192  {
193  KOKKOS_ASSERT(_wrapper_device);
194 
195  return _wrapper_device->gradient(t, p);
196  }
KOKKOS_VIRTUAL_FUNCTION Real3 gradient(Real t, Real3 p) const =0
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.

◆ integral()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::integral ( ) const
inline

Definition at line 221 of file KokkosFunction.h.

222  {
223  KOKKOS_ASSERT(_wrapper_device);
224 
225  return _wrapper_device->integral();
226  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
KOKKOS_VIRTUAL_FUNCTION Real integral() const =0

◆ operator bool()

KOKKOS_FUNCTION Moose::Kokkos::Function::operator bool ( ) const
inline

Get whether the function wrapper is valid.

Returns
Whether the function wrapper is valid

Definition at line 172 of file KokkosFunction.h.

173  {
174  KOKKOS_IF_ON_HOST(return static_cast<bool>(_wrapper_host);)
175 
176  return _wrapper_device != nullptr;
177  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
std::shared_ptr< FunctionWrapperHostBase > _wrapper_host
Pointer to the host function wrapper.

◆ timeDerivative()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::timeDerivative ( Real  t,
Real3  p 
) const
inline

Definition at line 209 of file KokkosFunction.h.

210  {
211  KOKKOS_ASSERT(_wrapper_device);
212 
213  return _wrapper_device->timeDerivative(t, p);
214  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
KOKKOS_VIRTUAL_FUNCTION Real timeDerivative(Real t, Real3 p) const =0

◆ timeIntegral()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::timeIntegral ( Real  t1,
Real  t2,
Real3  p 
) const
inline

Definition at line 215 of file KokkosFunction.h.

216  {
217  KOKKOS_ASSERT(_wrapper_device);
218 
219  return _wrapper_device->timeIntegral(t1, t2, p);
220  }
KOKKOS_VIRTUAL_FUNCTION Real timeIntegral(Real t1, Real t2, Real3 p) const =0
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.

◆ value()

KOKKOS_FUNCTION Real Moose::Kokkos::Function::value ( Real  t,
Real3  p 
) const
inline

Definition at line 179 of file KokkosFunction.h.

Referenced by KokkosFunctionAux::computeValue().

180  {
181  KOKKOS_ASSERT(_wrapper_device);
182 
183  return _wrapper_device->value(t, p);
184  }
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.
KOKKOS_VIRTUAL_FUNCTION Real value(Real t, Real3 p) const =0
Virtual shims that calls the corresponding methods of the actual stored function. ...

◆ vectorValue()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Function::vectorValue ( Real  t,
Real3  p 
) const
inline

Definition at line 185 of file KokkosFunction.h.

186  {
187  KOKKOS_ASSERT(_wrapper_device);
188 
189  return _wrapper_device->vectorValue(t, p);
190  }
KOKKOS_VIRTUAL_FUNCTION Real3 vectorValue(Real t, Real3 p) const =0
FunctionWrapperDeviceBase * _wrapper_device
Pointer to the device function wrapper.

Member Data Documentation

◆ _wrapper_device

FunctionWrapperDeviceBase* Moose::Kokkos::Function::_wrapper_device = nullptr
private

Pointer to the device function wrapper.

Definition at line 242 of file KokkosFunction.h.

Referenced by average(), curl(), div(), gradient(), integral(), operator bool(), timeDerivative(), timeIntegral(), value(), and vectorValue().

◆ _wrapper_host

std::shared_ptr<FunctionWrapperHostBase> Moose::Kokkos::Function::_wrapper_host
private

Pointer to the host function wrapper.

Definition at line 238 of file KokkosFunction.h.

Referenced by operator bool().


The documentation for this class was generated from the following file: