VTK
dox/Parallel/vtkVPICReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVPICReader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00028 #ifndef __vtkVPICReader_h
00029 #define __vtkVPICReader_h
00030 
00031 #include "vtkImageAlgorithm.h"
00032 
00033 
00034 class vtkCallbackCommand;
00035 class vtkDataArraySelection;
00036 class vtkFloatArray;
00037 class vtkStdString;
00038 class vtkMultiProcessController;
00039 class vtkInformation;
00040 //BTX
00041 class VPICDataSet;
00042 class GridExchange;
00043 //ETX
00044 class VTK_PARALLEL_EXPORT vtkVPICReader : public vtkImageAlgorithm
00045 {
00046 public:
00047   static vtkVPICReader *New();
00048   vtkTypeMacro(vtkVPICReader,vtkImageAlgorithm);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052 
00053   vtkSetStringMacro(FileName);
00054   vtkGetStringMacro(FileName);
00056 
00058 
00059   vtkSetVector3Macro(Stride, int);
00060   vtkGetVector3Macro(Stride, int);
00062 
00064 
00065   vtkSetVector2Macro(XExtent, int);
00066   vtkSetVector2Macro(YExtent, int);
00067   vtkSetVector2Macro(ZExtent, int);
00069 
00070   // Get the full layout size in files for setting the range in GUI
00071   vtkGetVector2Macro(XLayout, int);
00072   vtkGetVector2Macro(YLayout, int);
00073   vtkGetVector2Macro(ZLayout, int);
00074 
00076 
00077   vtkImageData *GetOutput();
00078   vtkImageData *GetOutput(int index);
00080 
00082 
00085   int GetNumberOfPointArrays();
00086   const char* GetPointArrayName(int index);
00087   int GetPointArrayStatus(const char* name); 
00088   void SetPointArrayStatus(const char* name, int status);
00089   void DisableAllPointArrays();
00090   void EnableAllPointArrays();
00092 
00093 protected:
00094   vtkVPICReader();
00095   ~vtkVPICReader();
00096 
00097   char *FileName;                       // First field part file giving path
00098 
00099   int Rank;                             // Number of this processor
00100   int TotalRank;                        // Number of processors
00101   int UsedRank;                         // Number of processors used in display
00102 
00103   VPICDataSet* vpicData;                // Data structure controlling access
00104   GridExchange* exchanger;    // Exchange ghost cells between procs
00105 
00106   int NumberOfPieces;                   // Number of files in dataset
00107   vtkIdType NumberOfNodes;              // Number of points in grid
00108   vtkIdType NumberOfCells;              // Number of cells in grid
00109   vtkIdType NumberOfTuples;             // Number of tuples in sub extent
00110 
00111   int WholeExtent[6];                   // Problem image extent
00112   int SubExtent[6];                     // Processor problem extent
00113   int Dimension[3];                     // Size of image
00114   int SubDimension[3];                  // Size of subextent of image
00115   int XLayout[2];                       // Extent in complete files
00116   int YLayout[2];                       // Extent in complete files
00117   int ZLayout[2];                       // Extent in complete files
00118 
00119   int NumberOfVariables;                // Number of variables to display
00120   vtkStdString* VariableName;           // Names of each variable
00121   int* VariableStruct;                  // Scalar, vector or tensor
00122 
00123   int NumberOfTimeSteps;                // Temporal domain
00124   double* TimeSteps;                    // Times available for request
00125   int CurrentTimeStep;                  // Time currently displayed
00126 
00127   int Stride[3];                        // Stride over actual data 
00128   int XExtent[2];                       // Subview extent in files
00129   int YExtent[2];                       // Subview extent in files
00130   int ZExtent[2];                       // Subview extent in files
00131 
00132   vtkFloatArray** data;                 // Actual data arrays
00133   int* dataLoaded;                      // Data is loaded for current time
00134 
00135   int Start[3];                         // Start offset for processor w ghosts
00136   int GhostDimension[3];                // Dimension including ghosts on proc
00137   int NumberOfGhostTuples;              // Total ghost cells per component
00138   int ghostLevel0;                      // Left plane number of ghosts
00139   int ghostLevel1;                      // Right plane number of ghosts
00140 
00141   // Controlls initializing and querrying MPI
00142   vtkMultiProcessController * MPIController; 
00143 
00144   // Selected field of interest
00145   vtkDataArraySelection* PointDataArraySelection;
00146 
00147   // Observer to modify this object when array selections are modified
00148   vtkCallbackCommand* SelectionObserver;
00149 
00150   int RequestData(vtkInformation *, vtkInformationVector **,
00151                   vtkInformationVector *);
00152   int RequestInformation(vtkInformation *, vtkInformationVector **inVector,
00153                          vtkInformationVector *);
00154 
00155   void LoadVariableData(int var, int timeStep);
00156   void LoadComponent(
00157         float* varData,
00158         float* block,
00159         int comp,
00160         int numberOfComponents);
00161 
00162   static void SelectionCallback(vtkObject* caller, unsigned long eid,
00163                                 void* clientdata, void* calldata);
00164   static void EventCallback(vtkObject* caller, unsigned long eid,
00165                                 void* clientdata, void* calldata);
00166 
00167 
00168 private:
00169   vtkVPICReader(const vtkVPICReader&);  // Not implemented.
00170   void operator=(const vtkVPICReader&); // Not implemented.
00171 };
00172 
00173 #endif
00174 
00175