https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
 Function (std::shared_ptr< FunctionWrapperHostBase > wrapper)
 Constructor.
 
 Function (const Function &function)
 Copy constructor for parallel dispatch.
 
 ~Function ()
 Destructor.
 
Function & operator= (const Function &function)=default
 Copy assignment operator.
 
KOKKOS_FUNCTION operator bool () const
 Get whether the function wrapper is valid.
 
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.
 
FunctionWrapperDeviceBase * _wrapper_device = nullptr
 Pointer to the device function wrapper.
 

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 232 of file KokkosFunction.h.

233 {
234 KOKKOS_ASSERT(_wrapper_device);
235
236 return _wrapper_device->average();
237 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real average() const
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 202 of file KokkosFunction.h.

203 {
204 KOKKOS_ASSERT(_wrapper_device);
205
206 return _wrapper_device->curl(t, p);
207 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 curl(Real, Real3) const

◆ div()

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

Definition at line 208 of file KokkosFunction.h.

209 {
210 KOKKOS_ASSERT(_wrapper_device);
211
212 return _wrapper_device->div(t, p);
213 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real div(Real, Real3) const

◆ gradient()

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

Definition at line 196 of file KokkosFunction.h.

197 {
198 KOKKOS_ASSERT(_wrapper_device);
199
200 return _wrapper_device->gradient(t, p);
201 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 gradient(Real, Real3) const

◆ integral()

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

Definition at line 226 of file KokkosFunction.h.

227 {
228 KOKKOS_ASSERT(_wrapper_device);
229
230 return _wrapper_device->integral();
231 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real integral() const

◆ 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 177 of file KokkosFunction.h.

178 {
179 KOKKOS_IF_ON_HOST(return static_cast<bool>(_wrapper_host);)
180
181 return _wrapper_device != nullptr;
182 }
std::shared_ptr< FunctionWrapperHostBase > _wrapper_host
Pointer to the host function wrapper.

◆ operator=()

Function & Moose::Kokkos::Function::operator= ( const Function &  function)
default

Copy assignment operator.

◆ timeDerivative()

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

Definition at line 214 of file KokkosFunction.h.

215 {
216 KOKKOS_ASSERT(_wrapper_device);
217
218 return _wrapper_device->timeDerivative(t, p);
219 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real timeDerivative(Real, Real3) const

◆ timeIntegral()

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

Definition at line 220 of file KokkosFunction.h.

221 {
222 KOKKOS_ASSERT(_wrapper_device);
223
224 return _wrapper_device->timeIntegral(t1, t2, p);
225 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real timeIntegral(Real, Real, Real3) const

◆ value()

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

Definition at line 184 of file KokkosFunction.h.

185 {
186 KOKKOS_ASSERT(_wrapper_device);
187
188 return _wrapper_device->value(t, p);
189 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real value(Real, Real3) const
Virtual shims that calls the corresponding methods of the actual stored function.

Referenced by KokkosVectorFunctionDirichletBC::computeQpResidual(), KokkosFunctionAux::computeValue(), and KokkosFunctionDirichletBCTempl< is_ad >::computeValue().

◆ vectorValue()

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

Definition at line 190 of file KokkosFunction.h.

191 {
192 KOKKOS_ASSERT(_wrapper_device);
193
194 return _wrapper_device->vectorValue(t, p);
195 }
KOKKOS_FUNCTION KOKKOS_VIRTUAL Real3 vectorValue(Real, Real3) const

Referenced by KokkosVectorFunctionDirichletBC::computeQpResidual().

Member Data Documentation

◆ _wrapper_device

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

Pointer to the device function wrapper.

Definition at line 247 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 243 of file KokkosFunction.h.

Referenced by operator bool().


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