1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // VPICView class contains information for a subset of a VPIC application
4 // for all time steps across all processors.  That subset might be the
5 // entire dataset.
6 //
7 /////////////////////////////////////////////////////////////////////////////
8 
9 #ifndef VPICView_h
10 #define VPICView_h
11 
12 #include "VPICDefinition.h"
13 #include "VPICGlobal.h"
14 #include "VPICHeader.h"
15 #include "VPICPart.h"
16 #include <iostream>
17 #include <string>
18 #include <vector>
19 #include <set>
20 
21 using namespace std;
22 
23 class VPIC_EXPORT VPICView {
24 public:
25    VPICView(int r, int t, VPICGlobal& global);
26    ~VPICView();
27 
28    // Initialize the view which is total dataset or a subset
29    void initialize(
30         int timeStep,           // Current time step
31         int* layoutSize,        // Dimensions in complete files
32         int*** layoutID,        // File ids included in the view
33         int* partSize,          // Size of data on one file
34         float* origin,          // Physical origin
35         float* step);           // Physical step
36 
37    // Partition the subset of files across available processors
38    void partitionFiles();
39    void partition();
40    void getPartFileNames(string* partFileName, int time, int part);
41 
42    // Set grid sizes, origin, step based on stride over problem
43    void calculateGridExtents();
44 
45    // Have each part load data into appropriate part of viz data on processor
46    void loadVariableData(
47         float* varData,         // Pre allocated array to fill
48         int varOffset,          // Offset into varData
49         int* localDim,          // Local block enhanced with ghost
50         int timeStep,           // Dump to load from
51         int variable,           // Variable index to load
52         int component);         // Component of variable to load
53 
needsGridCalculation()54    bool needsGridCalculation()  { return this->calculateGridNeeded; }
55 
56    // Check main directory for additional time steps and adjust structures
57    void addNewTimeSteps();
58 
59    void PrintSelf(ostream& os, int indent);
60 
61    // Setting the stride requires recalculation of grid and extents
62    void setStride(int s[]);
63 
64    void getDecomposition(int decomp[]);
65 
66    void getGridSize(int gridsize[]);
67    void getLayoutSize(int layout[]);
68 
69    void getOrigin(float origin[]);
70    void getOrigin(double origin[]);
71 
72    void getStep(float step[]);
73    void getStep(double step[]);
74 
75    void getPhysicalExtent(float extent[]);
76    void getPhysicalExtent(double extent[]);
77 
78    void getWholeExtent(int extent[]);
79    void getSubExtent(int piece, int extent[]);
80    void getSubDimension(int piece, int dimension[]);
81 
getNumberOfCells()82    int  getNumberOfCells()      { return this->numberOfCells; }
getNumberOfNodes()83    int  getNumberOfNodes()      { return this->numberOfNodes; }
getNumberOfParts()84    int  getNumberOfParts()      { return this->numberOfMyParts; }
85 
86 private:
87    int   rank;                          // Processor number
88    int   totalRank;                     // Number of graphics processors
89    VPICGlobal& global;                  // Common information for overall data
90 
91    // Visualization information
92    int   decomposition[DIMENSION];      // Graphics processor layout sizes
93    int   gridSize[DIMENSION];           // Visualization grid size for all parts
94    int   ghostSize[DIMENSION];          // Visualization ghost grid size
95 
96    float physicalOrigin[DIMENSION];     // Physical origin
97    float physicalStep[DIMENSION];       // Physical step
98    float physicalSize[DIMENSION];       // Physical upper extent
99 
100    int   numberOfCells;                 // Visualization grid positions
101    int   numberOfCellsWithGhosts;       // Visualization ghost grid positions
102    int   numberOfNodes;                 // Points within grid (gridsize + 1)
103 
104    int   stride[DIMENSION];             // Stride in each dimension
105    int   currentTimeStep;               // VPICParts set to this step
106 
107    // Graphic processor partition information
108    int** range;                         // Range of layoutSize for processor
109    int** subextent;                     // Subextent grid for every processor
110    int** subdimension;                  // Subdimension for every processor
111 
112    bool  calculateGridNeeded;           // Grid extent calculation required
113 
114    // Data access structure
115    int*** layoutID;                     // Numerical ID of file
116    int layoutSize[DIMENSION];           // # of parts in each dim of simulation
117    int partSize[DIMENSION];             // # of grids in each dim per part
118 
119    vector<VPICPart*> myParts;           // Every VPICPart this processor handles
120    int numberOfMyParts;
121 
122   VPICView(const VPICView&);  // Not implemented.
123   void operator=(const VPICView&);  // Not implemented.
124 };
125 
126 #endif
127