www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
EFAEdge Class Reference

#include <EFAEdge.h>

Public Member Functions

 EFAEdge (EFANode *node1, EFANode *node2)
 
 EFAEdge (const EFAEdge &other_edge)
 
 ~EFAEdge ()
 
bool equivalent (const EFAEdge &other) const
 
bool isPartialOverlap (const EFAEdge &other) const
 
bool containsEdge (const EFAEdge &other) const
 
bool getNodeMasters (EFANode *node, std::vector< EFANode *> &master_nodes, std::vector< double > &master_weights) const
 
void addIntersection (double position, EFANode *embedded_node_tmp, EFANode *from_node)
 
void resetIntersection (double position, EFANode *embedded_node_tmp, EFANode *from_node)
 
void copyIntersection (const EFAEdge &other, unsigned int from_node_id)
 
EFANodegetNode (unsigned int index) const
 
EFANodegetInteriorNode () const
 
void setInteriorNode (EFANode *node)
 
void reverseNodes ()
 
bool hasIntersection () const
 
bool hasIntersectionAtPosition (double position, EFANode *from_node) const
 
double getIntersection (unsigned int emb_id, EFANode *from_node) const
 
double distanceFromNode1 (EFANode *node) const
 
bool isEmbeddedNode (const EFANode *node) const
 
unsigned int getEmbeddedNodeIndex (EFANode *node) const
 
unsigned int getEmbeddedNodeIndex (double position, EFANode *from_node) const
 
EFANodegetEmbeddedNode (unsigned int index) const
 
unsigned int numEmbeddedNodes () const
 
void consistencyCheck ()
 
void switchNode (EFANode *new_node, EFANode *old_node)
 
bool containsNode (const EFANode *node) const
 
void removeEmbeddedNodes ()
 
void removeEmbeddedNode (EFANode *node)
 

Private Attributes

EFANode_edge_node1
 
EFANode_edge_node2
 
EFANode_edge_interior_node
 
std::vector< EFANode * > _embedded_nodes
 
std::vector< double > _intersection_x
 

Detailed Description

Definition at line 17 of file EFAEdge.h.

Constructor & Destructor Documentation

◆ EFAEdge() [1/2]

EFAEdge::EFAEdge ( EFANode node1,
EFANode node2 
)

Definition at line 16 of file EFAEdge.C.

16  : _edge_node1(node1), _edge_node2(node2)
17 {
18  _embedded_nodes.clear();
19  _intersection_x.clear();
20  _edge_interior_node = NULL;
22 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
void consistencyCheck()
Definition: EFAEdge.C:345
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_interior_node
Definition: EFAEdge.h:28
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ EFAEdge() [2/2]

EFAEdge::EFAEdge ( const EFAEdge other_edge)

Definition at line 24 of file EFAEdge.C.

25 {
26  _edge_node1 = other_edge._edge_node1;
27  _edge_node2 = other_edge._edge_node2;
28  _intersection_x = other_edge._intersection_x;
29  _embedded_nodes = other_edge._embedded_nodes;
31 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
void consistencyCheck()
Definition: EFAEdge.C:345
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ ~EFAEdge()

EFAEdge::~EFAEdge ( )

Definition at line 33 of file EFAEdge.C.

34 { // in EFAelement's destructor
35 }

Member Function Documentation

◆ addIntersection()

void EFAEdge::addIntersection ( double  position,
EFANode embedded_node_tmp,
EFANode from_node 
)

Definition at line 130 of file EFAEdge.C.

Referenced by EFAElement2D::addEdgeCut(), EFAElement3D::addFaceEdgeCut(), EFAElement2D::addFragmentEdgeCut(), EFAFragment2D::combineTipEdges(), EFAFace::combineTwoEdges(), and EFAFace::combineWithFace().

131 {
132  _embedded_nodes.push_back(embedded_node_tmp);
133  if (from_node == _edge_node1)
134  _intersection_x.push_back(position);
135  else if (from_node == _edge_node2)
136  _intersection_x.push_back(1.0 - position);
137  else
138  EFAError("In addIntersection from_node does not exist on edge");
139 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ consistencyCheck()

void EFAEdge::consistencyCheck ( )

Definition at line 345 of file EFAEdge.C.

Referenced by EFAEdge().

346 {
347  bool consistent = true;
351  consistent = false;
355  consistent = false;
356  if (!consistent)
357  EFAError("In consistencyCheck nodes on edge are not consistent");
358  if (_embedded_nodes.size() != _intersection_x.size())
359  EFAError("In consistencyCheck num of emb_nodes must be = num of inters_x");
360 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27
N_CATEGORY category() const
Definition: EFANode.C:42

◆ containsEdge()

bool EFAEdge::containsEdge ( const EFAEdge other) const

Definition at line 63 of file EFAEdge.C.

Referenced by EFAFragment2D::combineTipEdges(), EFAElement3D::getFragmentFaceEdgeID(), EFAFragment2D::isEdgeInterior(), and isPartialOverlap().

64 {
65  return containsNode(other._edge_node1) && containsNode(other._edge_node2);
66 }
EFANode * _edge_node1
Definition: EFAEdge.h:26
bool containsNode(const EFANode *node) const
Definition: EFAEdge.C:377
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ containsNode()

bool EFAEdge::containsNode ( const EFANode node) const

Definition at line 377 of file EFAEdge.C.

Referenced by XFEMCutElem2D::computePhysicalFaceAreaFraction(), containsEdge(), and EFAFace::EFAFace().

378 {
379  return _edge_node1 == node || _edge_node2 == node || isEmbeddedNode(node);
380 }
EFANode * _edge_node1
Definition: EFAEdge.h:26
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:266
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ copyIntersection()

void EFAEdge::copyIntersection ( const EFAEdge other,
unsigned int  from_node_id 
)

Definition at line 160 of file EFAEdge.C.

Referenced by EFAElement2D::createChild().

161 {
162  _embedded_nodes.clear();
163  _intersection_x.clear();
165  if (from_node_id == 0)
167  else if (from_node_id == 1)
168  {
169  for (unsigned int i = 0; i < other.numEmbeddedNodes(); ++i)
170  _intersection_x.push_back(1.0 - other._intersection_x[i]);
171  }
172  else
173  EFAError("from_node_id out of bounds");
174  if (_embedded_nodes.size() != _intersection_x.size())
175  EFAError("in copyIntersection num emb_nodes must == num of inters_x");
176 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
unsigned int numEmbeddedNodes() const
Definition: EFAEdge.C:339

◆ distanceFromNode1()

double EFAEdge::distanceFromNode1 ( EFANode node) const

Definition at line 248 of file EFAEdge.C.

Referenced by EFAFragment2D::combineTipEdges(), and EFAElement3D::isPhysicalEdgeCut().

249 {
250  double xi = -100.0;
251  if (_edge_node1 == node)
252  xi = 0.0;
253  else if (_edge_node2 == node)
254  xi = 1.0;
255  else if (isEmbeddedNode(node))
256  {
257  unsigned int embedded_node_id = getEmbeddedNodeIndex(node);
258  xi = _intersection_x[embedded_node_id];
259  }
260  else
261  EFAError("the given node is not found in the current edge");
262  return xi;
263 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
unsigned int getEmbeddedNodeIndex(EFANode *node) const
Definition: EFAEdge.C:281
EFANode * _edge_node1
Definition: EFAEdge.h:26
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:266
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ equivalent()

bool EFAEdge::equivalent ( const EFAEdge other) const

Definition at line 38 of file EFAEdge.C.

Referenced by EFAElement3D::getNeighborEdgeIndex(), and EFAElement2D::shouldDuplicateForPhantomCorner().

39 {
40  bool isEqual = false;
41  if (other._edge_node1 == _edge_node1 && other._edge_node2 == _edge_node2)
42  isEqual = true;
43  else if (other._edge_node2 == _edge_node1 && other._edge_node1 == _edge_node2)
44  isEqual = true;
45 
46  // For cut along the edge case
47  if (isEqual)
48  {
51  isEqual = false;
52  }
53  return isEqual;
54 }
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27
N_CATEGORY category() const
Definition: EFANode.C:42

◆ getEmbeddedNode()

EFANode * EFAEdge::getEmbeddedNode ( unsigned int  index) const

Definition at line 330 of file EFAEdge.C.

Referenced by EFAElement3D::addFaceEdgeCut(), EFAElement3D::checkNeighborFaceCut(), XFEM::markCutEdgesByState(), and EFAElement3D::removePhantomEmbeddedNode().

331 {
332  if (index < _embedded_nodes.size())
333  return _embedded_nodes[index];
334  else
335  EFAError("in getEmbeddedNode index out of bounds");
336 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ getEmbeddedNodeIndex() [1/2]

unsigned int EFAEdge::getEmbeddedNodeIndex ( EFANode node) const

Definition at line 281 of file EFAEdge.C.

Referenced by EFAElement3D::addFaceEdgeCut(), EFAElement3D::checkNeighborFaceCut(), distanceFromNode1(), and switchNode().

282 {
283  unsigned int index;
284  bool have_index = false;
285  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
286  {
287  if (_embedded_nodes[i] == node)
288  {
289  have_index = true;
290  index = i;
291  break;
292  }
293  }
294  if (!have_index)
295  EFAError("In getEmbeddedNodeIndex, could not find index");
296  return index;
297 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ getEmbeddedNodeIndex() [2/2]

unsigned int EFAEdge::getEmbeddedNodeIndex ( double  position,
EFANode from_node 
) const

Definition at line 300 of file EFAEdge.C.

301 {
302  bool have_index = false;
303  unsigned int index;
304  if (hasIntersection())
305  {
306  double tmp_intersection_x = -1.0; // dist from edge_node1
307  if (from_node == _edge_node1)
308  tmp_intersection_x = position;
309  else if (from_node == _edge_node2)
310  tmp_intersection_x = 1.0 - position;
311  else
312  EFAError("In getEmbeddedNodeIndex, from_node does not exist on edge");
313 
314  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
315  {
316  if (std::abs(tmp_intersection_x - _intersection_x[i]) < Xfem::tol)
317  {
318  have_index = true;
319  index = i;
320  break;
321  }
322  }
323  }
324  if (!have_index)
325  EFAError("In getEmbeddedNodeIndex, could not find index");
326  return index;
327 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
bool hasIntersection() const
Definition: EFAEdge.C:198
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
static const double tol
Definition: XFEMFuncs.h:21
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ getInteriorNode()

EFANode* EFAEdge::getInteriorNode ( ) const
inline

Definition at line 45 of file EFAEdge.h.

Referenced by EFAElement2D::connectNeighbors().

45 { return _edge_interior_node; };
EFANode * _edge_interior_node
Definition: EFAEdge.h:28

◆ getIntersection()

double EFAEdge::getIntersection ( unsigned int  emb_id,
EFANode from_node 
) const

Definition at line 237 of file EFAEdge.C.

Referenced by EFAElement2D::addFragmentEdgeCut().

238 {
239  if (from_node == _edge_node1)
240  return _intersection_x[emb_id];
241  else if (from_node == _edge_node2)
242  return 1.0 - _intersection_x[emb_id];
243  else
244  EFAError("In getIntersection node not in edge");
245 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ getNode()

EFANode * EFAEdge::getNode ( unsigned int  index) const

◆ getNodeMasters()

bool EFAEdge::getNodeMasters ( EFANode node,
std::vector< EFANode *> &  master_nodes,
std::vector< double > &  master_weights 
) const

Definition at line 69 of file EFAEdge.C.

72 {
73  master_nodes.clear();
74  master_weights.clear();
75  bool masters_found = false;
76  if (_edge_node1 == node || _edge_node2 == node)
77  {
78  master_nodes.push_back(node);
79  master_weights.push_back(1.0);
80  masters_found = true;
81  }
82  else
83  {
84  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
85  {
86  if (_embedded_nodes[i] == node)
87  {
88  master_nodes.push_back(_edge_node1);
89  master_nodes.push_back(_edge_node2);
90  master_weights.push_back(1.0 - _intersection_x[i]);
91  master_weights.push_back(_intersection_x[i]);
92  masters_found = true;
93  break;
94  }
95  }
96  }
97  return masters_found;
98 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ hasIntersection()

bool EFAEdge::hasIntersection ( ) const

Definition at line 198 of file EFAEdge.C.

Referenced by EFAElement2D::addFragmentEdgeCut(), EFAFragment2D::combineTipEdges(), EFAElement2D::connectNeighbors(), EFAElement2D::fragmentEdgeAlreadyCut(), getEmbeddedNodeIndex(), hasIntersectionAtPosition(), and XFEM::markCutEdgesByState().

199 {
200  bool has = false;
201  if (_edge_node1->parent() != NULL)
203 
204  if (_edge_node2->parent() != NULL)
206 
207  return has || _embedded_nodes.size() > 0;
208 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27
EFANode * parent() const
Definition: EFANode.C:48
N_CATEGORY category() const
Definition: EFANode.C:42

◆ hasIntersectionAtPosition()

bool EFAEdge::hasIntersectionAtPosition ( double  position,
EFANode from_node 
) const

Definition at line 211 of file EFAEdge.C.

Referenced by EFAElement3D::addFaceEdgeCut(), EFAElement2D::addFragmentEdgeCut(), and EFAElement3D::checkNeighborFaceCut().

212 {
213  bool has_int = false;
214  if (hasIntersection())
215  {
216  double tmp_intersection_x = -1.0;
217  if (from_node == _edge_node1)
218  tmp_intersection_x = position;
219  else if (from_node == _edge_node2)
220  tmp_intersection_x = 1.0 - position;
221  else
222  EFAError("In hasIntersectionAtPosition from_node does not exist on edge");
223 
224  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
225  {
226  if (std::abs(tmp_intersection_x - _intersection_x[i]) < Xfem::tol)
227  {
228  has_int = true;
229  break;
230  }
231  }
232  }
233  return has_int;
234 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
bool hasIntersection() const
Definition: EFAEdge.C:198
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
static const double tol
Definition: XFEMFuncs.h:21
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ isEmbeddedNode()

bool EFAEdge::isEmbeddedNode ( const EFANode node) const

Definition at line 266 of file EFAEdge.C.

Referenced by containsNode(), distanceFromNode1(), and switchNode().

267 {
268  bool is_emb = false;
269  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
270  {
271  if (_embedded_nodes[i] == node)
272  {
273  is_emb = true;
274  break;
275  }
276  }
277  return is_emb;
278 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ isPartialOverlap()

bool EFAEdge::isPartialOverlap ( const EFAEdge other) const

Definition at line 57 of file EFAEdge.C.

Referenced by XFEM::correctCrackExtensionDirection(), and XFEM::markCutEdgesByState().

58 {
59  return containsEdge(other) || other.containsEdge(*this);
60 }
bool containsEdge(const EFAEdge &other) const
Definition: EFAEdge.C:63

◆ numEmbeddedNodes()

unsigned int EFAEdge::numEmbeddedNodes ( ) const

Definition at line 339 of file EFAEdge.C.

Referenced by EFAElement2D::addEdgeCut(), EFAElement3D::addFaceEdgeCut(), copyIntersection(), and EFAElement3D::removePhantomEmbeddedNode().

340 {
341  return _embedded_nodes.size();
342 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ removeEmbeddedNode()

void EFAEdge::removeEmbeddedNode ( EFANode node)

Definition at line 390 of file EFAEdge.C.

391 {
392  unsigned int index = 0;
393  bool node_found = false;
394  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
395  {
396  if (_embedded_nodes[i] == node)
397  {
398  index = i;
399  node_found = true;
400  break;
401  }
402  }
403  if (node_found)
404  {
405  _embedded_nodes.erase(_embedded_nodes.begin() + index);
406  _intersection_x.erase(_intersection_x.begin() + index);
407  }
408 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ removeEmbeddedNodes()

void EFAEdge::removeEmbeddedNodes ( )

Definition at line 383 of file EFAEdge.C.

384 {
385  _embedded_nodes.clear();
386  _intersection_x.clear();
387 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29

◆ resetIntersection()

void EFAEdge::resetIntersection ( double  position,
EFANode embedded_node_tmp,
EFANode from_node 
)

Definition at line 142 of file EFAEdge.C.

143 {
144  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
145  {
146  if (_embedded_nodes[i] == embedded_node_tmp)
147  {
148  if (from_node == _edge_node1)
149  _intersection_x[i] = position;
150  else if (from_node == _edge_node2)
151  _intersection_x[i] = 1.0 - position;
152  else
153  EFAError("In resetIntersection from_node does not exist on edge");
154  break;
155  }
156  }
157 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ reverseNodes()

void EFAEdge::reverseNodes ( )

Definition at line 190 of file EFAEdge.C.

191 {
192  std::swap(_edge_node1, _edge_node2);
193  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
194  _intersection_x[i] = 1.0 - _intersection_x[i];
195 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:30
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
EFANode * _edge_node1
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:27

◆ setInteriorNode()

void EFAEdge::setInteriorNode ( EFANode node)
inline

Definition at line 46 of file EFAEdge.h.

Referenced by EFAElement2D::createChild(), and EFAElement2D::createEdges().

46 { _edge_interior_node = node; };
EFANode * _edge_interior_node
Definition: EFAEdge.h:28

◆ switchNode()

void EFAEdge::switchNode ( EFANode new_node,
EFANode old_node 
)

Definition at line 363 of file EFAEdge.C.

364 {
365  if (_edge_node1 == old_node)
366  _edge_node1 = new_node;
367  else if (_edge_node2 == old_node)
368  _edge_node2 = new_node;
369  else if (isEmbeddedNode(old_node))
370  {
371  unsigned int id = getEmbeddedNodeIndex(old_node);
372  _embedded_nodes[id] = new_node;
373  }
374 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:29
unsigned int getEmbeddedNodeIndex(EFANode *node) const
Definition: EFAEdge.C:281
EFANode * _edge_node1
Definition: EFAEdge.h:26
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:266
EFANode * _edge_node2
Definition: EFAEdge.h:27

Member Data Documentation

◆ _edge_interior_node

EFANode* EFAEdge::_edge_interior_node
private

Definition at line 28 of file EFAEdge.h.

Referenced by EFAEdge(), getInteriorNode(), and setInteriorNode().

◆ _edge_node1

EFANode* EFAEdge::_edge_node1
private

◆ _edge_node2

EFANode* EFAEdge::_edge_node2
private

◆ _embedded_nodes

std::vector<EFANode *> EFAEdge::_embedded_nodes
private

◆ _intersection_x

std::vector<double> EFAEdge::_intersection_x
private

The documentation for this class was generated from the following files: