https://mooseframework.inl.gov
Loading...
Searching...
No Matches
XFEMElementPairLocator.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
13 unsigned int interface_id,
14 bool use_displaced_mesh)
15 : ElementPairLocator(interface_id), _xfem(xfem), _use_displaced_mesh(use_displaced_mesh)
16{
18 _elem_pairs = _xfem->getXFEMDisplacedCutElemPairs(interface_id);
19 else
20 _elem_pairs = _xfem->getXFEMCutElemPairs(interface_id);
21}
22
23void
25{
26 // Does not support secondary cut yet.
27 if (_xfem->has_secondary_cut())
28 return;
29
30 _element_pair_info.clear();
31
32 for (std::list<std::pair<const Elem *, const Elem *>>::const_iterator it = _elem_pairs->begin();
33 it != _elem_pairs->end();
34 ++it)
35 {
36 const Elem * elem1 = it->first;
37 const Elem * elem2 = it->second;
38
39 std::vector<Point> intersectionPoints1;
40 Point normal1;
41 std::vector<Point> q_points1;
42 std::vector<Real> weights1;
43
44 unsigned int plane_id = 0; // Only support one cut plane for the time being
45
46 _xfem->getXFEMIntersectionInfo(
47 elem1, plane_id, normal1, intersectionPoints1, _use_displaced_mesh);
48
49 if (intersectionPoints1.size() == 2)
50 _xfem->getXFEMqRuleOnLine(intersectionPoints1, q_points1, weights1);
51 else if (intersectionPoints1.size() > 2)
52 _xfem->getXFEMqRuleOnSurface(intersectionPoints1, q_points1, weights1);
53
55 {
56 ElementPairInfo new_elem_info(
57 elem1, elem2, q_points1, q_points1, weights1, weights1, normal1, -normal1);
58 _element_pair_info.insert(
59 std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
60 }
61 else
62 {
63 std::vector<Point> intersectionPoints2;
64 Point normal2;
65 std::vector<Point> q_points2;
66 std::vector<Real> weights2;
67
68 _xfem->getXFEMIntersectionInfo(
69 elem2, plane_id, normal2, intersectionPoints2, _use_displaced_mesh);
70
71 // reverse the order of intersectionPoints2
72 std::reverse(std::begin(intersectionPoints2), std::end(intersectionPoints2));
73
74 if (intersectionPoints2.size() == 2)
75 _xfem->getXFEMqRuleOnLine(intersectionPoints2, q_points2, weights2);
76 else if (intersectionPoints2.size() > 2)
77 _xfem->getXFEMqRuleOnSurface(intersectionPoints2, q_points2, weights2);
78
79 ElementPairInfo new_elem_info(
80 elem1, elem2, q_points1, q_points2, weights1, weights2, normal1, normal2);
81 _element_pair_info.insert(
82 std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
83 }
84 }
85}
86
87void
const ElementPairList * _elem_pairs
std::map< std::pair< const Elem *, const Elem * >, ElementPairInfo > _element_pair_info
XFEMElementPairLocator(std::shared_ptr< XFEM > xfem, unsigned int interface_id, bool use_displaced_mesh=false)
std::shared_ptr< XFEM > _xfem