15 #include "libmesh/string_to_enum.h" 35 std::vector<Xfem::CutEdge> & ,
36 std::vector<Xfem::CutNode> & )
const 38 mooseError(
"Invalid method: must use vector of element faces for 3D mesh cutting");
44 std::vector<Xfem::CutFace> & cut_faces)
const 47 bool cut_elem =
false;
49 for (
unsigned int i = 0; i < elem->n_sides(); ++i)
52 std::unique_ptr<const Elem> curr_side = elem->side_ptr(i);
53 if (curr_side->dim() != 2)
54 mooseError(
"In cutElementByGeometry dimension of side must be 2, but it is ",
56 unsigned int n_edges = curr_side->n_sides();
58 std::vector<unsigned int> cut_edges;
59 std::vector<Real> cut_pos;
61 for (
unsigned int j = 0;
j < n_edges;
j++)
64 std::unique_ptr<const Elem> curr_edge = curr_side->side_ptr(
j);
65 if (curr_edge->type() !=
EDGE2)
66 mooseError(
"In cutElementByGeometry face edge must be EDGE2, but type is: ",
68 " base element type is: ",
70 const Node * node1 = curr_edge->node_ptr(0);
71 const Node * node2 = curr_edge->node_ptr(1);
76 cut_edges.push_back(
j);
81 if (cut_edges.size() == 2)
90 cut_faces.push_back(mycut);
99 std::vector<Xfem::CutEdge> & )
const 101 mooseError(
"Invalid method: must use vector of element faces for 3D mesh cutting");
107 std::vector<Xfem::CutFace> & )
const 110 mooseError(
"cutFragmentByGeometry not yet implemented for 3D mesh cutting");
117 bool has_intersection =
false;
120 double edge_point1[3] = {p1(0), p1(1), p1(2)};
121 double edge_point2[3] = {p2(0), p2(1), p2(2)};
122 double cut_point[3] = {0.0, 0.0, 0.0};
125 plane_point, plane_normal, edge_point1, edge_point2, cut_point) == 1)
127 Point temp_p(cut_point[0], cut_point[1], cut_point[2]);
131 has_intersection =
true;
134 return has_intersection;
140 Real dotp1 = (p1 - p) * (p2 - p1);
141 Real dotp2 = (p2 - p) * (p2 - p1);
142 return (dotp1 * dotp2 <= 0.0);
148 const Point & p)
const 153 return len_p1_p / full_len;
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point >> &frag_edges, std::vector< Xfem::CutEdge > &cut_edges) const override
Check to see whether a fragment of a 2D element should be cut based on geometric conditions.
void mooseError(Args &&... args)
GeometricCut3DUserObject(const InputParameters ¶meters)
virtual bool isInsideCutPlane(Point p) const =0
std::vector< Real > _position
Fractional distance along the cut edges where the cut is located.
virtual bool intersectWithEdge(const Point &p1, const Point &p2, Point &pint) const
Data structure defining a cut through a face.
int plane_normal_line_exp_int_3d(double pp[3], double normal[3], double p1[3], double p2[3], double pint[3])
Real getRelativePosition(const Point &p1, const Point &p2, const Point &p)
Get the relative position of p from p1 respect to the total length of the line segment.
bool intersectWithEdge(const Point &p1, const Point &p2, const std::vector< Point > &vertices, Point &pint)
check if a line intersects with an element defined by vertices calculate the distance from a point to...
Real getRelativePosition(const Point &p1, const Point &p2, const Point &p) const
std::string enum_to_string(const T e)
bool isInsideEdge(const Point &p1, const Point &p2, const Point &p) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes) const override
Check to see whether a specified 2D element should be cut based on geometric conditions.
static InputParameters validParams()
std::vector< unsigned int > _face_edge
IDs of all cut faces.
unsigned int _face_id
ID of the cut face.