anastruct.preprocess.beam_class =============================== .. py:module:: anastruct.preprocess.beam_class Attributes ---------- .. autoapisummary:: anastruct.preprocess.beam_class.DEFAULT_BEAM_SECTION Classes ------- .. autoapisummary:: anastruct.preprocess.beam_class.Beam Module Contents --------------- .. py:data:: DEFAULT_BEAM_SECTION :type: anastruct._types.SectionProps .. py:class:: Beam(length: Optional[float] = None, span_lengths: Optional[list[float]] = None, angle: float = 0.0, section: Optional[anastruct._types.SectionProps] = None) Bases: :py:obj:`abc.ABC` Abstract base class for 2D beam structures. Provides a framework for creating parametric beam geometries with automated node generation, connectivity, and support definitions. Subclasses implement specific beam types (simple, cantilever, etc.). The beam generation follows a two-phase process: 1. define_nodes() - Generate node coordinates and span connectivity 2. define_supports() - Define support locations and types Attributes: length (float): Total length of the beam (length units) angle (float): Angle of the beam (degrees; 0 = horizontal, positive = CCW); defaults to 0.0 section (SectionProps): Section properties for all beam elements; defaults to DEFAULT_BEAM_SECTION supports_type (Literal["simple", "pinned", "fixed"]): Type of supports to apply; defaults to "simple" system (SystemElements): The FEM system containing all nodes, elements, and supports .. py:attribute:: length :type: float .. py:attribute:: span_lengths :type: list[float] .. py:attribute:: angle :type: float .. py:attribute:: section :type: anastruct._types.SectionProps .. py:attribute:: nodes :type: list[anastruct.vertex.Vertex] .. py:attribute:: node_ids :type: dict[int, list[int]] .. py:attribute:: support_definitions :type: dict[int, Literal['fixed', 'pinned', 'roller']] .. py:attribute:: element_ids :type: dict[int, list[int]] .. py:attribute:: system :type: anastruct.fem.system.SystemElements .. py:attribute:: dx .. py:attribute:: dy .. py:property:: type :type: str :abstractmethod: Return the human-readable name of the beam type. .. py:method:: define_nodes() -> None :abstractmethod: Generate node coordinates and populate self.nodes list. Must be implemented by subclasses. Should create Vertex objects representing all node locations in the beam. Should also populate self.node_ids dictionary mapping spanwise node indices to global node IDs. .. py:method:: define_supports() -> None :abstractmethod: Define support locations and types by populating self.support_definitions. Must be implemented by subclasses. .. py:method:: add_nodes() -> None Add all nodes from self.nodes to the SystemElements. .. py:method:: add_elements() -> None Create elements from connectivity definitions and add to SystemElements. Populates element ID list self.element_ids. .. py:method:: add_supports() -> None Add supports from self.support_definitions to the SystemElements. .. py:method:: get_element_ids_of_spans(spans: Optional[Union[int, Sequence[int]]]) -> list[int] Get element IDs for a span. Args: span_ids (int, sequence, None): The ID of the span to query. If None, returns element IDs for all spans. If a sequence, returns IDs for all specified spans. Returns: list[int]: Element IDs of the requested span Raises: KeyError: If span_id does not exist .. py:method:: apply_q_load_to_spans(q: Union[float, Sequence[float]], direction: Union[anastruct._types.LoadDirection, Sequence[anastruct._types.LoadDirection]] = 'element', rotation: Optional[Union[float, Sequence[float]]] = None, q_perp: Optional[Union[float, Sequence[float]]] = None, spans: Optional[Union[int, Sequence[int]]] = None) -> None Apply distributed load to all elements within one or more spans. Args: q (Union[float, Sequence[float]]): Load magnitude (force/length units) direction (Union[LoadDirection, Sequence[LoadDirection]]): Load direction. Options: "element", "x", "y", "parallel", "perpendicular", "angle" rotation (Optional[Union[float, Sequence[float]]]): Rotation angle in degrees (used with direction="angle") q_perp (Optional[Union[float, Sequence[float]]]): Perpendicular load component .. py:method:: apply_point_load_to_spans(Fx: Union[float, Sequence[float]] = 0.0, Fy: Union[float, Sequence[float]] = 0.0, rotation: Union[float, Sequence[float]] = 0.0, absolute_location: Optional[float] = None, relative_location: Optional[float] = None, spans: Optional[Union[int, Sequence[int]]] = None, tolerance: Optional[float] = None) -> None Apply point load to elements within one or more spans. Args: Fx (Union[float, Sequence[float]]): Horizontal load component (force units) Fy (Union[float, Sequence[float]]): Vertical load component (force units) rotation (Union[float, Sequence[float]]): Rotation angle in degrees absolute_location (Optional[float]): Absolute location along the beam length (length units). Either absolute_location or relative_location must be provided. relative_location (Optional[float]): Relative location along the beam length (0.0 = start of span, 1.0 = end of span). Either absolute_location or relative_location must be provided. spans (Optional[Union[int, Sequence[int]]]): Span(s) to apply the load to. If None, applies to all spans. tolerance (float): Tolerance for matching existing node locations (length units). Defaults to beam length * 1e-4. .. py:method:: validate() -> bool Validate beam geometry and connectivity. Checks for common beam definition issues: - All node IDs in span lists reference valid nodes - No duplicate nodes at the same location - All elements have non-zero length Returns: bool: True if validation passes Raises: ValueError: If validation fails with description of the issue .. py:method:: show_structure() -> None Display the beam structure using matplotlib.