Mesh#

Module containing mesh and relative objects.

class volmdlr.mesh.ElementsGroup(elements, name: str)[source]#

Bases: DessiaObject

Defines a group of elements.

property elements_per_node#

Maps the elements of each node.

plot(ax=None, color='k')[source]#

Plot an ElementGroup.

point_to_element(point)[source]#

Checks if a point belongs to an element.

Parameters:

point (Point2D/Point3D) – A point2d/3d

Returns:

The input Element OR None

exception volmdlr.mesh.FlatElementError[source]#

Bases: Exception

An error in case an element is flat.

class volmdlr.mesh.LinearElement(start: Point2D, end: Point2D, interior_normal: Vector2D, name: str = '')[source]#

Bases: LineSegment2D

A class that defines a linear element.

class volmdlr.mesh.Mesh(elements_groups: List[ElementsGroup])[source]#

Bases: DessiaObject

Defines a mesh.

bounding_rectangle()[source]#
copy()[source]#

Copy object.

Parameters:
  • deep – If False, perform a shallow copy. If True, perform a deep copy.

  • memo – A dict that keep track of references.

delete_duplicated_nodes(reference_index, tol=0.0001)[source]#

Delete duplicated nodes.

get_nodes_correction()[source]#

A getter method for nodes_correction private variable.

Returns:

A dict of nodes_correction

Return type:

dict

property gmsh#

A property to get gmsh (a private variable).

Returns:

A gmsh_parser data

Return type:

GmshParser

nodes_correction(reference_index, tol=0.0001)[source]#
plot(ax=None)[source]#

Generic plot getting plot_data function to plot.

point_to_element(point)[source]#
set_nodes_correction(nodes_correction)[source]#

A setter method for nodes_correction private variable.

Parameters:

nodes_correction (dict) – A dict of nodes_correction

class volmdlr.mesh.Node2D(x: float, y: float, name: str = '')[source]#

Bases: Point2D

A node is a Point2D with some hash capabilities for performance used for Mesh.

classmethod from_point(point2d, name: str = '')[source]#

Defines a node2d from a point2d.

Parameters:
  • point2d (vm.Point2D.) – A point2d

  • name – object’s name.

Returns:

A node2d

Return type:

Node2D

class volmdlr.mesh.Node3D(x: float, y: float, z: float, name: str = '')[source]#

Bases: Point3D

A node is a Point3D with some hash capabilities for performance used for Mesh.

classmethod from_point(point3d, name: str = '')[source]#

Defines a node3d from a point3d.

Parameters:
  • point3d (vm.Point3D.) – A point3d

  • name – object’s name.

Returns:

A node3d

Return type:

Node3D

class volmdlr.mesh.QuadrilateralElement2D(points: List[Point2D])[source]#

Bases: ClosedPolygon2D

Class to define a 2D quadrilateral element.

class volmdlr.mesh.TetrahedralElement(points, name: str = '')[source]#

Bases: DessiaObject

Class to define a 3D tetrahedral element.

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True))[source]#

Generic plot getting plot_data function to plot.

class volmdlr.mesh.TetrahedralElementQuadratic(points, name: str = '')[source]#

Bases: DessiaObject

Class to define a 3D quadratic tetrahedral element.

class volmdlr.mesh.TriangularElement(points: List[Point2D])[source]#

Bases: Triangle

A mesh element defined with 3 nodes.

axial_symmetry(line)[source]#

Applies axial symmetry to the triangular element with respect to a given line.

This method creates a mirror image of the triangular element across the specified line. Each point of the triangle is reflected on the other side of the line, resulting in a new triangular element that is a mirror image of the original.

Parameters:

line – The line of symmetry.

Returns:

A new TriangularElement instance that is the mirror image of the original.

Return type:

TriangularElement

class volmdlr.mesh.TriangularElement2D(points, name: str = '')[source]#

Bases: TriangularElement, ClosedPolygon2D

Class to define a 2D triangular element.

axial_symmetry(line)[source]#

Applies axial symmetry to the triangular element with respect to a given line.

This method creates a mirror image of the triangular element across the specified line. Each point of the triangle is reflected on the other side of the line, resulting in a new triangular element that is a mirror image of the original.

Parameters:

line – The line of symmetry.

Returns:

A new TriangularElement2D instance that is the mirror image of the original.

Return type:

TriangularElement2D

plot(ax=None, edge_style: EdgeStyle = EdgeStyle(color='k', alpha=1, edge_ends=False, edge_direction=False, width=None, arrow=False, plot_points=False, dashed=True, linestyle='-', linewidth=1, equal_aspect=True), point_numbering=False, fill=False, fill_color='w')[source]#

Matplotlib plot for a closed polygon 2D.

class volmdlr.mesh.TriangularElement3D(points)[source]#

Bases: TriangularElement, ClosedPolygon3D

Class to define a 3D triangular element.

axial_symmetry(line)[source]#

Returns a symmetric new element with respect to the given line.