1 |
tim |
1739 |
/* |
2 |
|
|
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
|
|
* |
4 |
|
|
* Contact: oopse@oopse.org |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or |
7 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
8 |
|
|
* as published by the Free Software Foundation; either version 2.1 |
9 |
|
|
* of the License, or (at your option) any later version. |
10 |
|
|
* All we ask is that proper credit is given for our work, which includes |
11 |
|
|
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
|
|
* of your source code files, and to any copyright notice that you may distribute |
13 |
|
|
* with programs based on this work. |
14 |
|
|
* |
15 |
|
|
* This program is distributed in the hope that it will be useful, |
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
|
|
* GNU Lesser General Public License for more details. |
19 |
|
|
* |
20 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
21 |
|
|
* along with this program; if not, write to the Free Software |
22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
|
|
* |
24 |
|
|
*/ |
25 |
|
|
|
26 |
|
|
/** |
27 |
|
|
* @file DumpReader.hpp |
28 |
|
|
* @author tlin |
29 |
|
|
* @date 11/15/2004 |
30 |
|
|
* @time 09:25am |
31 |
|
|
* @version 2.0 |
32 |
|
|
*/ |
33 |
|
|
|
34 |
|
|
#ifndef IO_DUMPREADER_HPP |
35 |
|
|
#define IO_DUMPREADER_HPP |
36 |
|
|
|
37 |
|
|
#include <cstdio> |
38 |
|
|
#include <string> |
39 |
|
|
#include "brains/SimInfo.hpp" |
40 |
|
|
|
41 |
|
|
namespace oopse { |
42 |
|
|
|
43 |
|
|
/** |
44 |
|
|
* @class DumpReader DumpReader.hpp "io/DumpReader.hpp" |
45 |
|
|
* @todo get rid of more junk code from DumpReader |
46 |
|
|
*/ |
47 |
|
|
class DumpReader { |
48 |
|
|
public: |
49 |
|
|
|
50 |
|
|
DumpReader(SimInfo* info, const std::string & filename); |
51 |
|
|
//DumpReader(SimInfo * info, istream & is); |
52 |
|
|
|
53 |
|
|
~DumpReader(); |
54 |
|
|
|
55 |
|
|
/** Returns the number of frames in the dump file*/ |
56 |
|
|
int getNFrames(); |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
void readFrame(int whichFrame); |
60 |
|
|
|
61 |
|
|
private: |
62 |
|
|
|
63 |
|
|
void scanFile(); |
64 |
|
|
|
65 |
|
|
void readSet(int whichFrame); |
66 |
|
|
|
67 |
|
|
void parseDumpLine(char *line, StuntDouble* integrableObject); |
68 |
|
|
|
69 |
|
|
void parseCommentLine(char* line, Snapshot* s, bool useInitXSstate); |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
#ifdef IS_MPI |
73 |
|
|
|
74 |
|
|
void anonymousNodeDie(void); |
75 |
|
|
void nodeZeroError(void); |
76 |
|
|
|
77 |
|
|
#endif |
78 |
|
|
// the maximum length of a typical MPI package is 15k |
79 |
|
|
const static int maxBufferSize = 8192; |
80 |
|
|
|
81 |
|
|
SimInfo* info_; |
82 |
|
|
|
83 |
|
|
sstd::string filename_; |
84 |
|
|
bool isScanned_; |
85 |
|
|
|
86 |
|
|
FILE* inFile_; |
87 |
|
|
std::vector<fpos_t*> framePos_; |
88 |
|
|
}; |
89 |
|
|
|
90 |
|
|
} //end namespace oopse |
91 |
|
|
|
92 |
|
|
#endif //IO_DUMPREADER_HPP |