VTK
dox/IO/VPIC/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 "vtkIOVPICModule.h" // For export macro
00032 #include "vtkImageAlgorithm.h"
00033 
00034 
00035 class vtkCallbackCommand;
00036 class vtkDataArraySelection;
00037 class vtkFloatArray;
00038 class vtkStdString;
00039 class vtkMultiProcessController;
00040 class vtkInformation;
00041 //BTX
00042 class VPICDataSet;
00043 class GridExchange;
00044 //ETX
00045 class VTKIOVPIC_EXPORT vtkVPICReader : public vtkImageAlgorithm
00046 {
00047 public:
00048   static vtkVPICReader *New();
00049   vtkTypeMacro(vtkVPICReader,vtkImageAlgorithm);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00054   vtkSetStringMacro(FileName);
00055   vtkGetStringMacro(FileName);
00057 
00059 
00060   vtkSetVector3Macro(Stride, int);
00061   vtkGetVector3Macro(Stride, int);
00063 
00065 
00066   vtkSetVector2Macro(XExtent, int);
00067   vtkSetVector2Macro(YExtent, int);
00068   vtkSetVector2Macro(ZExtent, int);
00070 
00071   // Get the full layout size in files for setting the range in GUI
00072   vtkGetVector2Macro(XLayout, int);
00073   vtkGetVector2Macro(YLayout, int);
00074   vtkGetVector2Macro(ZLayout, int);
00075 
00077 
00078   vtkImageData *GetOutput();
00079   vtkImageData *GetOutput(int index);
00081 
00083 
00086   int GetNumberOfPointArrays();
00087   const char* GetPointArrayName(int index);
00088   int GetPointArrayStatus(const char* name);
00089   void SetPointArrayStatus(const char* name, int status);
00090   void DisableAllPointArrays();
00091   void EnableAllPointArrays();
00093 
00094 protected:
00095   vtkVPICReader();
00096   ~vtkVPICReader();
00097 
00098   char *FileName;                       // First field part file giving path
00099 
00100   int Rank;                             // Number of this processor
00101   int TotalRank;                        // Number of processors
00102   int UsedRank;                         // Number of processors used in display
00103 
00104   VPICDataSet* vpicData;                // Data structure controlling access
00105   GridExchange* exchanger;    // Exchange ghost cells between procs
00106 
00107   int NumberOfPieces;                   // Number of files in dataset
00108   vtkIdType NumberOfNodes;              // Number of points in grid
00109   vtkIdType NumberOfCells;              // Number of cells in grid
00110   vtkIdType NumberOfTuples;             // Number of tuples in sub extent
00111 
00112   int WholeExtent[6];                   // Problem image extent
00113   int SubExtent[6];                     // Processor problem extent
00114   int Dimension[3];                     // Size of image
00115   int SubDimension[3];                  // Size of subextent of image
00116   int XLayout[2];                       // Extent in complete files
00117   int YLayout[2];                       // Extent in complete files
00118   int ZLayout[2];                       // Extent in complete files
00119 
00120   int NumberOfVariables;                // Number of variables to display
00121   vtkStdString* VariableName;           // Names of each variable
00122   int* VariableStruct;                  // Scalar, vector or tensor
00123 
00124   int NumberOfTimeSteps;                // Temporal domain
00125   double* TimeSteps;                    // Times available for request
00126   int CurrentTimeStep;                  // Time currently displayed
00127 
00128   int Stride[3];                        // Stride over actual data
00129   int XExtent[2];                       // Subview extent in files
00130   int YExtent[2];                       // Subview extent in files
00131   int ZExtent[2];                       // Subview extent in files
00132 
00133   vtkFloatArray** data;                 // Actual data arrays
00134   int* dataLoaded;                      // Data is loaded for current time
00135 
00136   int Start[3];                         // Start offset for processor w ghosts
00137   int GhostDimension[3];                // Dimension including ghosts on proc
00138   int NumberOfGhostTuples;              // Total ghost cells per component
00139   int ghostLevel0;                      // Left plane number of ghosts
00140   int ghostLevel1;                      // Right plane number of ghosts
00141 
00142   // Controls initializing and querrying MPI
00143   vtkMultiProcessController * MPIController;
00144 
00145   // Selected field of interest
00146   vtkDataArraySelection* PointDataArraySelection;
00147 
00148   // Observer to modify this object when array selections are modified
00149   vtkCallbackCommand* SelectionObserver;
00150 
00151   int RequestData(vtkInformation *, vtkInformationVector **,
00152                   vtkInformationVector *);
00153   int RequestInformation(vtkInformation *, vtkInformationVector **inVector,
00154                          vtkInformationVector *);
00155 
00156   void LoadVariableData(int var, int timeStep);
00157   void LoadComponent(
00158         float* varData,
00159         float* block,
00160         int comp,
00161         int numberOfComponents);
00162 
00163   static void SelectionCallback(vtkObject* caller, unsigned long eid,
00164                                 void* clientdata, void* calldata);
00165   static void EventCallback(vtkObject* caller, unsigned long eid,
00166                                 void* clientdata, void* calldata);
00167 
00168 
00169 private:
00170   vtkVPICReader(const vtkVPICReader&);  // Not implemented.
00171   void operator=(const vtkVPICReader&); // Not implemented.
00172 };
00173 
00174 #endif