www.mooseframework.org
EFAElement.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #ifndef EFAELEMENT_H
9 #define EFAELEMENT_H
10 
11 #include <vector>
12 #include <map>
13 #include <set>
14 #include <ostream>
15 
16 class EFANode;
17 
19 {
20 public:
21  EFAElement(unsigned int eid, unsigned int n_nodes);
22 
23  virtual ~EFAElement();
24 
25 protected:
26  unsigned int _id;
27  unsigned int _num_nodes;
28  std::vector<EFANode *> _nodes;
29  std::vector<EFANode *> _local_nodes;
31  std::vector<EFAElement *> _children;
33  std::vector<unsigned int> _crack_tip_neighbors;
34  std::vector<EFAElement *>
35  _general_neighbors; // all elements sharing at least one node with curr elem
36 
37 public:
38  // common methods
39  unsigned int id() const;
40  unsigned int numNodes() const;
41  void setNode(unsigned int node_id, EFANode * node);
42  EFANode * getNode(unsigned int node_id) const;
43  bool containsNode(EFANode * node) const;
44  void printNodes(std::ostream & ostream) const;
45  EFANode * createLocalNodeFromGlobalNode(const EFANode * global_node) const;
46  EFANode * getGlobalNodeFromLocalNode(const EFANode * local_node) const;
47  unsigned int getLocalNodeIndex(EFANode * node) const;
48 
49  void setCrackTipSplit();
50  bool isCrackTipSplit() const;
51  unsigned int numCrackTipNeighbors() const;
52  unsigned int getCrackTipNeighbor(unsigned int index) const;
53  void addCrackTipNeighbor(EFAElement * neighbor_elem);
54 
55  EFAElement * getParent() const;
56  EFAElement * getChild(unsigned int child_id) const;
57  void setParent(EFAElement * parent);
58  unsigned int numChildren() const;
59  void addChild(EFAElement * child);
61  void findGeneralNeighbors(std::map<EFANode *, std::set<EFAElement *>> & InverseConnectivity);
62  EFAElement * getGeneralNeighbor(unsigned int index) const;
63  unsigned int numGeneralNeighbors() const;
64 
65  // pure virtual methods
66  virtual unsigned int numFragments() const = 0;
67  virtual bool isPartial() const = 0;
68  virtual void getNonPhysicalNodes(std::set<EFANode *> & non_physical_nodes) const = 0;
69 
70  virtual void switchNode(EFANode * new_node, EFANode * old_node, bool descend_to_parent) = 0;
71  virtual void switchEmbeddedNode(EFANode * new_node, EFANode * old_node) = 0;
72  virtual void updateFragmentNode() = 0;
73  virtual void getMasterInfo(EFANode * node,
74  std::vector<EFANode *> & master_nodes,
75  std::vector<double> & master_weights) const = 0;
76  virtual unsigned int numInteriorNodes() const = 0;
77 
78  virtual unsigned int getNeighborIndex(const EFAElement * neighbor_elem) const = 0;
79  virtual void clearNeighbors() = 0;
80  virtual void
81  setupNeighbors(std::map<EFANode *, std::set<EFAElement *>> & InverseConnectivityMap) = 0;
82  virtual void neighborSanityCheck() const = 0;
83 
84  virtual void initCrackTip(std::set<EFAElement *> & CrackTipElements) = 0;
85  virtual bool shouldDuplicateForCrackTip(const std::set<EFAElement *> & CrackTipElements) = 0;
86  virtual bool
87  shouldDuplicateCrackTipSplitElement(const std::set<EFAElement *> & CrackTipElements) = 0;
88  virtual bool shouldDuplicateForPhantomCorner() = 0;
89  virtual bool willCrackTipExtend(std::vector<unsigned int> & split_neighbors) const = 0;
90  virtual bool isCrackTipElement() const = 0;
91 
92  virtual unsigned int getNumCuts() const = 0;
93  virtual bool isFinalCut() const = 0;
94  virtual void updateFragments(const std::set<EFAElement *> & CrackTipElements,
95  std::map<unsigned int, EFANode *> & EmbeddedNodes) = 0;
96  virtual void fragmentSanityCheck(unsigned int n_old_frag_edges,
97  unsigned int n_old_frag_cuts) const = 0;
98  virtual void restoreFragment(const EFAElement * const from_elem) = 0;
99 
100  virtual void createChild(const std::set<EFAElement *> & CrackTipElements,
101  std::map<unsigned int, EFAElement *> & Elements,
102  std::map<unsigned int, EFAElement *> & newChildElements,
103  std::vector<EFAElement *> & ChildElements,
104  std::vector<EFAElement *> & ParentElements,
105  std::map<unsigned int, EFANode *> & TempNodes) = 0;
106  virtual void removePhantomEmbeddedNode() = 0;
107  virtual void
108  connectNeighbors(std::map<unsigned int, EFANode *> & PermanentNodes,
109  std::map<unsigned int, EFANode *> & TempNodes,
110  std::map<EFANode *, std::set<EFAElement *>> & InverseConnectivityMap,
111  bool merge_phantom_edges) = 0;
112  virtual void printElement(std::ostream & ostream) = 0;
113 
114 protected:
115  // common methods
116  void mergeNodes(EFANode *& childNode,
117  EFANode *& childOfNeighborNode,
118  EFAElement * childOfNeighborElem,
119  std::map<unsigned int, EFANode *> & PermanentNodes,
120  std::map<unsigned int, EFANode *> & TempNodes);
121 };
122 
123 #endif
virtual bool shouldDuplicateForCrackTip(const std::set< EFAElement * > &CrackTipElements)=0
void clearParentAndChildren()
Definition: EFAElement.C:207
unsigned int getLocalNodeIndex(EFANode *node) const
Definition: EFAElement.C:109
virtual void updateFragments(const std::set< EFAElement * > &CrackTipElements, std::map< unsigned int, EFANode * > &EmbeddedNodes)=0
virtual unsigned int getNeighborIndex(const EFAElement *neighbor_elem) const =0
virtual bool shouldDuplicateCrackTipSplitElement(const std::set< EFAElement * > &CrackTipElements)=0
EFANode * getNode(unsigned int node_id) const
Definition: EFAElement.C:44
EFANode * getGlobalNodeFromLocalNode(const EFANode *local_node) const
Definition: EFAElement.C:93
unsigned int _id
Definition: EFAElement.h:26
unsigned int numChildren() const
Definition: EFAElement.C:195
bool isCrackTipSplit() const
Definition: EFAElement.C:134
virtual void createChild(const std::set< EFAElement * > &CrackTipElements, std::map< unsigned int, EFAElement * > &Elements, std::map< unsigned int, EFAElement * > &newChildElements, std::vector< EFAElement * > &ChildElements, std::vector< EFAElement * > &ParentElements, std::map< unsigned int, EFANode * > &TempNodes)=0
virtual bool isPartial() const =0
unsigned int id() const
Definition: EFAElement.C:26
virtual bool isFinalCut() const =0
virtual void setupNeighbors(std::map< EFANode *, std::set< EFAElement * >> &InverseConnectivityMap)=0
EFAElement(unsigned int eid, unsigned int n_nodes)
Definition: EFAElement.C:14
virtual void getMasterInfo(EFANode *node, std::vector< EFANode * > &master_nodes, std::vector< double > &master_weights) const =0
void addChild(EFAElement *child)
Definition: EFAElement.C:201
unsigned int numNodes() const
Definition: EFAElement.C:32
virtual void updateFragmentNode()=0
std::vector< EFANode * > _nodes
Definition: EFAElement.h:28
void setParent(EFAElement *parent)
Definition: EFAElement.C:189
virtual unsigned int numFragments() const =0
unsigned int _num_nodes
Definition: EFAElement.h:27
virtual bool isCrackTipElement() const =0
virtual void switchEmbeddedNode(EFANode *new_node, EFANode *old_node)=0
virtual void switchNode(EFANode *new_node, EFANode *old_node, bool descend_to_parent)=0
virtual ~EFAElement()
Definition: EFAElement.C:23
EFAElement * _parent
Definition: EFAElement.h:30
EFAElement * getGeneralNeighbor(unsigned int index) const
Definition: EFAElement.C:234
virtual void neighborSanityCheck() const =0
virtual void initCrackTip(std::set< EFAElement * > &CrackTipElements)=0
virtual void connectNeighbors(std::map< unsigned int, EFANode * > &PermanentNodes, std::map< unsigned int, EFANode * > &TempNodes, std::map< EFANode *, std::set< EFAElement * >> &InverseConnectivityMap, bool merge_phantom_edges)=0
virtual void restoreFragment(const EFAElement *const from_elem)=0
unsigned int numGeneralNeighbors() const
Definition: EFAElement.C:240
virtual void clearNeighbors()=0
unsigned int numCrackTipNeighbors() const
Definition: EFAElement.C:140
virtual void printElement(std::ostream &ostream)=0
unsigned int getCrackTipNeighbor(unsigned int index) const
Definition: EFAElement.C:146
virtual unsigned int getNumCuts() const =0
EFAElement * getParent() const
Definition: EFAElement.C:174
void findGeneralNeighbors(std::map< EFANode *, std::set< EFAElement * >> &InverseConnectivity)
Definition: EFAElement.C:214
virtual void fragmentSanityCheck(unsigned int n_old_frag_edges, unsigned int n_old_frag_cuts) const =0
virtual void getNonPhysicalNodes(std::set< EFANode * > &non_physical_nodes) const =0
bool containsNode(EFANode *node) const
Definition: EFAElement.C:50
virtual void removePhantomEmbeddedNode()=0
void mergeNodes(EFANode *&childNode, EFANode *&childOfNeighborNode, EFAElement *childOfNeighborElem, std::map< unsigned int, EFANode * > &PermanentNodes, std::map< unsigned int, EFANode * > &TempNodes)
Definition: EFAElement.C:246
void setCrackTipSplit()
Definition: EFAElement.C:128
virtual unsigned int numInteriorNodes() const =0
void addCrackTipNeighbor(EFAElement *neighbor_elem)
Definition: EFAElement.C:155
virtual bool shouldDuplicateForPhantomCorner()=0
virtual bool willCrackTipExtend(std::vector< unsigned int > &split_neighbors) const =0
std::vector< EFAElement * > _general_neighbors
Definition: EFAElement.h:35
std::vector< EFAElement * > _children
Definition: EFAElement.h:31
EFAElement * getChild(unsigned int child_id) const
Definition: EFAElement.C:180
bool _crack_tip_split_element
Definition: EFAElement.h:32
void printNodes(std::ostream &ostream) const
Definition: EFAElement.C:59
std::vector< unsigned int > _crack_tip_neighbors
Definition: EFAElement.h:33
EFANode * createLocalNodeFromGlobalNode(const EFANode *global_node) const
Definition: EFAElement.C:68
void setNode(unsigned int node_id, EFANode *node)
Definition: EFAElement.C:38
std::vector< EFANode * > _local_nodes
Definition: EFAElement.h:29