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);
74 if (intersectWithEdge(*node1, *node2, intersection))
76 cut_edges.push_back(j);
77 cut_pos.push_back(getRelativePosition(*node1, *node2, intersection));
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);
151 Real full_len = (p2 - p1).norm();
152 Real len_p1_p = (
p - p1).norm();
153 return len_p1_p / full_len;
void mooseError(Args &&... args)
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.
virtual bool intersectWithEdge(const Point &p1, const Point &p2, Point &pint) const
static InputParameters validParams()
GeometricCut3DUserObject(const InputParameters ¶meters)
Real getRelativePosition(const Point &p1, const Point &p2, const Point &p) const
virtual bool isInsideCutPlane(Point p) const =0
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.
bool isInsideEdge(const Point &p1, const Point &p2, const Point &p) const
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
void mooseError(Args &&... args) const
int plane_normal_line_exp_int_3d(double pp[3], double normal[3], double p1[3], double p2[3], double pint[3])
std::string enum_to_string(const T e)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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.