    

 ## On this page

  

 

 # Structure IRockySPHElementInteraction

 Last update: 09.03.2026 

<a id="structIRockySPHElementInteraction"></a>

![](https://img.shields.io/badge/language-C%2B%2B-blue "C++")![](https://img.shields.io/badge/-public-brightgreen "public")

**\#include &lt;rocky\_sph\_interaction\_api.hpp&gt;**

`<a href="structIRockySPHElementInteraction.md#structIRockySPHElementInteraction">IRockySPHElementInteraction</a>` is a code representation of a pair of neighbor SPH elements within the support region of each other, i.e. they have a force interaction between them. Within Rocky, this pair is usually called *SPH element interaction*.

## Members

- [add\_acceleration](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a713381036ee74bb8476435037c14124b)
- [add\_force](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a1ee1b8234e2660a09b7b1a7fe3ba0e07)
- [calculate\_elements\_distance](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a72569f88c7d9a22615a3287ab7df33db)
- [calculate\_elements\_relative\_velocity](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a14f9867d6104ce395f3a1d48a03fd9c8)
- [get\_home\_element](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a7eb0236ba9b25b58b0ca258b1e79976b)
- [get\_home\_element\_velocity](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1acec345cb590d324b9729b8842b777906)
- [get\_near\_element](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1a0e9d2687e1c8a66357730003f850fe26)
- [get\_near\_element\_velocity](structIRockySPHElementInteraction.md#structIRockySPHElementInteraction_1aa71223f8afaf50df1e511041157ba890)

## Public functions

### Function calculate\_elements\_distance

<a id="structIRockySPHElementInteraction_1a72569f88c7d9a22615a3287ab7df33db"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::calculate_elements_distance() const

```

**Returns**:

The vector that joins the points at which the two neighbor SPH elements are located.

**Return type**: ROCKY\_FUNCTIONS float3

### Function calculate\_elements\_relative\_velocity

<a id="structIRockySPHElementInteraction_1a14f9867d6104ce395f3a1d48a03fd9c8"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::calculate_elements_relative_velocity() const

```

**Returns**:

The relative velocity vector between the two neighbor SPH elements.

**Return type**: ROCKY\_FUNCTIONS float3

### Function get\_home\_element\_velocity

<a id="structIRockySPHElementInteraction_1acec345cb590d324b9729b8842b777906"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::get_home_element_velocity() const

```

**Returns**:

The velocity vector of the SPH element labeled as *home* in the SPH interaction.

**Return type**: ROCKY\_FUNCTIONS float3

### Function get\_near\_element\_velocity

<a id="structIRockySPHElementInteraction_1aa71223f8afaf50df1e511041157ba890"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::get_near_element_velocity() const

```

**Returns**:

The velocity vector of the SPH element labeled as *near* in the SPH interaction.

**Return type**: ROCKY\_FUNCTIONS float3

### Function get\_home\_element

<a id="structIRockySPHElementInteraction_1a7eb0236ba9b25b58b0ca258b1e79976b"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS IRockySPHElement IRockySPHElementInteraction::get_home_element() const

```

**Returns**:

An `<a href="structIRockySPHElement.md#structIRockySPHElement">IRockySPHElement</a>` object representing the SPH element labeled as *home* in the *SPH interaction*.

**Return type**: ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.md#structIRockySPHElement)

### Function get\_near\_element

<a id="structIRockySPHElementInteraction_1a0e9d2687e1c8a66357730003f850fe26"></a>

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
ROCKY_FUNCTIONS IRockySPHElement IRockySPHElementInteraction::get_near_element() const

```

**Returns**:

An `<a href="structIRockySPHElement.md#structIRockySPHElement">IRockySPHElement</a>` object representing the SPH element labeled as *near* in the *SPH element interaction*.

**Return type**: ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.md#structIRockySPHElement)

### Function add\_force

<a id="structIRockySPHElementInteraction_1a1ee1b8234e2660a09b7b1a7fe3ba0e07"></a>

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

```cpp
ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_force(float3 force)

```

**By using this method, a SPH module can pass custom calculated forces to the Rocky solver,**:

so they are applied to the SPH elements associated to the referred *SPH element interaction*.

**Parameters**:

- **force**: The force to be applied to the SPH elements, expressed in Cartesian coordinates.

**Parameters**:

- float3 **force**

**Return type**: ROCKY\_FUNCTIONS void

### Function add\_acceleration

<a id="structIRockySPHElementInteraction_1a713381036ee74bb8476435037c14124b"></a>

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

```cpp
ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_acceleration(float3 acceleration)

```

**By using this method, a SPH module can pass custom calculated accelerations to the Rocky**:

solver, so they are added to the SPH elements associated in the referred *SPH element interaction*.

**Parameters**:

- **acceleration**: The acceleration to be added to the SPH elements, expressed in Cartesian coordinates.

**Parameters**:

- float3 **acceleration**

**Return type**: ROCKY\_FUNCTIONS void