RefTriangle3 (class)

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: pyleecan.Classes.RefCell.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
selfRefTriangle3

an RefCell object

verticendarray

vertices of the cell

ref_ptndarray

ref point(s)

nb_ref_ptint

nb of ref points

real_pointsndarray

points coordinate

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)

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(**kwargs)

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

compare(other, name='self')[source]

Compare two objects and return list of differences

as_dict(**kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). Optional keyword input parameter is for internal use only and may prevent json serializability.