https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Moose::Kokkos::SideReducer Class Reference

#include <KokkosSideReducer.h>

Inheritance diagram for Moose::Kokkos::SideReducer:
[legend]

Public Types

enum  TEST_TYPE { ALL, ANY }
 A flag changing the behavior of hasBoundary. More...
 

Public Member Functions

 SideReducer (const MooseObject *moose_object)
 
 SideReducer (const SideReducer &object)
 Copy constructor for parallel dispatch. More...
 
virtual ThreadID numReducerThreads () const override
 Get the number of threads. More...
 
template<typename Derived >
KOKKOS_FUNCTION void operator() (ReducerLoop, const ThreadID tid, const Derived &reducer, Real *result) const
 The parallel computation entry function called by Kokkos. More...
 
KOKKOS_FUNCTION const MeshkokkosMesh () const
 Get the const reference of the Kokkos mesh. More...
 
KOKKOS_FUNCTION const AssemblykokkosAssembly () const
 Get the const reference of the Kokkos assembly. More...
 
KOKKOS_FUNCTION const Array< System > & kokkosSystems () const
 Get the const reference of the Kokkos systems. More...
 
Array< System > & kokkosSystems ()
 Get the writeable host reference of the Kokkos systems. More...
 
KOKKOS_FUNCTION const SystemkokkosSystem (unsigned int sys) const
 Get the const reference of a Kokkos system. More...
 
SystemkokkosSystem (unsigned int sys)
 Get the writeable reference of a Kokkos system. More...
 
virtual const std::set< BoundaryID > & boundaryIDs () const
 Return the boundary IDs for this object. More...
 
const std::vector< BoundaryName > & boundaryNames () const
 Return the boundary names for this object. More...
 
unsigned int numBoundaryIDs () const
 Return the number of boundaries for this object. More...
 
bool hasBoundary (const BoundaryName &name) const
 Test if the supplied boundary name is valid for this object. More...
 
bool hasBoundary (const std::vector< BoundaryName > &names) const
 Test if the supplied vector of boundary names are valid for this object. More...
 
bool hasBoundary (const BoundaryID &id) const
 Test if the supplied boundary ids are valid for this object. More...
 
bool hasBoundary (const std::vector< BoundaryID > &ids, TEST_TYPE type=ALL) const
 Test if the supplied vector boundary ids are valid for this object. More...
 
bool hasBoundary (const std::set< BoundaryID > &ids, TEST_TYPE type=ALL) const
 Test if the supplied set of boundary ids are valid for this object. More...
 
bool isBoundarySubset (const std::set< BoundaryID > &ids) const
 Test if the class boundary ids are a subset of the supplied objects. More...
 
bool isBoundarySubset (const std::vector< BoundaryID > &ids) const
 
template<typename T , bool is_ad = false>
bool hasBoundaryMaterialProperty (const std::string &prop_name) const
 Check if a material property is valid for all boundaries of this object. More...
 
virtual bool boundaryRestricted () const
 Returns true if this object has been restricted to a boundary. More...
 
const std::set< BoundaryID > & meshBoundaryIDs () const
 Returns the set of all boundary ids for the entire mesh. More...
 
virtual bool checkVariableBoundaryIntegrity () const
 Whether integrity/coverage checking should be conducted for moose variables used in this object. More...
 
template<typename Derived >
KOKKOS_FUNCTION void reduce (Datum &, Real *) const
 Default methods to prevent compile errors even when these methods were not defined in the derived class. More...
 
template<typename Derived >
KOKKOS_FUNCTION void join (Real *, const Real *) const
 
template<typename Derived >
KOKKOS_FUNCTION void init (Real *) const
 

Static Public Member Functions

static InputParameters validParams ()
 
template<typename Derived >
static auto defaultReduce ()
 Function used to check if users have overriden the hook method. More...
 
static bool restricted (const std::set< BoundaryID > &ids)
 Helper for determining if the object is boundary restricted. More...
 

Protected Member Functions

virtual void computeReducer ()
 Dispatch reduction operation. More...
 
void allocateReductionBuffer (const unsigned int size)
 Allocate reduction buffer. More...
 
bool hasBoundaryMaterialPropertyHelper (const std::string &prop_name) const
 A helper method to avoid circular #include problems. More...
 
KOKKOS_FUNCTION dof_id_type numKokkosBoundaryNodes () const
 Get the number of nodes this Kokkos object is operating on. More...
 
KOKKOS_FUNCTION dof_id_type numKokkosBoundarySides () const
 Get the number of sides this Kokkos object is operating on. More...
 
KOKKOS_FUNCTION ContiguousNodeID kokkosBoundaryNodeID (Moose::Kokkos::ThreadID tid) const
 Get the contiguous node ID this Kokkos thread is operating on. More...
 
KOKKOS_FUNCTION auto kokkosBoundaryElementSideID (Moose::Kokkos::ThreadID tid) const
 Get the contiguous element ID - side index pair this Kokkos thread is operating on. More...
 

Protected Attributes

const MooseObject_reducer_object
 MOOSE object. More...
 
std::unique_ptr< DispatcherBase_reducer_dispatcher
 Kokkos functor dispatcher. More...
 
::Kokkos::View< Real *, ::Kokkos::HostSpace > _reduction_buffer
 Reduction buffer. More...
 

Detailed Description

Definition at line 19 of file KokkosSideReducer.h.

Member Enumeration Documentation

◆ TEST_TYPE

A flag changing the behavior of hasBoundary.

Enumerator
ALL 
ANY 

Definition at line 33 of file BoundaryRestrictable.h.

Constructor & Destructor Documentation

◆ SideReducer() [1/2]

Moose::Kokkos::SideReducer::SideReducer ( const MooseObject moose_object)

◆ SideReducer() [2/2]

Moose::Kokkos::SideReducer::SideReducer ( const SideReducer object)

Copy constructor for parallel dispatch.

Member Function Documentation

◆ allocateReductionBuffer()

void Moose::Kokkos::ReducerBase::allocateReductionBuffer ( const unsigned int  size)
inlineprotectedinherited

Allocate reduction buffer.

Definition at line 88 of file KokkosReducerBase.h.

89  {
90  ::Kokkos::realloc(_reduction_buffer, size);
91  }
::Kokkos::View< Real *, ::Kokkos::HostSpace > _reduction_buffer
Reduction buffer.

◆ boundaryIDs()

const std::set< BoundaryID > & BoundaryRestrictable::boundaryIDs ( ) const
virtualinherited

Return the boundary IDs for this object.

Returns
A set of all boundary ids for which the object is restricted

Definition at line 198 of file BoundaryRestrictable.C.

Referenced by MaterialBase::getGenericZeroMaterialPropertyByName(), BoundaryRestrictable::hasBoundaryMaterialPropertyHelper(), SidesetInfoVectorPostprocessor::initialize(), SideFVFluxBCIntegral::initialSetup(), BoundaryLinearFVFluxIntegral::initialSetup(), InterfaceQpUserObjectBase::initialSetup(), and MaterialBase::registerPropName().

199 {
200  return _bnd_ids;
201 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ boundaryNames()

const std::vector< BoundaryName > & BoundaryRestrictable::boundaryNames ( ) const
inherited

Return the boundary names for this object.

Returns
A set of all boundary names for which the object is restricted

Definition at line 204 of file BoundaryRestrictable.C.

Referenced by MaterialOutputAction::getParams(), NearestNodeDistanceAux::NearestNodeDistanceAux(), and NearestNodeValueAux::NearestNodeValueAux().

205 {
206  return _boundary_names;
207 }
std::vector< BoundaryName > _boundary_names
Vector the the boundary names.

◆ boundaryRestricted()

bool BoundaryRestrictable::boundaryRestricted ( ) const
virtualinherited

Returns true if this object has been restricted to a boundary.

See also
MooseObject

Definition at line 216 of file BoundaryRestrictable.C.

Referenced by Moose::Kokkos::Material::checkMaterialProperty(), Material::checkMaterialProperty(), MaterialOutputAction::getParams(), DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::haveMaterialProperty(), and NodePositions::initialize().

217 {
219 }
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ checkVariableBoundaryIntegrity()

virtual bool BoundaryRestrictable::checkVariableBoundaryIntegrity ( ) const
inlinevirtualinherited

Whether integrity/coverage checking should be conducted for moose variables used in this object.

This should return true if variables are only evaluated locally, e.g. on the current node or element. This should return false if evaluation of this object entails non-local variable evaluations

Definition at line 190 of file BoundaryRestrictable.h.

190 { return true; }

◆ computeReducer()

virtual void Moose::Kokkos::ReducerBase::computeReducer ( )
protectedvirtualinherited

Dispatch reduction operation.

◆ defaultReduce()

template<typename Derived >
static auto Moose::Kokkos::ReducerBase::defaultReduce ( )
inlinestaticinherited

Function used to check if users have overriden the hook method.

Returns
The function pointer of the default hook method

Definition at line 70 of file KokkosReducerBase.h.

71  {
72  return &ReducerBase::reduce<Derived>;
73  }

◆ hasBoundary() [1/5]

bool BoundaryRestrictable::hasBoundary ( const BoundaryName &  name) const
inherited

Test if the supplied boundary name is valid for this object.

Parameters
nameA BoundaryName to check
Returns
True if the given id is valid for this object

Definition at line 228 of file BoundaryRestrictable.C.

Referenced by BoundaryRestrictable::hasBoundary(), BoundaryRestrictable::hasBoundaryMaterialPropertyHelper(), NodePositions::initialize(), and AuxKernelBase::initialSetup().

229 {
230  // Create a vector and utilize the getBoundaryIDs function, which
231  // handles the ANY_BOUNDARY_ID (getBoundaryID does not)
232  return hasBoundary(_bnd_mesh->getBoundaryIDs({name}));
233 }
MooseMesh * _bnd_mesh
Point to mesh.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...

◆ hasBoundary() [2/5]

bool BoundaryRestrictable::hasBoundary ( const std::vector< BoundaryName > &  names) const
inherited

Test if the supplied vector of boundary names are valid for this object.

Parameters
namesA vector of BoundaryNames to check
Returns
True if the given ids are valid for this object

Definition at line 236 of file BoundaryRestrictable.C.

237 {
238  return hasBoundary(_bnd_mesh->getBoundaryIDs(names));
239 }
MooseMesh * _bnd_mesh
Point to mesh.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...

◆ hasBoundary() [3/5]

bool BoundaryRestrictable::hasBoundary ( const BoundaryID id) const
inherited

Test if the supplied boundary ids are valid for this object.

Parameters
idA BoundaryID to check
Returns
True if the given id is valid for this object

Definition at line 242 of file BoundaryRestrictable.C.

243 {
244  if (_bnd_ids.empty() || _bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
245  return true;
246  else
247  return _bnd_ids.find(id) != _bnd_ids.end();
248 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21

◆ hasBoundary() [4/5]

bool BoundaryRestrictable::hasBoundary ( const std::vector< BoundaryID > &  ids,
TEST_TYPE  type = ALL 
) const
inherited

Test if the supplied vector boundary ids are valid for this object.

Parameters
idsA vector of BoundaryIDs ids to check
typeA flag for the type of matching to perform: ALL requires that all supplied ids must match those of the object; ANY requires that any one of the supplied ids must match those of the object
Returns
True if the all of the given ids are found within the ids for this object

Definition at line 251 of file BoundaryRestrictable.C.

252 {
253  std::set<BoundaryID> ids_set(ids.begin(), ids.end());
254  return hasBoundary(ids_set, type);
255 }
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.

◆ hasBoundary() [5/5]

bool BoundaryRestrictable::hasBoundary ( const std::set< BoundaryID > &  ids,
TEST_TYPE  type = ALL 
) const
inherited

Test if the supplied set of boundary ids are valid for this object.

Parameters
idsA std::set of BoundaryIDs to check
typeA flag for the type of matching to perform: ALL requires that all supplied ids must match those of the object; ANY requires that any one of the supplied ids must match those of the object
Returns
True if the all of the given ids are found within the ids for this object
See also
isSubset

Definition at line 258 of file BoundaryRestrictable.C.

259 {
260  // An empty input is assumed to be ANY_BOUNDARY_ID
261  if (ids.empty() || ids.find(Moose::ANY_BOUNDARY_ID) != ids.end())
262  return true;
263 
264  // All supplied IDs must match those of the object
265  else if (type == ALL)
266  {
267  if (_bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
268  return true;
269  else
270  return std::includes(_bnd_ids.begin(), _bnd_ids.end(), ids.begin(), ids.end());
271  }
272  // Any of the supplied IDs must match those of the object
273  else
274  {
275  // Loop through the supplied ids
276  for (const auto & id : ids)
277  {
278  // Test the current supplied id
279  bool test = hasBoundary(id);
280 
281  // If the id exists in the stored ids, then return true, otherwise
282  if (test)
283  return true;
284  }
285  return false;
286  }
287 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21

◆ hasBoundaryMaterialProperty()

template<typename T , bool is_ad>
bool BoundaryRestrictable::hasBoundaryMaterialProperty ( const std::string &  prop_name) const
inherited

Check if a material property is valid for all boundaries of this object.

This method returns true if the supplied property name has been declared in a Material object on the boundary ids for this object.

Template Parameters
TThe type of material property
Parameters
prop_namethe name of the property to query
Returns
true if the property exists for all boundary ids of the object, otherwise false

Definition at line 295 of file BoundaryRestrictable.h.

296 {
297  // If you get here the supplied property is defined on all boundaries, but is still subject
298  // existence in the MateialData class
299  return hasBoundaryMaterialPropertyHelper(prop_name) &&
300  _bnd_material_data.haveGenericProperty<T, is_ad>(prop_name);
301 }
bool haveGenericProperty(const std::string &prop_name) const
Definition: MaterialData.h:370
bool hasBoundaryMaterialPropertyHelper(const std::string &prop_name) const
A helper method to avoid circular #include problems.
const MaterialData & _bnd_material_data
Pointer to MaterialData for boundary (.

◆ hasBoundaryMaterialPropertyHelper()

bool BoundaryRestrictable::hasBoundaryMaterialPropertyHelper ( const std::string &  prop_name) const
protectedinherited

A helper method to avoid circular #include problems.

See also
hasBoundaryMaterialProperty

Definition at line 319 of file BoundaryRestrictable.C.

Referenced by BoundaryRestrictable::hasBoundaryMaterialProperty().

320 {
321  // Reference to MaterialWarehouse for testing and retrieving boundary ids
323 
324  // Complete set of BoundaryIDs that this object is defined
325  const std::set<BoundaryID> & ids =
327 
328  // Loop over each BoundaryID for this object
329  for (const auto & id : ids)
330  {
331  // Storage of material properties that have been DECLARED on this BoundaryID
332  std::set<std::string> declared_props;
333 
334  // If boundary materials exist, populated the set of properties that were declared
335  if (warehouse.hasActiveBoundaryObjects(id))
336  {
337  const std::vector<std::shared_ptr<MaterialBase>> & mats =
338  warehouse.getActiveBoundaryObjects(id);
339  for (const auto & mat : mats)
340  {
341  const std::set<std::string> & mat_props = mat->getSuppliedItems();
342  declared_props.insert(mat_props.begin(), mat_props.end());
343  }
344  }
345 
346  // If the supplied property is not in the list of properties on the current id, return false
347  if (declared_props.find(prop_name) == declared_props.end())
348  return false;
349  }
350 
351  // If you get here the supplied property is defined on all boundaries
352  return true;
353 }
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
const MaterialWarehouse & getMaterialWarehouse() const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::set< BoundaryID > & meshBoundaryIDs() const
Returns the set of all boundary ids for the entire mesh.
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasBoundary(const BoundaryName &name) const
Test if the supplied boundary name is valid for this object.
FEProblemBase * _bnd_feproblem
Pointer to FEProblemBase.
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21

◆ init()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::init ( Real ) const
inlineinherited

Definition at line 58 of file KokkosReducerBase.h.

59  {
60  ::Kokkos::abort("Default init() should never be called. Make sure you properly redefined this "
61  "method in your class without typos.");
62  }

◆ isBoundarySubset() [1/2]

bool BoundaryRestrictable::isBoundarySubset ( const std::set< BoundaryID > &  ids) const
inherited

Test if the class boundary ids are a subset of the supplied objects.

Parameters
idsA std::set of boundaries to check
Returns
True if all of the boundary ids for this class are found within the given ids (opposite of hasBoundary)
See also
hasBoundary

Definition at line 290 of file BoundaryRestrictable.C.

Referenced by BoundaryRestrictable::isBoundarySubset().

291 {
292  // An empty input is assumed to be ANY_BOUNDARY_ID
293  if (ids.empty() || ids.find(Moose::ANY_BOUNDARY_ID) != ids.end())
294  return true;
295 
296  if (_bnd_ids.find(Moose::ANY_BOUNDARY_ID) != _bnd_ids.end())
297  return std::includes(ids.begin(),
298  ids.end(),
299  _bnd_mesh->meshBoundaryIds().begin(),
300  _bnd_mesh->meshBoundaryIds().end());
301  else
302  return std::includes(ids.begin(), ids.end(), _bnd_ids.begin(), _bnd_ids.end());
303 }
MooseMesh * _bnd_mesh
Point to mesh.
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh...
Definition: MooseMesh.C:3304
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21

◆ isBoundarySubset() [2/2]

bool BoundaryRestrictable::isBoundarySubset ( const std::vector< BoundaryID > &  ids) const
inherited

Definition at line 306 of file BoundaryRestrictable.C.

307 {
308  std::set<BoundaryID> ids_set(ids.begin(), ids.end());
309  return isBoundarySubset(ids_set);
310 }
bool isBoundarySubset(const std::set< BoundaryID > &ids) const
Test if the class boundary ids are a subset of the supplied objects.

◆ join()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::join ( Real ,
const Real  
) const
inlineinherited

Definition at line 52 of file KokkosReducerBase.h.

53  {
54  ::Kokkos::abort("Default join() should never be called. Make sure you properly redefined this "
55  "method in your class without typos.");
56  }

◆ kokkosAssembly()

KOKKOS_FUNCTION const Assembly& Moose::Kokkos::AssemblyHolder::kokkosAssembly ( ) const
inlineinherited

Get the const reference of the Kokkos assembly.

Returns
The const reference of the Kokkos assembly depending on the architecture this function is being called on

Definition at line 569 of file KokkosAssembly.h.

Referenced by Moose::Kokkos::System::getVectorQpADGrad(), Moose::Kokkos::System::getVectorQpADGradFace(), Moose::Kokkos::System::getVectorQpADValue(), Moose::Kokkos::System::getVectorQpADValueFace(), Moose::Kokkos::System::getVectorQpGradFace(), Moose::Kokkos::System::getVectorQpValueFace(), operator()(), Moose::Kokkos::ElementReducer::operator()(), Moose::Kokkos::NodalReducer::operator()(), Moose::Kokkos::NodalUserObject::operator()(), Moose::Kokkos::SideUserObject::operator()(), Moose::Kokkos::ElementUserObject::operator()(), Moose::Kokkos::ADNodalBC::operator()(), Moose::Kokkos::ADKernel::operator()(), Moose::Kokkos::ADIntegratedBC::operator()(), Moose::Kokkos::AuxKernel::operator()(), Moose::Kokkos::Material::operator()(), Moose::Kokkos::NodalBC::operator()(), Moose::Kokkos::NodalKernel::operator()(), Moose::Kokkos::IntegratedBC::operator()(), and Moose::Kokkos::Kernel::operator()().

570  {
571  KOKKOS_IF_ON_HOST(return _assembly_host;)
572 
573  return _assembly_device;
574  }
const Assembly _assembly_device
Device copy of the Kokkos assembly.
const Assembly & _assembly_host
Host reference of the Kokkos assembly.

◆ kokkosBoundaryElementSideID()

KOKKOS_FUNCTION auto BoundaryRestrictable::kokkosBoundaryElementSideID ( Moose::Kokkos::ThreadID  tid) const
inlineprotectedinherited

Get the contiguous element ID - side index pair this Kokkos thread is operating on.

Parameters
tidThe thread ID
Returns
The contiguous element ID - side index pair

Definition at line 273 of file BoundaryRestrictable.h.

Referenced by operator()(), Moose::Kokkos::SideUserObject::operator()(), Moose::Kokkos::ADIntegratedBC::operator()(), and Moose::Kokkos::IntegratedBC::operator()().

274  {
275  return _kokkos_element_side_ids[tid];
276  }
Moose::Kokkos::Array< Moose::Kokkos::Pair< ContiguousElementID, unsigned int > > _kokkos_element_side_ids
List of contiguous element ID - side index pairs this Kokkos object is operating on.

◆ kokkosBoundaryNodeID()

KOKKOS_FUNCTION ContiguousNodeID BoundaryRestrictable::kokkosBoundaryNodeID ( Moose::Kokkos::ThreadID  tid) const
inlineprotectedinherited

Get the contiguous node ID this Kokkos thread is operating on.

Parameters
tidThe thread ID
Returns
The contiguous node ID

Definition at line 264 of file BoundaryRestrictable.h.

Referenced by Moose::Kokkos::NodalReducer::operator()(), Moose::Kokkos::NodalUserObject::operator()(), Moose::Kokkos::ADNodalBC::operator()(), Moose::Kokkos::AuxKernel::operator()(), Moose::Kokkos::NodalBC::operator()(), and Moose::Kokkos::NodalKernel::operator()().

265  {
266  return _kokkos_node_ids[tid];
267  }
Moose::Kokkos::Array< ContiguousNodeID > _kokkos_node_ids
List of contiguous node IDs this Kokkos object is operating on.

◆ kokkosMesh()

KOKKOS_FUNCTION const Mesh& Moose::Kokkos::MeshHolder::kokkosMesh ( ) const
inlineinherited

Get the const reference of the Kokkos mesh.

Returns
The const reference of the Kokkos mesh depending on the architecture this function is being called on

Definition at line 452 of file KokkosMesh.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap(), Moose::Kokkos::Kernel::operator()(), Moose::Kokkos::IntegratedBC::operator()(), Moose::Kokkos::Datum::q_point(), and KokkosBoundNodalKernel::skipOnBoundary().

453  {
454  KOKKOS_IF_ON_HOST(
456  "kokkosMesh() was called too early. Kokkos mesh is available after problem "
457  "initialization. Override initialSetup() if you need to setup your object data "
458  "using the Kokkos mesh.");
459 
460  return _mesh_host;)
461 
462  return _mesh_device;
463  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool initialized() const
Get whether the mesh was initialized.
Definition: KokkosMesh.h:68
const Mesh _mesh_device
Device copy of the Kokkos mesh.
Definition: KokkosMesh.h:474
const Mesh & _mesh_host
Host reference of the Kokkos mesh.
Definition: KokkosMesh.h:470

◆ kokkosSystem() [1/2]

KOKKOS_FUNCTION const System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys) const
inlineinherited

◆ kokkosSystem() [2/2]

System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys)
inlineinherited

Get the writeable reference of a Kokkos system.

Parameters
sysThe system number
Returns
The writeable host reference of the Kokkos system

Definition at line 803 of file KokkosSystem.h.

803 { return _systems_host[sys]; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:810

◆ kokkosSystems() [1/2]

KOKKOS_FUNCTION const Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( ) const
inlineinherited

◆ kokkosSystems() [2/2]

Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( )
inlineinherited

Get the writeable host reference of the Kokkos systems.

Returns
The writeable host reference of the Kokkos systems

Definition at line 785 of file KokkosSystem.h.

785 { return _systems_host; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:810

◆ meshBoundaryIDs()

const std::set< BoundaryID > & BoundaryRestrictable::meshBoundaryIDs ( ) const
inherited

Returns the set of all boundary ids for the entire mesh.

Returns
A const reference the the boundary ids for the entire mesh

Definition at line 313 of file BoundaryRestrictable.C.

Referenced by BoundaryRestrictable::hasBoundaryMaterialPropertyHelper().

314 {
315  return _bnd_mesh->getBoundaryIDs();
316 }
MooseMesh * _bnd_mesh
Point to mesh.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...

◆ numBoundaryIDs()

unsigned int BoundaryRestrictable::numBoundaryIDs ( ) const
inherited

Return the number of boundaries for this object.

Returns
The number of boundary ids

Definition at line 210 of file BoundaryRestrictable.C.

Referenced by SidesetInfoVectorPostprocessor::initialize().

211 {
212  return (unsigned int)_bnd_ids.size();
213 }
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.

◆ numKokkosBoundaryNodes()

KOKKOS_FUNCTION dof_id_type BoundaryRestrictable::numKokkosBoundaryNodes ( ) const
inlineprotectedinherited

Get the number of nodes this Kokkos object is operating on.

Returns
The number of nodes local to this process

Definition at line 250 of file BoundaryRestrictable.h.

Referenced by Moose::Kokkos::NodalReducer::numReducerThreads(), and Moose::Kokkos::NodalUserObject::numUserObjectThreads().

250 { return _kokkos_node_ids.size(); }
KOKKOS_FUNCTION index_type size() const
Get the total array size.
Definition: KokkosArray.h:205
Moose::Kokkos::Array< ContiguousNodeID > _kokkos_node_ids
List of contiguous node IDs this Kokkos object is operating on.

◆ numKokkosBoundarySides()

KOKKOS_FUNCTION dof_id_type BoundaryRestrictable::numKokkosBoundarySides ( ) const
inlineprotectedinherited

Get the number of sides this Kokkos object is operating on.

Returns
The number of sides local to this process

Definition at line 255 of file BoundaryRestrictable.h.

Referenced by numReducerThreads(), and Moose::Kokkos::SideUserObject::numUserObjectThreads().

256  {
258  }
Moose::Kokkos::Array< Moose::Kokkos::Pair< ContiguousElementID, unsigned int > > _kokkos_element_side_ids
List of contiguous element ID - side index pairs this Kokkos object is operating on.
KOKKOS_FUNCTION index_type size() const
Get the total array size.
Definition: KokkosArray.h:205

◆ numReducerThreads()

virtual ThreadID Moose::Kokkos::SideReducer::numReducerThreads ( ) const
inlineoverridevirtual

Get the number of threads.

Implements Moose::Kokkos::ReducerBase.

Definition at line 31 of file KokkosSideReducer.h.

31 { return numKokkosBoundarySides(); }
KOKKOS_FUNCTION dof_id_type numKokkosBoundarySides() const
Get the number of sides this Kokkos object is operating on.

◆ operator()()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::SideReducer::operator() ( ReducerLoop  ,
const ThreadID  tid,
const Derived &  reducer,
Real result 
) const

The parallel computation entry function called by Kokkos.

Definition at line 43 of file KokkosSideReducer.h.

47 {
48  auto [elem, side] = kokkosBoundaryElementSideID(tid);
49 
50  Datum datum(elem, side, kokkosAssembly(), kokkosSystems());
51 
52  reducer.template reduce<Derived>(datum, result);
53 }
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object...
Definition: KokkosDatum.h:23
KOKKOS_FUNCTION const Assembly & kokkosAssembly() const
Get the const reference of the Kokkos assembly.
KOKKOS_FUNCTION auto kokkosBoundaryElementSideID(Moose::Kokkos::ThreadID tid) const
Get the contiguous element ID - side index pair this Kokkos thread is operating on.
KOKKOS_FUNCTION const Array< System > & kokkosSystems() const
Get the const reference of the Kokkos systems.
Definition: KokkosSystem.h:775

◆ reduce()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::reduce ( Datum ,
Real  
) const
inlineinherited

Default methods to prevent compile errors even when these methods were not defined in the derived class.

Definition at line 46 of file KokkosReducerBase.h.

47  {
48  ::Kokkos::abort("Default reduce() should never be called. Make sure you properly redefined "
49  "this method in your class without typos.");
50  }

◆ restricted()

bool BoundaryRestrictable::restricted ( const std::set< BoundaryID > &  ids)
staticinherited

Helper for determining if the object is boundary restricted.

This is needed for the MaterialPropertyInterface.

Definition at line 222 of file BoundaryRestrictable.C.

Referenced by moose::internal::boundaryRestricted(), and BoundaryRestrictable::boundaryRestricted().

223 {
224  return ids.find(Moose::ANY_BOUNDARY_ID) == ids.end();
225 }
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21

◆ validParams()

static InputParameters Moose::Kokkos::SideReducer::validParams ( )
static

Member Data Documentation

◆ _reducer_dispatcher

std::unique_ptr<DispatcherBase> Moose::Kokkos::ReducerBase::_reducer_dispatcher
protectedinherited

Kokkos functor dispatcher.

Definition at line 100 of file KokkosReducerBase.h.

◆ _reducer_object

const MooseObject* Moose::Kokkos::ReducerBase::_reducer_object
protectedinherited

MOOSE object.

Definition at line 96 of file KokkosReducerBase.h.

◆ _reduction_buffer

::Kokkos::View<Real *, ::Kokkos::HostSpace> Moose::Kokkos::ReducerBase::_reduction_buffer
protectedinherited

Reduction buffer.

Definition at line 104 of file KokkosReducerBase.h.

Referenced by Moose::Kokkos::ReducerBase::allocateReductionBuffer().


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