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, MeshTools::BoundingBox &bbox, void *context)
 
template<>
void dataLoad (std::istream &stream, FeatureFloodCount::FeatureData &feature, void *context)
 
template<>
void dataLoad (std::istream &stream, MeshTools::BoundingBox &bbox, void *context)
 
void updateBBoxExtremesHelper (MeshTools::BoundingBox &bbox, const Point &node)
 
void updateBBoxExtremesHelper (MeshTools::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)
 
template<>
InputParameters validParams< FeatureFloodCount > ()
 
std::ostream & operator<< (std::ostream &out, const FeatureFloodCount::FeatureData &feature)
 

Function Documentation

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

Definition at line 1788 of file FeatureFloodCount.C.

Referenced by dataLoad(), and FeatureFloodCount::FeatureData::updateBBoxExtremes().

1791 {
1792  for (const auto elem_id1 : elem_list1)
1793  {
1794  const auto * elem1 = mesh.elem_ptr(elem_id1);
1795  for (const auto elem_id2 : elem_list2)
1796  {
1797  const auto * elem2 = mesh.elem_ptr(elem_id2);
1798  if (elem1->has_neighbor(elem2))
1799  return true;
1800  }
1801  }
1802  return false;
1803 }
template<>
void dataLoad ( std::istream &  stream,
FeatureFloodCount::FeatureData feature,
void *  context 
)

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

Definition at line 60 of file FeatureFloodCount.C.

Referenced by FeatureFloodCount::deserialize().

61 {
66  loadHelper(stream, feature._ghosted_ids, context);
67  loadHelper(stream, feature._halo_ids, context);
68  loadHelper(stream, feature._disjoint_halo_ids, context);
69  loadHelper(stream, feature._periodic_nodes, context);
70  loadHelper(stream, feature._var_index, context);
71  loadHelper(stream, feature._id, context);
72  loadHelper(stream, feature._bboxes, context);
73  loadHelper(stream, feature._orig_ids, context);
74  loadHelper(stream, feature._min_entity_id, context);
75  loadHelper(stream, feature._vol_count, context);
76  loadHelper(stream, feature._centroid, context);
77  loadHelper(stream, feature._status, context);
78  loadHelper(stream, feature._intersects_boundary, context);
79 }
Point _centroid
The centroid of the feature (average of coordinates from entities participating in the volume calcula...
std::set< dof_id_type > _periodic_nodes
Holds the nodes that belong to the feature on a periodic boundary.
std::vector< MeshTools::BoundingBox > _bboxes
The vector of bounding boxes completely enclosing this feature (multiple used with periodic constrain...
std::set< dof_id_type > _disjoint_halo_ids
Holds halo ids that extend onto a non-topologically connected surface.
dof_id_type _min_entity_id
The minimum entity seen in the _local_ids, used for sorting features.
std::size_t _var_index
The Moose variable where this feature was found (often the "order parameter")
std::set< dof_id_type > _halo_ids
Holds the ids surrounding the feature.
std::list< std::pair< processor_id_type, unsigned int > > _orig_ids
Original processor/local ids.
Status _status
The status of a feature (used mostly in derived classes like the GrainTracker)
bool _intersects_boundary
Flag indicating whether this feature intersects a boundary.
std::set< dof_id_type > _ghosted_ids
Holds the ghosted ids for a feature (the ids which will be used for stitching.
std::size_t _vol_count
The count of entities contributing to the volume calculation.
unsigned int _id
An ID for this feature.
template<>
void dataLoad ( std::istream &  stream,
MeshTools::BoundingBox &  bbox,
void *  context 
)

Definition at line 83 of file FeatureFloodCount.C.

84 {
85  loadHelper(stream, bbox.min(), context);
86  loadHelper(stream, bbox.max(), context);
87 }
template<>
void dataStore ( std::ostream &  stream,
FeatureFloodCount::FeatureData feature,
void *  context 
)

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

Definition at line 29 of file FeatureFloodCount.C.

Referenced by FeatureFloodCount::serialize().

30 {
35  storeHelper(stream, feature._ghosted_ids, context);
36  storeHelper(stream, feature._halo_ids, context);
37  storeHelper(stream, feature._disjoint_halo_ids, context);
38  storeHelper(stream, feature._periodic_nodes, context);
39  storeHelper(stream, feature._var_index, context);
40  storeHelper(stream, feature._id, context);
41  storeHelper(stream, feature._bboxes, context);
42  storeHelper(stream, feature._orig_ids, context);
43  storeHelper(stream, feature._min_entity_id, context);
44  storeHelper(stream, feature._vol_count, context);
45  storeHelper(stream, feature._centroid, context);
46  storeHelper(stream, feature._status, context);
47  storeHelper(stream, feature._intersects_boundary, context);
48 }
Point _centroid
The centroid of the feature (average of coordinates from entities participating in the volume calcula...
std::set< dof_id_type > _periodic_nodes
Holds the nodes that belong to the feature on a periodic boundary.
std::vector< MeshTools::BoundingBox > _bboxes
The vector of bounding boxes completely enclosing this feature (multiple used with periodic constrain...
std::set< dof_id_type > _disjoint_halo_ids
Holds halo ids that extend onto a non-topologically connected surface.
dof_id_type _min_entity_id
The minimum entity seen in the _local_ids, used for sorting features.
std::size_t _var_index
The Moose variable where this feature was found (often the "order parameter")
std::set< dof_id_type > _halo_ids
Holds the ids surrounding the feature.
std::list< std::pair< processor_id_type, unsigned int > > _orig_ids
Original processor/local ids.
Status _status
The status of a feature (used mostly in derived classes like the GrainTracker)
bool _intersects_boundary
Flag indicating whether this feature intersects a boundary.
std::set< dof_id_type > _ghosted_ids
Holds the ghosted ids for a feature (the ids which will be used for stitching.
std::size_t _vol_count
The count of entities contributing to the volume calculation.
unsigned int _id
An ID for this feature.
template<>
void dataStore ( std::ostream &  stream,
MeshTools::BoundingBox &  bbox,
void *  context 
)

Definition at line 52 of file FeatureFloodCount.C.

53 {
54  storeHelper(stream, bbox.min(), context);
55  storeHelper(stream, bbox.max(), context);
56 }
std::ostream& operator<< ( std::ostream &  out,
const FeatureFloodCount::FeatureData feature 
)

Definition at line 1703 of file FeatureFloodCount.C.

Referenced by ExpressionBuilder::EBTerm::EBTerm(), and FeatureFloodCount::FeatureData::operator<().

1704 {
1705  static const bool debug = true;
1706 
1707  out << "Grain ID: ";
1708  if (feature._id != FeatureFloodCount::invalid_id)
1709  out << feature._id;
1710  else
1711  out << "invalid";
1712 
1713  if (debug)
1714  {
1715  out << "\nGhosted Entities: ";
1716  for (auto ghosted_id : feature._ghosted_ids)
1717  out << ghosted_id << " ";
1718 
1719  out << "\nLocal Entities: ";
1720  for (auto local_id : feature._local_ids)
1721  out << local_id << " ";
1722 
1723  out << "\nHalo Entities: ";
1724  for (auto halo_id : feature._halo_ids)
1725  out << halo_id << " ";
1726 
1727  out << "\nPeriodic Node IDs: ";
1728  for (auto periodic_node : feature._periodic_nodes)
1729  out << periodic_node << " ";
1730  }
1731 
1732  out << "\nBBoxes:";
1733  Real volume = 0;
1734  for (const auto & bbox : feature._bboxes)
1735  {
1736  out << "\nMax: " << bbox.max() << " Min: " << bbox.min();
1737  volume += (bbox.max()(0) - bbox.min()(0)) * (bbox.max()(1) - bbox.min()(1)) *
1738  (MooseUtils::absoluteFuzzyEqual(bbox.max()(2), bbox.min()(2))
1739  ? 1
1740  : bbox.max()(2) - bbox.min()(2));
1741  }
1742 
1743  out << "\nStatus: ";
1745  out << "CLEAR";
1746  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::MARKED))
1747  out << " MARKED";
1748  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::DIRTY))
1749  out << " DIRTY";
1750  if (static_cast<bool>(feature._status & FeatureFloodCount::Status::INACTIVE))
1751  out << " INACTIVE";
1752 
1753  if (debug)
1754  {
1755  out << "\nOrig IDs (rank, index): ";
1756  for (const auto & orig_pair : feature._orig_ids)
1757  out << '(' << orig_pair.first << ", " << orig_pair.second << ") ";
1758  out << "\nVar_index: " << feature._var_index;
1759  out << "\nMin Entity ID: " << feature._min_entity_id;
1760  }
1761  out << "\n\n";
1762 
1763  return out;
1764 }
std::set< dof_id_type > _local_ids
Holds the local ids in the interior of a feature.
std::set< dof_id_type > _periodic_nodes
Holds the nodes that belong to the feature on a periodic boundary.
std::vector< MeshTools::BoundingBox > _bboxes
The vector of bounding boxes completely enclosing this feature (multiple used with periodic constrain...
dof_id_type _min_entity_id
The minimum entity seen in the _local_ids, used for sorting features.
std::size_t _var_index
The Moose variable where this feature was found (often the "order parameter")
static const unsigned int invalid_id
std::set< dof_id_type > _halo_ids
Holds the ids surrounding the feature.
std::list< std::pair< processor_id_type, unsigned int > > _orig_ids
Original processor/local ids.
Status _status
The status of a feature (used mostly in derived classes like the GrainTracker)
std::set< dof_id_type > _ghosted_ids
Holds the ghosted ids for a feature (the ids which will be used for stitching.
unsigned int _id
An ID for this feature.
void updateBBoxExtremesHelper ( MeshTools::BoundingBox &  bbox,
const Point &  node 
)

Definition at line 1771 of file FeatureFloodCount.C.

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

1772 {
1773  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
1774  {
1775  bbox.min()(i) = std::min(bbox.min()(i), node(i));
1776  bbox.max()(i) = std::max(bbox.max()(i), node(i));
1777  }
1778 }
void updateBBoxExtremesHelper ( MeshTools::BoundingBox &  bbox,
const Elem &  elem 
)

Definition at line 1781 of file FeatureFloodCount.C.

1782 {
1783  for (auto node_n = decltype(elem.n_nodes())(0); node_n < elem.n_nodes(); ++node_n)
1784  updateBBoxExtremesHelper(bbox, *(elem.get_node(node_n)));
1785 }
void updateBBoxExtremesHelper(MeshTools::BoundingBox &bbox, const Point &node)
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 98 of file FeatureFloodCount.C.

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

99 {
100  InputParameters params = validParams<GeneralPostprocessor>();
101  params.addRequiredCoupledVar(
102  "variable",
103  "The variable(s) for which to find connected regions of interests, i.e. \"features\".");
104  params.addParam<Real>(
105  "threshold", 0.5, "The threshold value for which a new feature may be started");
106  params.addParam<Real>(
107  "connecting_threshold",
108  "The threshold for which an existing feature may be extended (defaults to \"threshold\")");
109  params.addParam<bool>("use_single_map",
110  true,
111  "Determine whether information is tracked per "
112  "coupled variable or consolidated into one "
113  "(default: true)");
114  params.addParam<bool>(
115  "condense_map_info",
116  false,
117  "Determines whether we condense all the node values when in multimap mode (default: false)");
118  params.addParam<bool>("use_global_numbering",
119  true,
120  "Determine whether or not global numbers are "
121  "used to label features on multiple maps "
122  "(default: true)");
123  params.addParam<bool>("enable_var_coloring",
124  false,
125  "Instruct the Postprocessor to populate the variable index map.");
126  params.addParam<bool>(
127  "compute_halo_maps",
128  false,
129  "Instruct the Postprocessor to communicate proper halo information to all ranks");
130  params.addParam<bool>("compute_var_to_feature_map",
131  false,
132  "Instruct the Postprocessor to compute the active vars to features map");
133  params.addParam<bool>(
134  "use_less_than_threshold_comparison",
135  true,
136  "Controls whether features are defined to be less than or greater than the threshold value.");
137 
145  params.set<bool>("use_displaced_mesh") = false;
146 
147  params.addParamNamesToGroup("use_single_map condense_map_info use_global_numbering", "Advanced");
148 
149  MooseEnum flood_type("NODAL ELEMENTAL", "ELEMENTAL");
150  params.addParam<MooseEnum>("flood_entity_type",
151  flood_type,
152  "Determines whether the flood algorithm runs on nodes or elements");
153  return params;
154 }