VTK
dox/IO/AMR/vtkAMRBaseParticlesReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003  Program:   Visualization Toolkit
00004  Module:    vtkAMRBaseParticlesReader.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  =========================================================================*/
00022 #ifndef VTKAMRBASEPARTICLESREADER_H_
00023 #define VTKAMRBASEPARTICLESREADER_H_
00024 
00025 #include "vtkIOAMRModule.h" // For export macro
00026 #include "vtkMultiBlockDataSetAlgorithm.h"
00027 
00028 class vtkInformation;
00029 class vtkInformationVector;
00030 class vtkIndent;
00031 class vtkMultiProcessController;
00032 class vtkPolyData;
00033 class vtkDataArraySelection;
00034 class vtkCallbackCommand;
00035 
00036 class VTKIOAMR_EXPORT vtkAMRBaseParticlesReader :
00037   public vtkMultiBlockDataSetAlgorithm
00038 {
00039 public:
00040   vtkTypeMacro( vtkAMRBaseParticlesReader, vtkMultiBlockDataSetAlgorithm );
00041   void PrintSelf(ostream &os, vtkIndent indent );
00042 
00044 
00045   vtkGetMacro(Frequency,int);
00046   vtkSetMacro(Frequency,int);
00048 
00050 
00051   vtkGetMacro(Controller, vtkMultiProcessController* );
00052   vtkSetMacro(Controller, vtkMultiProcessController* );
00054 
00056 
00057   vtkSetMacro(FilterLocation,int);
00058   vtkGetMacro(FilterLocation,int);
00059   vtkBooleanMacro(FilterLocation,int);
00061 
00062 
00064 
00066   vtkGetObjectMacro(ParticleDataArraySelection,vtkDataArraySelection);
00068 
00070   int GetNumberOfParticleArrays();
00071 
00074   const char* GetParticleArrayName( int index );
00075 
00077 
00078   int GetParticleArrayStatus( const char* name );
00079   void SetParticleArrayStatus( const char* name, int status );
00081 
00082 
00083   virtual void SetFileName( const char *fileName );
00084   vtkGetStringMacro(FileName);
00085 
00087 
00088   inline void SetMinLocation(
00089       const double minx, const double miny, const double minz )
00090     {
00091     this->MinLocation[ 0 ] = minx;
00092     this->MinLocation[ 1 ] = miny;
00093     this->MinLocation[ 2 ] = minz;
00094     }
00096 
00098 
00099   inline void SetMaxLocation(
00100       const double maxx, const double maxy, const double maxz )
00101     {
00102     this->MaxLocation[ 0 ] = maxx;
00103     this->MaxLocation[ 1 ] = maxy;
00104     this->MaxLocation[ 2 ] = maxz;
00105     }
00107 
00109   virtual int GetTotalNumberOfParticles() = 0;
00110 
00111 protected:
00112   vtkAMRBaseParticlesReader();
00113   virtual ~vtkAMRBaseParticlesReader();
00114 
00119   virtual void ReadMetaData() = 0;
00120 
00123   virtual vtkPolyData* ReadParticles( const int blkIdx ) = 0;
00124 
00129   bool CheckLocation( const double x, const double y, const double z );
00130 
00133   bool IsParallel( );
00134 
00137   bool IsBlockMine( const int blkIdx );
00138 
00144   int GetBlockProcessId( const int blkIdx );
00145 
00148   void Initialize();
00149 
00151 
00152   vtkDataArraySelection *ParticleDataArraySelection;
00153   vtkCallbackCommand *SelectionObserver;
00155 
00159   void InitializeParticleDataSelections();
00160 
00163   virtual void SetupParticleDataSelections() = 0;
00164 
00166 
00168   static void SelectionModifiedCallback(
00169    vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
00171 
00173 
00174   virtual int RequestData( vtkInformation *request,
00175       vtkInformationVector **inputVector,
00176       vtkInformationVector *outputVector );
00177   virtual int FillOutputPortInformation( int port, vtkInformation *info );
00179 
00180   int NumberOfBlocks;
00181 
00182   int FilterLocation;
00183   double MinLocation[3];
00184   double MaxLocation[3];
00185 
00186   int Frequency;
00187   vtkMultiProcessController *Controller;
00188 
00189   bool  InitialRequest;
00190   bool  Initialized;
00191   char *FileName;
00192 
00193 private:
00194   vtkAMRBaseParticlesReader( const vtkAMRBaseParticlesReader& ); // Not implemented
00195   void operator=(const vtkAMRBaseParticlesReader& ); // Not implemented
00196 };
00197 
00198 #endif /* VTKAMRBASEPARTICLESREADER_H_ */