Overture  Version 25
Ogshow.h
Go to the documentation of this file.
1 #ifndef OGSHOW_H
2 #define OGSHOW_H "Ogshow.h"
3 
4 #include "CompositeGrid.h"
6 #include "ShowFileParameter.h"
7 
8 #include OV_STD_INCLUDE(vector)
9 
10 class HDF_DataBase;
11 
12 class Ogshow
13 {
14  public:
15 
16  typedef int FrameSeriesID;
17 
19  {
22  };
23 
24 
25  Ogshow();
26  Ogshow(const aString & nameOfShowFile,
27  const aString & nameOfDirectory = ".",
28  int useStreamMode=false,
30 
31  ~Ogshow();
32 
33  // return a pointer to the current frame
35 
36  int open(const aString & nameOfShowFile,
37  const aString & nameOfDirectory = ".",
38  int useStreamMode=false,
40 
41  int close();
42 
43  // save a comment that applies to the whole file
44  int saveGeneralComment( const aString & comment );
45 
46  // save a comment with the current frame
47  int saveComment( const int commentNumber, const aString & comment );
48 
49  int saveSequence( const aString & name,
50  const RealArray & time,
51  const RealArray & value,
52  aString *name1=NULL,
53  aString *name2=NULL);
54 
55  // save parameters that apply to the whole file
59  };
60 
63 
64  // Save parameters into the current frame
65  int saveParameters(const aString & nameOfDirectory, ListOfShowFileParameters & params );
66 
68  {
71  };
72 
73  int getTotalNumberOfFrames() const;
74  int getNumberOfFrames() const;
75 
76  const aString & getShowFileName() const;
77 
78  int saveSolution( realGridCollectionFunction & u, const aString & name="u",
79  int frameForGrid=useDefaultLocation);
80 
81  int saveSolution( realMappedGridFunction & u, const aString & name="u",
82  int frameForGrid=useDefaultLocation);
83 
84  int getNumberOfFrameSeries() const;
85  FrameSeriesID newFrameSeries(const aString & name);
87  const aString& getFrameSeriesName(const FrameSeriesID frameSeries);
88  int setFrameSeriesName(const FrameSeriesID frameSeries, const aString & name);
90  int setCurrentFrameSeries(const FrameSeriesID frameSeries);
91  int setCurrentFrameSeries(const aString & name);
92 
93  int startFrame( const int frame=-1); // start a new frame or write to an existing one
94  int endFrame(); // end the frame, close sub-files if appropriate.
95 
96  bool getIsMovingGridProblem() const;
97  void setIsMovingGridProblem( const bool trueOrFalse );
98 
99  // indicate that the file should be flushed every so often:
100  void setFlushFrequency( const int flushFrequency = 5 );
101  int getFlushFrequency() const;
102 
103  // return true if the current frame is the first frame in the current subFile
104  bool isFirstFrameInSubFile() const;
105  // return true if the current frame is the last frame in the current subFile
106  bool isLastFrameInSubFile() const;
107 
108  // flush the data in the file *** this does not work ***
109  void flush();
110 
111 
112  protected:
113  void initialize();
114  int cleanup();
115  int createShowFile( const aString & nameOfShowFile, const aString & nameOfDirectory, ShowFileOpenOption openOption );
117  int saveCommentsToFile();
118 
120  GenericDataBase *showFile; // here is the show file
121  GenericDataBase *showDir; // Here is where we save the showfile information
123 
124  int showFileCounter; // counts number of solutions saved so far
125  int showFileCreated; // TRUE if a show file is mounted
127 
128  std::vector<aString> generalComment;
129 
131  int numberOfFramesPerFile; // This many frames per sub file
132  int magicNumber; // unique identifier saved with the file
134 
137 
139 
140  GenericDataBase *showDir; // current frame;
141  GenericDataBase *frame; // current frame;
142 
143  int solutionCounter; // local version of showFileCounter
144 
146  std::vector<aString> comment;
147  int movingGridProblem; // true if grids are moving (make this an int to be consistent with ShowFileReader)
148  int numberOfFrames; // local version of totalNumberOfFrames
149  int frameNumber; // current frame
152  int sequenceNumber; // number of seqences saved in the show file.
153  int streamMode; // if true, save file in stream mode (compressed).
156  };
157 
158  std::vector<OgshowFrameSeries> frameSeriesList;
159 
160 };
161 
162 
163 #endif