VTK
vtkStructuredGridConnectivity.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStructuredGridConnectivity.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
31 #ifndef vtkStructuredGridConnectivity_H_
32 #define vtkStructuredGridConnectivity_H_
33 
34 #define VTK_NO_OVERLAP 0
35 #define VTK_NODE_OVERLAP 1
36 #define VTK_EDGE_OVERLAP 2
37 #define VTK_PARTIAL_OVERLAP 3
38 
39 // VTK include directives
40 #include "vtkFiltersGeometryModule.h" // For export macro
42 #include "vtkStructuredNeighbor.h" // For Structured Neighbor object definition
43 #include "vtkStructuredData.h" // For data description definitions
44 
45 // C++ include directives
46 #include <iostream> // For cout
47 #include <vector> // For STL vector
48 #include <map> // For STL map
49 #include <utility> // For STL pair and overloaded relational operators
50 #include <cassert> // For assert()
51 
52 // Forward Declarations
53 class vtkIdList;
55 class vtkPointData;
56 class vtkCellData;
57 class vtkPoints;
58 
61 {
62 public:
65  void PrintSelf(ostream& os, vtkIndent indent );
66 
68 
69  vtkSetVector6Macro(WholeExtent,int);
70  vtkGetVector6Macro(WholeExtent,int);
72 
74 
75  vtkGetMacro(DataDimension,int);
77 
79  virtual void SetNumberOfGrids( const unsigned int N );
80 
82 
84  virtual void RegisterGrid( const int gridID, int extents[6],
85  vtkUnsignedCharArray* nodesGhostArray,
86  vtkUnsignedCharArray* cellGhostArray,
87  vtkPointData* pointData,
88  vtkCellData* cellData,
89  vtkPoints* gridNodes );
91 
94  void GetGridExtent( const int gridID, int extent[6] );
95 
98  void SetGhostedGridExtent( const int gridID, int ext[6] );
99 
101  void GetGhostedGridExtent( const int gridID, int ext[6] );
102 
104  virtual void ComputeNeighbors();
105 
107 
109  int GetNumberOfNeighbors( const int gridID )
110  { return( static_cast<int>(this->Neighbors[ gridID ].size() )); };
112 
115  vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei);
116 
120  vtkIdList* GetNeighbors( const int gridID, int *extents );
121 
123 
126  void FillGhostArrays(
127  const int gridID,
128  vtkUnsignedCharArray *nodesArray,
129  vtkUnsignedCharArray *cellsArray );
131 
133  virtual void CreateGhostLayers( const int N=1 );
134 
135 protected:
138 
140 
141  bool InBounds( const int idx, const int Lo, const int Hi )
142  { return( (idx>=Lo) && (idx<=Hi) ); };
144 
146 
147  bool StrictlyInsideBounds( const int idx, const int Lo, const int Hi )
148  { return( (idx > Lo) && (idx < Hi) ); };
150 
152 
153  bool IsSubset( int A[2], int B[2] )
154  { return( this->InBounds(A[0], B[0], B[1]) &&
155  this->InBounds(A[1], B[0], B[1]) ); };
157 
159  int Cardinality( int S[2] ) { return( S[1]-S[0]+1 ); };
160 
162 
164  int GetNumberOfNodesPerCell( const int dim )
165  {
166  int numNodes = 0;
167  switch( dim )
168  {
169  case 1:
170  numNodes = 2; // line cell
171  break;
172  case 2:
173  numNodes = 4; // quad cell
174  break;
175  case 3:
176  numNodes = 8; // hex cell
177  break;
178  default:
179  assert( "ERROR: code should not reach here!" && false );
180  } // END switch
181  return( numNodes );
182  }
184 
186 
187  void FillNodesGhostArray(
188  const int gridID, const int dataDescription,
189  int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodeArray );
191 
193 
194  void FillCellsGhostArray(
195  const int dataDescription, const int numNodesPerCell,
196  int dims[3], int CellExtent[6], vtkUnsignedCharArray *nodesArray,
197  vtkUnsignedCharArray *cellsArray );
199 
201 
204  void SearchNeighbors(
205  const int gridID,
206  const int i, const int j, const int k,
207  vtkIdList *neiList );
209 
211 
213  void MarkNodeProperty(
214  const int gridID,
215  const int i, const int j, const int k,
216  int ext[6], int RealExtent[6], unsigned char &pfield );
218 
220 
222  void MarkCellProperty(
223  unsigned char &pfield,
224  unsigned char *nodeGhostFields, const int numNodes );
226 
228  void GetRealExtent( const int gridID, int GridExtent[6],int RealExtent[6] );
229 
231 
233  bool IsGhostNode(
234  int GridExtent[6], int RealExtent[6],
235  const int i, const int j, const int k );
237 
239 
241  bool IsNodeOnBoundaryOfExtent(
242  const int i, const int j, const int k, int ext[6] );
244 
246 
249  bool IsNodeOnSharedBoundary(
250  const int gridID, int RealExtent[6],
251  const int i, const int j, const int k );
253 
257  bool IsNodeOnBoundary( const int i, const int j, const int k );
258 
260 
262  bool IsNodeInterior(
263  const int i, const int j, const int k,
264  int GridExtent[6] );
266 
268 
272  const int i, const int j, const int k,
273  int GridExtent[6] )
274  {
275  bool status = false;
277 
278  switch( this->DataDescription )
279  {
280  case VTK_X_LINE:
281  if( (GridExtent[0] <= i) && (i <= GridExtent[1]) )
282  {
283  status = true;
284  }
285  break;
286  case VTK_Y_LINE:
287  if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) )
288  {
289  status = true;
290  }
291  break;
292  case VTK_Z_LINE:
293  if( (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
294  {
295  status = true;
296  }
297  break;
298  case VTK_XY_PLANE:
299  if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
300  (GridExtent[2] <= j) && (j <= GridExtent[3]) )
301  {
302  status = true;
303  }
304  break;
305  case VTK_YZ_PLANE:
306  if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) &&
307  (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
308  {
309  status = true;
310  }
311  break;
312  case VTK_XZ_PLANE:
313  if( (GridExtent[0] <= i) && (i <= GridExtent[1] ) &&
314  (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
315  {
316  status = true;
317  }
318  break;
319  case VTK_XYZ_GRID:
320  if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
321  (GridExtent[2] <= j) && (j <= GridExtent[3]) &&
322  (GridExtent[4] <= k) && (k <= GridExtent[5]) )
323  {
324  status = true;
325  }
326  break;
327  default:
328  std::cout << "Data description is: " << this->DataDescription << "\n";
329  std::cout.flush();
330  assert( "pre: Undefined data-description!" && false );
331  } // END switch
332 
333  return( status );
334  }
335 
337 
338  void SetNeighbors(
339  const int i, const int j,
340  int i2jOrientation[3], int j2iOrientation[3],
341  int overlapExtent[6] );
343 
345 
351  void DetermineNeighborOrientation(
352  const int idx, int A[2], int B[2], int overlap[2], int orient[3] );
354 
356 
359  void DetectNeighbors(
360  const int i, const int j, int ex1[6], int ex2[6],
361  int orientation[3], int ndim);
363 
369  int IntervalOverlap( int A[2], int B[2], int overlap[2] );
370 
376  int DoPartialOverlap( int s[2], int S[2], int overlap[2] );
377 
379 
384  int PartialOverlap(
385  int A[2], const int CofA,
386  int B[2], const int CofB,
387  int overlap[2] );
389 
392  void EstablishNeighbors( const int i, const int j );
393 
397  void AcquireDataDescription();
398 
406  bool HasBlockConnection( const int gridID, const int blockDirection );
407 
415  void RemoveBlockConnection( const int gridID, const int blockDirection );
416 
424  void AddBlockConnection( const int gridID, const int blockDirection );
425 
428  void ClearBlockConnections( const int gridID );
429 
435  int GetNumberOfConnectingBlockFaces( const int gridID );
436 
439  void SetBlockTopology( const int gridID );
440 
442 
447  void GetIJKBlockOrientation(
448  const int i, const int j, const int k, int ext[6], int orientation[3] );
450 
452 
454  int Get1DOrientation(
455  const int idx, const int ExtentLo, const int ExtentHi,
456  const int OnLo, const int OnHi, const int NotOnBoundary );
458 
461  void CreateGhostedExtent( const int gridID, const int N );
462 
464 
467  void GetGhostedExtent(
468  int *ghostedExtent, int GridExtent[6],
469  const int minIdx, const int maxIdx, const int N);
471 
475  void CreateGhostedMaskArrays(const int gridID);
476 
481  void InitializeGhostData( const int gridID );
482 
486  void AllocatePointData( vtkPointData *RPD, const int N, vtkPointData *PD );
487 
491  void AllocateCellData( vtkCellData *RCD, const int N, vtkCellData *CD );
492 
495  void TransferRegisteredDataToGhostedData( const int gridID );
496 
499  void ComputeNeighborSendAndRcvExtent( const int gridID, const int N );
500 
504  virtual void TransferGhostDataFromNeighbors( const int gridID );
505 
507 
508  void TransferLocalNeighborData(
509  const int gridID, const vtkStructuredNeighbor& Neighor);
511 
513 
514  void CopyCoordinates(
515  vtkPoints *source, vtkIdType sourceIdx,
516  vtkPoints *target, vtkIdType targetIdx );
518 
520 
525  void CopyFieldData(
526  vtkFieldData *source, vtkIdType sourceIdx,
527  vtkFieldData *target, vtkIdType targetIdx );
529 
533  int GetNeighborIndex( const int gridIdx, const int NeighborGridIdx );
534 
536  void PrintExtent( int extent[6] );
537 
540  int WholeExtent[6];
541 
542  // BTX
543  std::vector< int > GridExtents;
544  std::vector< int > GhostedExtents;
545  std::vector< unsigned char > BlockTopology;
546  std::vector< std::vector<vtkStructuredNeighbor> > Neighbors;
547  std::map< std::pair< int,int >, int > NeighborPair2NeighborListIndex;
548  // ETX
549 
550 private:
552  void operator=(const vtkStructuredGridConnectivity& ); // Not implemented
553 };
554 
555 //=============================================================================
556 // INLINE METHODS
557 //=============================================================================
558 
559 //------------------------------------------------------------------------------
561  const int gridIdx, const int NeighborGridIdx )
562 {
563  assert("pre: Grid index is out-of-bounds!" &&
564  (gridIdx >= 0) &&
565  (gridIdx < static_cast<int>(this->NumberOfGrids)));
566  assert("pre: Neighbor grid index is out-of-bounds!" &&
567  (NeighborGridIdx >= 0) &&
568  (NeighborGridIdx < static_cast<int>(this->NumberOfGrids) ) );
569 
570  std::pair<int,int> gridPair = std::make_pair(gridIdx,NeighborGridIdx);
571  assert("pre: Neighboring grid pair does not exist in hash!" &&
572  (this->NeighborPair2NeighborListIndex.find(gridPair) !=
573  this->NeighborPair2NeighborListIndex.end() ) );
574 
575  return(this->NeighborPair2NeighborListIndex[gridPair]);
576 }
577 
578 //------------------------------------------------------------------------------
580  int *ghostedExtent, int GridExtent[6],
581  const int minIdx, const int maxIdx, const int N )
582 {
583  assert( "pre: Number of ghost layers must be N >= 1" && (N >= 1) );
584  assert( "pre: ghosted extent pointer is NULL" && ghostedExtent != NULL);
585 
586  ghostedExtent[minIdx] = GridExtent[minIdx]-N;
587  ghostedExtent[maxIdx] = GridExtent[maxIdx]+N;
588 
589  // Clamp the ghosted extent to be within the WholeExtent
590  ghostedExtent[minIdx] =
591  (ghostedExtent[minIdx] < this->WholeExtent[minIdx] )?
592  this->WholeExtent[minIdx] : ghostedExtent[minIdx];
593  ghostedExtent[maxIdx] =
594  (ghostedExtent[maxIdx] > this->WholeExtent[maxIdx])?
595  this->WholeExtent[maxIdx] : ghostedExtent[maxIdx];
596 }
597 
598 //------------------------------------------------------------------------------
600  const int gridID, int ext[6] )
601 {
602  assert( "pre: gridID is out-of-bounds" &&
603  (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
604  assert( "pre: ghosted-extents vector has not been allocated" &&
605  (this->NumberOfGrids == this->GhostedExtents.size()/6 ) );
606 
607  for( int i=0; i < 6; ++i )
608  {
609  this->GhostedExtents[ gridID*6+i ] = ext[i];
610  }
611 }
612 
613 //------------------------------------------------------------------------------
615  const int gridID, int ext[6])
616 {
617  assert( "pre: gridID out-of-bounds!" &&
618  (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
619  for( int i=0; i < 6; ++i )
620  {
621  ext[i] = this->GridExtents[ gridID*6+i ];
622  }
623 }
624 
625 //------------------------------------------------------------------------------
627  const int gridID, int ext[6])
628 {
629  assert( "pre: gridID out-of-bounds!" &&
630  (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
631 
632  if( this->GhostedExtents.size() == 0 )
633  {
634  ext[0] = ext[2] = ext[4] = -1;
635  ext[1] = ext[3] = ext[5] = 0;
636  vtkErrorMacro( "No ghosted extents found for registered grid extends!!!" );
637  return;
638  }
639 
640  assert( "GhostedExtents are not aligned with registered grid extents" &&
641  ( this->GhostedExtents.size() == this->GridExtents.size() ) );
642  for( int i=0; i < 6; ++i )
643  {
644  ext[i] = this->GhostedExtents[ gridID*6+i ];
645  }
646 }
647 
648 //------------------------------------------------------------------------------
650  const int i, const int j, const int k, int ext[6] )
651 {
652  if( !this->IsNodeWithinExtent( i,j,k, ext) )
653  {
654  return false;
655  }
656 
657  bool status = false;
658  switch( this->DataDescription )
659  {
660  case VTK_X_LINE:
661  if( i==ext[0] || i==ext[1] )
662  {
663  status = true;
664  }
665  break;
666  case VTK_Y_LINE:
667  if( j==ext[2] || j==ext[3] )
668  {
669  status = true;
670  }
671  break;
672  case VTK_Z_LINE:
673  if( k==ext[4] || k==ext[5] )
674  {
675  status = true;
676  }
677  break;
678  case VTK_XY_PLANE:
679  if( (i==ext[0] || i==ext[1]) ||
680  (j==ext[2] || j==ext[3]) )
681  {
682  status = true;
683  }
684  break;
685  case VTK_YZ_PLANE:
686  if( (j==ext[2] || j==ext[3]) ||
687  (k==ext[4] || k==ext[5]) )
688  {
689  status = true;
690  }
691  break;
692  case VTK_XZ_PLANE:
693  if( (i==ext[0] || i==ext[1]) ||
694  (k==ext[4] || k==ext[5]) )
695  {
696  status = true;
697  }
698  break;
699  case VTK_XYZ_GRID:
700  if( (i==ext[0] || i==ext[1]) ||
701  (j==ext[2] || j==ext[3]) ||
702  (k==ext[4] || k==ext[5]) )
703  {
704  status = true;
705  }
706  break;
707  default:
708  std::cout << "Data description is: " << this->DataDescription << "\n";
709  std::cout.flush();
710  assert( "pre: Undefined data-description!" && false );
711  } // END switch
712 
713  return( status );
714 }
715 
716 //------------------------------------------------------------------------------
718  const int i, const int j, const int k,
719  int GridExtent[6] )
720 {
721  bool status = false;
722 
723  switch( this->DataDescription )
724  {
725  case VTK_X_LINE:
726  if( (GridExtent[0] < i) && (i < GridExtent[1]) )
727  {
728  status = true;
729  }
730  break;
731  case VTK_Y_LINE:
732  if( (GridExtent[2] < j) && (j < GridExtent[3] ) )
733  {
734  status = true;
735  }
736  break;
737  case VTK_Z_LINE:
738  if( (GridExtent[4] < k) && (k < GridExtent[5] ) )
739  {
740  status = true;
741  }
742  break;
743  case VTK_XY_PLANE:
744  if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
745  (GridExtent[2] < j) && (j < GridExtent[3]) )
746  {
747  status = true;
748  }
749  break;
750  case VTK_YZ_PLANE:
751  if( (GridExtent[2] < j) && (j < GridExtent[3] ) &&
752  (GridExtent[4] < k) && (k < GridExtent[5] ) )
753  {
754  status = true;
755  }
756  break;
757  case VTK_XZ_PLANE:
758  if( (GridExtent[0] < i) && (i < GridExtent[1] ) &&
759  (GridExtent[4] < k) && (k < GridExtent[5] ) )
760  {
761  status = true;
762  }
763  break;
764  case VTK_XYZ_GRID:
765  if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
766  (GridExtent[2] < j) && (j < GridExtent[3]) &&
767  (GridExtent[4] < k) && (k < GridExtent[5]) )
768  {
769  status = true;
770  }
771  break;
772  default:
773  std::cout << "Data description is: " << this->DataDescription << "\n";
774  std::cout.flush();
775  assert( "pre: Undefined data-description!" && false );
776  } // END switch
777 
778  return( status );
779 }
780 
781 //------------------------------------------------------------------------------
783  const int idx, int A[2], int B[2], int overlap[2], int orient[3] )
784 {
785  assert( "pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3) );
786 
787  // A. Non-overlapping cases
788  if( overlap[0] == overlap[1] )
789  {
790  if( A[1] == B[0] )
791  {
792  orient[ idx ] = vtkStructuredNeighbor::HI;
793  }
794  else if( A[0] == B[1] )
795  {
796  orient[ idx ] = vtkStructuredNeighbor::LO;
797  }
798  else
799  {
800  orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
801  assert( "ERROR: Code should not reach here!" && false );
802  }
803  } // END non-overlapping cases
804  // B. Sub-set cases
805  else if( this->IsSubset( A, B) )
806  {
807  if( (A[0] == B[0]) && (A[1] == B[1]) )
808  {
809  orient[ idx ] = vtkStructuredNeighbor::ONE_TO_ONE;
810  }
811  else if( this->StrictlyInsideBounds( A[0], B[0], B[1] ) &&
812  this->StrictlyInsideBounds( A[1], B[0], B[1] ) )
813  {
814  orient[ idx ] = vtkStructuredNeighbor::SUBSET_BOTH;
815  }
816  else if( A[0] == B[0] )
817  {
818  orient[ idx ] = vtkStructuredNeighbor::SUBSET_HI;
819  }
820  else if( A[1] == B[1] )
821  {
822  orient[ idx ] = vtkStructuredNeighbor::SUBSET_LO;
823  }
824  else
825  {
826  orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
827  assert( "ERROR: Code should not reach here!" && false );
828  }
829  }
830  // C. Super-set cases
831  else if( this->IsSubset( B, A ) )
832  {
833  orient[ idx ] = vtkStructuredNeighbor::SUPERSET;
834  }
835  // D. Partially-overlapping (non-subset) cases
836  else if( !(this->IsSubset(A,B) || this->IsSubset(A,B)) )
837  {
838  if( this->InBounds( A[0], B[0], B[1] ) )
839  {
840  orient[ idx ] = vtkStructuredNeighbor::LO;
841  }
842  else if( this->InBounds( A[1], B[0], B[1] ) )
843  {
844  orient[ idx ] = vtkStructuredNeighbor::HI;
845  }
846  else
847  {
848  orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
849  assert( "ERROR: Code should not reach here!" && false );
850  }
851  }
852  else
853  {
854  orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
855  assert( "ERROR: Code should not reach here!" && false );
856  }
857 }
858 
859 //------------------------------------------------------------------------------
861  const int idx, const int ExtentLo, const int ExtentHi,
862  const int OnLo, const int OnHi, const int NotOnBoundary )
863 {
864  if( idx == ExtentLo )
865  {
866  return OnLo;
867  }
868  else if( idx == ExtentHi )
869  {
870  return OnHi;
871  }
872  return NotOnBoundary;
873 }
874 
875 //------------------------------------------------------------------------------
877  const int gridID, const int blockDirection )
878 {
879  // Sanity check
880  assert("pre: gridID is out-of-bounds" &&
881  (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
882  assert("pre: BlockTopology has not been properly allocated" &&
883  (this->NumberOfGrids == this->BlockTopology.size()));
884  assert("pre: blockDirection is out-of-bounds" &&
885  (blockDirection >= 0) && (blockDirection < 6) );
886  bool status = false;
887  if( this->BlockTopology[ gridID ] & (1 << blockDirection) )
888  {
889  status = true;
890  }
891  return( status );
892 }
893 
894 //------------------------------------------------------------------------------
896  const int gridID, const int blockDirection )
897 {
898  // Sanity check
899  assert("pre: gridID is out-of-bounds" &&
900  (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
901  assert("pre: BlockTopology has not been properly allocated" &&
902  (this->NumberOfGrids == this->BlockTopology.size()));
903  assert("pre: blockDirection is out-of-bounds" &&
904  (blockDirection >= 0) && (blockDirection < 6) );
905 
906  this->BlockTopology[ gridID ] &= ~(1 << blockDirection);
907 }
908 
909 //------------------------------------------------------------------------------
911  const int gridID, const int blockDirection )
912 {
913  // Sanity check
914  assert("pre: gridID is out-of-bounds" &&
915  (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
916  assert("pre: BlockTopology has not been properly allocated" &&
917  (this->NumberOfGrids == this->BlockTopology.size()));
918  assert("pre: blockDirection is out-of-bounds" &&
919  (blockDirection >= 0) && (blockDirection < 6) );
920  this->BlockTopology[ gridID ] |= (1 << blockDirection);
921 }
922 
923 //------------------------------------------------------------------------------
925  const int gridID )
926 {
927  // Sanity check
928  assert("pre: gridID is out-of-bounds" &&
929  (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
930  assert("pre: BlockTopology has not been properly allocated" &&
931  (this->NumberOfGrids == this->BlockTopology.size()));
932  for( int i=0; i < 6; ++i )
933  {
934  this->RemoveBlockConnection( gridID, i );
935  } // END for all block directions
936 }
937 
938 //------------------------------------------------------------------------------
940  const int gridID )
941 {
942  // Sanity check
943  assert("pre: gridID is out-of-bounds" &&
944  (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
945  assert("pre: BlockTopology has not been properly allocated" &&
946  (this->NumberOfGrids == this->BlockTopology.size()));
947 
948  int count = 0;
949  for( int i=0; i < 6; ++i )
950  {
951  if( this->HasBlockConnection( gridID, i ) )
952  {
953  ++count;
954  }
955  }
956  assert( "post: count must be in [0,5]" && (count >=0 && count <= 6) );
957  return( count );
958 }
959 
960 //------------------------------------------------------------------------------
962  const unsigned int N )
963 {
964  if (N == 0)
965  {
966  vtkErrorMacro("Number of grids cannot be 0.");
967  return;
968  }
969 
970  this->NumberOfGrids = N;
972 
973  this->GridExtents.resize( 6*N,-1);
974  this->Neighbors.resize( N );
975  this->BlockTopology.resize( N );
976 }
977 #endif /* vtkStructuredGridConnectivity_H_ */
int GetNumberOfConnectingBlockFaces(const int gridID)
std::map< std::pair< int, int >, int > NeighborPair2NeighborListIndex
bool HasBlockConnection(const int gridID, const int blockDirection)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
represent and manipulate point attribute data
Definition: vtkPointData.h:36
void AddBlockConnection(const int gridID, const int blockDirection)
void SetGhostedGridExtent(const int gridID, int ext[6])
void GetGhostedGridExtent(const int gridID, int ext[6])
virtual void ComputeNeighbors()=0
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
std::vector< unsigned char > BlockTopology
std::vector< std::vector< vtkStructuredNeighbor > > Neighbors
#define VTK_XZ_PLANE
bool InBounds(const int idx, const int Lo, const int Hi)
int vtkIdType
Definition: vtkType.h:275
int GetNeighborIndex(const int gridIdx, const int NeighborGridIdx)
void GetGhostedExtent(int *ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N)
void DetermineNeighborOrientation(const int idx, int A[2], int B[2], int overlap[2], int orient[3])
void RemoveBlockConnection(const int gridID, const int blockDirection)
void GetGridExtent(const int gridID, int extent[6])
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
#define VTK_XY_PLANE
virtual void SetNumberOfGrids(const unsigned int N)=0
void PrintSelf(ostream &os, vtkIndent indent)
bool IsNodeInterior(const int i, const int j, const int k, int GridExtent[6])
bool IsNodeWithinExtent(const int i, const int j, const int k, int GridExtent[6])
#define VTK_XYZ_GRID
dynamic, self-adjusting array of unsigned char
int Get1DOrientation(const int idx, const int ExtentLo, const int ExtentHi, const int OnLo, const int OnHi, const int NotOnBoundary)
bool StrictlyInsideBounds(const int idx, const int Lo, const int Hi)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
bool IsNodeOnBoundaryOfExtent(const int i, const int j, const int k, int ext[6])
#define VTK_YZ_PLANE
virtual void FillGhostArrays(const int gridId, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)=0
static vtkObject * New()
#define VTKFILTERSGEOMETRY_EXPORT
#define VTK_X_LINE
virtual void CreateGhostLayers(const int N=1)=0
#define VTK_Z_LINE
represent and manipulate 3D points
Definition: vtkPoints.h:38
virtual void SetNumberOfGrids(const unsigned int N)
represent and manipulate fields of data
Definition: vtkFieldData.h:55
#define VTK_Y_LINE