iota.mesh

Description

This module provides functionalities to operate with data from the meshes.

CFD mesh class object. This object is returned when getting a mesh from a CFD dataset using Dataset.get_mesh method.

Parameters

  • id: (int) id for the mesh

  • name: (str) name for the mesh

Example

Methods

Add a new cell defined by a list of faces

Parameters

  • type : (CFDMesh.CellType) the type of the cell

  • faces : (list of FaceHandle) a list of faces

Examples

Adding a cell of type hexahedron defined by a list of faces

Adding a cell of type polyhedron defined by a list of faces

Add a new face defined by a list of vertices

Parameters

  • vertices : (list of VertexHandle) a list of vertices

  • id : (int) identifier of the face

Examples

Adding a cell of type hexahedron defined by a list of faces

Adding a cell of type polyhedron defined by a list of faces

Add a single new vertex to the mesh

Parameters

  • vertex : (iota.Vector3) vertex position (x,y,z)

  • id : (int) id for the vertex

Example

Add a set of new vertices to the mesh

Parameters

  • vertices : (numpy.ndarray of floats) An array with the position (x,y,z) of the vertices

Example

Adding two new vertices to the mesh

Get the id of the vertices of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A numpy.ndarray of integers that contains the id of the vertices of the cell

Example

Getting the ids of the vertices of the cell with id = 5

Get the coordinates of the centre of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A numpy.ndarray of floats that contains the position (x,y,z) of the centre of the cell

Example

Getting the coordinates of the centre of the cell with id = 5

Get the coordinates of the centres of all cells

Returns

  • A numpy.ndarray of floats that contains, per row, the position (x,y,z) of the cells

Example

Get the id of the faces of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A numpy.ndarray of integers that contains the id of the faces of the cell

Example

Getting the id of the faces of the cell with id = 5

Get the id of the cells in the mesh

Returns

  • A numpy.ndarray of integers that contains the id of cells

Example

Get the id of the cells that are neighbors of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A numpy.ndarray of integers that contains the id of the cells

Example

Getting the id of the cells that are neighbors of the cell with id = 5

Get a list of the cells occupying a particular point in space

Parameters

  • point_coordinates : (iota.Vector3d) coordinates (x,y,z) of the point

  • cell_list : (list of integers) handles of the cells to interrogate (default: all cells)

Returns

  • A list of integers containing the handles of the cells that occupy that point in space

Get the number of cells in the mesh

Parameters

  • id : (int) index of cell

Returns

  • A integer that represents number of cells in the mesh

Example

Getting the size of the cells with id = 5

Get the type of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A iota.mesh.CellType that represents the type of the cell

Example

Getting the type of the cell with id = 5

Get the volume of a cell given its id

Parameters

  • id : (int) index of cell

Returns

  • A float that represents the volume of the cell

Example

Getting the volume of the cell with id = 5

Get the id of the cells around a vertex given its id

Parameters

  • id : (int) index of the vertex

Returns

  • A numpy.ndarray of integers with the id of the cells

Example

Getting the id of the cells around the vertex with id = 5

Check if the faces of the boundary of the mesh have consistent pointing normal vectors

Returns

  • A tuple of

    • A bool that is True if the faces have consistent pointing normal vectors

    • A bool that is True if the normal vectors point inwards

Example

Getting the id of the cells around the vertex with id = 5

Get the dimension of the mesh

Returns

  • A integer that represents the dimension of the mesh:

    • 0: point mesh

    • 1 : line segments

    • 2 : surface mesh

    • 3 : volume mesh

Example

Get the id of the vertices of an edge given its id

Parameters

  • id : (int) index of edge

Returns

  • A numpy.ndarray of integers that contains the id of the vertices of the edge

Example

Getting the ids of the vertices of the edge with id = 5

Get the id of the edges in the mesh

Returns

  • A numpy.ndarray of integers that contains the id of the edges

Example

Get the number of edges in the mesh

Returns

  • An integer the corresponds to the number of edges

Example

Get the number of edges in the mesh

Returns

  • An integer the corresponds to the number of edges

Example

Get the pair of vertices id for all the edges in the mesh

Returns

  • A numpy.ndarray of integers that contains a pair of vertices id for each edge

Example

Get the id of the vertices of a face given its id

Parameters

  • id : (int) index of the face

Returns

  • A numpy.ndarray of integers that contains the id of the vertices of the face

Example

Getting the ids of the vertices of the face with id = 5

Get the area of a face given its id

Parameters

  • id : (int) index of the face

Returns

  • A float that represents the area of the face

Example

Getting the area of the face with id = 5

Get the cell(s) that limit with a face given its id

Parameters

  • id : (int) index of the face

Returns

  • A list of integers that contains the id of the cells that limit with the face

Example

Getting the cells that limit with the face with id = 5

Get the centroid of a face given its id

Parameters

  • id : (int) index of the face

Returns

  • A numpy.ndarray of floats that contains the position (x,y,z) of the centroid of the face

Example

Getting the coordinates of the centroid of the face with id = 5

Get the centroids of all faces

Returns

  • A numpy.ndarray of floats that contains, per row, the position (x,y,z) of the centroids of all the faces

Example

Get the id of the faces in the mesh

Returns

  • A numpy.ndarray of integers that contains the id of the faces

Example

Get the id of the faces that are neighbors of a face given its id

Parameters

  • id : (int) index of the face

Returns

  • A numpy.ndarray of integers that contains the id of the faces

Example

Getting the id of the faces that are neighbors of the face with id = 5

Get the number the faces in the mesh

Returns

  • A integer that represents the number of faces

Example

Get the mesh that represents the isosurface for a constant value of a given an array of values of a variable

Parameters

  • variable : (numpy.ndarray of floats) array of values. Note the that the size of the values of the variable must be equal to the number of vertices of the input CFDMesh.

  • value: (float) constant value of variable for the calculation of the isosurface

Returns

  • A iota.CFDMesh object that contains the mesh that represents the isosurface

Example

Getting the isosurface mesh from the mesh called 'my_mesh' and based on the values of the result-analysis 'PRESSURE'-'phase-1' and a constant value of result equal to 0.0

Get the mesh that represents the skin of a volume mesh

Returns

  • A iota.CFDMesh object that contains the mesh representing the skin of the volume mesh

Example

Getting the skin of the volume mesh

Get a mesh that represents a slice of a volume mesh given the normal vector (nx,ny,nz ) and the position (x,y,z) of the origin that define the slice

Parameters

  • normal: (list of floats) normal vector (nx,ny,nz ) of the slice

  • origin: (list of float) position (x,y,z) of the slice

Returns

  • A iota.CFDMesh object that contains the mesh representing the slice

Example

Getting a slice with normal vector pointing the z-axis and centered at position (0,0,0)

Get the position (x,y,z) of a vertex given its id

Parameters

  • id: (int) index of the vertex

Returns

  • A numpy.ndarray of floats with the position (x,y,z) of the vertex

Example

Getting the position of the vertex with id=5

Get the id of the all the vertices in the mesh

Returns

  • A numpy.ndarray of integers with the id of the vertices

Example

Getting the id of the vertices of the mesh

Get the number of vertices in the mesh

Returns

  • An integer that represents the number of vertices in the mesh

Example

Getting the number of the vertices in the mesh

Get the positions (x,y,z) of all the vertices in the mesh

Returns

  • An numpy.ndarray of floats that contains the positions (x,y,z) of the vertices

Example

Getting the positions of the vertices in 'my_mesh'

Get the volume/area of a volume/surface mesh.

Returns

  • A float that represents the volume/area of the volume/surface mesh

Example

Getting the volume of a volume mesh

Getting the area of a surface mesh

Load a mesh list from file

*Returns a list of meshes

Arguments

  • filename: (str) file containing the meshes to me readed

  • split: (bool) split meshes by connectivities (default: True)

Example

Export a mesh to file

Arguments

  • mesh: (iota.mesh.Mesh) mesh object to be exported

  • filename: (str) file to write the mesh

  • format: (iota.mesh.export_format) mesh format for to written (default: P4S)

Example

Create a linear mesh of edges

Arguments

  • start: (iota.Vector3d) point representing the origin of the line

  • end: (iota.Vector3d) point representing the end of the line

  • element_size: (float) size of the triangular elements

  • name: (str) name of the mesh (default: 'line')

Example

Create a circular mesh of triangles

Arguments

  • centre: (iota.Vector3d) point representing the centre of the circle

  • radius: (float) radius of the circle

  • normal: (iota.Vector3d) normal vector representing the plane of the circle

  • element_size: (float) size of the triangular elements

  • name: (str) name of the mesh (default: 'circle')

Example

Create a rectangular mesh of triangles

Arguments

  • origin: (iota.Vector3d) point representing the origin of the rectangle

  • normal: (iota.Vector3d) normal vector representing the plane of the rectangle

  • length: (float) length of the rectangle

  • width: (float) width of the rectangle

  • element_size: (float) size of the triangular elements

  • name: (str) name of the mesh (default: 'rectangle')

Example

Create a cuboid mesh of tetrahedra

Arguments

  • origin: (iota.Vector3d) point representing the origin of the cuboid

  • up: (iota.Vector3d) vector representing the up direction of the cuboid

  • length: (float) length of the cuboid

  • width: (float) width of the cuboid

  • height: (float) height of the cuboid

  • element_size: (float) size of the elements

  • name: (str) name of the mesh (default: 'cuboid')

  • skin: (bool) generate the surface instead of volume (default: False)

Example

Create a cylinder mesh of tetrahedra

Arguments

  • origin: (iota.Vector3d) point representing the origin of the cylinder

  • up: (iota.Vector3d) vector representing the up direction of the cylinder

  • radius: (float) radius of the cylinder

  • height: (float) height of the cylinder

  • element_size: (float) size of the elements

  • name: (str) name of the mesh (default: 'cylinder')

  • skin: (bool) generate the surface instead of volume (default: False)

Example

Last updated

Was this helpful?