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.

Parameters

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

copy()[source]#

Return a deepcopy of the mesh.

Returns

A deepcopy of the mesh.

Return type

Mesh

disconnect()[source]#

Return a new instance of a Mesh with disconnected cells.

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)[source]#

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

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