VTK  9.3.20240419
vtkAMRBaseParticlesReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
9 #ifndef vtkAMRBaseParticlesReader_h
10 #define vtkAMRBaseParticlesReader_h
11 
12 #include "vtkIOAMRModule.h" // For export macro
14 
15 VTK_ABI_NAMESPACE_BEGIN
16 class vtkInformation;
18 class vtkIndent;
20 class vtkPolyData;
22 class vtkCallbackCommand;
23 
25 {
26 public:
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
31 
34  vtkGetMacro(Frequency, int);
35  vtkSetMacro(Frequency, int);
37 
39 
42  vtkGetObjectMacro(Controller, vtkMultiProcessController);
45 
47 
50  vtkSetMacro(FilterLocation, vtkTypeBool);
51  vtkGetMacro(FilterLocation, vtkTypeBool);
52  vtkBooleanMacro(FilterLocation, vtkTypeBool);
54 
56 
60  vtkGetObjectMacro(ParticleDataArraySelection, vtkDataArraySelection);
62 
67 
72  const char* GetParticleArrayName(int index);
73 
75 
78  int GetParticleArrayStatus(const char* name);
79  void SetParticleArrayStatus(const char* name, int status);
81 
82  virtual void SetFileName(VTK_FILEPATH const char* fileName);
84 
86 
89  inline void SetMinLocation(double minx, double miny, double minz)
90  {
91  this->MinLocation[0] = minx;
92  this->MinLocation[1] = miny;
93  this->MinLocation[2] = minz;
94  }
96 
98 
101  inline void SetMaxLocation(double maxx, double maxy, double maxz)
102  {
103  this->MaxLocation[0] = maxx;
104  this->MaxLocation[1] = maxy;
105  this->MaxLocation[2] = maxz;
106  }
108 
112  virtual int GetTotalNumberOfParticles() = 0;
113 
114 protected:
117 
124  virtual void ReadMetaData() = 0;
125 
130  virtual vtkPolyData* ReadParticles(int blkIdx) = 0;
131 
138  bool CheckLocation(double x, double y, double z);
139 
143  bool IsParallel();
144 
149  bool IsBlockMine(int blkIdx);
150 
158  int GetBlockProcessId(int blkIdx);
159 
164  void Initialize();
165 
167 
173 
180 
185  virtual void SetupParticleDataSelections() = 0;
186 
192  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
193 
195 
198  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
199  vtkInformationVector* outputVector) override;
202 
204 
206  double MinLocation[3];
207  double MaxLocation[3];
208 
211 
214  char* FileName;
215 
216 private:
218  void operator=(const vtkAMRBaseParticlesReader&) = delete;
219 };
220 
221 VTK_ABI_NAMESPACE_END
222 #endif /* vtkAMRBaseParticlesReader_h */
An abstract base class that implements all the common functionality for all particle readers.
const char * GetParticleArrayName(int index)
Get the particle array name of the array associated with the given index.
bool CheckLocation(double x, double y, double z)
Filters particles by their location.
bool IsBlockMine(int blkIdx)
Determines if the block associated with the given block index belongs to the process that executes th...
void SetParticleArrayStatus(const char *name, int status)
Get/Set whether the particle array status.
vtkMultiProcessController * Controller
bool IsParallel()
Determines whether this reader instance is running in parallel or not.
virtual void SetFileName(VTK_FILEPATH const char *fileName)
int GetBlockProcessId(int blkIdx)
Given the block index, this method determines the process Id.
~vtkAMRBaseParticlesReader() override
void InitializeParticleDataSelections()
Initializes the ParticleDataArraySelection object.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetNumberOfParticleArrays()
Get the number of particles arrays available in the input.
virtual void ReadMetaData()=0
Reads the metadata, e.g., the number of blocks in the file.
virtual vtkPolyData * ReadParticles(int blkIdx)=0
Reads the particles corresponding to the block associated with the given supplied block index.
vtkCallbackCommand * SelectionObserver
Standard Array selection variables & methods.
int GetParticleArrayStatus(const char *name)
Get/Set whether the particle array status.
void SetMinLocation(double minx, double miny, double minz)
Sets the min location.
void Initialize()
Initializes the AMR Particles reader NOTE: must be called in the constructor of concrete classes.
void SetMaxLocation(double maxx, double maxy, double maxz)
Sets the max location.
int FillOutputPortInformation(int port, vtkInformation *info) override
Standard pipeline operations.
virtual void SetController(vtkMultiProcessController *)
Set & Get the multi-process controller.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard pipeline operations.
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Call-back registered with the SelectionObserver for selecting/deselecting particles.
vtkDataArraySelection * ParticleDataArraySelection
Standard Array selection variables & methods.
virtual void SetupParticleDataSelections()=0
Sets up the ParticleDataArraySelection.
virtual int GetTotalNumberOfParticles()=0
Returns the total number of particles.
supports function callbacks
Store on/off settings for data arrays, etc.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:162
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH