https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GeometricCutUserObject.h
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
10#pragma once
11
12// MOOSE includes
14#include "XFEMAppTypes.h"
16
17#include "libmesh/libmesh_common.h"
18#include "libmesh/libmesh.h" // libMesh::invalid_uint
19#include "libmesh/elem.h"
20
21using namespace libMesh;
22
23class XFEM;
24
25namespace Xfem
26{
28struct CutEdge
29{
31 unsigned int _id1;
33 unsigned int _id2;
37 unsigned int _host_side_id;
38};
39
47inline bool
48operator<(const CutEdge & lhs, const CutEdge & rhs)
49{
50 if (lhs._id1 != rhs._id1)
51 return lhs._id1 < rhs._id1;
52 else
53 return lhs._id2 < rhs._id2;
54}
55
57struct CutNode
58{
60 unsigned int _id;
62 unsigned int _host_id;
63};
64
66struct CutFace
67{
69 unsigned int _face_id;
71 std::vector<unsigned int> _face_edge;
73 std::vector<Real> _position;
74};
75
78{
80 std::vector<CutEdge> _elem_cut_edges;
82 std::vector<CutNode> _elem_cut_nodes;
84 std::vector<CutEdge> _frag_cut_edges;
86 std::vector<std::vector<Point>> _frag_edges;
87};
88
91{
93 std::vector<CutFace> _elem_cut_faces;
95 std::vector<CutFace> _frag_cut_faces;
97 std::vector<std::vector<Point>> _frag_faces;
98};
99
100} // namespace Xfem
101
103{
104public:
110
111 GeometricCutUserObject(const InputParameters & parameters, const bool uses_mesh = false);
112
113 virtual void initialize() override;
114 virtual void execute() override;
115 virtual void threadJoin(const UserObject & y) override;
116 virtual void finalize() override;
117
118 virtual unsigned int getNumberOfCrackFrontPoints() const override
119 {
120 mooseError("getNumberOfCrackFrontPoints() is not implemented for this object.");
121 }
122
131 virtual bool cutElementByGeometry(const Elem * elem,
132 std::vector<Xfem::CutEdge> & cut_edges,
133 std::vector<Xfem::CutNode> & cut_nodes) const = 0;
134
142 virtual bool cutElementByGeometry(const Elem * elem,
143 std::vector<Xfem::CutFace> & cut_faces) const = 0;
144
151 virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_edges,
152 std::vector<Xfem::CutEdge> & cut_edges) const = 0;
153
160 virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_faces,
161 std::vector<Xfem::CutFace> & cut_faces) const = 0;
162
167 unsigned int getInterfaceID() const { return _interface_id; };
168
173 void setInterfaceID(unsigned int interface_id) { _interface_id = interface_id; };
174
180 bool shouldHealMesh() const { return _heal_always; };
181
189 virtual CutSubdomainID getCutSubdomainID(const Node * /*node*/) const
190 {
191 mooseError("Objects that inherit from GeometricCutUserObject should override the "
192 "getCutSubdomainID method");
193 return 0;
194 }
195
201 CutSubdomainID getCutSubdomainID(const Elem * elem) const;
202
203protected:
205 std::shared_ptr<XFEM> _xfem;
206
208 unsigned int _interface_id;
209
212
215
217 std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo2D>> _marked_elems_2d;
218 std::map<unsigned int, std::vector<Xfem::GeomMarkedElemInfo3D>> _marked_elems_3d;
220
222 void serialize(std::string & serialized_buffer);
223 void deserialize(std::vector<std::string> & serialized_buffers);
225};
const std::vector< double > y
unsigned int CutSubdomainID
Base class for crack front points provider.
std::map< unsigned int, std::vector< Xfem::GeomMarkedElemInfo3D > > _marked_elems_3d
virtual void threadJoin(const UserObject &y) override
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.
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
virtual void execute() override
unsigned int _interface_id
Associated interface id.
virtual unsigned int getNumberOfCrackFrontPoints() const override
Get the current number of crack front points.
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...
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point > > &frag_edges, std::vector< Xfem::CutEdge > &cut_edges) const =0
Check to see whether a fragment of a 2D element should be cut based on geometric conditions.
bool shouldHealMesh() const
Should the elements cut by this cutting object be healed in the current time step?
void setInterfaceID(unsigned int interface_id)
Set the interface ID for this cutting object.
void deserialize(std::vector< std::string > &serialized_buffers)
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes) const =0
Check to see whether a specified 2D element should be cut based on geometric conditions.
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point > > &frag_faces, std::vector< Xfem::CutFace > &cut_faces) const =0
Check to see whether a fragment of a 3D element should be cut based on geometric conditions.
virtual void initialize() override
virtual CutSubdomainID getCutSubdomainID(const Node *) const
Get CutSubdomainID telling which side the node belongs to relative to the cut.
virtual void finalize() override
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutFace > &cut_faces) const =0
Check to see whether a specified 3D element should be cut based on geometric conditions.
int _last_step_initialized
Time step information needed to advance a 3D crack only at the real beginning of a time step.
unsigned int getInterfaceID() const
Get the interface ID for this cutting object.
const InputParameters & parameters() const
void mooseError(Args &&... args) const
This is the XFEM class.
Definition XFEM.h:108
Definition XFEM.h:26
bool operator<(const CutEdge &lhs, const CutEdge &rhs)
Operator < for two CutEdge Objects Needed to allow the use of std::set<CutEdge>
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Data structure defining a cut on an element edge.
unsigned int _id1
ID of the first node on the edge.
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.
Data structure defining a cut through a face.
unsigned int _face_id
ID of the cut face.
std::vector< Real > _position
Fractional distance along the cut edges where the cut is located.
std::vector< unsigned int > _face_edge
IDs of all cut faces.
Data structure defining a cut through a node.
unsigned int _id
ID of the cut node.
unsigned int _host_id
Local ID of this node in the host element.
Data structure describing geometrically described cut through 2D element.
std::vector< CutNode > _elem_cut_nodes
Container for data about all cut nodes in this element.
std::vector< CutEdge > _frag_cut_edges
Container for data about all cut fragments 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.
Data structure describing geometrically described cut through 3D element.
std::vector< CutFace > _frag_cut_faces
Container for data about all faces this element's fragment.
std::vector< CutFace > _elem_cut_faces
Container for data about all cut faces in this element.
std::vector< std::vector< Point > > _frag_faces
Container for data about all cut faces in cut fragments in this element.