puncturedfem.Vert
Represents a vertex in a planar mesh.
Also stores topological information in the form of the vertex's global index and coordinates.
Attributes:
| Name | Type | Description |
|---|---|---|
idx |
int
|
The global index of the vertex. |
x |
float
|
The x-coordinate of the vertex. |
y |
float
|
The y-coordinate of the vertex. |
__add__(other)
Define the addition of two Verts.
Returns a new Vert with coordinates equal to the sum of the coordinates of the two Verts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object. |
required |
__eq__(other)
Return True if two Vertices have the same coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object. |
required |
__init__(x, y, idx=-1)
Initialize a Vert object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
float
|
The x-coordinate of the vertex. |
required |
y |
float
|
The y-coordinate of the vertex. |
required |
__mul__(other)
Define multiplication of two Verts or a Vert and a scalar.
Return a new Vert with coordinates equal to the product of the coordinates of the two Verts, or the coordinates of the Vert multiplied by the scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object or a scalar. |
required |
__repr__()
Return a string representation of the vertex.
__rmul__(other)
Define multiplication of two Verts or a Vert and a scalar.
Return a new Vert with coordinates equal to the product of the coordinates of the two Verts, or the coordinates of the Vert multiplied by the scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object or a scalar. |
required |
__str__()
Return a string representation of the vertex.
__sub__(other)
Define the subtraction of two Verts.
Return a new Vert with coordinates equal to the difference of the coordinates of the two Verts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object. |
required |
__truediv__(other)
Define division of two Verts or a Vert and a scalar.
Return a new Vert with coordinates equal to the quotient of the coordinates of the two Verts, or the coordinates of the Vert divided by the scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
Another Vert object or a scalar. |
required |
get_coord()
Get the coordinates of the vertex.
Returns:
| Name | Type | Description |
|---|---|---|
x |
float
|
The x-coordinate of the vertex. |
y |
float
|
The y-coordinate of the vertex. |
get_coord_array()
Get the coordinates of the vertex as a numpy.ndarray.
Returns:
| Name | Type | Description |
|---|---|---|
coords |
numpy.ndarray
|
Array of shape (2,) containing the vertex coordinates. |
norm()
Return the Euclidean norm of the vertex.
Returns:
| Type | Description |
|---|---|
float
|
The Euclidean norm of the vertex. |
set_coord(x, y)
Set the coordinates of the vertex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
float
|
The x-coordinate of the vertex. |
required |
y |
float
|
The y-coordinate of the vertex. |
required |
set_idx(idx)
Set the global vertex index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx |
int
|
Index of the vertex in the mesh. |
required |
Notes
The following attributes are set: idx : int The global index of the vertex.