www.mooseframework.org
EFAElement2D.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 EFAELEMENT2D_H
9 #define EFAELEMENT2D_H
10 
11 #include "EFAElement.h"
12 #include "EFAPoint.h"
13 
14 class EFAEdge;
15 class EFAFace;
16 class EFAFaceNode;
17 class EFAFragment2D;
18 
19 class EFAElement2D : public EFAElement
20 {
21 public:
22  EFAElement2D(unsigned int eid, unsigned int n_nodes);
23  EFAElement2D(const EFAElement2D * from_elem, bool convert_to_local);
24  EFAElement2D(const EFAFace * from_face);
25 
26  ~EFAElement2D();
27 
28 private:
29  unsigned int _num_edges;
30  std::vector<EFAEdge *> _edges;
31  std::vector<EFAFaceNode *> _interior_nodes;
32  std::vector<std::vector<EFAElement2D *>> _edge_neighbors;
33  std::vector<EFAFragment2D *> _fragments;
34  std::vector<EFAPoint> _local_node_coor;
35 
36 public:
37  // override virtual methods in base class
38  virtual unsigned int numFragments() const;
39  virtual bool isPartial() const;
40  virtual void getNonPhysicalNodes(std::set<EFANode *> & non_physical_nodes) const;
41 
42  virtual void switchNode(EFANode * new_node, EFANode * old_node, bool descend_to_parent);
43  virtual void switchEmbeddedNode(EFANode * new_node, EFANode * old_node);
44  virtual void updateFragmentNode();
45  virtual void getMasterInfo(EFANode * node,
46  std::vector<EFANode *> & master_nodes,
47  std::vector<double> & master_weights) const;
48  virtual unsigned int numInteriorNodes() const;
49 
50  bool overlaysElement(const EFAElement2D * other_elem) const;
51  virtual unsigned int getNeighborIndex(const EFAElement * neighbor_elem) const;
52  virtual void clearNeighbors();
53  virtual void setupNeighbors(std::map<EFANode *, std::set<EFAElement *>> & InverseConnectivityMap);
54  virtual void neighborSanityCheck() const;
55 
56  virtual void initCrackTip(std::set<EFAElement *> & CrackTipElements);
57  virtual bool shouldDuplicateForCrackTip(const std::set<EFAElement *> & CrackTipElements);
58  virtual bool shouldDuplicateCrackTipSplitElement(const std::set<EFAElement *> & CrackTipElements);
59  virtual bool shouldDuplicateForPhantomCorner();
60  virtual bool willCrackTipExtend(std::vector<unsigned int> & split_neighbors) const;
61  virtual bool isCrackTipElement() const;
62 
63  virtual unsigned int getNumCuts() const;
64  virtual bool isFinalCut() const;
65  virtual void updateFragments(const std::set<EFAElement *> & CrackTipElements,
66  std::map<unsigned int, EFANode *> & EmbeddedNodes);
67  virtual void fragmentSanityCheck(unsigned int n_old_frag_edges,
68  unsigned int n_old_frag_cuts) const;
69  virtual void restoreFragment(const EFAElement * const from_elem);
70 
71  virtual void createChild(const std::set<EFAElement *> & CrackTipElements,
72  std::map<unsigned int, EFAElement *> & Elements,
73  std::map<unsigned int, EFAElement *> & newChildElements,
74  std::vector<EFAElement *> & ChildElements,
75  std::vector<EFAElement *> & ParentElements,
76  std::map<unsigned int, EFANode *> & TempNodes);
77  virtual void removePhantomEmbeddedNode();
78  virtual void
79  connectNeighbors(std::map<unsigned int, EFANode *> & PermanentNodes,
80  std::map<unsigned int, EFANode *> & TempNodes,
81  std::map<EFANode *, std::set<EFAElement *>> & InverseConnectivityMap,
82  bool merge_phantom_edges);
83  virtual void printElement(std::ostream & ostream);
84 
85  // EFAelement2D specific methods
86  EFAFragment2D * getFragment(unsigned int frag_id) const;
87  std::set<EFANode *> getEdgeNodes(unsigned int edge_id) const;
88  bool getEdgeNodeParametricCoordinate(EFANode * node, std::vector<double> & para_coor) const;
89  EFAFaceNode * getInteriorNode(unsigned int interior_node_id) const;
90  void deleteInteriorNodes();
91 
92  unsigned int numEdges() const;
93  void setEdge(unsigned int edge_id, EFAEdge * edge);
94  void createEdges();
95  EFAEdge * getEdge(unsigned int edge_id) const;
96 
97  EFAEdge * getFragmentEdge(unsigned int frag_id, unsigned int edge_id) const;
98  std::set<EFANode *> getPhantomNodeOnEdge(unsigned int edge_id) const;
99  bool getFragmentEdgeID(unsigned int elem_edge_id, unsigned int & frag_edge_id) const;
100  bool isEdgePhantom(unsigned int edge_id) const;
101 
102  unsigned int numEdgeNeighbors(unsigned int edge_id) const;
103  EFAElement2D * getEdgeNeighbor(unsigned int edge_id, unsigned int neighbor_id) const;
104 
105  unsigned int getCrackTipSplitElementID() const;
106 
107  bool fragmentHasTipEdges() const;
108  unsigned int getTipEdgeID() const;
109  EFANode * getTipEmbeddedNode() const;
110  bool edgeContainsTip(unsigned int edge_id) const;
111  bool fragmentEdgeAlreadyCut(unsigned int ElemEdgeID) const;
112 
113  void addEdgeCut(unsigned int edge_id,
114  double position,
115  EFANode * embedded_node,
116  std::map<unsigned int, EFANode *> & EmbeddedNodes,
117  bool add_to_neighbor);
118  void addNodeCut(unsigned int node_id,
119  EFANode * embedded_permanent_node,
120  std::map<unsigned int, EFANode *> & PermanentNodes,
121  std::map<unsigned int, EFANode *> & EmbeddedPermanentNodes);
122  bool addFragmentEdgeCut(unsigned int frag_edge_id,
123  double position,
124  std::map<unsigned int, EFANode *> & EmbeddedNodes);
125  std::vector<EFAFragment2D *> branchingSplit(std::map<unsigned int, EFANode *> & EmbeddedNodes);
126 
127  std::vector<EFANode *> getCommonNodes(const EFAElement2D * other_elem) const;
128 
129 private:
130  // given the 1D parent coord of a point in an 2D element edge, translate it to 2D parametric
131  // coords
132  void mapParametricCoordFrom1Dto2D(unsigned int edge_id,
133  double xi_1d,
134  std::vector<double> & para_coor) const;
135  void setLocalCoordinates();
136 };
137 
138 #endif
virtual bool isPartial() const
Definition: EFAElement2D.C:206
virtual void fragmentSanityCheck(unsigned int n_old_frag_edges, unsigned int n_old_frag_cuts) const
Definition: EFAElement2D.C:869
virtual bool willCrackTipExtend(std::vector< unsigned int > &split_neighbors) const
Definition: EFAElement2D.C:727
EFAFragment2D * getFragment(unsigned int frag_id) const
virtual void initCrackTip(std::set< EFAElement * > &CrackTipElements)
Definition: EFAElement2D.C:554
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)
virtual void printElement(std::ostream &ostream)
virtual unsigned int getNumCuts() const
Definition: EFAElement2D.C:779
virtual void getNonPhysicalNodes(std::set< EFANode * > &non_physical_nodes) const
Definition: EFAElement2D.C:233
bool overlaysElement(const EFAElement2D *other_elem) const
Definition: EFAElement2D.C:357
virtual void switchEmbeddedNode(EFANode *new_node, EFANode *old_node)
Definition: EFAElement2D.C:287
virtual unsigned int getNeighborIndex(const EFAElement *neighbor_elem) const
Definition: EFAElement2D.C:445
virtual void neighborSanityCheck() const
Definition: EFAElement2D.C:521
virtual void getMasterInfo(EFANode *node, std::vector< EFANode * > &master_nodes, std::vector< double > &master_weights) const
Definition: EFAElement2D.C:298
virtual void restoreFragment(const EFAElement *const from_elem)
Definition: EFAElement2D.C:943
std::vector< EFAFaceNode * > _interior_nodes
Definition: EFAElement2D.h:31
virtual bool shouldDuplicateForPhantomCorner()
Definition: EFAElement2D.C:688
virtual void setupNeighbors(std::map< EFANode *, std::set< EFAElement * >> &InverseConnectivityMap)
Definition: EFAElement2D.C:465
std::vector< std::vector< EFAElement2D * > > _edge_neighbors
Definition: EFAElement2D.h:32
virtual bool isCrackTipElement() const
Definition: EFAElement2D.C:773
std::set< EFANode * > getPhantomNodeOnEdge(unsigned int edge_id) const
void setEdge(unsigned int edge_id, EFAEdge *edge)
bool getEdgeNodeParametricCoordinate(EFANode *node, std::vector< double > &para_coor) const
virtual unsigned int numInteriorNodes() const
Definition: EFAElement2D.C:351
std::vector< EFAEdge * > _edges
Definition: EFAElement2D.h:30
virtual bool isFinalCut() const
Definition: EFAElement2D.C:789
bool fragmentHasTipEdges() const
EFAEdge * getEdge(unsigned int edge_id) const
EFAEdge * getFragmentEdge(unsigned int frag_id, unsigned int edge_id) const
EFAElement2D * getEdgeNeighbor(unsigned int edge_id, unsigned int neighbor_id) const
EFANode * getTipEmbeddedNode() const
virtual void updateFragmentNode()
unsigned int getCrackTipSplitElementID() const
Definition: EFAElement2D.C:592
EFAFaceNode * getInteriorNode(unsigned int interior_node_id) const
virtual void switchNode(EFANode *new_node, EFANode *old_node, bool descend_to_parent)
Definition: EFAElement2D.C:260
std::vector< EFANode * > getCommonNodes(const EFAElement2D *other_elem) const
virtual void updateFragments(const std::set< EFAElement * > &CrackTipElements, std::map< unsigned int, EFANode * > &EmbeddedNodes)
Definition: EFAElement2D.C:808
bool fragmentEdgeAlreadyCut(unsigned int ElemEdgeID) const
bool edgeContainsTip(unsigned int edge_id) const
bool isEdgePhantom(unsigned int edge_id) const
virtual void removePhantomEmbeddedNode()
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)
Definition: EFAElement2D.C:984
virtual void clearNeighbors()
Definition: EFAElement2D.C:457
bool getFragmentEdgeID(unsigned int elem_edge_id, unsigned int &frag_edge_id) const
void setLocalCoordinates()
Definition: EFAElement2D.C:139
std::vector< EFAPoint > _local_node_coor
Definition: EFAElement2D.h:34
void addEdgeCut(unsigned int edge_id, double position, EFANode *embedded_node, std::map< unsigned int, EFANode * > &EmbeddedNodes, bool add_to_neighbor)
std::set< EFANode * > getEdgeNodes(unsigned int edge_id) const
virtual unsigned int numFragments() const
Definition: EFAElement2D.C:200
void addNodeCut(unsigned int node_id, EFANode *embedded_permanent_node, std::map< unsigned int, EFANode * > &PermanentNodes, std::map< unsigned int, EFANode * > &EmbeddedPermanentNodes)
unsigned int numEdgeNeighbors(unsigned int edge_id) const
virtual bool shouldDuplicateCrackTipSplitElement(const std::set< EFAElement * > &CrackTipElements)
Definition: EFAElement2D.C:637
unsigned int _num_edges
Definition: EFAElement2D.h:29
void mapParametricCoordFrom1Dto2D(unsigned int edge_id, double xi_1d, std::vector< double > &para_coor) const
unsigned int numEdges() const
void deleteInteriorNodes()
bool addFragmentEdgeCut(unsigned int frag_edge_id, double position, std::map< unsigned int, EFANode * > &EmbeddedNodes)
EFAElement2D(unsigned int eid, unsigned int n_nodes)
Definition: EFAElement2D.C:21
unsigned int getTipEdgeID() const
virtual bool shouldDuplicateForCrackTip(const std::set< EFAElement * > &CrackTipElements)
Definition: EFAElement2D.C:613
std::vector< EFAFragment2D * > branchingSplit(std::map< unsigned int, EFANode * > &EmbeddedNodes)
std::vector< EFAFragment2D * > _fragments
Definition: EFAElement2D.h:33
void createEdges()