41 #ifndef VTKABSTRACTGRIDCONNECTIVITY_H_ 42 #define VTKABSTRACTGRIDCONNECTIVITY_H_ 79 virtual void SetNumberOfGrids(
const unsigned int N ) = 0;
85 virtual void ComputeNeighbors( ) = 0;
91 virtual void CreateGhostLayers(
const int N=1 ) = 0;
109 vtkPointData* GetGhostedGridPointData(
const int gridID );
115 vtkCellData* GetGhostedGridCellData(
const int gridID );
121 vtkPoints* GetGhostedPoints(
const int gridID );
129 virtual void FillGhostArrays(
137 void RegisterGridGhostArrays(
144 void RegisterFieldData(
150 void RegisterGridNodes(
const int gridID,
vtkPoints *nodes );
156 void AllocateUserRegisterDataStructures();
157 void DeAllocateUserRegisterDataStructures();
163 void AllocateInternalDataStructures();
164 void DeAllocateInternalDataStructures();
197 if( !this->AllocatedGhostDataStructures )
203 assert(
"pre: GridID is out-of-bound GridPointData" &&
204 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids) ) );
205 assert(
"pre: Ghosted point ghost array" &&
206 (this->NumberOfGrids == this->GhostedPointGhostArray.size() ) );
208 return( this->GhostedPointGhostArray[ gridID ] );
215 if( !this->AllocatedGhostDataStructures )
220 assert(
"pre: GridID is out-of-bound GridPointData" &&
221 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
222 assert(
"pre: Ghosted point ghost array" &&
223 (this->NumberOfGrids == this->GhostedCellGhostArray.size() ) );
225 return( this->GhostedCellGhostArray[ gridID ] );
232 if( !this->AllocatedGhostDataStructures )
237 assert(
"pre: GridID is out-of-bound GridPointData" &&
238 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
239 assert(
"pre: Ghosted point ghost array" &&
240 (this->NumberOfGrids == this->GhostedGridPointData.size() ) );
242 return( this->GhostedGridPointData[ gridID ] );
249 if( !this->AllocatedGhostDataStructures )
254 assert(
"pre: GridID is out-of-bound GridPointData" &&
255 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
256 assert(
"pre: Ghosted point ghost array" &&
257 (this->NumberOfGrids == this->GhostedGridCellData.size() ) );
259 return( this->GhostedGridCellData[ gridID ] );
266 if( !this->AllocatedGhostDataStructures )
271 assert(
"pre: GridID is out-of-bound GridPointData" &&
272 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
273 assert(
"pre: Ghosted point ghost array" &&
274 (this->NumberOfGrids == this->GhostedGridPoints.size() ) );
276 return( this->GhostedGridPoints[ gridID ] );
284 assert(
"pre: Allocating UserRegister for N > 0 grids" &&
285 (this->NumberOfGrids > 0) );
287 this->GridPointGhostArrays.resize( this->NumberOfGrids, NULL );
288 this->GridCellGhostArrays.resize( this->NumberOfGrids, NULL );
289 this->GridPointData.resize( this->NumberOfGrids, NULL );
290 this->GridCellData.resize( this->NumberOfGrids, NULL );
291 this->GridPoints.resize( this->NumberOfGrids, NULL );
298 assert(
"pre: Data-structure has not been properly allocated" &&
299 (this->GridPointGhostArrays.size() == this->NumberOfGrids ) );
300 assert(
"pre: Data-structure has not been properly allocated" &&
301 (this->GridCellGhostArrays.size() == this->NumberOfGrids ) );
302 assert(
"pre: Data-structure has not been properly allocated" &&
303 (this->GridPointData.size() == this->NumberOfGrids ) );
304 assert(
"pre: Data-structure has not been properly allocated" &&
305 (this->GridCellData.size() == this->NumberOfGrids ) );
306 assert(
"pre: Data-structure has not been properly allocated" &&
307 (this->GridPoints.size() == this->NumberOfGrids ) );
309 for(
unsigned int i=0; i < this->NumberOfGrids; ++i )
321 if( this->GridPointData[i] != NULL )
323 this->GridPointData[i]->Delete();
325 if( this->GridCellData[i] != NULL )
327 this->GridCellData[i]->Delete();
329 if( this->GridPoints[i] != NULL )
331 this->GridPoints[i]->Delete();
335 this->GridPointGhostArrays.clear();
336 this->GridCellGhostArrays.clear();
337 this->GridPointData.clear();
338 this->GridCellData.clear();
339 this->GridPoints.clear();
346 assert(
"pre: Allocating Internal data-structured for N > 0 grids" &&
347 (this->NumberOfGrids > 0) );
349 this->GhostedGridPointData.resize( this->NumberOfGrids, NULL );
350 this->GhostedGridCellData.resize( this->NumberOfGrids, NULL );
351 this->GhostedPointGhostArray.resize( this->NumberOfGrids, NULL );
352 this->GhostedCellGhostArray.resize( this->NumberOfGrids, NULL );
353 this->GhostedGridPoints.resize( this->NumberOfGrids, NULL );
354 this->AllocatedGhostDataStructures =
true;
361 if( !this->AllocatedGhostDataStructures )
366 assert(
"pre: Data-structure has not been properly allocated" &&
367 (this->GhostedGridPointData.size() == this->NumberOfGrids) );
368 assert(
"pre: Data-structure has not been properly allocated" &&
369 (this->GhostedGridCellData.size() == this->NumberOfGrids) );
370 assert(
"pre: Data-structure has not been properly allocated" &&
371 (this->GhostedPointGhostArray.size() == this->NumberOfGrids) );
372 assert(
"pre: Data-structure has not been properly allocated" &&
373 (this->GhostedCellGhostArray.size() == this->NumberOfGrids ) );
374 assert(
"pre: Data-structure has not been properly allocated" &&
375 (this->GhostedGridPoints.size() == this->NumberOfGrids ) );
377 for(
unsigned int i=0; i < this->NumberOfGrids; ++i )
379 if( this->GhostedGridPointData[i] != NULL )
381 this->GhostedGridPointData[i]->Delete();
383 if( this->GhostedGridCellData[i] != NULL )
385 this->GhostedGridCellData[i]->Delete();
387 if( this->GhostedPointGhostArray[i] != NULL )
389 this->GhostedPointGhostArray[i]->Delete();
391 if( this->GhostedCellGhostArray[i] != NULL )
393 this->GhostedCellGhostArray[i]->Delete();
395 if( this->GhostedGridPoints[i] != NULL )
397 this->GhostedGridPoints[i]->Delete();
401 this->GhostedGridPointData.clear();
402 this->GhostedGridCellData.clear();
403 this->GhostedPointGhostArray.clear();
404 this->GhostedCellGhostArray.clear();
405 this->GhostedGridPoints.clear();
407 this->AllocatedGhostDataStructures =
false;
417 assert(
"pre: GridID is out-of-bound GridPointData" &&
418 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
419 assert(
"pre: GridPointGhostArrays has not been allocated" &&
420 (this->GridPointGhostArrays.size() == this->NumberOfGrids) );
421 assert(
"pre: GridCellGhostArrays has not been allocated" &&
422 (this->GridCellGhostArrays.size() == this->NumberOfGrids ) );
425 this->GridPointGhostArrays[ gridID ] = nodesArray;
426 this->GridCellGhostArrays[ gridID ] = cellsArray;
434 assert(
"pre: GridID is out-of-bound GridPointData" &&
435 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
436 assert(
"pre: GridPointData has not been allocated!" &&
437 (this->GridPointData.size() == this->NumberOfGrids ) );
438 assert(
"pre: GridCellData has not been allocated!" &&
439 (this->GridCellData.size() == this->NumberOfGrids ) );
442 if( PointData != NULL )
444 assert(
"pre: GridPointData[gridID] must be NULL" &&
445 this->GridPointData[ gridID ]==NULL );
447 this->GridPointData[ gridID ]->ShallowCopy( PointData );
451 this->GridPointData[ gridID ] = NULL;
454 if( CellData != NULL )
456 assert(
"pre: GridCellData[gridID] must be NULL" &&
457 this->GridCellData[gridID]==NULL );
459 this->GridCellData[ gridID ]->ShallowCopy( CellData );
463 this->GridCellData[ gridID ] = NULL;
472 assert(
"pre: GridID is out-of-bound GridPointData" &&
473 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
474 assert(
"pre: GridPoints has not been allocated!" &&
475 (this->GridPoints.size() == this->NumberOfGrids) );
479 assert(
"pre:GridPoints[gridID] must be NULL" &&
480 this->GridPoints[gridID]==NULL );
482 this->GridPoints[ gridID ]->SetDataTypeToDouble();
483 this->GridPoints[ gridID ]->ShallowCopy( nodes );
487 this->GridPoints[ gridID ] = NULL;
unsigned int NumberOfGhostLayers
void RegisterFieldData(const int gridID, vtkPointData *PointData, vtkCellData *CellData)
abstract base class for most VTK objects
represent and manipulate point attribute data
std::vector< vtkUnsignedCharArray *> GhostedPointGhostArray
#define vtkGetMacro(name, type)
represent and manipulate cell attribute data
std::vector< vtkPoints *> GridPoints
static vtkPointData * New()
vtkCellData * GetGhostedGridCellData(const int gridID)
void DeAllocateUserRegisterDataStructures()
#define vtkTypeMacro(thisClass, superclass)
std::vector< vtkUnsignedCharArray *> GridPointGhostArrays
static vtkCellData * New()
vtkUnsignedCharArray * GetGhostedPointGhostArray(const int gridID)
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
vtkUnsignedCharArray * GetGhostedCellGhostArray(const int gridID)
std::vector< vtkUnsignedCharArray *> GridCellGhostArrays
std::vector< vtkPointData *> GhostedGridPointData
vtkPointData * GetGhostedGridPointData(const int gridID)
bool AllocatedGhostDataStructures
dynamic, self-adjusting array of unsigned char
void RegisterGridGhostArrays(const int gridID, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
unsigned int NumberOfGrids
unsigned int GetNumberOfGrids()
vtkPoints * GetGhostedPoints(const int gridID)
std::vector< vtkCellData *> GhostedGridCellData
std::vector< vtkUnsignedCharArray *> GhostedCellGhostArray
void RegisterGridNodes(const int gridID, vtkPoints *nodes)
void AllocateUserRegisterDataStructures()
void AllocateInternalDataStructures()
std::vector< vtkPoints *> GhostedGridPoints
#define VTKFILTERSGEOMETRY_EXPORT
void DeAllocateInternalDataStructures()
std::vector< vtkPointData *> GridPointData
represent and manipulate 3D points
std::vector< vtkCellData *> GridCellData
#define vtkSetMacro(name, type)