Commit 955d20f9 authored by brugger's avatar brugger

I converted more filters to use avtDataRepresentations instead
of vtkDataSets.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23825 18c085ea-50e0-402c-830e-de6fd14e8384
parent 943fbc96
......@@ -116,10 +116,9 @@ avtShiftCenteringFilter::~avtShiftCenteringFilter()
// necessary.
//
// Arguments:
// inDS The input dataset.
// <unused> The domain number.
// inDR The input data representation.
//
// Returns: The output dataset.
// Returns: The output data representation.
//
// Programmer: Kathleen Bonnell
// Creation: April 19, 2001
......@@ -173,12 +172,20 @@ avtShiftCenteringFilter::~avtShiftCenteringFilter()
// Kathleen Biagas, Thu Sep 6 15:18:27 MST 2012
// Preserve data type.
//
// Eric Brugger, Tue Jul 22 08:01:18 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtShiftCenteringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
avtDataRepresentation *
avtShiftCenteringFilter::ExecuteData(avtDataRepresentation *inDR)
{
size_t i, j, k;
//
// Get the VTK data set.
//
vtkDataSet *inDS = inDR->GetDataVTK();
size_t i, j, k;
vtkDataSet *newDS = (vtkDataSet *) inDS->NewInstance();
newDS->ShallowCopy(inDS);
......@@ -411,13 +418,12 @@ avtShiftCenteringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
outDS = inDS;
}
if (outDS == newDS)
{
ManageMemory(outDS);
}
avtDataRepresentation *outDR = new avtDataRepresentation(outDS,
inDR->GetDomain(), inDR->GetLabel());
newDS->Delete();
return outDS;
return outDR;
}
......
......@@ -48,11 +48,6 @@
#include <avtDataTreeIterator.h>
class vtkDataSet;
class vtkCellDataToPointData;
class vtkPointDataToCellData;
// ****************************************************************************
// Class: avtShiftCenteringFilter
//
......@@ -85,6 +80,9 @@ class vtkPointDataToCellData;
// For ease of reading code, I forced the argument to be avtCentering, not
// integer.
//
// Eric Brugger, Tue Jul 22 08:00:59 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtShiftCenteringFilter : public avtDataTreeIterator
......@@ -100,7 +98,7 @@ class AVTFILTERS_API avtShiftCenteringFilter : public avtDataTreeIterator
protected:
avtCentering centeringTarget;
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual void UpdateDataObjectInfo(void);
virtual avtContract_p
ModifyContract(avtContract_p);
......
......@@ -120,11 +120,9 @@ avtSmoothPolyDataFilter::SetSmoothingLevel(int sl)
// Sends the specified input and output through the SmoothPolyData filter.
//
// Arguments:
// in_ds The input dataset.
// <unused> The domain number.
// <unused> The label.
// inDR The input data representation.
//
// Returns: The output geometry.
// Returns: The output data representation.
//
// Programmer: Jeremy Meredith
// Creation: December 6, 2002
......@@ -140,17 +138,25 @@ avtSmoothPolyDataFilter::SetSmoothingLevel(int sl)
// Kathleen Biagas, Fri Jan 25 16:04:46 PST 2013
// Call Update on the filter, not the data object.
//
// Eric Brugger, Tue Jul 22 08:24:19 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtSmoothPolyDataFilter::ExecuteData(vtkDataSet *inDS, int, string)
avtDataRepresentation *
avtSmoothPolyDataFilter::ExecuteData(avtDataRepresentation *inDR)
{
//
// Get the VTK data set.
//
vtkDataSet *inDS = inDR->GetDataVTK();
// Detect no-ops
if (smoothingLevel == 0 ||
GetInput()->GetInfo().GetAttributes().GetTopologicalDimension() != 2 ||
GetInput()->GetInfo().GetAttributes().GetSpatialDimension() != 3)
{
return inDS;
return inDR;
}
// We only work on surface data
......@@ -202,11 +208,13 @@ avtSmoothPolyDataFilter::ExecuteData(vtkDataSet *inDS, int, string)
outDS = newDS;
}
ManageMemory(outDS);
avtDataRepresentation *outDR = new avtDataRepresentation(outDS,
inDR->GetDomain(), inDR->GetLabel());
newDS->Delete();
smoothPolyData->Delete();
if (geom)
geom->Delete();
return outDS;
return outDR;
}
......@@ -63,6 +63,9 @@
// Moved inlined constructor and destructor definitions to .C files
// because certain compilers have problems with them.
//
// Eric Brugger, Tue Jul 22 08:23:57 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtSmoothPolyDataFilter : public avtDataTreeIterator
......@@ -81,7 +84,7 @@ class AVTFILTERS_API avtSmoothPolyDataFilter : public avtDataTreeIterator
protected:
int smoothingLevel;
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
};
......
......@@ -89,25 +89,29 @@ avtStaggeringFilter::~avtStaggeringFilter()
// offsets. If no offsets, or offsets are zero, returns input dataset.
//
// Arguments:
// inDS The input dataset.
// <unused> The domain number.
// <unused> The label.
// inDR The input data representation.
//
// Returns: The input dataset adjusted for node offsets
// Returns: The input data representation adjusted for node offsets
//
// Programmer: Marc Durant
// Creation: April 24, 2012
//
// Modifications:
// Eric Brugger, Tue Jul 22 08:56:41 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtStaggeringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
avtDataRepresentation *
avtStaggeringFilter::ExecuteData(avtDataRepresentation *inDR)
{
//
// Get the VTK data set.
//
vtkDataSet *inDS = inDR->GetDataVTK();
if (!inDS) {
return inDS;
return inDR;
}
vtkDataSet* outDS = NULL;
......@@ -120,14 +124,14 @@ avtStaggeringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
if (!velData) {
debug5 <<"avtStaggeringFilter::ExecuteData() - Unable to find scalar data on mesh, returning input dataset." <<std::endl;
return inDS;
return inDR;
}
vtkInformation* info = velData->GetInformation();
if (!info->Has(avtVariableCache::OFFSET_3())) {
debug5 <<"avtStaggeringFilter::ExecuteData() - scalars have NO offset information, returning input dataset." <<std::endl;
return inDS;
return inDR;
}
//Extract the offset information from the dataset
......@@ -203,7 +207,6 @@ avtStaggeringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
}
outDS = newGrid;
ManageMemory(outDS);
}
break;
......@@ -220,10 +223,15 @@ avtStaggeringFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
} //end switch(dstype)
if (outDS) {
return outDS;
avtDataRepresentation *outDR = new avtDataRepresentation(outDS,
inDR->GetDomain(), inDR->GetLabel());
outDS->Delete();
return outDR;
}
return inDS;
return inDR;
}
// ****************************************************************************
......
......@@ -37,17 +37,19 @@
*****************************************************************************/
// ************************************************************************* //
// avtStaggeringFilter.h //
// avtStaggeringFilter.h //
// ************************************************************************* //
#ifndef AVT_STAGGERING_FILTER_H
#define AVT_STAGGERING_FILTER_H
#include <filters_exports.h>
#include <avtDataTreeIterator.h>
#include <string>
// ****************************************************************************
// Class: avtStaggeringFilter
//
......@@ -57,6 +59,8 @@
// Creation: April 24, 2012
//
// Modifications:
// Eric Brugger, Tue Jul 22 08:56:12 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
......@@ -71,7 +75,7 @@ class AVTFILTERS_API avtStaggeringFilter : public avtDataTreeIterator
{ return "Preparing pipeline"; };
protected:
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual void UpdateDataObjectInfo(void);
virtual avtContract_p
ModifyContract(avtContract_p);
......
......@@ -199,11 +199,9 @@ avtSurfaceFilter::Equivalent(const AttributeGroup *a)
// to a scaled version of the point/cell data.
//
// Arguments:
// inDS The input dataset.
// <unused> The domain number.
// <unused> The label as a string.
// inDR The input data representation.
//
// Returns: The output dataset.
// Returns: The output data representation.
//
// Programmer: Kathleen Bonnell
// Creation: March 05, 2001
......@@ -287,11 +285,19 @@ avtSurfaceFilter::Equivalent(const AttributeGroup *a)
// Kathleen Biagas, Fri Sep 7 13:13:09 MST 2012
// Preserve scalars data type when using input scalars.
//
// Eric Brugger, Tue Jul 22 09:07:32 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtSurfaceFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
avtDataRepresentation *
avtSurfaceFilter::ExecuteData(avtDataRepresentation *inDR)
{
//
// Get the VTK data set.
//
vtkDataSet *inDS = inDR->GetDataVTK();
vtkDataArray *inScalars = NULL;
vtkDataArray *outScalars = NULL;
bool zf = atts.GetZeroFlag();
......@@ -443,12 +449,14 @@ avtSurfaceFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
if (cd2pd != NULL)
cd2pd->Delete();
ManageMemory(outUG);
outUG->Delete();
filter->Delete();
return (vtkDataSet*) outUG;
avtDataRepresentation *outDR = new avtDataRepresentation(outUG,
inDR->GetDomain(), inDR->GetLabel());
outUG->Delete();
return outDR;
}
......
......@@ -50,10 +50,6 @@
#include <SurfaceFilterAttributes.h>
class vtkDataSet;
class vtkSurfaceFilter;
// ****************************************************************************
// Class: avtSurfaceFilter
//
......@@ -103,6 +99,9 @@ class vtkSurfaceFilter;
// Hank Childs, Fri Mar 4 08:47:07 PST 2005
// Removed cd2pd.
//
// Eric Brugger, Tue Jul 22 09:06:43 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtSurfaceFilter : public avtDataTreeIterator
......@@ -133,7 +132,7 @@ class AVTFILTERS_API avtSurfaceFilter : public avtDataTreeIterator
double SkewTheValue(const double);
void CalculateScaleValues(double *, double*);
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual void UpdateDataObjectInfo(void);
virtual void VerifyInput(void);
virtual void PreExecute(void);
......
......@@ -251,9 +251,7 @@ avtTransform::~avtTransform()
// Executes the transform on the specified domain.
//
// Arguments:
// in_ds The input dataset.
// <unnamed> The domain number.
// <unnamed> The label.
// in_dr The input data representation.
//
// Programmer: Hank Childs
// Creation: November 27, 2000
......@@ -293,21 +291,36 @@ avtTransform::~avtTransform()
// Kathleen Biagas, Fri Jan 25 16:39:17 PST 2013
// Call Update on filter, not data object.
//
// Eric Brugger, Tue Jul 22 12:07:56 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtTransform::ExecuteData(vtkDataSet *in_ds, int, std::string)
avtDataRepresentation *
avtTransform::ExecuteData(avtDataRepresentation *in_dr)
{
//
// Get the VTK data set.
//
vtkDataSet *in_ds = in_dr->GetDataVTK();
vtkMatrix4x4 *mat = GetTransform();
if (IsIdentity(mat))
{
return in_ds;
return in_dr;
}
int datatype = in_ds->GetDataObjectType();
if (datatype == VTK_RECTILINEAR_GRID)
{
return TransformRectilinear((vtkRectilinearGrid *) in_ds);
vtkDataSet *out_ds = TransformRectilinear((vtkRectilinearGrid *) in_ds);
avtDataRepresentation *out_dr = new avtDataRepresentation(out_ds,
in_dr->GetDomain(), in_dr->GetLabel());
out_ds->Delete();
return out_dr;
}
vtkTransformFilter *transform = vtkTransformFilter::New();
......@@ -337,10 +350,12 @@ avtTransform::ExecuteData(vtkDataSet *in_ds, int, std::string)
transform->Update();
vtkPointSet *out_ds = transform->GetOutput();
ManageMemory(out_ds);
avtDataRepresentation *out_dr = new avtDataRepresentation(out_ds,
in_dr->GetDomain(), in_dr->GetLabel());
transform->Delete();
return out_ds;
return out_dr;
}
......@@ -362,6 +377,9 @@ avtTransform::ExecuteData(vtkDataSet *in_ds, int, std::string)
// to change to polydata or something else, just store the transform so
// we can do the right thing later.
//
// Eric Brugger, Tue Jul 22 12:07:56 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
......@@ -405,9 +423,6 @@ avtTransform::TransformRectilinear(vtkRectilinearGrid *rgrid)
ct->SetTuple1(i, t->GetElement(i / 4, i % 4));
out->GetFieldData()->AddArray(ct);
ManageMemory(out);
out->Delete();
rv = out;
}
else
......@@ -491,6 +506,9 @@ avtTransform::OutputIsRectilinear(vtkMatrix4x4 *mat)
// Kathleen Bonnell, Fri Dec 13 14:07:15 PST 2002
// Use NewInstance instead of MakeObject, to match new vtk api.
//
// Eric Brugger, Tue Jul 22 12:07:56 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
......@@ -554,14 +572,6 @@ avtTransform::TransformRectilinearToRectilinear(vtkRectilinearGrid *rgrid)
out->SetZCoordinates(z_new);
z_new->Delete();
//
// We want to reduce the reference count of this dataset so it doesn't get
// leaked. But where to store it? Fortunately, our base class handles
// this for us.
//
ManageMemory(out);
out->Delete();
return out;
}
......@@ -604,6 +614,9 @@ avtTransform::TransformRectilinearToRectilinear(vtkRectilinearGrid *rgrid)
// Kathleen Biagas, Tue Aug 21 16:49:12 MST 2012
// Preserve coordinate type.
//
// Eric Brugger, Tue Jul 22 12:07:56 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
......@@ -721,14 +734,7 @@ avtTransform::TransformRectilinearToCurvilinear(vtkRectilinearGrid *rgrid)
arr->Delete();
}
//
// We want to reduce the reference count of this dataset so it doesn't get
// leaked. But where to store it? Fortunately, our base class handles
// this for us.
//
ManageMemory(out);
trans->Delete();
out->Delete();
return out;
}
......
......@@ -95,6 +95,9 @@ class vtkRectilinearGrid;
// Dave Pugmire, Fri May 14 08:04:43 EDT 2010
// Flag for vector transformations.
//
// Eric Brugger, Tue Jul 22 12:07:11 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtTransform : public virtual avtDataTreeIterator
......@@ -106,13 +109,13 @@ class AVTFILTERS_API avtTransform : public virtual avtDataTreeIterator
virtual const char *GetType(void) { return "avtTransform"; };
virtual const char *GetDescription(void)
{ return "Transforming data"; };
void SetVectorTransform(bool b)
void SetVectorTransform(bool b)
{ transformVectors = b; }
protected:
bool transformVectors;
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual vtkMatrix4x4 *GetTransform() = 0;
virtual void UpdateDataObjectInfo(void);
......
......@@ -101,11 +101,9 @@ avtVertexNormalsFilter::~avtVertexNormalsFilter()
// Sends the specified input and output through the VertexNormals filter.
//
// Arguments:
// in_ds The input dataset.
// <unused> The domain number.
// <unused> The label.
// in_dr The input data representation.
//
// Returns: The output dataset.
// Returns: The output data representation.
//
// Programmer: Hank Childs
// Creation: December 31, 2001
......@@ -158,26 +156,34 @@ avtVertexNormalsFilter::~avtVertexNormalsFilter()
// Hank Childs, Thu Dec 28 15:25:50 PST 2006
// Add support for direct normals calculation of structured grids.
//
// Eric Brugger, Tue Jul 22 12:19:31 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
vtkDataSet *
avtVertexNormalsFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
avtDataRepresentation *
avtVertexNormalsFilter::ExecuteData(avtDataRepresentation *in_dr)
{
//
// Get the VTK data set.
//
vtkDataSet *in_ds = in_dr->GetDataVTK();
avtDataAttributes &atts = GetInput()->GetInfo().GetAttributes();
if (atts.GetSpatialDimension() != 3 || atts.GetTopologicalDimension() != 2)
{
return in_ds;
return in_dr;
}
if (GetInput()->GetInfo().GetValidity().NormalsAreInappropriate())
{
return in_ds;
return in_dr;
}
if (GetInput()->GetInfo().GetValidity().GetDisjointElements() == true)
{
return in_ds;
return in_dr;
}
if (in_ds->GetDataObjectType() == VTK_POLY_DATA)
......@@ -202,11 +208,13 @@ avtVertexNormalsFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
normals->Update();
vtkPolyData *out_ds = normals->GetOutput();
//out_ds->SetSource(NULL);
ManageMemory(out_ds);
avtDataRepresentation *out_dr = new avtDataRepresentation(out_ds,
in_dr->GetDomain(), in_dr->GetLabel());
normals->Delete();
return out_ds;
return out_dr;
}
else if (in_ds->GetDataObjectType() == VTK_STRUCTURED_GRID)
{
......@@ -230,16 +238,18 @@ avtVertexNormalsFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
normals->Update();
vtkStructuredGrid *out_ds = normals->GetOutput();
//out_ds->SetSource(NULL);
ManageMemory(out_ds);
normals->Delete();
return out_ds;
avtDataRepresentation *out_dr = new avtDataRepresentation(out_ds,
in_dr->GetDomain(), in_dr->GetLabel());
normals->Delete();
return out_dr;
}
// Don't know what to do with other grid types.
debug1 << "Sent unsupported grid type into normals filter" << endl;
return in_ds;
return in_dr;
}
......
......@@ -75,6 +75,9 @@
// Jeremy Meredith, Thu Feb 15 11:44:28 EST 2007
// Added support for rectilinear grids with an inherent transform.
//
// Eric Brugger, Tue Jul 22 12:19:04 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtVertexNormalsFilter : public avtDataTreeIterator
......@@ -88,7 +91,7 @@ class AVTFILTERS_API avtVertexNormalsFilter : public avtDataTreeIterator
{ return "Calculating normals"; };
protected:
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual bool FilterUnderstandsTransformedRectMesh();
};
......
......@@ -47,6 +47,7 @@
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkRectilinearGrid.h>
#include <vtkVisItUtility.h>
#include <DebugStream.h>
#include <ImproperUseException.h>
......@@ -96,11 +97,9 @@ avtWarpFilter::~avtWarpFilter()
// Takes in an input dataset and warps it by the point data scalars.
//
// Arguments:
// inDS The input dataset.
// <unused> The domain number.
// <unused> The label.
// inDR The input data representation.
//
// Returns: The output dataset.
// Returns: The output data representation.
//
// Programmer: Kathleen Bonnell
// Creation: July 12, 2006
......@@ -112,13 +111,19 @@ avtWarpFilter::~avtWarpFilter()
// Kathleen Biagas, Tue Aug 21 16:48:31 MST 2012
// Preserve coordinate type.
//
// Eric Brugger, Tue Jul 22 12:24:55 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
#include <vtkVisItUtility.h>
vtkDataSet *
avtWarpFilter::ExecuteData(vtkDataSet *inDS, int, string)
avtDataRepresentation *
avtWarpFilter::ExecuteData(avtDataRepresentation *inDR)
{
//
// Get the VTK data set.
//
vtkDataSet *inDS = inDR->GetDataVTK();
if (inDS->GetDataObjectType() != VTK_RECTILINEAR_GRID)
{
EXCEPTION1(ImproperUseException, "Expecting RectlinearGrid");
......@@ -194,9 +199,12 @@ avtWarpFilter::ExecuteData(vtkDataSet *inDS, int, string)
verts->Delete();
lines->Delete();
ManageMemory(polys);
avtDataRepresentation *outDR = new avtDataRepresentation(polys,
inDR->GetDomain(), inDR->GetLabel());
polys->Delete();
return polys;
return outDR;
}
......
......@@ -44,8 +44,8 @@
#define AVT_WARP_FILTER_H
#include <filters_exports.h>
#include <avtDataTreeIterator.h>
#include <avtDataTreeIterator.h>
// ****************************************************************************
......@@ -61,6 +61,9 @@
// Kathleen Bonnell, Fri Nov 17 13:05:53 PST 2006
// Needs FILTERS api for windows build.
//
// Eric Brugger, Tue Jul 22 12:24:30 PDT 2014
// Modified the class to work with avtDataRepresentation.
//
// ****************************************************************************
class AVTFILTERS_API avtWarpFilter : public avtDataTreeIterator
......@@ -74,7 +77,7 @@ class AVTFILTERS_API avtWarpFilter : public avtDataTreeIterator
{ return "Warping dataset"; };
protected:
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual avtDataRepresentation *ExecuteData(avtDataRepresentation *);
virtual void PostExecute(void);
virtual void UpdateDataObjectInfo(void);
virtual avtContract_p
......
......@@ -746,16 +746,23 @@ avtWorldSpaceToImageSpaceTransform::UpdateDataObjectInfo(void)
// If we are looking at polydata (point meshes), then do the same
// perspective trick as we do for curvilinear and unstructured meshes.
//
// Eric Brugger, Tue Jul 22 12:32:39 PDT 2014
// Modified the class to work with avtDataRepresentation.
//