pycba.utils.supports_to_R#
- supports_to_R(supports, n_nodes=None)[source]#
Lower a per-node list of named supports to a raw restraint vector
R.This is the friendly front-end to the low-level
Rvector used throughout PyCBA: one entry per node (left to right), each either a support name or a raw[vertical, rotation]DOF pair. The result is exactly theRyou would otherwise write by hand, sosupports=andR=are interchangeable on theBeam/BeamAnalysisconstructors.Recognised names (case-insensitive):
"p"/"pin"/"pinned"and"r"/"roller"->[-1, 0](vertical held, rotation free)."e"/"encastre"/"fixed"/"clamped"->[-1, -1](fully fixed)."f"/"free"->[0, 0](unrestrained, e.g. a cantilever tip).
Elastic springs are given as a raw pair, e.g.
[5e4, 0]for a vertical spring (stiffness5e4) with the rotation free.An internal hinge is not a support (it is a member moment release) and is rejected; release the moment on the adjacent member via its element type instead.
- Parameters:
supports (
Sequence[Union[str,Sequence[float]]]) – One entry per node, ordered left to right.n_nodes (
Optional[int]) – Expected number of nodes (= number of spans + 1). If given, the length ofsupportsis validated against it for a clear early error.
- Returns:
The restraint vector
Rof length2 * len(supports).- Return type:
list- Raises:
ValueError – If
n_nodesis given and does not matchlen(supports), or any entry is not a recognised name or valid[vertical, rotation]pair.