Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
ShowFileReader.h
Go to the documentation of this file.
1
#ifndef SHOW_FILE_READER_H
2
#define SHOW_FILE_READER_H
3
4
// -------------------------------------------------------------------
5
// This class can be used to access solutions from a show file.
6
//
7
// This class is used by plotStuff. It is also used by solvers to
8
// read in initial conditions from a show file.
9
// -------------------------------------------------------------------
10
11
#include "
GenericGraphicsInterface.h
"
12
#include "
CompositeGrid.h
"
13
#include "
HDF_DataBase.h
"
14
#include "
DataBaseAccessFunctions.h
"
15
#include "
Ogshow.h
"
16
#include "
ShowFileParameter.h
"
17
18
#include OV_STD_INCLUDE(vector)
19
20
class
ShowFileReader
21
{
22
public
:
23
24
enum
ReturnType
25
{
26
notFound
=0,
27
solutionFound
=1,
28
gridFound
=2,
29
solutionAndGridFound
=3
30
};
31
32
enum
GridLocationEnum
33
{
34
useDefaultLocation
=-2,
35
useCurrentFrame
=-1
36
};
37
38
39
ShowFileReader
(
const
aString
& nameOfShowFile=
nullString
);
40
~ShowFileReader
();
41
42
int
open
(
const
aString
& nameOfShowFile,
const
int
displayInfo=1 );
43
int
close
();
44
45
int
getNumberOfFrameSeries
()
const
;
46
aString
getFrameSeriesName
(
const
Ogshow::FrameSeriesID
frame_series );
47
int
getNumberOfFrames
()
const
;
48
int
getNumberOfSolutions
()
const
;
49
int
getNumberOfSequences
()
const
;
50
51
int
setCurrentFrameSeries
(
const
Ogshow::FrameSeriesID
frame_series );
52
Ogshow::FrameSeriesID
getCurrentFrameSeries
()
const
;
53
54
ReturnType
getAGrid
(
MappedGrid
& cg,
55
int
& solutionNumber,
56
int
frameForGrid=
useDefaultLocation
);
57
58
ReturnType
getAGrid
(
GridCollection
& cg,
59
int
& solutionNumber,
60
int
frameForGrid=
useDefaultLocation
);
61
62
ReturnType
getASolution
(
int
& solutionNumber,
63
MappedGrid
& cg,
64
realMappedGridFunction
& u);
65
66
ReturnType
getASolution
(
int
& solutionNumber,
67
GridCollection
& cg,
68
realGridCollectionFunction
& u);
69
70
int
getSequenceNames
(
aString
*name,
int
maximumNumberOfNames);
71
72
int
getSequence
(
int
sequenceNumber,
73
aString
& name,
RealArray
& time,
RealArray
& value,
74
aString
*componentName1,
int
maxcomponentName1,
75
aString
*componentName2,
int
maxcomponentName2);
76
77
// return a pointer to a frame (by default the current frame)
78
HDF_DataBase
*
getFrame
(
int
solutionNumber=-1);
79
80
bool
isAMovingGrid
();
81
82
// get a parameter with a given name
83
bool
getGeneralParameter
(
const
aString
& name,
int
& value,
84
const
Ogshow::PlaceToSaveGeneralParameters
placeToSave=
Ogshow::THECurrentFrameSeries
);
85
bool
getGeneralParameter
(
const
aString
& name,
real
& value,
86
const
Ogshow::PlaceToSaveGeneralParameters
placeToSave=
Ogshow::THECurrentFrameSeries
);
87
bool
getGeneralParameter
(
const
aString
& name,
aString
& value,
88
const
Ogshow::PlaceToSaveGeneralParameters
placeToSave=
Ogshow::THECurrentFrameSeries
);
89
90
// get a parameter with a given name and type
91
bool
getGeneralParameter
(
const
aString
& name,
ShowFileParameter::ParameterType
type,
int
& value,
real
& rValue,
92
aString
& stringValue,
93
const
Ogshow::PlaceToSaveGeneralParameters
placeToSave=
Ogshow::THECurrentFrameSeries
);
94
95
// Get parameters from a given directory in the current frame
96
bool
getParameters
(
const
aString
& nameOfDirectory,
ListOfShowFileParameters
& params );
97
98
// get header comments for the last grid or solution that was found
99
const
aString
*
getHeaderComments
(
int
& numberOfHeaderComments);
100
101
102
103
// Get the list of parameters that go with this file.
104
int
getGeneralParameters
(
const
int
displayInfo=1 );
105
106
// Return the general parameters
107
ListOfShowFileParameters
&
getListOfGeneralParameters
(
108
const
Ogshow::PlaceToSaveGeneralParameters
placeToSave=
Ogshow::THECurrentFrameSeries
);
109
110
// For very large files we may have to reduce the number of files that we allow to be open at any time
111
void
setMaximumNumberOfOpenShowFiles
(
const
int
maxNumber);
112
113
private
:
114
bool
showFileIsOpen;
115
GenericDataBase
**showFile;
116
std::vector<aString> frameSeriesNames;
117
enum
SeriesItemEnum {
118
numFrames,
119
numSolutions,
120
numSequences,
121
isMovingGrid,
122
frameIDForGrid,
123
streamModeOption,
124
numItemsInSeries
125
};
126
127
IntegerArray
frameSeriesInfo;
128
129
int
numberOfFrames;
130
int
numberOfSolutions;
131
int
numberOfSequences;
132
133
int
numberOfShowFiles;
134
int
numberOfOpenFiles;
135
int
frameNumberForGrid;
136
int
maximumNumberOfHeaderComments;
137
int
numberOfHeaderComments;
// for last solution/grid found
138
139
int
maxNumberOfShowFiles;
140
int
maxNumberOfOpenFiles;
// there is some limit like 30-40
141
aString
*headerComment;
// for last solution/grid found
142
aString
nameOfShowFile;
143
bool
movingGridProblem;
144
145
int
streamMode;
146
147
Ogshow::FrameSeriesID
currentFrameSeries;
148
HDF_DataBase
currentFrameSeriesDB;
149
HDF_DataBase
currentFrame;
150
151
152
std::vector<ListOfShowFileParameters> listOfGeneralParameters;
153
154
int
openShowFile(
const
int
n);
155
156
int
getNumberOfValidFiles(
const
int
displayInfo=1 );
157
158
int
countNumberOfFramesAndSolutions(
const
int
displayInfo=1 );
159
160
void
checkSolutionNumber(
const
aString
& routineName,
int
& solutionNumber );
161
162
};
163
164
165
#endif
166
167
168
169
170
171
172
173
Generated on Fri Jan 4 2013 10:17:59 for Overture by
1.8.3