mesh.py

Define functions for mesh handling.

petgem.mesh.mesh.getMeshInfo(nedelec_order, elemsN, elemsF, facesN, edgesN, boundaries, rank)[source]

Get and print data mesh.

Parameters:
  • nedelec_order (int) – nedelec element order.
  • elemsN (matrix) – elements-nodes connectivity.
  • elemsF (matrix) – elements-faces connectivity.
  • facesN (matrix) – faces-nodes connectivity.
  • edgesN (matrix) – edges-nodes connectivity.
  • boundaries (vector) – boundaries.
Returns:

number of elements, number of edges, number of boundaries and number of degrees of freedom

Return type:

int

class petgem.mesh.mesh.gmshObject(mshfilename)[source]

Class for mesh of type Gmsh. This class provides methods to parse .msh files to python format.

addElementsRule(condition, action)[source]

Add (append) an user rule to list of elements in the gmshObject.

Parameters:
  • condition (str) – function or condition to be added.
  • action (str) – action to be executed.
Returns:

None.

addNodesRule(condition, action)[source]

Add (append) an user rule to list of nodes in the gmshObject.

Parameters:
  • condition (str) – function or condition to be added.
  • action (str) – action to be executed.
Returns:

None.

cleanRules()[source]

Clean rules in the gmshObject.

edge_4_node = 26
edge_5_node = 27
edge_6_node = 28
gmshParser()[source]

Parser nodesRules and nodesElements in an gmshObject.

hexahedron_125_node = 93
hexahedron_20_node = 17
hexahedron_27_node = 12
hexahedron_64_node = 92
hexahedron_8_node = 5
line_2_node = 1
line_3_node = 8
np = <module 'numpy' from '/home/ocastillo/.local/lib/python3.6/site-packages/numpy/__init__.py'>
point_1_node = 15
printNumberElements()[source]

Print number of elements of a gmshObject.

Returns:None.
printNumberNodes()[source]

Print number of nodes of a gmshObject.

Returns:None.
printNumberPhysicalGroups()[source]

Print number of physical groups of a gmshObject.

Returns:None.
prism_15_node = 18
prism_18_node = 13
prism_6_node = 6
pyramid_13_node = 19
pyramid_14_node = 14
pyramid_5_node = 7
quadrangle_4_node = 3
quadrangle_8_node = 16
quadrangle_9_node = 10
tetrahedron_10_node = 11
tetrahedron_20_node = 29
tetrahedron_35_node = 30
tetrahedron_4_node = 4
tetrahedron_56_node = 31
triangle_10_node = 21
triangle_12_node_incomplete = 22
triangle_15_node = 23
triangle_15_node_incomplete = 24
triangle_21_node = 25
triangle_3_node = 2
triangle_6_node = 9
triangle_9_node_incomplete = 20
petgem.mesh.mesh.readGmshConnectivity(mesh_file)[source]

Read a mesh connectivity from a Gmsh file.

Parameters:mesh_file (str) – mesh file to be readed.
Returns:mesh connectivity (elemsN) and number of elements.
Return type:ndarray, int.
petgem.mesh.mesh.readGmshNodes(mesh_file)[source]

Read a mesh nodes from a Gmsh file.

Parameters:mesh_file (str) – mesh file to be readed.
Returns:nodes coordinates and number of nodes.
Return type:ndarray, int.
petgem.mesh.mesh.readGmshPhysicalGroups(mesh_file)[source]

Read conductivity model from a mesh in Gmsh format.

Parameters:mesh_file (str) – mesh file to be readed.
Returns:conductivity model (elemsS) and number of elements.
Return type:ndarray, int.
petgem.mesh.mesh.unitary_test()[source]

Unitary test for mesh.py script.