www.mooseframework.org
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Static Private Member Functions | Private Attributes | List of all members
FeatureFloodCount Class Referenceabstract

This object will mark nodes or elements of continuous regions all with a unique number for the purpose of counting or "coloring" unique regions in a solution. More...

#include <FeatureFloodCount.h>

Inheritance diagram for FeatureFloodCount:
[legend]

Classes

class  FeatureData
 

Public Types

enum  FieldType {
  FieldType::UNIQUE_REGION, FieldType::VARIABLE_COLORING, FieldType::GHOSTED_ENTITIES, FieldType::HALOS,
  FieldType::CENTROID, FieldType::ACTIVE_BOUNDS, FieldType::INTERSECTS_SPECIFIED_BOUNDARY
}
 
enum  Status : unsigned char { Status::CLEAR = 0x0, Status::MARKED = 0x1, Status::DIRTY = 0x2, Status::INACTIVE = 0x4 }
 This enumeration is used to indicate status of the grains in the _unique_grains data structure. More...
 
enum  BoundaryIntersection : unsigned char {
  BoundaryIntersection::NONE = 0x0, BoundaryIntersection::ANY_BOUNDARY = 0x1, BoundaryIntersection::PRIMARY_PERCOLATION_BOUNDARY = 0x2, BoundaryIntersection::SECONDARY_PERCOLATION_BOUNDARY = 0x4,
  BoundaryIntersection::SPECIFIED_BOUNDARY = 0x8
}
 This enumeration is used to inidacate status of boundary intersections. More...
 
typedef DataFileName DataFileParameterType
 
typedef FunctorBase< RealFunctorType
 
typedef Real ValueType
 
typedef typename FunctorReturnType< Real, FunctorEvaluationKind::Gradient >::type GradientType
 
typedef ValueType DotType
 
enum  TEST_TYPE
 

Public Member Functions

 FeatureFloodCount (const InputParameters &parameters)
 
virtual void initialSetup () override
 
virtual void meshChanged () override
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 
virtual Real getValue () const override
 
std::size_t getNumberActiveFeatures () const
 Return the number of active features. More...
 
virtual std::size_t getTotalFeatureCount () const
 Returns the total feature count (active and inactive ids, useful for sizing vectors) More...
 
virtual bool doesFeatureIntersectBoundary (unsigned int feature_id) const
 Returns a Boolean indicating whether this feature intersects any boundary. More...
 
virtual bool doesFeatureIntersectSpecifiedBoundary (unsigned int feature_id) const
 Returns a Boolean indicating whether this feature intersects boundaries in a user-supplied list. More...
 
virtual bool isFeaturePercolated (unsigned int feature_id) const
 Returns a Boolean indicating whether this feature is percolated (e.g. More...
 
virtual Point featureCentroid (unsigned int feature_id) const
 Returns the centroid of the designated feature (only supported without periodic boundaries) More...
 
virtual const std::vector< unsigned int > & getVarToFeatureVector (dof_id_type elem_id) const
 Returns a list of active unique feature ids for a particular element. More...
 
virtual unsigned int getFeatureVar (unsigned int feature_id) const
 Returns the variable representing the passed in feature. More...
 
std::size_t numCoupledVars () const
 Returns the number of coupled varaibles. More...
 
const std::vector< MooseVariable * > & getCoupledVars () const
 Returns a const vector to the coupled variable pointers. More...
 
const std::vector< MooseVariableFEBase * > & getFECoupledVars () const
 Returns a const vector to the coupled MooseVariableFEBase pointers. More...
 
virtual Real getEntityValue (dof_id_type entity_id, FieldType field_type, std::size_t var_index=0) const
 
bool isElemental () const
 
const std::vector< FeatureData > & getFeatures () const
 Return a constant reference to the vector of all discovered features. More...
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () const
 
void gatherSum (T &value)
 
void gatherMax (T &value)
 
void gatherMin (T &value)
 
void gatherProxyValueMax (T1 &value, T2 &proxy)
 
void gatherProxyValueMin (T1 &value, T2 &proxy)
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
std::set< UserObjectName > getDependObjects () const
 
virtual bool needThreadedCopy () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool enabled () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &name, const std::string *param=nullptr) const
 
virtual void timestepSetup ()
 
virtual void timestepSetup () override
 
virtual void jacobianSetup ()
 
virtual void jacobianSetup () override
 
virtual void residualSetup ()
 
virtual void residualSetup () override
 
virtual void customSetup (const ExecFlagType &)
 
virtual void customSetup (const ExecFlagType &exec_type) override
 
const ExecFlagEnumgetExecuteOnEnum () const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const T & getUserObject (const std::string &param_name, bool is_dependency=true) const
 
const T & getUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty ()
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName (const std::string &prop_name)
 
const MaterialProperty< T > & getZeroMaterialProperty (Ts... args)
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< MaterialBase > discrete)
 
std::unordered_map< SubdomainID, std::vector< MaterialBase *> > buildRequiredMaterials (bool allow_stateful=true)
 
void statefulPropertiesAllowed (bool)
 
bool getMaterialPropertyCalled () const
 
const std::unordered_set< unsigned int > & getMatPropDependencies () const
 
virtual void resolveOptionalProperties ()
 
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName (const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
 
bool isImplicit ()
 
const PostprocessorValuegetCurrentValue () const
 
const std::string & PPName () const
 
virtual bool hasBlocks (SubdomainID) const override
 
bool supportsFaceArg () const override final
 
bool supportsElemSideQpArg () const override final
 
void buildOutputHideVariableList (std::set< std::string > variable_names)
 
const std::set< OutputName > & getOutputs ()
 
FunctorReturnType< Real, FET >::type genericEvaluate (const Space &r, const State &state) const
 
const MooseFunctorName & functorName () const
 
void setCacheClearanceSchedule (const std::set< ExecFlagType > &clearance_schedule)
 
virtual bool isExtrapolatedBoundaryFace (const FaceInfo &, const Elem *, const StateArg &) const
 
bool isInternalFace (const FaceInfo &) const
 
virtual bool isConstant () const
 
virtual bool hasFaceSide (const FaceInfo &fi, const bool fi_elem_side) const override
 
Moose::FaceArg checkFace (const Moose::FaceArg &face) const
 
virtual void threadJoin (const UserObject &) override
 
virtual void threadJoin (const UserObject &) override
 
virtual void subdomainSetup () override
 
virtual void subdomainSetup () override
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 
T & getSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
T & getSamplerByName (const SamplerName &name)
 
SamplergetSamplerByName (const SamplerName &name)
 
const std::vector< MooseVariableScalar *> & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
PerfGraphperfGraph ()
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
const std::vector< MooseVariableFieldBase *> & getCoupledMooseVars () const
 
const std::vector< MooseVariable *> & getCoupledStandardMooseVars () const
 
const std::vector< VectorMooseVariable *> & getCoupledVectorMooseVars () const
 
const std::vector< ArrayMooseVariable *> & getCoupledArrayMooseVars () const
 
void addFEVariableCoupleableVectorTag (TagID tag)
 
void addFEVariableCoupleableMatrixTag (TagID tag)
 
std::set< TagID > & getFEVariableCoupleableVectorTags ()
 
const std::set< TagID > & getFEVariableCoupleableVectorTags () const
 
std::set< TagID > & getFEVariableCoupleableMatrixTags ()
 
const std::set< TagID > & getFEVariableCoupleableMatrixTags () const
 
auto & getWritableCoupledVariables () const
 
bool hasWritableCoupledVariables () const
 
const ADVariableValuegetADDefaultValue (const std::string &var_name) const
 
const ADVectorVariableValuegetADDefaultVectorValue (const std::string &var_name) const
 
const ADVariableGradientgetADDefaultGradient () const
 
const ADVectorVariableGradientgetADDefaultVectorGradient () const
 
const ADVariableSecondgetADDefaultSecond () const
 
const std::set< MooseVariableFieldBase *> & getMooseVariableDependencies () const
 
std::set< MooseVariableFieldBase *> checkAllVariables (const DofObjectType &dof_object, const std::set< MooseVariableFieldBase * > &vars_to_omit={})
 
std::set< MooseVariableFieldBase *> checkVariables (const DofObjectType &dof_object, const std::set< MooseVariableFieldBase * > &vars_to_check)
 
virtual const std::set< BoundaryID > & boundaryIDs () const
 
const std::vector< BoundaryName > & boundaryNames () const
 
unsigned int numBoundaryIDs () const
 
bool hasBoundary (const BoundaryName &name) const
 
bool hasBoundary (const std::vector< BoundaryName > &names) const
 
bool hasBoundary (const BoundaryID &id) const
 
bool hasBoundary (const std::vector< BoundaryID > &ids, TEST_TYPE type=ALL) const
 
bool hasBoundary (const std::set< BoundaryID > &ids, TEST_TYPE type=ALL) const
 
bool isBoundarySubset (const std::set< BoundaryID > &ids) const
 
bool isBoundarySubset (const std::vector< BoundaryID > &ids) const
 
bool hasBoundaryMaterialProperty (const std::string &prop_name) const
 
virtual bool boundaryRestricted () const
 
const std::set< BoundaryID > & meshBoundaryIDs () const
 
virtual bool checkVariableBoundaryIntegrity () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void sortDFS (typename std::vector< T > &vector)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header)
 
static std::string deduceFunctorName (const std::string &name, const InputParameters &params)
 
static bool restricted (const std::set< BoundaryID > &ids)
 

Public Attributes

const ConsoleStream _console
 
 ALL
 
 ANY
 

Static Public Attributes

static constexpr PropertyValue::id_type default_property_id
 
static constexpr PropertyValue::id_type zero_property_id
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 
static const std::size_t invalid_size_t = std::numeric_limits<std::size_t>::max()
 
static const unsigned int invalid_id = std::numeric_limits<unsigned int>::max()
 
static const processor_id_type invalid_proc_id
 

Protected Member Functions

template<typename T >
bool isBoundaryEntity (const T *entity) const
 Returns a Boolean indicating whether the entity is on one of the desired boundaries. More...
 
virtual void updateFieldInfo ()
 This method is used to populate any of the data structures used for storing field data (nodal or elemental). More...
 
bool flood (const DofObject *dof_object, std::size_t current_index)
 This method will check if the current entity is above the supplied threshold and "mark" it. More...
 
virtual Real getThreshold (std::size_t current_index) const
 Return the starting comparison threshold to use when inspecting an entity during the flood stage. More...
 
virtual Real getConnectingThreshold (std::size_t current_index) const
 Return the "connecting" comparison threshold to use when inspecting an entity during the flood stage. More...
 
bool compareValueWithThreshold (Real entity_value, Real threshold) const
 This method is used to determine whether the current entity value is part of a feature or not. More...
 
virtual bool isNewFeatureOrConnectedRegion (const DofObject *dof_object, std::size_t &current_index, FeatureData *&feature, Status &status, unsigned int &new_id)
 Method called during the recursive flood routine that should return whether or not the current entity is part of the current feature (if one is being explored), or if it's the start of a new feature. More...
 
void expandPointHalos ()
 This method takes all of the partial features and expands the local, ghosted, and halo sets around those regions to account for the diffuse interface. More...
 
void expandEdgeHalos (unsigned int num_layers_to_expand)
 This method expands the existing halo set by some width determined by the passed in value. More...
 
template<typename T >
void visitNeighborsHelper (const T *curr_entity, std::vector< const T *> neighbor_entities, FeatureData *feature, bool expand_halos_only, bool topological_neighbor, bool disjoint_only)
 The actual logic for visiting neighbors is abstracted out here. More...
 
virtual void prepareDataForTransfer ()
 This routine uses the local flooded data to build up the local feature data structures (_partial feature_sets). More...
 
void serialize (std::string &serialized_buffer, unsigned int var_num=invalid_id)
 This routines packs the _partial_feature_sets data into a structure suitable for parallel communication operations. More...
 
void deserialize (std::vector< std::string > &serialized_buffers, unsigned int var_num=invalid_id)
 This routine takes the vector of byte buffers (one for each processor), deserializes them into a series of FeatureSet objects, and appends them to the _feature_sets data structure. More...
 
virtual void mergeSets ()
 This routine is called on the primary rank only and stitches together the partial feature pieces seen on any processor. More...
 
virtual void consolidateMergedFeatures (std::vector< std::list< FeatureData >> *saved_data=nullptr)
 This method consolidates all of the merged information from _partial_feature_sets into the _feature_sets vectors. More...
 
virtual bool areFeaturesMergeable (const FeatureData &f1, const FeatureData &f2) const
 Method for determining whether two features are mergeable. More...
 
virtual processor_id_type numberOfDistributedMergeHelpers () const
 Returns a number indicating the number of merge helpers when running in parallel based on certain implementer decided criteria. More...
 
void communicateAndMerge ()
 This routine handles all of the serialization, communication and deserialization of the data structures containing FeatureData objects. More...
 
virtual void restoreOriginalDataStructures (std::vector< std::list< FeatureData >> &)
 
void sortAndLabel ()
 Sort and assign ids to features based on their position in the container after sorting. More...
 
void scatterAndUpdateRanks ()
 Calls buildLocalToGlobalIndices to build the individual local to global indicies for each rank and scatters that information to all ranks. More...
 
virtual void buildLocalToGlobalIndices (std::vector< std::size_t > &local_to_global_all, std::vector< int > &counts) const
 This routine populates a stacked vector of local to global indices per rank and the associated count vector for scattering the vector to the ranks. More...
 
void buildFeatureIdToLocalIndices (unsigned int max_id)
 This method builds a lookup map for retrieving the right local feature (by index) given a global index or id. More...
 
virtual void clearDataStructures ()
 Helper routine for clearing up data structures during initialize and prior to parallel communication. More...
 
void updateBoundaryIntersections (FeatureData &feature) const
 Update the feature's attributes to indicate boundary intersections. More...
 
void appendPeriodicNeighborNodes (FeatureData &feature) const
 This routine adds the periodic node information to our data structure prior to packing the data this makes those periodic neighbors appear much like ghosted nodes in a multiprocessor setting. More...
 
void updateRegionOffsets ()
 This routine updates the _region_offsets variable which is useful for quickly determining the proper global number for a feature when using multimap mode. More...
 
std::string deduceFunctorName (const std::string &name) const
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObject &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
virtual void checkMaterialProperty (const std::string &name, const unsigned int state)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
Moose::StateArg determineState () const
 
const Moose::Functor< T > & getFunctor (const std::string &name)
 
const Moose::Functor< T > & getFunctor (const std::string &name, THREAD_ID tid)
 
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem)
 
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem, THREAD_ID tid)
 
bool isFunctor (const std::string &name) const
 
bool isFunctor (const std::string &name, const SubProblem &subproblem) const
 
Moose::ElemArg makeElemArg (const Elem *elem, bool correct_skewnewss=false) const
 
void checkFunctorSupportsSideIntegration (const std::string &name, bool qp_integration)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual ValueType evaluate (const ElemArg &elem, const StateArg &state) const =0
 
virtual ValueType evaluate (const FaceArg &face, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemQpArg &qp, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemSideQpArg &side_qp, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemPointArg &elem_point, const StateArg &state) const =0
 
virtual ValueType evaluate (const NodeArg &node, const StateArg &state) const =0
 
virtual GradientType evaluateGradient (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const NodeArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemArg &, const StateArg &) const
 
virtual DotType evaluateDot (const FaceArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemSideQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemPointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const NodeArg &, const StateArg &) const
 
virtual void coupledCallback (const std::string &, bool) const
 
virtual bool isCoupled (const std::string &var_name, unsigned int i=0) const
 
virtual bool isCoupledConstant (const std::string &var_name) const
 
unsigned int coupledComponents (const std::string &var_name) const
 
VariableName coupledName (const std::string &var_name, unsigned int comp=0) const
 
std::vector< VariableName > coupledNames (const std::string &var_name) const
 
virtual unsigned int coupled (const std::string &var_name, unsigned int comp=0) const
 
std::vector< unsigned intcoupledIndices (const std::string &var_name) const
 
virtual const VariableValuecoupledValue (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledValues (const std::string &var_name) const
 
std::vector< const VectorVariableValue *> coupledVectorValues (const std::string &var_name) const
 
const GenericVariableValue< is_ad > & coupledGenericValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericValue (const std::string &var_name, unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericValue (const std::string &var_name, unsigned int comp) const
 
std::vector< const GenericVariableValue< is_ad > *> coupledGenericValues (const std::string &var_name) const
 
std::vector< const GenericVariableValue< false > *> coupledGenericValues (const std::string &var_name) const
 
std::vector< const GenericVariableValue< true > *> coupledGenericValues (const std::string &var_name) const
 
const GenericVariableValue< is_ad > & coupledGenericDofValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericDofValue (const std::string &var_name, unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericDofValue (const std::string &var_name, unsigned int comp) const
 
virtual const VariableValuecoupledValueLower (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledValue (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const ADVariableValue *> adCoupledValues (const std::string &var_name) const
 
const ADVariableValueadCoupledLowerValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVectorVariableValueadCoupledVectorValue (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const ADVectorVariableValue *> adCoupledVectorValues (const std::string &var_name) const
 
virtual const VariableValuecoupledVectorTagValue (const std::string &var_names, TagID tag, unsigned int index=0) const
 
virtual const VariableValuecoupledVectorTagValue (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
std::vector< const VariableValue *> coupledVectorTagValues (const std::string &var_names, TagID tag) const
 
std::vector< const VariableValue *> coupledVectorTagValues (const std::string &var_names, const std::string &tag_name) const
 
virtual const ArrayVariableValuecoupledVectorTagArrayValue (const std::string &var_names, TagID tag, unsigned int index=0) const
 
virtual const ArrayVariableValuecoupledVectorTagArrayValue (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
std::vector< const ArrayVariableValue *> coupledVectorTagArrayValues (const std::string &var_names, TagID tag) const
 
std::vector< const ArrayVariableValue *> coupledVectorTagArrayValues (const std::string &var_names, const std::string &tag_name) const
 
virtual const VariableGradientcoupledVectorTagGradient (const std::string &var_names, TagID tag, unsigned int index=0) const
 
virtual const VariableGradientcoupledVectorTagGradient (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
std::vector< const VariableGradient *> coupledVectorTagGradients (const std::string &var_names, TagID tag) const
 
std::vector< const VariableGradient *> coupledVectorTagGradients (const std::string &var_names, const std::string &tag_name) const
 
virtual const ArrayVariableGradientcoupledVectorTagArrayGradient (const std::string &var_names, TagID tag, unsigned int index=0) const
 
virtual const ArrayVariableGradientcoupledVectorTagArrayGradient (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
std::vector< const ArrayVariableGradient *> coupledVectorTagArrayGradients (const std::string &var_names, TagID tag) const
 
std::vector< const ArrayVariableGradient *> coupledVectorTagArrayGradients (const std::string &var_names, const std::string &tag_name) const
 
virtual const VariableValuecoupledVectorTagDofValue (const std::string &var_name, TagID tag, unsigned int index=0) const
 
virtual const VariableValuecoupledVectorTagDofValue (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
const ArrayVariableValuecoupledVectorTagArrayDofValue (const std::string &var_name, const std::string &tag_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledVectorTagDofValues (const std::string &var_names, TagID tag) const
 
std::vector< const VariableValue *> coupledVectorTagDofValues (const std::string &var_names, const std::string &tag_name) const
 
virtual const VariableValuecoupledMatrixTagValue (const std::string &var_names, TagID tag, unsigned int index=0) const
 
virtual const VariableValuecoupledMatrixTagValue (const std::string &var_names, const std::string &tag_name, unsigned int index=0) const
 
std::vector< const VariableValue *> coupledMatrixTagValues (const std::string &var_names, TagID tag) const
 
std::vector< const VariableValue *> coupledMatrixTagValues (const std::string &var_names, const std::string &tag_name) const
 
virtual const VectorVariableValuecoupledVectorValue (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayValue (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const ArrayVariableValue *> coupledArrayValues (const std::string &var_name) const
 
MooseWritableVariablewritableVariable (const std::string &var_name, unsigned int comp=0)
 
virtual VariableValuewritableCoupledValue (const std::string &var_name, unsigned int comp=0)
 
void checkWritableVar (MooseWritableVariable *var)
 
virtual const VariableValuecoupledValueOld (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledValuesOld (const std::string &var_name) const
 
virtual const VariableValuecoupledValueOlder (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledValuesOlder (const std::string &var_name) const
 
virtual const VariableValuecoupledValuePreviousNL (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorValueOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorValueOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayValueOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayValueOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableGradientcoupledGradient (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableGradient *> coupledGradients (const std::string &var_name) const
 
const ADVariableGradientadCoupledGradient (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableGradientadCoupledGradientDot (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const ADVariableGradient *> adCoupledGradients (const std::string &var_name) const
 
const GenericVariableGradient< is_ad > & coupledGenericGradient (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableGradient< false > & coupledGenericGradient (const std::string &var_name, unsigned int comp) const
 
const GenericVariableGradient< true > & coupledGenericGradient (const std::string &var_name, unsigned int comp) const
 
std::vector< const GenericVariableGradient< is_ad > *> coupledGenericGradients (const std::string &var_name) const
 
std::vector< const GenericVariableGradient< false > *> coupledGenericGradients (const std::string &var_name) const
 
std::vector< const GenericVariableGradient< true > *> coupledGenericGradients (const std::string &var_name) const
 
const ADVectorVariableGradientadCoupledVectorGradient (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableSecondadCoupledSecond (const std::string &var_name, unsigned int comp=0) const
 
const ADVectorVariableSecondadCoupledVectorSecond (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableGradientcoupledGradientOld (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableGradient *> coupledGradientsOld (const std::string &var_name) const
 
virtual const VariableGradientcoupledGradientOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableGradientcoupledGradientPreviousNL (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableGradientcoupledGradientDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableGradientcoupledGradientDotDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableGradientcoupledVectorGradient (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableGradientcoupledVectorGradientOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableGradientcoupledVectorGradientOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableGradientcoupledArrayGradient (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableGradientcoupledArrayGradientOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableGradientcoupledArrayGradientOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableGradientcoupledArrayGradientDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableCurlcoupledCurl (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableCurlcoupledCurlOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableCurlcoupledCurlOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableSecondcoupledSecond (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableSecondcoupledSecondOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableSecondcoupledSecondOlder (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableSecondcoupledSecondPreviousNL (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDot (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledDots (const std::string &var_name) const
 
virtual const VariableValuecoupledDotDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledDot (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const ADVariableValue *> adCoupledDots (const std::string &var_name) const
 
const ADVariableValueadCoupledDotDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVectorVariableValueadCoupledVectorDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorDotDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VectorVariableValuecoupledVectorDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledVectorDotDu (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledVectorDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayDotDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const ArrayVariableValuecoupledArrayDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDotDu (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledArrayDotDu (const std::string &var_name, unsigned int comp=0) const
 
const T & coupledNodalValue (const std::string &var_name, unsigned int comp=0) const
 
const Moose::ADType< T >::typeadCoupledNodalValue (const std::string &var_name, unsigned int comp=0) const
 
const T & coupledNodalValueOld (const std::string &var_name, unsigned int comp=0) const
 
const T & coupledNodalValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const T & coupledNodalValuePreviousNL (const std::string &var_name, unsigned int comp=0) const
 
const T & coupledNodalDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledNodalDotDot (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledNodalDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledNodalDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
virtual const VariableValuecoupledDofValues (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledAllDofValues (const std::string &var_name) const
 
virtual const VariableValuecoupledDofValuesOld (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledAllDofValuesOld (const std::string &var_name) const
 
virtual const VariableValuecoupledDofValuesOlder (const std::string &var_name, unsigned int comp=0) const
 
std::vector< const VariableValue *> coupledAllDofValuesOlder (const std::string &var_name) const
 
virtual const ArrayVariableValuecoupledArrayDofValues (const std::string &var_name, unsigned int comp=0) const
 
virtual const ADVariableValueadCoupledDofValues (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadZeroValue () const
 
const ADVariableGradientadZeroGradient () const
 
const ADVariableSecondadZeroSecond () const
 
const GenericVariableValue< is_ad > & genericZeroValue ()
 
const GenericVariableValue< false > & genericZeroValue ()
 
const GenericVariableValue< true > & genericZeroValue ()
 
const GenericVariableGradient< is_ad > & genericZeroGradient ()
 
const GenericVariableGradient< false > & genericZeroGradient ()
 
const GenericVariableGradient< true > & genericZeroGradient ()
 
const GenericVariableSecond< is_ad > & genericZeroSecond ()
 
const GenericVariableSecond< false > & genericZeroSecond ()
 
const GenericVariableSecond< true > & genericZeroSecond ()
 
bool checkVar (const std::string &var_name, unsigned int comp=0, unsigned int comp_bound=0) const
 
const MooseVariableFieldBasegetFEVar (const std::string &var_name, unsigned int comp) const
 
const MooseVariableFieldBasegetFieldVar (const std::string &var_name, unsigned int comp) const
 
MooseVariableFieldBasegetFieldVar (const std::string &var_name, unsigned int comp)
 
const T * getVarHelper (const std::string &var_name, unsigned int comp) const
 
T * getVarHelper (const std::string &var_name, unsigned int comp)
 
MooseVariablegetVar (const std::string &var_name, unsigned int comp)
 
const MooseVariablegetVar (const std::string &var_name, unsigned int comp) const
 
VectorMooseVariablegetVectorVar (const std::string &var_name, unsigned int comp)
 
const VectorMooseVariablegetVectorVar (const std::string &var_name, unsigned int comp) const
 
ArrayMooseVariablegetArrayVar (const std::string &var_name, unsigned int comp)
 
const ArrayMooseVariablegetArrayVar (const std::string &var_name, unsigned int comp) const
 
void validateExecutionerType (const std::string &name, const std::string &fn_name) const
 
std::vector< T > coupledVectorHelper (const std::string &var_name, const Func &func) const
 
void addMooseVariableDependency (MooseVariableFieldBase *var)
 
void addMooseVariableDependency (const std::vector< MooseVariableFieldBase * > &vars)
 
bool hasBoundaryMaterialPropertyHelper (const std::string &prop_name) const
 
void visitNodalNeighbors (const Node *node, FeatureData *feature, bool expand_halos_only)
 These two routines are utility routines used by the flood routine and by derived classes for visiting neighbors. More...
 
void visitElementalNeighbors (const Elem *elem, FeatureData *feature, bool expand_halos_only, bool disjoint_only)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

std::vector< MooseVariableFEBase * > _fe_vars
 The vector of coupled in variables. More...
 
std::vector< MooseVariable * > _vars
 The vector of coupled in variables cast to MooseVariable. More...
 
const DofMap & _dof_map
 Reference to the dof_map containing the coupled variables. More...
 
const Real _threshold
 The threshold above (or below) where an entity may begin a new region (feature) More...
 
Real _step_threshold
 
const Real _connecting_threshold
 The threshold above (or below) which neighboring entities are flooded (where regions can be extended but not started) More...
 
Real _step_connecting_threshold
 
MooseMesh_mesh
 A reference to the mesh. More...
 
unsigned long _var_number
 This variable is used to build the periodic node map. More...
 
const bool _single_map_mode
 This variable is used to indicate whether or not multiple maps are used during flooding. More...
 
const bool _condense_map_info
 
const bool _global_numbering
 This variable is used to indicate whether or not we identify features with unique numbers on multiple maps. More...
 
const bool _var_index_mode
 This variable is used to indicate whether the maps will contain unique region information or just the variable numbers owning those regions. More...
 
const bool _compute_halo_maps
 Indicates whether or not to communicate halo map information with all ranks. More...
 
const bool _compute_var_to_feature_map
 Indicates whether or not the var to feature map is populated. More...
 
const bool _use_less_than_threshold_comparison
 Use less-than when comparing values against the threshold value. More...
 
const std::size_t _n_vars
 
const std::size_t _maps_size
 Convenience variable holding the size of all the datastructures size by the number of maps. More...
 
const processor_id_type _n_procs
 Convenience variable holding the number of processors in this simulation. More...
 
std::vector< std::set< dof_id_type > > _entities_visited
 This variable keeps track of which nodes have been visited during execution. More...
 
std::vector< std::map< dof_id_type, int > > _var_index_maps
 This map keeps track of which variables own which nodes. More...
 
std::unordered_map< dof_id_type, std::vector< const Elem * > > _nodes_to_elem_map
 The data structure used to find neighboring elements give a node ID. More...
 
std::vector< unsigned int_feature_counts_per_map
 The number of features seen by this object per map. More...
 
unsigned int _feature_count
 The number of features seen by this object (same as summing _feature_counts_per_map) More...
 
std::vector< std::list< FeatureData > > _partial_feature_sets
 The data structure used to hold partial and communicated feature data, during the discovery and merging phases. More...
 
std::vector< FeatureData > & _feature_sets
 The data structure used to hold the globally unique features. More...
 
std::vector< FeatureData_volatile_feature_sets
 Derived objects (e.g. More...
 
std::vector< std::map< dof_id_type, int > > _feature_maps
 The feature maps contain the raw flooded node information and eventually the unique grain numbers. More...
 
std::vector< std::size_t > _local_to_global_feature_map
 The vector recording the local to global feature indices. More...
 
std::vector< std::size_t > _feature_id_to_local_index
 The vector recording the grain_id to local index (several indices will contain invalid_size_t) More...
 
PeriodicBoundaries * _pbs
 A pointer to the periodic boundary constraints object. More...
 
std::unique_ptr< PointLocatorBase > _point_locator
 
const PostprocessorValue_element_average_value
 Average value of the domain which can optionally be used to find features in a field. More...
 
std::map< dof_id_type, int_ghosted_entity_ids
 The map for holding reconstructed ghosted element information. More...
 
std::vector< std::map< dof_id_type, int > > _halo_ids
 The data structure for looking up halos around features. More...
 
std::multimap< dof_id_type, dof_id_type_periodic_node_map
 The data structure which is a list of nodes that are constrained to other nodes based on the imposed periodic boundary conditions. More...
 
std::unordered_set< dof_id_type_all_boundary_entity_ids
 The set of entities on the boundary of the domain used for determining if features intersect any boundary. More...
 
std::map< dof_id_type, std::vector< unsigned int > > _entity_var_to_features
 
std::vector< unsigned int_empty_var_to_features
 
std::vector< BoundaryID_primary_perc_bnds
 
std::vector< BoundaryID_secondary_perc_bnds
 
std::vector< BoundaryID_specified_bnds
 
const bool _is_elemental
 Determines if the flood counter is elements or not (nodes) More...
 
bool _is_boundary_restricted
 Indicates that this object should only run on one or more boundaries. More...
 
ConstBndElemRange_bnd_elem_range
 Boundary element range pointer. More...
 
const bool _is_primary
 Convenience variable for testing primary rank. More...
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
const THREAD_ID _tid
 
Assembly_assembly
 
const Moose::CoordinateSystemType_coord_sys
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real_real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const InputParameters_mi_params
 
const std::string _mi_name
 
const MooseObjectName _mi_moose_object_name
 
FEProblemBase_mi_feproblem
 
SubProblem_mi_subproblem
 
const THREAD_ID _mi_tid
 
const Moose::MaterialDataType _material_data_type
 
MaterialData_material_data
 
bool _stateful_allowed
 
bool _get_material_property_called
 
std::vector< std::unique_ptr< PropertyValue > > _default_properties
 
std::unordered_set< unsigned int_material_property_dependencies
 
const MaterialPropertyName _get_suffix
 
const bool _use_interpolated_state
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real_t
 
int_t_step
 
Real_dt
 
Real_dt_old
 
bool _is_transient
 
const std::string & _pp_name
 
const PostprocessorValue_current_value
 
const Parallel::Communicator & _communicator
 
const InputParameters_c_parameters
 
const std::string & _c_name
 
const std::string & _c_type
 
FEProblemBase_c_fe_problem
 
const SystemBase *const _c_sys
 
std::unordered_map< std::string, std::vector< MooseVariableFieldBase *> > _coupled_vars
 
std::vector< MooseVariableFieldBase *> _coupled_moose_vars
 
std::vector< MooseVariable *> _coupled_standard_moose_vars
 
std::vector< VectorMooseVariable *> _coupled_vector_moose_vars
 
std::vector< ArrayMooseVariable *> _coupled_array_moose_vars
 
std::vector< MooseVariableFV< Real > *> _coupled_standard_fv_moose_vars
 
const std::unordered_map< std::string, std::string > & _new_to_deprecated_coupled_vars
 
bool _c_nodal
 
bool _c_is_implicit
 
const bool _c_allow_element_to_nodal_coupling
 
THREAD_ID _c_tid
 
std::unordered_map< std::string, std::vector< std::unique_ptr< VariableValue > > > _default_value
 
std::unordered_map< std::string, std::unique_ptr< MooseArray< DualReal > > > _ad_default_value
 
std::unordered_map< std::string, std::unique_ptr< VectorVariableValue > > _default_vector_value
 
std::unordered_map< std::string, std::unique_ptr< ArrayVariableValue > > _default_array_value
 
std::unordered_map< std::string, std::unique_ptr< MooseArray< ADRealVectorValue > > > _ad_default_vector_value
 
VariableValue _default_value_zero
 
VariableGradient _default_gradient
 
MooseArray< ADRealVectorValue_ad_default_gradient
 
MooseArray< ADRealTensorValue_ad_default_vector_gradient
 
VariableSecond _default_second
 
MooseArray< ADRealTensorValue_ad_default_second
 
const VariableValue_zero
 
const VariablePhiValue_phi_zero
 
const MooseArray< DualReal > & _ad_zero
 
const VariableGradient_grad_zero
 
const MooseArray< ADRealVectorValue > & _ad_grad_zero
 
const VariablePhiGradient_grad_phi_zero
 
const VariableSecond_second_zero
 
const MooseArray< ADRealTensorValue > & _ad_second_zero
 
const VariablePhiSecond_second_phi_zero
 
const VectorVariableValue_vector_zero
 
const VectorVariableCurl_vector_curl_zero
 
VectorVariableValue _default_vector_value_zero
 
VectorVariableGradient _default_vector_gradient
 
VectorVariableCurl _default_vector_curl
 
ArrayVariableValue _default_array_value_zero
 
ArrayVariableGradient _default_array_gradient
 
ArrayVariableCurl _default_array_curl
 
bool _coupleable_neighbor
 

Static Protected Attributes

static const std::string _interpolated_old
 
static const std::string _interpolated_older
 

Static Private Member Functions

template<class T >
static void sort (std::set< T > &)
 
template<class T >
static void sort (std::vector< T > &container)
 
template<class T >
static void reserve (std::set< T > &, std::size_t)
 
template<class T >
static void reserve (std::vector< T > &container, std::size_t size)
 
template<class T >
static bool contains (std::set< T > &container, const T &item)
 
template<class T >
static bool contains (std::vector< T > &container, const T &item)
 

Private Attributes

std::deque< const DofObject * > _entity_queue
 The data structure for maintaining entities to flood during discovery. More...
 

Detailed Description

This object will mark nodes or elements of continuous regions all with a unique number for the purpose of counting or "coloring" unique regions in a solution.

It is designed to work with either a single variable, or multiple variables.

Note: When inspecting multiple variables, those variables must not have regions of interest that overlap or they will not be correctly colored.

Definition at line 40 of file FeatureFloodCount.h.

Member Enumeration Documentation

◆ BoundaryIntersection

enum FeatureFloodCount::BoundaryIntersection : unsigned char
strong

This enumeration is used to inidacate status of boundary intersections.

Enumerator
NONE 
ANY_BOUNDARY 
PRIMARY_PERCOLATION_BOUNDARY 
SECONDARY_PERCOLATION_BOUNDARY 
SPECIFIED_BOUNDARY 

Definition at line 129 of file FeatureFloodCount.h.

129  : unsigned char
130  {
131  NONE = 0x0,
132  ANY_BOUNDARY = 0x1,
133  PRIMARY_PERCOLATION_BOUNDARY = 0x2,
134  SECONDARY_PERCOLATION_BOUNDARY = 0x4,
135  SPECIFIED_BOUNDARY = 0x8
136  };
NONE

◆ FieldType

Enumerator
UNIQUE_REGION 
VARIABLE_COLORING 
GHOSTED_ENTITIES 
HALOS 
CENTROID 
ACTIVE_BOUNDS 
INTERSECTS_SPECIFIED_BOUNDARY 

Definition at line 102 of file FeatureFloodCount.h.

103  {
104  UNIQUE_REGION,
105  VARIABLE_COLORING,
106  GHOSTED_ENTITIES,
107  HALOS,
108  CENTROID,
109  ACTIVE_BOUNDS,
110  INTERSECTS_SPECIFIED_BOUNDARY,
111  };

◆ Status

enum FeatureFloodCount::Status : unsigned char
strong

This enumeration is used to indicate status of the grains in the _unique_grains data structure.

Enumerator
CLEAR 
MARKED 
DIRTY 
INACTIVE 

Definition at line 120 of file FeatureFloodCount.h.

120  : unsigned char
121  {
122  CLEAR = 0x0,
123  MARKED = 0x1,
124  DIRTY = 0x2,
125  INACTIVE = 0x4
126  };

Constructor & Destructor Documentation

◆ FeatureFloodCount()

FeatureFloodCount::FeatureFloodCount ( const InputParameters parameters)

Definition at line 189 of file FeatureFloodCount.C.

191  Coupleable(this, false),
193  BoundaryRestrictable(this, false),
196  _dof_map(_vars[0]->dofMap()),
197  _threshold(getParam<Real>("threshold")),
198  _connecting_threshold(isParamValid("connecting_threshold")
199  ? getParam<Real>("connecting_threshold")
200  : getParam<Real>("threshold")),
202  _var_number(_fe_vars[0]->number()),
203  _single_map_mode(getParam<bool>("use_single_map")),
204  _condense_map_info(getParam<bool>("condense_map_info")),
205  _global_numbering(getParam<bool>("use_global_numbering")),
206  _var_index_mode(getParam<bool>("enable_var_coloring")),
207  _compute_halo_maps(getParam<bool>("compute_halo_maps")),
208  _compute_var_to_feature_map(getParam<bool>("compute_var_to_feature_map")),
209  _use_less_than_threshold_comparison(getParam<bool>("use_less_than_threshold_comparison")),
210  _n_vars(_fe_vars.size()),
211  _maps_size(_single_map_mode ? 1 : _fe_vars.size()),
214  _feature_count(0),
216  _feature_sets(getParam<bool>("restartable_required")
217  ? declareRestartableData<std::vector<FeatureData>>("feature_sets")
220  _pbs(nullptr),
222  ? getPostprocessorValue("elem_avg_value")
223  : _real_zero),
225  _is_elemental(getParam<MooseEnum>("flood_entity_type") == "ELEMENTAL"),
226  _is_primary(processor_id() == 0)
227 {
228  if (_var_index_mode)
229  _var_index_maps.resize(_maps_size);
230 
232 
234 
235  if (_subproblem.isTransient())
236  {
237  // tell MOOSE that we are going to need old and older DoF values
238  for (auto & var : _vars)
239  {
240  var->dofValuesOld();
241  var->dofValuesOlder();
242  }
243  }
244 
245  if (parameters.isParamValid("primary_percolation_boundaries"))
247  parameters.get<std::vector<BoundaryName>>("primary_percolation_boundaries"));
248  if (parameters.isParamValid("secondary_percolation_boundaries"))
250  parameters.get<std::vector<BoundaryName>>("secondary_percolation_boundaries"));
251 
252  if (_primary_perc_bnds.empty() != _secondary_perc_bnds.empty())
253  paramError("primary_percolation_boundaries",
254  "primary_percolation_boundaries and secondary_percolation_boundaries must both be "
255  "supplied when checking for percolation");
256 
257  if (parameters.isParamValid("specified_boundaries"))
259  _mesh.getBoundaryIDs(parameters.get<std::vector<BoundaryName>>("specified_boundaries"));
260 }
virtual MooseMesh & mesh()=0
std::vector< BoundaryID > _primary_perc_bnds
const PostprocessorValue & _element_average_value
Average value of the domain which can optionally be used to find features in a field.
std::vector< BoundaryID > _specified_bnds
std::vector< BoundaryID > _secondary_perc_bnds
const std::size_t _n_vars
virtual bool boundaryRestricted() const
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
const bool _condense_map_info
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
const bool _is_primary
Convenience variable for testing primary rank.
MooseVariableDependencyInterface(const MooseObject *)
T & declareRestartableData(const std::string &data_name, Args &&... args)
const PostprocessorValue & getPostprocessorValue(const std::string &param_name, const unsigned int index=0) const
SubProblem & _subproblem
std::vector< FeatureData > _volatile_feature_sets
Derived objects (e.g.
const std::vector< MooseVariable *> & getCoupledStandardMooseVars() const
bool isParamValid(const std::string &name) const
processor_id_type n_processors() const
Coupleable(const MooseObject *moose_object, bool nodal, bool is_fv=false)
std::vector< std::map< dof_id_type, int > > _halo_ids
The data structure for looking up halos around features.
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
const Real _connecting_threshold
The threshold above (or below) which neighboring entities are flooded (where regions can be extended ...
virtual bool isTransient() const=0
unsigned long _var_number
This variable is used to build the periodic node map.
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
const bool _use_less_than_threshold_comparison
Use less-than when comparing values against the threshold value.
const T & getParam(const std::string &name) const
const bool _global_numbering
This variable is used to indicate whether or not we identify features with unique numbers on multiple...
const DofMap & _dof_map
Reference to the dof_map containing the coupled variables.
void paramError(const std::string &param, Args... args) const
std::vector< std::map< dof_id_type, int > > _feature_maps
The feature maps contain the raw flooded node information and eventually the unique grain numbers...
const bool _single_map_mode
This variable is used to indicate whether or not multiple maps are used during flooding.
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
const Real _threshold
The threshold above (or below) where an entity may begin a new region (feature)
const std::vector< MooseVariableFieldBase *> & getCoupledMooseVars() const
bool _is_boundary_restricted
Indicates that this object should only run on one or more boundaries.
std::vector< MooseVariableFEBase * > _fe_vars
The vector of coupled in variables.
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
GeneralPostprocessor(const InputParameters &parameters)
const bool _compute_halo_maps
Indicates whether or not to communicate halo map information with all ranks.
PeriodicBoundaries * _pbs
A pointer to the periodic boundary constraints object.
void addMooseVariableDependency(MooseVariableFieldBase *var)
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
const Real & _real_zero
const processor_id_type _n_procs
Convenience variable holding the number of processors in this simulation.
std::vector< unsigned int > _feature_counts_per_map
The number of features seen by this object per map.
const InputParameters & parameters() const
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
BoundaryRestrictable(const MooseObject *moose_object, bool nodal)
MooseMesh & _mesh
A reference to the mesh.
processor_id_type processor_id() const
const bool _compute_var_to_feature_map
Indicates whether or not the var to feature map is populated.
const bool _var_index_mode
This variable is used to indicate whether the maps will contain unique region information or just the...
std::vector< std::map< dof_id_type, int > > _var_index_maps
This map keeps track of which variables own which nodes.
bool isParamValid(const std::string &name) const

Member Function Documentation

◆ appendPeriodicNeighborNodes()

void FeatureFloodCount::appendPeriodicNeighborNodes ( FeatureData feature) const
protected

This routine adds the periodic node information to our data structure prior to packing the data this makes those periodic neighbors appear much like ghosted nodes in a multiprocessor setting.

Definition at line 1819 of file FeatureFloodCount.C.

Referenced by prepareDataForTransfer().

1820 {
1821  if (_is_elemental)
1822  {
1823  for (auto entity : feature._local_ids)
1824  {
1825  Elem * elem = _mesh.elemPtr(entity);
1826 
1827  for (const auto node_n : make_range(elem->n_nodes()))
1828  {
1829  auto iters = _periodic_node_map.equal_range(elem->node_id(node_n));
1830 
1831  for (auto it = iters.first; it != iters.second; ++it)
1832  {
1833  feature._periodic_nodes.insert(feature._periodic_nodes.end(), it->first);
1834  feature._periodic_nodes.insert(feature._periodic_nodes.end(), it->second);
1835  }
1836  }
1837  }
1838  }
1839  else
1840  {
1841  for (auto entity : feature._local_ids)
1842  {
1843  auto iters = _periodic_node_map.equal_range(entity);
1844 
1845  for (auto it = iters.first; it != iters.second; ++it)
1846  {
1847  feature._periodic_nodes.insert(feature._periodic_nodes.end(), it->first);
1848  feature._periodic_nodes.insert(feature._periodic_nodes.end(), it->second);
1849  }
1850  }
1851  }
1852 
1853  // TODO: Remove duplicates
1854 }
std::multimap< dof_id_type, dof_id_type > _periodic_node_map
The data structure which is a list of nodes that are constrained to other nodes based on the imposed ...
virtual Elem * elemPtr(const dof_id_type i)
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
IntRange< T > make_range(T beg, T end)
MooseMesh & _mesh
A reference to the mesh.

◆ areFeaturesMergeable()

bool FeatureFloodCount::areFeaturesMergeable ( const FeatureData f1,
const FeatureData f2 
) const
protectedvirtual

Method for determining whether two features are mergeable.

This routine exists because derived classes may need to override this function rather than use the mergeable method in the FeatureData object.

Reimplemented in PolycrystalUserObjectBase.

Definition at line 1276 of file FeatureFloodCount.C.

Referenced by mergeSets().

1277 {
1278  return f1.mergeable(f2);
1279 }

◆ buildFeatureIdToLocalIndices()

void FeatureFloodCount::buildFeatureIdToLocalIndices ( unsigned int  max_id)
protected

This method builds a lookup map for retrieving the right local feature (by index) given a global index or id.

max_id is passed to size the vector properly and may or may not be a globally consistent number. The assumption is that any id that is later queried from this object that is higher simply doesn't exist on the local processor.

Definition at line 660 of file FeatureFloodCount.C.

Referenced by GrainTracker::assignGrains(), scatterAndUpdateRanks(), and GrainTracker::trackGrains().

661 {
662  _feature_id_to_local_index.assign(max_id + 1, invalid_size_t);
663  for (const auto feature_index : index_range(_feature_sets))
664  {
665  if (_feature_sets[feature_index]._status != Status::INACTIVE)
666  {
667  mooseAssert(_feature_sets[feature_index]._id <= max_id,
668  "Feature ID out of range(" << _feature_sets[feature_index]._id << ')');
669  _feature_id_to_local_index[_feature_sets[feature_index]._id] = feature_index;
670  }
671  }
672 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...
auto index_range(const T &sizable)

◆ buildLocalToGlobalIndices()

void FeatureFloodCount::buildLocalToGlobalIndices ( std::vector< std::size_t > &  local_to_global_all,
std::vector< int > &  counts 
) const
protectedvirtual

This routine populates a stacked vector of local to global indices per rank and the associated count vector for scattering the vector to the ranks.

The individual vectors can be different sizes. The ith vector will be distributed to the ith processor including the primary rank. e.g. [ ... n_0 ] [ ... n_1 ] ... [ ... n_m ]

It is intended to be overridden in derived classes.

Definition at line 614 of file FeatureFloodCount.C.

Referenced by scatterAndUpdateRanks().

616 {
617  mooseAssert(_is_primary, "This method must only be called on the root processor");
618 
619  counts.assign(_n_procs, 0);
620  // Now size the individual counts vectors based on the largest index seen per processor
621  for (const auto & feature : _feature_sets)
622  for (const auto & local_index_pair : feature._orig_ids)
623  {
624  // local_index_pair.first = ranks, local_index_pair.second = local_index
625  mooseAssert(local_index_pair.first < _n_procs, "Processor ID is out of range");
626  if (local_index_pair.second >= static_cast<std::size_t>(counts[local_index_pair.first]))
627  counts[local_index_pair.first] = local_index_pair.second + 1;
628  }
629 
630  // Build the offsets vector
631  unsigned int globalsize = 0;
632  std::vector<int> offsets(_n_procs); // Type is signed for use with the MPI API
633  for (const auto i : index_range(offsets))
634  {
635  offsets[i] = globalsize;
636  globalsize += counts[i];
637  }
638 
639  // Finally populate the primary vector
640  local_to_global_all.resize(globalsize, FeatureFloodCount::invalid_size_t);
641  for (const auto & feature : _feature_sets)
642  {
643  // Get the local indices from the feature and build a map
644  for (const auto & local_index_pair : feature._orig_ids)
645  {
646  auto rank = local_index_pair.first;
647  mooseAssert(rank < _n_procs, rank << ", " << _n_procs);
648 
649  auto local_index = local_index_pair.second;
650  auto stacked_local_index = offsets[rank] + local_index;
651 
652  mooseAssert(stacked_local_index < globalsize,
653  "Global index: " << stacked_local_index << " is out of range");
654  local_to_global_all[stacked_local_index] = feature._id;
655  }
656  }
657 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
const bool _is_primary
Convenience variable for testing primary rank.
const processor_id_type _n_procs
Convenience variable holding the number of processors in this simulation.
auto index_range(const T &sizable)

◆ clearDataStructures()

void FeatureFloodCount::clearDataStructures ( )
protectedvirtual

Helper routine for clearing up data structures during initialize and prior to parallel communication.

Definition at line 316 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

317 {
318 }

◆ communicateAndMerge()

void FeatureFloodCount::communicateAndMerge ( )
protected

This routine handles all of the serialization, communication and deserialization of the data structures containing FeatureData objects.

The libMesh packed range routines handle the communication of the individual string buffers. Here we need to create a container to hold our type to serialize. It'll always be size one because we are sending a single byte stream of all the data to other processors. The stream need not be the same size on all processors.

Additionally we need to create a different container to hold the received byte buffers. The container type need not match the send container type. However, We do know the number of incoming buffers (num processors) so we'll go ahead and use a vector.

When we distribute merge work, we are reducing computational work by adding more communication. Each of the first _n_vars processors will receive one variable worth of information to merge. After each of those processors has merged that information, it'll be sent to the primary processor where final consolidation will occur.

Send the data from all processors to the first 'n_merging_procs' processors to create a complete global feature maps for each variable.

A call to gather_packed_range seems to populate the receiving buffer on all processors, not just the receiving buffer on the actual receiving processor. If we plan to call this function repeatedly, we must clear the buffers each time on all non-receiving processors. On the actual receiving processor, we'll save off the buffer for use later.

The FeatureFloodCount and derived objects rely on having the original data structures intact on all non-zero ranks. This is because local-only information (local entities) is never communicated and thus must remain intact. However, the distributed merging will destroy that information. The easiest thing to do is to swap out the data structure while we perform the distributed merge work.

Send the data from the merging processors to the root to create a complete global feature map.

Send the data from all processors to the root to create a complete global feature map.

Definition at line 403 of file FeatureFloodCount.C.

Referenced by GrainTracker::finalize(), and finalize().

404 {
405  TIME_SECTION("communicateAndMerge", 3, "Communicating and Merging");
406 
407  // First we need to transform the raw data into a usable data structure
409 
417  std::vector<std::string> send_buffers(1);
418 
425  std::vector<std::string> recv_buffers, deserialize_buffers;
426 
433  const auto n_merging_procs = numberOfDistributedMergeHelpers();
434 
435  if (n_merging_procs > 1)
436  {
437  auto rank = processor_id();
438  bool is_merging_processor = rank < n_merging_procs;
439 
440  if (is_merging_processor)
441  recv_buffers.reserve(_app.n_processors());
442 
443  for (const auto i : make_range(n_merging_procs))
444  {
445  serialize(send_buffers[0], i);
446 
452  (void *)(nullptr),
453  send_buffers.begin(),
454  send_buffers.end(),
455  std::back_inserter(recv_buffers));
456 
463  if (rank == i)
464  recv_buffers.swap(deserialize_buffers);
465  else
466  recv_buffers.clear();
467  }
468 
469  // Setup a new communicator for doing merging communication operations
470  Parallel::Communicator merge_comm;
471 
472  _communicator.split(is_merging_processor ? 0 : MPI_UNDEFINED, rank, merge_comm);
473 
474  if (is_merging_processor)
475  {
483  std::vector<std::list<FeatureData>> tmp_data(_partial_feature_sets.size());
484  tmp_data.swap(_partial_feature_sets);
485 
486  deserialize(deserialize_buffers, processor_id());
487 
488  send_buffers[0].clear();
489  recv_buffers.clear();
490  deserialize_buffers.clear();
491 
492  // Merge one variable's worth of data
493  mergeSets();
494 
495  // Now we need to serialize again to send to the primary (only the processors who did work)
496  serialize(send_buffers[0]);
497 
498  // Free up as much memory as possible here before we do global communication
500 
505  merge_comm.gather_packed_range(0,
506  (void *)(nullptr),
507  send_buffers.begin(),
508  send_buffers.end(),
509  std::back_inserter(recv_buffers));
510 
511  if (_is_primary)
512  {
513  // The root process now needs to deserialize all of the data
514  deserialize(recv_buffers);
515 
516  send_buffers[0].clear();
517  recv_buffers.clear();
518 
519  consolidateMergedFeatures(&tmp_data);
520  }
521  else
522  // Restore our original data on non-zero ranks
523  tmp_data.swap(_partial_feature_sets);
524  }
525  }
526 
527  // Serialized merging (primary does all the work)
528  else
529  {
530  if (_is_primary)
531  recv_buffers.reserve(_app.n_processors());
532 
533  serialize(send_buffers[0]);
534 
535  // Free up as much memory as possible here before we do global communication
537 
543  (void *)(nullptr),
544  send_buffers.begin(),
545  send_buffers.end(),
546  std::back_inserter(recv_buffers));
547 
548  if (_is_primary)
549  {
550  // The root process now needs to deserialize all of the data
551  deserialize(recv_buffers);
552  recv_buffers.clear();
553 
554  mergeSets();
555 
557  }
558  }
559 
560  if (!_is_primary)
562 
563  // Make sure that feature count is communicated to all ranks
565 }
void gather_packed_range(const unsigned int root_id, Context *context, Iter range_begin, const Iter range_end, OutputIter out, std::size_t approx_buffer_size=1000000) const
void serialize(std::string &serialized_buffer, unsigned int var_num=invalid_id)
This routines packs the _partial_feature_sets data into a structure suitable for parallel communicati...
const bool _is_primary
Convenience variable for testing primary rank.
const Parallel::Communicator & _communicator
virtual void consolidateMergedFeatures(std::vector< std::list< FeatureData >> *saved_data=nullptr)
This method consolidates all of the merged information from _partial_feature_sets into the _feature_s...
processor_id_type n_processors() const
virtual void clearDataStructures()
Helper routine for clearing up data structures during initialize and prior to parallel communication...
virtual processor_id_type numberOfDistributedMergeHelpers() const
Returns a number indicating the number of merge helpers when running in parallel based on certain imp...
void split(int color, int key, Communicator &target) const
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
virtual void mergeSets()
This routine is called on the primary rank only and stitches together the partial feature pieces seen...
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
virtual void restoreOriginalDataStructures(std::vector< std::list< FeatureData >> &)
IntRange< T > make_range(T beg, T end)
void deserialize(std::vector< std::string > &serialized_buffers, unsigned int var_num=invalid_id)
This routine takes the vector of byte buffers (one for each processor), deserializes them into a seri...
processor_id_type processor_id() const
virtual void prepareDataForTransfer()
This routine uses the local flooded data to build up the local feature data structures (_partial feat...

◆ compareValueWithThreshold()

bool FeatureFloodCount::compareValueWithThreshold ( Real  entity_value,
Real  threshold 
) const
protected

This method is used to determine whether the current entity value is part of a feature or not.

Comparisons can either be greater than or less than the threshold which is controlled via input parameter.

Definition at line 1451 of file FeatureFloodCount.C.

Referenced by isNewFeatureOrConnectedRegion().

1452 {
1453  return ((_use_less_than_threshold_comparison && (entity_value >= threshold)) ||
1454  (!_use_less_than_threshold_comparison && (entity_value <= threshold)));
1455 }
const bool _use_less_than_threshold_comparison
Use less-than when comparing values against the threshold value.

◆ consolidateMergedFeatures()

void FeatureFloodCount::consolidateMergedFeatures ( std::vector< std::list< FeatureData >> *  saved_data = nullptr)
protectedvirtual

This method consolidates all of the merged information from _partial_feature_sets into the _feature_sets vectors.

Now that the merges are complete we need to adjust the centroid, and halos. Additionally, To make several of the sorting and tracking algorithms more straightforward, we will move the features into a flat vector. Finally we can count the final number of features and find the max local index seen on any processor

Note: This is all occurring on rank 0 only!

IMPORTANT: FeatureFloodCount::_feature_count is set on rank 0 at this point but we can't broadcast it here because this routine is not collective.

Definition at line 1193 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

1194 {
1195  TIME_SECTION("consolidateMergedFeatures", 3, "Consolidating Merged Features");
1196 
1205  mooseAssert(_is_primary,
1206  "cosolidateMergedFeatures() may only be called on the primary processor");
1207  mooseAssert(saved_data == nullptr || saved_data->size() == _partial_feature_sets.size(),
1208  "Data structure size mismatch");
1209 
1210  // Offset where the current set of features with the same variable id starts in the flat vector
1211  unsigned int feature_offset = 0;
1212  // Set the member feature count to zero and start counting the actual features
1213  _feature_count = 0;
1214  for (const auto map_num : index_range(_partial_feature_sets))
1215  {
1216  for (auto & feature : _partial_feature_sets[map_num])
1217  {
1218  if (saved_data)
1219  {
1220  for (auto it = (*saved_data)[map_num].begin(); it != (*saved_data)[map_num].end();
1221  /* no increment */)
1222  {
1223  if (feature.canConsolidate(*it))
1224  {
1225  feature.consolidate(std::move(*it));
1226  it = (*saved_data)[map_num].erase(it); // increment
1227  }
1228  else
1229  ++it;
1230  }
1231  }
1232 
1233  // If after merging we still have an inactive feature, discard it
1234  if (feature._status == Status::CLEAR)
1235  {
1236  // First we need to calculate the centroid now that we are doing merging all partial
1237  // features
1238  if (feature._vol_count != 0)
1239  feature._centroid /= feature._vol_count;
1240 
1241  _feature_sets.emplace_back(std::move(feature));
1242  ++_feature_count;
1243  }
1244  }
1245 
1246  // Record the feature numbers just for the current map
1247  _feature_counts_per_map[map_num] = _feature_count - feature_offset;
1248 
1249  // Now update the running feature count so we can calculate the next map's contribution
1250  feature_offset = _feature_count;
1251 
1252  // Clean up the "moved" objects
1253  _partial_feature_sets[map_num].clear();
1254  if (saved_data)
1255  (*saved_data)[map_num].clear();
1256  }
1257 
1258  // We may have resided our data structures for the communicateAndMerge step. We'll restore the
1259  // original size here just in case we need to loop over the assumed size (i.e. _maps_size)
1260  // elsewhere in this or derived objects.
1261  if (_partial_feature_sets.size() != _maps_size)
1262  {
1264 
1267  }
1268 
1273 }
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
const bool _is_primary
Convenience variable for testing primary rank.
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
std::vector< unsigned int > _feature_counts_per_map
The number of features seen by this object per map.
auto index_range(const T &sizable)

◆ contains() [1/2]

template<class T >
static bool FeatureFloodCount::contains ( std::set< T > &  container,
const T &  item 
)
inlinestaticprivate

Definition at line 744 of file FeatureFloodCount.h.

Referenced by visitNeighborsHelper().

745  {
746  return container.find(item) != container.end();
747  }

◆ contains() [2/2]

template<class T >
static bool FeatureFloodCount::contains ( std::vector< T > &  container,
const T &  item 
)
inlinestaticprivate

Definition at line 750 of file FeatureFloodCount.h.

751  {
752  for (const auto & cont_item : container)
753  if (item == cont_item)
754  return true;
755  return false;
756  }

◆ deserialize()

void FeatureFloodCount::deserialize ( std::vector< std::string > &  serialized_buffers,
unsigned int  var_num = invalid_id 
)
protected

This routine takes the vector of byte buffers (one for each processor), deserializes them into a series of FeatureSet objects, and appends them to the _feature_sets data structure.

Note: It is assumed that local processor information may already be stored in the _feature_sets data structure so it is not cleared before insertion.

Usually we have the local processor data already in the _partial_feature_sets data structure. However, if we are doing distributed merge work, we also need to preserve all of the original data for use in later stages of the algorithm so it'll have been swapped out with clean buffers. This leaves us a choice, either we just duplicate the Features from the original data structure after we've swapped out the buffer, or we go ahead and unpack data that we would normally already have. So during distributed merging, that's exactly what we'll do. Later however when the primary is doing the final consolidating, we'll opt to just skip the local unpacking. To tell the difference, between these two modes, we just need to see if a var_num was passed in.

Definition at line 1103 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

1104 {
1105  // The input string stream used for deserialization
1106  std::istringstream iss;
1107 
1108  auto rank = processor_id();
1109 
1110  for (const auto proc_id : index_range(serialized_buffers))
1111  {
1123  if (var_num == invalid_id && proc_id == rank)
1124  continue;
1125 
1126  iss.str(serialized_buffers[proc_id]); // populate the stream with a new buffer
1127  iss.clear(); // reset the string stream state
1128 
1129  // Load the gathered data into the data structure.
1130  if (var_num == invalid_id)
1131  dataLoad(iss, _partial_feature_sets, this);
1132  else
1133  dataLoad(iss, _partial_feature_sets[var_num], this);
1134  }
1135 }
void dataLoad(std::istream &stream, FeatureFloodCount::FeatureData &feature, void *context)
static const unsigned int invalid_id
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ doesFeatureIntersectBoundary()

bool FeatureFloodCount::doesFeatureIntersectBoundary ( unsigned int  feature_id) const
virtual

Returns a Boolean indicating whether this feature intersects any boundary.

Reimplemented in GrainTracker, and FauxGrainTracker.

Definition at line 843 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute().

844 {
845  // Some processors don't contain the largest feature id, in that case we just return invalid_id
846  if (feature_id >= _feature_id_to_local_index.size())
847  return false;
848 
849  auto local_index = _feature_id_to_local_index[feature_id];
850 
851  if (local_index != invalid_size_t)
852  {
853  mooseAssert(local_index < _feature_sets.size(), "local_index out of bounds");
854  return _feature_sets[local_index]._status != Status::INACTIVE
855  ? _feature_sets[local_index]._boundary_intersection != BoundaryIntersection::NONE
856  : false;
857  }
858 
859  return false;
860 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...

◆ doesFeatureIntersectSpecifiedBoundary()

bool FeatureFloodCount::doesFeatureIntersectSpecifiedBoundary ( unsigned int  feature_id) const
virtual

Returns a Boolean indicating whether this feature intersects boundaries in a user-supplied list.

Reimplemented in GrainTracker.

Definition at line 863 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute(), and getEntityValue().

864 {
865  // Some processors don't contain the largest feature id, in that case we just return invalid_id
866  if (feature_id >= _feature_id_to_local_index.size())
867  return false;
868 
869  auto local_index = _feature_id_to_local_index[feature_id];
870 
871  if (local_index != invalid_size_t)
872  {
873  mooseAssert(local_index < _feature_sets.size(), "local_index out of bounds");
874  return _feature_sets[local_index]._status != Status::INACTIVE
875  ? ((_feature_sets[local_index]._boundary_intersection &
878  : false;
879  }
880 
881  return false;
882 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...

◆ execute()

void FeatureFloodCount::execute ( )
overridevirtual

Implements GeneralPostprocessor.

Reimplemented in PolycrystalUserObjectBase, FauxGrainTracker, GrainTracker, and FauxPolycrystalVoronoi.

Definition at line 344 of file FeatureFloodCount.C.

Referenced by GrainTracker::execute().

345 {
346  TIME_SECTION("execute", 3, "Flooding Features");
347 
348  // Iterate only over boundaries if restricted
350  {
351  mooseInfo("Using EXPERIMENTAL boundary restricted FeatureFloodCount object!\n");
352 
353  // Set the boundary range pointer for use during flooding
355 
356  auto rank = processor_id();
357 
358  for (const auto & belem : *_bnd_elem_range)
359  {
360  const Elem * elem = belem->_elem;
361  BoundaryID boundary_id = belem->_bnd_id;
362 
363  if (elem->processor_id() == rank)
364  {
365  if (hasBoundary(boundary_id))
366  for (const auto var_num : index_range(_vars))
367  flood(elem, var_num);
368  }
369  }
370  }
371  else // Normal volumetric operation
372  {
373  for (const auto & current_elem : _mesh.getMesh().active_local_element_ptr_range())
374  {
375  // Loop over elements or nodes
376  if (_is_elemental)
377  {
378  for (const auto var_num : index_range(_vars))
379  flood(current_elem, var_num);
380  }
381  else
382  {
383  auto n_nodes = current_elem->n_vertices();
384  for (const auto i : make_range(n_nodes))
385  {
386  const Node * current_node = current_elem->node_ptr(i);
387 
388  for (const auto var_num : index_range(_vars))
389  flood(current_node, var_num);
390  }
391  }
392  }
393  }
394 }
void mooseInfo(Args &&... args) const
const dof_id_type n_nodes
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
MeshBase & getMesh()
boundary_id_type BoundaryID
bool hasBoundary(const BoundaryName &name) const
bool _is_boundary_restricted
Indicates that this object should only run on one or more boundaries.
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
bool flood(const DofObject *dof_object, std::size_t current_index)
This method will check if the current entity is above the supplied threshold and "mark" it...
IntRange< T > make_range(T beg, T end)
ConstBndElemRange * _bnd_elem_range
Boundary element range pointer.
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement *> * getBoundaryElementRange()
MooseMesh & _mesh
A reference to the mesh.
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ expandEdgeHalos()

void FeatureFloodCount::expandEdgeHalos ( unsigned int  num_layers_to_expand)
protected

This method expands the existing halo set by some width determined by the passed in value.

This method does NOT mask off any local IDs.

Create a copy of the halo set so that as we insert new ids into the set we don't continue to iterate on those new ids.

We have to handle disjoint halo IDs slightly differently. Once you are disjoint, you can't go back so make sure that we keep placing these IDs in the disjoint set.

Definition at line 1560 of file FeatureFloodCount.C.

Referenced by GrainTracker::finalize(), and PolycrystalUserObjectBase::finalize().

1561 {
1562  if (num_layers_to_expand == 0)
1563  return;
1564 
1565  TIME_SECTION("expandEdgeHalos", 3, "Expanding Edge Halos");
1566 
1567  for (auto & list_ref : _partial_feature_sets)
1568  {
1569  for (auto & feature : list_ref)
1570  {
1571  for (unsigned short halo_level = 0; halo_level < num_layers_to_expand; ++halo_level)
1572  {
1577  FeatureData::container_type orig_halo_ids(feature._halo_ids);
1578  for (auto entity : orig_halo_ids)
1579  {
1580  if (_is_elemental)
1582  &feature,
1583  /*expand_halos_only =*/true,
1584  /*disjoint_only =*/false);
1585  else
1587  &feature,
1588  /*expand_halos_only =*/true);
1589  }
1590 
1595  FeatureData::container_type disjoint_orig_halo_ids(feature._disjoint_halo_ids);
1596  for (auto entity : disjoint_orig_halo_ids)
1597  {
1598  if (_is_elemental)
1600 
1601  &feature,
1602  /*expand_halos_only =*/true,
1603  /*disjoint_only =*/true);
1604  else
1606 
1607  &feature,
1608  /*expand_halos_only =*/true);
1609  }
1610  }
1611  }
1612  }
1613 }
void visitNodalNeighbors(const Node *node, FeatureData *feature, bool expand_halos_only)
These two routines are utility routines used by the flood routine and by derived classes for visiting...
std::vector< dof_id_type > container_type
The primary underlying container type used to hold the data in each FeatureData.
virtual Elem * elemPtr(const dof_id_type i)
virtual const Node * nodePtr(const dof_id_type i) const
void visitElementalNeighbors(const Elem *elem, FeatureData *feature, bool expand_halos_only, bool disjoint_only)
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
MooseMesh & _mesh
A reference to the mesh.

◆ expandPointHalos()

void FeatureFloodCount::expandPointHalos ( )
protected

This method takes all of the partial features and expands the local, ghosted, and halo sets around those regions to account for the diffuse interface.

Rather than using any kind of recursion here, we simply expand the region by all "point" neighbors from the actual grain cells since all point neighbors will contain contributions to the region.

To expand the feature element region to the actual flooded region (nodal basis) we need to add in all point neighbors of the current local region for each feature. This is because the elemental variable influence spreads from the elemental data out exactly one element from every mesh point.

Definition at line 1498 of file FeatureFloodCount.C.

1499 {
1500  const auto & node_to_elem_map = _mesh.nodeToActiveSemilocalElemMap();
1501  FeatureData::container_type expanded_local_ids;
1502  auto my_processor_id = processor_id();
1503 
1510  for (auto & list_ref : _partial_feature_sets)
1511  {
1512  for (auto & feature : list_ref)
1513  {
1514  expanded_local_ids.clear();
1515 
1516  for (auto entity : feature._local_ids)
1517  {
1518  const Elem * elem = _mesh.elemPtr(entity);
1519  mooseAssert(elem, "elem pointer is NULL");
1520 
1521  // Get the nodes on a current element so that we can add in point neighbors
1522  auto n_nodes = elem->n_vertices();
1523  for (const auto i : make_range(n_nodes))
1524  {
1525  const Node * current_node = elem->node_ptr(i);
1526 
1527  auto elem_vector_it = node_to_elem_map.find(current_node->id());
1528  if (elem_vector_it == node_to_elem_map.end())
1529  mooseError("Error in node to elem map");
1530 
1531  const auto & elem_vector = elem_vector_it->second;
1532 
1533  std::copy(elem_vector.begin(),
1534  elem_vector.end(),
1535  std::insert_iterator<FeatureData::container_type>(expanded_local_ids,
1536  expanded_local_ids.end()));
1537 
1538  // Now see which elements need to go into the ghosted set
1539  for (auto entity : elem_vector)
1540  {
1541  const Elem * neighbor = _mesh.elemPtr(entity);
1542  mooseAssert(neighbor, "neighbor pointer is NULL");
1543 
1544  if (neighbor->processor_id() != my_processor_id)
1545  feature._ghosted_ids.insert(feature._ghosted_ids.end(), elem->id());
1546  }
1547  }
1548  }
1549 
1550  // Replace the existing local ids with the expanded local ids
1551  feature._local_ids.swap(expanded_local_ids);
1552 
1553  // Copy the expanded local_ids into the halo_ids container
1554  feature._halo_ids = feature._local_ids;
1555  }
1556  }
1557 }
std::vector< dof_id_type > container_type
The primary underlying container type used to hold the data in each FeatureData.
virtual Elem * elemPtr(const dof_id_type i)
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToActiveSemilocalElemMap()
const dof_id_type n_nodes
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
MooseMesh & _mesh
A reference to the mesh.
processor_id_type processor_id() const

◆ featureCentroid()

Point FeatureFloodCount::featureCentroid ( unsigned int  feature_id) const
virtual

Returns the centroid of the designated feature (only supported without periodic boundaries)

Definition at line 909 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute().

910 {
911  if (feature_id >= _feature_id_to_local_index.size())
912  return invalid_id;
913 
914  auto local_index = _feature_id_to_local_index[feature_id];
915 
916  Real invalid_coord = std::numeric_limits<Real>::max();
917  Point p(invalid_coord, invalid_coord, invalid_coord);
918  if (local_index != invalid_size_t)
919  {
920  mooseAssert(local_index < _feature_sets.size(), "local_index out of bounds");
921  p = _feature_sets[local_index]._centroid;
922  }
923  return p;
924 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
static const unsigned int invalid_id
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...

◆ finalize()

void FeatureFloodCount::finalize ( )
overridevirtual

Reimplemented from GeneralPostprocessor.

Reimplemented in PolycrystalUserObjectBase, GrainTracker, FauxPolycrystalVoronoi, and FauxGrainTracker.

Definition at line 675 of file FeatureFloodCount.C.

Referenced by PolycrystalUserObjectBase::finalize().

676 {
677  TIME_SECTION("finalize", 3, "Finalizing Feature Identification");
678 
679  // Gather all information on processor zero and merge
681 
682  // Sort and label the features
683  if (_is_primary)
684  sortAndLabel();
685 
686  // Send out the local to global mappings
688 
689  // Populate _feature_maps and _var_index_maps
690  updateFieldInfo();
691 }
virtual void updateFieldInfo()
This method is used to populate any of the data structures used for storing field data (nodal or elem...
const bool _is_primary
Convenience variable for testing primary rank.
void communicateAndMerge()
This routine handles all of the serialization, communication and deserialization of the data structur...
void sortAndLabel()
Sort and assign ids to features based on their position in the container after sorting.
void scatterAndUpdateRanks()
Calls buildLocalToGlobalIndices to build the individual local to global indicies for each rank and sc...

◆ flood()

bool FeatureFloodCount::flood ( const DofObject *  dof_object,
std::size_t  current_index 
)
protected

This method will check if the current entity is above the supplied threshold and "mark" it.

It will then inspect neighboring entities that are above the connecting threshold and add them to the current feature.

Returns
Boolean indicating whether a new feature was found while exploring the current entity.

If we reach this point (i.e. we haven't continued to the next queue entry), we've found a new mesh entity that's part of a feature. We need to mark the entity as visited at this point (and not before!) to avoid infinite recursion. If you mark the node too early you risk not coloring in a whole feature any time a "connecting threshold" is used since we may have already visited this entity earlier but it was in-between two thresholds.

See if this particular entity cell contributes to the centroid calculation. We only deal with elemental floods and only count it if it's owned by the current processor to avoid skewing the result.

Definition at line 1327 of file FeatureFloodCount.C.

Referenced by execute(), and PolycrystalUserObjectBase::execute().

1329 {
1330  // if (dof_object == nullptr || dof_object == libMesh::remote_elem)
1331  // return false;
1332  mooseAssert(dof_object, "DOF object is nullptr");
1333  mooseAssert(_entity_queue.empty(), "Entity queue is not empty when starting a feature");
1334 
1335  // Kick off the exploration of a new feature
1336  _entity_queue.push_front(dof_object);
1337 
1338  bool return_value = false;
1339  FeatureData * feature = nullptr;
1340  while (!_entity_queue.empty())
1341  {
1342  const DofObject * curr_dof_object = _entity_queue.back();
1343  const Elem * elem = _is_elemental ? static_cast<const Elem *>(curr_dof_object) : nullptr;
1344  _entity_queue.pop_back();
1345 
1346  // Retrieve the id of the current entity
1347  auto entity_id = curr_dof_object->id();
1348 
1349  // Has this entity already been marked? - if so move along
1350  if (current_index != invalid_size_t &&
1351  _entities_visited[current_index].find(entity_id) != _entities_visited[current_index].end())
1352  continue;
1353 
1354  // Are we outside of the range we should be working in?
1355  if (_is_elemental && !_dof_map.is_evaluable(*elem))
1356  continue;
1357 
1358  // See if the current entity either starts a new feature or continues an existing feature
1359  auto new_id = invalid_id; // Writable reference to hold an optional id;
1360  Status status =
1361  Status::INACTIVE; // Status is inactive until we find an entity above the starting threshold
1362 
1363  // Make sure that the Assembly object has the right element and subdomain information set
1364  // since we are moving through the mesh in a manual fashion.
1365  if (_is_elemental)
1367 
1368  if (!isNewFeatureOrConnectedRegion(curr_dof_object, current_index, feature, status, new_id))
1369  {
1370  // If we have an active feature, we just found a halo entity
1371  if (feature)
1372  feature->_halo_ids.insert(feature->_halo_ids.end(), entity_id);
1373  continue;
1374  }
1375 
1376  mooseAssert(current_index != invalid_size_t, "current_index is invalid");
1377 
1386  return_value = true;
1387  _entities_visited[current_index].insert(entity_id);
1388 
1389  auto map_num = _single_map_mode ? decltype(current_index)(0) : current_index;
1390 
1391  // New Feature (we need to create it and add it to our data structure)
1392  if (!feature)
1393  {
1394  _partial_feature_sets[map_num].emplace_back(
1395  current_index, _feature_count++, processor_id(), status);
1396 
1397  // Get a handle to the feature we will update (always the last feature in the data structure)
1398  feature = &_partial_feature_sets[map_num].back();
1399 
1400  // If new_id is valid, we'll set it in the feature here.
1401  if (new_id != invalid_id)
1402  feature->_id = new_id;
1403  }
1404 
1405  // Insert the current entity into the local ids data structure
1406  feature->_local_ids.insert(feature->_local_ids.end(), entity_id);
1407 
1413  if (_is_elemental && processor_id() == curr_dof_object->processor_id())
1414  {
1415  // Keep track of how many elements participate in the centroid averaging
1416  feature->_vol_count++;
1417 
1418  // Sum the centroid values for now, we'll average them later
1419  feature->_centroid += elem->vertex_average();
1420 
1421  // // Does the volume intersect the boundary?
1422  // if (_all_boundary_entity_ids.find(elem->id()) != _all_boundary_entity_ids.end())
1423  // feature->_intersects_boundary = true;
1424  }
1425 
1426  if (_is_elemental)
1428  feature,
1429  /*expand_halos_only =*/false,
1430  /*disjoint_only =*/false);
1431  else
1432  visitNodalNeighbors(static_cast<const Node *>(curr_dof_object),
1433  feature,
1434  /*expand_halos_only =*/false);
1435  }
1436 
1437  return return_value;
1438 }
void visitNodalNeighbors(const Node *node, FeatureData *feature, bool expand_halos_only)
These two routines are utility routines used by the flood routine and by derived classes for visiting...
static const std::size_t invalid_size_t
Status
This enumeration is used to indicate status of the grains in the _unique_grains data structure...
std::vector< std::set< dof_id_type > > _entities_visited
This variable keeps track of which nodes have been visited during execution.
MPI_Status status
void visitElementalNeighbors(const Elem *elem, FeatureData *feature, bool expand_halos_only, bool disjoint_only)
const DofMap & _dof_map
Reference to the dof_map containing the coupled variables.
static const unsigned int invalid_id
const bool _single_map_mode
This variable is used to indicate whether or not multiple maps are used during flooding.
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
virtual bool isNewFeatureOrConnectedRegion(const DofObject *dof_object, std::size_t &current_index, FeatureData *&feature, Status &status, unsigned int &new_id)
Method called during the recursive flood routine that should return whether or not the current entity...
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
FEProblemBase & _fe_problem
processor_id_type processor_id() const
std::deque< const DofObject * > _entity_queue
The data structure for maintaining entities to flood during discovery.

◆ getConnectingThreshold()

Real FeatureFloodCount::getConnectingThreshold ( std::size_t  current_index) const
protectedvirtual

Return the "connecting" comparison threshold to use when inspecting an entity during the flood stage.

Definition at line 1445 of file FeatureFloodCount.C.

Referenced by isNewFeatureOrConnectedRegion().

1446 {
1448 }

◆ getCoupledVars()

const std::vector<MooseVariable *>& FeatureFloodCount::getCoupledVars ( ) const
inline

Returns a const vector to the coupled variable pointers.

Definition at line 97 of file FeatureFloodCount.h.

Referenced by AverageGrainVolume::AverageGrainVolume(), and FeatureVolumeVectorPostprocessor::FeatureVolumeVectorPostprocessor().

97 { return _vars; }
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.

◆ getEntityValue()

Real FeatureFloodCount::getEntityValue ( dof_id_type  entity_id,
FieldType  field_type,
std::size_t  var_index = 0 
) const
virtual

Reimplemented in GrainTracker, and FauxGrainTracker.

Definition at line 927 of file FeatureFloodCount.C.

Referenced by GrainTracker::getEntityValue(), and FeatureFloodCountAux::precalculateValue().

930 {
931  auto use_default = false;
932  if (var_index == invalid_size_t)
933  {
934  use_default = true;
935  var_index = 0;
936  }
937 
938  mooseAssert(var_index < _maps_size, "Index out of range");
939 
940  switch (field_type)
941  {
943  {
944  const auto entity_it = _feature_maps[var_index].find(entity_id);
945 
946  if (entity_it != _feature_maps[var_index].end())
947  return entity_it->second; // + _region_offsets[var_index];
948  else
949  return -1;
950  }
951 
953  {
954  mooseAssert(
956  "\"enable_var_coloring\" must be set to true to pull back the VARIABLE_COLORING field");
957 
958  const auto entity_it = _var_index_maps[var_index].find(entity_id);
959 
960  if (entity_it != _var_index_maps[var_index].end())
961  return entity_it->second;
962  else
963  return -1;
964  }
965 
967  {
968  const auto entity_it = _ghosted_entity_ids.find(entity_id);
969 
970  if (entity_it != _ghosted_entity_ids.end())
971  return entity_it->second;
972  else
973  return -1;
974  }
975 
976  case FieldType::HALOS:
977  {
978  if (!use_default)
979  {
980  const auto entity_it = _halo_ids[var_index].find(entity_id);
981  if (entity_it != _halo_ids[var_index].end())
982  return entity_it->second;
983  }
984  else
985  {
986  // Showing halos in reverse order for backwards compatibility
987  for (auto map_num = _maps_size;
988  map_num-- /* don't compare greater than zero for unsigned */;)
989  {
990  const auto entity_it = _halo_ids[map_num].find(entity_id);
991 
992  if (entity_it != _halo_ids[map_num].end())
993  return entity_it->second;
994  }
995  }
996  return -1;
997  }
998 
999  case FieldType::CENTROID:
1000  {
1001  if (_periodic_node_map.size())
1002  mooseDoOnce(mooseWarning(
1003  "Centroids are not correct when using periodic boundaries, contact the MOOSE team"));
1004 
1005  // If this element contains the centroid of one of features, return one
1006  const auto * elem_ptr = _mesh.elemPtr(entity_id);
1007 
1008  for (const auto & feature : _feature_sets)
1009  {
1010  if (feature._status == Status::INACTIVE)
1011  continue;
1012 
1013  if (elem_ptr->contains_point(feature._centroid))
1014  return 1;
1015  }
1016 
1017  return 0;
1018  }
1019 
1021  {
1022  auto ids = getVarToFeatureVector(entity_id);
1023  if (ids.size() != 0)
1025  return 0;
1026  }
1027 
1028  default:
1029  return 0;
1030  }
1031 }
std::multimap< dof_id_type, dof_id_type > _periodic_node_map
The data structure which is a list of nodes that are constrained to other nodes based on the imposed ...
static const std::size_t invalid_size_t
virtual Elem * elemPtr(const dof_id_type i)
virtual const std::vector< unsigned int > & getVarToFeatureVector(dof_id_type elem_id) const
Returns a list of active unique feature ids for a particular element.
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
void mooseWarning(Args &&... args) const
std::map< dof_id_type, int > _ghosted_entity_ids
The map for holding reconstructed ghosted element information.
std::vector< std::map< dof_id_type, int > > _halo_ids
The data structure for looking up halos around features.
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
std::vector< std::map< dof_id_type, int > > _feature_maps
The feature maps contain the raw flooded node information and eventually the unique grain numbers...
virtual bool doesFeatureIntersectSpecifiedBoundary(unsigned int feature_id) const
Returns a Boolean indicating whether this feature intersects boundaries in a user-supplied list...
MooseMesh & _mesh
A reference to the mesh.
const bool _var_index_mode
This variable is used to indicate whether the maps will contain unique region information or just the...
std::vector< std::map< dof_id_type, int > > _var_index_maps
This map keeps track of which variables own which nodes.

◆ getFeatures()

const std::vector<FeatureData>& FeatureFloodCount::getFeatures ( ) const
inline

Return a constant reference to the vector of all discovered features.

Definition at line 328 of file FeatureFloodCount.h.

Referenced by GrainTracker::prepopulateState().

328 { return _feature_sets; }
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.

◆ getFeatureVar()

unsigned int FeatureFloodCount::getFeatureVar ( unsigned int  feature_id) const
virtual

Returns the variable representing the passed in feature.

Reimplemented in GrainTracker, and FauxGrainTracker.

Definition at line 824 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute(), and GrainTracker::getFeatureVar().

825 {
826  // Some processors don't contain the largest feature id, in that case we just return invalid_id
827  if (feature_id >= _feature_id_to_local_index.size())
828  return invalid_id;
829 
830  auto local_index = _feature_id_to_local_index[feature_id];
831  if (local_index != invalid_size_t)
832  {
833  mooseAssert(local_index < _feature_sets.size(), "local_index out of bounds");
834  return _feature_sets[local_index]._status != Status::INACTIVE
835  ? _feature_sets[local_index]._var_index
836  : invalid_id;
837  }
838 
839  return invalid_id;
840 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
static const unsigned int invalid_id
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...

◆ getFECoupledVars()

const std::vector<MooseVariableFEBase *>& FeatureFloodCount::getFECoupledVars ( ) const
inline

Returns a const vector to the coupled MooseVariableFEBase pointers.

Definition at line 100 of file FeatureFloodCount.h.

Referenced by AverageGrainVolume::AverageGrainVolume().

100 { return _fe_vars; }
std::vector< MooseVariableFEBase * > _fe_vars
The vector of coupled in variables.

◆ getNumberActiveFeatures()

std::size_t FeatureFloodCount::getNumberActiveFeatures ( ) const

Return the number of active features.

Definition at line 806 of file FeatureFloodCount.C.

Referenced by AverageGrainVolume::getValue().

807 {
808  // Note: This value is parallel consistent, see FeatureFloodCount::communicateAndMerge()
809  return _feature_count;
810 }
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...

◆ getThreshold()

Real FeatureFloodCount::getThreshold ( std::size_t  current_index) const
protectedvirtual

Return the starting comparison threshold to use when inspecting an entity during the flood stage.

Reimplemented in GrainTracker.

Definition at line 1440 of file FeatureFloodCount.C.

Referenced by isNewFeatureOrConnectedRegion().

1441 {
1442  return _step_threshold;
1443 }

◆ getTotalFeatureCount()

std::size_t FeatureFloodCount::getTotalFeatureCount ( ) const
virtual

Returns the total feature count (active and inactive ids, useful for sizing vectors)

Since the FeatureFloodCount object doesn't maintain any information about features between invocations. The maximum id in use is simply the number of features.

Reimplemented in FauxGrainTracker, and GrainTracker.

Definition at line 813 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute(), and AverageGrainVolume::initialize().

814 {
820  return _feature_count;
821 }
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...

◆ getValue()

Real FeatureFloodCount::getValue ( ) const
overridevirtual

Implements GeneralPostprocessor.

Reimplemented in FauxGrainTracker.

Definition at line 800 of file FeatureFloodCount.C.

801 {
802  return static_cast<Real>(_feature_count);
803 }
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ getVarToFeatureVector()

const std::vector< unsigned int > & FeatureFloodCount::getVarToFeatureVector ( dof_id_type  elem_id) const
virtual

Returns a list of active unique feature ids for a particular element.

The vector is indexed by variable number with each entry containing either an invalid size_t type (no feature active at that location) or a feature id if the variable is non-zero at that location.

Reimplemented in GrainTracker, and FauxGrainTracker.

Definition at line 694 of file FeatureFloodCount.C.

Referenced by AverageGrainVolume::execute(), FeatureVolumeVectorPostprocessor::execute(), getEntityValue(), GrainTracker::getVarToFeatureVector(), and FeatureFloodCountAux::precalculateValue().

695 {
696  mooseDoOnce(if (!_compute_var_to_feature_map) mooseError(
697  "Please set \"compute_var_to_feature_map = true\" to use this interface method"));
698 
699  const auto pos = _entity_var_to_features.find(elem_id);
700  if (pos != _entity_var_to_features.end())
701  {
702  mooseAssert(pos->second.size() == _n_vars, "Variable to feature vector not sized properly");
703  return pos->second;
704  }
705  else
706  return _empty_var_to_features;
707 }
const std::size_t _n_vars
std::map< dof_id_type, std::vector< unsigned int > > _entity_var_to_features
std::vector< unsigned int > _empty_var_to_features
void mooseError(Args &&... args) const
const bool _compute_var_to_feature_map
Indicates whether or not the var to feature map is populated.

◆ initialize()

void FeatureFloodCount::initialize ( )
overridevirtual

Implements GeneralPostprocessor.

Reimplemented in PolycrystalUserObjectBase, FauxGrainTracker, GrainTracker, and FauxPolycrystalVoronoi.

Definition at line 284 of file FeatureFloodCount.C.

Referenced by GrainTracker::initialize(), and PolycrystalUserObjectBase::initialize().

285 {
286  // Clear the feature marking maps and region counters and other data structures
287  for (const auto map_num : make_range(_maps_size))
288  {
289  _feature_maps[map_num].clear();
290  _partial_feature_sets[map_num].clear();
291 
292  if (_var_index_mode)
293  _var_index_maps[map_num].clear();
294 
295  _halo_ids[map_num].clear();
296  }
297 
298  _feature_sets.clear();
299 
300  // Calculate the thresholds for this iteration
303 
304  _ghosted_entity_ids.clear();
305 
306  // Reset the feature count and max local size
307  _feature_count = 0;
308 
309  _entity_var_to_features.clear();
310 
311  for (auto & map_ref : _entities_visited)
312  map_ref.clear();
313 }
const PostprocessorValue & _element_average_value
Average value of the domain which can optionally be used to find features in a field.
std::vector< std::set< dof_id_type > > _entities_visited
This variable keeps track of which nodes have been visited during execution.
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::map< dof_id_type, std::vector< unsigned int > > _entity_var_to_features
std::map< dof_id_type, int > _ghosted_entity_ids
The map for holding reconstructed ghosted element information.
std::vector< std::map< dof_id_type, int > > _halo_ids
The data structure for looking up halos around features.
const Real _connecting_threshold
The threshold above (or below) which neighboring entities are flooded (where regions can be extended ...
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
std::vector< std::map< dof_id_type, int > > _feature_maps
The feature maps contain the raw flooded node information and eventually the unique grain numbers...
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
const Real _threshold
The threshold above (or below) where an entity may begin a new region (feature)
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
IntRange< T > make_range(T beg, T end)
const bool _var_index_mode
This variable is used to indicate whether the maps will contain unique region information or just the...
std::vector< std::map< dof_id_type, int > > _var_index_maps
This map keeps track of which variables own which nodes.

◆ initialSetup()

void FeatureFloodCount::initialSetup ( )
overridevirtual

Size the empty var to features vector to the number of coupled variables. This empty vector (but properly sized) vector is returned for elements that are queried but are not in the structure (which also shouldn't happen). The user is warned in this case but this helps avoid extra bounds checking in user code and avoids segfaults.

Reimplemented from GeneralPostprocessor.

Reimplemented in PolycrystalUserObjectBase, and FauxPolycrystalVoronoi.

Definition at line 263 of file FeatureFloodCount.C.

Referenced by PolycrystalUserObjectBase::initialSetup().

264 {
265  // We need one map per coupled variable for normal runs to support overlapping features
266  _entities_visited.resize(_vars.size());
267 
268  // Get a pointer to the PeriodicBoundaries buried in libMesh
269  _pbs = _fe_problem.getNonlinearSystemBase(_sys.number()).dofMap().get_periodic_boundaries();
270 
271  meshChanged();
272 
281 }
const std::size_t _n_vars
std::vector< std::set< dof_id_type > > _entities_visited
This variable keeps track of which nodes have been visited during execution.
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
static const unsigned int invalid_id
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
unsigned int number() const
PeriodicBoundaries * _pbs
A pointer to the periodic boundary constraints object.
std::vector< unsigned int > _empty_var_to_features
FEProblemBase & _fe_problem
virtual void meshChanged() override

◆ isBoundaryEntity()

template<typename T >
bool FeatureFloodCount::isBoundaryEntity ( const T *  entity) const
protected

Returns a Boolean indicating whether the entity is on one of the desired boundaries.

Definition at line 1858 of file FeatureFloodCount.C.

Referenced by visitNeighborsHelper().

1859 {
1860  mooseAssert(_bnd_elem_range, "Boundary Element Range is nullptr");
1861 
1862  if (entity)
1863  for (const auto & belem : *_bnd_elem_range)
1864  // Only works for Elements
1865  if (belem->_elem->id() == entity->id() && hasBoundary(belem->_bnd_id))
1866  return true;
1867 
1868  return false;
1869 }
bool hasBoundary(const BoundaryName &name) const
ConstBndElemRange * _bnd_elem_range
Boundary element range pointer.

◆ isElemental()

bool FeatureFloodCount::isElemental ( ) const
inline

Definition at line 117 of file FeatureFloodCount.h.

Referenced by FeatureFloodCountAux::FeatureFloodCountAux().

117 { return _is_elemental; }
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)

◆ isFeaturePercolated()

bool FeatureFloodCount::isFeaturePercolated ( unsigned int  feature_id) const
virtual

Returns a Boolean indicating whether this feature is percolated (e.g.

intersects at least two different boundaries from sets supplied by the user)

Reimplemented in GrainTracker.

Definition at line 885 of file FeatureFloodCount.C.

Referenced by FeatureVolumeVectorPostprocessor::execute().

886 {
887  // Some processors don't contain the largest feature id, in that case we just return invalid_id
888  if (feature_id >= _feature_id_to_local_index.size())
889  return false;
890 
891  auto local_index = _feature_id_to_local_index[feature_id];
892 
893  if (local_index != invalid_size_t)
894  {
895  mooseAssert(local_index < _feature_sets.size(), "local_index out of bounds");
896  bool primary = ((_feature_sets[local_index]._boundary_intersection &
899  bool secondary = ((_feature_sets[local_index]._boundary_intersection &
902  return _feature_sets[local_index]._status != Status::INACTIVE ? (primary && secondary) : false;
903  }
904 
905  return false;
906 }
static const std::size_t invalid_size_t
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::vector< std::size_t > _feature_id_to_local_index
The vector recording the grain_id to local index (several indices will contain invalid_size_t) ...

◆ isNewFeatureOrConnectedRegion()

bool FeatureFloodCount::isNewFeatureOrConnectedRegion ( const DofObject *  dof_object,
std::size_t &  current_index,
FeatureData *&  feature,
Status status,
unsigned int new_id 
)
protectedvirtual

Method called during the recursive flood routine that should return whether or not the current entity is part of the current feature (if one is being explored), or if it's the start of a new feature.

If the value is only above the connecting threshold, it's still part of a feature but possibly part of one that we'll discard if there is never any starting threshold encountered.

Reimplemented in PolycrystalUserObjectBase.

Definition at line 1458 of file FeatureFloodCount.C.

Referenced by flood().

1463 {
1464  // Get the value of the current variable for the current entity
1465  Real entity_value;
1466  if (_is_elemental)
1467  {
1468  const Elem * elem = static_cast<const Elem *>(dof_object);
1469  std::vector<Point> centroid(1, elem->vertex_average());
1470  _subproblem.reinitElemPhys(elem, centroid, 0);
1471  entity_value = _vars[current_index]->sln()[0];
1472  }
1473  else
1474  entity_value = _vars[current_index]->getNodalValue(*static_cast<const Node *>(dof_object));
1475 
1476  // If the value compares against our starting threshold, this is definitely part of a feature
1477  // we'll keep
1478  if (compareValueWithThreshold(entity_value, getThreshold(current_index)))
1479  {
1480  Status * status_ptr = &status;
1481 
1482  if (feature)
1483  status_ptr = &feature->_status;
1484 
1485  // Update an existing feature's status or clear the flag on the passed in status
1486  *status_ptr &= ~Status::INACTIVE;
1487  return true;
1488  }
1489 
1494  return compareValueWithThreshold(entity_value, getConnectingThreshold(current_index));
1495 }
Status
This enumeration is used to indicate status of the grains in the _unique_grains data structure...
SubProblem & _subproblem
MPI_Status status
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
virtual Real getConnectingThreshold(std::size_t current_index) const
Return the "connecting" comparison threshold to use when inspecting an entity during the flood stage...
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid)=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
bool compareValueWithThreshold(Real entity_value, Real threshold) const
This method is used to determine whether the current entity value is part of a feature or not...
virtual Real getThreshold(std::size_t current_index) const
Return the starting comparison threshold to use when inspecting an entity during the flood stage...

◆ mergeSets()

void FeatureFloodCount::mergeSets ( )
protectedvirtual

This routine is called on the primary rank only and stitches together the partial feature pieces seen on any processor.

Insert the new entity at the end of the list so that it may be checked against all other partial features again.

Now remove both halves the merged features: it2 contains the "moved" feature cell just inserted at the back of the list, it1 contains the mostly empty other half. We have to be careful about the order in which these two elements are deleted. We delete it2 first since we don't care where its iterator points after the deletion. We are going to break out of this loop anyway. If we delete it1 first, it may end up pointing at the same location as it2 which after the second deletion would cause both of the iterators to be invalidated.

Reimplemented in PolycrystalUserObjectBase.

Definition at line 1138 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

1139 {
1140  TIME_SECTION("mergeSets", 3, "Merging Sets");
1141 
1142  // When working with _distribute_merge_work all of the maps will be empty except for one
1143  for (const auto map_num : make_range(_maps_size))
1144  {
1145  for (auto it1 = _partial_feature_sets[map_num].begin();
1146  it1 != _partial_feature_sets[map_num].end();
1147  /* No increment on it1 */)
1148  {
1149  bool merge_occured = false;
1150  for (auto it2 = _partial_feature_sets[map_num].begin();
1151  it2 != _partial_feature_sets[map_num].end();
1152  ++it2)
1153  {
1154  if (it1 != it2 && areFeaturesMergeable(*it1, *it2))
1155  {
1156  it2->merge(std::move(*it1));
1157 
1162  _partial_feature_sets[map_num].emplace_back(std::move(*it2));
1163 
1173  _partial_feature_sets[map_num].erase(it2);
1174  it1 = _partial_feature_sets[map_num].erase(it1); // it1 is incremented here!
1175 
1176  // A merge occurred, this is used to determine whether or not we increment the outer
1177  // iterator
1178  merge_occured = true;
1179 
1180  // We need to start the list comparison over for the new it1 so break here
1181  break;
1182  }
1183  } // it2 loop
1184 
1185  if (!merge_occured) // No merges so we need to manually increment the outer iterator
1186  ++it1;
1187 
1188  } // it1 loop
1189  } // map loop
1190 }
virtual bool areFeaturesMergeable(const FeatureData &f1, const FeatureData &f2) const
Method for determining whether two features are mergeable.
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
IntRange< T > make_range(T beg, T end)

◆ meshChanged()

void FeatureFloodCount::meshChanged ( )
overridevirtual

We need to build a set containing all of the boundary entities to compare against. This will be elements for elemental flooding. Volumes for nodal flooding is not supported

Reimplemented from GeneralPostprocessor.

Reimplemented in FauxPolycrystalVoronoi, and GrainTracker.

Definition at line 321 of file FeatureFloodCount.C.

Referenced by initialSetup(), and GrainTracker::meshChanged().

322 {
323  _point_locator = _mesh.getMesh().sub_point_locator();
324 
326 
327  // Build a new node to element map
328  _nodes_to_elem_map.clear();
329  MeshTools::build_nodes_to_elem_map(_mesh.getMesh(), _nodes_to_elem_map);
330 
336  _all_boundary_entity_ids.clear();
337  if (_is_elemental)
338  for (auto elem_it = _mesh.bndElemsBegin(), elem_end = _mesh.bndElemsEnd(); elem_it != elem_end;
339  ++elem_it)
340  _all_boundary_entity_ids.insert((*elem_it)->_elem->id());
341 }
virtual bnd_elem_iterator bndElemsEnd()
std::multimap< dof_id_type, dof_id_type > _periodic_node_map
The data structure which is a list of nodes that are constrained to other nodes based on the imposed ...
virtual bnd_elem_iterator bndElemsBegin()
MeshBase & getMesh()
unsigned long _var_number
This variable is used to build the periodic node map.
std::unique_ptr< PointLocatorBase > _point_locator
PeriodicBoundaries * _pbs
A pointer to the periodic boundary constraints object.
std::unordered_map< dof_id_type, std::vector< const Elem * > > _nodes_to_elem_map
The data structure used to find neighboring elements give a node ID.
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
MooseMesh & _mesh
A reference to the mesh.
void buildPeriodicNodeMap(std::multimap< dof_id_type, dof_id_type > &periodic_node_map, unsigned int var_number, PeriodicBoundaries *pbs) const
std::unordered_set< dof_id_type > _all_boundary_entity_ids
The set of entities on the boundary of the domain used for determining if features intersect any boun...

◆ numberOfDistributedMergeHelpers()

processor_id_type FeatureFloodCount::numberOfDistributedMergeHelpers ( ) const
protectedvirtual

Returns a number indicating the number of merge helpers when running in parallel based on certain implementer decided criteria.

This is a communication versus computation trade-off that we are almost always willing to make except for small problems. The decision however may be more complicated for some derived classes.

Reimplemented in PolycrystalUserObjectBase.

Definition at line 397 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

398 {
399  return _app.n_processors() >= _maps_size ? _maps_size : 1;
400 }
processor_id_type n_processors() const
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...

◆ numCoupledVars()

std::size_t FeatureFloodCount::numCoupledVars ( ) const
inline

Returns the number of coupled varaibles.

Definition at line 87 of file FeatureFloodCount.h.

87 { return _n_vars; }
const std::size_t _n_vars

◆ prepareDataForTransfer()

void FeatureFloodCount::prepareDataForTransfer ( )
protectedvirtual

This routine uses the local flooded data to build up the local feature data structures (_partial feature_sets).

This routine does not perform any communication so the _partial_feature_sets data structure will only contain information from the local processor after calling this routine. Any existing data in the _partial_feature_sets structure is destroyed by calling this routine.

_partial_feature_sets layout: The outer vector is sized to one when _single_map_mode == true, otherwise it is sized for the number of coupled variables. The inner list represents the flooded regions (local only after this call but fully populated after parallel communication and stitching).

If using a vector container, we need to sort all of the data structures for later operations such as checking for intersection and merging. The following "sort" function does nothing when invoked on a std::set.

Save off the min entity id present in the feature to uniquely identify the feature regardless of n_procs

Reimplemented in PolycrystalUserObjectBase.

Definition at line 1034 of file FeatureFloodCount.C.

Referenced by communicateAndMerge(), and PolycrystalUserObjectBase::prepareDataForTransfer().

1035 {
1036  TIME_SECTION("prepareDataForTransfer", 3, "Preparing Data For Transfer");
1037 
1038  MeshBase & mesh = _mesh.getMesh();
1039 
1040  FeatureData::container_type local_ids_no_ghost, set_difference;
1041 
1042  for (auto & list_ref : _partial_feature_sets)
1043  {
1044  for (auto & feature : list_ref)
1045  {
1046  // See if the feature intersects a boundary or perhaps one of the percolation boundaries.
1047  updateBoundaryIntersections(feature);
1048 
1049  // Periodic node ids
1050  appendPeriodicNeighborNodes(feature);
1051 
1057  FeatureFloodCount::sort(feature._ghosted_ids);
1058  FeatureFloodCount::sort(feature._local_ids);
1059  FeatureFloodCount::sort(feature._halo_ids);
1060  FeatureFloodCount::sort(feature._disjoint_halo_ids);
1061  FeatureFloodCount::sort(feature._periodic_nodes);
1062 
1063  // Now extend the bounding box by the halo region
1064  if (_is_elemental)
1065  feature.updateBBoxExtremes(mesh);
1066  else
1067  {
1068  for (auto & halo_id : feature._halo_ids)
1069  updateBBoxExtremesHelper(feature._bboxes[0], mesh.point(halo_id));
1070  }
1071 
1072  mooseAssert(!feature._local_ids.empty(), "local entity ids cannot be empty");
1073 
1078  feature._min_entity_id = *feature._local_ids.begin();
1079  }
1080  }
1081 }
std::vector< dof_id_type > container_type
The primary underlying container type used to hold the data in each FeatureData.
void appendPeriodicNeighborNodes(FeatureData &feature) const
This routine adds the periodic node information to our data structure prior to packing the data this ...
static void sort(std::set< T > &)
MeshBase & mesh
MeshBase & getMesh()
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
void updateBoundaryIntersections(FeatureData &feature) const
Update the feature&#39;s attributes to indicate boundary intersections.
void updateBBoxExtremesHelper(BoundingBox &bbox, const Point &node)
MooseMesh & _mesh
A reference to the mesh.

◆ reserve() [1/2]

template<class T >
static void FeatureFloodCount::reserve ( std::set< T > &  ,
std::size_t   
)
inlinestaticprivate

Definition at line 732 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount::FeatureData::consolidate(), FeatureFloodCount::FeatureData::merge(), and FeatureFloodCount::FeatureData::updateBBoxExtremes().

733  {
734  // Sets are trees, no reservations necessary
735  }

◆ reserve() [2/2]

template<class T >
static void FeatureFloodCount::reserve ( std::vector< T > &  container,
std::size_t  size 
)
inlinestaticprivate

Definition at line 738 of file FeatureFloodCount.h.

739  {
740  container.reserve(size);
741  }

◆ restoreOriginalDataStructures()

virtual void FeatureFloodCount::restoreOriginalDataStructures ( std::vector< std::list< FeatureData >> &  )
inlineprotectedvirtual

Reimplemented in PolycrystalUserObjectBase.

Definition at line 487 of file FeatureFloodCount.h.

Referenced by communicateAndMerge().

487 {}

◆ scatterAndUpdateRanks()

void FeatureFloodCount::scatterAndUpdateRanks ( )
protected

Calls buildLocalToGlobalIndices to build the individual local to global indicies for each rank and scatters that information to all ranks.

Finally, the non-primary ranks update their own data structures to reflect the global mappings.

On non-root processors we can't maintain the full _feature_sets data structure since we don't have all of the global information. We'll move the items from the partial feature sets into a flat structure maintaining order and update the internal IDs with the proper global ID.

Important: Make sure we clear the local status if we received a valid global index for this feature. It's possible that we have a status of INVALID on the local processor because there was never any starting threshold found. However, the root processor wouldn't have sent an index if it didn't find a starting threshold connected to our local piece.

Definition at line 710 of file FeatureFloodCount.C.

Referenced by GrainTracker::assignGrains(), finalize(), and GrainTracker::trackGrains().

711 {
712  // local to global map (one per processor)
713  std::vector<int> counts;
714  std::vector<std::size_t> local_to_global_all;
715  if (_is_primary)
716  buildLocalToGlobalIndices(local_to_global_all, counts);
717 
718  // Scatter local_to_global indices to all processors and store in class member variable
719  _communicator.scatter(local_to_global_all, counts, _local_to_global_feature_map);
720 
721  std::size_t largest_global_index = std::numeric_limits<std::size_t>::lowest();
722  if (!_is_primary)
723  {
725 
732  for (auto & list_ref : _partial_feature_sets)
733  {
734  for (auto & feature : list_ref)
735  {
736  mooseAssert(feature._orig_ids.size() == 1, "feature._orig_ids length doesn't make sense");
737 
738  auto global_index = FeatureFloodCount::invalid_size_t;
739  auto local_index = feature._orig_ids.begin()->second;
740 
741  if (local_index < _local_to_global_feature_map.size())
742  global_index = _local_to_global_feature_map[local_index];
743 
744  if (global_index != FeatureFloodCount::invalid_size_t)
745  {
746  if (global_index > largest_global_index)
747  largest_global_index = global_index;
748 
749  // Set the correct global index
750  feature._id = global_index;
751 
759  feature._status &= ~Status::INACTIVE;
760 
761  // Move the feature into the correct place
762  _feature_sets[local_index] = std::move(feature);
763  }
764  }
765  }
766  }
767  else
768  {
769  for (auto global_index : local_to_global_all)
770  if (global_index != FeatureFloodCount::invalid_size_t && global_index > largest_global_index)
771  largest_global_index = global_index;
772  }
773 
774  // communicate the boundary intersection state
775  std::vector<std::pair<unsigned int, int>> intersection_state;
776  for (auto & feature : _feature_sets)
777  intersection_state.emplace_back(feature._id, static_cast<int>(feature._boundary_intersection));
778 
779  // gather on root
780  _communicator.gather(0, intersection_state);
781 
782  // consolidate
783  std::map<unsigned int, int> consolidated_intersection_state;
784  if (_is_primary)
785  for (const auto & [id, state] : intersection_state)
786  consolidated_intersection_state[id] |= state;
787 
788  // broadcast result
789  _communicator.broadcast(consolidated_intersection_state, 0);
790 
791  // apply broadcast changes
792  for (auto & feature : _feature_sets)
793  feature._boundary_intersection |=
794  static_cast<BoundaryIntersection>(consolidated_intersection_state[feature._id]);
795 
796  buildFeatureIdToLocalIndices(largest_global_index);
797 }
void scatter(const std::vector< T, A > &data, T &recv, const unsigned int root_id=0) const
static const std::size_t invalid_size_t
void gather(const unsigned int root_id, const T &send_data, std::vector< T, A > &recv) const
Status
This enumeration is used to indicate status of the grains in the _unique_grains data structure...
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
const bool _is_primary
Convenience variable for testing primary rank.
const Parallel::Communicator & _communicator
virtual void buildLocalToGlobalIndices(std::vector< std::size_t > &local_to_global_all, std::vector< int > &counts) const
This routine populates a stacked vector of local to global indices per rank and the associated count ...
BoundaryIntersection
This enumeration is used to inidacate status of boundary intersections.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
void buildFeatureIdToLocalIndices(unsigned int max_id)
This method builds a lookup map for retrieving the right local feature (by index) given a global inde...
std::vector< std::size_t > _local_to_global_feature_map
The vector recording the local to global feature indices.

◆ serialize()

void FeatureFloodCount::serialize ( std::string &  serialized_buffer,
unsigned int  var_num = invalid_id 
)
protected

This routines packs the _partial_feature_sets data into a structure suitable for parallel communication operations.

Definition at line 1084 of file FeatureFloodCount.C.

Referenced by communicateAndMerge().

1085 {
1086  // stream for serializing the _partial_feature_sets data structure to a byte stream
1087  std::ostringstream oss;
1088 
1089  mooseAssert(var_num == invalid_id || var_num < _partial_feature_sets.size(),
1090  "var_num out of range");
1091 
1092  // Serialize everything
1093  if (var_num == invalid_id)
1094  dataStore(oss, _partial_feature_sets, this);
1095  else
1096  dataStore(oss, _partial_feature_sets[var_num], this);
1097 
1098  // Populate the passed in string pointer with the string stream's buffer contents
1099  serialized_buffer.assign(oss.str());
1100 }
void dataStore(std::ostream &stream, FeatureFloodCount::FeatureData &feature, void *context)
static const unsigned int invalid_id
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...

◆ sort() [1/2]

template<class T >
static void FeatureFloodCount::sort ( std::set< T > &  )
inlinestaticprivate

Definition at line 720 of file FeatureFloodCount.h.

Referenced by prepareDataForTransfer().

721  {
722  // Sets are already sorted, do nothing
723  }

◆ sort() [2/2]

template<class T >
static void FeatureFloodCount::sort ( std::vector< T > &  container)
inlinestaticprivate

Definition at line 726 of file FeatureFloodCount.h.

727  {
728  std::sort(container.begin(), container.end());
729  }

◆ sortAndLabel()

void FeatureFloodCount::sortAndLabel ( )
protected

Sort and assign ids to features based on their position in the container after sorting.

Perform a sort to give a parallel unique sorting to the identified features. We use the "min_entity_id" inside each feature to assign it's position in the sorted vector.

Sanity check. Now that we've sorted the flattened vector of features we need to make sure that the counts vector still lines up appropriately with each feature's _var_index.

Definition at line 568 of file FeatureFloodCount.C.

Referenced by GrainTracker::assignGrains(), and finalize().

569 {
570  mooseAssert(_is_primary, "sortAndLabel can only be called on the primary");
571 
577  std::sort(_feature_sets.begin(), _feature_sets.end());
578 
579 #ifndef NDEBUG
580 
585  unsigned int feature_offset = 0;
586  for (const auto map_num : make_range(_maps_size))
587  {
588  // Skip empty map checks
589  if (_feature_counts_per_map[map_num] == 0)
590  continue;
591 
592  // Check the begin and end of the current range
593  auto range_front = feature_offset;
594  auto range_back = feature_offset + _feature_counts_per_map[map_num] - 1;
595 
596  mooseAssert(range_front <= range_back && range_back < _feature_count,
597  "Indexing error in feature sets");
598 
599  if (!_single_map_mode && (_feature_sets[range_front]._var_index != map_num ||
600  _feature_sets[range_back]._var_index != map_num))
601  mooseError("Error in _feature_sets sorting, map index: ", map_num);
602 
603  feature_offset += _feature_counts_per_map[map_num];
604  }
605 #endif
606 
607  // Label the features with an ID based on the sorting (processor number independent value)
608  for (const auto i : index_range(_feature_sets))
609  if (_feature_sets[i]._id == invalid_id)
610  _feature_sets[i]._id = i;
611 }
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
const bool _is_primary
Convenience variable for testing primary rank.
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps...
static const unsigned int invalid_id
const bool _single_map_mode
This variable is used to indicate whether or not multiple maps are used during flooding.
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map) ...
IntRange< T > make_range(T beg, T end)
std::vector< unsigned int > _feature_counts_per_map
The number of features seen by this object per map.
void mooseError(Args &&... args) const
auto index_range(const T &sizable)

◆ updateBoundaryIntersections()

void FeatureFloodCount::updateBoundaryIntersections ( FeatureData feature) const
protected

Update the feature's attributes to indicate boundary intersections.

Definition at line 1772 of file FeatureFloodCount.C.

Referenced by prepareDataForTransfer().

1773 {
1774  if (_is_elemental)
1775  {
1776  for (auto entity : feature._local_ids)
1777  {
1778  // See if this feature is on a boundary if we haven't already figured that out
1779  if ((feature._boundary_intersection & BoundaryIntersection::ANY_BOUNDARY) ==
1781  {
1782  Elem * elem = _mesh.elemPtr(entity);
1783  if (elem && elem->on_boundary())
1784  feature._boundary_intersection |= BoundaryIntersection::ANY_BOUNDARY;
1785  }
1786 
1787  // Now see if the feature touches the primary and/or secondary boundary IDs if we haven't
1788  // figured that out already
1789  if ((feature._boundary_intersection & BoundaryIntersection::PRIMARY_PERCOLATION_BOUNDARY) ==
1791  {
1792  for (auto primary_id : _primary_perc_bnds)
1793  if (_mesh.isBoundaryElem(entity, primary_id))
1794  feature._boundary_intersection |= BoundaryIntersection::PRIMARY_PERCOLATION_BOUNDARY;
1795  }
1796 
1797  if ((feature._boundary_intersection & BoundaryIntersection::SECONDARY_PERCOLATION_BOUNDARY) ==
1799  {
1800  for (auto secondary_id : _secondary_perc_bnds)
1801  if (_mesh.isBoundaryElem(entity, secondary_id))
1802  feature._boundary_intersection |= BoundaryIntersection::SECONDARY_PERCOLATION_BOUNDARY;
1803  }
1804 
1805  // See if the feature contacts any of the user-specified boundaries if we haven't
1806  // done so already
1807  if ((feature._boundary_intersection & BoundaryIntersection::SPECIFIED_BOUNDARY) ==
1809  {
1810  for (auto specified_id : _specified_bnds)
1811  if (_mesh.isBoundaryElem(entity, specified_id))
1812  feature._boundary_intersection |= BoundaryIntersection::SPECIFIED_BOUNDARY;
1813  }
1814  }
1815  }
1816 }
std::vector< BoundaryID > _primary_perc_bnds
std::vector< BoundaryID > _specified_bnds
std::vector< BoundaryID > _secondary_perc_bnds
virtual Elem * elemPtr(const dof_id_type i)
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
bool isBoundaryElem(dof_id_type elem_id) const
MooseMesh & _mesh
A reference to the mesh.

◆ updateFieldInfo()

void FeatureFloodCount::updateFieldInfo ( )
protectedvirtual

This method is used to populate any of the data structures used for storing field data (nodal or elemental).

It is called at the end of finalize and can make use of any of the data structures created during the execution of this postprocessor.

Reimplemented in GrainTracker.

Definition at line 1282 of file FeatureFloodCount.C.

Referenced by finalize().

1283 {
1284  for (const auto i : index_range(_feature_sets))
1285  {
1286  auto & feature = _feature_sets[i];
1287 
1288  // If the developer has requested _condense_map_info we'll make sure we only update the zeroth
1289  // map
1290  auto map_index = (_single_map_mode || _condense_map_info) ? decltype(feature._var_index)(0)
1291  : feature._var_index;
1292 
1293  // Loop over the entity ids of this feature and update our local map
1294  for (auto entity : feature._local_ids)
1295  {
1296  _feature_maps[map_index][entity] = static_cast<int>(feature._id);
1297 
1298  if (_var_index_mode)
1299  _var_index_maps[map_index][entity] = feature._var_index;
1300 
1301  // Fill in the data structure that keeps track of all features per elem
1303  {
1304  auto insert_pair = moose_try_emplace(
1305  _entity_var_to_features, entity, std::vector<unsigned int>(_n_vars, invalid_id));
1306  auto & vec_ref = insert_pair.first->second;
1307  vec_ref[feature._var_index] = feature._id;
1308  }
1309  }
1310 
1311  if (_compute_halo_maps)
1312  // Loop over the halo ids to update cells with halo information
1313  for (auto entity : feature._halo_ids)
1314  _halo_ids[map_index][entity] = static_cast<int>(feature._id);
1315 
1316  // Loop over the ghosted ids to update cells with ghost information
1317  for (auto entity : feature._ghosted_ids)
1318  _ghosted_entity_ids[entity] = 1;
1319 
1320  // TODO: Fixme
1321  if (!_global_numbering)
1322  mooseError("Local numbering currently disabled");
1323  }
1324 }
const std::size_t _n_vars
const bool _condense_map_info
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
std::map< dof_id_type, std::vector< unsigned int > > _entity_var_to_features
std::pair< typename M::iterator, bool > moose_try_emplace(M &m, const typename M::key_type &k, Args &&... args)
std::map< dof_id_type, int > _ghosted_entity_ids
The map for holding reconstructed ghosted element information.
std::vector< std::map< dof_id_type, int > > _halo_ids
The data structure for looking up halos around features.
const bool _global_numbering
This variable is used to indicate whether or not we identify features with unique numbers on multiple...
static const unsigned int invalid_id
std::vector< std::map< dof_id_type, int > > _feature_maps
The feature maps contain the raw flooded node information and eventually the unique grain numbers...
const bool _single_map_mode
This variable is used to indicate whether or not multiple maps are used during flooding.
const bool _compute_halo_maps
Indicates whether or not to communicate halo map information with all ranks.
void mooseError(Args &&... args) const
const bool _compute_var_to_feature_map
Indicates whether or not the var to feature map is populated.
auto index_range(const T &sizable)
const bool _var_index_mode
This variable is used to indicate whether the maps will contain unique region information or just the...
std::vector< std::map< dof_id_type, int > > _var_index_maps
This map keeps track of which variables own which nodes.

◆ updateRegionOffsets()

void FeatureFloodCount::updateRegionOffsets ( )
protected

This routine updates the _region_offsets variable which is useful for quickly determining the proper global number for a feature when using multimap mode.

◆ validParams()

InputParameters FeatureFloodCount::validParams ( )
static

The FeatureFloodCount and derived objects should not to operate on the displaced mesh. These objects consume variable values from the nonlinear system and use a lot of raw geometric element information from the mesh. If you use the displaced system with EBSD information for instance, you'll have difficulties reconciling the difference between the coordinates from the EBSD data file and the potential displacements applied via boundary conditions.

Definition at line 99 of file FeatureFloodCount.C.

Referenced by GrainTracker::validParams(), GrainTrackerInterface::validParams(), and PolycrystalUserObjectBase::validParams().

100 {
103 
104  params.addRequiredCoupledVar(
105  "variable",
106  "The variable(s) for which to find connected regions of interests, i.e. \"features\".");
107  params.addParam<Real>(
108  "threshold", 0.5, "The threshold value for which a new feature may be started");
109  params.addParam<Real>(
110  "connecting_threshold",
111  "The threshold for which an existing feature may be extended (defaults to \"threshold\")");
112  params.addParam<bool>("use_single_map",
113  true,
114  "Determine whether information is tracked per "
115  "coupled variable or consolidated into one "
116  "(default: true)");
117  params.addParam<bool>(
118  "condense_map_info",
119  false,
120  "Determines whether we condense all the node values when in multimap mode (default: false)");
121  params.addParam<bool>("use_global_numbering",
122  true,
123  "Determine whether or not global numbers are "
124  "used to label features on multiple maps "
125  "(default: true)");
126  params.addParam<bool>("enable_var_coloring",
127  false,
128  "Instruct the Postprocessor to populate the variable index map.");
129  params.addParam<bool>(
130  "compute_halo_maps",
131  false,
132  "Instruct the Postprocessor to communicate proper halo information to all ranks");
133  params.addParam<bool>("compute_var_to_feature_map",
134  false,
135  "Instruct the Postprocessor to compute the active vars to features map");
136  params.addParam<bool>(
137  "use_less_than_threshold_comparison",
138  true,
139  "Controls whether features are defined to be less than or greater than the threshold value.");
140 
141  params.addParam<std::vector<BoundaryName>>(
142  "primary_percolation_boundaries",
143  "A list of boundaries used in conjunction with the corresponding "
144  "\"secondary_percolation_boundaries\" parameter for determining if a feature creates a path "
145  "connecting any pair of boundaries");
146  params.addParam<std::vector<BoundaryName>>(
147  "secondary_percolation_boundaries",
148  "Paired boundaries with \"primaryary_percolation_boundaries\" parameter");
149  params.addParam<std::vector<BoundaryName>>(
150  "specified_boundaries",
151  "An optional list of boundaries; if supplied, each feature is checked to determine whether "
152  "it intersects any of the specified boundaries in this list.");
153 
161  params.set<bool>("use_displaced_mesh") = false;
162 
163  // The FeatureFloodCount object does not require that any state (restartable information) is
164  // maintained. This Boolean is set to false so that we don't ask MOOSE to save a potentially
165  // large data structure for no reason. It is set for true in at least one derived class
166  // (GrainTracker).
167  params.addPrivateParam<bool>("restartable_required", false);
168 
169  params.addParamNamesToGroup(
170  "use_single_map condense_map_info use_global_numbering primary_percolation_boundaries",
171  "Advanced");
172 
173  MooseEnum flood_type("NODAL ELEMENTAL", "ELEMENTAL");
174  params.addParam<MooseEnum>("flood_entity_type",
175  flood_type,
176  "Determines whether the flood algorithm runs on nodes or elements");
177 
178  params.addClassDescription("The object is able to find and count \"connected components\" in any "
179  "solution field or number of solution fields. A primary example would "
180  "be to count \"bubbles\".");
181 
182  params.addRelationshipManager("ElementSideNeighborLayers",
185 
186  return params;
187 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
T & set(const std::string &name, bool quiet_mode=false)
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
static InputParameters validParams()
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

◆ visitElementalNeighbors()

void FeatureFloodCount::visitElementalNeighbors ( const Elem *  elem,
FeatureData feature,
bool  expand_halos_only,
bool  disjoint_only 
)
protected

Retrieve only the active neighbors for each side of this element, append them to the list of active neighbors

In general, {evaluable elements} >= {local elements} U {algebraic ghosting elements}. That is, the number of evaluable elements does NOT necessarily equal to the number of local and algebraic ghosting elements. The neighbors of evaluable elements can be remote even though we have two layers of geometric ghosting elements.

If the current element (passed into this method) doesn't have a connected neighbor but does have a topological neighbor, this might be a new disjoint region that we'll need to represent with a separate bounding box. To find out for sure, we'll need see if the new neighbors are present in any of the halo or disjoint halo sets. If they are not present, this is a new region.

In general, {evaluable elements} >= {local elements} U {algebraic ghosting elements}. That is, the number of evaluable elements does NOT necessarily equal to the number of local and algebraic ghosting elements. The neighbors of evaluable elements can be remote even though we have two layers of geometric ghosting elements.

This neighbor is NULL which means we need to expand the bounding box here in case this grain is up against multiple domain edges so we don't end up with a degenerate bounding box.

Definition at line 1616 of file FeatureFloodCount.C.

Referenced by expandEdgeHalos(), and flood().

1620 {
1621  mooseAssert(elem, "Elem is NULL");
1622 
1623  std::vector<const Elem *> all_active_neighbors;
1624  MeshBase & mesh = _mesh.getMesh();
1625 
1626  // Loop over all neighbors (at the the same level as the current element)
1627  for (const auto i : make_range(elem->n_neighbors()))
1628  {
1629  const Elem * neighbor_ancestor = nullptr;
1630  bool topological_neighbor = false;
1631 
1636  neighbor_ancestor = elem->neighbor_ptr(i);
1637 
1638  if (neighbor_ancestor)
1639  {
1646  if (neighbor_ancestor->is_remote())
1647  continue;
1648 
1649  neighbor_ancestor->active_family_tree_by_neighbor(all_active_neighbors, elem, false);
1650  }
1651  else
1652  {
1653  neighbor_ancestor = elem->topological_neighbor(i, mesh, *_point_locator, _pbs);
1654 
1662  if (neighbor_ancestor)
1663  {
1670  if (neighbor_ancestor->is_remote())
1671  continue;
1672 
1673  neighbor_ancestor->active_family_tree_by_topological_neighbor(
1674  all_active_neighbors, elem, mesh, *_point_locator, _pbs, false);
1675 
1676  topological_neighbor = true;
1677  }
1678  else
1679  {
1685  updateBBoxExtremesHelper(feature->_bboxes[0], *elem);
1686  }
1687  }
1688 
1689  visitNeighborsHelper(elem,
1690  all_active_neighbors,
1691  feature,
1692  expand_halos_only,
1693  topological_neighbor,
1694  disjoint_only);
1695 
1696  all_active_neighbors.clear();
1697  }
1698 }
MeshBase & mesh
MeshBase & getMesh()
std::unique_ptr< PointLocatorBase > _point_locator
PeriodicBoundaries * _pbs
A pointer to the periodic boundary constraints object.
void visitNeighborsHelper(const T *curr_entity, std::vector< const T *> neighbor_entities, FeatureData *feature, bool expand_halos_only, bool topological_neighbor, bool disjoint_only)
The actual logic for visiting neighbors is abstracted out here.
IntRange< T > make_range(T beg, T end)
void updateBBoxExtremesHelper(BoundingBox &bbox, const Point &node)
MooseMesh & _mesh
A reference to the mesh.

◆ visitNeighborsHelper()

template<typename T >
void FeatureFloodCount::visitNeighborsHelper ( const T *  curr_entity,
std::vector< const T *>  neighbor_entities,
FeatureData feature,
bool  expand_halos_only,
bool  topological_neighbor,
bool  disjoint_only 
)
protected

The actual logic for visiting neighbors is abstracted out here.

This method is templated to handle the Nodal and Elemental cases together.

Only recurse where we own this entity and it's a topologically connected entity. We shouldn't even attempt to flood to the periodic boundary because we won't have solution information and if we are using DistributedMesh we probably won't have geometric information either.

When we only recurse on entities we own, we can never get more than one away from a local entity which should be in the ghosted zone.

Premark neighboring entities with a halo mark. These entities may or may not end up being part of the feature. We will not update the _entities_visited data structure here.

Definition at line 1715 of file FeatureFloodCount.C.

Referenced by visitElementalNeighbors(), and visitNodalNeighbors().

1721 {
1722  // Loop over all active element neighbors
1723  for (const auto neighbor : neighbor_entities)
1724  {
1725  if (neighbor && (!_is_boundary_restricted || isBoundaryEntity(neighbor)))
1726  {
1727  if (expand_halos_only)
1728  {
1729  auto entity_id = neighbor->id();
1730 
1731  if (topological_neighbor || disjoint_only)
1732  feature->_disjoint_halo_ids.insert(feature->_disjoint_halo_ids.end(), entity_id);
1733  else if (!FeatureFloodCount::contains(feature->_local_ids, entity_id))
1734  feature->_halo_ids.insert(feature->_halo_ids.end(), entity_id);
1735  }
1736  else
1737  {
1738  auto my_processor_id = processor_id();
1739 
1740  if (!topological_neighbor && neighbor->processor_id() != my_processor_id)
1741  feature->_ghosted_ids.insert(feature->_ghosted_ids.end(), curr_entity->id());
1742 
1752  if (curr_entity->processor_id() == my_processor_id ||
1753  neighbor->processor_id() == my_processor_id)
1754  {
1761  if (topological_neighbor || disjoint_only)
1762  feature->_disjoint_halo_ids.insert(feature->_disjoint_halo_ids.end(), neighbor->id());
1763  else
1764  _entity_queue.push_front(neighbor);
1765  }
1766  }
1767  }
1768  }
1769 }
bool isBoundaryEntity(const T *entity) const
Returns a Boolean indicating whether the entity is on one of the desired boundaries.
static bool contains(std::set< T > &container, const T &item)
bool _is_boundary_restricted
Indicates that this object should only run on one or more boundaries.
processor_id_type processor_id() const
std::deque< const DofObject * > _entity_queue
The data structure for maintaining entities to flood during discovery.

◆ visitNodalNeighbors()

void FeatureFloodCount::visitNodalNeighbors ( const Node *  node,
FeatureData feature,
bool  expand_halos_only 
)
protected

These two routines are utility routines used by the flood routine and by derived classes for visiting neighbors.

Since the logic is different for the elemental versus nodal case it's easier to split them up.

Definition at line 1701 of file FeatureFloodCount.C.

Referenced by expandEdgeHalos(), and flood().

1704 {
1705  mooseAssert(node, "Node is NULL");
1706 
1707  std::vector<const Node *> all_active_neighbors;
1708  MeshTools::find_nodal_neighbors(_mesh.getMesh(), *node, _nodes_to_elem_map, all_active_neighbors);
1709 
1710  visitNeighborsHelper(node, all_active_neighbors, feature, expand_halos_only, false, false);
1711 }
MeshBase & getMesh()
std::unordered_map< dof_id_type, std::vector< const Elem * > > _nodes_to_elem_map
The data structure used to find neighboring elements give a node ID.
void visitNeighborsHelper(const T *curr_entity, std::vector< const T *> neighbor_entities, FeatureData *feature, bool expand_halos_only, bool topological_neighbor, bool disjoint_only)
The actual logic for visiting neighbors is abstracted out here.
MooseMesh & _mesh
A reference to the mesh.

Member Data Documentation

◆ _all_boundary_entity_ids

std::unordered_set<dof_id_type> FeatureFloodCount::_all_boundary_entity_ids
protected

The set of entities on the boundary of the domain used for determining if features intersect any boundary.

Definition at line 695 of file FeatureFloodCount.h.

Referenced by meshChanged().

◆ _bnd_elem_range

ConstBndElemRange* FeatureFloodCount::_bnd_elem_range
protected

Boundary element range pointer.

Definition at line 713 of file FeatureFloodCount.h.

Referenced by execute(), and isBoundaryEntity().

◆ _compute_halo_maps

const bool FeatureFloodCount::_compute_halo_maps
protected

Indicates whether or not to communicate halo map information with all ranks.

Definition at line 588 of file FeatureFloodCount.h.

Referenced by GrainTracker::communicateHaloMap(), GrainTracker::meshChanged(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _compute_var_to_feature_map

const bool FeatureFloodCount::_compute_var_to_feature_map
protected

Indicates whether or not the var to feature map is populated.

Definition at line 591 of file FeatureFloodCount.h.

Referenced by getVarToFeatureVector(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _condense_map_info

const bool FeatureFloodCount::_condense_map_info
protected

Definition at line 577 of file FeatureFloodCount.h.

Referenced by GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _connecting_threshold

const Real FeatureFloodCount::_connecting_threshold
protected

The threshold above (or below) which neighboring entities are flooded (where regions can be extended but not started)

Definition at line 561 of file FeatureFloodCount.h.

Referenced by initialize().

◆ _dof_map

const DofMap& FeatureFloodCount::_dof_map
protected

Reference to the dof_map containing the coupled variables.

Definition at line 553 of file FeatureFloodCount.h.

Referenced by flood().

◆ _element_average_value

const PostprocessorValue& FeatureFloodCount::_element_average_value
protected

Average value of the domain which can optionally be used to find features in a field.

Definition at line 676 of file FeatureFloodCount.h.

Referenced by initialize().

◆ _empty_var_to_features

std::vector<unsigned int> FeatureFloodCount::_empty_var_to_features
protected

Definition at line 699 of file FeatureFloodCount.h.

Referenced by getVarToFeatureVector(), and initialSetup().

◆ _entities_visited

std::vector<std::set<dof_id_type> > FeatureFloodCount::_entities_visited
protected

This variable keeps track of which nodes have been visited during execution.

We don't use the _feature_map for this since we don't want to explicitly store data for all the unmarked nodes in a serialized datastructures. This keeps our overhead down since this variable never needs to be communicated.

Definition at line 615 of file FeatureFloodCount.h.

Referenced by PolycrystalUserObjectBase::execute(), flood(), initialize(), initialSetup(), and PolycrystalUserObjectBase::isNewFeatureOrConnectedRegion().

◆ _entity_queue

std::deque<const DofObject *> FeatureFloodCount::_entity_queue
private

The data structure for maintaining entities to flood during discovery.

Definition at line 759 of file FeatureFloodCount.h.

Referenced by flood(), and visitNeighborsHelper().

◆ _entity_var_to_features

std::map<dof_id_type, std::vector<unsigned int> > FeatureFloodCount::_entity_var_to_features
protected

◆ _fe_vars

std::vector<MooseVariableFEBase *> FeatureFloodCount::_fe_vars
protected

The vector of coupled in variables.

Definition at line 548 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), and getFECoupledVars().

◆ _feature_count

unsigned int FeatureFloodCount::_feature_count
protected

◆ _feature_counts_per_map

std::vector<unsigned int> FeatureFloodCount::_feature_counts_per_map
protected

The number of features seen by this object per map.

Definition at line 629 of file FeatureFloodCount.h.

Referenced by consolidateMergedFeatures(), PolycrystalUserObjectBase::prepareDataForTransfer(), sortAndLabel(), and GrainTracker::trackGrains().

◆ _feature_id_to_local_index

std::vector<std::size_t> FeatureFloodCount::_feature_id_to_local_index
protected

◆ _feature_maps

std::vector<std::map<dof_id_type, int> > FeatureFloodCount::_feature_maps
protected

The feature maps contain the raw flooded node information and eventually the unique grain numbers.

We have a vector of them so we can create one per variable if that level of detail is desired.

Definition at line 662 of file FeatureFloodCount.h.

Referenced by getEntityValue(), initialize(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _feature_sets

std::vector<FeatureData>& FeatureFloodCount::_feature_sets
protected

◆ _ghosted_entity_ids

std::map<dof_id_type, int> FeatureFloodCount::_ghosted_entity_ids
protected

The map for holding reconstructed ghosted element information.

Definition at line 679 of file FeatureFloodCount.h.

Referenced by getEntityValue(), initialize(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _global_numbering

const bool FeatureFloodCount::_global_numbering
protected

This variable is used to indicate whether or not we identify features with unique numbers on multiple maps.

Definition at line 581 of file FeatureFloodCount.h.

Referenced by updateFieldInfo().

◆ _halo_ids

std::vector<std::map<dof_id_type, int> > FeatureFloodCount::_halo_ids
protected

The data structure for looking up halos around features.

The outer vector is for splitting out the information per variable. The inner map holds the actual halo information

Definition at line 685 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount::FeatureData::clear(), GrainTracker::communicateHaloMap(), getEntityValue(), FeatureFloodCount::FeatureData::halosIntersect(), initialize(), FeatureFloodCount::FeatureData::merge(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _is_boundary_restricted

bool FeatureFloodCount::_is_boundary_restricted
protected

Indicates that this object should only run on one or more boundaries.

Definition at line 710 of file FeatureFloodCount.h.

Referenced by execute(), FeatureFloodCount(), and visitNeighborsHelper().

◆ _is_elemental

const bool FeatureFloodCount::_is_elemental
protected

◆ _is_primary

const bool FeatureFloodCount::_is_primary
protected

◆ _local_to_global_feature_map

std::vector<std::size_t> FeatureFloodCount::_local_to_global_feature_map
protected

The vector recording the local to global feature indices.

Definition at line 665 of file FeatureFloodCount.h.

Referenced by scatterAndUpdateRanks().

◆ _maps_size

const std::size_t FeatureFloodCount::_maps_size
protected

◆ _mesh

MooseMesh& FeatureFloodCount::_mesh
protected

◆ _n_procs

const processor_id_type FeatureFloodCount::_n_procs
protected

Convenience variable holding the number of processors in this simulation.

Definition at line 607 of file FeatureFloodCount.h.

Referenced by buildLocalToGlobalIndices(), and GrainTracker::communicateHaloMap().

◆ _n_vars

const std::size_t FeatureFloodCount::_n_vars
protected

◆ _nodes_to_elem_map

std::unordered_map<dof_id_type, std::vector<const Elem *> > FeatureFloodCount::_nodes_to_elem_map
protected

The data structure used to find neighboring elements give a node ID.

Definition at line 626 of file FeatureFloodCount.h.

Referenced by meshChanged(), and visitNodalNeighbors().

◆ _partial_feature_sets

std::vector<std::list<FeatureData> > FeatureFloodCount::_partial_feature_sets
protected

The data structure used to hold partial and communicated feature data, during the discovery and merging phases.

The outer vector is indexed by map number (often variable number). The inner list is an unordered list of partially discovered features.

Definition at line 639 of file FeatureFloodCount.h.

Referenced by communicateAndMerge(), consolidateMergedFeatures(), deserialize(), expandEdgeHalos(), expandPointHalos(), flood(), initialize(), PolycrystalUserObjectBase::mergeSets(), mergeSets(), PolycrystalUserObjectBase::prepareDataForTransfer(), prepareDataForTransfer(), GrainTracker::prepopulateState(), scatterAndUpdateRanks(), and serialize().

◆ _pbs

PeriodicBoundaries* FeatureFloodCount::_pbs
protected

A pointer to the periodic boundary constraints object.

Definition at line 671 of file FeatureFloodCount.h.

Referenced by initialSetup(), PolycrystalUserObjectBase::isNewFeatureOrConnectedRegion(), meshChanged(), and visitElementalNeighbors().

◆ _periodic_node_map

std::multimap<dof_id_type, dof_id_type> FeatureFloodCount::_periodic_node_map
protected

The data structure which is a list of nodes that are constrained to other nodes based on the imposed periodic boundary conditions.

Definition at line 691 of file FeatureFloodCount.h.

Referenced by appendPeriodicNeighborNodes(), FauxGrainTracker::getEntityValue(), getEntityValue(), and meshChanged().

◆ _point_locator

std::unique_ptr<PointLocatorBase> FeatureFloodCount::_point_locator
protected

◆ _primary_perc_bnds

std::vector<BoundaryID> FeatureFloodCount::_primary_perc_bnds
protected

Definition at line 701 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), and updateBoundaryIntersections().

◆ _secondary_perc_bnds

std::vector<BoundaryID> FeatureFloodCount::_secondary_perc_bnds
protected

Definition at line 702 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), and updateBoundaryIntersections().

◆ _single_map_mode

const bool FeatureFloodCount::_single_map_mode
protected

This variable is used to indicate whether or not multiple maps are used during flooding.

Definition at line 575 of file FeatureFloodCount.h.

Referenced by flood(), PolycrystalUserObjectBase::PolycrystalUserObjectBase(), sortAndLabel(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _specified_bnds

std::vector<BoundaryID> FeatureFloodCount::_specified_bnds
protected

Definition at line 704 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), and updateBoundaryIntersections().

◆ _step_connecting_threshold

Real FeatureFloodCount::_step_connecting_threshold
protected

Definition at line 562 of file FeatureFloodCount.h.

Referenced by getConnectingThreshold(), and initialize().

◆ _step_threshold

Real FeatureFloodCount::_step_threshold
protected

Definition at line 557 of file FeatureFloodCount.h.

Referenced by GrainTracker::getThreshold(), getThreshold(), and initialize().

◆ _threshold

const Real FeatureFloodCount::_threshold
protected

The threshold above (or below) where an entity may begin a new region (feature)

Definition at line 556 of file FeatureFloodCount.h.

Referenced by FauxGrainTracker::execute(), and initialize().

◆ _use_less_than_threshold_comparison

const bool FeatureFloodCount::_use_less_than_threshold_comparison
protected

Use less-than when comparing values against the threshold value.

True by default. If false, then greater-than comparison is used instead.

Definition at line 598 of file FeatureFloodCount.h.

Referenced by compareValueWithThreshold(), and FauxGrainTracker::execute().

◆ _var_index_maps

std::vector<std::map<dof_id_type, int> > FeatureFloodCount::_var_index_maps
protected

This map keeps track of which variables own which nodes.

We need a vector of them for multimap mode where multiple variables can own a single mode.

Note: This map is only populated when "show_var_coloring" is set to true.

Definition at line 623 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), getEntityValue(), initialize(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _var_index_mode

const bool FeatureFloodCount::_var_index_mode
protected

This variable is used to indicate whether the maps will contain unique region information or just the variable numbers owning those regions.

Definition at line 585 of file FeatureFloodCount.h.

Referenced by FeatureFloodCount(), getEntityValue(), initialize(), GrainTracker::updateFieldInfo(), and updateFieldInfo().

◆ _var_number

unsigned long FeatureFloodCount::_var_number
protected

This variable is used to build the periodic node map.

Assumption: We are going to assume that either all variables are periodic or none are. This assumption can be relaxed at a later time if necessary.

Definition at line 572 of file FeatureFloodCount.h.

Referenced by GrainTracker::centroidRegionDistance(), and meshChanged().

◆ _vars

std::vector<MooseVariable *> FeatureFloodCount::_vars
protected

◆ _volatile_feature_sets

std::vector<FeatureData> FeatureFloodCount::_volatile_feature_sets
protected

Derived objects (e.g.

the GrainTracker) may require restartable data to track information across time steps. The FeatureFloodCounter however does not. This container is here so that we have the flexabilty to switch between volatile and non-volatile storage. The _feature_sets data structure can conditionally refer to this structure or a MOOSE-provided structure, which is backed up.

Definition at line 655 of file FeatureFloodCount.h.

◆ invalid_id

const unsigned int FeatureFloodCount::invalid_id = std::numeric_limits<unsigned int>::max()
static

◆ invalid_proc_id

const processor_id_type FeatureFloodCount::invalid_proc_id
static
Initial value:
=
std::numeric_limits<processor_id_type>::max()

Definition at line 93 of file FeatureFloodCount.h.

Referenced by PolycrystalUserObjectBase::numberOfDistributedMergeHelpers().

◆ invalid_size_t

const std::size_t FeatureFloodCount::invalid_size_t = std::numeric_limits<std::size_t>::max()
static

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