VTK
dox/IO/ParallelNetCDF/vtkPNetCDFPOPReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtPkNetCDFPOPReader.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 =========================================================================*/
00033 #ifndef __vtkPNetCDFPOPReader_h
00034 #define __vtkPNetCDFPOPReader_h
00035 
00036 #include "vtkIOParallelNetCDFModule.h" // For export macro
00037 #include "vtkRectilinearGridAlgorithm.h"
00038 
00039 class vtkDataArraySelection;
00040 class vtkCallbackCommand;
00041 class vtkMPIController;
00042 class vtkPNetCDFPOPReaderInternal;
00043 
00044 class VTKIOPARALLELNETCDF_EXPORT vtkPNetCDFPOPReader : public vtkRectilinearGridAlgorithm
00045 {
00046 public:
00047   vtkTypeMacro(vtkPNetCDFPOPReader,vtkRectilinearGridAlgorithm);
00048   static vtkPNetCDFPOPReader *New();
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   virtual int GetNumberOfVariableArrays();
00066   virtual const char *GetVariableArrayName(int idx);
00067   virtual int GetVariableArrayStatus(const char *name);
00068   virtual void SetVariableArrayStatus(const char *name, int status);
00070 
00073   void SetReaderRanks(vtkIdList*);
00074 
00075   // Set/Get the vtkMultiProcessController which will handle communications
00076   // for the parallel rendering.
00077   vtkGetObjectMacro(Controller, vtkMPIController);
00078   void SetController(vtkMPIController *controller);
00079 
00080 protected:
00081   vtkPNetCDFPOPReader();
00082   ~vtkPNetCDFPOPReader();
00083 
00084   int RequestData(vtkInformation*,vtkInformationVector**,
00085                   vtkInformationVector*);
00086   virtual int RequestInformation(vtkInformation* request,
00087                                  vtkInformationVector** inputVector,
00088                                  vtkInformationVector* outputVector);
00089 
00090   // Helper function for RequestData:  Reads part of the netCDF
00091   // file and sends sub-arrays to all ranks that need that data
00092   int ReadAndSend( vtkInformation* outInfo, int varID);
00093 
00094   // Returns the MPI rank of the process that should read the specified depth
00095   int ReaderForDepth( unsigned depth);
00096 
00097   bool IsReaderRank();
00098   bool IsFirstReaderRank();
00099 
00100   static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
00101                                         void *clientdata, void *calldata);
00102 
00103   static void EventCallback(vtkObject* caller, unsigned long eid,
00104                             void* clientdata, void* calldata);
00105 
00106   vtkCallbackCommand* SelectionObserver;
00107 
00108   char *FileName;
00109   char *OpenedFileName;
00110   vtkSetStringMacro(OpenedFileName);
00111 
00112   int NCDFFD; //netcdf file descriptor
00113 
00114   int Stride[3];
00115 
00116   vtkMPIController *Controller;
00117 
00118 private:
00119   vtkPNetCDFPOPReader(const vtkPNetCDFPOPReader&);  // Not implemented.
00120   void operator=(const vtkPNetCDFPOPReader&);  // Not implemented.
00121 
00122   vtkPNetCDFPOPReaderInternal* Internals;
00123 };
00124 #endif