GooseFEM 1.4.1.dev2+g78f16df
Loading...
Searching...
No Matches
GooseFEM::Mesh Namespace Reference

Generic mesh operations, and simple mesh definitions. More...

Namespaces

namespace  Hex8
 Simple meshes of 8-noded hexahedral elements in 3d (ElementType::Hex8).
 
namespace  Quad4
 Simple meshes of 4-noded quadrilateral elements in 2d (ElementType::Quad4).
 
namespace  Tri3
 Simple meshes of and mesh operations for triangular elements of type ElementType::Tri3.
 

Classes

class  ManualStitch
 Stitch two mesh objects, specifying overlapping nodes by hand. More...
 
class  RegularBase
 CRTP base class for regular meshes. More...
 
class  RegularBase2d
 CRTP base class for regular meshes in 2d. More...
 
class  RegularBase3d
 CRTP base class for regular meshes in 3d. More...
 
class  Renumber
 Renumber indices to lowest possible index. More...
 
class  Reorder
 Reorder to lowest possible index, in specific order. More...
 
class  Stitch
 Stitch mesh objects, automatically searching for overlapping nodes. More...
 
class  Vstack
 Vertically stack meshes. More...
 

Enumerations

enum class  ElementType { Unknown , Quad4 , Hex8 , Tri3 }
 Enumerator for element-types. More...
 

Functions

template<class D >
std::vector< std::vector< size_t > > nodaltyings (const D &dofs)
 List nodal tyings based on DOF-numbers per node.
 
template<class S , class T >
ElementType defaultElementType (const S &coor, const T &conn)
 Extract the element type based on the connectivity.
 
array_type::tensor< size_t, 2 > dofs (size_t nnode, size_t ndim)
 List with DOF-numbers in sequential order.
 
template<class T >
T renumber (const T &dofs)
 Renumber to lowest possible index (see GooseFEM::Mesh::Renumber).
 
template<class S , class T >
array_type::tensor< size_t, 2 > overlapping (const S &coor_a, const T &coor_b, double rtol=1e-5, double atol=1e-8)
 Find overlapping nodes.
 
template<class E >
array_type::tensor< size_t, 1 > coordination (const E &conn)
 Number of elements connected to each node.
 
template<class E >
std::vector< std::vector< size_t > > elem2node (const E &conn, bool sorted=true)
 Elements connected to each node.
 
template<class E , class D >
std::vector< std::vector< size_t > > elem2node (const E &conn, const D &dofs, bool sorted=true)
 Elements connected to each node.
 
template<class D >
std::vector< std::vector< size_t > > node2dof (const D &dofs, bool sorted=true)
 Nodes connected to each DOF.
 
template<class C , class E >
array_type::tensor< double, 2 > edgesize (const C &coor, const E &conn, ElementType type)
 Return size of each element edge.
 
template<class C , class E >
array_type::tensor< double, 2 > edgesize (const C &coor, const E &conn)
 Return size of each element edge.
 
template<class C , class E >
array_type::tensor< double, 2 > centers (const C &coor, const E &conn, ElementType type)
 Coordinates of the center of each element.
 
template<class C , class E >
array_type::tensor< double, 2 > centers (const C &coor, const E &conn)
 Coordinates of the center of each element.
 
template<class T , class C , class E >
array_type::tensor< size_t, 1 > elemmap2nodemap (const T &elem_map, const C &coor, const E &conn, ElementType type)
 Convert an element-map to a node-map.
 
template<class T , class C , class E >
array_type::tensor< size_t, 1 > elemmap2nodemap (const T &elem_map, const C &coor, const E &conn)
 Convert an element-map to a node-map.
 
template<class C , class E >
array_type::tensor< double, 2 > nodal_mass (const C &coor, const E &conn, ElementType type)
 Compute the mass of each node in the mesh.
 
template<class C , class E >
array_type::tensor< double, 2 > nodal_mass (const C &coor, const E &conn)
 Compute the mass of each node in the mesh.
 
template<class C , class E >
array_type::tensor< double, 1 > center_of_gravity (const C &coor, const E &conn, ElementType type)
 Compute the center of gravity of a mesh.
 
template<class C , class E >
array_type::tensor< double, 1 > center_of_gravity (const C &coor, const E &conn)
 Compute the center of gravity of a mesh.
 

Detailed Description

Generic mesh operations, and simple mesh definitions.

Enumeration Type Documentation

◆ ElementType

Enumerator for element-types.

Enumerator
Unknown 

Unknown element-type.

Quad4 

Quadrilateral: 4-noded element in 2-d.

Hex8 

Hexahedron: 8-noded element in 3-d.

Tri3 

Triangle: 3-noded element in 2-d.

Definition at line 31 of file Mesh.h.

Function Documentation

◆ center_of_gravity() [1/2]

template<class C , class E >
array_type::tensor< double, 1 > GooseFEM::Mesh::center_of_gravity ( const C & coor,
const E & conn )
inline

Compute the center of gravity of a mesh.

Template Parameters
Ce.g. array_type::tensor<double, 2>
Ee.g. array_type::tensor<size_t, 2>
Parameters
coorNodal coordinates [nnode, ndim].
connConnectivity [nelem, nne].
Returns
Center of gravity [ndim].

Definition at line 2826 of file Mesh.h.

◆ center_of_gravity() [2/2]

template<class C , class E >
array_type::tensor< double, 1 > GooseFEM::Mesh::center_of_gravity ( const C & coor,
const E & conn,
ElementType type )
inline

Compute the center of gravity of a mesh.

Template Parameters
Ce.g. array_type::tensor<double, 2>
Ee.g. array_type::tensor<size_t, 2>
Parameters
coorNodal coordinates [nnode, ndim].
connConnectivity [nelem, nne].
typeElementType.
Returns
Center of gravity [ndim].

Definition at line 2809 of file Mesh.h.

◆ centers() [1/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::centers ( const C & coor,
const E & conn )
inline

Coordinates of the center of each element.

The element-type is automatically determined, see defaultElementType().

Parameters
coorNodal coordinates.
connConnectivity.
Returns
Center of each element.

Definition at line 2656 of file Mesh.h.

◆ centers() [2/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::centers ( const C & coor,
const E & conn,
ElementType type )
inline

Coordinates of the center of each element.

Parameters
coorNodal coordinates.
connConnectivity.
typeElementType.
Returns
Center of each element.

Definition at line 2626 of file Mesh.h.

◆ coordination()

template<class E >
array_type::tensor< size_t, 1 > GooseFEM::Mesh::coordination ( const E & conn)
inline

Number of elements connected to each node.

Parameters
connConnectivity [nelem, nne].
Returns
Coordination per node.

Definition at line 2463 of file Mesh.h.

◆ defaultElementType()

template<class S , class T >
ElementType GooseFEM::Mesh::defaultElementType ( const S & coor,
const T & conn )
inline

Extract the element type based on the connectivity.

Parameters
coorNodal coordinates [nnode, ndim].
connConnectivity [nelem, nne].
Returns
ElementType().

Definition at line 46 of file Mesh.h.

◆ dofs()

array_type::tensor< size_t, 2 > GooseFEM::Mesh::dofs ( size_t nnode,
size_t ndim )
inline

List with DOF-numbers in sequential order.

The output is a sequential list of DOF-numbers for each vector-component of each node. For example for 3 nodes in 2 dimensions the output is

\( \begin{bmatrix} 0 & 1 \\ 2 & 3 \\ 4 & 5 \end{bmatrix} \)

Parameters
nnodeNumber of nodes.
ndimNumber of dimensions.
Returns
DOF-numbers.

Definition at line 93 of file Mesh.h.

◆ edgesize() [1/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::edgesize ( const C & coor,
const E & conn )
inline

Return size of each element edge.

The element-type is automatically determined, see defaultElementType().

Parameters
coorNodal coordinates.
connConnectivity.
Returns
Edge-sizes per element.

Definition at line 2612 of file Mesh.h.

◆ edgesize() [2/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::edgesize ( const C & coor,
const E & conn,
ElementType type )
inline

Return size of each element edge.

Parameters
coorNodal coordinates.
connConnectivity.
typeElementType.
Returns
Edge-sizes per element.

Definition at line 2571 of file Mesh.h.

◆ elem2node() [1/2]

template<class E >
std::vector< std::vector< size_t > > GooseFEM::Mesh::elem2node ( const E & conn,
bool sorted = true )
inline

Elements connected to each node.

Parameters
connConnectivity [nelem, nne].
sortedIf true the list of elements for each node is sorted.
Returns
Elements per node [nnode, ...].

Definition at line 2486 of file Mesh.h.

◆ elem2node() [2/2]

template<class E , class D >
std::vector< std::vector< size_t > > GooseFEM::Mesh::elem2node ( const E & conn,
const D & dofs,
bool sorted = true )
inline

Elements connected to each node.

Parameters
connConnectivity [nelem, nne].
sortedIf true the list of elements for each node is sorted.
Returns
Elements per node [nnode, ...].
Parameters
dofsDOFs per node, allowing accounting for periodicity [nnode, ndim].

Definition at line 2517 of file Mesh.h.

◆ elemmap2nodemap() [1/2]

template<class T , class C , class E >
array_type::tensor< size_t, 1 > GooseFEM::Mesh::elemmap2nodemap ( const T & elem_map,
const C & coor,
const E & conn )
inline

Convert an element-map to a node-map.

The element-type is automatically determined, see defaultElementType().

Parameters
elem_mapElement-map such that new_elvar = elvar[elem_map].
coorNodal coordinates.
connConnectivity.
Returns
Node-map such that new_nodevar = nodevar[node_map]

Definition at line 2712 of file Mesh.h.

◆ elemmap2nodemap() [2/2]

template<class T , class C , class E >
array_type::tensor< size_t, 1 > GooseFEM::Mesh::elemmap2nodemap ( const T & elem_map,
const C & coor,
const E & conn,
ElementType type )
inline

Convert an element-map to a node-map.

Parameters
elem_mapElement-map such that new_elvar = elvar[elem_map].
coorNodal coordinates.
connConnectivity.
typeElementType.
Returns
Node-map such that new_nodevar = nodevar[node_map]

Definition at line 2672 of file Mesh.h.

◆ nodal_mass() [1/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::nodal_mass ( const C & coor,
const E & conn )
inline

Compute the mass of each node in the mesh.

If nodes are not part of the connectivity the mass is set to zero, such that the center of gravity is simply::

 average(coor, GooseFEM.Mesh.nodal_mass(coor, conn), axis=0);
Template Parameters
Ce.g. array_type::tensor<double, 2>
Ee.g. array_type::tensor<size_t, 2>
Parameters
coorNodal coordinates [nnode, ndim].
connConnectivity [nelem, nne].
Returns
Center of gravity [ndim].

Definition at line 2768 of file Mesh.h.

◆ nodal_mass() [2/2]

template<class C , class E >
array_type::tensor< double, 2 > GooseFEM::Mesh::nodal_mass ( const C & coor,
const E & conn,
ElementType type )
inline

Compute the mass of each node in the mesh.

If nodes are not part of the connectivity the mass is set to zero, such that the center of gravity is simply::

 average(coor, GooseFEM.Mesh.nodal_mass(coor, conn, type), axis=0);
Template Parameters
Ce.g. array_type::tensor<double, 2>
Ee.g. array_type::tensor<size_t, 2>
Parameters
coorNodal coordinates [nnode, ndim].
connConnectivity [nelem, nne].
typeElementType.
Returns
Center of gravity [ndim].

Definition at line 2732 of file Mesh.h.

◆ nodaltyings()

template<class D >
std::vector< std::vector< size_t > > GooseFEM::Mesh::nodaltyings ( const D & dofs)
inline

List nodal tyings based on DOF-numbers per node.

Parameters
dofsDOFs per node [nnode, ndim].
Returns
Nodes to which the nodes is connected (sorted) [nnode, ...]

Definition at line 2840 of file Mesh.h.

◆ node2dof()

template<class D >
std::vector< std::vector< size_t > > GooseFEM::Mesh::node2dof ( const D & dofs,
bool sorted = true )
inline

Nodes connected to each DOF.

Parameters
dofsDOFs per node [nnode, ndim].
sortedIf true the list of nodes for each DOF is sorted.
Returns
Nodes per DOF [ndof, ...].

Definition at line 2557 of file Mesh.h.

◆ overlapping()

template<class S , class T >
array_type::tensor< size_t, 2 > GooseFEM::Mesh::overlapping ( const S & coor_a,
const T & coor_b,
double rtol = 1e-5,
double atol = 1e-8 )
inline

Find overlapping nodes.

The output has the following structure:

 [
     [nodes_from_mesh_a],
     [nodes_from_mesh_b],
 ]
Parameters
coor_aNodal coordinates of mesh "a" [nnode, ndim].
coor_bNodal coordinates of mesh "b" [nnode, ndim].
rtolRelative tolerance for position match.
atolAbsolute tolerance for position match.
Returns
Overlapping nodes.

Definition at line 1716 of file Mesh.h.

◆ renumber()

template<class T >
T GooseFEM::Mesh::renumber ( const T & dofs)
inline

Renumber to lowest possible index (see GooseFEM::Mesh::Renumber).

Parameters
dofsDOF-numbers [nnode, ndim].
Returns
Renumbered DOF-numbers.

Definition at line 172 of file Mesh.h.