Class for reading particles from txt files. At the moment file formats Cuboid and Particle are supported.
More...
#include <TxtReader.h>
Class for reading particles from txt files. At the moment file formats Cuboid and Particle are supported.
◆ readCuboid()
| int FileReader::readCuboid |
( |
ParticleContainer & |
particles, |
|
|
std::ifstream & |
input_file |
|
) |
| |
|
staticprivate |
Helper method to read files containing cuboids.
- Parameters
-
| particles | Particle Container to store the particles in. |
| input_file | Input file stream being currently at the position of that line, in which the number of cuboids is specified. |
Only parses files correctly which adhere to the particle format. If the file pretends to contain valid cuboid data, but violates the input format for some reason, this method may provide erroneous data. If an error is detected, this function returns -1. The key word Cuboid in the first non comment line of a file indicates the cuboid file format. Look at 2D-cuboid.collision.txt for reference.
- Returns
- 0, if the operation was successful, -1 otherwise
◆ readFile()
| int FileReader::readFile |
( |
ParticleContainer & |
particles, |
|
|
const std::string & |
filename |
|
) |
| |
|
static |
Read txt files containing cuboid or particle data.
- Parameters
-
| particles | Particle Container to store the particles in. |
| filename | Path to the file to be read. |
Valid file formats are Cuboid and Particle. The format of a txt file must be specified in the first line that is not a comment. Look at the files in the input file for more information. Any other file format will be rejected. If the specified file format is violated, the data may not be read correctly.
- Returns
- 0, if the operation was successful, -1 if the file format is violated, -2 if the file could not be opened and -3 if the the file format is unknown
◆ readParticle()
| int FileReader::readParticle |
( |
ParticleContainer & |
particles, |
|
|
std::ifstream & |
input_file |
|
) |
| |
|
staticprivate |
Helper method to read files containing particles.
- Parameters
-
| particles | Particle Container to store the particles in. |
| input_file | Input file stream being currently at the position of that line, in which the number of particles is specified. |
Only parses files correctly which adhere to the particle format. If the file pretends to contain valid particle data, but violates the input format for some reason, this method may provide erroneous data. If an error is detected, this function returns -1. The key word Particle in the first non comment line of a file indicates the particle file format. Look at eingabe-sonne.txt for reference.
- Returns
- 0, if the operation was successful, -1 otherwise
The documentation for this class was generated from the following files:
- /home/runner/work/MolSim/MolSim/src/fileHandling/reader/TxtReader/TxtReader.h
- /home/runner/work/MolSim/MolSim/src/fileHandling/reader/TxtReader/TxtReader.cpp