jplus-0.4.6
|
00001 /* -*- mode: c++; indent-tabs-mode:nil -*- */ 00002 #include <fstream> 00003 #include <string> 00004 00006 class trjfile { 00007 protected: 00009 int neq; 00011 std::fstream trj; 00012 public: 00013 00015 trjfile(); 00016 00023 bool open(std::string path, bool create=true); 00024 00026 bool close(); 00027 00030 bool good(); 00031 00040 bool saveFrame(const int neq, const double &T, const double* data); 00041 00044 bool hasNextFrame(); 00045 00049 int getNEQ(); 00050 00055 bool loadFrame(double &T, double* data); 00056 00059 int size(); 00060 00064 bool toFrame(int frame); 00065 00066 protected: 00068 std::streampos header_size(); 00069 00071 std::streampos frame_size(); 00072 00076 void setHeader(int id, int neq); 00077 00078 };