PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
|
Collection of methods useful in simulation. More...
Namespaces | |
namespace | geometry |
Provides geometrical methods such as point inside rectangle. | |
namespace | io |
Provides geometrical methods such as point inside rectangle. | |
namespace | methods |
Provides fast methods to add/subtract list of data, to find maximum/minimum from list of data. | |
namespace | parallel |
Implements some key functions and classes regularly used in the code when running with MPI. | |
Data Structures | |
class | DistributionSample |
Templated probability distribution. More... | |
struct | Matrix3 |
A structure to represent 3d matrices. More... | |
struct | Point |
A structure to represent 3d vectors. More... | |
struct | SymMatrix3 |
A structure to represent 3d matrices. More... | |
Functions | |
bool | isGreater (const double &a, const double &b) |
Returns true if a > b. | |
bool | isLess (const double &a, const double &b) |
Returns true if a < b. | |
double | hatFunction (const double &x, const double &x_min, const double &x_max) |
Computes hat function at given point. | |
double | hatFunctionQuick (const double &x, const double &x_min, const double &x_max) |
Computes hat function at given point. | |
double | linearStepFunc (const double &x, const double &x1, const double &x2) |
Compute linear step function. | |
double | gaussian (const double &r, const double &a, const double &beta) |
Compute gaussian function in 1-d. | |
double | gaussian2d (const util::Point &x, const size_t &dof, const std::vector< double > ¶ms) |
Compute gaussian function in 2-d. | |
double | doubleGaussian2d (const util::Point &x, const size_t &dof, const std::vector< double > ¶ms) |
Compute sum of two gaussian function in 2-d. | |
double | equivalentMass (const double &m1, const double &m2) |
Compute harmonic mean of m1 and m2. | |
std::vector< util::Point > | getCornerPoints (size_t dim, const std::pair< util::Point, util::Point > &box) |
Returns all corner points in the box. | |
std::vector< std::pair< util::Point, util::Point > > | getEdges (size_t dim, const std::pair< util::Point, util::Point > &box) |
Returns all corner points in the box. | |
util::Point | getCenter (size_t dim, const std::pair< util::Point, util::Point > &box) |
Returns center point. | |
double | inscribedRadiusInBox (size_t dim, const std::pair< util::Point, util::Point > &box) |
Computes the radius of biggest circle/sphere completely within the object. | |
double | circumscribedRadiusInBox (size_t dim, const std::pair< util::Point, util::Point > &box) |
Computes the radius of smallest circle/sphere which can have the box inside. | |
util::Point | getPointOnLine (const util::Point &p1, const util::Point &p2, const double &s) |
Returns point in line formed by points p1 and p2. | |
double | computeMeshSize (const std::vector< util::Point > &nodes) |
Computes minimum distance between any two nodes. | |
double | computeMeshSize (const std::vector< util::Point > &nodes, size_t start, size_t end) |
Computes minimum distance between any two nodes. | |
std::pair< util::Point, util::Point > | computeBBox (const std::vector< util::Point > &nodes) |
Computes bounding box for vector nodes. | |
double | computeInscribedRadius (const std::pair< util::Point, util::Point > &box) |
Computes maximum radius of circle/sphere within a given box. | |
std::pair< util::Point, util::Point > | toPointBox (const std::vector< double > &p1, const std::vector< double > &p2) |
Create box from two coordinate data. | |
double | triangleArea (const util::Point &x1, const util::Point &x2, const util::Point &x3) |
Compute area of triangle. | |
template<class T > | |
T | l2Dist (const std::vector< T > &x1, const std::vector< T > &x2) |
Computes l2 distance between two vectors. | |
bool | checkMatrix (const std::vector< std::vector< double > > &m) |
Checks matrix. | |
std::vector< double > | dot (const std::vector< std::vector< double > > &m, const std::vector< double > &v) |
Computes the dot product between matrix and vector. | |
std::vector< std::vector< double > > | transpose (const std::vector< std::vector< double > > &m) |
Computes the tranpose of matrix. | |
double | det (const std::vector< std::vector< double > > &m) |
Computes the determinant of matrix. | |
std::vector< std::vector< double > > | inv (const std::vector< std::vector< double > > &m) |
Computes the determinant of matrix. | |
RandGenerator | get_rd_gen (int seed=-1) |
Return random number generator. | |
std::default_random_engine | get_rd_engine (int &seed) |
Return random number generator. | |
double | transform_to_normal_dist (double mean, double std, double sample) |
Transform sample from N(0,1) to N(mean, std^2) | |
double | transform_to_uniform_dist (double min, double max, double sample) |
Transform sample from U(0,1) to U(a,b) | |
print_const (arg, fmt='%4.6e', prefix="") | |
print_list (arg, fmt='%4.6e', delim=', ') | |
print_bool (arg, prefix="") | |
print_dbl (arg, prefix="") | |
print_int (arg, prefix="") | |
print_dbl_list (arg, prefix="") | |
print_int_list (arg, prefix="") | |
print_point_gmsh (arg, n) | |
print_cir_gmsh (arg, n) | |
print_line_gmsh (arg, n) | |
print_lineloop_gmsh (arg, n) | |
gmsh_file_hdr (f) | |
get_E (K, nu) | |
get_G (E, nu) | |
get_eff_k (k1, k2) | |
get_max (l) | |
rotate (p, theta, axis) | |
get_ref_hex_points (center, radius, add_center=False) | |
get_ref_drum_points (center, radius, width, add_center=False) | |
does_intersect (p, particles, padding) | |
does_intersect_rect (p, particles, padding, rect, is_3d=False) | |
generate_circle_gmsh_input (filename, center, radius, mesh_size, pp_tag=None) | |
generate_rectangle_gmsh_input (filename, rectangle, mesh_size, pp_tag=None) | |
generate_hexagon_gmsh_input (filename, center, radius, mesh_size, pp_tag=None) | |
generate_drum_gmsh_input (filename, center, radius, width, mesh_size, pp_tag=None) | |
Methods to check point in domain | |
bool | isPointInsideBox (util::Point x, size_t dim, const std::pair< util::Point, util::Point > &box) |
Returns true if point is inside box. | |
bool | isPointInsideRectangle (util::Point x, double x_min, double x_max, double y_min, double y_max) |
Checks if point is inside a rectangle. | |
bool | isPointInsideRectangle (util::Point x, util::Point x_lb, util::Point x_rt) |
Checks if point is inside a rectangle. | |
bool | isPointInsideAngledRectangle (util::Point x, double x_min, double x_max, double y_min, double y_max, double theta) |
Checks if point is inside an angled rectangle. | |
bool | isPointInsideCuboid (util::Point x, util::Point x_lbb, util::Point x_rtf) |
Checks if point is inside a cuboid. | |
bool | isPointInsideCylinder (const util::Point &p, const double &length, const double &radius, const util::Point &axis) |
Returns true if point is inside the cylinder. | |
bool | isPointInsideCylinder (const util::Point &p, const double &radius, const util::Point &x1, const util::Point &x2) |
Returns true if point is inside the cylinder. | |
bool | isPointInsideEllipse (const util::Point &p, const util::Point ¢er, const std::vector< double > &radius_vec, unsigned int dim) |
Returns true if point is inside the ellipsoid. | |
bool | isPointInsideEllipse (const util::Point &p, const util::Point ¢er, const std::vector< double > &radius_vec, unsigned int dim, double &d) |
Returns true if point is inside the ellipsoid. | |
Methods to check intersection of various objects | |
bool | areBoxesNear (const std::pair< util::Point, util::Point > &b1, const std::pair< util::Point, util::Point > &b2, const double &tol, size_t dim) |
Checks if given two boxes are within given distance from each other. | |
bool | doLinesIntersect (const std::pair< util::Point, util::Point > &line_1, const std::pair< util::Point, util::Point > &line_2) |
Do lines intersect. | |
double | distanceBetweenLines (const std::pair< util::Point, util::Point > &line_1, const std::pair< util::Point, util::Point > &line_2) |
Compute distance between lines. | |
double | distanceBetweenSegments (const std::pair< util::Point, util::Point > &line_1, const std::pair< util::Point, util::Point > &line_2) |
Compute distance between lines. | |
double | distanceBetweenPlanes (const std::pair< util::Point, util::Point > &plane_1, const std::pair< util::Point, util::Point > &plane_2) |
Compute distance between planes. | |
double | pointDistanceLine (const util::Point &p, const std::pair< util::Point, util::Point > &line) |
Compute distance between point and line. | |
double | pointDistanceSegment (const util::Point &p, const std::pair< util::Point, util::Point > &line) |
Compute distance between point and line. | |
double | pointDistancePlane (const util::Point &p, const std::pair< util::Point, util::Point > &plane) |
Compute distance between point and plane. | |
Rotation | |
std::vector< double > | rotateCW2D (const std::vector< double > &x, const double &theta) |
Rotates a vector in xy-plane in clockwise direction. | |
util::Point | rotateCW2D (const util::Point &x, const double &theta) |
Rotates a vector in xy-plane in clockwise direction. | |
std::vector< double > | rotateACW2D (const std::vector< double > &x, const double &theta) |
Rotates a vector in xy-plane in anti-clockwise direction. | |
util::Point | rotateACW2D (const util::Point &x, const double &theta) |
Rotates a vector in xy-plane in anti-clockwise direction. | |
std::vector< double > | rotate2D (const std::vector< double > &x, const double &theta) |
Rotates a vector in xy-plane assuming ACW convention. | |
util::Point | rotate2D (const util::Point &x, const double &theta) |
Rotates a vector in xy-plane assuming ACW convention. | |
util::Point | derRotate2D (const util::Point &x, const double &theta) |
Computes derivative of rotation wrt to time. | |
util::Point | rotate (const util::Point &p, const double &theta, const util::Point &axis) |
Returns the vector after rotating by desired angle. | |
double | angle (util::Point a, util::Point b) |
Computes angle between two vectors. | |
double | angle (util::Point a, util::Point b, util::Point axis, bool is_axis=true) |
Computes angle between two vectors. | |
Variables | |
VTK Element types | |
static const int | vtk_type_vertex = 1 |
Integer flag for vertex (point) element. | |
static const int | vtk_type_poly_vertex = 2 |
Integer flag for poly vertex element. | |
static const int | vtk_type_line = 3 |
Integer flag for line element. | |
static const int | vtk_type_poly_line = 4 |
Integer flag for poly line element. | |
static const int | vtk_type_triangle = 5 |
Integer flag for triangle element. | |
static const int | vtk_type_triangle_strip = 6 |
Integer flag for triangle strip element. | |
static const int | vtk_type_polygon = 7 |
Integer flag for polygon element. | |
static const int | vtk_type_pixel = 8 |
Integer flag for pixel element. | |
static const int | vtk_type_quad = 9 |
Integer flag for quad element. | |
static const int | vtk_type_tetra = 10 |
Integer flag for tetrahedron element. | |
static const int | vtk_type_voxel = 11 |
Integer flag for voxel element. | |
static const int | vtk_type_hexahedron = 12 |
Integer flag for hexahedron element. | |
static const int | vtk_type_wedge = 13 |
Integer flag for wedge element. | |
static const int | vtk_type_pyramid = 14 |
Integer flag for pyramid element. | |
static int | vtk_map_element_to_num_nodes [16] |
Map from element type to number of nodes (for vtk) | |
static int | vtk_to_msh_element_type_map [16] |
Map from vtk element type to msh element type. | |
Gmsh Element types | |
static const int | msh_type_line = 1 |
Integer flag for line element. | |
static const int | msh_type_triangle = 2 |
Integer flag for triangle element. | |
static const int | msh_type_quadrangle = 3 |
Integer flag for quadrangle element. | |
static const int | msh_type_tetrahedron = 4 |
Integer flag for tetrahedron element. | |
static const int | msh_type_hexahedron = 5 |
Integer flag for hexahedron element. | |
static const int | msh_type_prism = 6 |
Integer flag for prism element. | |
static const int | msh_type_pyramid = 7 |
Integer flag for pyramid element. | |
static const int | msh_type_line_second_order = 8 |
Integer flag for line (second order) element. | |
static const int | msh_type_traingle_second_order = 9 |
Integer flag for traingle (second order) element. | |
static const int | msh_type_quadrangle_second_order = 10 |
Integer flag for quadrangle (second order) element. | |
static const int | msh_type_vertex = 15 |
Integer flag for vertex (point) element. | |
static int | msh_map_element_to_num_nodes [16] |
Map from element type to number of nodes (for msh) | |
Collection of methods useful in simulation.
This namespace provides number of useful functions and struct definition.
double util::angle | ( | util::Point | a, |
util::Point | b | ||
) |
Computes angle between two vectors.
a | Vector 1 |
b | Vector 2 |
Definition at line 81 of file transformation.cpp.
References util::Point::length().
Referenced by angle(), distanceBetweenPlanes(), doLinesIntersect(), and test::testUtilMethods().
double util::angle | ( | util::Point | a, |
util::Point | b, | ||
util::Point | axis, | ||
bool | is_axis = true |
||
) |
Computes angle between two vectors.
a | Vector 1 |
b | Vector 2 |
axis | Axis of rotation |
is_axis | If true then axis is the axis of orientation, otherwise axis specifies the +ve side of the plane in which a and b are |
Definition at line 91 of file transformation.cpp.
References angle(), util::Point::cross(), and util::Point::length().
bool util::areBoxesNear | ( | const std::pair< util::Point, util::Point > & | b1, |
const std::pair< util::Point, util::Point > & | b2, | ||
const double & | tol, | ||
size_t | dim | ||
) |
Checks if given two boxes are within given distance from each other.
b1 | Box 1 |
b2 | Box 2 |
tol | Tolerance for checking |
dim | Dimension of the objects |
Definition at line 109 of file geom.cpp.
References circumscribedRadiusInBox(), getCenter(), getCornerPoints(), inscribedRadiusInBox(), isLess(), and isPointInsideBox().
Referenced by util::geometry::Triangle::isNear(), util::geometry::Square::isNear(), util::geometry::Rectangle::isNear(), util::geometry::Hexagon::isNear(), util::geometry::Drum2D::isNear(), util::geometry::Cube::isNear(), util::geometry::Cuboid::isNear(), and util::geometry::Cylinder::isNear().
bool util::checkMatrix | ( | const std::vector< std::vector< double > > & | m | ) |
Checks matrix.
m | Matrix |
Definition at line 15 of file matrix.cpp.
References util::io::printStr().
double util::circumscribedRadiusInBox | ( | size_t | dim, |
const std::pair< util::Point, util::Point > & | box | ||
) |
Computes the radius of smallest circle/sphere which can have the box inside.
dim | Dimension of the box |
box | Pair of corner points of the box |
Definition at line 208 of file geom.cpp.
References getCenter(), getCornerPoints(), and isGreater().
Referenced by areBoxesNear(), util::geometry::Circle::isNear(), and util::geometry::Sphere::isNear().
std::pair< util::Point, util::Point > util::computeBBox | ( | const std::vector< util::Point > & | nodes | ) |
Computes bounding box for vector nodes.
nodes | List of nodal coordinates |
Definition at line 606 of file geom.cpp.
References isLess().
double util::computeInscribedRadius | ( | const std::pair< util::Point, util::Point > & | box | ) |
double util::computeMeshSize | ( | const std::vector< util::Point > & | nodes | ) |
Computes minimum distance between any two nodes.
nodes | List of nodal coordinates |
Definition at line 551 of file geom.cpp.
References isLess().
Referenced by particle::BaseParticle::BaseParticle().
double util::computeMeshSize | ( | const std::vector< util::Point > & | nodes, |
size_t | start, | ||
size_t | end | ||
) |
Computes minimum distance between any two nodes.
This only considers the nodes between start and end
nodes | List of nodal coordinates |
start | Start index from where to start |
end | End index |
Definition at line 578 of file geom.cpp.
References isLess().
util::Point util::derRotate2D | ( | const util::Point & | x, |
const double & | theta | ||
) |
Computes derivative of rotation wrt to time.
If \( R(x,t) = Q(at)x \) then \( dR/dt = a Q' x \). This function returns \( Q' x \).
x | Point |
theta | Angle |
Definition at line 60 of file transformation.cpp.
References util::Point::d_x, and util::Point::d_y.
Referenced by loading::ParticleULoading::apply().
double util::det | ( | const std::vector< std::vector< double > > & | m | ) |
Computes the determinant of matrix.
m | Matrix |
Definition at line 75 of file matrix.cpp.
Referenced by fe::TetElem::getJacobian(), and inv().
double util::distanceBetweenLines | ( | const std::pair< util::Point, util::Point > & | line_1, |
const std::pair< util::Point, util::Point > & | line_2 | ||
) |
Compute distance between lines.
line_1 | Line 1 |
line_2 | Line 2 |
Definition at line 387 of file geom.cpp.
double util::distanceBetweenPlanes | ( | const std::pair< util::Point, util::Point > & | plane_1, |
const std::pair< util::Point, util::Point > & | plane_2 | ||
) |
Compute distance between planes.
plane_1 | Plane 1 given by pair of normal and one point which it contains |
plane_2 | Plane 2 given by pair of normal and one point which it contains |
Definition at line 490 of file geom.cpp.
References angle().
double util::distanceBetweenSegments | ( | const std::pair< util::Point, util::Point > & | line_1, |
const std::pair< util::Point, util::Point > & | line_2 | ||
) |
Compute distance between lines.
line_1 | Line 1 |
line_2 | Line 2 |
Definition at line 412 of file geom.cpp.
util.does_intersect | ( | p, | |
particles, | |||
padding | |||
) |
Returns true if particle p intersects or is near enough to existing particles Parameters ---------- p : list Coordinates of center and radius of particle [x,y,z,r] particles : list List of center + radius of multiple particles. E.g. particles[0] is a list containing coordinates of center and radius. padding: float Minimum distance between circle boundaries such that if two circles Returns ------- bool True if particle intersects or is near enough to one of the particle in the list
Definition at line 251 of file util.py.
util.does_intersect_rect | ( | p, | |
particles, | |||
padding, | |||
rect, | |||
is_3d = False |
|||
) |
Returns true if particle p is sufficiently close or outside the rectangle (in 2d) or cuboid (in 3d) Parameters ---------- p : list Coordinates of center and radius of particle [x,y,z,r] particles : list List of center + radius of multiple particles. E.g. particles[0] is a list containing coordinates of center and radius. padding: float Minimum distance between circle boundaries such that if two circles rect: list Coordinates of left-bottom and right-top corner points of rectangle (2d) or cuboid (3d). E.g. [x1 y1, z1, x2, y2, z2] is_3d: bool True if we are dealing with cuboid Returns ------- bool True if particle intersects or is near enough to the rectangle
Definition at line 280 of file util.py.
bool util::doLinesIntersect | ( | const std::pair< util::Point, util::Point > & | line_1, |
const std::pair< util::Point, util::Point > & | line_2 | ||
) |
Do lines intersect.
line_1 | Line 1 |
line_2 | Line 2 |
Definition at line 356 of file geom.cpp.
References angle(), and util::Point::lengthSq().
std::vector< double > util::dot | ( | const std::vector< std::vector< double > > & | m, |
const std::vector< double > & | v | ||
) |
Computes the dot product between matrix and vector.
m | Matrix |
v | vector |
Definition at line 38 of file matrix.cpp.
Referenced by fe::TetElem::getDerShapes(), fe::TetElem::getQuadDatas(), util::geometry::Line::isInside(), util::geometry::Line::isNear(), util::geometry::Line::isNearBoundary(), and fe::TetElem::mapPointToRefElem().
double util::doubleGaussian2d | ( | const util::Point & | x, |
const size_t & | dof, | ||
const std::vector< double > & | params | ||
) |
Compute sum of two gaussian function in 2-d.
Double guassian (2-d) function:
\[ f(x,y) = (f_1(x,y), f_2(x,y)) + (g_1(x,y), g_2(x,y)), \]
where \( (f_1,f_2)\) and \((g_1, g_2)\) are two guassian 2-d function as described in guassian2d() with different values of \( (x_c, y_c), a, (d_1, d_2)\).
x | Coordinates of point |
params | List of parameters |
dof | Component of guassian function |
Definition at line 107 of file function.cpp.
References util::Point::dist(), and gaussian().
double util::equivalentMass | ( | const double & | m1, |
const double & | m2 | ||
) |
Compute harmonic mean of m1 and m2.
m1 | Mass 1 |
m2 | Mass 2 |
Definition at line 127 of file function.cpp.
Referenced by model::DEMModel::setupContact().
double util::gaussian | ( | const double & | r, |
const double & | a, | ||
const double & | beta | ||
) |
Compute gaussian function in 1-d.
Guassian (1-d) function: \( f(r) = a \exp(-\frac{r^2}{\beta}). \)
Here \( a\) is the amplitude and \( \beta \) is the exponential factor.
r | Distance from origin |
a | Amplitude |
beta | Factor in exponential function |
Definition at line 87 of file function.cpp.
Referenced by doubleGaussian2d(), and gaussian2d().
double util::gaussian2d | ( | const util::Point & | x, |
const size_t & | dof, | ||
const std::vector< double > & | params | ||
) |
Compute gaussian function in 2-d.
Guassian (2-d) function:
\[ f(x,y) = (f_1(x,y), f_2(x,y)), \]
where
\[ f_1(x,y) = a \exp(-\frac{(x-x_c)^2 + (y-y_c)^2}{\beta}) d_1, \quad f_1(x,y) = a \exp(-\frac{(x-x_c)^2 + (y-y_c)^2}{\beta}) d_2. \]
Here \( (x_c,y_c) \) is the center of the pulse, \( a\) is the amplitude, \( \beta \) is the exponential factor, and \( (d_1,d_2)\) is the direction of the pulse.
x | Coordinates of point |
params | List of parameters |
dof | Component of guassian function |
Definition at line 92 of file function.cpp.
References util::Point::dist(), and gaussian().
util.generate_circle_gmsh_input | ( | filename, | |
center, | |||
radius, | |||
mesh_size, | |||
pp_tag = None |
|||
) |
Creates .geo file for discretization of circle using gmsh Parameters ---------- filename : str Filename of .geo file to be created center : list Coordinates of center of circle radius: float Radius of circle mesh_size: float Mesh size pp_tag: str, optional Postfix .geo file with this tag
Definition at line 320 of file util.py.
References gmsh_file_hdr(), print_cir_gmsh(), print_lineloop_gmsh(), and print_point_gmsh().
util.generate_drum_gmsh_input | ( | filename, | |
center, | |||
radius, | |||
width, | |||
mesh_size, | |||
pp_tag = None |
|||
) |
Creates .geo file for discretization of drum (concave polygon, see get_ref_drum_points) using gmsh Parameters ---------- filename : str Filename of .geo file to be created center : list Coordinates of center radius: float Radius width: float Neck width (see get_ref_drum_points()) mesh_size: float Mesh size pp_tag: str, optional Postfix .geo file with this tag
Definition at line 466 of file util.py.
References get_ref_drum_points(), gmsh_file_hdr(), print_line_gmsh(), print_lineloop_gmsh(), and print_point_gmsh().
util.generate_hexagon_gmsh_input | ( | filename, | |
center, | |||
radius, | |||
mesh_size, | |||
pp_tag = None |
|||
) |
Creates .geo file for discretization of hexagon using gmsh Parameters ---------- filename : str Filename of .geo file to be created center : list Coordinates of center of hexagon radius: float Radius mesh_size: float Mesh size pp_tag: str, optional Postfix .geo file with this tag
Definition at line 420 of file util.py.
References get_ref_hex_points(), gmsh_file_hdr(), print_line_gmsh(), print_lineloop_gmsh(), and print_point_gmsh().
util.generate_rectangle_gmsh_input | ( | filename, | |
rectangle, | |||
mesh_size, | |||
pp_tag = None |
|||
) |
Creates .geo file for discretization of rectangle using gmsh Parameters ---------- filename : str Filename of .geo file to be created rectangle : list Coordinates of left-bottom and right-top corner points of rectangle mesh_size: float Mesh size pp_tag: str, optional Postfix .geo file with this tag
Definition at line 369 of file util.py.
References gmsh_file_hdr(), print_line_gmsh(), print_lineloop_gmsh(), and print_point_gmsh().
util.get_E | ( | K, | |
nu | |||
) |
Returns Young's modulus given bulk modulus and Poisson's ratio Parameters ---------- K : float Bulk modulus nu : float Poisson's ratio Returns ------- float Young's modulus
Definition at line 49 of file util.py.
util.get_eff_k | ( | k1, | |
k2 | |||
) |
Returns effective bulk modulus Parameters ---------- k1: float First bulk modulus k2 : float Second bulk modulus Returns ------- float Effective bulk modulus
Definition at line 86 of file util.py.
util.get_G | ( | E, | |
nu | |||
) |
Returns shear modulus given Young's modulus and Poisson's ratio Parameters ---------- E: float Young's modulus nu : float Poisson's ratio Returns ------- float Shear modulus
Definition at line 67 of file util.py.
util.get_max | ( | l | ) |
Returns maximum value in list Parameters ---------- l: list List of values Returns ------- float Maximum value
Definition at line 104 of file util.py.
|
inline |
Return random number generator.
seed | Seed |
Definition at line 48 of file randomDist.h.
|
inline |
Return random number generator.
seed | Seed |
Definition at line 30 of file randomDist.h.
Referenced by anonymous_namespace{testNSearchLib.cpp}::assignRandomTags(), util::DistributionSample< T >::init(), anonymous_namespace{testNSearchLib.cpp}::lattice(), anonymous_namespace{testNSearchLib.cpp}::neighSearchTreeClosestPointSizet(), and test::testTaskflow().
util.get_ref_drum_points | ( | center, | |
radius, | |||
width, | |||
add_center = False |
|||
) |
Returns size points on reference concave polygon (we refer to it as drum) Reference concave polygon: v3 v2 + -------------------------------- + \ / \ / + o + /v4 x v1 \ / \ + -------------------------------- + v5 v6 Axis is a vector from x to v1, radius is distance between x and v2, and width of neck is the distance between v2 and v4. Parameters ---------- center: list Coordinates of center of polygon radius : float Radius of polygon (distance between center x and vertex v2) width : float Width of neck, i.e. distance between vertex v2 and v4 add_center : bool True if we include the center to the returned list (first point in the returned list will be the center if the flag is true) Returns ------- list Coordinates of points
Definition at line 190 of file util.py.
References rotate().
Referenced by generate_drum_gmsh_input().
util.get_ref_hex_points | ( | center, | |
radius, | |||
add_center = False |
|||
) |
Returns size points on reference hexagon Reference hexagon: v3 v2 + + + o + v4 x v1 + + v5 v6 Axis is a vector from x to v1 and radius is distance between x and v1. Parameters ---------- center: list Coordinates of center of hexagon radius : float Radius of hexagon add_center : bool True if we include the center to the returned list (first point in the returned list will be the center if the flag is true) Returns ------- list Coordinates of points
Definition at line 146 of file util.py.
References rotate().
Referenced by generate_hexagon_gmsh_input().
util::Point util::getCenter | ( | size_t | dim, |
const std::pair< util::Point, util::Point > & | box | ||
) |
Returns center point.
dim | Dimension of the box |
box | Pair of points representing cuboid (rectangle in 2d) |
Definition at line 91 of file geom.cpp.
References util::Point::d_x.
Referenced by areBoxesNear(), circumscribedRadiusInBox(), util::geometry::Circle::isNear(), util::geometry::Sphere::isNear(), and test::testUtilMethods().
std::vector< util::Point > util::getCornerPoints | ( | size_t | dim, |
const std::pair< util::Point, util::Point > & | box | ||
) |
Returns all corner points in the box.
dim | Dimension of the box |
box | Pair of points representing cuboid (rectangle in 2d) |
Definition at line 14 of file geom.cpp.
References util::Point::d_x.
Referenced by areBoxesNear(), circumscribedRadiusInBox(), util::geometry::Triangle::doesIntersect(), util::geometry::Square::doesIntersect(), util::geometry::Rectangle::doesIntersect(), util::geometry::Hexagon::doesIntersect(), util::geometry::Drum2D::doesIntersect(), util::geometry::Cube::doesIntersect(), util::geometry::Cuboid::doesIntersect(), util::geometry::Circle::doesIntersect(), util::geometry::Sphere::doesIntersect(), util::geometry::Cylinder::doesIntersect(), util::geometry::AnnulusGeomObject::doesIntersect(), util::geometry::ComplexGeomObject::doesIntersect(), getEdges(), util::geometry::Triangle::isInside(), util::geometry::Square::isInside(), util::geometry::Rectangle::isInside(), util::geometry::Hexagon::isInside(), util::geometry::Drum2D::isInside(), util::geometry::Cube::isInside(), util::geometry::Cuboid::isInside(), util::geometry::Circle::isInside(), util::geometry::Sphere::isInside(), util::geometry::Cylinder::isInside(), util::geometry::AnnulusGeomObject::isInside(), util::geometry::ComplexGeomObject::isInside(), util::geometry::Circle::isNear(), util::geometry::Sphere::isNear(), util::geometry::Triangle::isOutside(), util::geometry::Square::isOutside(), util::geometry::Rectangle::isOutside(), util::geometry::Hexagon::isOutside(), util::geometry::Drum2D::isOutside(), util::geometry::Cube::isOutside(), util::geometry::Cuboid::isOutside(), util::geometry::Circle::isOutside(), util::geometry::Sphere::isOutside(), util::geometry::Cylinder::isOutside(), util::geometry::AnnulusGeomObject::isOutside(), util::geometry::ComplexGeomObject::isOutside(), and test::testUtilMethods().
std::vector< std::pair< util::Point, util::Point > > util::getEdges | ( | size_t | dim, |
const std::pair< util::Point, util::Point > & | box | ||
) |
Returns all corner points in the box.
dim | Dimension of the box |
box | Pair of points representing cuboid (rectangle in 2d) |
Definition at line 43 of file geom.cpp.
References getCornerPoints().
Referenced by test::testUtilMethods().
util::Point util::getPointOnLine | ( | const util::Point & | p1, |
const util::Point & | p2, | ||
const double & | s | ||
) |
util.gmsh_file_hdr | ( | f | ) |
Definition at line 45 of file util.py.
Referenced by generate_circle_gmsh_input(), generate_drum_gmsh_input(), generate_hexagon_gmsh_input(), and generate_rectangle_gmsh_input().
double util::hatFunction | ( | const double & | x, |
const double & | x_min, | ||
const double & | x_max | ||
) |
Computes hat function at given point.
Hat function: f ^ | | 1 o | /|\ | / | \ | / | \ | / | \ | / | \ | / | \ o____________o____________o______\ x / x_min x_max
x | Point in real line |
x_min | Left side point in real line |
x_max | Right side point in real line |
Definition at line 25 of file function.cpp.
References isGreater(), and isLess().
double util::hatFunctionQuick | ( | const double & | x, |
const double & | x_min, | ||
const double & | x_max | ||
) |
Computes hat function at given point.
This version does not test if point x is in valid interval.
Hat function: f ^ | | 1 o | /|\ | / | \ | / | \ | / | \ | / | \ | / | \ o____________o____________o______\ x / x_min x_max
x | Point in real line |
x_min | Left side point in real line |
x_max | Right side point in real line |
Definition at line 46 of file function.cpp.
References isLess().
double util::inscribedRadiusInBox | ( | size_t | dim, |
const std::pair< util::Point, util::Point > & | box | ||
) |
Computes the radius of biggest circle/sphere completely within the object.
dim | Dimension of the box |
box | Pair of corner points of the box |
Definition at line 183 of file geom.cpp.
References isGreater().
Referenced by areBoxesNear(), util::geometry::Circle::isNear(), and util::geometry::Sphere::isNear().
std::vector< std::vector< double > > util::inv | ( | const std::vector< std::vector< double > > & | m | ) |
Computes the determinant of matrix.
m | Matrix |
Definition at line 93 of file matrix.cpp.
References det().
Referenced by fe::TetElem::getDerShapes(), fe::TetElem::getQuadDatas(), and fe::TetElem::mapPointToRefElem().
bool util::isGreater | ( | const double & | a, |
const double & | b | ||
) |
Returns true if a > b.
a | Value a |
b | Value b |
Definition at line 15 of file function.cpp.
References COMPARE_EPS.
Referenced by loading::ParticleFLoading::apply(), util::geometry::AnnulusGeomObject::center(), util::geometry::ComplexGeomObject::center(), anonymous_namespace{tetElem.cpp}::checkPoint(), model::DEMModel::checkStop(), circumscribedRadiusInBox(), anonymous_namespace{materialUtil.cpp}::computeHydrostaticStrainI(), material::RnpMaterial::computeParameters(), material::PmbMaterial::computeParameters(), material::PdElastic::computeParameters(), material::PdState::computeParameters(), anonymous_namespace{materialUtil.cpp}::computeStateMxI(), anonymous_namespace{materialUtil.cpp}::computeStateThetaxI(), material::RnpMaterial::getBondEF(), material::PmbMaterial::getBondEF(), hatFunction(), inscribedRadiusInBox(), util::geometry::Line::isInside(), util::geometry::Cylinder::isInside(), util::geometry::BoxPartition::isNear(), util::geometry::Line::isNear(), util::geometry::Cylinder::isNear(), util::geometry::Line::isNearBoundary(), util::geometry::Cylinder::isNearBoundary(), isPointInsideAngledRectangle(), isPointInsideBox(), isPointInsideCuboid(), isPointInsideRectangle(), isPointInsideRectangle(), fe::LineElem::mapPointToRefElem(), fe::TetElem::mapPointToRefElem(), fe::TriElem::mapPointToRefElem(), model::DEMModel::ppTwoParticleTest(), model::DEMModel::setupContact(), twoparticle_demo::Model::twoParticleTestMaxShearStress(), twoparticle_demo::Model::twoParticleTestPenetrationDist(), anonymous_namespace{materialUtil.cpp}::updateBondFractureDataI(), and model::DEMModel::updateContactNeighborSearchParameters().
bool util::isLess | ( | const double & | a, |
const double & | b | ||
) |
Returns true if a < b.
a | Value a |
b | Value b |
Definition at line 20 of file function.cpp.
References COMPARE_EPS.
Referenced by areBoxesNear(), anonymous_namespace{tetElem.cpp}::checkPoint(), fe::Mesh::computeBBox(), computeBBox(), fe::Mesh::computeMeshSize(), computeMeshSize(), computeMeshSize(), material::RnpMaterial::computeParameters(), material::PmbMaterial::computeParameters(), material::PdElastic::computeParameters(), material::PdState::computeParameters(), anonymous_namespace{materialUtil.cpp}::computeStateMxI(), fe::getMaxShearStressAndLoc(), fe::getStrainStress(), hatFunction(), hatFunctionQuick(), util::geometry::Rectangle::inscribedRadius(), util::geometry::Cuboid::inscribedRadius(), util::geometry::Line::isInside(), util::geometry::Circle::isInside(), util::geometry::Sphere::isInside(), util::geometry::Cylinder::isInside(), util::geometry::Circle::isNear(), util::geometry::Sphere::isNear(), util::geometry::BoxPartition::isNear(), util::geometry::Line::isNear(), util::geometry::Circle::isNear(), util::geometry::Sphere::isNear(), util::geometry::Cylinder::isNear(), util::geometry::Line::isNearBoundary(), util::geometry::Square::isNearBoundary(), util::geometry::Rectangle::isNearBoundary(), util::geometry::Cube::isNearBoundary(), util::geometry::Cuboid::isNearBoundary(), util::geometry::Circle::isNearBoundary(), util::geometry::Sphere::isNearBoundary(), util::geometry::Cylinder::isNearBoundary(), isPointInsideAngledRectangle(), isPointInsideBox(), isPointInsideCuboid(), isPointInsideRectangle(), isPointInsideRectangle(), linearStepFunc(), fe::LineElem::mapPointToRefElem(), fe::TetElem::mapPointToRefElem(), fe::TriElem::mapPointToRefElem(), model::DEMModel::ppTwoParticleTest(), particle::RefParticle::RefParticle(), inp::Input::setContactDeck(), twoparticle_demo::Model::twoParticleTestPenetrationDist(), and model::DEMModel::updateContactNeighborSearchParameters().
bool util::isPointInsideAngledRectangle | ( | util::Point | x, |
double | x_min, | ||
double | x_max, | ||
double | y_min, | ||
double | y_max, | ||
double | theta | ||
) |
Checks if point is inside an angled rectangle.
x | Point |
x_min | X coordinate of left-bottom corner point |
x_max | X coordinate of right-top corner point |
y_min | Y coordinate of left-bottom corner point |
y_max | Y coordinate of right-top corner point |
theta | Angle of orientation of rectangle from x-axis |
Definition at line 249 of file geom.cpp.
References isGreater(), isLess(), and rotateCW2D().
bool util::isPointInsideBox | ( | util::Point | x, |
size_t | dim, | ||
const std::pair< util::Point, util::Point > & | box | ||
) |
Returns true if point is inside box.
x | Point |
dim | Dimension of the box |
box | Pair of points representing cuboid (rectangle in 2d) |
Definition at line 159 of file geom.cpp.
References util::Point::d_x, util::Point::d_y, util::Point::d_z, isGreater(), and isLess().
Referenced by areBoxesNear(), util::geometry::Triangle::isNear(), util::geometry::Square::isNear(), util::geometry::Rectangle::isNear(), util::geometry::Hexagon::isNear(), util::geometry::Drum2D::isNear(), util::geometry::Cube::isNear(), and util::geometry::Cuboid::isNear().
bool util::isPointInsideCuboid | ( | util::Point | x, |
util::Point | x_lbb, | ||
util::Point | x_rtf | ||
) |
Checks if point is inside a cuboid.
x | Point |
x_lbb | Coordinate of left-bottom-back corner point |
x_rtf | Coordinate of right-top-front corner point |
Definition at line 286 of file geom.cpp.
References util::Point::d_x, util::Point::d_y, util::Point::d_z, isGreater(), and isLess().
Referenced by util::geometry::Cube::isInside(), and util::geometry::Cuboid::isInside().
bool util::isPointInsideCylinder | ( | const util::Point & | p, |
const double & | length, | ||
const double & | radius, | ||
const util::Point & | axis | ||
) |
Returns true if point is inside the cylinder.
p | Point |
length | Length of cylinder |
radius | Radius of cylinder |
axis | Axis of cylinder |
Definition at line 296 of file geom.cpp.
References util::Point::lengthSq().
bool util::isPointInsideCylinder | ( | const util::Point & | p, |
const double & | radius, | ||
const util::Point & | x1, | ||
const util::Point & | x2 | ||
) |
Returns true if point is inside the cylinder.
p | Point |
radius | Radius of cylinder |
x1 | Point at the center of cross-section at s=0 |
x2 | Point at the center of cross-section at s=L |
Definition at line 310 of file geom.cpp.
References util::Point::lengthSq().
bool util::isPointInsideEllipse | ( | const util::Point & | p, |
const util::Point & | center, | ||
const std::vector< double > & | radius_vec, | ||
unsigned int | dim | ||
) |
Returns true if point is inside the ellipsoid.
p | Point |
center | Center of ellipse |
radius_vec | Vector of radius describing ellipse |
dim | Dimension |
Definition at line 328 of file geom.cpp.
bool util::isPointInsideEllipse | ( | const util::Point & | p, |
const util::Point & | center, | ||
const std::vector< double > & | radius_vec, | ||
unsigned int | dim, | ||
double & | d | ||
) |
Returns true if point is inside the ellipsoid.
Also computes d = x^2 / r1^2 + y^2 / r2^2 + z^2 / r3^2
p | Point |
center | Center of ellipse |
radius_vec | Vector of radius describing ellipse |
dim | Dimension |
d |
Definition at line 339 of file geom.cpp.
bool util::isPointInsideRectangle | ( | util::Point | x, |
double | x_min, | ||
double | x_max, | ||
double | y_min, | ||
double | y_max | ||
) |
Checks if point is inside a rectangle.
x | Point |
x_min | X coordinate of left-bottom corner point |
x_max | X coordinate of right-top corner point |
y_min | Y coordinate of left-bottom corner point |
y_max | Y coordinate of right-top corner point |
Definition at line 231 of file geom.cpp.
References util::Point::d_x, util::Point::d_y, isGreater(), and isLess().
Referenced by util::geometry::Square::isInside(), and util::geometry::Rectangle::isInside().
bool util::isPointInsideRectangle | ( | util::Point | x, |
util::Point | x_lb, | ||
util::Point | x_rt | ||
) |
Checks if point is inside a rectangle.
x | Point |
x_lb | Coordinate of left-bottom corner point |
x_rt | Coordinate of right-top corner point |
Definition at line 241 of file geom.cpp.
References util::Point::d_x, util::Point::d_y, isGreater(), and isLess().
|
inline |
Computes l2 distance between two vectors.
x1 | Vector 1 |
x2 | Vector 2 |
Definition at line 357 of file geom.h.
Referenced by test::testUtilMethods().
double util::linearStepFunc | ( | const double & | x, |
const double & | x1, | ||
const double & | x2 | ||
) |
Compute linear step function.
Step function:
f ^ | __________ | / | / | _______/ | / | / |/_________________________ t x1 x1+x2
x | Point in real line |
x1 | Point such that function is linear with slope 1 in [0, x1) |
x2 | Point such that function is constant in [x1, x1 + x2) |
Definition at line 62 of file function.cpp.
References isLess().
Referenced by loading::ParticleFLoading::apply().
double util::pointDistanceLine | ( | const util::Point & | p, |
const std::pair< util::Point, util::Point > & | line | ||
) |
Compute distance between point and line.
p | Point |
line | Line |
Definition at line 502 of file geom.cpp.
References util::Point::lengthSq().
double util::pointDistancePlane | ( | const util::Point & | p, |
const std::pair< util::Point, util::Point > & | plane | ||
) |
Compute distance between point and plane.
p | Point |
plane | Plane given by pair of normal and one point which it contains |
Definition at line 540 of file geom.cpp.
References util::Point::length().
double util::pointDistanceSegment | ( | const util::Point & | p, |
const std::pair< util::Point, util::Point > & | line | ||
) |
Compute distance between point and line.
p | Point |
line | Line |
Definition at line 517 of file geom.cpp.
References util::Point::length().
util.print_bool | ( | arg, | |
prefix = "" |
|||
) |
util.print_cir_gmsh | ( | arg, | |
n | |||
) |
Definition at line 36 of file util.py.
References print_list().
Referenced by generate_circle_gmsh_input().
util.print_const | ( | arg, | |
fmt = '%4.6e' , |
|||
prefix = "" |
|||
) |
Definition at line 5 of file util.py.
Referenced by print_dbl(), and print_int().
util.print_dbl | ( | arg, | |
prefix = "" |
|||
) |
Definition at line 19 of file util.py.
References print_const().
util.print_dbl_list | ( | arg, | |
prefix = "" |
|||
) |
Definition at line 25 of file util.py.
References print_list().
util.print_int | ( | arg, | |
prefix = "" |
|||
) |
Definition at line 22 of file util.py.
References print_const().
util.print_int_list | ( | arg, | |
prefix = "" |
|||
) |
Definition at line 29 of file util.py.
References print_list().
util.print_line_gmsh | ( | arg, | |
n | |||
) |
Definition at line 39 of file util.py.
References print_list().
Referenced by generate_drum_gmsh_input(), generate_hexagon_gmsh_input(), and generate_rectangle_gmsh_input().
util.print_lineloop_gmsh | ( | arg, | |
n | |||
) |
Definition at line 42 of file util.py.
References print_list().
Referenced by generate_circle_gmsh_input(), generate_drum_gmsh_input(), generate_hexagon_gmsh_input(), and generate_rectangle_gmsh_input().
util.print_list | ( | arg, | |
fmt = '%4.6e' , |
|||
delim = ', ' |
|||
) |
Definition at line 8 of file util.py.
Referenced by particle_wall.particle_locations(), print_cir_gmsh(), print_dbl_list(), print_int_list(), print_line_gmsh(), print_lineloop_gmsh(), and print_point_gmsh().
util.print_point_gmsh | ( | arg, | |
n | |||
) |
Definition at line 33 of file util.py.
References print_list().
Referenced by generate_circle_gmsh_input(), generate_drum_gmsh_input(), generate_hexagon_gmsh_input(), and generate_rectangle_gmsh_input().
util::Point util::rotate | ( | const util::Point & | p, |
const double & | theta, | ||
const util::Point & | axis | ||
) |
Returns the vector after rotating by desired angle.
p | Vector |
theta | Angle of rotation |
axis | Axis of rotation |
Definition at line 67 of file transformation.cpp.
References util::Point::cross().
Referenced by particle::ParticleTransform::apply(), util::geometry::Drum2D::Drum2D(), get_ref_drum_points(), get_ref_hex_points(), util::geometry::Hexagon::Hexagon(), util::geometry::Drum2D::isInside(), test::testUtilMethods(), and util::geometry::Triangle::Triangle().
util.rotate | ( | p, | |
theta, | |||
axis | |||
) |
Returns rotation of vector about specified axis by specified angle Parameters ---------- p: list Coordinates of vector theta : float Angle of rotation axis : list Axis of rotation Returns ------- list Coordinates of rotated vector
Definition at line 121 of file util.py.
std::vector< double > util::rotate2D | ( | const std::vector< double > & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane assuming ACW convention.
x | Point |
theta | Angle |
Definition at line 45 of file transformation.cpp.
Referenced by loading::ParticleULoading::apply().
util::Point util::rotate2D | ( | const util::Point & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane assuming ACW convention.
x | Point |
theta | Angle |
Definition at line 53 of file transformation.cpp.
References util::Point::d_x, and util::Point::d_y.
std::vector< double > util::rotateACW2D | ( | const std::vector< double > & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane in anti-clockwise direction.
x | Point |
theta | Angle |
Definition at line 31 of file transformation.cpp.
References rotateCW2D().
Referenced by test::testUtilMethods().
util::Point util::rotateACW2D | ( | const util::Point & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane in anti-clockwise direction.
x | Point |
theta | Angle |
Definition at line 37 of file transformation.cpp.
References rotateCW2D().
std::vector< double > util::rotateCW2D | ( | const std::vector< double > & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane in clockwise direction.
x | Point |
theta | Angle |
Definition at line 15 of file transformation.cpp.
Referenced by isPointInsideAngledRectangle(), rotateACW2D(), rotateACW2D(), and test::testUtilMethods().
util::Point util::rotateCW2D | ( | const util::Point & | x, |
const double & | theta | ||
) |
Rotates a vector in xy-plane in clockwise direction.
x | Point |
theta | Angle |
Definition at line 23 of file transformation.cpp.
References util::Point::d_x, and util::Point::d_y.
std::pair< util::Point, util::Point > util::toPointBox | ( | const std::vector< double > & | p1, |
const std::vector< double > & | p2 | ||
) |
|
inline |
Transform sample from N(0,1) to N(mean, std^2)
mean | Mean of normal distribution |
std | Std of normal distribution |
sample | Sample from N(0,1) |
Definition at line 68 of file randomDist.h.
|
inline |
Transform sample from U(0,1) to U(a,b)
min | Min of uniform distribution |
max | Max of uniform distribution |
sample | Sample from U(0,1) |
Definition at line 80 of file randomDist.h.
Referenced by model::DEMModel::createParticlesFromFile().
std::vector< std::vector< double > > util::transpose | ( | const std::vector< std::vector< double > > & | m | ) |
Computes the tranpose of matrix.
m | Matrix |
Definition at line 56 of file matrix.cpp.
Referenced by fe::TetElem::mapPointToRefElem().
double util::triangleArea | ( | const util::Point & | x1, |
const util::Point & | x2, | ||
const util::Point & | x3 | ||
) |
Compute area of triangle.
x1 | Vertex 1 |
x2 | Vertex 2 |
x3 | Vertex 3 |
Definition at line 642 of file geom.cpp.
References util::Point::d_x, and util::Point::d_y.
Referenced by util::geometry::Triangle::isInside(), util::geometry::Triangle::isNearBoundary(), and test::testUtilMethods().