Skip to main content
#include <rocky_triangle_scalars.hpp> IRockyTriangleScalarsModel allows users to add new triangle scalars, find triangle scalars created in other modules or activate triangle scalars known to Rocky, during the setup phase of a module. Triangle scalars are special variables attached to boundary triangles, which are able to store values per triangle that are preserved between time iterations during a simulation. Inherits from:
  • ScalarsModel< rocky20::TriangleScalarsController >

Members

Public functions

Function find

This method searches for a scalar variable already created by other modules,: in order to allow access to its values, or store new values on it, during the execution of the simulation. Parameters:
  • name: The name given to the scalar at the moment of its creation.
Returns: The index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise. Parameters:
  • const char * name
Return type: int

Function add

This method creates a new scalar variable of type double: for storing custom values during a simulation, preserving them between time iterations. Parameters:
  • name: The name given to the scalar variable. The purpose of this name is twofold. First, it enables to find this scalar variable from other module, in order to share their values. Second, if the scalar variable can be displayed in a 3D window as a property, this name will identify it in the Rocky UI.
  • unit: A string specifying the unit in S.I. associated to the scalar variable.
  • output: Enables/disables the storage in disk at output times, for the visualization and post-processing of the scalar values.
Returns: The index that will uniquely identify the scalar variable during the execution of the simulation. Parameters:
  • const char * name
  • const char * unit
  • bool output = true
Return type: int

Function add_accumulation_scalar

This method creates a new scalar variable of type defined by template parameter: data_type for storing custom values during a simulation, preserving them between time iterations. The scalar added with this method has a special behavior defined for pulling data from devices in multi-gpu simulations: It will accumulate those values in the host memory. Parameters:
  • name: The name given to the scalar variable. The purpose of this name is twofold. First, it enables to find this scalar variable from other module, in order to share their values. Second, if the scalar variable can be displayed in a 3D window as a property, this name will identify it in the Rocky UI.
  • unit: A string specifying the unit in S.I. associated to the scalar variable.
  • output: Enables/disables the storage in disk at output times, for the visualization and post-processing of the scalar values.
Returns: The index that will uniquely identify the scalar variable during the execution of the simulation. Parameters:
  • const char * name
  • const char * unit
  • bool output = true
Return type: int

Function reset

This method resets to zero all values stored in a scalar variable.: Parameters:
  • scalar_index: The index attributed to the scalar variable at the moment of its creation.
Parameters:
  • int scalar_index
Return type: void

Function set_dimension

The purpose of this method is to associate a dimensional factor: to a scalar variable. This factor will be used to nondimensionalize their values. For instance, if the scalar represents a force, a force dimensional factor must be associated through this method. Dimensional factors for the fundamental magnitudes are provided by functions of a IRockyModel object. Parameters:
  • scalar_index: The index attributed to the scalar variable at the moment of its creation.
  • dimension_factor: The appropriate dimensional factor for the scalar variable.
Parameters:
  • int scalar_index
  • double dimension_factor
Return type: void

Function enable_storage_of_exchanged_heat

**This method activates an internal triangle scalar that accumulates the heat **: exchanged by geometry triangles with surrounding particles and/or SPH fluid elements during a simulation. The value of this scalar at each geometry triangle and at a given time will be equal to the sum of the heat received by the triangle from all particles and/or SPH elements that interacted with it since the last reset event, which is triggered by the IRockyTriangleScalarsModel::reset_exchanged_heat() function. Return type: void

Function reset_exchanged_heat

**This method resets an internal triangle scalar that accumulates the heat **: exchanged by geometry triangles with surrounding particles and/or SPH fluid elements. For example, this function may be called from within the ROCKY_PLUGIN_BEGIN_ITERATION hook. In that case, at the end of an iteration, a custom module can get the value of the total heat received by each triangle during the last timestep. Return type: void

Function calculate_sum_over_geometries

Returns: A vector of the size of geometries in a project, in which every value is the sum of the triangle scalar values associated to the triangles belonging to a geometry. Those values are ordered in the vector according to the indices assigned to the geometries in a project. The sums are performed only if the triangle scalars are of type double or IRockyStatisticsAccumulator. Parameters:
  • int scalar_index
Return type: std::vector< double >

Function pull_scalar_from_devices

Copies the scalar values defined by scalar_index from the device memory to the host memory (DRAM). When running a simulation in multi-GPU, the values of different devices will be accumulated (summed) in the scalar host memory. This method can only be called for scalars added with add_accumulation_scalar in multi-gpu simulations. Parameters:
  • scalar_index: the index of the scalar we want to copy.
Parameters:
  • int scalar_index
Return type: void

Function push_scalar_to_devices

Send the current scalar values defined by scalar_index located in host memory (DRAM) to the devices memory. Parameters:
  • scalar_index: the index of the scalar we want to push to devices.
Parameters:
  • int scalar_index
Return type: void