www.mooseframework.org
XFEMFuncs.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 #include <vector>
13 #include "libmesh/point.h"
14 #include "libmesh/plane.h"
15 #include "EFAPoint.h"
16 
17 using namespace libMesh;
18 
19 namespace Xfem
20 {
21 static const double tol = 1.0e-10;
22 
23 void dunavant_rule2(const Real * wts,
24  const Real * a,
25  const Real * b,
26  const unsigned int * permutation_ids,
27  unsigned int n_wts,
28  std::vector<Point> & points,
29  std::vector<Real> & weights);
30 
31 void stdQuadr2D(unsigned int nen, unsigned int iord, std::vector<std::vector<Real>> & sg2);
32 
33 void wissmannPoints(unsigned int nqp, std::vector<std::vector<Real>> & wss);
34 
35 void shapeFunc2D(unsigned int nen,
36  std::vector<Real> & ss,
37  std::vector<Point> & xl,
38  std::vector<std::vector<Real>> & shp,
39  Real & xsj,
40  bool natl_flg);
41 
42 double r8vec_norm(int n, double a[]);
43 
44 void r8vec_copy(int n, double a1[], double a2[]);
45 
46 bool r8vec_eq(int n, double a1[], double a2[]);
47 
48 double r8vec_dot_product(int n, double a1[], double a2[]);
49 
50 bool line_exp_is_degenerate_nd(int dim_num, double p1[], double p2[]);
51 
53  double pp[3], double normal[3], double p1[3], double p2[3], double pint[3]);
54 
56  double coord[], int order_max, int face_num, int node[], int node_num, int order[]);
57 
58 void i4vec_zero(int n, int a[]);
59 
60 void normalizePoint(Point & p);
61 
62 void normalizePoint(EFAPoint & p);
63 
64 double r8_acos(double c);
65 
66 double angle_rad_3d(double p1[3], double p2[3], double p3[3]);
67 
81 bool intersectSegmentWithCutLine(const Point & segment_point1,
82  const Point & segment_point2,
83  const std::pair<Point, Point> & cutting_line_points,
84  const Real & cutting_line_fraction,
85  Real & segment_intersection_fraction);
86 
96 Real crossProduct2D(const Point & point_a, const Point & point_b);
97 
106 Real pointSegmentDistance(const Point & x0, const Point & x1, const Point & x2, Point & xp);
107 
118 // See "Generating Signed Distance Fields From Triangle Meshes" for details.
119 // (http://www2.imm.dtu.dk/pubdb/edoc/imm1289.pdf)
120 //
121 // R1
122 // 1
123 // * *
124 // R4 * * R6
125 // * R0 *
126 // * *
127 // 2 * * * * 3
128 // R2 R5 R3
129 
130 Real pointTriangleDistance(const Point & x0,
131  const Point & x1,
132  const Point & x2,
133  const Point & x3,
134  Point & xp,
135  unsigned int & region);
136 
145 bool intersectWithEdge(const Point & p1,
146  const Point & p2,
147  const std::vector<Point> & vertices,
148  Point & pint);
149 
156 bool isInsideEdge(const Point & p1, const Point & p2, const Point & p);
157 
164 Real getRelativePosition(const Point & p1, const Point & p2, const Point & p);
165 
172 bool isInsideCutPlane(const std::vector<Point> & vertices, const Point & p);
173 
174 } // namespace Xfem
double polyhedron_volume_3d(double coord[], int order_max, int face_num, int node[], int node_num, int order[])
Definition: XFEMFuncs.C:489
void shapeFunc2D(unsigned int nen, std::vector< Real > &ss, std::vector< Point > &xl, std::vector< std::vector< Real >> &shp, Real &xsj, bool natl_flg)
Definition: XFEMFuncs.C:269
Real pointSegmentDistance(const Point &x0, const Point &x1, const Point &x2, Point &xp)
Calculate the signed distance from a point to a line segment.
Definition: XFEMFuncs.C:818
void wissmannPoints(unsigned int nqp, std::vector< std::vector< Real >> &wss)
Definition: XFEMFuncs.C:233
bool line_exp_is_degenerate_nd(int dim_num, double p1[], double p2[])
Definition: XFEMFuncs.C:394
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
double r8vec_norm(int n, double a[])
Definition: XFEMFuncs.C:354
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:403
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.
Definition: XFEMFuncs.C:991
void i4vec_zero(int n, int a[])
Definition: XFEMFuncs.C:586
Definition: XFEM.h:25
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...
Definition: XFEMFuncs.C:948
bool isInsideCutPlane(const std::vector< Point > &vertices, const Point &p)
Check if point p is inside a plane.
Definition: XFEMFuncs.C:999
Real crossProduct2D(const Point &point_a, const Point &point_b)
Compute the cross product of two vectors, provided as Point objects, which have nonzero components on...
Definition: XFEMFuncs.C:812
static const double tol
Definition: XFEMFuncs.h:21
bool intersectSegmentWithCutLine(const Point &segment_point1, const Point &segment_point2, const std::pair< Point, Point > &cutting_line_points, const Real &cutting_line_fraction, Real &segment_intersection_fraction)
Determine whether a line segment is intersected by a cutting line, and compute the fraction along tha...
Definition: XFEMFuncs.C:774
bool r8vec_eq(int n, double a1[], double a2[])
Definition: XFEMFuncs.C:374
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void stdQuadr2D(unsigned int nen, unsigned int iord, std::vector< std::vector< Real >> &sg2)
Definition: XFEMFuncs.C:96
void normalizePoint(EFAPoint &p)
Definition: XFEMFuncs.C:631
void dunavant_rule2(const Real *wts, const Real *a, const Real *b, const unsigned int *permutation_ids, unsigned int n_wts, std::vector< Point > &points, std::vector< Real > &weights)
Definition: XFEMFuncs.C:21
double r8vec_dot_product(int n, double a1[], double a2[])
Definition: XFEMFuncs.C:384
bool isInsideEdge(const Point &p1, const Point &p2, const Point &p)
check if point is inside the straight edge p1-p2
Definition: XFEMFuncs.C:983
double angle_rad_3d(double p1[3], double p2[3], double p3[3])
Definition: XFEMFuncs.C:691
double r8_acos(double c)
Definition: XFEMFuncs.C:639
Real pointTriangleDistance(const Point &x0, const Point &x1, const Point &x2, const Point &x3, Point &xp, unsigned int &region)
Calculate the signed distance from a point to a triangle.
Definition: XFEMFuncs.C:836
void r8vec_copy(int n, double a1[], double a2[])
Definition: XFEMFuncs.C:365