Mesh#

class felupe.Mesh(points, cells, cell_type=None)[source]#

A mesh with points, cells and optional a specified cell type.

Parameters:
  • points (ndarray) – Point coordinates.

  • cells (ndarray) – Point-connectivity of cells.

  • cell_type (str or None, optional) – An optional string in VTK-convention that specifies the cell type (default is None). Necessary when a mesh is saved to a file.

points#

Point coordinates.

Type:

ndarray

cells#

Point-connectivity of cells.

Type:

ndarray

cell_type#

A string in VTK-convention that specifies the cell type.

Type:

str or None

npoints#

Amount of points.

Type:

int

dim#

Dimension of mesh point coordinates.

Type:

int

ndof#

Amount of degrees of freedom.

Type:

int

ncells#

Amount of cells.

Type:

int

points_with_cells#

Array with points connected to cells.

Type:

array

points_without_cells#

Array with points not connected to cells.

Type:

array

cells_per_point#

Array which counts connected cells per point. Used for averging results.

Type:

array

as_meshio(**kwargs)[source]#

Export the mesh as meshio.Mesh.

copy()[source]#

Return a deepcopy of the mesh.

Returns:

A deepcopy of the mesh.

Return type:

Mesh

disconnect(points_per_cell=None, calc_points=True)[source]#

Return a new instance of a Mesh with disconnected cells. Optionally, the points-per-cell may be specified (must be lower or equal the number of points- per-cell of the original Mesh). If the Mesh is to be used as a dual Mesh, then the point-coordinates do not have to be re-created because they are not used.

save(filename='mesh.vtk', **kwargs)[source]#

Export the mesh as VTK file. For XDMF-export please ensure to have h5py (as an optional dependancy of meshio) installed.

Parameters:

filename (str, optional) – The filename of the mesh (default is mesh.vtk).

update(cells, cell_type=None)[source]#

Update the cell and dimension attributes with a given cell array.

class felupe.MeshContainer(meshes, merge=False, decimals=None)[source]#

A container which operates on a list of meshes with identical dimensions.

Parameters:

meshes ([felupe.Mesh, ...]) – A list with meshes.

dim#

The (identical) dimension of all underlying meshes.

Type:

int

points#

Point coordinates.

Type:

ndarray

meshes#

A list with meshes.

Type:

[felupe.Mesh, …]

append(mesh)[source]#

Append a Mesh to the list of meshes.

as_meshio(combined=True, **kwargs)[source]#

Export a (combined) mesh object as meshio.Mesh.

cells()[source]#

Return a list of tuples with cell-types and cell-connectivities.

copy()[source]#

Return a deepcopy of the mesh container.

merge_duplicate_points(decimals=None)[source]#

Merge duplicate points and update meshes.

pop(index)[source]#

Pop an item of the list of meshes.

class felupe.Rectangle(a=(0, 0), b=(1, 1), n=(2, 2))[source]#

Bases: Mesh

class felupe.Cube(a=(0, 0, 0), b=(1, 1, 1), n=(2, 2, 2))[source]#

Bases: Mesh

class felupe.Grid(*xi, indexing='ij', **kwargs)[source]#

Bases: Mesh