42 #ifndef vtkAbstractGridConnectivity_h 43 #define vtkAbstractGridConnectivity_h 46 #include "vtkFiltersGeometryModule.h" 73 vtkSetMacro( NumberOfGhostLayers,
unsigned int );
74 vtkGetMacro( NumberOfGhostLayers,
unsigned int);
84 virtual void SetNumberOfGrids(
const unsigned int N ) = 0;
94 virtual void ComputeNeighbors( ) = 0;
102 virtual void CreateGhostLayers(
const int N=1 ) = 0;
126 vtkPointData* GetGhostedGridPointData(
const int gridID );
134 vtkCellData* GetGhostedGridCellData(
const int gridID );
142 vtkPoints* GetGhostedPoints(
const int gridID );
151 virtual void FillGhostArrays(
159 void RegisterGridGhostArrays(
166 void RegisterFieldData(
172 void RegisterGridNodes(
const int gridID,
vtkPoints *nodes );
180 void AllocateUserRegisterDataStructures();
181 void DeAllocateUserRegisterDataStructures();
189 void AllocateInternalDataStructures();
190 void DeAllocateInternalDataStructures();
221 if( !this->AllocatedGhostDataStructures )
227 assert(
"pre: GridID is out-of-bound GridPointData" &&
228 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids) ) );
229 assert(
"pre: Ghosted point ghost array" &&
230 (this->NumberOfGrids == this->GhostedPointGhostArray.size() ) );
232 return( this->GhostedPointGhostArray[ gridID ] );
239 if( !this->AllocatedGhostDataStructures )
244 assert(
"pre: GridID is out-of-bound GridPointData" &&
245 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
246 assert(
"pre: Ghosted point ghost array" &&
247 (this->NumberOfGrids == this->GhostedCellGhostArray.size() ) );
249 return( this->GhostedCellGhostArray[ gridID ] );
256 if( !this->AllocatedGhostDataStructures )
261 assert(
"pre: GridID is out-of-bound GridPointData" &&
262 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
263 assert(
"pre: Ghosted point ghost array" &&
264 (this->NumberOfGrids == this->GhostedGridPointData.size() ) );
266 return( this->GhostedGridPointData[ gridID ] );
273 if( !this->AllocatedGhostDataStructures )
278 assert(
"pre: GridID is out-of-bound GridPointData" &&
279 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
280 assert(
"pre: Ghosted point ghost array" &&
281 (this->NumberOfGrids == this->GhostedGridCellData.size() ) );
283 return( this->GhostedGridCellData[ gridID ] );
290 if( !this->AllocatedGhostDataStructures )
295 assert(
"pre: GridID is out-of-bound GridPointData" &&
296 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
297 assert(
"pre: Ghosted point ghost array" &&
298 (this->NumberOfGrids == this->GhostedGridPoints.size() ) );
300 return( this->GhostedGridPoints[ gridID ] );
308 assert(
"pre: Allocating UserRegister for N > 0 grids" &&
309 (this->NumberOfGrids > 0) );
311 this->GridPointGhostArrays.resize( this->NumberOfGrids,
nullptr );
312 this->GridCellGhostArrays.resize( this->NumberOfGrids,
nullptr );
313 this->GridPointData.resize( this->NumberOfGrids,
nullptr );
314 this->GridCellData.resize( this->NumberOfGrids,
nullptr );
315 this->GridPoints.resize( this->NumberOfGrids,
nullptr );
322 assert(
"pre: Data-structure has not been properly allocated" &&
323 (this->GridPointGhostArrays.size() == this->NumberOfGrids ) );
324 assert(
"pre: Data-structure has not been properly allocated" &&
325 (this->GridCellGhostArrays.size() == this->NumberOfGrids ) );
326 assert(
"pre: Data-structure has not been properly allocated" &&
327 (this->GridPointData.size() == this->NumberOfGrids ) );
328 assert(
"pre: Data-structure has not been properly allocated" &&
329 (this->GridCellData.size() == this->NumberOfGrids ) );
330 assert(
"pre: Data-structure has not been properly allocated" &&
331 (this->GridPoints.size() == this->NumberOfGrids ) );
333 for(
unsigned int i=0; i < this->NumberOfGrids; ++i )
345 if( this->GridPointData[i] !=
nullptr )
347 this->GridPointData[i]->Delete();
349 if( this->GridCellData[i] !=
nullptr )
351 this->GridCellData[i]->Delete();
353 if( this->GridPoints[i] !=
nullptr )
355 this->GridPoints[i]->Delete();
359 this->GridPointGhostArrays.clear();
360 this->GridCellGhostArrays.clear();
361 this->GridPointData.clear();
362 this->GridCellData.clear();
363 this->GridPoints.clear();
370 assert(
"pre: Allocating Internal data-structured for N > 0 grids" &&
371 (this->NumberOfGrids > 0) );
373 this->GhostedGridPointData.resize( this->NumberOfGrids,
nullptr );
374 this->GhostedGridCellData.resize( this->NumberOfGrids,
nullptr );
375 this->GhostedPointGhostArray.resize( this->NumberOfGrids,
nullptr );
376 this->GhostedCellGhostArray.resize( this->NumberOfGrids,
nullptr );
377 this->GhostedGridPoints.resize( this->NumberOfGrids,
nullptr );
378 this->AllocatedGhostDataStructures =
true;
385 if( !this->AllocatedGhostDataStructures )
390 assert(
"pre: Data-structure has not been properly allocated" &&
391 (this->GhostedGridPointData.size() == this->NumberOfGrids) );
392 assert(
"pre: Data-structure has not been properly allocated" &&
393 (this->GhostedGridCellData.size() == this->NumberOfGrids) );
394 assert(
"pre: Data-structure has not been properly allocated" &&
395 (this->GhostedPointGhostArray.size() == this->NumberOfGrids) );
396 assert(
"pre: Data-structure has not been properly allocated" &&
397 (this->GhostedCellGhostArray.size() == this->NumberOfGrids ) );
398 assert(
"pre: Data-structure has not been properly allocated" &&
399 (this->GhostedGridPoints.size() == this->NumberOfGrids ) );
401 for(
unsigned int i=0; i < this->NumberOfGrids; ++i )
403 if( this->GhostedGridPointData[i] !=
nullptr )
405 this->GhostedGridPointData[i]->Delete();
407 if( this->GhostedGridCellData[i] !=
nullptr )
409 this->GhostedGridCellData[i]->Delete();
411 if( this->GhostedPointGhostArray[i] !=
nullptr )
413 this->GhostedPointGhostArray[i]->Delete();
415 if( this->GhostedCellGhostArray[i] !=
nullptr )
417 this->GhostedCellGhostArray[i]->Delete();
419 if( this->GhostedGridPoints[i] !=
nullptr )
421 this->GhostedGridPoints[i]->Delete();
425 this->GhostedGridPointData.clear();
426 this->GhostedGridCellData.clear();
427 this->GhostedPointGhostArray.clear();
428 this->GhostedCellGhostArray.clear();
429 this->GhostedGridPoints.clear();
431 this->AllocatedGhostDataStructures =
false;
441 assert(
"pre: GridID is out-of-bound GridPointData" &&
442 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
443 assert(
"pre: GridPointGhostArrays has not been allocated" &&
444 (this->GridPointGhostArrays.size() == this->NumberOfGrids) );
445 assert(
"pre: GridCellGhostArrays has not been allocated" &&
446 (this->GridCellGhostArrays.size() == this->NumberOfGrids ) );
449 this->GridPointGhostArrays[ gridID ] = nodesArray;
450 this->GridCellGhostArrays[ gridID ] = cellsArray;
458 assert(
"pre: GridID is out-of-bound GridPointData" &&
459 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
460 assert(
"pre: GridPointData has not been allocated!" &&
461 (this->GridPointData.size() == this->NumberOfGrids ) );
462 assert(
"pre: GridCellData has not been allocated!" &&
463 (this->GridCellData.size() == this->NumberOfGrids ) );
466 if( PointData !=
nullptr )
468 assert(
"pre: GridPointData[gridID] must be nullptr" &&
469 this->GridPointData[ gridID ]==
nullptr );
471 this->GridPointData[ gridID ]->ShallowCopy( PointData );
475 this->GridPointData[ gridID ] =
nullptr;
478 if( CellData !=
nullptr )
480 assert(
"pre: GridCellData[gridID] must be nullptr" &&
481 this->GridCellData[gridID]==
nullptr );
483 this->GridCellData[ gridID ]->ShallowCopy( CellData );
487 this->GridCellData[ gridID ] =
nullptr;
496 assert(
"pre: GridID is out-of-bound GridPointData" &&
497 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
498 assert(
"pre: GridPoints has not been allocated!" &&
499 (this->GridPoints.size() == this->NumberOfGrids) );
501 if( nodes !=
nullptr )
503 assert(
"pre:GridPoints[gridID] must be nullptr" &&
504 this->GridPoints[gridID]==
nullptr );
506 this->GridPoints[ gridID ]->SetDataTypeToDouble();
507 this->GridPoints[ gridID ]->ShallowCopy( nodes );
511 this->GridPoints[ gridID ] =
nullptr;
unsigned int NumberOfGhostLayers
void RegisterFieldData(const int gridID, vtkPointData *PointData, vtkCellData *CellData)
Registers the grid's field data, i.e., the node and cell data.
abstract base class for most VTK objects
represent and manipulate point attribute data
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< vtkUnsignedCharArray * > GhostedPointGhostArray
represent and manipulate cell attribute data
std::vector< vtkPoints * > GridPoints
static vtkPointData * New()
vtkCellData * GetGhostedGridCellData(const int gridID)
Returns the ghosted grid cell data for the grid associated with the given grid ID.
void DeAllocateUserRegisterDataStructures()
Allocate/De-allocate the data-structures where the user-supplied grids will be registered.
std::vector< vtkUnsignedCharArray * > GridPointGhostArrays
static vtkCellData * New()
vtkUnsignedCharArray * GetGhostedPointGhostArray(const int gridID)
Returns the ghosted points ghost array for the grid associated with the given grid ID...
a simple class to control print indentation
vtkUnsignedCharArray * GetGhostedCellGhostArray(const int gridID)
Returns the ghosted cells ghost array for the grid associated with the given grid ID...
std::vector< vtkUnsignedCharArray * > GridCellGhostArrays
std::vector< vtkPointData * > GhostedGridPointData
A superclass that defines the interface to be implemented by all concrete grid connectivity classes...
vtkPointData * GetGhostedGridPointData(const int gridID)
Returns the ghosted grid point data for the grid associated with the given grid ID.
bool AllocatedGhostDataStructures
dynamic, self-adjusting array of unsigned char
void RegisterGridGhostArrays(const int gridID, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
Registers the ghostarrays for the given grid.
unsigned int NumberOfGrids
unsigned int GetNumberOfGrids()
Returns the total number of grids.
vtkPoints * GetGhostedPoints(const int gridID)
Returns the ghosted grid points for the grid associated with the given grid ID.
std::vector< vtkCellData * > GhostedGridCellData
std::vector< vtkUnsignedCharArray * > GhostedCellGhostArray
void RegisterGridNodes(const int gridID, vtkPoints *nodes)
Registers the grid nodes for the grid associated with the given gridID.
void AllocateUserRegisterDataStructures()
Allocate/De-allocate the data-structures where the user-supplied grids will be registered.
void AllocateInternalDataStructures()
Allocated/De-allocate the data-structures where the ghosted grid data will be stored.
std::vector< vtkPoints * > GhostedGridPoints
void DeAllocateInternalDataStructures()
Allocated/De-allocate the data-structures where the ghosted grid data will be stored.
std::vector< vtkPointData * > GridPointData
represent and manipulate 3D points
std::vector< vtkCellData * > GridCellData