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

#include <KokkosNodalReducer.h>

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

Public Types

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

Public Member Functions

 NodalReducer (const MooseObject *object)
 
 NodalReducer (const NodalReducer &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...
 
const std::vector< SubdomainName > & blocks () const
 Return the block names for this object. More...
 
unsigned int numBlocks () const
 Return the number of blocks for this object. More...
 
virtual const std::set< SubdomainID > & blockIDs () const
 Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids. More...
 
unsigned int blocksMaxDimension () const
 Return the largest mesh dimension of the elements in the blocks for this object. More...
 
bool hasBlocks (const SubdomainName &name) const
 Test if the supplied block name is valid for this object. More...
 
bool hasBlocks (const std::vector< SubdomainName > &names) const
 Test if the supplied vector of block names are valid for this object. More...
 
bool hasBlocks (const std::set< SubdomainName > &names) const
 Test if the supplied set of block names are valid for this object. More...
 
bool hasBlocks (SubdomainID id) const
 Test if the supplied block ids are valid for this object. More...
 
bool hasBlocks (const std::vector< SubdomainID > &ids) const
 Test if the supplied vector block ids are valid for this object. More...
 
bool hasBlocks (const std::set< SubdomainID > &ids) const
 Test if the supplied set of block ids are valid for this object. More...
 
bool isBlockSubset (const std::set< SubdomainID > &ids) const
 Test if the class block ids are a subset of the supplied objects. More...
 
bool isBlockSubset (const std::vector< SubdomainID > &ids) const
 Test if the class block ids are a subset of the supplied objects. More...
 
template<typename T , bool is_ad = false>
bool hasBlockMaterialProperty (const std::string &prop_name)
 Check if a material property is valid for all blocks of this object. More...
 
const std::set< SubdomainID > & meshBlockIDs () const
 Return all of the SubdomainIDs for the mesh. More...
 
virtual bool blockRestricted () const
 Returns true if this object has been restricted to a block. More...
 
virtual void checkVariable (const MooseVariableFieldBase &variable) const
 Helper for checking that the ids for this object are in agreement with the variables on the supplied variable. 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...
 
virtual bool hasBlockMaterialPropertyHelper (const std::string &prop_name)
 A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty. More...
 
void initializeBlockRestrictable (const MooseObject *moose_object)
 An initialization routine needed for dual constructors. More...
 
void initializeKokkosBlockRestrictable ()
 
Moose::CoordinateSystemType getBlockCoordSystem ()
 Check if the blocks this object operates on all have the same coordinate system, and if so return it. More...
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockElements () const
 Get the number of elements this Kokkos object is operating on. More...
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockNodes () const
 Get the number of nodes this Kokkos object is operating on. More...
 
KOKKOS_FUNCTION dof_id_type numKokkosBlockSides () const
 Get the number of sides this Kokkos object is operating on. More...
 
KOKKOS_FUNCTION ContiguousElementID kokkosBlockElementID (Moose::Kokkos::ThreadID tid) const
 Get the contiguous element ID this Kokkos thread is operating on. More...
 
KOKKOS_FUNCTION ContiguousElementID kokkosBlockNodeID (Moose::Kokkos::ThreadID tid) const
 Get the contiguous node index this Kokkos thread is operating on. More...
 
KOKKOS_FUNCTION auto kokkosBlockElementSideID (Moose::Kokkos::ThreadID tid) const
 Get the contiguous element ID - side index pair this Kokkos thread is operating on. 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 bool _bnd
 Flag whether this object is boundary-restricted. More...
 
const bool _unique_node_execute
 Flag for enable/disabling multiple execute calls on nodes that share block ids. More...
 
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...
 
const MaterialData_blk_material_data
 Pointer to the MaterialData class for this object. More...
 

Detailed Description

Definition at line 20 of file KokkosNodalReducer.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

◆ NodalReducer() [1/2]

Moose::Kokkos::NodalReducer::NodalReducer ( const MooseObject object)

◆ NodalReducer() [2/2]

Moose::Kokkos::NodalReducer::NodalReducer ( const NodalReducer 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.

◆ blockIDs()

const std::set< SubdomainID > & BlockRestrictable::blockIDs ( ) const
virtualinherited

Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.

Returns
a set of SubdomainIDs that are valid for this object

Definition at line 209 of file BlockRestrictable.C.

Referenced by FunctorMaterial::addFunctorProperty(), DiracKernelBase::addPoint(), DiracKernelBase::addPointWithValidId(), NodalPatchRecoveryAuxBase::blockRestrictElements(), MooseMesh::cacheFaceInfoVariableOwnership(), MooseMesh::cacheFVElementalDoFs(), ComboMarker::ComboMarker(), ElementGroupCentroidPositions::ElementGroupCentroidPositions(), ExtraIDIntegralVectorPostprocessor::ExtraIDIntegralVectorPostprocessor(), BlockRestrictable::getBlockCoordSystem(), MaterialBase::getGenericZeroMaterialPropertyByName(), NEML2FEInterpolation::getMOOSEVariable(), FunctorIC::gradient(), BlockRestrictable::hasBlockMaterialPropertyHelper(), IndicatorMarker::IndicatorMarker(), SubdomainsDivision::initialize(), ElementCentroidPositions::initialize(), QuadraturePointsPositions::initialize(), FunctorExtremaPositions::initialize(), NodalPatchRecoveryAux::NodalPatchRecoveryAux(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), ProjectedMaterialPropertyNodalPatchRecoveryAux::ProjectedMaterialPropertyNodalPatchRecoveryAux(), MaterialBase::registerPropName(), FVPointValueConstraint::setMyElem(), and FunctorIC::value().

210 {
211  if (_blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
212  return _blk_mesh->meshSubdomains();
213  else
214  return _blk_ids;
215 }
const MooseMesh * _blk_mesh
Pointer to Mesh.
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3298

◆ blockRestricted()

bool BlockRestrictable::blockRestricted ( ) const
virtualinherited

◆ blocks()

const std::vector< SubdomainName > & BlockRestrictable::blocks ( ) const
inherited

Return the block names for this object.

Note, if the 'blocks' input parameter was not utilized this will return an empty vector.

Returns
vector of SubdomainNames that are valid for this object

Definition at line 203 of file BlockRestrictable.C.

Referenced by MaterialOutputAction::getParams(), SubdomainsDivision::initialize(), and SolutionIC::initialSetup().

204 {
205  return _blocks;
206 }
std::vector< SubdomainName > _blocks
Vector the block names supplied by the user via the input file.

◆ blocksMaxDimension()

unsigned int BlockRestrictable::blocksMaxDimension ( ) const
inherited

Return the largest mesh dimension of the elements in the blocks for this object.

Definition at line 386 of file BlockRestrictable.C.

387 {
388  mooseAssert(_blk_dim != libMesh::invalid_uint, "Block restriction not initialized");
389  return _blk_dim;
390 }
unsigned int _blk_dim
Largest mesh dimension of the elements in the blocks for this object.
const unsigned int invalid_uint

◆ 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(), BoundaryLinearFVFluxIntegral::initialSetup(), SideFVFluxBCIntegral::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.

◆ checkVariable()

void BlockRestrictable::checkVariable ( const MooseVariableFieldBase variable) const
virtualinherited

Helper for checking that the ids for this object are in agreement with the variables on the supplied variable.

Parameters
variableThe variable to check against.

Reimplemented in DomainUserObject.

Definition at line 358 of file BlockRestrictable.C.

Referenced by DomainUserObject::checkVariable().

359 {
360  // a variable defined on all internal sides does not need this check because
361  // it can be coupled with other variables in DG kernels
362  if (!_blk_mesh->interiorLowerDBlocks().empty() &&
364  return;
365 
366  if (!isBlockSubset(variable.activeSubdomains()))
367  {
368  std::string var_ids = Moose::stringify(variable.activeSubdomains(), ", ");
369  std::string obj_ids = Moose::stringify(blockRestricted() ? _blk_ids : meshBlockIDs(), ", ");
370  mooseError("The 'block' parameter of the object '",
371  _blk_name,
372  "' must be a subset of the 'block' parameter of the variable '",
373  variable.name(),
374  "':\n Object '",
375  _blk_name,
376  "': ",
377  obj_ids,
378  "\n Variable '",
379  variable.name(),
380  "': ",
381  var_ids);
382  }
383 }
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition: MooseMesh.h:1549
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
bool isBlockSubset(const std::set< SubdomainID > &ids) const
Test if the class block ids are a subset of the supplied objects.
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
bool activeOnSubdomains(const std::set< SubdomainID > &subdomains) const
Is the variable active on the subdomains?
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
const MooseMesh * _blk_mesh
Pointer to Mesh.
const std::set< SubdomainID > & activeSubdomains() const
The subdomains the variable is active on.
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
const std::string & _blk_name
Name of the object.

◆ 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  }

◆ getBlockCoordSystem()

Moose::CoordinateSystemType BlockRestrictable::getBlockCoordSystem ( )
protectedinherited

Check if the blocks this object operates on all have the same coordinate system, and if so return it.

Definition at line 336 of file BlockRestrictable.C.

337 {
338  if (!_blk_mesh)
339  mooseError("No mesh available in BlockRestrictable::checkCoordSystem()");
340  if (!_blk_feproblem)
341  mooseError("No problem available in BlockRestrictable::checkCoordSystem()");
342 
343  const auto & subdomains = blockRestricted() ? blockIDs() : meshBlockIDs();
344 
345  if (subdomains.empty())
346  mooseError("No subdomains found in the problem.");
347 
348  // make sure all subdomains are using the same coordinate system
349  auto coord_system = _blk_feproblem->getCoordSystem(*subdomains.begin());
350  for (auto subdomain : subdomains)
351  if (_blk_feproblem->getCoordSystem(subdomain) != coord_system)
352  mooseError("This object requires all subdomains to have the same coordinate system.");
353 
354  return coord_system;
355 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
const MooseMesh * _blk_mesh
Pointer to Mesh.
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
Definition: SubProblem.C:1283

◆ hasBlockMaterialProperty()

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

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

This method returns true if the supplied property name has been declared in a Material object on the block 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 block ids of the object, otherwise false
See also
Material::hasBlockMaterialProperty

Definition at line 360 of file BlockRestrictable.h.

361 {
362  mooseAssert(_blk_material_data != NULL, "MaterialData pointer is not defined");
363  return hasBlockMaterialPropertyHelper(prop_name) &&
364  _blk_material_data->haveGenericProperty<T, is_ad>(prop_name);
365 }
bool haveGenericProperty(const std::string &prop_name) const
Definition: MaterialData.h:370
const MaterialData * _blk_material_data
Pointer to the MaterialData class for this object.
virtual bool hasBlockMaterialPropertyHelper(const std::string &prop_name)
A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.

◆ hasBlockMaterialPropertyHelper()

bool BlockRestrictable::hasBlockMaterialPropertyHelper ( const std::string &  prop_name)
protectedvirtualinherited

A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.

It also avoid circular #include problems.

See also
hasBlockMaterialProperty

Definition at line 300 of file BlockRestrictable.C.

Referenced by BlockRestrictable::hasBlockMaterialProperty().

301 {
302 
303  // Reference to MaterialWarehouse for testing and retrieving block ids
305 
306  // Complete set of ids that this object is active
307  const std::set<SubdomainID> & ids = blockRestricted() ? blockIDs() : meshBlockIDs();
308 
309  // Loop over each id for this object
310  for (const auto & id : ids)
311  {
312  // Storage of material properties that have been DECLARED on this id
313  std::set<std::string> declared_props;
314 
315  // If block materials exist, populated the set of properties that were declared
316  if (warehouse.hasActiveBlockObjects(id))
317  {
318  const std::vector<std::shared_ptr<MaterialBase>> & mats = warehouse.getActiveBlockObjects(id);
319  for (const auto & mat : mats)
320  {
321  const std::set<std::string> & mat_props = mat->getSuppliedItems();
322  declared_props.insert(mat_props.begin(), mat_props.end());
323  }
324  }
325 
326  // If the supplied property is not in the list of properties on the current id, return false
327  if (declared_props.find(prop_name) == declared_props.end())
328  return false;
329  }
330 
331  // If you get here the supplied property is defined on all blocks
332  return true;
333 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
MaterialBase objects are special in that they have additional objects created automatically (see FEPr...
const MaterialWarehouse & getMaterialWarehouse() const
const std::set< SubdomainID > & meshBlockIDs() const
Return all of the SubdomainIDs for the mesh.

◆ hasBlocks() [1/6]

bool BlockRestrictable::hasBlocks ( const SubdomainName &  name) const
inherited

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

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

Definition at line 224 of file BlockRestrictable.C.

Referenced by LinearFVFluxKernel::addMatrixContribution(), DiracKernelBase::addPoint(), LinearFVFluxKernel::addRightHandSideContribution(), NodalPatchRecoveryBase::addToQuery(), MultiAppVariableValueSamplePostprocessorTransfer::cacheElemToPostprocessorData(), DomainUserObject::checkVariable(), ComputeJacobianThread::compute(), ComboMarker::computeElementMarker(), GradientJumpIndicator::computeQpIntegral(), ProjectionAux::computeValue(), DomainUserObject::DomainUserObject(), ProjectionAux::elemOnNodeVariableIsDefinedOn(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), QuadraturePointMultiApp::fillPositions(), CentroidMultiApp::fillPositions(), NodalPatchRecoveryBase::gatherRequestList(), NodalPatchRecoveryBase::getCoefficients(), MeshDivisionFunctorReductionVectorPostprocessor::hasBlocks(), BlockRestrictable::hasBlocks(), MooseVariableField< Real >::hasBlocks(), FVFluxKernel::hasFaceSide(), IndicatorMarker::IndicatorMarker(), NodePositions::initialize(), ParsedDownSelectionPositions::initialize(), UpdateErrorVectorsThread::onElement(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), and BlockRestrictionDebugOutput::printBlockRestrictionMap().

225 {
226  // Create a vector and utilize the getSubdomainIDs function, which
227  // handles the ANY_BLOCK_ID (getSubdomainID does not)
228  std::vector<SubdomainName> names(1);
229  names[0] = name;
230  return hasBlocks(_blk_mesh->getSubdomainIDs(names));
231 }
std::string name(const ElemQuality q)
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition: MooseMesh.C:1759
const MooseMesh * _blk_mesh
Pointer to Mesh.
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.

◆ hasBlocks() [2/6]

bool BlockRestrictable::hasBlocks ( const std::vector< SubdomainName > &  names) const
inherited

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

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

Definition at line 234 of file BlockRestrictable.C.

235 {
236  return hasBlocks(_blk_mesh->getSubdomainIDs(names));
237 }
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition: MooseMesh.C:1759
const MooseMesh * _blk_mesh
Pointer to Mesh.
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.

◆ hasBlocks() [3/6]

bool BlockRestrictable::hasBlocks ( const std::set< SubdomainName > &  names) const
inherited

Test if the supplied set of block names are valid for this object.

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

Definition at line 240 of file BlockRestrictable.C.

241 {
242  return hasBlocks(_blk_mesh->getSubdomainIDs(names));
243 }
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition: MooseMesh.C:1759
const MooseMesh * _blk_mesh
Pointer to Mesh.
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.

◆ hasBlocks() [4/6]

bool BlockRestrictable::hasBlocks ( SubdomainID  id) const
inherited

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

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

Definition at line 246 of file BlockRestrictable.C.

247 {
248  if (_blk_ids.empty() || _blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
249  return true;
250  else
251  return _blk_ids.find(id) != _blk_ids.end();
252 }
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)

◆ hasBlocks() [5/6]

bool BlockRestrictable::hasBlocks ( const std::vector< SubdomainID > &  ids) const
inherited

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

Parameters
idsA vector of SubdomainIDs ids to check
Returns
True if all of the given ids are found within the ids for this object

Definition at line 255 of file BlockRestrictable.C.

256 {
257  std::set<SubdomainID> ids_set(ids.begin(), ids.end());
258  return hasBlocks(ids_set);
259 }
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.

◆ hasBlocks() [6/6]

bool BlockRestrictable::hasBlocks ( const std::set< SubdomainID > &  ids) const
inherited

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

Parameters
idsA std::set of SubdomainIDs to check
Returns
True if all of the given ids are found within the ids for this object
See also
isSubset

Definition at line 262 of file BlockRestrictable.C.

263 {
264  if (_blk_ids.empty() || _blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
265  return true;
266  else
267  return std::includes(_blk_ids.begin(), _blk_ids.end(), ids.begin(), ids.end());
268 }
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)

◆ 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  }

◆ initializeBlockRestrictable()

void BlockRestrictable::initializeBlockRestrictable ( const MooseObject moose_object)
protectedinherited

An initialization routine needed for dual constructors.

Definition at line 76 of file BlockRestrictable.C.

Referenced by BlockRestrictable::BlockRestrictable().

77 {
78  // If the mesh pointer is not defined, but FEProblemBase is, get it from there
79  if (_blk_feproblem != NULL && _blk_mesh == NULL)
81 
82  // Check that the mesh pointer was defined, it is required for this class to operate
83  if (_blk_mesh == NULL)
84  mooseError("The input parameters must contain a pointer to FEProblem via '_fe_problem' or a "
85  "pointer to the MooseMesh via '_mesh'");
86 
87  // Populate the MaterialData pointer
88  if (_blk_feproblem != NULL)
89  {
90 #ifdef MOOSE_KOKKOS_ENABLED
93  else
94 #endif
96  }
97 
98  // The 'block' input is defined
99  if (moose_object->isParamValid("block"))
100  {
101  // Extract the blocks from the input
102  _blocks = moose_object->getParam<std::vector<SubdomainName>>("block");
103 
104  // Store the IDs in a set, handling ANY_BLOCK_ID if supplied
105  if (std::find(_blocks.begin(), _blocks.end(), "ANY_BLOCK_ID") != _blocks.end())
107  else
108  {
109  // Get the IDs from the supplied names
111  _blk_ids.insert(_vec_ids.begin(), _vec_ids.end());
112  }
113  }
114 
115  // When 'blocks' is not set and there is a "variable", use the blocks from the variable
116  else if (moose_object->isParamValid("variable"))
117  {
118  std::string variable_name = moose_object->parameters().getMooseType("variable");
119  if (!variable_name.empty())
121  ->getVariable(_blk_tid,
122  variable_name,
125  .activeSubdomains();
126  }
127 
128  // Produce error if the object is not allowed to be both block and boundary restricted
129  if (!_blk_dual_restrictable && !_boundary_ids.empty() && !_boundary_ids.empty())
130  if (!_boundary_ids.empty() && _boundary_ids.find(Moose::ANY_BOUNDARY_ID) == _boundary_ids.end())
131  moose_object->paramError("block",
132  "Attempted to restrict the object '",
133  _blk_name,
134  "' to a block, but the object is already restricted by boundary");
135 
136  // If no blocks were defined above, specify that it is valid on all blocks
137  if (_blk_ids.empty() && !moose_object->isParamValid("boundary"))
138  {
140  _blocks = {"ANY_BLOCK_ID"};
141  }
142 
143  // If this object is block restricted, check that defined blocks exist on the mesh
144  if (_blk_ids.find(Moose::ANY_BLOCK_ID) == _blk_ids.end())
145  {
146  const std::set<SubdomainID> & valid_ids = _blk_mesh->meshSubdomains();
147  std::vector<SubdomainID> diff;
148 
149  std::set_difference(_blk_ids.begin(),
150  _blk_ids.end(),
151  valid_ids.begin(),
152  valid_ids.end(),
153  std::back_inserter(diff));
154 
155  if (!diff.empty())
156  {
157  std::ostringstream msg;
158  auto sep = " ";
159  msg << "the following blocks (ids) do not exist on the mesh:";
160  for (const auto & id : diff)
161  {
162  if (_blk_name.size() > 0)
163  {
164  auto & name =
165  _blocks.at(std::find(_vec_ids.begin(), _vec_ids.end(), id) - _vec_ids.begin());
166  if (std::to_string(id) != name)
167  msg << sep << name << " (" << id << ")";
168  else
169  msg << sep << id;
170  }
171  else
172  msg << sep << id;
173  sep = ", ";
174  }
175  std::vector<SubdomainID> valid_ids_vec(valid_ids.begin(), valid_ids.end());
176  auto valid_names = _blk_mesh->getSubdomainNames(valid_ids_vec);
177  msg << "\nBlocks names (resp. ids) that do exist: " << Moose::stringify(valid_names) << " ("
178  << Moose::stringify(valid_ids) << ")";
179  moose_object->paramError("block", msg.str());
180  }
181  }
182 
183  // Get the mesh dimension for the blocks
184  if (blockRestricted())
186  else
188 
189 #ifdef MOOSE_KOKKOS_ENABLED
190  if (moose_object->isKokkosObject())
193 #endif
194 }
std::string name(const ElemQuality q)
std::string getMooseType(const std::string &name) const
Utility functions for retrieving one of the MooseTypes variables into the common "string" base class...
unsigned int _blk_dim
Largest mesh dimension of the elements in the blocks for this object.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Definition: KokkosUtils.h:40
const bool _blk_dual_restrictable
Flag for allowing dual restriction.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:467
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseBase.h:416
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool isKokkosObject() const
Get whether this object is a Kokkos functor The parameter MooseBase::kokkos_object_param is set by th...
Definition: MooseObject.h:63
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
FEProblemBase * _blk_feproblem
Pointer to FEProblemBase.
const MooseObject * _moose_object
Pointer to the MOOSE object.
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition: MooseMesh.C:1759
std::vector< SubdomainID > _vec_ids
Vector of block ids supplied by the user via the input file (for error reporting) ...
void addKokkosMeshInitializationHook(std::function< void()> function)
Add a function hook that needs to be called after Kokkos mesh initialization.
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition: MooseMesh.C:3012
THREAD_ID _blk_tid
Thread id for this object.
std::vector< SubdomainName > _blocks
Vector the block names supplied by the user via the input file.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
Definition: MooseMesh.C:1791
MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid=0, const MooseObject *object=nullptr) const
MaterialData & getKokkosMaterialData(Moose::MaterialDataType type, const MooseObject *object=nullptr) const
const MooseMesh * _blk_mesh
Pointer to Mesh.
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
Definition: MooseMesh.C:3033
const MaterialData * _blk_material_data
Pointer to the MaterialData class for this object.
virtual MooseMesh & mesh() override
const std::set< BoundaryID > & _boundary_ids
Reference to the boundary_ids, defaults to an empty set if not provided.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition: MooseBase.h:209
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
void initializeKokkosBlockRestrictable()
const std::string & _blk_name
Name of the object.
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:21
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3298

◆ initializeKokkosBlockRestrictable()

void BlockRestrictable::initializeKokkosBlockRestrictable ( )
protectedinherited

◆ isBlockSubset() [1/2]

bool BlockRestrictable::isBlockSubset ( const std::set< SubdomainID > &  ids) const
inherited

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

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

Definition at line 271 of file BlockRestrictable.C.

Referenced by BlockRestrictable::checkVariable(), BlockRestrictable::isBlockSubset(), NodalPatchRecoveryAux::NodalPatchRecoveryAux(), and ProjectedMaterialPropertyNodalPatchRecoveryAux::ProjectedMaterialPropertyNodalPatchRecoveryAux().

272 {
273  // An empty input is assumed to be ANY_BLOCK_ID
274  if (ids.empty() || ids.find(Moose::ANY_BLOCK_ID) != ids.end())
275  return true;
276 
277  if (_blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
278  return std::includes(ids.begin(),
279  ids.end(),
280  _blk_mesh->meshSubdomains().begin(),
281  _blk_mesh->meshSubdomains().end());
282  else
283  return std::includes(ids.begin(), ids.end(), _blk_ids.begin(), _blk_ids.end());
284 }
const MooseMesh * _blk_mesh
Pointer to Mesh.
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3298

◆ isBlockSubset() [2/2]

bool BlockRestrictable::isBlockSubset ( const std::vector< SubdomainID > &  ids) const
inherited

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

Parameters
idsA std::vector of Subdomains to check
Returns
True if all of the block ids for this class are found within the given ids (opposite of hasBlocks)
See also
hasBlocks

Definition at line 287 of file BlockRestrictable.C.

288 {
289  std::set<SubdomainID> ids_set(ids.begin(), ids.end());
290  return isBlockSubset(ids_set);
291 }
bool isBlockSubset(const std::set< SubdomainID > &ids) const
Test if the class block ids are a subset of the supplied objects.

◆ 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(), Moose::Kokkos::ElementReducer::operator()(), Moose::Kokkos::SideReducer::operator()(), 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.

◆ kokkosBlockElementID()

KOKKOS_FUNCTION ContiguousElementID BlockRestrictable::kokkosBlockElementID ( Moose::Kokkos::ThreadID  tid) const
inlineprotectedinherited

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

Parameters
tidThe thread ID
Returns
The contiguous element ID

Definition at line 280 of file BlockRestrictable.h.

Referenced by Moose::Kokkos::ElementReducer::operator()(), Moose::Kokkos::ElementUserObject::operator()(), Moose::Kokkos::ADKernel::operator()(), Moose::Kokkos::AuxKernel::operator()(), and Moose::Kokkos::Kernel::operator()().

281  {
282  return _kokkos_element_ids[tid];
283  }
Moose::Kokkos::Array< ContiguousElementID > _kokkos_element_ids
List of contiguous element IDs this Kokkos object is operating on.

◆ kokkosBlockElementSideID()

KOKKOS_FUNCTION auto BlockRestrictable::kokkosBlockElementSideID ( 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 298 of file BlockRestrictable.h.

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

◆ kokkosBlockNodeID()

KOKKOS_FUNCTION ContiguousElementID BlockRestrictable::kokkosBlockNodeID ( Moose::Kokkos::ThreadID  tid) const
inlineprotectedinherited

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

Parameters
tidThe thread ID
Returns
the contiguous node ID

Definition at line 289 of file BlockRestrictable.h.

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

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

◆ 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 Moose::Kokkos::SideReducer::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 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

◆ meshBlockIDs()

const std::set< SubdomainID > & BlockRestrictable::meshBlockIDs ( ) const
inherited

Return all of the SubdomainIDs for the mesh.

Returns
A set of all subdomians for the entire mesh

Definition at line 294 of file BlockRestrictable.C.

Referenced by BlockRestrictable::checkVariable(), ElementGroupCentroidPositions::ElementGroupCentroidPositions(), BlockRestrictable::getBlockCoordSystem(), BlockRestrictable::hasBlockMaterialPropertyHelper(), and SolutionIC::initialSetup().

295 {
296  return _blk_mesh->meshSubdomains();
297 }
const MooseMesh * _blk_mesh
Pointer to Mesh.
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3298

◆ 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. ...

◆ numBlocks()

unsigned int BlockRestrictable::numBlocks ( ) const
inherited

Return the number of blocks for this object.

Returns
The number of subdomains

Definition at line 218 of file BlockRestrictable.C.

Referenced by ElementCentroidPositions::initialize(), and QuadraturePointsPositions::initialize().

219 {
220  return (unsigned int)_blk_ids.size();
221 }
std::set< SubdomainID > _blk_ids
Set of block ids supplied by the user via the input file (for error checking)

◆ 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.

◆ numKokkosBlockElements()

KOKKOS_FUNCTION dof_id_type BlockRestrictable::numKokkosBlockElements ( ) const
inlineprotectedinherited

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

Returns
The number of elements local to this process

Definition at line 261 of file BlockRestrictable.h.

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

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

◆ numKokkosBlockNodes()

KOKKOS_FUNCTION dof_id_type BlockRestrictable::numKokkosBlockNodes ( ) 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 266 of file BlockRestrictable.h.

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

266 { 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.

◆ numKokkosBlockSides()

KOKKOS_FUNCTION dof_id_type BlockRestrictable::numKokkosBlockSides ( ) 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 271 of file BlockRestrictable.h.

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

◆ 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 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 Moose::Kokkos::SideReducer::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::NodalReducer::numReducerThreads ( ) const
inlineoverridevirtual

Get the number of threads.

Implements Moose::Kokkos::ReducerBase.

Definition at line 32 of file KokkosNodalReducer.h.

33  {
35  }
KOKKOS_FUNCTION dof_id_type numKokkosBoundaryNodes() const
Get the number of nodes this Kokkos object is operating on.
const bool _bnd
Flag whether this object is boundary-restricted.
KOKKOS_FUNCTION dof_id_type numKokkosBlockNodes() const
Get the number of nodes this Kokkos object is operating on.

◆ operator()()

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

The parallel computation entry function called by Kokkos.

Definition at line 57 of file KokkosNodalReducer.h.

61 {
62  auto node = _bnd ? kokkosBoundaryNodeID(tid) : kokkosBlockNodeID(tid);
63 
64  Datum datum(node, kokkosAssembly(), kokkosSystems());
65 
66  reducer.template reduce<Derived>(datum, result);
67 }
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 ContiguousNodeID kokkosBoundaryNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node ID this Kokkos thread is operating on.
const bool _bnd
Flag whether this object is boundary-restricted.
KOKKOS_FUNCTION ContiguousElementID kokkosBlockNodeID(Moose::Kokkos::ThreadID tid) const
Get the contiguous node index 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::NodalReducer::validParams ( )
static

Member Data Documentation

◆ _blk_material_data

const MaterialData* BlockRestrictable::_blk_material_data
protectedinherited

Pointer to the MaterialData class for this object.

Definition at line 232 of file BlockRestrictable.h.

Referenced by BlockRestrictable::hasBlockMaterialProperty(), and BlockRestrictable::initializeBlockRestrictable().

◆ _bnd

const bool Moose::Kokkos::NodalReducer::_bnd
protected

Flag whether this object is boundary-restricted.

Definition at line 48 of file KokkosNodalReducer.h.

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

◆ _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().

◆ _unique_node_execute

const bool Moose::Kokkos::NodalReducer::_unique_node_execute
protected

Flag for enable/disabling multiple execute calls on nodes that share block ids.

Definition at line 52 of file KokkosNodalReducer.h.


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