Back

FixedProjectiveConstraint

This component fixes certain degrees of freedom of the mechanical model to constant values.

abstract
The FixedProjectiveConstraint fixes certain degrees of freedom in a mechanical model to their initial positions, optionally projecting zero velocity. It can be configured to fix all DOFs or visualize the fixed constraints.
sheet
# FixedProjectiveConstraint **Overview**: The `FixedProjectiveConstraint` component enforces certain degrees of freedom (DOFs) within a mechanical model to remain at their initial positions over time, optionally projecting zero velocity. It inherits from `ProjectiveConstraintSet` and interacts with the topology container to apply constraints. **Mathematical Model**: For a given point $i$ whose DOFs are fixed, - Position constraint: \[ \mathbf{x}_i(t) = \mathbf{c}_i \quad \forall t, \] where $\mathbf{c}_i$ is the initial position. - Velocity projection (if `d_projectVelocity` is true): \[ \mathbf{v}_i(t) = \frac{d\mathbf{x}_i}{dt} = 0. \] The constraints are applied by modifying system matrices to enforce fixed positions and velocities. **Parameters and Data**: - `fixAll`: bool, filter all DOFs to implement a fixed object (default: false). - `showObject`: bool, draw or not the fixed constraints (default: false). - `drawSize`: SReal, size of rendered particles (0 for point-based rendering, >0 for sphere radius) (default: 1.0). - `activate_projectVelocity`: bool, project zero velocity if true (default: false). **Dependencies and Connections**: Requires a topology container (`BaseMeshTopology`) to apply constraints. **Practical Notes**: Ensure proper configuration of indices or use `fixAll` for global fixation. Setting `d_projectVelocity` ensures zero velocity projection.
name
FixedConstraint
description
This component fixes certain degrees of freedom of the mechanical model to constant values.
parameters
  • {'name': 'drawSize', 'type': 'float', 'description': 'Draw size used for drawing points as spheres instead of small dots. Set to 0 to use classical point drawing.'}
  • {'name': 'indices', 'type': 'list of int', 'description': "List of point indices that will be fixed. When the 'fixAll' option is set to true, this list is ignored and all points are fixed."}
  • {'name': 'showObject', 'type': 'bool', 'description': 'Enable or disable the visualization of the constraint in the visualizer.'}
  • {'name': 'projectVelocity', 'type': 'bool', 'description': 'If set to true, the velocity of the fixed points will also be projected to zero. This is useful when a new point becomes fixed while its velocity is non-zero, otherwise it may drift away.'}
  • {'name': 'fixAll', 'type': 'bool', 'description': "If set to true, all points in the model are fixed regardless of the 'indices' list."}
inputLinks
  • {'name': 'mechanicalState', 'type': 'MechanicalState', 'description': 'The mechanical state on which this constraint operates. This is generally a deformable object or particle system that contains positions, velocities and forces for each point.'}
maths
The **FixedConstraint** component in the Simulation Open Framework Architecture (SOFA) is designed to enforce certain degrees of freedom (DOFs) within a mechanical model to remain constant over time. This functionality can be crucial for simulating various physical systems where some parts must not move or are constrained to specific positions, such as boundary conditions in solid mechanics problems. ### Mathematical Formulation: 1. **Definition**: The constraint is defined by fixing the position and optionally the velocity of a set of points (DOFs) within the mechanical model. Mathematically, for a given point $i$ whose DOFs are to be fixed, its position $ extbf{x}_i(t)$ at time $t$ should remain constant, i.e., \[ extbf{x}_i(t) = extbf{c}_i \quad \forall t, \] where $ extbf{c}_i$ is the fixed position. 2. **Fixing Velocities**: If the `d_projectVelocity` option is set to true, the velocity $ extbf{v}_i(t)$ of these points must also be zero at all times: \[ extbf{v}_i(t) = rac{d extbf{x}_i}{dt} = 0. \] 3. **Matrix Representation**: In the context of matrix integration, this constraint is often incorporated into the system matrices by setting the corresponding rows and columns to identity for the fixed DOFs. This ensures that these points remain at their prescribed positions: - For a point $i$ with position $ extbf{x}_i$, \[ extbf{A} = \begin{pmatrix} 1 & 0 & 0 & ... & 0 \\ 0 & 1 & 0 & ... & 0 \\ ... & ... & ... & ... & ... \\ 0 & 0 & 0 & ... & 1 \end{pmatrix}, \] where the matrix $ extbf{A}$ is applied to enforce $\textbf{x}_i = extbf{c}_i$. ### Integration and Constraint Enforcement: The **FixedConstraint** component works in conjunction with other components that handle integration (e.g., explicit or implicit integrators). During the simulation, the constraint forces are computed such that any movement from the fixed positions is prevented. The algorithm applies constraints as follows during each integration step: 1. **Projection Step**: Project the velocities and positions of constrained points onto their fixed values after computing the forces and accelerations. \[ extbf{x}_i^{k+1} = extbf{c}_i,\quad \textbf{v}_i^{k+1} = 0, \] where $k$ denotes the time step index. 2. **Matrix Operations**: The constraints are also applied by modifying the system matrix $ extbf{A}$ and vector $ extbf{b}$ during each iteration of the linear solver (if used), setting the appropriate rows to enforce fixed positions. ### Physical Interpretation: Physically, this constraint can be interpreted as attaching a rigid support or an infinitely stiff spring at certain points. These points act as boundary conditions that do not allow any movement under external forces. This is particularly useful for simulating mechanical systems with fixed boundaries, such as the base of a bridge being pinned to the ground. ### Usage and Configuration: The FixedConstraint can be configured by specifying which DOFs (points) are to be fixed through indices or by setting `d_fixAll` to true. Additionally, the `d_projectVelocity` option ensures that any initial velocity of these points is set to zero if they are newly added as constraints during runtime. ### Visualization: For visualization purposes, the component draws spheres (or points) at fixed positions with a configurable size for better visual representation and understanding of the simulation setup.
{
  "name": "FixedProjectiveConstraint",
  "main": {
    "name": "FixedProjectiveConstraint",
    "namespace": "sofa::component::constraint::projective",
    "module": "Sofa.Component.Constraint.Projective",
    "include": "sofa/component/constraint/projective/FixedProjectiveConstraint.h",
    "doc": "Attach given particles to their initial positions.\n\nMaintain a constant velocity.\nIf the particle is initially fixed then it is attached to its initial position.\nOtherwise it keeps on drifting.\nFor maintaining particles fixed in any case, @sa PointProjectiveConstraint",
    "inherits": [
      "ProjectiveConstraintSet"
    ],
    "templates": [
      "sofa::defaulttype::Rigid2Types",
      "sofa::defaulttype::Rigid3Types",
      "sofa::defaulttype::Vec3Types"
    ],
    "data_fields": [
      {
        "name": "d_fixAll",
        "type": "bool",
        "xmlname": "fixAll",
        "help": "filter all the DOF to implement a fixed object"
      },
      {
        "name": "d_showObject",
        "type": "bool",
        "xmlname": "showObject",
        "help": "draw or not the fixed constraints"
      },
      {
        "name": "d_drawSize",
        "type": "SReal",
        "xmlname": "drawSize",
        "help": "Size of the rendered particles (0 -> point based rendering, >0 -> radius of spheres)"
      },
      {
        "name": "d_projectVelocity",
        "type": "bool",
        "xmlname": "activate_projectVelocity",
        "help": "if true, projects not only a constant but a zero velocity"
      }
    ],
    "links": [
      {
        "name": "l_topology",
        "target": "BaseMeshTopology",
        "kind": "single",
        "xmlname": "topology",
        "help": "link to the topology container"
      }
    ],
    "methods": [
      {
        "name": "clearConstraints",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "addConstraint",
        "return_type": "void",
        "params": [
          {
            "name": "index",
            "type": "int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "removeConstraint",
        "return_type": "void",
        "params": [
          {
            "name": "index",
            "type": "int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "init",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "reinit",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "projectResponse",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "resData",
            "type": "DataVecDeriv &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "projectVelocity",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "vData",
            "type": "DataVecDeriv &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "projectPosition",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "xData",
            "type": "DataVecCoord &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "projectJacobianMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "cData",
            "type": "DataMatrixDeriv &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "applyConstraint",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "matrix",
            "type": "const sofa::core::behavior::MultiMatrixAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "applyConstraint",
        "return_type": "void",
        "params": [
          {
            "name": "mparams",
            "type": "const core::MechanicalParams *"
          },
          {
            "name": "vect",
            "type": "linearalgebra::BaseVector *"
          },
          {
            "name": "matrix",
            "type": "const sofa::core::behavior::MultiMatrixAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "projectMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "sofa::linearalgebra::BaseMatrix *"
          },
          {
            "name": "",
            "type": "unsigned int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "applyConstraint",
        "return_type": "void",
        "params": [
          {
            "name": "matrix",
            "type": "sofa::core::behavior::ZeroDirichletCondition *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "computeBBox",
        "return_type": "void",
        "params": [
          {
            "name": "params",
            "type": "const core::ExecParams *"
          },
          {
            "name": "onlyVisible",
            "type": "bool"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "draw",
        "return_type": "void",
        "params": [
          {
            "name": "vparams",
            "type": "const core::visual::VisualParams *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "fixAllDOFs",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "checkIndices",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "computeBBoxForIndices",
        "return_type": "void",
        "params": [
          {
            "name": "indices",
            "type": "const int &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      }
    ]
  },
  "desc": {
    "name": "FixedConstraint",
    "description": "This component fixes certain degrees of freedom of the mechanical model to constant values.",
    "parameters": [
      {
        "name": "drawSize",
        "type": "float",
        "description": "Draw size used for drawing points as spheres instead of small dots. Set to 0 to use classical point drawing."
      },
      {
        "name": "indices",
        "type": "list of int",
        "description": "List of point indices that will be fixed. When the 'fixAll' option is set to true, this list is ignored and all points are fixed."
      },
      {
        "name": "showObject",
        "type": "bool",
        "description": "Enable or disable the visualization of the constraint in the visualizer."
      },
      {
        "name": "projectVelocity",
        "type": "bool",
        "description": "If set to true, the velocity of the fixed points will also be projected to zero. This is useful when a new point becomes fixed while its velocity is non-zero, otherwise it may drift away."
      },
      {
        "name": "fixAll",
        "type": "bool",
        "description": "If set to true, all points in the model are fixed regardless of the 'indices' list."
      }
    ],
    "inputLinks": [
      {
        "name": "mechanicalState",
        "type": "MechanicalState",
        "description": "The mechanical state on which this constraint operates. This is generally a deformable object or particle system that contains positions, velocities and forces for each point."
      }
    ]
  },
  "maths": {
    "maths": "The **FixedConstraint** component in the Simulation Open Framework Architecture (SOFA) is designed to enforce certain degrees of freedom (DOFs) within a mechanical model to remain constant over time. This functionality can be crucial for simulating various physical systems where some parts must not move or are constrained to specific positions, such as boundary conditions in solid mechanics problems.\n\n### Mathematical Formulation:\n\n1. **Definition**: The constraint is defined by fixing the position and optionally the velocity of a set of points (DOFs) within the mechanical model. Mathematically, for a given point $i$ whose DOFs are to be fixed, its position $\textbf{x}_i(t)$ at time $t$ should remain constant, i.e.,\n\n   \\[\n   \textbf{x}_i(t) = \textbf{c}_i \\quad \\forall t,\n   \\]\n   where $\textbf{c}_i$ is the fixed position.\n\n2. **Fixing Velocities**: If the `d_projectVelocity` option is set to true, the velocity $\textbf{v}_i(t)$ of these points must also be zero at all times:\n\n   \\[\n   \textbf{v}_i(t) = \frac{d\textbf{x}_i}{dt} = 0.\n   \\]\n\n3. **Matrix Representation**: In the context of matrix integration, this constraint is often incorporated into the system matrices by setting the corresponding rows and columns to identity for the fixed DOFs. This ensures that these points remain at their prescribed positions:\n\n   - For a point $i$ with position $\textbf{x}_i$,\n     \\[\n     \textbf{A} =\n     \\begin{pmatrix}\n       1 & 0 & 0 & ... & 0 \\\\\n       0 & 1 & 0 & ... & 0 \\\\\n       ... & ... & ... & ... & ... \\\\\n       0 & 0 & 0 & ... & 1\n     \\end{pmatrix},\n     \\]\n   where the matrix $\textbf{A}$ is applied to enforce $\\textbf{x}_i = \textbf{c}_i$.\n\n### Integration and Constraint Enforcement:\n\nThe **FixedConstraint** component works in conjunction with other components that handle integration (e.g., explicit or implicit integrators). During the simulation, the constraint forces are computed such that any movement from the fixed positions is prevented. The algorithm applies constraints as follows during each integration step:\n\n1. **Projection Step**: Project the velocities and positions of constrained points onto their fixed values after computing the forces and accelerations.\n   \\[\n   \textbf{x}_i^{k+1} = \textbf{c}_i,\\quad \\textbf{v}_i^{k+1} = 0,\n   \\]\n   where $k$ denotes the time step index.\n\n2. **Matrix Operations**: The constraints are also applied by modifying the system matrix $\textbf{A}$ and vector $\textbf{b}$ during each iteration of the linear solver (if used), setting the appropriate rows to enforce fixed positions.\n\n### Physical Interpretation:\n\nPhysically, this constraint can be interpreted as attaching a rigid support or an infinitely stiff spring at certain points. These points act as boundary conditions that do not allow any movement under external forces. This is particularly useful for simulating mechanical systems with fixed boundaries, such as the base of a bridge being pinned to the ground.\n\n### Usage and Configuration:\n\nThe FixedConstraint can be configured by specifying which DOFs (points) are to be fixed through indices or by setting `d_fixAll` to true. Additionally, the `d_projectVelocity` option ensures that any initial velocity of these points is set to zero if they are newly added as constraints during runtime.\n\n### Visualization:\n\nFor visualization purposes, the component draws spheres (or points) at fixed positions with a configurable size for better visual representation and understanding of the simulation setup.\n"
  },
  "summary": {
    "abstract": "The FixedProjectiveConstraint fixes certain degrees of freedom in a mechanical model to their initial positions, optionally projecting zero velocity. It can be configured to fix all DOFs or visualize the fixed constraints.",
    "sheet": "# FixedProjectiveConstraint\n\n**Overview**: The `FixedProjectiveConstraint` component enforces certain degrees of freedom (DOFs) within a mechanical model to remain at their initial positions over time, optionally projecting zero velocity. It inherits from `ProjectiveConstraintSet` and interacts with the topology container to apply constraints.\n\n**Mathematical Model**: For a given point $i$ whose DOFs are fixed,\n- Position constraint: \n  \\[ \\mathbf{x}_i(t) = \\mathbf{c}_i \\quad \\forall t, \\]\nwhere $\\mathbf{c}_i$ is the initial position.\n- Velocity projection (if `d_projectVelocity` is true):\n  \\[ \\mathbf{v}_i(t) = \\frac{d\\mathbf{x}_i}{dt} = 0. \\]\nThe constraints are applied by modifying system matrices to enforce fixed positions and velocities.\n\n**Parameters and Data**: \n- `fixAll`: bool, filter all DOFs to implement a fixed object (default: false).\n- `showObject`: bool, draw or not the fixed constraints (default: false).\n- `drawSize`: SReal, size of rendered particles (0 for point-based rendering, >0 for sphere radius) (default: 1.0).\n- `activate_projectVelocity`: bool, project zero velocity if true (default: false).\n\n**Dependencies and Connections**: Requires a topology container (`BaseMeshTopology`) to apply constraints.\n\n**Practical Notes**: Ensure proper configuration of indices or use `fixAll` for global fixation. Setting `d_projectVelocity` ensures zero velocity projection."
  }
}