Commit 51d4312f authored by camp's avatar camp

Fixed a bug in the SetDataset function. It did not update pointers to the new vtkDataSet.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@16149 18c085ea-50e0-402c-830e-de6fd14e8384
parent 21957a18
......@@ -63,8 +63,32 @@
//
//----------------------------------------------------------------------------
avtCellLocator::avtCellLocator( vtkDataSet* ds ) : dataSet(ds)
avtCellLocator::avtCellLocator( vtkDataSet* ds ) : dataSet(NULL)
{
SetDataSet(ds);
}
// ****************************************************************************
// Method: avtCellLocator::SetDataSet
//
// Purpose:
// Set the data set for this avtCellLocator
//
// Programmer: David Camp
// Creation: April 21, 2011
//
// Modifications:
//
// David Camp, Tue Sep 13 08:16:35 PDT 2011
// Needed to reset the pointer to the dataset
//
// ****************************************************************************
void
avtCellLocator::SetDataSet(vtkDataSet *ds)
{
ReleaseDataSet();
dataSet = ds;
dataSet->Register( NULL );
cellIdxPtr = NULL;
......@@ -81,9 +105,9 @@ avtCellLocator::avtCellLocator( vtkDataSet* ds ) : dataSet(ds)
else if( vtkStructuredGrid* sg = vtkStructuredGrid::SafeDownCast( dataSet ) )
{
strDimPtr = sg->GetDimensions();
if (strDimPtr[0] > 1 && strDimPtr[0] > 1 && strDimPtr[2] == 1)
if (strDimPtr[0] > 1 && strDimPtr[1] > 1 && strDimPtr[2] == 1)
normal2D = true;
else if (strDimPtr[0] > 1 && strDimPtr[0] > 1 && strDimPtr[2] > 1)
else if (strDimPtr[0] > 1 && strDimPtr[1] > 1 && strDimPtr[2] > 1)
normal3D = true;
}
......@@ -116,25 +140,6 @@ avtCellLocator::~avtCellLocator()
dataSet->Delete();
}
// ****************************************************************************
// Method: avtCellLocator::SetDataSet
//
// Purpose:
// Set the data set for this avtCellLocator
//
// Programmer: David Camp
// Creation: April 21, 2011
//
// ****************************************************************************
void
avtCellLocator::SetDataSet(vtkDataSet *ds)
{
ReleaseDataSet();
ds->Register(NULL);
dataSet = ds;
}
// ****************************************************************************
// Method: avtCellLocator::ReleaseDataSet
//
......@@ -154,10 +159,18 @@ avtCellLocator::ReleaseDataSet()
{
dataSet->Delete();
dataSet = NULL;
cellIdxPtr = NULL;
cellLocPtr = NULL;
strDimPtr = NULL;
normal2D = false;
normal3D = false;
fCoordPtr = NULL;
dCoordPtr = NULL;
}
}
// ****************************************************************************
// Method: avtCellLocator::Destruct
//
......@@ -177,7 +190,6 @@ avtCellLocator::Destruct(void *p)
delete cl;
}
//----------------------------------------------------------------------------
// Modifications:
// Kathleen Bonnell, Fri Aug 13 08:20:15 MST 2010
......
......@@ -72,6 +72,10 @@ typedef std::vector<avtInterpolationWeight> avtInterpolationWeights;
// Hank Childs, Sun Nov 28 11:34:04 PST 2010
// Add support for caching cell locators via void_ref_ptr.
//
// David Camp, Tue Sep 13 08:16:35 PDT 2011
// Changed the SetDataSet function to virtual. You may need to reset
// pointer to the new dataset.
//
// ************************************************************************* //
class IVP_API avtCellLocator
......@@ -81,7 +85,7 @@ class IVP_API avtCellLocator
virtual ~avtCellLocator();
vtkDataSet *GetDataSet() { return dataSet; }
void SetDataSet(vtkDataSet *ds);
virtual void SetDataSet(vtkDataSet *ds);
void ReleaseDataSet();
virtual vtkIdType FindCell( const double pos[3],
......
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