> ## 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.

# Structure IRockyContactScalars

![][C++]
![][public]

**#include \<rocky\_contact\_scalars.hpp>**

During the iterative process of a simulation, `IRockyContactScalars` gives access to all contact scalars defined in the project. These contact scalars can be built-in scalars defined in the Rocky solver, as well as custom contact scalars defined by the current module or other active modules.

**Inherits from**:

* EntityScalars\< rocky20::ContactScalars >

## Members

* [add\_scalar](#structIRockyContactScalars_1a67c155eff0d5724c29859512b0d994de)
* [get\_scalar](#structIRockyContactScalars_1ad4f28cca964b58258b7011f0dc59040d)
* [max\_scalar](#structIRockyContactScalars_1a6413332aeb968cdc28e96a351deb3bcb)
* [set\_scalar](#structIRockyContactScalars_1abdde96805bdced6ebf4f7c2a1b5d9a70)

## Public functions

### Function get\_scalar

![][public]
![][const]

```cpp theme={null}
ROCKY_FUNCTIONS double IRockyContactScalars::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**:

* **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.

**Parameters**:

* int **scalar\_index**

**Return type**: ROCKY\_FUNCTIONS double

### Function set\_scalar

![][public]
![][const]

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyContactScalars::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**:

* **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.

**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

### Function add\_scalar

![][public]
![][const]

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyContactScalars::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**:

* **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.\


**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

### Function max\_scalar

![][public]
![][const]

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyContactScalars::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**:

* **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.

**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"

[const]: https://img.shields.io/badge/-const-lightblue "const"
