Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3eb55b4
Add new abstract truss class
brookshsmith Nov 12, 2025
c5e7c89
Create add_node() function to ensure control over node ids
brookshsmith Nov 12, 2025
a4a7d6e
Fix bug-ish in negative index; do not negate an index of '0'
brookshsmith Nov 12, 2025
7cf7044
Add SectionProps type, always import Vertex
brookshsmith Nov 12, 2025
1fd7dd3
Add a Howe truss
brookshsmith Nov 12, 2025
bf138ea
Add a generic RoofTruss class
brookshsmith Nov 17, 2025
087e984
Add a slew of roof truss types
brookshsmith Nov 17, 2025
b4324de
Create an upper-level FlatTruss base class too
brookshsmith Nov 18, 2025
c9d1afe
Add more roof truss types
brookshsmith Nov 18, 2025
e27004a
Fill __all__ list
brookshsmith Nov 18, 2025
2400d33
Remove disused imports
brookshsmith Nov 18, 2025
c592ef6
Rename truss -> preprocess
brookshsmith Nov 20, 2025
1e4b16e
Merge branch 'master' into trussGenerator
brookshsmith Nov 21, 2025
09e3003
Add .coverage to .gitignore
brookshsmith Nov 21, 2025
faeea84
Store element IDs too
brookshsmith Dec 8, 2025
0deeeb6
Merge branch 'master' into trussGenerator
brookshsmith Dec 8, 2025
3e2b3d3
Switch to dicts, add quick q_loads to class
brookshsmith Dec 9, 2025
4dae823
Update individual trusses per data type changes
brookshsmith Dec 9, 2025
8908389
Add docstrings everywhere, fix a couple minor bugs / typos
brookshsmith Jan 20, 2026
e52a16a
Add a factory function
brookshsmith Jan 20, 2026
30323d0
Add validation function
brookshsmith Jan 20, 2026
56cf4c5
Add truss tests
brookshsmith Jan 20, 2026
2fa43ac
Fix typing and formatting
brookshsmith Jan 20, 2026
f238cda
Misc typing cleanup
brookshsmith Jan 20, 2026
f49f494
Fix imports
brookshsmith Jan 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .coverage
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ MANIFEST
build/
.ipynb_checkpoints/

dev/
dev/
.coverage
1 change: 1 addition & 0 deletions anastruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from anastruct.fem.system import SystemElements
from anastruct.fem.util.load import LoadCase, LoadCombination
from anastruct.preprocess import truss
from anastruct.vertex import Vertex
2 changes: 1 addition & 1 deletion anastruct/fem/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2363,6 +2363,6 @@ def _negative_index_to_id(idx: int, collection: Collection[int]) -> int:
idx = int(idx)
else:
raise TypeError("Node or element id must be an integer")
if idx > 0:
if idx >= 0:
return idx
return max(collection) + (idx + 1)
42 changes: 42 additions & 0 deletions anastruct/fem/system_components/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,48 @@ def det_node_ids(
return node_ids[0], node_ids[1]


def add_node(
system: "SystemElements", point: Vertex, node_id: Optional[int] = None
) -> int:
"""Add a node, optionally with a specific ID, without adding an element

Args:
system (SystemElements): System in which the nodes are located
point (Vertex): Location of the node
node_id (Optional[int], optional): node_id to assign to the node. Defaults to None,
which means to use the first available node_id automatically.

Raises:
FEMException: Raised when the location is already assigned to a different node id.
FEMException: Raised when the node id is already assigned to a different location.

Returns:
int: The node id of the added (or existing) node
"""
if point in system._vertices:
if node_id is not None:
existing_node_id = system._vertices[point]
if existing_node_id != node_id:
raise FEMException(
"Flawed inputs",
f"Location {point} is already assigned to node id {existing_node_id}, "
f"cannot assign to node id {node_id}.",
)
return existing_node_id

if node_id is None:
node_id = max(system.node_map.keys(), default=0) + 1
elif node_id in system.node_map and system.node_map[node_id].vertex != point:
raise FEMException(
"Flawed inputs",
f"Node id {node_id} is already assigned to a different location.",
)

system._vertices[point] = node_id
system.node_map[node_id] = Node(node_id, vertex=point)
return node_id


def support_check(system: "SystemElements", node_id: int) -> None:
"""Check if the node is a hinge

Expand Down
Empty file.
Loading
Loading