Skip to content

compas_cem.equilibrium ¤

The form-finding algorithm that solves a topology diagram for static equilibrium.

Functions:¤

static_equilibrium ¤

static_equilibrium(
    topology, kmax=None, tmax=100, eta=1e-06, verbose=False, callback=None
)

Generate a form diagram in static equilibrium.

Parameters:

  • topology (:class:`compas_cem.diagrams.TopologyDiagram`) –

    A topology diagram.

  • kmax (``int``, default: None ) –

    The last sequence in the diagram to calculate equilibrium at. If kmax is None or the number of sequences in the diagram is smaller, then kmax will be ignored and equilibrium will be calculated for all sequences. Defaults to None.

  • tmax (``int``, default: 100 ) –

    Maximum number of iterations the algorithm will run for. Defaults to 100.

  • eta (``float``, default: 1e-06 ) –

    Distance threshold that marks equilibrium convergence. This threshold is compared against the sum of distances of the nodes' positions from one iteration to the next one. If eta is hit before consuming tmax iterations, calculations will stop early. Defaults to 1e-6.

  • verbose (``bool``, default: False ) –

    Flag to print out internal operations. Defaults to False.

  • callback (``function``, default: None ) –

    An optional callback function to run at every iteration. Defaults to None.

Returns:

  • form ( :class:`compas_cem.diagrams.FormDiagram` ) –

    A form diagram.

Source code in src/compas_cem/equilibrium/force.py
def static_equilibrium(
    topology, kmax=None, tmax=100, eta=1e-6, verbose=False, callback=None
):
    """
    Generate a form diagram in static equilibrium.

    Parameters
    ----------
    topology : :class:`compas_cem.diagrams.TopologyDiagram`
        A topology diagram.
    kmax : ``int``, optional
        The last sequence in the diagram to calculate equilibrium at.
        If ``kmax`` is ``None`` or the number of sequences in the diagram is smaller,
        then ``kmax`` will be ignored and equilibrium will be calculated for all sequences.
        Defaults to ``None``.
    tmax : ``int``, optional
        Maximum number of iterations the algorithm will run for.
        Defaults to ``100``.
    eta : ``float``, optional
        Distance threshold that marks equilibrium convergence.
        This threshold is compared against the sum of distances of the nodes'
        positions from one iteration to the next one.
        If ``eta`` is hit before consuming ``tmax`` iterations, calculations
        will stop early.
        Defaults to ``1e-6``.
    verbose : ``bool``, optional
        Flag to print out internal operations.
        Defaults to ``False``.
    callback : ``function``, optional
        An optional callback function to run at every iteration.
        Defaults to ``None``.

    Returns
    -------
    form : :class:`compas_cem.diagrams.FormDiagram`
        A form diagram.
    """
    attrs = equilibrium_state(topology, kmax, tmax, eta, verbose, callback)
    form = FormDiagram.from_topology_diagram(topology)
    form_update(form, **attrs)
    return form

static_equilibrium_numpy ¤

static_equilibrium_numpy(topology, tmax=100, eta=1e-06, verbose=False, callback=None)

Generate a form diagram in static equilibrium using numpy.

Parameters:

  • topology (:class:`compas_cem.diagrams.TopologyDiagram`) –

    A topology diagram.

  • tmax (``int``, default: 100 ) –

    Maximum number of iterations the algorithm will run for. Defaults to 100.

  • eta (``float``, default: 1e-06 ) –

    Distance threshold that marks equilibrium convergence. This threshold is compared against the sum of distances of the nodes' positions from one iteration to the next one. If eta is hit before consuming tmax iterations, calculations will stop early. Defaults to 1e-6.

  • verbose (``bool``, default: False ) –

    Flag to print out internal operations. Defaults to False.

  • callback (``function``, default: None ) –

    An optional callback function to run at every iteration. Defaults to None.

Returns:

  • form ( :class:`compas_cem.diagrams.FormDiagram` ) –

    A form diagram.

Source code in src/compas_cem/equilibrium/force_numpy.py
def static_equilibrium_numpy(
    topology, tmax=100, eta=1e-6, verbose=False, callback=None
):
    """
    Generate a form diagram in static equilibrium using numpy.

    Parameters
    ----------
    topology : :class:`compas_cem.diagrams.TopologyDiagram`
        A topology diagram.
    tmax : ``int``, optional
        Maximum number of iterations the algorithm will run for.
        Defaults to ``100``.
    eta : ``float``, optional
        Distance threshold that marks equilibrium convergence.
        This threshold is compared against the sum of distances of the nodes'
        positions from one iteration to the next one.
        If ``eta`` is hit before consuming ``tmax`` iterations, calculations
        will stop early.
        Defaults to ``1e-6``.
    verbose : ``bool``, optional
        Flag to print out internal operations.
        Defaults to ``False``.
    callback : ``function``, optional
        An optional callback function to run at every iteration.
        Defaults to ``None``.

    Returns
    -------
    form : :class:`compas_cem.diagrams.FormDiagram`
        A form diagram.
    """
    attrs = equilibrium_state_numpy(topology, tmax, eta, verbose, callback)
    form = FormDiagram.from_topology_diagram(topology)
    form_update(form, **attrs)
    return form