www.mooseframework.org
GeometricCutUserObject.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 // MOOSE includes
14 
15 #include "libmesh/libmesh_common.h"
16 #include "libmesh/libmesh.h" // libMesh::invalid_uint
17 #include "libmesh/elem.h"
18 
19 using namespace libMesh;
20 
21 class XFEM;
22 
23 namespace Xfem
24 {
26 struct CutEdge
27 {
29  unsigned int _id1;
31  unsigned int _id2;
33  Real _distance;
35  unsigned int _host_side_id;
36 };
37 
45 inline bool
46 operator<(const CutEdge & lhs, const CutEdge & rhs)
47 {
48  if (lhs._id1 != rhs._id1)
49  return lhs._id1 < rhs._id1;
50  else
51  return lhs._id2 < rhs._id2;
52 }
53 
55 struct CutNode
56 {
58  unsigned int _id;
60  unsigned int _host_id;
61 };
62 
64 struct CutFace
65 {
67  unsigned int _face_id;
69  std::vector<unsigned int> _face_edge;
71  std::vector<Real> _position;
72 };
73 
76 {
78  std::vector<CutEdge> _elem_cut_edges;
80  std::vector<CutNode> _elem_cut_nodes;
82  std::vector<CutEdge> _frag_cut_edges;
84  std::vector<std::vector<Point>> _frag_edges;
85 };
86 
89 {
91  std::vector<CutFace> _elem_cut_faces;
93  std::vector<CutFace> _frag_cut_faces;
95  std::vector<std::vector<Point>> _frag_faces;
96 };
97 
98 } // namespace Xfem
99 
100 // Forward declarations
102 
103 template <>
104 InputParameters validParams<GeometricCutUserObject>();
105 
107 {
108 public:
113  GeometricCutUserObject(const InputParameters & parameters);
114 
115  virtual void initialize() override;
116  virtual void execute() override;
117  virtual void threadJoin(const UserObject & y) override;
118  virtual void finalize() override;
119 
129  virtual bool cutElementByGeometry(const Elem * elem,
130  std::vector<Xfem::CutEdge> & cut_edges,
131  std::vector<Xfem::CutNode> & cut_nodes,
132  Real time) const = 0;
133 
142  virtual bool cutElementByGeometry(const Elem * elem,
143  std::vector<Xfem::CutFace> & cut_faces,
144  Real time) const = 0;
145 
153  virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_edges,
154  std::vector<Xfem::CutEdge> & cut_edges,
155  Real time) const = 0;
156 
164  virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_faces,
165  std::vector<Xfem::CutFace> & cut_faces,
166  Real time) const = 0;
167 
172  unsigned int getInterfaceID() const { return _interface_id; };
173 
178  void setInterfaceID(unsigned int interface_id) { _interface_id = interface_id; };
179 
185  bool shouldHealMesh() const { return _heal_always; };
186 
187 protected:
189  std::shared_ptr<XFEM> _xfem;
190 
192  unsigned int _interface_id;
193 
196 
199 
201  std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo2D>> _marked_elems_2d;
202  std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo3D>> _marked_elems_3d;
204 
206  void serialize(std::string & serialized_buffer);
207  void deserialize(std::vector<std::string> & serialized_buffers);
209 };
Xfem::CutEdge::_id1
unsigned int _id1
ID of the first node on the edge.
Definition: GeometricCutUserObject.h:29
Xfem::GeomMarkedElemInfo2D
Data structure describing geometrically described cut through 2D element.
Definition: GeometricCutUserObject.h:75
GeometricCutUserObject::getInterfaceID
unsigned int getInterfaceID() const
Get the interface ID for this cutting object.
Definition: GeometricCutUserObject.h:172
Xfem::CutEdge::_distance
Real _distance
Fractional distance along the edge (from node 1 to 2) where the cut is located.
Definition: GeometricCutUserObject.h:33
libMesh
Definition: RANFSNormalMechanicalContact.h:24
Xfem::CutNode::_host_id
unsigned int _host_id
Local ID of this node in the host element.
Definition: GeometricCutUserObject.h:60
validParams< GeometricCutUserObject >
InputParameters validParams< GeometricCutUserObject >()
Definition: GeometricCutUserObject.C:25
Xfem::CutFace::_position
std::vector< Real > _position
Fractional distance along the cut edges where the cut is located.
Definition: GeometricCutUserObject.h:71
Xfem::CutEdge::_id2
unsigned int _id2
ID of the second node on the edge.
Definition: GeometricCutUserObject.h:31
Xfem::GeomMarkedElemInfo2D::_elem_cut_edges
std::vector< CutEdge > _elem_cut_edges
Container for data about all cut edges in this element.
Definition: GeometricCutUserObject.h:78
Xfem::GeomMarkedElemInfo2D::_elem_cut_nodes
std::vector< CutNode > _elem_cut_nodes
Container for data about all cut nodes in this element.
Definition: GeometricCutUserObject.h:80
Xfem::CutEdge::_host_side_id
unsigned int _host_side_id
Local ID of this side in the host element.
Definition: GeometricCutUserObject.h:35
Xfem::GeomMarkedElemInfo2D::_frag_edges
std::vector< std::vector< Point > > _frag_edges
Container for data about all cut edges in cut fragments in this element.
Definition: GeometricCutUserObject.h:84
GeometricCutUserObject
Definition: GeometricCutUserObject.h:106
Xfem::CutFace::_face_id
unsigned int _face_id
ID of the cut face.
Definition: GeometricCutUserObject.h:67
Xfem::CutFace::_face_edge
std::vector< unsigned int > _face_edge
IDs of all cut faces.
Definition: GeometricCutUserObject.h:69
GeometricCutUserObject::_marked_elems_3d
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d
Definition: GeometricCutUserObject.h:202
CrackFrontPointsProvider.h
GeometricCutUserObject::_last_step_initialized
unsigned int _last_step_initialized
Time step information needed to advance a 3D crack only at the real beginning of a time step.
Definition: GeometricCutUserObject.h:198
Xfem::GeomMarkedElemInfo3D
Data structure describing geometrically described cut through 3D element.
Definition: GeometricCutUserObject.h:88
Xfem::GeomMarkedElemInfo2D::_frag_cut_edges
std::vector< CutEdge > _frag_cut_edges
Container for data about all cut fragments in this element.
Definition: GeometricCutUserObject.h:82
GeometricCutUserObject::shouldHealMesh
bool shouldHealMesh() const
Should the elements cut by this cutting object be healed in the current time step?
Definition: GeometricCutUserObject.h:185
GeometricCutUserObject::_interface_id
unsigned int _interface_id
Associated interface id.
Definition: GeometricCutUserObject.h:192
GeometricCutUserObject::setInterfaceID
void setInterfaceID(unsigned int interface_id)
Set the interface ID for this cutting object.
Definition: GeometricCutUserObject.h:178
Xfem::CutNode
Data structure defining a cut through a node.
Definition: GeometricCutUserObject.h:55
GeometricCutUserObject::_marked_elems_2d
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.
Definition: GeometricCutUserObject.h:201
Xfem
Definition: XFEM.h:25
Xfem::operator<
bool operator<(const CutEdge &lhs, const CutEdge &rhs)
Operator < for two CutEdge Objects Needed to allow the use of std::set<CutEdge>
Definition: GeometricCutUserObject.h:46
GeometricCutUserObject::_heal_always
bool _heal_always
Heal the mesh.
Definition: GeometricCutUserObject.h:195
Xfem::CutNode::_id
unsigned int _id
ID of the cut node.
Definition: GeometricCutUserObject.h:58
Xfem::GeomMarkedElemInfo3D::_frag_faces
std::vector< std::vector< Point > > _frag_faces
Container for data about all cut faces in cut fragments in this element.
Definition: GeometricCutUserObject.h:95
Xfem::GeomMarkedElemInfo3D::_frag_cut_faces
std::vector< CutFace > _frag_cut_faces
Container for data about all faces this element's fragment.
Definition: GeometricCutUserObject.h:93
Xfem::CutFace
Data structure defining a cut through a face.
Definition: GeometricCutUserObject.h:64
XFEM
This is the XFEM class.
Definition: XFEM.h:61
Xfem::GeomMarkedElemInfo3D::_elem_cut_faces
std::vector< CutFace > _elem_cut_faces
Container for data about all cut faces in this element.
Definition: GeometricCutUserObject.h:91
Xfem::CutEdge
Data structure defining a cut on an element edge.
Definition: GeometricCutUserObject.h:26
CrackFrontPointsProvider
Base class for crack front points provider.
Definition: CrackFrontPointsProvider.h:22