www.mooseframework.org
Functions
FeatureFloodCount.C File Reference

Go to the source code of this file.

Functions

template<>
void dataStore (std::ostream &stream, FeatureFloodCount::FeatureData &feature, void *context)
 
template<>
void dataStore (std::ostream &stream, BoundingBox &bbox, void *context)
 
template<>
void dataLoad (std::istream &stream, FeatureFloodCount::FeatureData &feature, void *context)
 
template<>
void dataLoad (std::istream &stream, BoundingBox &bbox, void *context)
 
void updateBBoxExtremesHelper (BoundingBox &bbox, const Point &node)
 
void updateBBoxExtremesHelper (BoundingBox &bbox, const Elem &elem)
 
bool areElemListsMergeable (const std::list< dof_id_type > &elem_list1, const std::list< dof_id_type > &elem_list2, MeshBase &mesh)
 
 registerMooseObject ("PhaseFieldApp", FeatureFloodCount)
 
template<>
InputParameters validParams< FeatureFloodCount > ()
 
std::ostream & operator<< (std::ostream &out, const FeatureFloodCount::FeatureData &feature)
 

Function Documentation

◆ areElemListsMergeable()

bool areElemListsMergeable ( const std::list< dof_id_type > &  elem_list1,
const std::list< dof_id_type > &  elem_list2,
MeshBase &  mesh 
)

Definition at line 2222 of file FeatureFloodCount.C.

2226 {
2227  for (const auto elem_id1 : elem_list1)
2228  {
2229  const auto * elem1 = mesh.elem_ptr(elem_id1);
2230  for (const auto elem_id2 : elem_list2)
2231  {
2232  const auto * elem2 = mesh.elem_ptr(elem_id2);
2233  if (elem1->has_neighbor(elem2))
2234  return true;
2235  }
2236  }
2237  return false;

Referenced by FeatureFloodCount::FeatureData::updateBBoxExtremes().

◆ dataLoad() [1/2]

template<>
void dataLoad ( std::istream &  stream,
BoundingBox &  bbox,
void *  context 
)

Definition at line 87 of file FeatureFloodCount.C.

88 {
89  loadHelper(stream, bbox.min(), context);
90  loadHelper(stream, bbox.max(), context);
91 }

◆ dataLoad() [2/2]

template<>
void dataLoad ( std::istream &  stream,
FeatureFloodCount::FeatureData feature,
void *  context 
)

Note that _local_ids is not loaded here. It's not needed for restart, and not needed during the parallel merge operation

Definition at line 64 of file FeatureFloodCount.C.

65 {
70  loadHelper(stream, feature._ghosted_ids, context);
71  loadHelper(stream, feature._halo_ids, context);
72  loadHelper(stream, feature._disjoint_halo_ids, context);
73  loadHelper(stream, feature._periodic_nodes, context);
74  loadHelper(stream, feature._var_index, context);
75  loadHelper(stream, feature._id, context);
76  loadHelper(stream, feature._bboxes, context);
77  loadHelper(stream, feature._orig_ids, context);
78  loadHelper(stream, feature._min_entity_id, context);
79  loadHelper(stream, feature._vol_count, context);
80  loadHelper(stream, feature._centroid, context);
81  loadHelper(stream, feature._status, context);
82  loadHelper(stream, feature._boundary_intersection, context);
83 }

Referenced by FeatureFloodCount::deserialize().

◆ dataStore() [1/2]

template<>
void dataStore ( std::ostream &  stream,
BoundingBox &  bbox,
void *  context 
)

Definition at line 56 of file FeatureFloodCount.C.

57 {
58  storeHelper(stream, bbox.min(), context);
59  storeHelper(stream, bbox.max(), context);
60 }

◆ dataStore() [2/2]

template<>
void dataStore ( std::ostream &  stream,
FeatureFloodCount::FeatureData feature,
void *  context 
)

Note that _local_ids is not stored here. It's not needed for restart, and not needed during the parallel merge operation

Definition at line 33 of file FeatureFloodCount.C.

34 {
39  storeHelper(stream, feature._ghosted_ids, context);
40  storeHelper(stream, feature._halo_ids, context);
41  storeHelper(stream, feature._disjoint_halo_ids, context);
42  storeHelper(stream, feature._periodic_nodes, context);
43  storeHelper(stream, feature._var_index, context);
44  storeHelper(stream, feature._id, context);
45  storeHelper(stream, feature._bboxes, context);
46  storeHelper(stream, feature._orig_ids, context);
47  storeHelper(stream, feature._min_entity_id, context);
48  storeHelper(stream, feature._vol_count, context);
49  storeHelper(stream, feature._centroid, context);
50  storeHelper(stream, feature._status, context);
51  storeHelper(stream, feature._boundary_intersection, context);
52 }

Referenced by FeatureFloodCount::serialize().

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const FeatureFloodCount::FeatureData feature 
)

Definition at line 2138 of file FeatureFloodCount.C.

2139 {
2140  static const bool debug = true;
2141 
2142  out << "Grain ID: ";
2143  if (feature._id != FeatureFloodCount::invalid_id)
2144  out << feature._id;
2145  else
2146  out << "invalid";
2147 
2148  if (debug)
2149  {
2150  out << "\nGhosted Entities: ";
2151  for (auto ghosted_id : feature._ghosted_ids)
2152  out << ghosted_id << " ";
2153 
2154  out << "\nLocal Entities: ";
2155  for (auto local_id : feature._local_ids)
2156  out << local_id << " ";
2157 
2158  out << "\nHalo Entities: ";
2159  for (auto halo_id : feature._halo_ids)
2160  out << halo_id << " ";
2161 
2162  out << "\nPeriodic Node IDs: ";
2163  for (auto periodic_node : feature._periodic_nodes)
2164  out << periodic_node << " ";
2165  }
2166 
2167  out << "\nBBoxes:";
2168  Real volume = 0;
2169  for (const auto & bbox : feature._bboxes)
2170  {
2171  out << "\nMax: " << bbox.max() << " Min: " << bbox.min();
2172  volume += (bbox.max()(0) - bbox.min()(0)) * (bbox.max()(1) - bbox.min()(1)) *
2173  (MooseUtils::absoluteFuzzyEqual(bbox.max()(2), bbox.min()(2))
2174  ? 1
2175  : bbox.max()(2) - bbox.min()(2));
2176  }
2177 
2178  out << "\nStatus: ";
2180  out << "CLEAR";
2181  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::MARKED))
2182  out << " MARKED";
2183  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::DIRTY))
2184  out << " DIRTY";
2185  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::INACTIVE))
2186  out << " INACTIVE";
2187 
2188  if (debug)
2189  {
2190  out << "\nOrig IDs (rank, index): ";
2191  for (const auto & orig_pair : feature._orig_ids)
2192  out << '(' << orig_pair.first << ", " << orig_pair.second << ") ";
2193  out << "\nVar_index: " << feature._var_index;
2194  out << "\nMin Entity ID: " << feature._min_entity_id;
2195  }
2196  out << "\n\n";
2197 
2198  return out;
2199 }

◆ registerMooseObject()

registerMooseObject ( "PhaseFieldApp"  ,
FeatureFloodCount   
)

◆ updateBBoxExtremesHelper() [1/2]

void updateBBoxExtremesHelper ( BoundingBox &  bbox,
const Elem &  elem 
)

Definition at line 2215 of file FeatureFloodCount.C.

2217 {
2218  for (MooseIndex(elem.n_nodes()) node_n = 0; node_n < elem.n_nodes(); ++node_n)
2219  updateBBoxExtremesHelper(bbox, *(elem.node_ptr(node_n)));

◆ updateBBoxExtremesHelper() [2/2]

void updateBBoxExtremesHelper ( BoundingBox &  bbox,
const Point &  node 
)

Definition at line 2205 of file FeatureFloodCount.C.

2207 {
2208  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
2209  {
2210  bbox.min()(i) = std::min(bbox.min()(i), node(i));
2211  bbox.max()(i) = std::max(bbox.max()(i), node(i));
2212  }

Referenced by FeatureFloodCount::prepareDataForTransfer(), FeatureFloodCount::FeatureData::updateBBoxExtremes(), updateBBoxExtremesHelper(), and FeatureFloodCount::visitElementalNeighbors().

◆ validParams< FeatureFloodCount >()

template<>
InputParameters validParams< FeatureFloodCount > ( )

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 104 of file FeatureFloodCount.C.

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

Referenced by validParams< GrainTracker >(), validParams< GrainTrackerInterface >(), and validParams< PolycrystalUserObjectBase >().

FeatureFloodCount::FeatureData::_id
unsigned int _id
An ID for this feature.
Definition: FeatureFloodCount.h:287
FeatureFloodCount::FeatureData::_disjoint_halo_ids
container_type _disjoint_halo_ids
Holds halo ids that extend onto a non-topologically connected surface.
Definition: FeatureFloodCount.h:278
FeatureFloodCount::FeatureData::_boundary_intersection
BoundaryIntersection _boundary_intersection
Enumaration indicating boundary intersection status.
Definition: FeatureFloodCount.h:310
FeatureFloodCount::FeatureData::_min_entity_id
dof_id_type _min_entity_id
The minimum entity seen in the _local_ids, used for sorting features.
Definition: FeatureFloodCount.h:297
FeatureFloodCount::Status::CLEAR
FeatureFloodCount::FeatureData::_ghosted_ids
container_type _ghosted_ids
Holds the ghosted ids for a feature (the ids which will be used for stitching.
Definition: FeatureFloodCount.h:268
FeatureFloodCount::FeatureData::_halo_ids
container_type _halo_ids
Holds the ids surrounding the feature.
Definition: FeatureFloodCount.h:275
FeatureFloodCount::FeatureData::_orig_ids
std::list< std::pair< processor_id_type, unsigned int > > _orig_ids
Original processor/local ids.
Definition: FeatureFloodCount.h:294
updateBBoxExtremesHelper
void updateBBoxExtremesHelper(BoundingBox &bbox, const Point &node)
Definition: FeatureFloodCount.C:2205
FeatureFloodCount::invalid_id
static const unsigned int invalid_id
Definition: FeatureFloodCount.h:94
FeatureFloodCount::Status::INACTIVE
FeatureFloodCount::FeatureData::_periodic_nodes
container_type _periodic_nodes
Holds the nodes that belong to the feature on a periodic boundary.
Definition: FeatureFloodCount.h:281
FeatureFloodCount::FeatureData::_var_index
std::size_t _var_index
The Moose variable where this feature was found (often the "order parameter")
Definition: FeatureFloodCount.h:284
FeatureFloodCount::FeatureData::_centroid
Point _centroid
The centroid of the feature (average of coordinates from entities participating in the volume calcula...
Definition: FeatureFloodCount.h:304
FeatureFloodCount::FeatureData::_local_ids
container_type _local_ids
Holds the local ids in the interior of a feature.
Definition: FeatureFloodCount.h:272
FeatureFloodCount::Status::DIRTY
FeatureFloodCount::FeatureData::_vol_count
std::size_t _vol_count
The count of entities contributing to the volume calculation.
Definition: FeatureFloodCount.h:300
FeatureFloodCount::FeatureData::_bboxes
std::vector< BoundingBox > _bboxes
The vector of bounding boxes completely enclosing this feature (multiple used with periodic constrain...
Definition: FeatureFloodCount.h:291
FeatureFloodCount::FeatureData::_status
Status _status
The status of a feature (used mostly in derived classes like the GrainTracker)
Definition: FeatureFloodCount.h:307
FeatureFloodCount::Status::MARKED