YACTS trajectory file.
More...
#include <src/trjfile.h>
|
| trjfile () |
| Instantiates unopened trajectory file.
|
|
bool | open (std::string path, bool create=true) |
| Opens/creates trajectory and positions it before the last frame, or right after the header if trajectory was empty.
|
|
bool | close () |
| Closes the trajectory.
|
|
bool | good () |
| Checks that trajectory file is opened and properly positioned.
|
|
bool | saveFrame (const int neq, const double &T, const double *data) |
| Saves frame to the file at the current pos, appends if necessary.
|
|
bool | hasNextFrame () |
| Checks if the file has next frame stored.
|
|
int | getNEQ () |
| Get number of equations.
|
|
bool | loadFrame (double &T, double *data) |
| Load frame.
|
|
int | size () |
| Get number of frames in the file.
|
|
bool | toFrame (int frame) |
| Position the file before the specified frame.
|
|
|
int | neq |
| Number of equations in the system solved (frame size).
|
|
std::fstream | trj |
| Opened stream to the underlying file.
|
|
YACTS trajectory file.
Holds the past and current states of integrated system.
◆ trjfile()
Instantiates unopened trajectory file.
◆ close()
◆ frame_size()
std::streampos trjfile::frame_size |
( |
| ) |
|
|
protected |
◆ getNEQ()
Get number of equations.
- Returns
- the number of frames or 0 if the file was just created and no frames were stored yet.
◆ good()
Checks that trajectory file is opened and properly positioned.
- Returns
- true if everything is ok.
◆ hasNextFrame()
bool trjfile::hasNextFrame |
( |
| ) |
|
Checks if the file has next frame stored.
- Returns
- true if the next frame can be read.
◆ header_size()
std::streampos trjfile::header_size |
( |
| ) |
|
|
protected |
◆ loadFrame()
bool trjfile::loadFrame |
( |
double & |
T, |
|
|
double * |
data |
|
) |
| |
Load frame.
- Parameters
-
T | the variable to hold the time of the frame. |
data | the array to hold the frame data (should have enough space for getNEQ() doubles). |
◆ open()
bool trjfile::open |
( |
std::string |
path, |
|
|
bool |
create = true |
|
) |
| |
Opens/creates trajectory and positions it before the last frame, or right after the header if trajectory was empty.
- Parameters
-
path | filesystem path to the trajectory. |
create | when true an empty trajectory will be created when file is missing, otherwise this is failure. |
- Returns
- true if everything is ok.
◆ saveFrame()
bool trjfile::saveFrame |
( |
const int |
neq, |
|
|
const double & |
T, |
|
|
const double * |
data |
|
) |
| |
Saves frame to the file at the current pos, appends if necessary.
If this is the first frame saved, the passed neq parameter defines the number of frames in this trajectory file, then it becomes an error to save frames with different neq.
- Parameters
-
neq | number of equations in the system. |
T | time of the frame. |
data | frame data. |
- Returns
- true if success.
◆ setHeader()
void trjfile::setHeader |
( |
int |
id, |
|
|
int |
neq |
|
) |
| |
|
protected |
patch the header with new data
- Parameters
-
id | reserved. |
neq | number of equations in the system. |
◆ size()
Get number of frames in the file.
- Returns
- the total number of frames currently in trajectory.
◆ toFrame()
bool trjfile::toFrame |
( |
int |
frame | ) |
|
Position the file before the specified frame.
- Parameters
-
frame | position will be set before this frame, 0 positions before the first frame, -1 positions before the last frame. |
◆ neq
Number of equations in the system solved (frame size).
◆ trj
std::fstream trjfile::trj |
|
protected |
Opened stream to the underlying file.
The documentation for this class was generated from the following file: