1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkStructuredNeighbor.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkStructuredNeighbor.h"
#include "vtkStructuredExtent.h"
vtkStructuredNeighbor::vtkStructuredNeighbor()
{
this->NeighborID = 0;
this->OverlapExtent[ 0 ] = this->OverlapExtent[ 1 ] =
this->OverlapExtent[ 2 ] = this->OverlapExtent[ 3 ] =
this->OverlapExtent[ 4 ] = this->OverlapExtent[ 5 ] = 0;
this->Orientation[ 0 ] = this->Orientation[ 1 ] =
this->Orientation[ 2 ] = vtkStructuredNeighbor::UNDEFINED;
for( int i=0; i < 6; ++i )
{
this->SendExtent[i] = this->RcvExtent[i] = -1;
}
}
//------------------------------------------------------------------------------
vtkStructuredNeighbor::vtkStructuredNeighbor(
const int neiId, int overlap[6] )
{
this->NeighborID = neiId;
for( int i=0; i < 6; ++i )
{
this->SendExtent[ i ] =
this->RcvExtent[ i ] =
this->OverlapExtent[ i ] = overlap[ i ];
}
}
//------------------------------------------------------------------------------
vtkStructuredNeighbor::vtkStructuredNeighbor(
const int neiId, int overlap[6], int orient[3] )
{
this->NeighborID = neiId;
for( int i=0; i < 3; ++i )
{
this->RcvExtent[i*2] =
this->SendExtent[i*2] =
this->OverlapExtent[ i*2 ] = overlap[ i*2 ];
this->RcvExtent[i*2+1] =
this->SendExtent[i*2+1] =
this->OverlapExtent[ i*2+1 ] = overlap[ i*2+1 ];
this->Orientation[ i ] = orient[ i ];
}
}
//------------------------------------------------------------------------------
vtkStructuredNeighbor::~vtkStructuredNeighbor()
{
}
//------------------------------------------------------------------------------
void vtkStructuredNeighbor::ComputeSendAndReceiveExtent(
int gridRealExtent[6], int* vtkNotUsed(gridGhostedExtent[6]),
int neiRealExtent[6],int WholeExtent[6], const int N)
{
for( int i=0; i < 3; ++i )
{
switch( this->Orientation[i] )
{
case vtkStructuredNeighbor::SUPERSET:
this->SendExtent[i*2] -= N;
this->SendExtent[i*2+1] += N;
break;
case vtkStructuredNeighbor::SUBSET_HI:
case vtkStructuredNeighbor::HI:
this->RcvExtent[i*2+1] += N;
this->SendExtent[i*2] -= N;
break;
case vtkStructuredNeighbor::SUBSET_LO:
case vtkStructuredNeighbor::LO:
this->RcvExtent[i*2] -= N;
this->SendExtent[i*2+1] += N;
break;
case vtkStructuredNeighbor::SUBSET_BOTH:
this->RcvExtent[i*2] -= N;
this->SendExtent[i*2+1] += N;
this->RcvExtent[i*2+1] += N;
this->SendExtent[i*2] -= N;
break;
default:
; /* NO OP */
}
} // END for all dimensions
// Hmm...restricting receive extent to the real extent of the neighbor
vtkStructuredExtent::Clamp( this->RcvExtent, neiRealExtent );
vtkStructuredExtent::Clamp( this->SendExtent, gridRealExtent );
vtkStructuredExtent::Clamp( this->RcvExtent, WholeExtent );
vtkStructuredExtent::Clamp( this->SendExtent, WholeExtent );
}
|