Commit 5083f3cd authored by George Zagaris's avatar George Zagaris
Browse files

ENH: Dealing with ghost cells outside domain

Imlemented functionality (partially complete) for
dealing with the ghost cells that are outside the
domain.
parent 5f0be174
......@@ -313,19 +313,18 @@ void vtkAMRDataTransferFilter::ExtrudeGhostLayers( )
}
else
{
// std::ostringstream oss;
// oss.str(""); oss.clear();
// oss << "InitialGrid_" << currentLevel << "_" << dataIdx;
// this->WriteGrid( myGrid, oss.str() );
vtkUniformGrid *extrudedGrid = this->GetExtrudedGrid( myGrid );
assert( "post: extrudedGrid != NULL" && (extrudedGrid != NULL) );
// oss.str(""); oss.clear();
// oss << "ExtrudedGrid_" << currentLevel << "_" << dataIdx;
// this->WriteGrid( extrudedGrid, oss.str() );
vtkAMRBox globalBox;
double h[3];
myBox.GetGridSpacing( h );
this->AMRDataSet->GetGlobalAMRBoxWithSpacing( globalBox, h );
myBox.GrowWithinBounds( this->NumberOfGhostLayers, globalBox );
// myBox.Grow(this->NumberOfGhostLayers);
myBox.Grow(this->NumberOfGhostLayers);
this->ExtrudedData->SetDataSet(
currentLevel,dataIdx,myBox,extrudedGrid);
extrudedGrid->Delete();
......@@ -412,6 +411,17 @@ void vtkAMRDataTransferFilter::FindDonors(
}
} // END if the cell is found in this grid
else
{
// -2 indicates that this node is orphaned, i.e., no donor cell
// was found.
donorLevelInfo->SetValue( rcverIdx, -2 );
donorCellInfo->SetValue( rcverIdx, -2 );
donorGridInfo->SetValue( rcverIdx, 0 );
donorCentroid->SetComponent(rcverIdx, 0, 0.0 );
donorCentroid->SetComponent(rcverIdx, 1, 0.0 );
donorCentroid->SetComponent(rcverIdx, 2, 0.0 );
}
} // END for all receivers
......@@ -506,11 +516,16 @@ void vtkAMRDataTransferFilter::LocalDataTransfer()
int donorCell = donorCellInfo->GetValue(rcverIdx);
unsigned int donorGridIdx = donorGridInfo->GetValue(rcverIdx);
// Skip cells that are outside the boundary
if( donorLevel == -2 )
continue;
int donorGridLevel = -1;
int donorGridBlockIdx = -1;
vtkAMRGridIndexEncoder::decode(
donorGridIdx,donorGridLevel,donorGridBlockIdx);
assert( "post: donor grid level mismatch!" &&
assert( "post: donor grid level mismatch!" &&
(donorGridLevel==donorLevel));
double dcentroid[3];
......
......@@ -427,9 +427,18 @@ bool vtkAMRDualMeshExtractor::ProcessCellDual(
(ug->GetPointData() != NULL) );
assert( "pre: input grid must have PointOwnership information" &&
ug->GetPointData()->HasArray("PointOwnership") );
assert( "pre: input grid must have DonorLevel information" &&
ug->GetCellData()->HasArray("DonorLevel") );
assert( "pre: cell index out-of-bounds!" &&
( (cellIdx >= 0) && (cellIdx < ug->GetNumberOfCells() ) ) );
vtkIntArray *dlevel =
vtkIntArray::SafeDownCast( ug->GetCellData()->GetArray("DonorLevel" ) );
// If the cell has no donor, then ignore it
// if( dlevel->GetValue( cellIdx ) == -2 )
// return false;
if( ug->IsCellVisible( cellIdx ) )
return true;
else
......@@ -437,6 +446,7 @@ bool vtkAMRDualMeshExtractor::ProcessCellDual(
vtkPointData *PD = ug->GetPointData();
vtkIntArray *PO =
vtkIntArray::SafeDownCast( PD->GetArray("PointOwnership") );
vtkIdList *ptIds = vtkIdList::New();
ug->GetCellPoints( cellIdx, ptIds );
for( int i=0; i < ptIds->GetNumberOfIds(); ++i )
......
......@@ -110,7 +110,7 @@ class VTK_AMR_EXPORT vtkAMRDualMeshExtractor :
void FixGaps( vtkHierarchicalBoxDataSet *amrds,vtkMultiBlockDataSet *dual );
// Description:
// This method
// This method process the dual mesh at the current level.
void ProcessDual(
const unsigned int currentLevel, vtkUnstructuredGrid *dualMesh,
vtkHierarchicalBoxDataSet *amrData );
......
......@@ -55,6 +55,7 @@ int main( int argc, char **argv )
vtkHierarchicalBoxDataSet *amrData=
AMRCommon::ReadAMRData( std::string(argv[1] ) );
AMRCommon::WriteAMRData( amrData, std::string("INPUTAMR") );
assert( "AMR dataset is empty!" && (amrData->GetNumberOfLevels() > 0) );
// STEP 1: Compute intergrid connectivity
std::cout << "Computing inter-block & inter-process connectivity!\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment