    

 ## On this page

  

 

 # IRockySPHElementInteraction Struct Reference

 Last update: 16.07.2025 

`#include <<a class="el" href="rocky__sph__interaction__api_8hpp_source.xhtml">rocky_sph_interaction_api.hpp</a>>`

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

ROCKY\_FUNCTIONS float3 [calculate\_elements\_distance](#a72569f88c7d9a22615a3287ab7df33db) () const ROCKY\_FUNCTIONS float3 [calculate\_elements\_relative\_velocity](#a14f9867d6104ce395f3a1d48a03fd9c8) () const ROCKY\_FUNCTIONS float3 [get\_home\_element\_velocity](#acec345cb590d324b9729b8842b777906) () const ROCKY\_FUNCTIONS float3 [get\_near\_element\_velocity](#aa71223f8afaf50df1e511041157ba890) () const ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) [get\_home\_element](#a7eb0236ba9b25b58b0ca258b1e79976b) () const ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) [get\_near\_element](#a0e9d2687e1c8a66357730003f850fe26) () const ROCKY\_FUNCTIONS void [add\_force](#a1ee1b8234e2660a09b7b1a7fe3ba0e07) (float3 force) ROCKY\_FUNCTIONS void [add\_acceleration](#a713381036ee74bb8476435037c14124b) (float3 acceleration) <a id="details" name="details"></a>## Detailed Description

`<a class="el" href="structIRockySPHElementInteraction.xhtml">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*.



## Member Function Documentation

<a id="a713381036ee74bb8476435037c14124b" name="a713381036ee74bb8476435037c14124b"></a>## [◆ ](#a713381036ee74bb8476435037c14124b)add\_acceleration()

 ROCKY\_FUNCTIONS void IRockySPHElementInteraction::add\_acceleration  ( float3 *acceleration*) 

By using this method, a SPH module can pass custom calculated accelerations to the Rockysolver, so they are added to the SPH elements associated in the referred *SPH element interaction*.Parameters accelerationThe acceleration to be added to the SPH elements, expressed in Cartesian coordinates. 



<a id="a1ee1b8234e2660a09b7b1a7fe3ba0e07" name="a1ee1b8234e2660a09b7b1a7fe3ba0e07"></a>## [◆ ](#a1ee1b8234e2660a09b7b1a7fe3ba0e07)add\_force()

 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 forceThe force to be applied to the SPH elements, expressed in Cartesian coordinates. 



<a id="a72569f88c7d9a22615a3287ab7df33db" name="a72569f88c7d9a22615a3287ab7df33db"></a>## [◆ ](#a72569f88c7d9a22615a3287ab7df33db)calculate\_elements\_distance()

 ROCKY\_FUNCTIONS float3 IRockySPHElementInteraction::calculate\_elements\_distance  ( )  const

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



<a id="a14f9867d6104ce395f3a1d48a03fd9c8" name="a14f9867d6104ce395f3a1d48a03fd9c8"></a>## [◆ ](#a14f9867d6104ce395f3a1d48a03fd9c8)calculate\_elements\_relative\_velocity()

 ROCKY\_FUNCTIONS float3 IRockySPHElementInteraction::calculate\_elements\_relative\_velocity  ( )  const

ReturnsThe relative velocity vector between the two neighbor SPH elements. 



<a id="a7eb0236ba9b25b58b0ca258b1e79976b" name="a7eb0236ba9b25b58b0ca258b1e79976b"></a>## [◆ ](#a7eb0236ba9b25b58b0ca258b1e79976b)get\_home\_element()

 ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) IRockySPHElementInteraction::get\_home\_element  ( )  const

ReturnsAn `<a class="el" href="structIRockySPHElement.xhtml">IRockySPHElement</a>` object representing the SPH element labeled as *home* in the *SPH interaction*. 



<a id="acec345cb590d324b9729b8842b777906" name="acec345cb590d324b9729b8842b777906"></a>## [◆ ](#acec345cb590d324b9729b8842b777906)get\_home\_element\_velocity()

 ROCKY\_FUNCTIONS float3 IRockySPHElementInteraction::get\_home\_element\_velocity  ( )  const

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



<a id="a0e9d2687e1c8a66357730003f850fe26" name="a0e9d2687e1c8a66357730003f850fe26"></a>## [◆ ](#a0e9d2687e1c8a66357730003f850fe26)get\_near\_element()

 ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) IRockySPHElementInteraction::get\_near\_element  ( )  const

ReturnsAn `<a class="el" href="structIRockySPHElement.xhtml">IRockySPHElement</a>` object representing the SPH element labeled as *near* in the *SPH element interaction*. 



<a id="aa71223f8afaf50df1e511041157ba890" name="aa71223f8afaf50df1e511041157ba890"></a>## [◆ ](#aa71223f8afaf50df1e511041157ba890)get\_near\_element\_velocity()

 ROCKY\_FUNCTIONS float3 IRockySPHElementInteraction::get\_near\_element\_velocity  ( )  const

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