www.mooseframework.org
XFEMElementPairLocator.C
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 
9 
10 XFEMElementPairLocator::XFEMElementPairLocator(MooseSharedPointer<XFEM> xfem,
11  unsigned int interface_id,
12  bool use_displaced_mesh)
13  : ElementPairLocator(interface_id), _xfem(xfem), _use_displaced_mesh(use_displaced_mesh)
14 {
16  _elem_pairs = _xfem->getXFEMDisplacedCutElemPairs();
17  else
18  _elem_pairs = _xfem->getXFEMCutElemPairs();
19 }
20 
21 void
23 {
24  // Does not support secondary cut yet.
25  if (_xfem->has_secondary_cut())
26  return;
27 
28  _element_pair_info.clear();
29 
30  for (std::list<std::pair<const Elem *, const Elem *>>::const_iterator it = _elem_pairs->begin();
31  it != _elem_pairs->end();
32  ++it)
33  {
34  const Elem * elem1 = it->first;
35  const Elem * elem2 = it->second;
36 
37  std::vector<Point> intersectionPoints1;
38  Point normal1;
39  std::vector<Point> q_points1;
40  std::vector<Real> weights1;
41 
42  unsigned int plane_id = 0; // Only support one cut plane for the time being
43 
44  _xfem->getXFEMIntersectionInfo(
45  elem1, plane_id, normal1, intersectionPoints1, _use_displaced_mesh);
46 
47  if (intersectionPoints1.size() == 2)
48  _xfem->getXFEMqRuleOnLine(intersectionPoints1, q_points1, weights1);
49  else if (intersectionPoints1.size() > 2)
50  _xfem->getXFEMqRuleOnSurface(intersectionPoints1, q_points1, weights1);
51 
53  {
54  ElementPairInfo new_elem_info(
55  elem1, elem2, q_points1, q_points1, weights1, weights1, normal1, -normal1);
56  _element_pair_info.insert(
57  std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
58  }
59  else
60  {
61  std::vector<Point> intersectionPoints2;
62  Point normal2;
63  std::vector<Point> q_points2;
64  std::vector<Real> weights2;
65 
66  _xfem->getXFEMIntersectionInfo(
67  elem2, plane_id, normal2, intersectionPoints2, _use_displaced_mesh);
68 
69  if (intersectionPoints2.size() == 2)
70  _xfem->getXFEMqRuleOnLine(intersectionPoints2, q_points2, weights2);
71  else if (intersectionPoints2.size() > 2)
72  _xfem->getXFEMqRuleOnSurface(intersectionPoints2, q_points2, weights2);
73 
74  ElementPairInfo new_elem_info(
75  elem1, elem2, q_points1, q_points2, weights1, weights2, normal1, normal2);
76  _element_pair_info.insert(
77  std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
78  }
79  }
80 }
81 
82 void
84 {
85  reinit();
86 }
MooseSharedPointer< XFEM > _xfem
XFEMElementPairLocator(MooseSharedPointer< XFEM > xfem, unsigned int interface_id, bool use_displaced_mesh=false)