An interface that restricts an object to subdomains via the 'blocks' input parameter. More...
#include <BlockRestrictable.h>
Public Member Functions | |
BlockRestrictable (const MooseObject *moose_object, bool initialize=true) | |
Class constructor Populates the 'block' input parameters, see the general class documentation for details. More... | |
BlockRestrictable (const MooseObject *moose_object, const std::set< BoundaryID > &boundary_ids) | |
Class constructor Populates the 'block' input parameters when an object is also boundary restricted, see the general class documentation for details. More... | |
virtual | ~BlockRestrictable () |
Destructor: does nothing but needs to be marked as virtual since this class defines virtual functions. 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 (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... | |
Static Public Member Functions | |
static InputParameters | validParams () |
Protected Member Functions | |
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... | |
Moose::CoordinateSystemType | getBlockCoordSystem () |
Check if the blocks this object operates on all have the same coordinate system, and if so return it. More... | |
Protected Attributes | |
const MaterialData * | _blk_material_data |
Pointer to the MaterialData class for this object. More... | |
Private Attributes | |
std::set< SubdomainID > | _blk_ids |
Set of block ids supplied by the user via the input file (for error checking) More... | |
std::vector< SubdomainID > | _vec_ids |
Vector of block ids supplied by the user via the input file (for error reporting) More... | |
std::vector< SubdomainName > | _blocks |
Vector the block names supplied by the user via the input file. More... | |
const bool | _blk_dual_restrictable |
Flag for allowing dual restriction. More... | |
FEProblemBase * | _blk_feproblem |
Pointer to FEProblemBase. More... | |
MooseMesh * | _blk_mesh |
Pointer to Mesh. More... | |
const std::set< BoundaryID > | _empty_boundary_ids |
An empty set for referencing when boundary_ids is not included. More... | |
const std::set< BoundaryID > & | _boundary_ids |
Reference to the boundary_ids, defaults to an empty set if not provided. More... | |
THREAD_ID | _blk_tid |
Thread id for this object. More... | |
const std::string & | _blk_name |
Name of the object. More... | |
unsigned int | _blk_dim |
Largest mesh dimension of the elements in the blocks for this object. More... | |
An interface that restricts an object to subdomains via the 'blocks' input parameter.
This class adds the 'blocks' input parameter and checks that it is populated, if it is not populated it will be populated with all valid block ids via two methods:
When using with an object with a 'variable' parameter (e.g., Kernel), the following must also exist within the input parameters for the class to operate correctly
In the general case (i.e., no 'variable') either one of the following must also exist within the input parameters for proper operation of the class:
When creating a new object, generally, this class should be inherited following MooseObject. Also, the BlockRestricted::validParams() must be added to any other parameters for the the class being created, since this is where the 'blocks' input parameter is created.
Definition at line 57 of file BlockRestrictable.h.
BlockRestrictable::BlockRestrictable | ( | const MooseObject * | moose_object, |
bool | initialize = true |
||
) |
Class constructor Populates the 'block' input parameters, see the general class documentation for details.
parameters | The input parameters (see the detailed help for additional information) |
initialize | Disable initialization, MooseVariableBase was converted to a MooseObject, this flag allows it to be constructed as if it wasn't to maintain backward compatibility, this will be removed in the fugure. TODO:MooseVariableToMooseObject (see #10601) |
Definition at line 40 of file BlockRestrictable.C.
BlockRestrictable::BlockRestrictable | ( | const MooseObject * | moose_object, |
const std::set< BoundaryID > & | boundary_ids | ||
) |
Class constructor Populates the 'block' input parameters when an object is also boundary restricted, see the general class documentation for details.
parameters | The input parameters (see the detailed help for additional information) |
boundary_ids | The boundary ids that the object is restricted to |
Definition at line 57 of file BlockRestrictable.C.
|
inlinevirtual |
Destructor: does nothing but needs to be marked as virtual since this class defines virtual functions.
Definition at line 86 of file BlockRestrictable.h.
|
virtual |
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
Definition at line 190 of file BlockRestrictable.C.
Referenced by FunctorMaterial::addFunctorProperty(), DiracKernelBase::addPoint(), DiracKernelBase::addPointWithValidId(), NodalPatchRecoveryAuxBase::blockRestrictElements(), MooseMesh::cacheFaceInfoVariableOwnership(), ElementGroupCentroidPositions::ElementGroupCentroidPositions(), ExtraIDIntegralVectorPostprocessor::ExtraIDIntegralVectorPostprocessor(), getBlockCoordSystem(), MaterialBase::getGenericZeroMaterialPropertyByName(), hasBlockMaterialPropertyHelper(), SubdomainsDivision::initialize(), ElementCentroidPositions::initialize(), MooseVariableBase::MooseVariableBase(), NodalPatchRecoveryAux::NodalPatchRecoveryAux(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), ProjectedMaterialPropertyNodalPatchRecoveryAux::ProjectedMaterialPropertyNodalPatchRecoveryAux(), MaterialBase::registerPropName(), and FVPointValueConstraint::setMyElem().
|
virtual |
Returns true if this object has been restricted to a block.
Definition at line 178 of file BlockRestrictable.C.
Referenced by NodalPatchRecoveryAuxBase::blockRestrictElements(), checkVariable(), SubdomainsDivision::divisionIndex(), ElementGroupCentroidPositions::ElementGroupCentroidPositions(), getBlockCoordSystem(), hasBlockMaterialPropertyHelper(), SubdomainsDivision::initialize(), ElementCentroidPositions::initialize(), initializeBlockRestrictable(), SolutionIC::initialSetup(), MooseVariableBase::MooseVariableBase(), and FVPointValueConstraint::setMyElem().
const std::vector< SubdomainName > & BlockRestrictable::blocks | ( | ) | const |
Return the block names for this object.
Note, if the 'blocks' input parameter was not utilized this will return an empty vector.
Definition at line 184 of file BlockRestrictable.C.
Referenced by MaterialOutputAction::getParams(), SubdomainsDivision::initialize(), and SolutionIC::initialSetup().
unsigned int BlockRestrictable::blocksMaxDimension | ( | ) | const |
Return the largest mesh dimension of the elements in the blocks for this object.
Definition at line 360 of file BlockRestrictable.C.
|
virtual |
Helper for checking that the ids for this object are in agreement with the variables on the supplied variable.
variable | The variable to check against. |
Reimplemented in DomainUserObject.
Definition at line 333 of file BlockRestrictable.C.
Referenced by DomainUserObject::checkVariable().
|
protected |
Check if the blocks this object operates on all have the same coordinate system, and if so return it.
Definition at line 311 of file BlockRestrictable.C.
bool BlockRestrictable::hasBlockMaterialProperty | ( | const std::string & | prop_name | ) |
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.
T | The type of material property |
prop_name | the name of the property to query |
Definition at line 264 of file BlockRestrictable.h.
|
protectedvirtual |
A helper method to allow the Material object to specialize the behavior of hasBlockMaterialProperty.
It also avoid circular #include problems.
Definition at line 275 of file BlockRestrictable.C.
Referenced by hasBlockMaterialProperty().
bool BlockRestrictable::hasBlocks | ( | const SubdomainName & | name | ) | const |
Test if the supplied block name is valid for this object.
name | A SubdomainName to check |
Definition at line 205 of file BlockRestrictable.C.
Referenced by LinearFVFluxKernel::addMatrixContribution(), DiracKernelBase::addPoint(), LinearFVFluxKernel::addRightHandSideContribution(), MultiAppVariableValueSamplePostprocessorTransfer::cacheElemToPostprocessorData(), DomainUserObject::checkVariable(), ComputeJacobianThread::compute(), DomainUserObject::DomainUserObject(), ExtraIDIntegralVectorPostprocessor::execute(), MeshDivisionFunctorReductionVectorPostprocessor::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), ExtraIDIntegralVectorPostprocessor::ExtraIDIntegralVectorPostprocessor(), QuadraturePointMultiApp::fillPositions(), CentroidMultiApp::fillPositions(), hasBlocks(), MooseVariableField< Real >::hasBlocks(), FVFluxKernel::hasFaceSide(), and PointwiseRenormalizeVector::PointwiseRenormalizeVector().
bool BlockRestrictable::hasBlocks | ( | const std::vector< SubdomainName > & | names | ) | const |
Test if the supplied vector of block names are valid for this object.
names | A vector of SubdomainNames to check |
Definition at line 215 of file BlockRestrictable.C.
bool BlockRestrictable::hasBlocks | ( | SubdomainID | id | ) | const |
Test if the supplied block ids are valid for this object.
id | A SubdomainID to check |
Definition at line 221 of file BlockRestrictable.C.
bool BlockRestrictable::hasBlocks | ( | const std::vector< SubdomainID > & | ids | ) | const |
Test if the supplied vector block ids are valid for this object.
ids | A vector of SubdomainIDs ids to check |
Definition at line 230 of file BlockRestrictable.C.
bool BlockRestrictable::hasBlocks | ( | const std::set< SubdomainID > & | ids | ) | const |
Test if the supplied set of block ids are valid for this object.
ids | A std::set of SubdomainIDs to check |
Definition at line 237 of file BlockRestrictable.C.
|
protected |
An initialization routine needed for dual constructors.
Definition at line 74 of file BlockRestrictable.C.
Referenced by BlockRestrictable().
bool BlockRestrictable::isBlockSubset | ( | const std::set< SubdomainID > & | ids | ) | const |
Test if the class block ids are a subset of the supplied objects.
ids | A std::set of Subdomains to check |
Definition at line 246 of file BlockRestrictable.C.
Referenced by checkVariable(), isBlockSubset(), NodalPatchRecoveryAux::NodalPatchRecoveryAux(), and ProjectedMaterialPropertyNodalPatchRecoveryAux::ProjectedMaterialPropertyNodalPatchRecoveryAux().
bool BlockRestrictable::isBlockSubset | ( | const std::vector< SubdomainID > & | ids | ) | const |
Test if the class block ids are a subset of the supplied objects.
ids | A std::vector of Subdomains to check |
Definition at line 262 of file BlockRestrictable.C.
const std::set< SubdomainID > & BlockRestrictable::meshBlockIDs | ( | ) | const |
Return all of the SubdomainIDs for the mesh.
Definition at line 269 of file BlockRestrictable.C.
Referenced by checkVariable(), ElementGroupCentroidPositions::ElementGroupCentroidPositions(), getBlockCoordSystem(), hasBlockMaterialPropertyHelper(), and SolutionIC::initialSetup().
unsigned int BlockRestrictable::numBlocks | ( | ) | const |
Return the number of blocks for this object.
Definition at line 199 of file BlockRestrictable.C.
Referenced by ElementCentroidPositions::initialize().
|
static |
Definition at line 21 of file BlockRestrictable.C.
Referenced by SubdomainsDivision::validParams(), QuadraturePointMultiApp::validParams(), CentroidMultiApp::validParams(), ElementCentroidPositions::validParams(), ElementGroupCentroidPositions::validParams(), KernelBase::validParams(), ProjectedStatefulMaterialStorageAction::validParams(), DiracKernelBase::validParams(), LinearFVKernel::validParams(), InternalSideUserObject::validParams(), NodalUserObject::validParams(), NodalKernelBase::validParams(), Indicator::validParams(), ElementUserObject::validParams(), FVKernel::validParams(), MooseVariableBase::validParams(), LineMaterialSamplerBase< Real >::validParams(), DGKernelBase::validParams(), Marker::validParams(), FVInitialConditionBase::validParams(), DomainUserObject::validParams(), InitialConditionBase::validParams(), AuxKernelTempl< Real >::validParams(), and MaterialBase::validParams().
|
private |
Largest mesh dimension of the elements in the blocks for this object.
Definition at line 259 of file BlockRestrictable.h.
Referenced by blocksMaxDimension(), and initializeBlockRestrictable().
|
private |
Flag for allowing dual restriction.
Definition at line 238 of file BlockRestrictable.h.
Referenced by initializeBlockRestrictable().
|
private |
Pointer to FEProblemBase.
Definition at line 241 of file BlockRestrictable.h.
Referenced by getBlockCoordSystem(), hasBlockMaterialPropertyHelper(), and initializeBlockRestrictable().
|
private |
Set of block ids supplied by the user via the input file (for error checking)
Definition at line 229 of file BlockRestrictable.h.
Referenced by blockIDs(), blockRestricted(), checkVariable(), hasBlocks(), initializeBlockRestrictable(), isBlockSubset(), and numBlocks().
|
protected |
Pointer to the MaterialData class for this object.
Definition at line 207 of file BlockRestrictable.h.
Referenced by hasBlockMaterialProperty(), and initializeBlockRestrictable().
|
private |
Pointer to Mesh.
Definition at line 244 of file BlockRestrictable.h.
Referenced by blockIDs(), getBlockCoordSystem(), hasBlocks(), initializeBlockRestrictable(), isBlockSubset(), and meshBlockIDs().
|
private |
Name of the object.
Definition at line 256 of file BlockRestrictable.h.
Referenced by checkVariable(), and initializeBlockRestrictable().
|
private |
Thread id for this object.
Definition at line 253 of file BlockRestrictable.h.
Referenced by initializeBlockRestrictable().
|
private |
Vector the block names supplied by the user via the input file.
Definition at line 235 of file BlockRestrictable.h.
Referenced by blocks(), and initializeBlockRestrictable().
|
private |
Reference to the boundary_ids, defaults to an empty set if not provided.
Definition at line 250 of file BlockRestrictable.h.
Referenced by initializeBlockRestrictable().
|
private |
An empty set for referencing when boundary_ids is not included.
Definition at line 247 of file BlockRestrictable.h.
|
private |
Vector of block ids supplied by the user via the input file (for error reporting)
Definition at line 232 of file BlockRestrictable.h.
Referenced by initializeBlockRestrictable().