https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
Moose::Kokkos::FunctorRegistry Class Reference

#include <KokkosFunctorRegistry.h>

Public Member Functions

 FunctorRegistry ()=default
 
 FunctorRegistry (FunctorRegistry const &)=delete
 
FunctorRegistryoperator= (FunctorRegistry const &)=delete
 
 FunctorRegistry (FunctorRegistry &&)=delete
 
FunctorRegistryoperator= (FunctorRegistry &&)=delete
 

Static Public Member Functions

template<typename Object >
static char addFunctor (const std::string &name)
 Register a functor.
 
template<typename Object >
static char addFunction (const std::string &name)
 Register a function.
 
static std::unique_ptr< FunctorWrapperHostBasebuildFunctor (const void *object, const std::string &name)
 Build and get a host wrapper of a functor.
 
static std::unique_ptr< FunctionWrapperHostBasebuildFunction (const void *object, const std::string &name)
 Build and get a host wrapper of a function.
 

Static Private Member Functions

static FunctorRegistrygetRegistry ()
 Get the registry singleton.
 

Private Attributes

std::map< std::string, std::unique_ptr< FunctorRegistryEntryBase > > _functors
 Map containing the host wrapper shells of functors with the key being the registered object type name.
 
std::map< std::string, std::unique_ptr< FunctionRegistryEntryBase > > _functions
 Map containing the host wrapper shells of functions with the key being the registered object type name.
 

Detailed Description

Definition at line 60 of file KokkosFunctorRegistry.h.

Constructor & Destructor Documentation

◆ FunctorRegistry() [1/3]

Moose::Kokkos::FunctorRegistry::FunctorRegistry ( )
default

◆ FunctorRegistry() [2/3]

Moose::Kokkos::FunctorRegistry::FunctorRegistry ( FunctorRegistry const &  )
delete

◆ FunctorRegistry() [3/3]

Moose::Kokkos::FunctorRegistry::FunctorRegistry ( FunctorRegistry &&  )
delete

Member Function Documentation

◆ addFunction()

template<typename Object >
static char Moose::Kokkos::FunctorRegistry::addFunction ( const std::string &  name)
inlinestatic

Register a function.

Template Parameters
ObjectThe function class type
Parameters
nameThe registered function type name

Definition at line 90 of file KokkosFunctorRegistry.h.

91 {
92 getRegistry()._functions[name] = std::make_unique<FunctionRegistryEntry<Object>>();
93
94 return 0;
95 }
static FunctorRegistry & getRegistry()
Get the registry singleton.
std::map< std::string, std::unique_ptr< FunctionRegistryEntryBase > > _functions
Map containing the host wrapper shells of functions with the key being the registered object type nam...
std::string name(const ElemQuality q)

◆ addFunctor()

template<typename Object >
static char Moose::Kokkos::FunctorRegistry::addFunctor ( const std::string &  name)
inlinestatic

Register a functor.

Template Parameters
ObjectThe functor class type
Parameters
nameThe registered functor type name

Definition at line 77 of file KokkosFunctorRegistry.h.

78 {
79 getRegistry()._functors[name] = std::make_unique<FunctorRegistryEntry<Object>>();
80
81 return 0;
82 }
std::map< std::string, std::unique_ptr< FunctorRegistryEntryBase > > _functors
Map containing the host wrapper shells of functors with the key being the registered object type name...

◆ buildFunction()

static std::unique_ptr< FunctionWrapperHostBase > Moose::Kokkos::FunctorRegistry::buildFunction ( const void *  object,
const std::string &  name 
)
inlinestatic

Build and get a host wrapper of a function.

Parameters
objectThe pointer to the function
nameThe registered function type name
Returns
The host wrapper

Definition at line 121 of file KokkosFunctorRegistry.h.

123 {
124 auto it = getRegistry()._functions.find(name);
125 if (it == getRegistry()._functions.end())
126 mooseError("Kokkos function not registered for type '",
127 name,
128 "'. Double check that you used Kokkos-specific registration macro.");
129
130 return it->second->build(object);
131 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311

◆ buildFunctor()

static std::unique_ptr< FunctorWrapperHostBase > Moose::Kokkos::FunctorRegistry::buildFunctor ( const void *  object,
const std::string &  name 
)
inlinestatic

Build and get a host wrapper of a functor.

Parameters
objectThe pointer to the functor
nameThe registered functor type name
Returns
The host wrapper

Definition at line 103 of file KokkosFunctorRegistry.h.

105 {
106 auto it = getRegistry()._functors.find(name);
107 if (it == getRegistry()._functors.end())
108 mooseError("Kokkos functor not registered for type '",
109 name,
110 "'. Double check that you used Kokkos-specific registration macro.");
111
112 return it->second->build(object);
113 }

◆ getRegistry()

static FunctorRegistry & Moose::Kokkos::FunctorRegistry::getRegistry ( )
staticprivate

Get the registry singleton.

Returns
The registry singleton

Referenced by addFunction(), addFunctor(), buildFunction(), and buildFunctor().

◆ operator=() [1/2]

FunctorRegistry & Moose::Kokkos::FunctorRegistry::operator= ( FunctorRegistry &&  )
delete

◆ operator=() [2/2]

FunctorRegistry & Moose::Kokkos::FunctorRegistry::operator= ( FunctorRegistry const &  )
delete

Member Data Documentation

◆ _functions

std::map<std::string, std::unique_ptr<FunctionRegistryEntryBase> > Moose::Kokkos::FunctorRegistry::_functions
private

Map containing the host wrapper shells of functions with the key being the registered object type name.

Definition at line 149 of file KokkosFunctorRegistry.h.

Referenced by addFunction(), and buildFunction().

◆ _functors

std::map<std::string, std::unique_ptr<FunctorRegistryEntryBase> > Moose::Kokkos::FunctorRegistry::_functors
private

Map containing the host wrapper shells of functors with the key being the registered object type name.

Definition at line 144 of file KokkosFunctorRegistry.h.

Referenced by addFunctor(), and buildFunctor().


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