Commit 66336430 authored by hrchilds's avatar hrchilds

Update from June 21, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@18 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3e4a7917
......@@ -4,6 +4,7 @@
#include <avtThresholdFilter.h>
#include <vtkPolyData.h>
#include <vtkThreshold.h>
#include <vtkUnstructuredGrid.h>
......@@ -111,6 +112,9 @@ avtThresholdFilter::Equivalent(const AttributeGroup *a)
// Hank Childs, Tue Sep 10 18:29:14 PDT 2002
// Make memory management be self-contained in this routine.
//
// Hank Childs, Sat Jun 21 09:25:34 PDT 2003
// If we have poly data input, then we should have poly data output.
//
// ****************************************************************************
vtkDataSet *
......@@ -166,8 +170,36 @@ avtThresholdFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
out_ds = NULL;
}
//
// If we had poly data input, we want poly data output. The VTK filter
// only returns unstructured grids, so convert that now.
//
bool shouldDelete = false;
if (in_ds->GetDataObjectType() == VTK_POLY_DATA && out_ds != NULL)
{
vtkUnstructuredGrid *ugrid = (vtkUnstructuredGrid *) out_ds;
vtkPolyData *out_pd = vtkPolyData::New();
out_pd->SetPoints(ugrid->GetPoints());
out_pd->GetPointData()->ShallowCopy(ugrid->GetPointData());
out_pd->GetCellData()->ShallowCopy(ugrid->GetCellData());
int ncells = ugrid->GetNumberOfCells();
out_pd->Allocate(ncells);
for (int i = 0 ; i < ncells ; i++)
{
int celltype = ugrid->GetCellType(i);
vtkIdType *pts;
int npts;
ugrid->GetCellPoints(i, npts, pts);
out_pd->InsertNextCell(celltype, npts, pts);
}
out_ds = out_pd;
shouldDelete = true;
}
ManageMemory(out_ds);
threshold->Delete();
if (shouldDelete)
out_ds->Delete();
return out_ds;
}
......
// ************************************************************************* //
// avtBoundaryFilter.C //
// avtBoundaryFilter.C //
// ************************************************************************* //
......@@ -44,6 +44,10 @@ avtBoundaryFilter::SetPlotAtts(const BoundaryAttributes *atts)
// Creation: June 12, 2003
//
// Modifications:
//
// Hank Childs, Sat Jun 21 10:51:29 PDT 2003
// Made more efficient by removing unnecessary work.
//
// ****************************************************************************
avtDataTree_p
......@@ -178,9 +182,9 @@ avtBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string label)
int numNewCells = 0;
for (int j = 0; j < ntotalcells; j++)
{
in_pd->GetCellPoints(j, npts, pts);
if (boundaryList[j] == s)
{
in_pd->GetCellPoints(j, npts, pts);
out_pd->InsertNextCell(in_pd->GetCellType(j),
npts, pts);
out_CD->CopyData(in_CD, j, numNewCells++);
......@@ -251,7 +255,6 @@ void
avtBoundaryFilter::RefashionDataObjectInfo(void)
{
avtDataAttributes &outAtts = GetOutput()->GetInfo().GetAttributes();
avtDataAttributes &inAtts = GetInput()->GetInfo().GetAttributes();
outAtts.SetLabels(plotAtts.GetBoundaryNames());
}
......
// ************************************************************************* //
// avtFilledBoundaryFilter.C //
// avtFilledBoundaryFilter.C //
// ************************************************************************* //
#include <avtFilledBoundaryFilter.h>
#include <avtDataAttributes.h>
#include <avtTerminatingSource.h>
#include <vtkCellArray.h>
#include <vtkDataSet.h>
#include <vtkIntArray.h>
#include <vtkPolyData.h>
#include <vtkUnstructuredGrid.h>
#include <avtDataAttributes.h>
#include <avtTerminatingSource.h>
#include <DebugStream.h>
#include <ImproperUseException.h>
using std::string;
// ****************************************************************************
// Method: avtFilledBoundaryFilter::SetPlotAtts
//
......@@ -49,7 +54,8 @@ avtFilledBoundaryFilter::SetPlotAtts(const FilledBoundaryAttributes *atts)
// ****************************************************************************
avtDataTree_p
avtFilledBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string label)
avtFilledBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain,
string label)
{
if (in_ds == NULL || in_ds->GetNumberOfPoints() == 0)
{
......@@ -80,6 +86,7 @@ avtFilledBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string l
avtDataTree_p rv = new avtDataTree();
return rv;
}
//
// Break up the dataset into a collection of datasets, one
// per boundary.
......@@ -145,8 +152,6 @@ avtFilledBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string l
//
out_ds = new vtkDataSet *[nSelectedBoundaries];
vtkCellArray *cells = in_pd->GetPolys();
//
// The following call is a workaround for a VTK bug. It turns
// out that when GetCellType if called for the first time for a
......@@ -177,13 +182,12 @@ avtFilledBoundaryFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string l
out_pd->Allocate(boundaryCounts[s]);
vtkIdType npts, *pts;
cells->InitTraversal();
int numNewCells = 0;
for (int j = 0; j < ntotalcells; j++)
{
cells->GetNextCell(npts, pts);
if (boundaryList[j] == s)
{
in_pd->GetCellPoints(j, npts, pts);
out_pd->InsertNextCell(in_pd->GetCellType(j),
npts, pts);
out_CD->CopyData(in_CD, j, numNewCells++);
......
......@@ -65,6 +65,10 @@ avtSubsetFilter::SetPlotAtts(const SubsetAttributes *atts)
// Kathleen Bonnell, Fri Dec 6 12:02:04 PST 2002
// Copy all cell data, not just ghost levels. Pass point data.
//
// Hank Childs, Sat Jun 21 10:48:19 PDT 2003
// Fix a problem with accessing cells from poly data. This fix also made
// the accessing more efficient.
//
// ****************************************************************************
avtDataTree_p
......@@ -164,8 +168,6 @@ avtSubsetFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string label)
//
out_ds = new vtkDataSet *[nSelectedSubsets];
vtkCellArray *cells = in_pd->GetPolys();
//
// The following call is a workaround for a VTK bug. It turns
// out that when GetCellType if called for the first time for a
......@@ -196,13 +198,12 @@ avtSubsetFilter::ExecuteDataTree(vtkDataSet *in_ds, int domain, string label)
out_pd->Allocate(subsetCounts[s]);
vtkIdType npts, *pts;
cells->InitTraversal();
int numNewCells = 0;
for (int j = 0; j < ntotalcells; j++)
{
cells->GetNextCell(npts, pts);
if (subsetList[j] == s)
{
in_pd->GetCellPoints(j, npts, pts);
out_pd->InsertNextCell(in_pd->GetCellType(j),
npts, pts);
out_CD->CopyData(in_CD, j, numNewCells++);
......
......@@ -417,10 +417,9 @@ void vtkSlicer::UnstructuredGridExecute(void)
vtkAppendPolyData *appender = vtkAppendPolyData::New();
appender->AddInput(not_from_zoo);
appender->AddInput(just_from_zoo);
appender->SetOutput(output);
output->Update();
appender->GetOutput()->Update();
output->SetSource(NULL);
output->ShallowCopy(appender->GetOutput());
appender->Delete();
not_from_zoo->Delete();
just_from_zoo->Delete();
......
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