www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GeometricCut3DUserObject Class Referenceabstract

#include <GeometricCut3DUserObject.h>

Inheritance diagram for GeometricCut3DUserObject:
[legend]

Public Member Functions

 GeometricCut3DUserObject (const InputParameters &parameters)
 
virtual bool active (Real time) const override
 
virtual bool cutElementByGeometry (const Elem *elem, std::vector< CutEdge > &cut_edges, std::vector< CutNode > &cut_nodes, Real time) const override
 
virtual bool cutElementByGeometry (const Elem *elem, std::vector< CutFace > &cut_faces, Real time) const override
 
virtual bool cutFragmentByGeometry (std::vector< std::vector< Point >> &frag_edges, std::vector< CutEdge > &cut_edges, Real time) const override
 
virtual bool cutFragmentByGeometry (std::vector< std::vector< Point >> &frag_faces, std::vector< CutFace > &cut_faces, Real time) const override
 
Real cutFraction (unsigned int cut_num, Real time) const
 
virtual const std::vector< Point > getCrackFrontPoints (unsigned int) const =0
 get a set of points along a crack front from a XFEM GeometricCutUserObject More...
 

Protected Member Functions

virtual bool intersectWithEdge (const Point &p1, const Point &p2, Point &pint) const
 
virtual bool isInsideCutPlane (Point p) const =0
 
bool isInsideEdge (const Point &p1, const Point &p2, const Point &p) const
 
Real getRelativePosition (const Point &p1, const Point &p2, const Point &p) const
 

Protected Attributes

Point _center
 
Point _normal
 
std::vector< std::pair< Real, Real > > _cut_time_ranges
 

Detailed Description

Definition at line 15 of file GeometricCut3DUserObject.h.

Constructor & Destructor Documentation

GeometricCut3DUserObject::GeometricCut3DUserObject ( const InputParameters &  parameters)

Definition at line 31 of file GeometricCut3DUserObject.C.

32  : GeometricCutUserObject(parameters), _center(), _normal()
33 {
34  _cut_time_ranges.push_back(std::make_pair(0.0, 0.0));
35 }
std::vector< std::pair< Real, Real > > _cut_time_ranges
GeometricCutUserObject(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...

Member Function Documentation

bool GeometricCut3DUserObject::active ( Real  time) const
overridevirtual

Implements GeometricCutUserObject.

Definition at line 37 of file GeometricCut3DUserObject.C.

37 { return true; }
bool GeometricCut3DUserObject::cutElementByGeometry ( const Elem *  elem,
std::vector< CutEdge > &  cut_edges,
std::vector< CutNode > &  cut_nodes,
Real  time 
) const
overridevirtual

Implements GeometricCutUserObject.

Definition at line 40 of file GeometricCut3DUserObject.C.

44 {
45  mooseError("Invalid method: must use vector of element faces for 3D mesh cutting");
46  return false;
47 }
bool GeometricCut3DUserObject::cutElementByGeometry ( const Elem *  elem,
std::vector< CutFace > &  cut_faces,
Real  time 
) const
overridevirtual

Implements GeometricCutUserObject.

Definition at line 50 of file GeometricCut3DUserObject.C.

54 {
55  bool cut_elem = false;
56 
57  for (unsigned int i = 0; i < elem->n_sides(); ++i)
58  {
59  // This returns the lowest-order type of side.
60  std::unique_ptr<Elem> curr_side = elem->side(i);
61  if (curr_side->dim() != 2)
62  mooseError("In cutElementByGeometry dimension of side must be 2, but it is ",
63  curr_side->dim());
64  unsigned int n_edges = curr_side->n_sides();
65 
66  std::vector<unsigned int> cut_edges;
67  std::vector<Real> cut_pos;
68 
69  for (unsigned int j = 0; j < n_edges; j++)
70  {
71  // This returns the lowest-order type of side.
72  std::unique_ptr<Elem> curr_edge = curr_side->side(j);
73  if (curr_edge->type() != EDGE2)
74  mooseError("In cutElementByGeometry face edge must be EDGE2, but type is: ",
75  libMesh::Utility::enum_to_string(curr_edge->type()),
76  " base element type is: ",
77  libMesh::Utility::enum_to_string(elem->type()));
78  Node * node1 = curr_edge->get_node(0);
79  Node * node2 = curr_edge->get_node(1);
80 
81  Point intersection;
82  if (intersectWithEdge(*node1, *node2, intersection))
83  {
84  cut_edges.push_back(j);
85  cut_pos.push_back(getRelativePosition(*node1, *node2, intersection));
86  }
87  }
88 
89  if (cut_edges.size() == 2)
90  {
91  cut_elem = true;
92  CutFace mycut;
93  mycut.face_id = i;
94  mycut.face_edge.push_back(cut_edges[0]);
95  mycut.face_edge.push_back(cut_edges[1]);
96  mycut.position.push_back(cut_pos[0]);
97  mycut.position.push_back(cut_pos[1]);
98  cut_faces.push_back(mycut);
99  }
100  }
101 
102  return cut_elem;
103 }
virtual bool intersectWithEdge(const Point &p1, const Point &p2, Point &pint) const
Real getRelativePosition(const Point &p1, const Point &p2, const Point &p) const
std::vector< Real > position
unsigned int face_id
std::vector< unsigned int > face_edge
Real GeometricCutUserObject::cutFraction ( unsigned int  cut_num,
Real  time 
) const
inherited

Definition at line 39 of file GeometricCutUserObject.C.

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

40 {
41  Real fraction = 0.0;
42 
43  if (time >= _cut_time_ranges[cut_num].first)
44  {
45  if (time >= _cut_time_ranges[cut_num].second)
46  fraction = 1.0;
47  else
48  fraction = (time - _cut_time_ranges[cut_num].first) /
49  (_cut_time_ranges[cut_num].second - _cut_time_ranges[cut_num].first);
50  }
51  return fraction;
52 }
std::vector< std::pair< Real, Real > > _cut_time_ranges
bool GeometricCut3DUserObject::cutFragmentByGeometry ( std::vector< std::vector< Point >> &  frag_edges,
std::vector< CutEdge > &  cut_edges,
Real  time 
) const
overridevirtual

Implements GeometricCutUserObject.

Definition at line 106 of file GeometricCut3DUserObject.C.

109 {
110  mooseError("Invalid method: must use vector of element faces for 3D mesh cutting");
111  return false;
112 }
bool GeometricCut3DUserObject::cutFragmentByGeometry ( std::vector< std::vector< Point >> &  frag_faces,
std::vector< CutFace > &  cut_faces,
Real  time 
) const
overridevirtual

Implements GeometricCutUserObject.

Definition at line 115 of file GeometricCut3DUserObject.C.

118 {
119  // TODO: Need this for branching in 3D
120  mooseError("cutFragmentByGeometry not yet implemented for 3D mesh cutting");
121  return false;
122 }
virtual const std::vector<Point> CrackFrontPointsProvider::getCrackFrontPoints ( unsigned  int) const
pure virtualinherited

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

Returns
A vector which contains all crack front points

Implemented in CircleCutUserObject, EllipseCutUserObject, LineSegmentCutSetUserObject, LineSegmentCutUserObject, and RectangleCutUserObject.

Referenced by CrackFrontDefinition::initialSetup().

Real GeometricCut3DUserObject::getRelativePosition ( const Point &  p1,
const Point &  p2,
const Point &  p 
) const
protected

Definition at line 156 of file GeometricCut3DUserObject.C.

Referenced by cutElementByGeometry().

159 {
160  // get the relative position of p from p1
161  Real full_len = (p2 - p1).norm();
162  Real len_p1_p = (p - p1).norm();
163  return len_p1_p / full_len;
164 }
bool GeometricCut3DUserObject::intersectWithEdge ( const Point &  p1,
const Point &  p2,
Point &  pint 
) const
protectedvirtual

Definition at line 125 of file GeometricCut3DUserObject.C.

Referenced by cutElementByGeometry().

126 {
127  bool has_intersection = false;
128  double plane_point[3] = {_center(0), _center(1), _center(2)};
129  double plane_normal[3] = {_normal(0), _normal(1), _normal(2)};
130  double edge_point1[3] = {p1(0), p1(1), p1(2)};
131  double edge_point2[3] = {p2(0), p2(1), p2(2)};
132  double cut_point[3] = {0.0, 0.0, 0.0};
133 
135  plane_point, plane_normal, edge_point1, edge_point2, cut_point) == 1)
136  {
137  Point temp_p(cut_point[0], cut_point[1], cut_point[2]);
138  if (isInsideCutPlane(temp_p) && isInsideEdge(p1, p2, temp_p))
139  {
140  pint = temp_p;
141  has_intersection = true;
142  }
143  }
144  return has_intersection;
145 }
int plane_normal_line_exp_int_3d(double pp[3], double normal[3], double p1[3], double p2[3], double pint[3])
Definition: XFEMFuncs.C:408
virtual bool isInsideCutPlane(Point p) const =0
bool isInsideEdge(const Point &p1, const Point &p2, const Point &p) const
virtual bool GeometricCut3DUserObject::isInsideCutPlane ( Point  p) const
protectedpure virtual
bool GeometricCut3DUserObject::isInsideEdge ( const Point &  p1,
const Point &  p2,
const Point &  p 
) const
protected

Definition at line 148 of file GeometricCut3DUserObject.C.

Referenced by intersectWithEdge().

149 {
150  Real dotp1 = (p1 - p) * (p2 - p1);
151  Real dotp2 = (p2 - p) * (p2 - p1);
152  return (dotp1 * dotp2 <= 0.0);
153 }

Member Data Documentation

Point GeometricCut3DUserObject::_center
protected
std::vector<std::pair<Real, Real> > GeometricCutUserObject::_cut_time_ranges
protectedinherited
Point GeometricCut3DUserObject::_normal
protected

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