AQUAgpusph 5.0.4
|
Plain text particles data files loader/saver. More...
#include <FastASCII.hpp>
Public Member Functions | |
FastASCII (ProblemSetup &sim_data, unsigned int iset, size_t offset, size_t n=0, const std::string file_ext=".dat") | |
Constructor. | |
~FastASCII () | |
Destructor. | |
Public Member Functions inherited from Aqua::InputOutput::ASCII | |
ASCII (ProblemSetup &sim_data, unsigned int iset, size_t offset, size_t n=0, const std::string file_ext=".dat") | |
Constructor. | |
virtual | ~ASCII () |
Destructor. | |
virtual void | load () |
Load the data. | |
virtual void | print_file () |
Print the data to a file. | |
Public Member Functions inherited from Aqua::InputOutput::Particles | |
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. |
Protected Member Functions | |
std::string | readField (const std::string field, const std::string line, size_t index, void *data) |
Extract the field value from a line. | |
Protected Member Functions inherited from Aqua::InputOutput::ASCII | |
virtual void | print_header (std::ofstream &f) const |
Write the file header. | |
virtual void | formatLine (std::string &l) |
Conveniently format a read line. | |
virtual size_t | readNParticles (std::ifstream &f) |
Count the number of particles present in the input file. | |
void | print_file (const char sep, const char comp_sep) |
Print the data to a file. | |
Protected Member Functions inherited from Aqua::InputOutput::Particles | |
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. | |
Protected Member Functions inherited from Aqua::InputOutput::InputOutput | |
InputOutput () | |
Constructor. | |
virtual | ~InputOutput () |
Destructor. |
Plain text particles data files loader/saver.
These files are formatted as ASCCI plain text where the particles data are stored by rows, and where the fields are separated by columns.
Aqua::InputOutput::FastASCII::FastASCII | ( | ProblemSetup & | sim_data, |
unsigned int | iset, | ||
size_t | offset, | ||
size_t | n = 0, | ||
const std::string | file_ext = ".dat" ) |
Constructor.
sim_data | Simulation data |
iset | Particles set index. |
offset | First particle managed by this saver/loader. |
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) |
Aqua::InputOutput::FastASCII::~FastASCII | ( | ) |
Destructor.
|
protectedvirtual |
Extract the field value from a line.
field | Field name. |
line | Text line, |
index | Index of the particle to read. |
data | Data array. |
Reimplemented from Aqua::InputOutput::ASCII.