pylbm.elements.Triangle

class pylbm.elements.Triangle(point, vecta, vectb, label=0, isfluid=False)

Class Triangle

Parameters:
pointlist

the coordinates of the first point of the triangle

vectalist

the coordinates of the first vector

vectblist

the coordinates of the second vector

labellist

three integers (default [0, 0, 0])

isfluidboolean
  • True if the triangle is added

  • False if the triangle is deleted

Examples

the bottom half square of [0,1]x[0,1]

>>> point = [0., 0.]
>>> vecta = [1., 0.]
>>> vectb = [0., 1.]
>>> Triangle(point, vecta, vectb)
+----------+
| Triangle |
+----------+
    - dimension: 2
    - start point: [0. 0.]
    - v1: [1. 0.]
    - v2: [0. 1.]
    - label: [0, 0, 0]
    - type: solid
Attributes:
pointndarray

the coordinates of the first point of the triangle

v1ndarray

the coordinates of the first vector

v2ndarray

the coordinates of the second vector

labellist

the list of the label of the edge

isfluidboolean

True if the triangle is added and False if the triangle is deleted

number_of_boundsint

number of edges: 3

dim: int

2

Methods

distance(grid, v[, dmax, normal])

Compute the distance in the v direction between the triangle and the points defined by (x, y).

get_bounds()

return the smallest box where the element is.

point_inside(grid)

return a boolean array which defines if a point is inside or outside of the element.

test_label()

test if the number of labels is equal to the number of bounds.

visualize(viewer, color[, viewlabel, scale, ...])

visualize the element

Attributes

number_of_bounds