MeshMat (class)

Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Mesh/MeshMat

class MeshMat(cell=-1, point=-1, label=None, dimension=2, init_dict=None, init_str=None)[source]

Bases: pyleecan.Classes.Mesh.Mesh

Gather the mesh storage format

VERSION = 1
get_point(indices=None)

Return a matrix of points coordinates.

Parameters
  • self (Mesh) – an Mesh object

  • indices (list) – Indices of the targeted points. If None, return all.

  • is_indice (bool) – Option to return the points indices (useful for unsorted

Returns

  • coordinates (ndarray) – points coordinates

  • indices (ndarray) – points indices

get_cell(indices=None)

Return the connectivity for one selected element

Parameters
  • self (MeshMat) – an MeshMat object

  • indices (list) – list of indice. If None, return all.

Returns

cells – Dict of connectivities

Return type

dict

get_mesh_pv(path='C:/Users/HP/Documents/Franco/Website/Git/pyleecan/pyleecan/Results/temp.vtk', indices=None)

Return the pyvista mesh object (or submesh).

Parameters
  • self (MeshMat) – a MeshMat object

  • indices (list) – list of the points to extract (optional)

Returns

mesh – a pyvista UnstructuredGrid object

Return type

pyvista.core.pointset.UnstructuredGrid

get_cell_area(indices=None)

Return the area of the cells on the outer surface.

Parameters
  • self (MeshMat) – a MeshMat object

  • indices (list) – list of the points to extract (optional)

Returns

areas – Area of the cells

Return type

ndarray

add_cell(pt_indice, cell_type, group_name=None)

Add a new cell defined by a point indices

Parameters
  • self (MeshMat) – an Mesh object

  • pt_indice (ndarray) – a ndarray of points indices

  • group_name (str) – name of the group

Returns

new_ind – Tag of the created element. None if the element already exist

Return type

int

get_vertice(indices=None)

Return a connectivity matrix where the points indices are replaced by their coordinates.

Parameters
  • self (MeshMat) – an MeshMat object

  • cell_type (str) – a key corresponding to an element type

  • group (numpy.array) – One or several group numbers to be returned

Returns

vertice – Selected vertices

Return type

numpy.array

get_point2cell(pt_indice)

Return all cell indices of cells containing a point.

Parameters
  • self (MeshMat) – an MeshMat object

  • pt_indice (int) – a point indice

Returns

pt_to_cell – Indices of cells containing the point

Return type

ndarray

renum()

Remove non-used points, restart point indices from 0, and update connectivity. Indices of cells stay the same.

Parameters

self (MeshMat) – an Mesh object

find_cell(points, nb_pt, normal_t=None)

Return the cells containing the target point(s)

Parameters
  • self (MeshMat) – an MeshMat object

  • points (ndarray) – coordinates of the target point(s)

  • nb_pt (int) – number of target points

Returns

cell_list – A list of of selected cells

Return type

list

interface(other_mesh)

Define a MeshMat object corresponding to the exact intersection between two meshes (points must be in both meshes).

Parameters
  • self (MeshMat) – a Mesh object

  • other_mesh (Mesh) –

    an other Mesh object

    Returns

  • -------

save(save_path='', is_folder=False)

Save the object to the save_path

Parameters
  • self – A pyleecan object

  • save_path (str) – path to the folder to save the object

  • is_folder (bool) – to split the object in different files: separate simulation machine and materials

copy()

Return a copy of the class

get_logger()

Get the object logger or its parent’s one

Parameters

obj – A pyleecan object

Returns

logger – Pyleecan object dedicated logger

Return type

logging.Logger

as_dict()[source]

Convert this object in a json seriable dict (can be use in __init__)

property cell

Storing connectivity

Type

{CellMat}

property point

Storing nodes

Type

PointMat