Commit dfc20689 authored by Sebastien Jourdain's avatar Sebastien Jourdain Committed by Kitware Robot
Browse files

Merge topic 'hyperTreeGrid2UnstructuredGrid'

d4589c5d added routins to recover the state of the filter before execution
63f5f784 resolve memory leak using the fast delete function
96d0856e cleaned up constructor and changed fastDelete to nullptr assignment
1fc39b44 added a comment in the descructor of the purpose of class members
7c5a87ab Merge branch 'leonhardt/vtk-hyperTreeGrid2UnstructuredGrid' into HEAD
5d662864 commented out extra deletes of already deleted items in destructor
e1162ad0 removed unused property "Mask" in HyperTreeGridToUnstructuredGrid
7d28ba87 fix bug #17588

: vtkHyperTreeGridToUnstructuredGrid clean internal state
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: John Patchett's avatarJohn Patchett <patchett2002@gmail.com>
Merge-request: !5485
parents 56612d4a d4589c5d
......@@ -29,62 +29,25 @@
vtkStandardNewMacro(vtkHyperTreeGridToUnstructuredGrid);
//-----------------------------------------------------------------------------
vtkHyperTreeGridToUnstructuredGrid::vtkHyperTreeGridToUnstructuredGrid()
{
// Create storage for corners of leaf cells
this->Points = vtkPoints::New();
// Create storage for untructured leaf cells
this->Cells = vtkCellArray::New();
// Default dimension is 0
this->Dimension = 0;
this->Orientation = 0;
this->Axes = nullptr;
}
vtkHyperTreeGridToUnstructuredGrid::vtkHyperTreeGridToUnstructuredGrid() :
Points(nullptr),
Cells(nullptr),
Dimension(0),
Orientation(0),
Axes(nullptr)
{}
//-----------------------------------------------------------------------------
vtkHyperTreeGridToUnstructuredGrid::~vtkHyperTreeGridToUnstructuredGrid()
{
if (this->Points)
{
this->Points->Delete();
this->Points = nullptr;
}
if (this->Cells)
{
this->Cells->Delete();
this->Cells = nullptr;
}
// The class members are only used during process and are destroyed once
// the process is finished to reduce stack size during recursive calls.
}
//----------------------------------------------------------------------------
void vtkHyperTreeGridToUnstructuredGrid::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
if (this->Points)
{
os << indent << "Points:\n";
this->Points->PrintSelf(os, indent.GetNextIndent());
}
else
{
os << indent << "Points: ( none )\n";
}
if (this->Cells)
{
os << indent << "Cells:\n";
this->Cells->PrintSelf(os, indent.GetNextIndent());
}
else
{
os << indent << "Cells: ( none )\n";
}
os << indent << "Dimension : " << this->Dimension << endl;
}
//----------------------------------------------------------------------------
......@@ -107,6 +70,8 @@ int vtkHyperTreeGridToUnstructuredGrid::ProcessTrees(
}
// Set instance variables needed for this conversion
this->Points = vtkPoints::New();
this->Cells = vtkCellArray::New();
this->Dimension = input->GetDimension();
this->Orientation = input->GetOrientation();
this->Axes = input->GetAxes();
......@@ -116,9 +81,6 @@ int vtkHyperTreeGridToUnstructuredGrid::ProcessTrees(
this->OutData = output->GetCellData();
this->OutData->CopyAllocate(this->InData);
// Retrieve material mask
this->Mask = input->HasMask() ? input->GetMask() : nullptr;
// Iterate over all hyper trees
vtkIdType index;
vtkHyperTreeGrid::vtkHyperTreeGridIterator it;
......@@ -153,6 +115,11 @@ int vtkHyperTreeGridToUnstructuredGrid::ProcessTrees(
break;
} // switch ( this->Dimension )
this->Points->FastDelete();
this->Cells->FastDelete();
this->Points = nullptr;
this->Cells = nullptr;
return 1;
}
......
......@@ -81,11 +81,6 @@ protected:
*/
void AddCell( vtkIdType, double*, double* );
/**
* Output material mask constructed by this filter
*/
vtkBitArray* Mask;
/**
* Storage for points of output unstructured mesh
*/
......
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