AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
Aqua::InputOutput::Particles Class Reference

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

#include <InputOutput/Particles.h>

Inheritance diagram for Aqua::InputOutput::Particles:
Inheritance graph
[legend]
Collaboration diagram for Aqua::InputOutput::Particles:
Collaboration graph
[legend]

Public Member Functions

 Particles (ProblemSetup &sim_data, unsigned int iset, unsigned int offset, unsigned int n=0)
 Constructor.
 
virtual ~Particles ()
 Destructor.
 
const std::string file ()
 Get the last printed file path.
 
unsigned int n ()
 Get the number of particles managed by this instance.
 
virtual void waitForSavers ()
 Wait for the eventual parallel saving threads.
 
- Public Member Functions inherited from Aqua::InputOutput::InputOutput
virtual void save (float t)=0
 Save the data.
 
virtual void load ()=0
 Load the data.
 

Protected Member Functions

ProblemSetupsimData ()
 Get the simulation data structure.
 
void n (unsigned int n)
 Set the number of particles managed by this instance.
 
const uivec2 bounds () const
 Get the particle index bounds of the "set of particles" managed by this class.
 
const 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)
 
std::vector< void * > download (std::vector< std::string > fields)
 
- 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,
unsigned int  offset,
unsigned int  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 uivec2 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).

◆ download()

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

Download the data from the device, and store it

Parameters
fieldsFields to download
Returns
host allocated memory
Note
The returned data must be manually cleared.
Here is the call graph for this function:

◆ file() [1/3]

const std::string Aqua::InputOutput::Particles::file ( )
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.

◆ 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]

unsigned int Aqua::InputOutput::Particles::n ( )
inline

Get the number of particles managed by this instance.

Returns
Number of particles

◆ n() [2/2]

void Aqua::InputOutput::Particles::n ( unsigned int  n)
inlineprotected

Set the number of particles managed by this instance.

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

◆ setId()

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

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

Returns
The "particles index" index.

◆ simData()

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

Get the simulation data structure.

Returns
Simulation data

◆ 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

Reimplemented in Aqua::InputOutput::VTK.


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