PySAGAS Cell

class pysagas.geometry.cell.Cell[source]

A triangular cell object.

p0

The first vertex of the cell.

Type:

Vector

p1

The second vertex of the cell.

Type:

Vector

p2

The third vertex of the cell.

Type:

Vector

A

The cell face area.

Type:

float

n

The cell normal.

Type:

Vector

c

The cell centroid.

Type:

Vector

dndv

The sensitivity of the cell’s normal vector to each vertex.

Type:

np.array

dAdv

The sensitivity of the cell’s area to each vertex.

Type:

np.array

dvdp

The sensitivity of the cell’s vertices to each geometric parameter.

Type:

np.array

dndp

The sensitivity of the cell’s normal vector to each geometric parameter.

Type:

np.array

dAdp

The sensitivity of the cell’s area to each geometric parameter.

Type:

np.array

dcdp

The sensitivity of the centroid to each geometric parameter.

Type:

np.array

flowstate

The flowstate associated with the cell.

Type:

FlowState

sensitivities

An array containing the [x,y,z] force sensitivities of the cell.

Type:

np.array

static A_sensitivity(p0, p1, p2)[source]

Calculates the sensitivity of a cell’s area to the points defining the cell analytically.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

sensitivity – The sensitivity matrix with size m x n. Rows m refer to the vertices, columns n refer to the vertex coordinates.

Return type:

np.array

__init__(p0, p1, p2, face_ids=None)[source]

Constructs a cell, defined by three points.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

  • face_ids (list[int] | None)

static c_sensitivity(p0, p1, p2)[source]

Calculates the sensitivity of a cell’s centroid to the points defining the cell.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

sensitivity – The sensitivity matrix with size m x n x p. Rows m refer to the vertices, columns n refer to the vertex coordinates, and slices p refer to the components of the centroid point.

Return type:

np.array

static calc_area(p0, p1, p2)[source]

Calculates the area of a cell defined by three points.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

area – The area of the cell defined by the points.

Return type:

float

References

https://en.wikipedia.org/wiki/Cross_product

static calc_centroid(p0, p1, p2)[source]

Calculates the centroid of a cell defined by three points.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

c – The centroid of the cell defined by the points.

Return type:

Vector

References

https://en.wikipedia.org/wiki/Centroid

static calc_normal(p0, p1, p2)[source]

Calculates the normal vector of a cell defined by three points.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

normal – The unit normal vector of the cell defined by the points.

Return type:

Vector

References

https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal

classmethod from_points(points, **kwargs)[source]

Constructs a Vector object from an array of coordinates.

Parameters:

points (Union[List[Vector], np.array[Vector]]) – The points defining the cell.

Return type:

Cell

static n_sensitivity(p0, p1, p2)[source]

Calculates the sensitivity of a cell’s normal vector to the points defining the cell analytically.

Parameters:
  • p0 (Vector) – The first point defining the cell.

  • p1 (Vector) – The second point defining the cell.

  • p2 (Vector) – The third point defining the cell.

Returns:

sensitivity – The sensitivity matrix with size m x n x p. Rows m refer to the vertices, columns n refer to the vertex coordinates, and slices p refer to the components of the normal vector.

Return type:

np.array

to_dict()[source]

Returns the Cell as a dictionary.

property vertices

The cell vertices.

exception pysagas.geometry.cell.DegenerateCell[source]

Exception raised for degenerate cells.

__init__(message='Degenerate cell')[source]