PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
fe Namespace Reference

Data Structures

class  B
 
class  BaseElem
 A base class which provides methods to map points to/from reference element and to compute quadrature data. More...
 
class  HexElem
 Trilinear hexahedron (VTK type 12) on reference cube [-1,1]^3. More...
 
class  LineElem
 A class for mapping and quadrature related operations for linear 2-node line element. More...
 
struct  QuadData
 A struct to store the quadrature data. List of data are. More...
 
class  QuadElem
 A class for mapping and quadrature related operations for bi-linear quadrangle element. More...
 
class  TetElem
 A class for mapping and quadrature related operations for linear tetrahedron element. More...
 
class  TriElem
 A class for mapping and quadrature related operations for linear triangle element. More...
 

Functions

std::unique_ptr< BaseElem > elem (size_t type, size_t order)
 
void mapToPhysical (std::vector< QuadData > &qds, const std::vector< util::Point > &nodes, bool derivatives)
 

Function Documentation

◆ elem()

std::unique_ptr< BaseElem > fe::elem ( size_t  type,
size_t  order 
)
inline

Definition at line 31 of file elemIncludes.h.

31 {
32 if (type == util::vtk_type_line)
33 return std::make_unique<LineElem>(order);
34 if (type == util::vtk_type_triangle)
35 return std::make_unique<TriElem>(order);
36 if (type == util::vtk_type_quad)
37 return std::make_unique<QuadElem>(order);
38 if (type == util::vtk_type_tetra)
39 return std::make_unique<TetElem>(order);
40 if (type == util::vtk_type_hexahedron)
41 return std::make_unique<HexElem>(order);
42 throw std::runtime_error(
44 << std::format("Error: element type = {} is not supported.\n", type));
45}
Collects a message with stream syntax for use in an exception.
Definition io.h:52
static const int vtk_type_triangle
Integer flag for triangle element.
static const int vtk_type_quad
Integer flag for quad element.
static const int vtk_type_tetra
Integer flag for tetrahedron element.
static const int vtk_type_hexahedron
Integer flag for hexahedron element.
static const int vtk_type_line
Integer flag for line element.

References util::vtk_type_hexahedron, util::vtk_type_line, util::vtk_type_quad, util::vtk_type_tetra, and util::vtk_type_triangle.

Referenced by mesh::Mesh::computeVol(), mesh::getCurrentQuadPoints(), mesh::getMaxShearStressAndLoc(), mesh::getStrainStress(), and anonymous_namespace{quadratureData.cpp}::numQuadPoints().

Here is the caller graph for this function:

◆ mapToPhysical()

void fe::mapToPhysical ( std::vector< QuadData > &  qds,
const std::vector< util::Point > &  nodes,
bool  derivatives 
)

Isoparametric map for quadrature data already filled on the reference element (N, dN/dξ, w_ref, ξ). Writes J, det(J), physical x, w = w_ref det(J), and (if derivatives) dN/dx = J^{-1} dN/dξ.

Definition at line 14 of file map.cpp.

15 {
16 for (auto &qd : qds) {
17 const auto n = qd.d_shapes.size();
18 if (qd.d_derShapes.size() != n || n == 0 || qd.d_derShapes[0].empty())
19 continue;
20 const int dim = static_cast<int>(qd.d_derShapes[0].size());
21
22 std::vector<std::vector<double>> J(dim, std::vector<double>(dim, 0.));
23 for (int a = 0; a < static_cast<int>(n); a++)
24 for (int alpha = 0; alpha < dim; alpha++)
25 for (int j = 0; j < dim; j++)
26 J[alpha][j] += qd.d_derShapes[a][alpha] * nodes[a][j];
27
28 qd.d_J = J;
29 qd.d_detJ = util::det(J);
30 qd.d_w *= qd.d_detJ;
31
32 qd.d_p = util::Point();
33 for (size_t a = 0; a < n; a++)
34 for (int j = 0; j < dim; j++)
35 qd.d_p[j] += qd.d_shapes[a] * nodes[a][j];
36
37 if (!derivatives)
38 continue;
39
40 const auto Jinv = util::inv(J);
41 for (size_t a = 0; a < n; a++)
42 qd.d_derShapes[a] = util::dot(Jinv, qd.d_derShapes[a]);
43 }
44}
double det(const std::vector< std::vector< double > > &m)
Computes the determinant of matrix.
Definition matrix.cpp:75
std::vector< std::vector< double > > inv(const std::vector< std::vector< double > > &m)
Computes the determinant of matrix.
Definition matrix.cpp:93
std::vector< double > dot(const std::vector< std::vector< double > > &m, const std::vector< double > &v)
Computes the dot product between matrix and vector.
Definition matrix.cpp:38
A structure to represent 3d vectors.
Definition point.h:30

References util::det(), util::dot(), and util::inv().

Referenced by fe::BaseElem::getQuadDatas(), and fe::BaseElem::getQuadPoints().

Here is the call graph for this function:
Here is the caller graph for this function: