Line data Source code
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 :
10 : #include "XFEMElementPairLocator.h"
11 :
12 730 : XFEMElementPairLocator::XFEMElementPairLocator(std::shared_ptr<XFEM> xfem,
13 : unsigned int interface_id,
14 730 : bool use_displaced_mesh)
15 730 : : ElementPairLocator(interface_id), _xfem(xfem), _use_displaced_mesh(use_displaced_mesh)
16 : {
17 730 : if (_use_displaced_mesh)
18 237 : _elem_pairs = _xfem->getXFEMDisplacedCutElemPairs(interface_id);
19 : else
20 493 : _elem_pairs = _xfem->getXFEMCutElemPairs(interface_id);
21 730 : }
22 :
23 : void
24 38746 : XFEMElementPairLocator::reinit()
25 : {
26 : // Does not support secondary cut yet.
27 38746 : if (_xfem->has_secondary_cut())
28 : return;
29 :
30 : _element_pair_info.clear();
31 :
32 34290 : for (std::list<std::pair<const Elem *, const Elem *>>::const_iterator it = _elem_pairs->begin();
33 467664 : it != _elem_pairs->end();
34 : ++it)
35 : {
36 433374 : const Elem * elem1 = it->first;
37 433374 : 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 433374 : _xfem->getXFEMIntersectionInfo(
47 433374 : elem1, plane_id, normal1, intersectionPoints1, _use_displaced_mesh);
48 :
49 433374 : if (intersectionPoints1.size() == 2)
50 329837 : _xfem->getXFEMqRuleOnLine(intersectionPoints1, q_points1, weights1);
51 103537 : else if (intersectionPoints1.size() > 2)
52 103537 : _xfem->getXFEMqRuleOnSurface(intersectionPoints1, q_points1, weights1);
53 :
54 433374 : if (!_use_displaced_mesh)
55 : {
56 : ElementPairInfo new_elem_info(
57 14122 : elem1, elem2, q_points1, q_points1, weights1, weights1, normal1, -normal1);
58 28244 : _element_pair_info.insert(
59 14122 : std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
60 14122 : }
61 : else
62 : {
63 : std::vector<Point> intersectionPoints2;
64 : Point normal2;
65 : std::vector<Point> q_points2;
66 : std::vector<Real> weights2;
67 :
68 419252 : _xfem->getXFEMIntersectionInfo(
69 : elem2, plane_id, normal2, intersectionPoints2, _use_displaced_mesh);
70 :
71 : // reverse the order of intersectionPoints2
72 419252 : std::reverse(std::begin(intersectionPoints2), std::end(intersectionPoints2));
73 :
74 419252 : if (intersectionPoints2.size() == 2)
75 319071 : _xfem->getXFEMqRuleOnLine(intersectionPoints2, q_points2, weights2);
76 100181 : else if (intersectionPoints2.size() > 2)
77 100181 : _xfem->getXFEMqRuleOnSurface(intersectionPoints2, q_points2, weights2);
78 :
79 : ElementPairInfo new_elem_info(
80 419252 : elem1, elem2, q_points1, q_points2, weights1, weights2, normal1, normal2);
81 838504 : _element_pair_info.insert(
82 419252 : std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
83 419252 : }
84 433374 : }
85 : }
86 :
87 : void
88 35950 : XFEMElementPairLocator::update()
89 : {
90 35950 : reinit();
91 35950 : }
|