AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::InputOutput::Particles Class Reference

Particles file loader/saver base class. More...

#include <Particles.hpp>

Inheritance diagram for Aqua::InputOutput::Particles:
Collaboration diagram for Aqua::InputOutput::Particles:

Public Member Functions

 Particles (ProblemSetup &sim_data, unsigned int iset, size_t offset, size_t n=0)
 Constructor.
virtual ~Particles ()
 Destructor.
const std::string & file () const
 Get the last printed file path.
size_t n () const
 Get the number of particles managed by this instance.
cl_event getUserEvent () const
 Get the user event to be waited for before the file saving is finished.
virtual void waitForSavers ()
 Wait for the eventual parallel saving threads.
virtual void save (float t)
 Save the data.
virtual void print_file ()
 Print the data to a file.
Public Member Functions inherited from Aqua::InputOutput::InputOutput
virtual void load ()=0
 Load the data.

Protected Member Functions

const ProblemSetupsimData () const
 Get the simulation data structure.
void n (const size_t &n)
 Set the number of particles managed by this instance.
const ulvec2 bounds () const
 Get the particle index bounds of the "set of particles" managed by this class.
unsigned int setId () const
 Get the "particles set" index associated with this class.
void loadDefault ()
 Register some default arrays:
void file (const std::string filename)
 Set the file name.
unsigned int file (const std::string basename, unsigned int start_index, unsigned int digits=5)
float time () const
 Get the current simulation time to be written.
cl_event download (std::vector< std::string > fields)
 Download the data from the device and store it.
std::map< std::string, void * > data () const
 Get the stored memory objects where the device data has been downloaded.
Protected Member Functions inherited from Aqua::InputOutput::InputOutput
 InputOutput ()
 Constructor.
virtual ~InputOutput ()
 Destructor.

Detailed Description

Particles file loader/saver base class.

In AQUAgpusph the input/output managers are divided in 3 different types:

  1. The simulation configuration files manager
  2. The report file managers
  3. The particles output file managers

The particles files have 2 main objectives:

  1. Particles data loading at the start of simulations.
  2. Visualization of the simulation results.
See also
Aqua::InputOutput::InputOutput
Aqua::InputOutput::Report
Aqua::InputOutput::State

Constructor & Destructor Documentation

◆ Particles()

Aqua::InputOutput::Particles::Particles ( ProblemSetup & sim_data,
unsigned int iset,
size_t offset,
size_t n = 0 )

Constructor.

Parameters
sim_dataSimulation data
offsetFirst particle managed by this saver/loader
isetParticles set index
nNumber of particles managed by this saver/loader. If 0, the number of particles will be obtained from the input file (thus only valid for loaders)
Here is the call graph for this function:

◆ ~Particles()

Aqua::InputOutput::Particles::~Particles ( )
virtual

Destructor.

Member Function Documentation

◆ bounds()

const ulvec2 Aqua::InputOutput::Particles::bounds ( ) const
inlineprotected

Get the particle index bounds of the "set of particles" managed by this class.

Returns
The index bounds (first and last particle).

◆ data()

std::map< std::string, void * > Aqua::InputOutput::Particles::data ( ) const
inlineprotected

Get the stored memory objects where the device data has been downloaded.

Returns
The memory objects
See also
download()

◆ download()

cl_event Aqua::InputOutput::Particles::download ( std::vector< std::string > fields)
protected

Download the data from the device and store it.

Parameters
fieldsFields to download
Returns
The event that will be marked as completed when the data is already available
See also
data()
Here is the call graph for this function:

◆ file() [1/3]

const std::string & Aqua::InputOutput::Particles::file ( ) const
inline

Get the last printed file path.

Returns
The last printed file, NULL if a file has not been printed yet.

◆ file() [2/3]

unsigned int Aqua::InputOutput::Particles::file ( const std::string basename,
unsigned int start_index,
unsigned int digits = 5 )
protected

Look for the first non-existing file path

Parameters
basenameThe base name of the file
start_indexFirst index that will be checked.
digitsNumber of digits of the replaced integer number. If the number of digits of the integer value are greater than this value this parameter will be ignored, otherwise zeroes will be appended at the left of the decimal representation of the integer.
Returns
The next non-existing file index.
See also
Aqua::newFilePath()
Here is the call graph for this function:

◆ file() [3/3]

void Aqua::InputOutput::Particles::file ( const std::string filename)
inlineprotected

Set the file name.

Parameters
filenameThe new file to save/load. Optionally a null parameter can be passed in order to clear the stored file name.

◆ getUserEvent()

cl_event Aqua::InputOutput::Particles::getUserEvent ( ) const
inline

Get the user event to be waited for before the file saving is finished.

Returns
The event
Note
In general waitForSavers() shall be used instead of this function, which is provided just to work with the OpenCL callbacks

◆ loadDefault()

void Aqua::InputOutput::Particles::loadDefault ( )
protected

Register some default arrays:

  1. iset
    1. id_sorted
    2. id_unsorted
Here is the call graph for this function:

◆ n() [1/2]

size_t Aqua::InputOutput::Particles::n ( ) const
inline

Get the number of particles managed by this instance.

Returns
Number of particles

◆ n() [2/2]

void Aqua::InputOutput::Particles::n ( const size_t & n)
inlineprotected

Set the number of particles managed by this instance.

Returns
Number of particles
Here is the call graph for this function:

◆ print_file()

virtual void Aqua::InputOutput::Particles::print_file ( )
inlinevirtual

Print the data to a file.

This function shall be overloaded by the inherited classes. Remember to call this function anyway to set the user event as completed

Note
This method is public to work with the OpenCL callbacks, but it is not meant to be called by the users

Reimplemented in Aqua::InputOutput::ASCII, Aqua::InputOutput::CSV, and Aqua::InputOutput::VTK.

Here is the call graph for this function:

◆ save()

void Aqua::InputOutput::Particles::save ( float t)
virtual

Save the data.

Parameters
tSimulation time

Implements Aqua::InputOutput::InputOutput.

Reimplemented in Aqua::InputOutput::VTK.

Here is the call graph for this function:

◆ setId()

unsigned int Aqua::InputOutput::Particles::setId ( ) const
inlineprotected

Get the "particles set" index associated with this class.

Returns
The "particles index" index.

◆ simData()

const ProblemSetup & Aqua::InputOutput::Particles::simData ( ) const
inlineprotected

Get the simulation data structure.

Returns
Simulation data

◆ time()

float Aqua::InputOutput::Particles::time ( ) const
inlineprotected

Get the current simulation time to be written.

Returns
The simulation time

◆ waitForSavers()

virtual void Aqua::InputOutput::Particles::waitForSavers ( )
inlinevirtual

Wait for the eventual parallel saving threads.

Some savers may optionally launch parallel threads to save the data, in an asynchronous way, in order to improve the performance. In such a case, AQUAgpusph shall wait them to finish before proceeding to destroy the data

Here is the call graph for this function:

The documentation for this class was generated from the following files: