Particles file loader/saver base class.
More...
#include <Particles.hpp>
|
| 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.
|
virtual void | load ()=0 |
| Load the data.
|
|
const ProblemSetup & | simData () 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.
|
| InputOutput () |
| Constructor.
|
virtual | ~InputOutput () |
| Destructor.
|
Particles file loader/saver base class.
In AQUAgpusph the input/output managers are divided in 3 different types:
- The simulation configuration files manager
- The report file managers
- The particles output file managers
The particles files have 2 main objectives:
- Particles data loading at the start of simulations.
- Visualization of the simulation results.
- See also
- Aqua::InputOutput::InputOutput
-
Aqua::InputOutput::Report
-
Aqua::InputOutput::State
◆ Particles()
Aqua::InputOutput::Particles::Particles |
( |
ProblemSetup & | sim_data, |
|
|
unsigned int | iset, |
|
|
size_t | offset, |
|
|
size_t | n = 0 ) |
Constructor.
- Parameters
-
sim_data | Simulation data |
offset | First particle managed by this saver/loader |
iset | Particles set index |
n | Number 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) |
◆ ~Particles()
Aqua::InputOutput::Particles::~Particles |
( |
| ) |
|
|
virtual |
◆ 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
-
- Returns
- The event that will be marked as completed when the data is already available
- See also
- data()
◆ 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
-
basename | The base name of the file |
start_index | First index that will be checked. |
digits | Number 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()
◆ file() [3/3]
void Aqua::InputOutput::Particles::file |
( |
const std::string | filename | ) |
|
|
inlineprotected |
Set the file name.
- Parameters
-
filename | The 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:
- iset
- id_sorted
- id_unsorted
◆ 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
◆ 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.
◆ save()
void Aqua::InputOutput::Particles::save |
( |
float | t | ) |
|
|
virtual |
◆ setId()
unsigned int Aqua::InputOutput::Particles::setId |
( |
| ) |
const |
|
inlineprotected |
Get the "particles set" index associated with this class.
- Returns
- The "particles index" index.
◆ simData()
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
The documentation for this class was generated from the following files:
- /home/pepe/SPH/Code/aquagpusph/aquagpusph/InputOutput/Particles.hpp
- /home/pepe/SPH/Code/aquagpusph/aquagpusph/InputOutput/Particles.cpp