pyleecan.Classes.RefTriangle3 module

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

class RefTriangle3(epsilon=0.05, init_dict=None, init_str=None)[source]

Bases: RefCell

Store triangle elements for 2D mesh

VERSION = 1
shape_function(points, nb_pt)

Return the values of linear shape functions in reference triangle for a given point

jacobian(point, vertice)

Compute jacobian, jacobian determinant and jacobian derivatives for linear triangle.

:param : :type : param self : a RefElement object

grad_shape_function(point)

Return the gradient of linear shape functions in reference triangle for a given point

get_real_point(vertice, ref_pt, nb_ref_pt=1)

Return the coordinates in the cell of a point in the reference cell.

Parameters:
  • self (RefTriangle3) – an RefCell object

  • vertice (ndarray) – vertices of the cell

  • ref_pt (ndarray) – ref point(s)

  • nb_ref_pt (int) – nb of ref points

Returns:

real_points – points coordinate

Return type:

ndarray

get_ref_point(vertice, point)

Return the coordinate of the equivalent point in the ref cell

Parameters:
  • self (RefTriangle3) – a RefTriangle3 object

  • vertice (ndarray) – vertice of the cell

  • point (ndarray) –

    coordinates of a point

    Returns

  • -------

  • pt1_ref (ndarray) – coordinates of the ref point

is_inside(vertice, point, normal_t=None)

Check if a point is inside the cell defined by the vertices.

Parameters:
  • self (RefTriangle3) – an RefTriangle3 object

  • vertice (ndarray) – vertices of the cell

  • point (ndarray) – coordinates of the checked point

  • normal_t (ndarray) – (optional) cell normal vector

Returns:

is_inside – true if the point is inside the cell

Return type:

bool

get_cell_area(vertices)

Return the area of the cells. https://en.wikipedia.org/wiki/Shoelace_formula

Parameters:
  • self (RefTriangle3) – a RefTriangle3 object

  • vertices (list or array) – the cells vertices

Returns:

area – area of the cells

Return type:

array

get_normal(vertice)

Return the array of the normals coordinates.

Parameters:
  • self (MeshVTK) – a MeshVTK object

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

  • loc (str) – localization of the normals (“center” or “point”)

Returns:

normals – Normals coordinates

Return type:

ndarray

save(save_path='', is_folder=False, type_handle_old=2, type_compression=0)

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 (json only)

  • type_handle_old (int) – How to handle old file in folder mode (0:Nothing, 1:Delete, 2:Move to “Backup” folder)

  • type_compression (int) – Available only for json, 0: no compression, 1: gzip

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

compare(other, name='self', ignore_list=None, is_add_value=False)[source]

Compare two objects and return list of differences

as_dict(type_handle_ndarray=0, keep_function=False, **kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). type_handle_ndarray: int

How to handle ndarray (0: tolist, 1: copy, 2: nothing)

keep_functionbool

True to keep the function object, else return str

Optional keyword input parameter is for internal use only and may prevent json serializability.

copy()[source]

Creates a deepcopy of the object