utils
create_branch_node_matrix(edge_index)
Creates the branch-node matrix for a given set of edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
Tensor
|
A tensor of shape (2, num_edges) containing the indices of the nodes that form each edge. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: A dense tensor of shape (num_edges, num_nodes) representing the branch-node incidence matrix. The matrix has an entry of +1 and -1 for each row indicating the start and end nodes of each edge, respectively. |
Source code in src/torch_structure/formfinding/utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
create_xy_equilibrium_matrix(coords, is_support, edge_index)
Creates the equilibrium matrix for the x and y components of the equilibrium equations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
Tensor
|
A tensor of shape (num_nodes, 3) containing the 3D coordinates of each node. Only the x and y coordinates have an effect on the output. |
required |
is_support
|
Tensor
|
A boolean tensor of shape (num_nodes, 1) indicating which nodes are fixed (True) or free (False). |
required |
edge_index
|
Tensor
|
A tensor of shape (2, num_edges) containing the indices of the nodes that form each edge. Needs to be directed. |
required |
Source code in src/torch_structure/formfinding/utils.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
create_xy_equilibrium_space(coords, is_support, edge_index)
Compute a basis for the space of xy-equilibrium-preserving coordinate perturbations.
Builds the xy equilibrium matrix and returns a basis of its null space, i.e. the directions in which free-node xy-coordinates can move while keeping the horizontal equilibrium equations satisfied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
Tensor[N, 3]
|
node coordinates; only x and y affect the result. |
required |
is_support
|
(Tensor[N, 1], bool)
|
mask of fixed (supported) nodes. |
required |
edge_index
|
Tensor[2, E]
|
directed edge connectivity. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor [D, K]: basis vectors (columns) spanning the null space |
|
|
of the xy equilibrium matrix, where |
|
|
free nodes. |
Source code in src/torch_structure/formfinding/utils.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |