Commit eba27009 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Make sure that HT axis cut restores duality flag to original state

Change-Id: I348ac90e7250a1b9ea546bd62c0d56b034e48b8e
parent ada3fdab
......@@ -37,7 +37,7 @@ int TestHyperTreeGrid( int argc, char* argv[] )
int testIntValue = 0;
// Dimension of hyper trees
int dim = 2;
int dim = 3;
//vtkNew<vtkHyperTreeGenerator> fractal;
//vtkNew<vtkHyperTreeGridFractalSource> fractal;
......@@ -90,18 +90,6 @@ int TestHyperTreeGrid( int argc, char* argv[] )
writer1->SetInputConnection( shrink->GetOutputPort() );
writer1->Write();
cerr << "# Cut" << endl;
vtkNew<vtkCutter> cut;
vtkNew<vtkPlane> plane;
plane->SetOrigin( .5, .5, .15 );
plane->SetNormal( 0, 0, 1 );
cut->SetInputData( htGrid );
cut->SetCutFunction( plane.GetPointer() );
vtkNew<vtkPolyDataWriter> writer2;
writer2->SetFileName( "./hyperTreeGridCut.vtk" );
writer2->SetInputConnection( cut->GetOutputPort() );
writer2->Write();
// Axis-aligned cut works only in 3D for now
if ( dim == 3 )
{
......@@ -116,6 +104,18 @@ int TestHyperTreeGrid( int argc, char* argv[] )
writer3->Write();
}
cerr << "# Cut" << endl;
vtkNew<vtkCutter> cut;
vtkNew<vtkPlane> plane;
plane->SetOrigin( .5, .5, .15 );
plane->SetNormal( 0, 0, 1 );
cut->SetInputData( htGrid );
cut->SetCutFunction( plane.GetPointer() );
vtkNew<vtkPolyDataWriter> writer2;
writer2->SetFileName( "./hyperTreeGridCut.vtk" );
writer2->SetInputConnection( cut->GetOutputPort() );
writer2->Write();
vtkNew<vtkHyperTreeGridGeometry> geometry;
geometry->SetInputConnection( fractal->GetOutputPort() );
geometry->Update();
......
......@@ -181,7 +181,11 @@ int vtkHyperTreeGridAxisCut::RequestData( vtkInformation*,
}
// Ensure that primal grid API is used for hyper trees
this->Input->SetDualGridFlag( false );
bool inputDualFlagIsOn = this->Input->GetDualGridFlag();
if ( inputDualFlagIsOn )
{
this->Input->SetDualGridFlag( false );
}
// Initialize output cell data
vtkCellData *outCD = this->Output->GetCellData();
......@@ -189,6 +193,14 @@ int vtkHyperTreeGridAxisCut::RequestData( vtkInformation*,
outCD->CopyAllocate( inCD );
this->ProcessTrees();
// Return duality flag of input to its original state
if ( inputDualFlagIsOn )
{
this->Input->SetDualGridFlag( true );
}
// Clean up
this->Input = 0;
this->Output = 0;
......
Supports Markdown
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