> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IRockyJointScalars Struct Reference

`#include <rocky_joint_scalars.hpp>`

Inherits EntityScalars\< rocky20::JointScalars >.

## Public Member Functions

| Type | Name |
| - | - |
| ROCKY\_FUNCTIONS double | [get\_scalar](#a99bd176be9958223d6dc2a9e62f7ec30) (int scalar\_index) const |
| ROCKY\_FUNCTIONS void | [set\_scalar](#a41d7ac3675a9d3ee3e79cd79c9de1f26) (int scalar\_index, double value) const |
| ROCKY\_FUNCTIONS void | [add\_scalar](#abc05fdd6e7595ea79f4fa0aeafd93552) (int scalar\_index, double value) const |
| ROCKY\_FUNCTIONS void | [max\_scalar](#a5e95059b8068dc460f40119e2a58d32f) (int scalar\_index, double value) const |

## Detailed Description

When running a simulation an [`IRockyJointScalars`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockyJointScalars) object gives access to all joint scalars defined in the project. These joint scalars can be built-in scalars defined in the solver, or custom joint scalars defined by the current module or other active modules.

## Member Function Documentation

### add\_scalar()

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyJointScalars::add_scalar(
    int scalar_index,
    double value
) const
```

**If a custom scalar variable was defined during the setup of the module,**

this method can be used to sum a value to the current one stored in it.

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The integer index that was associated to the scalar variable during the setup of the module. |
| value | The value that must be summed to the current stored value. |

### get\_scalar()

```cpp theme={null}
ROCKY_FUNCTIONS double IRockyJointScalars::get_scalar(int scalar_index) const
```

**If a custom scalar variable was defined during the setup of the module,**

the value currently stored can be accessed with this method.

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The integer index that was associated to the scalar variable during the setup of the module. |

**Returns**

The value currently stored in the scalar variable.

### max\_scalar()

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyJointScalars::max_scalar(
    int scalar_index,
    double value
) const
```

**If a custom scalar variable was defined during the setup of the module,**

this method can be used to make the scalar store the maximum of a set of values. A common use of this method is, for instance, to find the maximum among a set of values associated to the contacts of a particle.

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The integer index that was associated to the scalar variable during the setup of the module. |
| value | A value that must be checked if it is greater than the current stored value. |

### set\_scalar()

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyJointScalars::set_scalar(
    int scalar_index,
    double value
) const
```

**If a custom scalar variable was defined during the setup of the module,**

this method can be used to store a value on it.

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The integer index that was associated to the scalar variable during the setup of the module. |
| value | The value that must be stored. |
