Overture  Version 25
OvertureInit.h
Go to the documentation of this file.
1 #ifndef OVERTURE_INIT_H
2 #define OVERTURE_INIT_H
3 
7 // class realMappedGridFunction;
8 #ifdef OV_USE_DOUBLE
9 #define realMappedGridFunction doubleMappedGridFunction
10 #define realGridCollectionFunction doubleGridCollectionFunction
11 #else
12 #define realMappedGridFunction floatMappedGridFunction
13 #define realGridCollectionFunction floatGridCollectionFunction
14 #endif
15 
19 
20 class MappingParameters;
22 class GraphicsParameters;
24 class ListOfMappingRC;
25 class Mapping;
26 class MappingLinkedList;
27 
28 class Overture
29 {
30  public:
31  static int start(int & argc, char **&argv);
32  static int finish();
33 
34  enum AbortEnum
35  {
38  };
39  static AbortEnum getAbortOption();
40  static void setAbortOption( AbortEnum action );
41  static void abort();
42  static void abort(const aString & message);
43 
44  // memory usage functions:
45  // return memory use in Mb:
46  static real getCurrentMemoryUsage();
47  // Turn on the checking of the memory usage (needed for checkMemoryUsage)
48  static void turnOnMemoryChecking(bool trueOrFalse=true, real memoryUsageScaleFactor=1.1 );
49  // check current memory usage and print a message if it has increased by a certain fraction:
50  static real checkMemoryUsage(const aString & label, FILE *file=stdout);
51  static real getMaximumMemoryUsage();
52  // print current memory usage:
53  static real printMemoryUsage(const aString & label, FILE *file=stdout);
54 
57 
58  static floatSerialArray & nullFloatArray();
59  static doubleSerialArray & nullDoubleArray();
60  static RealArray & nullRealArray();
61  static intSerialArray & nullIntArray();
62 
67 
70 
75 
80 
84 
86  getGraphicsInterface(const aString & windowTitle="Your Slogan Here", const bool initialize=true,
87  int argc=0, char *argv[]=NULL);
88  static void
90 
92  static void setMappingList(ListOfMappingRC *list);
93 
94  static FILE* debugFile;
95  static void openDebugFile();
96  static void (*shutDownPETSc)(); // Here is the function that will shut down PETSc. (NULL if we are not using PETSc)
97 
98  #ifdef USE_PPP
99  static MPI_Comm OV_COMM; // Overture COMM_WORLD for MPI
100  #else
101  static int OV_COMM;
102  #endif
103 
104  protected:
107  static AbortEnum abortOption;
108 
109  private:
110 
111  static floatSerialArray *pNullFloatArray;
112  static doubleSerialArray *pNullDoubleArray;
113  static RealArray *pNullRealArray;
114  static intSerialArray *pNullIntArray;
115 
116  static floatDistributedArray *pNullFloatDistributedArray;
117  static doubleDistributedArray *pNullDoubleDistributedArray;
118  static RealDistributedArray *pNullRealDistributedArray;
119  static IntegerDistributedArray *pNullIntegerDistributedArray;
120 
121 
122  static MappingParameters *pNullMappingParameters;
123  static MappingLinkedList *pStaticMappingList;
124 
125  static floatMappedGridFunction *pNullFloatMappedGridFunction;
126  static doubleMappedGridFunction *pNullDoubleMappedGridFunction;
127  static intMappedGridFunction *pNullIntMappedGridFunction;
128  static realMappedGridFunction *pNullRealMappedGridFunction;
129 
130  static floatGridCollectionFunction *pNullFloatGridCollectionFunction;
131  static doubleGridCollectionFunction *pNullDoubleGridCollectionFunction;
132  static intGridCollectionFunction *pNullIntGridCollectionFunction;
133  static realGridCollectionFunction *pNullRealGridCollectionFunction;
134 
135  static BoundaryConditionParameters *pDefaultBoundaryConditionParameters;
136 
137  static GraphicsParameters *pDefaultGraphicsParameters; // used for default arguments
138  static GraphicsParameters *pCurrentGraphicsParameters;
139 
140  static real maximumMemoryUse, oldMaximumMemoryInUse; // keeps track of maximum memory used
141  static bool checkMemoryUsageIsOn;
142  static real memoryUsageScaleFactor; // =1.1 : print message when memory has increased by this amount from previous message
143 
144  // We must only shutdown PETSc once so we keep track of it's use here
145  static int referenceCountForPETSc; // keeps track of objects that reference PETSc
146  static bool PETScIsInitialized; // true if PETSc has been initialized
147 };
148 
149 #undef realMappedGridFunction
150 #undef realGridCollectionFunction
151 #endif