www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LineSegmentCutSetUserObject Class Reference

#include <LineSegmentCutSetUserObject.h>

Inheritance diagram for LineSegmentCutSetUserObject:
[legend]

Public Member Functions

 LineSegmentCutSetUserObject (const InputParameters &parameters)
 
virtual const std::vector< Point > getCrackFrontPoints (unsigned int num_crack_front_points) const override
 get a set of points along a crack front from a XFEM GeometricCutUserObject More...
 
virtual std::vector< Real > getCutData () const
 Get the cut location information. More...
 
virtual bool cutElementByGeometry (const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes, Real time) const override
 Check to see whether a specified 2D element should be cut based on geometric conditions. More...
 
virtual bool cutElementByGeometry (const Elem *elem, std::vector< Xfem::CutFace > &cut_faces, Real time) const override
 Check to see whether a specified 3D element should be cut based on geometric conditions. More...
 
virtual bool cutFragmentByGeometry (std::vector< std::vector< Point >> &frag_edges, std::vector< Xfem::CutEdge > &cut_edges, Real time) const override
 Check to see whether a fragment of a 2D element should be cut based on geometric conditions. More...
 
virtual bool cutFragmentByGeometry (std::vector< std::vector< Point >> &frag_faces, std::vector< Xfem::CutFace > &cut_faces, Real time) const override
 Check to see whether a fragment of a 3D element should be cut based on geometric conditions. More...
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void threadJoin (const UserObject &y) override
 
virtual void finalize () override
 
unsigned int getInterfaceID () const
 Get the interface ID for this cutting object. More...
 
void setInterfaceID (unsigned int interface_id)
 Set the interface ID for this cutting object. More...
 
bool shouldHealMesh () const
 Should the elements cut by this cutting object be healed in the current time step? More...
 

Protected Member Functions

bool IntersectSegmentWithCutLine (const Point &segment_point1, const Point &segment_point2, const std::pair< Point, Point > &cutting_line_points, const Real &cutting_line_fraction, Real &segment_intersection_fraction) const
 
Real crossProduct2D (const Point &point_a, const Point &point_b) const
 
virtual Real cutFraction (unsigned int cut_num, Real time) const
 Find the fractional distance along a specified cut line for the current time that is currently active. More...
 
void serialize (std::string &serialized_buffer)
 Methods to pack/unpack the _marked_elems_2d and _marked_elems_3d data into a structure suitable for parallel communication. More...
 
void deserialize (std::vector< std::string > &serialized_buffers)
 

Protected Attributes

std::vector< Real > _cut_data
 
std::vector< std::pair< Point, Point > > _cut_line_endpoints
 
std::vector< std::pair< Real, Real > > _cut_time_ranges
 Vector of start/end times for each cut segment. More...
 
std::shared_ptr< XFEM_xfem
 Pointer to the XFEM controller object. More...
 
unsigned int _interface_id
 Associated interface id. More...
 
bool _heal_always
 Heal the mesh. More...
 
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
 Containers with information about all 2D and 3D elements marked for cutting by this object. More...
 
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d
 

Detailed Description

Definition at line 21 of file LineSegmentCutSetUserObject.h.

Constructor & Destructor Documentation

◆ LineSegmentCutSetUserObject()

LineSegmentCutSetUserObject::LineSegmentCutSetUserObject ( const InputParameters &  parameters)

Definition at line 36 of file LineSegmentCutSetUserObject.C.

37  : GeometricCut2DUserObject(parameters), _cut_data(getParam<std::vector<Real>>("cut_data"))
38 {
39  // Set up constant parameters
40  const int line_cut_data_len = 6;
41 
42  // Throw error if length of cut_data is incorrect
43  if (_cut_data.size() % line_cut_data_len != 0)
44  mooseError("Length of LineSegmentCutSetUserObject cut_data must be a multiple of 6.");
45 
46  unsigned int num_cuts = _cut_data.size() / line_cut_data_len;
47 
48  // Assign scale and translate parameters
49  std::pair<Real, Real> scale;
50  if (isParamValid("cut_scale"))
51  {
52  auto vec_scale = getParam<std::vector<Real>>("cut_scale");
53  scale = std::make_pair(vec_scale[0], vec_scale[1]);
54  }
55  else
56  {
57  scale = std::make_pair(1.0, 1.0);
58  }
59 
60  std::pair<Real, Real> trans;
61  if (isParamValid("cut_translate"))
62  {
63  auto vec_trans = getParam<std::vector<Real>>("cut_translate");
64  trans = std::make_pair(vec_trans[0], vec_trans[1]);
65  }
66  else
67  {
68  trans = std::make_pair(0.0, 0.0);
69  }
70 
71  // Clear _start_times & _end_times vectors initialized from
72  // time_start_cut & time_end_cut values
73  _cut_time_ranges.clear();
74 
75  for (unsigned int i = 0; i < num_cuts; ++i)
76  {
77  Real x0 = (_cut_data[i * line_cut_data_len + 0] + trans.first) * scale.first;
78  Real y0 = (_cut_data[i * line_cut_data_len + 1] + trans.second) * scale.second;
79  Real x1 = (_cut_data[i * line_cut_data_len + 2] + trans.first) * scale.first;
80  Real y1 = (_cut_data[i * line_cut_data_len + 3] + trans.second) * scale.second;
81  _cut_line_endpoints.push_back(std::make_pair(Point(x0, y0, 0.0), Point(x1, y1, 0.0)));
82 
83  _cut_time_ranges.push_back(
84  std::make_pair(_cut_data[i * line_cut_data_len + 4], _cut_data[i * line_cut_data_len + 5]));
85  }
86 
87  if (_cut_line_endpoints.size() != _cut_time_ranges.size())
88  mooseError("Number of start/end times must match number of cut line endpoint sets");
89 }
std::vector< std::pair< Point, Point > > _cut_line_endpoints
GeometricCut2DUserObject(const InputParameters &parameters)
std::vector< std::pair< Real, Real > > _cut_time_ranges
Vector of start/end times for each cut segment.

Member Function Documentation

◆ crossProduct2D()

Real GeometricCut2DUserObject::crossProduct2D ( const Point &  point_a,
const Point &  point_b 
) const
protectedinherited

Definition at line 196 of file GeometricCut2DUserObject.C.

Referenced by GeometricCut2DUserObject::IntersectSegmentWithCutLine().

197 {
198  return (point_a(0) * point_b(1) - point_b(0) * point_a(1));
199 }

◆ cutElementByGeometry() [1/2]

bool GeometricCut2DUserObject::cutElementByGeometry ( const Elem *  elem,
std::vector< Xfem::CutEdge > &  cut_edges,
std::vector< Xfem::CutNode > &  cut_nodes,
Real  time 
) const
overridevirtualinherited

Check to see whether a specified 2D element should be cut based on geometric conditions.

Parameters
elemPointer to the libMesh element to be considered for cutting
cut_edgesData structure filled with information about edges to be cut
cut_nodesData structure filled with information about nodes to be cut
timeCurrent simulation time
Returns
bool true if element is to be cut

Implements GeometricCutUserObject.

Definition at line 39 of file GeometricCut2DUserObject.C.

43 {
44  bool cut_elem = false;
45 
46  for (unsigned int cut = 0; cut < _cut_line_endpoints.size(); ++cut)
47  {
48  Real fraction = cutFraction(cut, time);
49 
50  if (fraction > 0.0)
51  {
52  unsigned int n_sides = elem->n_sides();
53 
54  for (unsigned int i = 0; i < n_sides; ++i)
55  {
56  // This returns the lowest-order type of side, which should always
57  // be an EDGE2 here because this class is for 2D only.
58  std::unique_ptr<Elem> curr_side = elem->side(i);
59  if (curr_side->type() != EDGE2)
60  mooseError("In cutElementByGeometry element side must be EDGE2, but type is: ",
61  libMesh::Utility::enum_to_string(curr_side->type()),
62  " base element type is: ",
63  libMesh::Utility::enum_to_string(elem->type()));
64 
65  const Node * node1 = curr_side->get_node(0);
66  const Node * node2 = curr_side->get_node(1);
67  Real seg_int_frac = 0.0;
68 
70  *node1, *node2, _cut_line_endpoints[cut], fraction, seg_int_frac))
71  {
72  if (seg_int_frac > Xfem::tol && seg_int_frac < 1.0 - Xfem::tol)
73  {
74  cut_elem = true;
75  Xfem::CutEdge mycut;
76  mycut._id1 = node1->id();
77  mycut._id2 = node2->id();
78  mycut._distance = seg_int_frac;
79  mycut._host_side_id = i;
80  cut_edges.push_back(mycut);
81  }
82  else if (seg_int_frac < Xfem::tol)
83  {
84  cut_elem = true;
85  Xfem::CutNode mycut;
86  mycut._id = node1->id();
87  mycut._host_id = i;
88  cut_nodes.push_back(mycut);
89  }
90  }
91  }
92  }
93  }
94  return cut_elem;
95 }
Data structure defining a cut through a node.
std::vector< std::pair< Point, Point > > _cut_line_endpoints
unsigned int _host_id
Local ID of this node in the host element.
bool IntersectSegmentWithCutLine(const Point &segment_point1, const Point &segment_point2, const std::pair< Point, Point > &cutting_line_points, const Real &cutting_line_fraction, Real &segment_intersection_fraction) const
Data structure defining a cut on an element edge.
unsigned int _id1
ID of the first node on the edge.
static const double tol
Definition: XFEMFuncs.h:21
virtual Real cutFraction(unsigned int cut_num, Real time) const
Find the fractional distance along a specified cut line for the current time that is currently active...
Real _distance
Fractional distance along the edge (from node 1 to 2) where the cut is located.
unsigned int _id2
ID of the second node on the edge.
unsigned int _host_side_id
Local ID of this side in the host element.
unsigned int _id
ID of the cut node.

◆ cutElementByGeometry() [2/2]

bool GeometricCut2DUserObject::cutElementByGeometry ( const Elem *  elem,
std::vector< Xfem::CutFace > &  cut_faces,
Real  time 
) const
overridevirtualinherited

Check to see whether a specified 3D element should be cut based on geometric conditions.

Parameters
elemPointer to the libMesh element to be considered for cutting
cut_facesData structure filled with information about edges to be cut
timeCurrent simulation time
Returns
bool true if element is to be cut

Implements GeometricCutUserObject.

Definition at line 98 of file GeometricCut2DUserObject.C.

101 {
102  mooseError("Invalid method: must use vector of element edges for 2D mesh cutting");
103  return false;
104 }

◆ cutFraction()

Real GeometricCut2DUserObject::cutFraction ( unsigned int  cut_num,
Real  time 
) const
protectedvirtualinherited

Find the fractional distance along a specified cut line for the current time that is currently active.

Used for time-based propagation along a line

Parameters
cut_numIndex of the cut being queried
timeCurrent simulation time
Returns
Current fractional distance

Reimplemented in MovingLineSegmentCutSetUserObject.

Definition at line 202 of file GeometricCut2DUserObject.C.

Referenced by GeometricCut2DUserObject::cutElementByGeometry(), and GeometricCut2DUserObject::cutFragmentByGeometry().

203 {
204  mooseAssert(_cut_time_ranges.size() > cut_num,
205  "cut_num is outside the bounds of _cut_time_ranges");
206 
207  Real fraction = 0.0;
208 
209  if (time >= _cut_time_ranges[cut_num].first)
210  {
211  if (time >= _cut_time_ranges[cut_num].second)
212  fraction = 1.0;
213  else
214  {
215  Real denominator = _cut_time_ranges[cut_num].second - _cut_time_ranges[cut_num].first;
216  if (MooseUtils::absoluteFuzzyEqual(denominator, 0.0))
217  mooseError("time_start_cut and time_end_cut cannot have the same value");
218  fraction = (time - _cut_time_ranges[cut_num].first) / denominator;
219  }
220  }
221  return fraction;
222 }
std::vector< std::pair< Real, Real > > _cut_time_ranges
Vector of start/end times for each cut segment.

◆ cutFragmentByGeometry() [1/2]

bool GeometricCut2DUserObject::cutFragmentByGeometry ( std::vector< std::vector< Point >> &  frag_edges,
std::vector< Xfem::CutEdge > &  cut_edges,
Real  time 
) const
overridevirtualinherited

Check to see whether a fragment of a 2D element should be cut based on geometric conditions.

Parameters
frag_edgesData structure defining the current fragment to be considered
cut_edgesData structure filled with information about fragment edges to be cut
timeCurrent simulation time
Returns
bool true if fragment is to be cut

Implements GeometricCutUserObject.

Definition at line 107 of file GeometricCut2DUserObject.C.

110 {
111  bool cut_frag = false;
112 
113  for (unsigned int cut = 0; cut < _cut_line_endpoints.size(); ++cut)
114  {
115  Real fraction = cutFraction(cut, time);
116 
117  if (fraction > 0.0)
118  {
119  unsigned int n_sides = frag_edges.size();
120 
121  for (unsigned int i = 0; i < n_sides; ++i)
122  {
123  Real seg_int_frac = 0.0;
124 
125  if (IntersectSegmentWithCutLine(frag_edges[i][0],
126  frag_edges[i][1],
127  _cut_line_endpoints[cut],
128  fraction,
129  seg_int_frac))
130  {
131  cut_frag = true;
132  Xfem::CutEdge mycut;
133  mycut._id1 = i;
134  mycut._id2 = (i < (n_sides - 1) ? (i + 1) : 0);
135  mycut._distance = seg_int_frac;
136  mycut._host_side_id = i;
137  cut_edges.push_back(mycut);
138  }
139  }
140  }
141  }
142  return cut_frag;
143 }
std::vector< std::pair< Point, Point > > _cut_line_endpoints
bool IntersectSegmentWithCutLine(const Point &segment_point1, const Point &segment_point2, const std::pair< Point, Point > &cutting_line_points, const Real &cutting_line_fraction, Real &segment_intersection_fraction) const
Data structure defining a cut on an element edge.
unsigned int _id1
ID of the first node on the edge.
virtual Real cutFraction(unsigned int cut_num, Real time) const
Find the fractional distance along a specified cut line for the current time that is currently active...
Real _distance
Fractional distance along the edge (from node 1 to 2) where the cut is located.
unsigned int _id2
ID of the second node on the edge.
unsigned int _host_side_id
Local ID of this side in the host element.

◆ cutFragmentByGeometry() [2/2]

bool GeometricCut2DUserObject::cutFragmentByGeometry ( std::vector< std::vector< Point >> &  frag_faces,
std::vector< Xfem::CutFace > &  cut_faces,
Real  time 
) const
overridevirtualinherited

Check to see whether a fragment of a 3D element should be cut based on geometric conditions.

Parameters
frag_facesData structure defining the current fragment to be considered
cut_facesData structure filled with information about fragment faces to be cut
timeCurrent simulation time
Returns
bool true if fragment is to be cut

Implements GeometricCutUserObject.

Definition at line 146 of file GeometricCut2DUserObject.C.

149 {
150  mooseError("Invalid method: must use vector of element edges for 2D mesh cutting");
151  return false;
152 }

◆ deserialize()

void GeometricCutUserObject::deserialize ( std::vector< std::string > &  serialized_buffers)
protectedinherited

Definition at line 222 of file GeometricCutUserObject.C.

Referenced by GeometricCutUserObject::finalize().

223 {
224  mooseAssert(serialized_buffers.size() == _app.n_processors(),
225  "Unexpected size of serialized_buffers: " << serialized_buffers.size());
226 
227  // The input string stream used for deserialization
228  std::istringstream iss;
229 
230  // Loop over all datastructures for all processors to perfrom the gather operation
231  for (unsigned int rank = 0; rank < serialized_buffers.size(); ++rank)
232  {
233  // skip the current processor (its data is already in the structures)
234  if (rank == processor_id())
235  continue;
236 
237  // populate the stream with a new buffer and reset stream state
238  iss.clear();
239  iss.str(serialized_buffers[rank]);
240 
241  // Load the communicated data into temporary structures
242  std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo2D>> other_marked_elems_2d;
243  std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo3D>> other_marked_elems_3d;
244  dataLoad(iss, other_marked_elems_2d, this);
245  dataLoad(iss, other_marked_elems_3d, this);
246 
247  // merge the data in with the current processor's data
248  _marked_elems_2d.insert(other_marked_elems_2d.begin(), other_marked_elems_2d.end());
249  _marked_elems_3d.insert(other_marked_elems_3d.begin(), other_marked_elems_3d.end());
250  }
251 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
void dataLoad(std::istream &stream, Xfem::CutFace &cf, void *context)
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d

◆ execute()

void GeometricCutUserObject::execute ( )
overridevirtualinherited

Reimplemented in MovingLineSegmentCutSetUserObject.

Definition at line 67 of file GeometricCutUserObject.C.

Referenced by MovingLineSegmentCutSetUserObject::execute().

68 {
69  if (_current_elem->dim() == 2)
70  {
71  std::vector<Xfem::CutEdge> elem_cut_edges;
72  std::vector<Xfem::CutNode> elem_cut_nodes;
73  std::vector<Xfem::CutEdge> frag_cut_edges;
74  std::vector<std::vector<Point>> frag_edges;
75 
76  EFAElement2D * EFAElem = _xfem->getEFAElem2D(_current_elem);
77 
78  // Don't cut again if elem has been already cut twice
79  if (!EFAElem->isFinalCut())
80  {
81  // get fragment edges
82  _xfem->getFragmentEdges(_current_elem, EFAElem, frag_edges);
83 
84  // mark cut edges for the element and its fragment
85  bool cut = cutElementByGeometry(_current_elem, elem_cut_edges, elem_cut_nodes, _t);
86  if (EFAElem->numFragments() > 0)
87  cut |= cutFragmentByGeometry(frag_edges, frag_cut_edges, _t);
88 
89  if (cut)
90  {
92  gmei2d._elem_cut_edges = elem_cut_edges;
93  gmei2d._elem_cut_nodes = elem_cut_nodes;
94  gmei2d._frag_cut_edges = frag_cut_edges;
95  gmei2d._frag_edges = frag_edges;
96  _marked_elems_2d[_current_elem->id()].push_back(gmei2d);
97  }
98  }
99  }
100  else if (_current_elem->dim() == 3)
101  {
102  std::vector<Xfem::CutFace> elem_cut_faces;
103  std::vector<Xfem::CutFace> frag_cut_faces;
104  std::vector<std::vector<Point>> frag_faces;
105 
106  EFAElement3D * EFAElem = _xfem->getEFAElem3D(_current_elem);
107 
108  // Don't cut again if elem has been already cut twice
109  if (!EFAElem->isFinalCut())
110  {
111  // get fragment edges
112  _xfem->getFragmentFaces(_current_elem, EFAElem, frag_faces);
113 
114  // mark cut faces for the element and its fragment
115  bool cut = cutElementByGeometry(_current_elem, elem_cut_faces, _t);
116  // TODO: This would be done for branching, which is not yet supported in 3D
117  // if (EFAElem->numFragments() > 0)
118  // cut |= cutFragmentByGeometry(frag_faces, frag_cut_faces, _t);
119 
120  if (cut)
121  {
123  gmei3d._elem_cut_faces = elem_cut_faces;
124  gmei3d._frag_cut_faces = frag_cut_faces;
125  gmei3d._frag_faces = frag_faces;
126  _marked_elems_3d[_current_elem->id()].push_back(gmei3d);
127  }
128  }
129  }
130 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
Data structure describing geometrically described cut through 3D element.
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point >> &frag_edges, std::vector< Xfem::CutEdge > &cut_edges, Real time) const =0
Check to see whether a fragment of a 2D element should be cut based on geometric conditions.
virtual unsigned int numFragments() const
Definition: EFAElement2D.C:202
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes, Real time) const =0
Check to see whether a specified 2D element should be cut based on geometric conditions.
std::vector< CutNode > _elem_cut_nodes
Container for data about all cut nodes in this element.
std::vector< CutEdge > _elem_cut_edges
Container for data about all cut edges in this element.
std::vector< std::vector< Point > > _frag_edges
Container for data about all cut edges in cut fragments in this element.
virtual bool isFinalCut() const
Definition: EFAElement2D.C:791
std::vector< CutEdge > _frag_cut_edges
Container for data about all cut fragments in this element.
Data structure describing geometrically described cut through 2D element.
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
std::vector< CutFace > _frag_cut_faces
Container for data about all faces this element&#39;s fragment.
std::vector< std::vector< Point > > _frag_faces
Container for data about all cut faces in cut fragments in this element.
std::vector< CutFace > _elem_cut_faces
Container for data about all cut faces in this element.
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d
virtual bool isFinalCut() const
Definition: EFAElement3D.C:838

◆ finalize()

void GeometricCutUserObject::finalize ( )
overridevirtualinherited

Reimplemented in MovingLineSegmentCutSetUserObject.

Definition at line 254 of file GeometricCutUserObject.C.

Referenced by MovingLineSegmentCutSetUserObject::finalize().

255 {
256  // for single processor runs we do not need to do anything here
257  if (_app.n_processors() > 1)
258  {
259  // create send buffer
260  std::string send_buffer;
261 
262  // create byte buffers for the streams received from all processors
263  std::vector<std::string> recv_buffers;
264 
265  // pack the complex datastructures into the string stream
266  serialize(send_buffer);
267 
268  // broadcast serialized data to and receive from all processors
269  _communicator.allgather(send_buffer, recv_buffers);
270 
271  // unpack the received data and merge it into the local data structures
272  deserialize(recv_buffers);
273  }
274 
275  for (const auto & it : _marked_elems_2d)
276  for (const auto & gmei : it.second)
277  _xfem->addGeomMarkedElem2D(it.first, gmei, _interface_id);
278 
279  for (const auto & it : _marked_elems_3d)
280  for (const auto & gmei : it.second)
281  _xfem->addGeomMarkedElem3D(it.first, gmei, _interface_id);
282 
283  _marked_elems_2d.clear();
284  _marked_elems_3d.clear();
285 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
unsigned int _interface_id
Associated interface id.
void deserialize(std::vector< std::string > &serialized_buffers)
void serialize(std::string &serialized_buffer)
Methods to pack/unpack the _marked_elems_2d and _marked_elems_3d data into a structure suitable for p...
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d

◆ getCrackFrontPoints()

const std::vector< Point > LineSegmentCutSetUserObject::getCrackFrontPoints ( unsigned int  int) const
overridevirtual

get a set of points along a crack front from a XFEM GeometricCutUserObject

Returns
A vector which contains all crack front points

Implements CrackFrontPointsProvider.

Reimplemented in MovingLineSegmentCutSetUserObject.

Definition at line 92 of file LineSegmentCutSetUserObject.C.

93 {
94  mooseError("getCrackFrontPoints() is not implemented for this object.");
95 }

◆ getCutData()

virtual std::vector<Real> LineSegmentCutSetUserObject::getCutData ( ) const
inlinevirtual

Get the cut location information.

Definition at line 33 of file LineSegmentCutSetUserObject.h.

Referenced by LineSegmentLevelSetAux::compute(), and PointValueAtXFEMInterface::execute().

33 { return _cut_data; };

◆ getInterfaceID()

unsigned int GeometricCutUserObject::getInterfaceID ( ) const
inlineinherited

Get the interface ID for this cutting object.

Returns
the interface ID

Definition at line 173 of file GeometricCutUserObject.h.

173 { return _interface_id; };
unsigned int _interface_id
Associated interface id.

◆ initialize()

void GeometricCutUserObject::initialize ( )
overridevirtualinherited

Reimplemented in MeshCut3DUserObject, and MovingLineSegmentCutSetUserObject.

Definition at line 60 of file GeometricCutUserObject.C.

61 {
62  _marked_elems_2d.clear();
63  _marked_elems_3d.clear();
64 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d

◆ IntersectSegmentWithCutLine()

bool GeometricCut2DUserObject::IntersectSegmentWithCutLine ( const Point &  segment_point1,
const Point &  segment_point2,
const std::pair< Point, Point > &  cutting_line_points,
const Real &  cutting_line_fraction,
Real &  segment_intersection_fraction 
) const
protectedinherited

Definition at line 155 of file GeometricCut2DUserObject.C.

Referenced by GeometricCut2DUserObject::cutElementByGeometry(), and GeometricCut2DUserObject::cutFragmentByGeometry().

161 {
162  // Use the algorithm described here to determine whether a line segment is intersected
163  // by a cutting line, and to compute the fraction along that line where the intersection
164  // occurs:
165  // http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
166 
167  bool cut_segment = false;
168  Point seg_dir = segment_point2 - segment_point1;
169  Point cut_dir = cutting_line_points.second - cutting_line_points.first;
170  Point cut_start_to_seg_start = segment_point1 - cutting_line_points.first;
171 
172  Real cut_dir_cross_seg_dir = crossProduct2D(cut_dir, seg_dir);
173 
174  if (std::abs(cut_dir_cross_seg_dir) > Xfem::tol)
175  {
176  // Fraction of the distance along the cutting segment where it intersects the edge segment
177  Real cut_int_frac = crossProduct2D(cut_start_to_seg_start, seg_dir) / cut_dir_cross_seg_dir;
178 
179  if (cut_int_frac >= 0.0 && cut_int_frac <= cutting_line_fraction)
180  { // Cutting segment intersects the line of the edge segment, but the intersection point may
181  // be
182  // outside the segment
183  Real int_frac = crossProduct2D(cut_start_to_seg_start, cut_dir) / cut_dir_cross_seg_dir;
184  if (int_frac >= 0.0 &&
185  int_frac <= 1.0) // TODO: revisit end cases for intersections with corners
186  {
187  cut_segment = true;
188  segment_intersection_fraction = int_frac;
189  }
190  }
191  }
192  return cut_segment;
193 }
static const double tol
Definition: XFEMFuncs.h:21
Real crossProduct2D(const Point &point_a, const Point &point_b) const

◆ serialize()

void GeometricCutUserObject::serialize ( std::string &  serialized_buffer)
protectedinherited

Methods to pack/unpack the _marked_elems_2d and _marked_elems_3d data into a structure suitable for parallel communication.

Definition at line 209 of file GeometricCutUserObject.C.

Referenced by GeometricCutUserObject::finalize().

210 {
211  // stream for serializing the _marked_elems_2d and _marked_elems_3d data structures to a byte
212  // stream
213  std::ostringstream oss;
214  dataStore(oss, _marked_elems_2d, this);
215  dataStore(oss, _marked_elems_3d, this);
216 
217  // Populate the passed in string pointer with the string stream's buffer contents
218  serialized_buffer.assign(oss.str());
219 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
void dataStore(std::ostream &stream, Xfem::CutFace &cf, void *context)
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d

◆ setInterfaceID()

void GeometricCutUserObject::setInterfaceID ( unsigned int  interface_id)
inlineinherited

Set the interface ID for this cutting object.

Parameters
theinterface ID

Definition at line 179 of file GeometricCutUserObject.h.

Referenced by XFEM::addGeometricCut().

179 { _interface_id = interface_id; };
unsigned int _interface_id
Associated interface id.

◆ shouldHealMesh()

bool GeometricCutUserObject::shouldHealMesh ( ) const
inlineinherited

Should the elements cut by this cutting object be healed in the current time step?

Returns
true if the cut element should be healed

Definition at line 186 of file GeometricCutUserObject.h.

186 { return _heal_always; };
bool _heal_always
Heal the mesh.

◆ threadJoin()

void GeometricCutUserObject::threadJoin ( const UserObject &  y)
overridevirtualinherited

Definition at line 133 of file GeometricCutUserObject.C.

134 {
135  const GeometricCutUserObject & gcuo = dynamic_cast<const GeometricCutUserObject &>(y);
136 
137  for (const auto & it : gcuo._marked_elems_2d)
138  {
139  mooseAssert(_marked_elems_2d.find(it.first) == _marked_elems_2d.end(),
140  "Element already inserted in map from a different thread");
141  _marked_elems_2d[it.first] = it.second;
142  }
143  for (const auto & it : gcuo._marked_elems_3d)
144  {
145  mooseAssert(_marked_elems_3d.find(it.first) == _marked_elems_3d.end(),
146  "Element already inserted in map from a different thread");
147  _marked_elems_3d[it.first] = it.second;
148  }
149 }
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo2D > > _marked_elems_2d
Containers with information about all 2D and 3D elements marked for cutting by this object...
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d

Member Data Documentation

◆ _cut_data

std::vector<Real> LineSegmentCutSetUserObject::_cut_data
protected

◆ _cut_line_endpoints

std::vector<std::pair<Point, Point> > GeometricCut2DUserObject::_cut_line_endpoints
protectedinherited

◆ _cut_time_ranges

std::vector<std::pair<Real, Real> > GeometricCut2DUserObject::_cut_time_ranges
protectedinherited

◆ _heal_always

bool GeometricCutUserObject::_heal_always
protectedinherited

Heal the mesh.

Definition at line 196 of file GeometricCutUserObject.h.

◆ _interface_id

unsigned int GeometricCutUserObject::_interface_id
protectedinherited

Associated interface id.

Definition at line 193 of file GeometricCutUserObject.h.

Referenced by GeometricCutUserObject::finalize(), and GeometricCutUserObject::GeometricCutUserObject().

◆ _marked_elems_2d

std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo2D> > GeometricCutUserObject::_marked_elems_2d
protectedinherited

◆ _marked_elems_3d

std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo3D> > GeometricCutUserObject::_marked_elems_3d
protectedinherited

◆ _xfem

std::shared_ptr<XFEM> GeometricCutUserObject::_xfem
protectedinherited

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