blob: 9a89a3c0661dd02f703d0ad179f545a0e064685b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// AmrFileReader
#ifndef __AMRFILEREADERPLUS_HH_
#define __AMRFILEREADERPLUS_HH_
#include <stdio.h>
#include <IO.hh>
#include "AMRgridreaderPlus.h"
#include "FlexArrayTmpl.H"
class AMRfilereaderPlus : public AMRgridreaderPlus {
protected:
int gridloading;
FlexArray<int> activeGrids;
FlexArray<AMRgridPlus> grids;
FlexArray<int> levelmask;
IObase::DataType datatype;
int maxlevel,maxtimeres,mintime,maxtime;
double smax, smin;
double bounds[6];
int current_time;
// Internal Utility methods
void buildInfoTable();
void loadGrids();
void reclaimGrids();
void purgeGrids();
void printGridInfo(AMRgridPlus &g);
public:
int debug;
void printGridInfo();
void printActiveGrids();
AMRfilereaderPlus(IObase &f);
int getNumLevels(){ return maxlevel+1; }
void getTimeRange(int &min,int &max){
min=mintime;
max=maxtime;
}
void getScalarRange(float &min, float &max){
min=smin;max=smax;
}
void getScalarRange(double &min, double &max){
min=smin;max=smax;
}
void getBounds(double *bnds){for (int ii=0;ii<6;ii++){bnds[ii]=bounds[ii];}}
void getBounds(float *bnds){for (int ii=0;ii<6;ii++){bnds[ii]=bounds[ii];}}
void setTime(int timestep);
// starts out with all selected
void showLevel(int level=-1){ // default is all (-1)
if(level>=levelmask.getSize() || level<0){
printf("AmrConvert::showLevel(%u) : Level out of range 0:%u\n",
level,levelmask.getSize()-1);
}
else
levelmask[level]=1;
}
void showAllLevels();
void hideAllLevels(){for (int ii=0;ii<maxlevel+1;ii++)hideLevel(ii);}
void hideLevel(int level=-1){ // default is all (-1)
if(level>=levelmask.getSize() || level<0){
printf("AmrConvert::showLevel(%u) : Level out of range 0:%u\n",
level,levelmask.getSize()-1);
}
else
levelmask[level]=0;
}
int nLevels(){ return maxlevel+1; }
IObase::DataType getDataType(){return datatype;}
// For C interface
int getNumGrids(){ // number of active grids
return activeGrids.getSize();
}
int getActiveIndex(int ii){ return activeGrids[ii];}
int getGrids(AMRgridPlus *g);
// For C++ interface
int getGrids(FlexArray<AMRgridPlus> &g);
void setDataLoadingOff(){ gridloading=0; purgeGrids();}
void setDataLoadingOn(){ gridloading=1; loadGrids();}
};
#endif
|