42 #ifndef vtkAbstractGridConnectivity_h 43 #define vtkAbstractGridConnectivity_h 47 #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(
157 void RegisterGridGhostArrays(
168 void RegisterGridNodes(
const int gridID,
vtkPoints* nodes);
175 void AllocateUserRegisterDataStructures();
176 void DeAllocateUserRegisterDataStructures();
184 void AllocateInternalDataStructures();
185 void DeAllocateInternalDataStructures();
216 if (!this->AllocatedGhostDataStructures)
221 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
222 (gridID < static_cast<int>(this->NumberOfGrids)));
223 assert(
"pre: Ghosted point ghost array" &&
224 (this->NumberOfGrids == this->GhostedPointGhostArray.size()));
226 return (this->GhostedPointGhostArray[gridID]);
232 if (!this->AllocatedGhostDataStructures)
237 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
238 (gridID < static_cast<int>(this->NumberOfGrids)));
239 assert(
"pre: Ghosted point ghost array" &&
240 (this->NumberOfGrids == this->GhostedCellGhostArray.size()));
242 return (this->GhostedCellGhostArray[gridID]);
248 if (!this->AllocatedGhostDataStructures)
253 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
254 (gridID < static_cast<int>(this->NumberOfGrids)));
256 "pre: Ghosted point ghost array" && (this->NumberOfGrids == this->GhostedGridPointData.size()));
258 return (this->GhostedGridPointData[gridID]);
264 if (!this->AllocatedGhostDataStructures)
269 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
270 (gridID < static_cast<int>(this->NumberOfGrids)));
272 "pre: Ghosted point ghost array" && (this->NumberOfGrids == this->GhostedGridCellData.size()));
274 return (this->GhostedGridCellData[gridID]);
280 if (!this->AllocatedGhostDataStructures)
285 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
286 (gridID < static_cast<int>(this->NumberOfGrids)));
288 "pre: Ghosted point ghost array" && (this->NumberOfGrids == this->GhostedGridPoints.size()));
290 return (this->GhostedGridPoints[gridID]);
297 assert(
"pre: Allocating UserRegister for N > 0 grids" && (this->NumberOfGrids > 0));
299 this->GridPointGhostArrays.resize(this->NumberOfGrids,
nullptr);
300 this->GridCellGhostArrays.resize(this->NumberOfGrids,
nullptr);
301 this->GridPointData.resize(this->NumberOfGrids,
nullptr);
302 this->GridCellData.resize(this->NumberOfGrids,
nullptr);
303 this->GridPoints.resize(this->NumberOfGrids,
nullptr);
309 assert(
"pre: Data-structure has not been properly allocated" &&
310 (this->GridPointGhostArrays.size() == this->NumberOfGrids));
311 assert(
"pre: Data-structure has not been properly allocated" &&
312 (this->GridCellGhostArrays.size() == this->NumberOfGrids));
313 assert(
"pre: Data-structure has not been properly allocated" &&
314 (this->GridPointData.size() == this->NumberOfGrids));
315 assert(
"pre: Data-structure has not been properly allocated" &&
316 (this->GridCellData.size() == this->NumberOfGrids));
317 assert(
"pre: Data-structure has not been properly allocated" &&
318 (this->GridPoints.size() == this->NumberOfGrids));
320 for (
unsigned int i = 0; i < this->NumberOfGrids; ++i)
332 if (this->GridPointData[i] !=
nullptr)
334 this->GridPointData[i]->Delete();
336 if (this->GridCellData[i] !=
nullptr)
338 this->GridCellData[i]->Delete();
340 if (this->GridPoints[i] !=
nullptr)
342 this->GridPoints[i]->Delete();
346 this->GridPointGhostArrays.clear();
347 this->GridCellGhostArrays.clear();
348 this->GridPointData.clear();
349 this->GridCellData.clear();
350 this->GridPoints.clear();
356 assert(
"pre: Allocating Internal data-structured for N > 0 grids" && (this->NumberOfGrids > 0));
358 this->GhostedGridPointData.resize(this->NumberOfGrids,
nullptr);
359 this->GhostedGridCellData.resize(this->NumberOfGrids,
nullptr);
360 this->GhostedPointGhostArray.resize(this->NumberOfGrids,
nullptr);
361 this->GhostedCellGhostArray.resize(this->NumberOfGrids,
nullptr);
362 this->GhostedGridPoints.resize(this->NumberOfGrids,
nullptr);
363 this->AllocatedGhostDataStructures =
true;
369 if (!this->AllocatedGhostDataStructures)
374 assert(
"pre: Data-structure has not been properly allocated" &&
375 (this->GhostedGridPointData.size() == this->NumberOfGrids));
376 assert(
"pre: Data-structure has not been properly allocated" &&
377 (this->GhostedGridCellData.size() == this->NumberOfGrids));
378 assert(
"pre: Data-structure has not been properly allocated" &&
379 (this->GhostedPointGhostArray.size() == this->NumberOfGrids));
380 assert(
"pre: Data-structure has not been properly allocated" &&
381 (this->GhostedCellGhostArray.size() == this->NumberOfGrids));
382 assert(
"pre: Data-structure has not been properly allocated" &&
383 (this->GhostedGridPoints.size() == this->NumberOfGrids));
385 for (
unsigned int i = 0; i < this->NumberOfGrids; ++i)
387 if (this->GhostedGridPointData[i] !=
nullptr)
389 this->GhostedGridPointData[i]->Delete();
391 if (this->GhostedGridCellData[i] !=
nullptr)
393 this->GhostedGridCellData[i]->Delete();
395 if (this->GhostedPointGhostArray[i] !=
nullptr)
397 this->GhostedPointGhostArray[i]->Delete();
399 if (this->GhostedCellGhostArray[i] !=
nullptr)
401 this->GhostedCellGhostArray[i]->Delete();
403 if (this->GhostedGridPoints[i] !=
nullptr)
405 this->GhostedGridPoints[i]->Delete();
409 this->GhostedGridPointData.clear();
410 this->GhostedGridCellData.clear();
411 this->GhostedPointGhostArray.clear();
412 this->GhostedCellGhostArray.clear();
413 this->GhostedGridPoints.clear();
415 this->AllocatedGhostDataStructures =
false;
423 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
424 (gridID < static_cast<int>(this->NumberOfGrids)));
425 assert(
"pre: GridPointGhostArrays has not been allocated" &&
426 (this->GridPointGhostArrays.size() == this->NumberOfGrids));
427 assert(
"pre: GridCellGhostArrays has not been allocated" &&
428 (this->GridCellGhostArrays.size() == this->NumberOfGrids));
431 this->GridPointGhostArrays[gridID] = nodesArray;
432 this->GridCellGhostArrays[gridID] = cellsArray;
440 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
441 (gridID < static_cast<int>(this->NumberOfGrids)));
442 assert(
"pre: GridPointData has not been allocated!" &&
443 (this->GridPointData.size() == this->NumberOfGrids));
444 assert(
"pre: GridCellData has not been allocated!" &&
445 (this->GridCellData.size() == this->NumberOfGrids));
448 if (PointData !=
nullptr)
450 assert(
"pre: GridPointData[gridID] must be nullptr" && this->GridPointData[gridID] ==
nullptr);
452 this->GridPointData[gridID]->ShallowCopy(PointData);
456 this->GridPointData[gridID] =
nullptr;
459 if (CellData !=
nullptr)
461 assert(
"pre: GridCellData[gridID] must be nullptr" && this->GridCellData[gridID] ==
nullptr);
463 this->GridCellData[gridID]->ShallowCopy(CellData);
467 this->GridCellData[gridID] =
nullptr;
475 assert(
"pre: GridID is out-of-bound GridPointData" && (gridID >= 0) &&
476 (gridID < static_cast<int>(this->NumberOfGrids)));
478 "pre: GridPoints has not been allocated!" && (this->GridPoints.size() == this->NumberOfGrids));
480 if (nodes !=
nullptr)
482 assert(
"pre:GridPoints[gridID] must be nullptr" && this->GridPoints[gridID] ==
nullptr);
484 this->GridPoints[gridID]->SetDataTypeToDouble();
485 this->GridPoints[gridID]->ShallowCopy(nodes);
489 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.
std::vector< vtkUnsignedCharArray * > GridCellGhostArrays
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< vtkPointData * > GridPointData
represent and manipulate cell attribute data
static vtkPointData * New()
std::vector< vtkUnsignedCharArray * > GridPointGhostArrays
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< vtkPoints * > GhostedGridPoints
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...
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
std::vector< vtkCellData * > GhostedGridCellData
std::vector< vtkCellData * > GridCellData
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< vtkPointData * > GhostedGridPointData
std::vector< vtkUnsignedCharArray * > GhostedPointGhostArray
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.
void DeAllocateInternalDataStructures()
Allocated/De-allocate the data-structures where the ghosted grid data will be stored.
std::vector< vtkUnsignedCharArray * > GhostedCellGhostArray
represent and manipulate 3D points
std::vector< vtkPoints * > GridPoints