www.mooseframework.org
FeatureFloodCount.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "Coupleable.h"
13 #include "GeneralPostprocessor.h"
14 #include "InfixIterator.h"
15 #include "MooseVariableDependencyInterface.h"
16 #include "BoundaryRestrictable.h"
17 
18 #include <iterator>
19 #include <list>
20 #include <set>
21 #include <vector>
22 
23 #include "libmesh/bounding_box.h"
24 #include "libmesh/periodic_boundaries.h"
25 
26 // External includes
27 #include "bitmask_operators.h"
28 
29 // Forward Declarations
30 class FeatureFloodCount;
31 class MooseMesh;
32 
33 template <>
34 InputParameters validParams<FeatureFloodCount>();
35 
44 class FeatureFloodCount : public GeneralPostprocessor,
45  public Coupleable,
46  public MooseVariableDependencyInterface,
47  public BoundaryRestrictable
48 {
49 public:
50  FeatureFloodCount(const InputParameters & parameters);
51 
52  virtual void initialSetup() override;
53  virtual void meshChanged() override;
54  virtual void initialize() override;
55  virtual void execute() override;
56  virtual void finalize() override;
57  virtual Real getValue() override;
58 
60  std::size_t getNumberActiveFeatures() const;
61 
63  virtual std::size_t getTotalFeatureCount() const;
64 
66  virtual bool doesFeatureIntersectBoundary(unsigned int feature_id) const;
67 
69  virtual bool doesFeatureIntersectSpecifiedBoundary(unsigned int feature_id) const;
70 
73  virtual bool isFeaturePercolated(unsigned int feature_id) const;
74 
76  virtual Point featureCentroid(unsigned int feature_id) const;
77 
83  virtual const std::vector<unsigned int> & getVarToFeatureVector(dof_id_type elem_id) const;
84 
86  virtual unsigned int getFeatureVar(unsigned int feature_id) const;
87 
89  std::size_t numCoupledVars() const { return _n_vars; }
90 
93  static const std::size_t invalid_size_t;
94  static const unsigned int invalid_id;
96 
98  const std::vector<MooseVariable *> & getCoupledVars() const { return _vars; }
99 
101  const std::vector<MooseVariableFEBase *> & getFECoupledVars() const { return _fe_vars; }
102 
103  enum class FieldType
104  {
108  HALOS,
109  CENTROID,
111  };
112 
113  // Retrieve field information
114  virtual Real
115  getEntityValue(dof_id_type entity_id, FieldType field_type, std::size_t var_index = 0) const;
116 
117  inline bool isElemental() const { return _is_elemental; }
118 
120  enum class Status : unsigned char
121  {
122  CLEAR = 0x0,
123  MARKED = 0x1,
124  DIRTY = 0x2,
125  INACTIVE = 0x4
126  };
127 
129  enum class BoundaryIntersection : unsigned char
130  {
131  NONE = 0x0,
132  ANY_BOUNDARY = 0x1,
135  SPECIFIED_BOUNDARY = 0x8
136  };
137 
139  {
140  public:
149  using container_type = std::set<dof_id_type>;
150 
151  FeatureData() : FeatureData(std::numeric_limits<std::size_t>::max(), Status::INACTIVE) {}
152 
153  FeatureData(std::size_t var_index,
154  unsigned int local_index,
155  processor_id_type rank,
156  Status status)
157  : FeatureData(var_index, status)
158  {
159  _orig_ids = {std::make_pair(rank, local_index)};
160  }
161 
162  FeatureData(std::size_t var_index,
163  Status status,
164  unsigned int id = invalid_id,
165  std::vector<BoundingBox> bboxes = {BoundingBox()})
166  : _var_index(var_index),
167  _id(id),
168  _bboxes(bboxes), // Assume at least one bounding box
169  _min_entity_id(DofObject::invalid_id),
170  _vol_count(0),
171  _status(status),
173  {
174  }
175 
177  // Default Move constructors
178  FeatureData(FeatureData && /* f */) = default;
179  FeatureData & operator=(FeatureData && /* f */) = default;
181 
183 
187  void updateBBoxExtremes(MeshBase & mesh);
188  void updateBBoxExtremes(BoundingBox & bbox, const BoundingBox & rhs_bbox);
190 
195  bool boundingBoxesIntersect(const FeatureData & rhs) const;
196 
206  bool mergeable(const FeatureData & rhs) const;
207 
216  bool canConsolidate(const FeatureData & rhs) const;
217 
219 
223  bool halosIntersect(const FeatureData & rhs) const;
224  bool periodicBoundariesIntersect(const FeatureData & rhs) const;
225  bool ghostedIntersect(const FeatureData & rhs) const;
227 
232  void expandBBox(const FeatureData & rhs);
233 
238  void merge(FeatureData && rhs);
239 
243  void consolidate(FeatureData && rhs);
244 
245  // TODO: Doco
246  void clear();
247 
249  bool operator<(const FeatureData & rhs) const
250  {
251  if (_id != invalid_id)
252  {
253  mooseAssert(rhs._id != invalid_id, "Asymmetric setting of ids detected during sort");
254 
255  // Sort based on ids
256  return _id < rhs._id;
257  }
258  else
259  // Sort based on processor independent information (mesh and variable info)
260  return _var_index < rhs._var_index ||
262  }
263 
265  friend std::ostream & operator<<(std::ostream & out, const FeatureData & feature);
266 
269 
273 
276 
279 
282 
284  std::size_t _var_index;
285 
287  unsigned int _id;
288 
291  std::vector<BoundingBox> _bboxes;
292 
294  std::list<std::pair<processor_id_type, unsigned int>> _orig_ids;
295 
297  dof_id_type _min_entity_id;
298 
300  std::size_t _vol_count;
301 
304  Point _centroid;
305 
308 
311 
312  FeatureData duplicate() const { return FeatureData(*this); }
313 
314 #ifndef __INTEL_COMPILER
315 
326  private:
327 #endif
328 
334  FeatureData(const FeatureData & /* f */) = default;
335  FeatureData & operator=(const FeatureData & /* f */) = default;
337  };
338 
340  const std::vector<FeatureData> & getFeatures() const { return _feature_sets; }
341 
342 protected:
346  template <typename T>
347  bool isBoundaryEntity(const T * entity) const;
348 
354  virtual void updateFieldInfo();
355 
363  bool flood(const DofObject * dof_object, std::size_t current_index);
364 
369  virtual Real getThreshold(std::size_t current_index) const;
370 
375  virtual Real getConnectingThreshold(std::size_t current_index) const;
376 
382  bool compareValueWithThreshold(Real entity_value, Real threshold) const;
383 
389  virtual bool isNewFeatureOrConnectedRegion(const DofObject * dof_object,
390  std::size_t & current_index,
391  FeatureData *& feature,
392  Status & status,
393  unsigned int & new_id);
394 
401  void expandPointHalos();
402 
407  void expandEdgeHalos(unsigned int num_layers_to_expand);
408 
410 
415  void visitNodalNeighbors(const Node * node, FeatureData * feature, bool expand_halos_only);
416  void visitElementalNeighbors(const Elem * elem,
417  FeatureData * feature,
418  bool expand_halos_only,
419  bool disjoint_only);
421 
427  template <typename T>
428  void visitNeighborsHelper(const T * curr_entity,
429  std::vector<const T *> neighbor_entities,
430  FeatureData * feature,
431  bool expand_halos_only,
432  bool topological_neighbor,
433  bool disjoint_only);
434 
446  void prepareDataForTransfer();
447 
452  void serialize(std::string & serialized_buffer, unsigned int var_num = invalid_id);
453 
461  void deserialize(std::vector<std::string> & serialized_buffers,
462  unsigned int var_num = invalid_id);
463 
468  virtual void mergeSets();
469 
475  virtual bool areFeaturesMergeable(const FeatureData & f1, const FeatureData & f2) const;
476 
481  void communicateAndMerge();
482 
486  void sortAndLabel();
487 
493  void scatterAndUpdateRanks();
494 
504  virtual void buildLocalToGlobalIndices(std::vector<std::size_t> & local_to_global_all,
505  std::vector<int> & counts) const;
506 
513  void buildFeatureIdToLocalIndices(unsigned int max_id);
514 
519  virtual void clearDataStructures();
520 
524  void updateBoundaryIntersections(FeatureData & feature) const;
525 
530  void appendPeriodicNeighborNodes(FeatureData & feature) const;
531 
536  void updateRegionOffsets();
537 
542  template <class InputIterator>
543  static bool setsIntersect(InputIterator first1,
544  InputIterator last1,
545  InputIterator first2,
546  InputIterator last2)
547  {
548  while (first1 != last1 && first2 != last2)
549  {
550  if (*first1 == *first2)
551  return true;
552 
553  if (*first1 < *first2)
554  ++first1;
555  else if (*first1 > *first2)
556  ++first2;
557  }
558  return false;
559  }
560 
561  /*************************************************
562  *************** Data Structures *****************
563  ************************************************/
565  std::vector<MooseVariableFEBase *> _fe_vars;
567  std::vector<MooseVariable *> _vars;
568 
570  const DofMap & _dof_map;
571 
573  const Real _threshold;
574  Real _step_threshold;
575 
580 
582  MooseMesh & _mesh;
583 
589  unsigned long _var_number;
590 
592  const bool _single_map_mode;
593 
594  const bool _condense_map_info;
595 
598  const bool _global_numbering;
599 
602  const bool _var_index_mode;
603 
605  const bool _compute_halo_maps;
606 
608  const bool _compute_var_to_feature_map;
609 
616 
617  // Convenience variable holding the number of variables coupled into this object
618  const std::size_t _n_vars;
619 
621  const std::size_t _maps_size;
622 
624  const processor_id_type _n_procs;
625 
632  std::vector<std::set<dof_id_type>> _entities_visited;
633 
640  std::vector<std::map<dof_id_type, int>> _var_index_maps;
641 
643  std::vector<std::vector<const Elem *>> _nodes_to_elem_map;
644 
646  std::vector<unsigned int> _feature_counts_per_map;
647 
649  unsigned int _feature_count;
650 
656  std::vector<std::list<FeatureData>> _partial_feature_sets;
657 
663  std::vector<FeatureData> & _feature_sets;
664 
672  std::vector<FeatureData> _volatile_feature_sets;
673 
679  std::vector<std::map<dof_id_type, int>> _feature_maps;
680 
682  std::vector<std::size_t> _local_to_global_feature_map;
683 
685  std::vector<std::size_t> _feature_id_to_local_index;
686 
688  PeriodicBoundaries * _pbs;
689 
690  std::unique_ptr<PointLocatorBase> _point_locator;
691 
693  const PostprocessorValue & _element_average_value;
694 
696  std::map<dof_id_type, int> _ghosted_entity_ids;
697 
702  std::vector<std::map<dof_id_type, int>> _halo_ids;
703 
708  std::multimap<dof_id_type, dof_id_type> _periodic_node_map;
709 
712  std::unordered_set<dof_id_type> _all_boundary_entity_ids;
713 
714  std::map<dof_id_type, std::vector<unsigned int>> _entity_var_to_features;
715 
716  std::vector<unsigned int> _empty_var_to_features;
717 
718  std::vector<BoundaryID> _primary_perc_bnds;
719  std::vector<BoundaryID> _secondary_perc_bnds;
720 
721  std::vector<BoundaryID> _specified_bnds;
722 
724  const bool _is_elemental;
725 
728 
730  ConstBndElemRange * _bnd_elem_range;
731 
733  const bool _is_master;
734 
735 private:
736  template <class T>
737  static inline void sort(std::set<T> & /*container*/)
738  {
739  // Sets are already sorted, do nothing
740  }
741 
742  template <class T>
743  static inline void sort(std::vector<T> & container)
744  {
745  std::sort(container.begin(), container.end());
746  }
747 
748  template <class T>
749  static inline void reserve(std::set<T> & /*container*/, std::size_t /*size*/)
750  {
751  // Sets are trees, no reservations necessary
752  }
753 
754  template <class T>
755  static inline void reserve(std::vector<T> & container, std::size_t size)
756  {
757  container.reserve(size);
758  }
759 
764  void consolidateMergedFeatures(std::vector<std::list<FeatureData>> * saved_data = nullptr);
765 
767  std::deque<const DofObject *> _entity_queue;
768 
770  const bool _distribute_merge_work;
771 
773  const PerfID _execute_timer;
774  const PerfID _merge_timer;
775  const PerfID _finalize_timer;
776  const PerfID _comm_and_merge;
777  const PerfID _expand_halos;
778  const PerfID _update_field_info;
779  const PerfID _prepare_for_transfer;
780  const PerfID _consolidate_merged_features;
781 };
782 
783 template <>
784 void dataStore(std::ostream & stream, FeatureFloodCount::FeatureData & feature, void * context);
785 template <>
786 void dataStore(std::ostream & stream, BoundingBox & bbox, void * context);
787 
788 template <>
789 void dataLoad(std::istream & stream, FeatureFloodCount::FeatureData & feature, void * context);
790 template <>
791 void dataLoad(std::istream & stream, BoundingBox & bbox, void * context);
792 
793 template <>
794 struct enable_bitmask_operators<FeatureFloodCount::Status>
795 {
796  static const bool enable = true;
797 };
798 
799 template <>
800 struct enable_bitmask_operators<FeatureFloodCount::BoundaryIntersection>
801 {
802  static const bool enable = true;
803 };
FeatureFloodCount::FeatureData::consolidate
void consolidate(FeatureData &&rhs)
Consolidates features, i.e.
Definition: FeatureFloodCount.C:2068
FeatureFloodCount::expandEdgeHalos
void expandEdgeHalos(unsigned int num_layers_to_expand)
This method expands the existing halo set by some width determined by the passed in value.
Definition: FeatureFloodCount.C:1527
FeatureFloodCount::_var_index_mode
const bool _var_index_mode
This variable is used to indicate whether the maps will contain unique region information or just the...
Definition: FeatureFloodCount.h:601
FeatureFloodCount::_condense_map_info
const bool _condense_map_info
Definition: FeatureFloodCount.h:593
validParams< FeatureFloodCount >
InputParameters validParams< FeatureFloodCount >()
Definition: FeatureFloodCount.C:104
FeatureFloodCount::_secondary_perc_bnds
std::vector< BoundaryID > _secondary_perc_bnds
Definition: FeatureFloodCount.h:718
FeatureFloodCount::FieldType::UNIQUE_REGION
FeatureFloodCount::invalid_size_t
static const std::size_t invalid_size_t
Definition: FeatureFloodCount.h:93
FeatureFloodCount::scatterAndUpdateRanks
void scatterAndUpdateRanks()
Calls buildLocalToGlobalIndices to build the individual local to global indicies for each rank and sc...
Definition: FeatureFloodCount.C:717
FeatureFloodCount::_mesh
MooseMesh & _mesh
A reference to the mesh.
Definition: FeatureFloodCount.h:581
FeatureFloodCount::FeatureData::_id
unsigned int _id
An ID for this feature.
Definition: FeatureFloodCount.h:287
FeatureFloodCount::prepareDataForTransfer
void prepareDataForTransfer()
This routine uses the local flooded data to build up the local feature data structures (_feature_sets...
Definition: FeatureFloodCount.C:1017
FeatureFloodCount::getEntityValue
virtual Real getEntityValue(dof_id_type entity_id, FieldType field_type, std::size_t var_index=0) const
Definition: FeatureFloodCount.C:918
FeatureFloodCount::FeatureFloodCount
FeatureFloodCount(const InputParameters &parameters)
Definition: FeatureFloodCount.C:194
FeatureFloodCount::doesFeatureIntersectBoundary
virtual bool doesFeatureIntersectBoundary(unsigned int feature_id) const
Returns a Boolean indicating whether this feature intersects any boundary.
Definition: FeatureFloodCount.C:828
FeatureFloodCount::BoundaryIntersection::SECONDARY_PERCOLATION_BOUNDARY
FeatureFloodCount::getVarToFeatureVector
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.
Definition: FeatureFloodCount.C:701
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::_merge_timer
const PerfID _merge_timer
Definition: FeatureFloodCount.h:773
FeatureFloodCount::isElemental
bool isElemental() const
Definition: FeatureFloodCount.h:117
FeatureFloodCount::FeatureData::clear
void clear()
Definition: FeatureFloodCount.C:2087
FeatureFloodCount::FeatureData::container_type
std::set< dof_id_type > container_type
The primary underlying container type used to hold the data in each FeatureData.
Definition: FeatureFloodCount.h:149
FeatureFloodCount::featureCentroid
virtual Point featureCentroid(unsigned int feature_id) const
Returns the centroid of the designated feature (only supported without periodic boundaries)
Definition: FeatureFloodCount.C:900
FeatureFloodCount::FeatureData::mergeable
bool mergeable(const FeatureData &rhs) const
The routine called to see if two features are mergeable:
Definition: FeatureFloodCount.C:1953
FeatureFloodCount::FieldType::CENTROID
FeatureFloodCount::_comm_and_merge
const PerfID _comm_and_merge
Definition: FeatureFloodCount.h:775
FeatureFloodCount::Status
Status
This enumeration is used to indicate status of the grains in the _unique_grains data structure.
Definition: FeatureFloodCount.h:120
FeatureFloodCount::communicateAndMerge
void communicateAndMerge()
This routine handles all of the serialization, communication and deserialization of the data structur...
Definition: FeatureFloodCount.C:412
FeatureFloodCount::_entities_visited
std::vector< std::set< dof_id_type > > _entities_visited
This variable keeps track of which nodes have been visited during execution.
Definition: FeatureFloodCount.h:631
FeatureFloodCount::_execute_timer
const PerfID _execute_timer
Timers.
Definition: FeatureFloodCount.h:772
FeatureFloodCount::getThreshold
virtual Real getThreshold(std::size_t current_index) const
Return the starting comparison threshold to use when inspecting an entity during the flood stage.
Definition: FeatureFloodCount.C:1407
FeatureFloodCount::FieldType
FieldType
Definition: FeatureFloodCount.h:103
FeatureFloodCount::FeatureData::periodicBoundariesIntersect
bool periodicBoundariesIntersect(const FeatureData &rhs) const
Definition: FeatureFloodCount.C:1937
FeatureFloodCount::areFeaturesMergeable
virtual bool areFeaturesMergeable(const FeatureData &f1, const FeatureData &f2) const
Method for determining whether two features are mergeable.
Definition: FeatureFloodCount.C:1243
FeatureFloodCount::isBoundaryEntity
bool isBoundaryEntity(const T *entity) const
Returns a Boolean indicating whether the entity is on one of the desired boundaries.
Definition: FeatureFloodCount.C:1810
FeatureFloodCount::FieldType::GHOSTED_ENTITIES
FeatureFloodCount::visitNodalNeighbors
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...
Definition: FeatureFloodCount.C:1653
FeatureFloodCount::FeatureData::_boundary_intersection
BoundaryIntersection _boundary_intersection
Enumaration indicating boundary intersection status.
Definition: FeatureFloodCount.h:310
FeatureFloodCount::_is_master
const bool _is_master
Convenience variable for testing master rank.
Definition: FeatureFloodCount.h:732
FeatureFloodCount::_finalize_timer
const PerfID _finalize_timer
Definition: FeatureFloodCount.h:774
FeatureFloodCount::isFeaturePercolated
virtual bool isFeaturePercolated(unsigned int feature_id) const
Returns a Boolean indicating whether this feature is percolated (e.g.
Definition: FeatureFloodCount.C:874
FeatureFloodCount::FeatureData::duplicate
FeatureData duplicate() const
Definition: FeatureFloodCount.h:312
FeatureFloodCount::buildLocalToGlobalIndices
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 ...
Definition: FeatureFloodCount.C:619
FeatureFloodCount::_specified_bnds
std::vector< BoundaryID > _specified_bnds
Definition: FeatureFloodCount.h:720
FeatureFloodCount
This object will mark nodes or elements of continuous regions all with a unique number for the purpos...
Definition: FeatureFloodCount.h:44
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::getTotalFeatureCount
virtual std::size_t getTotalFeatureCount() const
Returns the total feature count (active and inactive ids, useful for sizing vectors)
Definition: FeatureFloodCount.C:798
FeatureFloodCount::expandPointHalos
void expandPointHalos()
This method takes all of the partial features and expands the local, ghosted, and halo sets around th...
Definition: FeatureFloodCount.C:1465
FeatureFloodCount::initialize
virtual void initialize() override
Definition: FeatureFloodCount.C:298
dataStore
void dataStore(std::ostream &stream, FeatureFloodCount::FeatureData &feature, void *context)
Definition: FeatureFloodCount.C:33
FeatureFloodCount::Status::CLEAR
FeatureFloodCount::BoundaryIntersection::SPECIFIED_BOUNDARY
FeatureFloodCount::sortAndLabel
void sortAndLabel()
Sort and assign ids to features based on their position in the container after sorting.
Definition: FeatureFloodCount.C:573
FeatureFloodCount::FeatureData::expandBBox
void expandBBox(const FeatureData &rhs)
Located the overlapping bounding box between this Feature and the other Feature and expands that over...
Definition: FeatureFloodCount.C:2099
FeatureFloodCount::consolidateMergedFeatures
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...
Definition: FeatureFloodCount.C:1176
FeatureFloodCount::FeatureData::operator<<
friend std::ostream & operator<<(std::ostream &out, const FeatureData &feature)
stream output operator
Definition: FeatureFloodCount.C:2138
FeatureFloodCount::sort
static void sort(std::set< T > &)
Definition: FeatureFloodCount.h:736
FeatureFloodCount::appendPeriodicNeighborNodes
void appendPeriodicNeighborNodes(FeatureData &feature) const
This routine adds the periodic node information to our data structure prior to packing the data this ...
Definition: FeatureFloodCount.C:1771
FeatureFloodCount::FeatureData::FeatureData
FeatureData(std::size_t var_index, Status status, unsigned int id=invalid_id, std::vector< BoundingBox > bboxes={BoundingBox()})
Definition: FeatureFloodCount.h:162
FeatureFloodCount::finalize
virtual void finalize() override
Definition: FeatureFloodCount.C:681
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::_step_connecting_threshold
Real _step_connecting_threshold
Definition: FeatureFloodCount.h:578
FeatureFloodCount::getCoupledVars
const std::vector< MooseVariable * > & getCoupledVars() const
Returns a const vector to the coupled variable pointers.
Definition: FeatureFloodCount.h:98
FeatureFloodCount::_consolidate_merged_features
const PerfID _consolidate_merged_features
Definition: FeatureFloodCount.h:779
FeatureFloodCount::getFeatures
const std::vector< FeatureData > & getFeatures() const
Return a constant reference to the vector of all discovered features.
Definition: FeatureFloodCount.h:340
FeatureFloodCount::visitNeighborsHelper
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.
Definition: FeatureFloodCount.C:1667
FeatureFloodCount::_var_number
unsigned long _var_number
This variable is used to build the periodic node map.
Definition: FeatureFloodCount.h:588
FeatureFloodCount::_feature_sets
std::vector< FeatureData > & _feature_sets
The data structure used to hold the globally unique features.
Definition: FeatureFloodCount.h:662
FeatureFloodCount::_entity_var_to_features
std::map< dof_id_type, std::vector< unsigned int > > _entity_var_to_features
Definition: FeatureFloodCount.h:713
FeatureFloodCount::FieldType::ACTIVE_BOUNDS
FeatureFloodCount::_global_numbering
const bool _global_numbering
This variable is used to indicate whether or not we identify features with unique numbers on multiple...
Definition: FeatureFloodCount.h:597
FeatureFloodCount::_volatile_feature_sets
std::vector< FeatureData > _volatile_feature_sets
Derived objects (e.g.
Definition: FeatureFloodCount.h:671
FeatureFloodCount::FeatureData::_halo_ids
container_type _halo_ids
Holds the ids surrounding the feature.
Definition: FeatureFloodCount.h:275
FeatureFloodCount::FeatureData::operator<
bool operator<(const FeatureData &rhs) const
Comparison operator for sorting individual FeatureDatas.
Definition: FeatureFloodCount.h:249
FeatureFloodCount::FeatureData::_orig_ids
std::list< std::pair< processor_id_type, unsigned int > > _orig_ids
Original processor/local ids.
Definition: FeatureFloodCount.h:294
FeatureFloodCount::getFeatureVar
virtual unsigned int getFeatureVar(unsigned int feature_id) const
Returns the variable representing the passed in feature.
Definition: FeatureFloodCount.C:809
FeatureFloodCount::BoundaryIntersection
BoundaryIntersection
This enumeration is used to inidacate status of boundary intersections.
Definition: FeatureFloodCount.h:129
FeatureFloodCount::FeatureData::canConsolidate
bool canConsolidate(const FeatureData &rhs) const
This routine indicates whether two features can be consolidated, that is, one feature is reasonably e...
Definition: FeatureFloodCount.C:1963
FeatureFloodCount::_nodes_to_elem_map
std::vector< std::vector< const Elem * > > _nodes_to_elem_map
The data structure used to find neighboring elements give a node ID.
Definition: FeatureFloodCount.h:642
FeatureFloodCount::_single_map_mode
const bool _single_map_mode
This variable is used to indicate whether or not multiple maps are used during flooding.
Definition: FeatureFloodCount.h:591
FeatureFloodCount::_point_locator
std::unique_ptr< PointLocatorBase > _point_locator
Definition: FeatureFloodCount.h:689
FeatureFloodCount::_use_less_than_threshold_comparison
const bool _use_less_than_threshold_comparison
Use less-than when comparing values against the threshold value.
Definition: FeatureFloodCount.h:614
FeatureFloodCount::doesFeatureIntersectSpecifiedBoundary
virtual bool doesFeatureIntersectSpecifiedBoundary(unsigned int feature_id) const
Returns a Boolean indicating whether this feature intersects boundaries in a user-supplied list.
Definition: FeatureFloodCount.C:850
FeatureFloodCount::_ghosted_entity_ids
std::map< dof_id_type, int > _ghosted_entity_ids
The map for holding reconstructed ghosted element information.
Definition: FeatureFloodCount.h:695
FeatureFloodCount::FeatureData::FeatureData
FeatureData()
Definition: FeatureFloodCount.h:151
FeatureFloodCount::_maps_size
const std::size_t _maps_size
Convenience variable holding the size of all the datastructures size by the number of maps.
Definition: FeatureFloodCount.h:620
FeatureFloodCount::_partial_feature_sets
std::vector< std::list< FeatureData > > _partial_feature_sets
The data structure used to hold partial and communicated feature data, during the discovery and mergi...
Definition: FeatureFloodCount.h:655
FeatureFloodCount::_dof_map
const DofMap & _dof_map
Reference to the dof_map containing the coupled variables.
Definition: FeatureFloodCount.h:569
FeatureFloodCount::FeatureData::merge
void merge(FeatureData &&rhs)
Merges another Feature Data into this one.
Definition: FeatureFloodCount.C:1974
FeatureFloodCount::_fe_vars
std::vector< MooseVariableFEBase * > _fe_vars
The vector of coupled in variables.
Definition: FeatureFloodCount.h:564
FeatureFloodCount::FeatureData::boundingBoxesIntersect
bool boundingBoxesIntersect(const FeatureData &rhs) const
Determines if any of this FeatureData's bounding boxes overlap with the other FeatureData's bounding ...
Definition: FeatureFloodCount.C:1918
FeatureFloodCount::_is_elemental
const bool _is_elemental
Determines if the flood counter is elements or not (nodes)
Definition: FeatureFloodCount.h:723
dataLoad
void dataLoad(std::istream &stream, FeatureFloodCount::FeatureData &feature, void *context)
Definition: FeatureFloodCount.C:64
FeatureFloodCount::_empty_var_to_features
std::vector< unsigned int > _empty_var_to_features
Definition: FeatureFloodCount.h:715
FeatureFloodCount::visitElementalNeighbors
void visitElementalNeighbors(const Elem *elem, FeatureData *feature, bool expand_halos_only, bool disjoint_only)
Definition: FeatureFloodCount.C:1584
FeatureFloodCount::FeatureData
Definition: FeatureFloodCount.h:138
FeatureFloodCount::_vars
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
Definition: FeatureFloodCount.h:566
FeatureFloodCount::_connecting_threshold
const Real _connecting_threshold
The threshold above (or below) which neighboring entities are flooded (where regions can be extended ...
Definition: FeatureFloodCount.h:577
FeatureFloodCount::_halo_ids
std::vector< std::map< dof_id_type, int > > _halo_ids
The data structure for looking up halos around features.
Definition: FeatureFloodCount.h:701
FeatureFloodCount::FeatureData::ghostedIntersect
bool ghostedIntersect(const FeatureData &rhs) const
Definition: FeatureFloodCount.C:1946
FeatureFloodCount::execute
virtual void execute() override
Definition: FeatureFloodCount.C:358
FeatureFloodCount::invalid_id
static const unsigned int invalid_id
Definition: FeatureFloodCount.h:94
FeatureFloodCount::mergeSets
virtual void mergeSets()
This routine is called on the master rank only and stitches together the partial feature pieces seen ...
Definition: FeatureFloodCount.C:1121
FeatureFloodCount::updateRegionOffsets
void updateRegionOffsets()
This routine updates the _region_offsets variable which is useful for quickly determining the proper ...
FeatureFloodCount::_pbs
PeriodicBoundaries * _pbs
A pointer to the periodic boundary constraints object.
Definition: FeatureFloodCount.h:687
FeatureFloodCount::clearDataStructures
virtual void clearDataStructures()
Helper routine for clearing up data structures during initialize and prior to parallel communication.
Definition: FeatureFloodCount.C:330
FeatureFloodCount::Status::INACTIVE
FeatureFloodCount::FeatureData::FeatureData
FeatureData(std::size_t var_index, unsigned int local_index, processor_id_type rank, Status status)
Definition: FeatureFloodCount.h:153
FeatureFloodCount::_feature_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.
Definition: FeatureFloodCount.h:678
FeatureFloodCount::initialSetup
virtual void initialSetup() override
Definition: FeatureFloodCount.C:277
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::compareValueWithThreshold
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.
Definition: FeatureFloodCount.C:1418
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::numCoupledVars
std::size_t numCoupledVars() const
Returns the number of coupled varaibles.
Definition: FeatureFloodCount.h:89
FeatureFloodCount::deserialize
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...
Definition: FeatureFloodCount.C:1086
FeatureFloodCount::_feature_id_to_local_index
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)
Definition: FeatureFloodCount.h:684
FeatureFloodCount::_distribute_merge_work
const bool _distribute_merge_work
Keeps track of whether we are distributing the merge work.
Definition: FeatureFloodCount.h:769
FeatureFloodCount::_compute_halo_maps
const bool _compute_halo_maps
Indicates whether or not to communicate halo map information with all ranks.
Definition: FeatureFloodCount.h:604
FeatureFloodCount::BoundaryIntersection::ANY_BOUNDARY
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::getConnectingThreshold
virtual Real getConnectingThreshold(std::size_t current_index) const
Return the "connecting" comparison threshold to use when inspecting an entity during the flood stage.
Definition: FeatureFloodCount.C:1412
FeatureFloodCount::FeatureData::halosIntersect
bool halosIntersect(const FeatureData &rhs) const
Determine if one of this FeaturesData's member sets intersects the other FeatureData's corresponding ...
Definition: FeatureFloodCount.C:1930
FeatureFloodCount::flood
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.
Definition: FeatureFloodCount.C:1294
FeatureFloodCount::_feature_count
unsigned int _feature_count
The number of features seen by this object (same as summing _feature_counts_per_map)
Definition: FeatureFloodCount.h:648
FeatureFloodCount::FeatureData::_local_ids
container_type _local_ids
Holds the local ids in the interior of a feature.
Definition: FeatureFloodCount.h:272
FeatureFloodCount::_threshold
const Real _threshold
The threshold above (or below) where an entity may begin a new region (feature)
Definition: FeatureFloodCount.h:572
FeatureFloodCount::_update_field_info
const PerfID _update_field_info
Definition: FeatureFloodCount.h:777
FeatureFloodCount::_is_boundary_restricted
bool _is_boundary_restricted
Indicates that this object should only run on one or more boundaries.
Definition: FeatureFloodCount.h:726
FeatureFloodCount::isNewFeatureOrConnectedRegion
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...
Definition: FeatureFloodCount.C:1425
FeatureFloodCount::reserve
static void reserve(std::set< T > &, std::size_t)
Definition: FeatureFloodCount.h:748
FeatureFloodCount::Status::DIRTY
FeatureFloodCount::FeatureData::updateBBoxExtremes
void updateBBoxExtremes(MeshBase &mesh)
Update the minimum and maximum coordinates of a bounding box given a Point, Elem or BBox parameter.
Definition: FeatureFloodCount.C:1824
FeatureFloodCount::FeatureData::_vol_count
std::size_t _vol_count
The count of entities contributing to the volume calculation.
Definition: FeatureFloodCount.h:300
FeatureFloodCount::FieldType::VARIABLE_COLORING
FeatureFloodCount::_bnd_elem_range
ConstBndElemRange * _bnd_elem_range
Boundary element range pointer.
Definition: FeatureFloodCount.h:729
FeatureFloodCount::buildFeatureIdToLocalIndices
void buildFeatureIdToLocalIndices(unsigned int max_id)
This method builds a lookup map for retrieving the right local feature (by index) given a global inde...
Definition: FeatureFloodCount.C:665
FeatureFloodCount::BoundaryIntersection::NONE
FeatureFloodCount::_entity_queue
std::deque< const DofObject * > _entity_queue
The data structure for maintaining entities to flood during discovery.
Definition: FeatureFloodCount.h:766
FeatureFloodCount::_compute_var_to_feature_map
const bool _compute_var_to_feature_map
Indicates whether or not the var to feature map is populated.
Definition: FeatureFloodCount.h:607
FeatureFloodCount::_element_average_value
const PostprocessorValue & _element_average_value
Average value of the domain which can optionally be used to find features in a field.
Definition: FeatureFloodCount.h:692
FeatureFloodCount::_periodic_node_map
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 ...
Definition: FeatureFloodCount.h:707
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::_all_boundary_entity_ids
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...
Definition: FeatureFloodCount.h:711
FeatureFloodCount::FeatureData::operator=
FeatureData & operator=(FeatureData &&)=default
FeatureFloodCount::_step_threshold
Real _step_threshold
Definition: FeatureFloodCount.h:573
FeatureFloodCount::_prepare_for_transfer
const PerfID _prepare_for_transfer
Definition: FeatureFloodCount.h:778
FeatureFloodCount::setsIntersect
static bool setsIntersect(InputIterator first1, InputIterator last1, InputIterator first2, InputIterator last2)
This method detects whether two sets intersect without building a result set.
Definition: FeatureFloodCount.h:543
FeatureFloodCount::_n_procs
const processor_id_type _n_procs
Convenience variable holding the number of processors in this simulation.
Definition: FeatureFloodCount.h:623
FeatureFloodCount::getValue
virtual Real getValue() override
Definition: FeatureFloodCount.C:785
FeatureFloodCount::_expand_halos
const PerfID _expand_halos
Definition: FeatureFloodCount.h:776
FeatureFloodCount::_var_index_maps
std::vector< std::map< dof_id_type, int > > _var_index_maps
This map keeps track of which variables own which nodes.
Definition: FeatureFloodCount.h:639
FeatureFloodCount::_n_vars
const std::size_t _n_vars
Definition: FeatureFloodCount.h:617
FeatureFloodCount::_local_to_global_feature_map
std::vector< std::size_t > _local_to_global_feature_map
The vector recording the local to global feature indices.
Definition: FeatureFloodCount.h:681
FeatureFloodCount::updateBoundaryIntersections
void updateBoundaryIntersections(FeatureData &feature) const
Update the feature's attributes to indicate boundary intersections.
Definition: FeatureFloodCount.C:1724
FeatureFloodCount::meshChanged
virtual void meshChanged() override
Definition: FeatureFloodCount.C:335
FeatureFloodCount::_feature_counts_per_map
std::vector< unsigned int > _feature_counts_per_map
The number of features seen by this object per map.
Definition: FeatureFloodCount.h:645
FeatureFloodCount::BoundaryIntersection::PRIMARY_PERCOLATION_BOUNDARY
FeatureFloodCount::FeatureData::_status
Status _status
The status of a feature (used mostly in derived classes like the GrainTracker)
Definition: FeatureFloodCount.h:307
FeatureFloodCount::_primary_perc_bnds
std::vector< BoundaryID > _primary_perc_bnds
Definition: FeatureFloodCount.h:717
FeatureFloodCount::updateFieldInfo
virtual void updateFieldInfo()
This method is used to populate any of the data structures used for storing field data (nodal or elem...
Definition: FeatureFloodCount.C:1249
FeatureFloodCount::FieldType::HALOS
FeatureFloodCount::serialize
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...
Definition: FeatureFloodCount.C:1067
FeatureFloodCount::Status::MARKED
FeatureFloodCount::getFECoupledVars
const std::vector< MooseVariableFEBase * > & getFECoupledVars() const
Returns a const vector to the coupled MooseVariableFEBase pointers.
Definition: FeatureFloodCount.h:101
FeatureFloodCount::getNumberActiveFeatures
std::size_t getNumberActiveFeatures() const
Return the number of active features.
Definition: FeatureFloodCount.C:791