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 15 of file EFAEdge.h.

Constructor & Destructor Documentation

EFAEdge::EFAEdge ( EFANode node1,
EFANode node2 
)

Definition at line 14 of file EFAEdge.C.

14  : _edge_node1(node1), _edge_node2(node2)
15 {
16  _embedded_nodes.clear();
17  _intersection_x.clear();
18  _edge_interior_node = NULL;
20 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
void consistencyCheck()
Definition: EFAEdge.C:343
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_interior_node
Definition: EFAEdge.h:26
EFANode * _edge_node2
Definition: EFAEdge.h:25
EFAEdge::EFAEdge ( const EFAEdge other_edge)

Definition at line 22 of file EFAEdge.C.

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

Definition at line 31 of file EFAEdge.C.

32 { // in EFAelement's destructor
33 }

Member Function Documentation

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

Definition at line 128 of file EFAEdge.C.

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

129 {
130  _embedded_nodes.push_back(embedded_node_tmp);
131  if (from_node == _edge_node1)
132  _intersection_x.push_back(position);
133  else if (from_node == _edge_node2)
134  _intersection_x.push_back(1.0 - position);
135  else
136  EFAError("In addIntersection from_node does not exist on edge");
137 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
void EFAEdge::consistencyCheck ( )

Definition at line 343 of file EFAEdge.C.

Referenced by EFAEdge(), and setInteriorNode().

344 {
345  bool consistent = true;
349  consistent = false;
353  consistent = false;
354  if (!consistent)
355  EFAError("In consistencyCheck nodes on edge are not consistent");
356  if (_embedded_nodes.size() != _intersection_x.size())
357  EFAError("In consistencyCheck num of emb_nodes must be = num of inters_x");
358 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
N_CATEGORY category() const
Definition: EFANode.C:40
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
bool EFAEdge::containsEdge ( const EFAEdge other) const

Definition at line 61 of file EFAEdge.C.

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

62 {
63  return containsNode(other._edge_node1) && containsNode(other._edge_node2);
64 }
bool containsNode(const EFANode *node) const
Definition: EFAEdge.C:375
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
bool EFAEdge::containsNode ( const EFANode node) const

Definition at line 375 of file EFAEdge.C.

Referenced by containsEdge(), EFAFace::EFAFace(), and setInteriorNode().

376 {
377  return _edge_node1 == node || _edge_node2 == node || isEmbeddedNode(node);
378 }
EFANode * _edge_node1
Definition: EFAEdge.h:24
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:264
EFANode * _edge_node2
Definition: EFAEdge.h:25
void EFAEdge::copyIntersection ( const EFAEdge other,
unsigned int  from_node_id 
)

Definition at line 158 of file EFAEdge.C.

Referenced by EFAElement2D::createChild().

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

Definition at line 246 of file EFAEdge.C.

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

247 {
248  double xi = -100.0;
249  if (_edge_node1 == node)
250  xi = 0.0;
251  else if (_edge_node2 == node)
252  xi = 1.0;
253  else if (isEmbeddedNode(node))
254  {
255  unsigned int embedded_node_id = getEmbeddedNodeIndex(node);
256  xi = _intersection_x[embedded_node_id];
257  }
258  else
259  EFAError("the given node is not found in the current edge");
260  return xi;
261 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
EFANode * _edge_node1
Definition: EFAEdge.h:24
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:264
EFANode * _edge_node2
Definition: EFAEdge.h:25
unsigned int getEmbeddedNodeIndex(EFANode *node) const
Definition: EFAEdge.C:279
bool EFAEdge::equivalent ( const EFAEdge other) const

Definition at line 36 of file EFAEdge.C.

Referenced by EFAElement2D::shouldDuplicateForPhantomCorner().

37 {
38  bool isEqual = false;
39  if (other._edge_node1 == _edge_node1 && other._edge_node2 == _edge_node2)
40  isEqual = true;
41  else if (other._edge_node2 == _edge_node1 && other._edge_node1 == _edge_node2)
42  isEqual = true;
43 
44  // For cut along the edge case
45  if (isEqual)
46  {
49  isEqual = false;
50  }
51  return isEqual;
52 }
N_CATEGORY category() const
Definition: EFANode.C:40
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
EFANode * EFAEdge::getEmbeddedNode ( unsigned int  index) const

Definition at line 328 of file EFAEdge.C.

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

329 {
330  if (index < _embedded_nodes.size())
331  return _embedded_nodes[index];
332  else
333  EFAError("in getEmbeddedNode index out of bounds");
334 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
unsigned int EFAEdge::getEmbeddedNodeIndex ( EFANode node) const

Definition at line 279 of file EFAEdge.C.

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

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

Definition at line 298 of file EFAEdge.C.

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

Definition at line 43 of file EFAEdge.h.

Referenced by EFAElement2D::connectNeighbors().

43 { return _edge_interior_node; };
EFANode * _edge_interior_node
Definition: EFAEdge.h:26
double EFAEdge::getIntersection ( unsigned int  emb_id,
EFANode from_node 
) const

Definition at line 235 of file EFAEdge.C.

Referenced by EFAElement2D::addFragmentEdgeCut(), and setInteriorNode().

236 {
237  if (from_node == _edge_node1)
238  return _intersection_x[emb_id];
239  else if (from_node == _edge_node2)
240  return 1.0 - _intersection_x[emb_id];
241  else
242  EFAError("In getIntersection node not in edge");
243 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
EFANode * EFAEdge::getNode ( unsigned int  index) const
bool EFAEdge::getNodeMasters ( EFANode node,
std::vector< EFANode * > &  master_nodes,
std::vector< double > &  master_weights 
) const

Definition at line 67 of file EFAEdge.C.

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

Definition at line 196 of file EFAEdge.C.

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

197 {
198  bool has = false;
199  if (_edge_node1->parent() != NULL)
201 
202  if (_edge_node2->parent() != NULL)
204 
205  return has || _embedded_nodes.size() > 0;
206 }
EFANode * parent() const
Definition: EFANode.C:46
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
N_CATEGORY category() const
Definition: EFANode.C:40
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
bool EFAEdge::hasIntersectionAtPosition ( double  position,
EFANode from_node 
) const

Definition at line 209 of file EFAEdge.C.

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

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

Definition at line 264 of file EFAEdge.C.

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

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

Definition at line 55 of file EFAEdge.C.

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

56 {
57  return containsEdge(other) || other.containsEdge(*this);
58 }
bool containsEdge(const EFAEdge &other) const
Definition: EFAEdge.C:61
unsigned int EFAEdge::numEmbeddedNodes ( ) const

Definition at line 337 of file EFAEdge.C.

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

338 {
339  return _embedded_nodes.size();
340 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
void EFAEdge::removeEmbeddedNode ( EFANode node)

Definition at line 388 of file EFAEdge.C.

Referenced by setInteriorNode().

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

Definition at line 381 of file EFAEdge.C.

Referenced by setInteriorNode().

382 {
383  _embedded_nodes.clear();
384  _intersection_x.clear();
385 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
void EFAEdge::resetIntersection ( double  position,
EFANode embedded_node_tmp,
EFANode from_node 
)

Definition at line 140 of file EFAEdge.C.

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

Definition at line 188 of file EFAEdge.C.

Referenced by setInteriorNode().

189 {
190  std::swap(_edge_node1, _edge_node2);
191  for (unsigned int i = 0; i < _embedded_nodes.size(); ++i)
192  _intersection_x[i] = 1.0 - _intersection_x[i];
193 }
std::vector< double > _intersection_x
Definition: EFAEdge.h:28
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
EFANode * _edge_node1
Definition: EFAEdge.h:24
EFANode * _edge_node2
Definition: EFAEdge.h:25
void EFAEdge::setInteriorNode ( EFANode node)
inline

Definition at line 44 of file EFAEdge.h.

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

44 { _edge_interior_node = node; };
EFANode * _edge_interior_node
Definition: EFAEdge.h:26
void EFAEdge::switchNode ( EFANode new_node,
EFANode old_node 
)

Definition at line 361 of file EFAEdge.C.

Referenced by setInteriorNode().

362 {
363  if (_edge_node1 == old_node)
364  _edge_node1 = new_node;
365  else if (_edge_node2 == old_node)
366  _edge_node2 = new_node;
367  else if (isEmbeddedNode(old_node))
368  {
369  unsigned int id = getEmbeddedNodeIndex(old_node);
370  _embedded_nodes[id] = new_node;
371  }
372 }
std::vector< EFANode * > _embedded_nodes
Definition: EFAEdge.h:27
EFANode * _edge_node1
Definition: EFAEdge.h:24
bool isEmbeddedNode(const EFANode *node) const
Definition: EFAEdge.C:264
EFANode * _edge_node2
Definition: EFAEdge.h:25
unsigned int getEmbeddedNodeIndex(EFANode *node) const
Definition: EFAEdge.C:279

Member Data Documentation

EFANode* EFAEdge::_edge_interior_node
private

Definition at line 26 of file EFAEdge.h.

Referenced by EFAEdge(), and getInteriorNode().

EFANode* EFAEdge::_edge_node1
private
EFANode* EFAEdge::_edge_node2
private
std::vector<EFANode *> EFAEdge::_embedded_nodes
private
std::vector<double> EFAEdge::_intersection_x
private

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