Commit 8d681ddb authored by bonnell's avatar bonnell

Some more work towards double-precision support.

Most of these changes are to preserve coordinate's data type as it passes through the filter.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@19049 18c085ea-50e0-402c-830e-de6fd14e8384
parent 9499671b
......@@ -7909,6 +7909,9 @@ avtGenericDatabase::CreateSimplifiedNestingRepresentation(
// Hank Childs, Sun Oct 28 15:02:31 PST 2007
// If there is ghost data in the input, then ignore that ghost data.
//
// Kathleen Biagas, Tue Aug 21 14:18:32 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkUnstructuredGrid *
......@@ -8300,7 +8303,7 @@ avtGenericDatabase::CreateSimplifiedNestingRepresentation(
// won't be very many (so memory cost won't be high) and it makes
// our indexing so easy this way.
//
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(rgrid);
int nPts = numIlist*numJlist*numKlist;
pts->SetNumberOfPoints(nPts);
int iOff = 0;
......@@ -10398,6 +10401,9 @@ avtGenericDatabase::AssociateBounds(vtkDataSet *ds)
// Make sure that all of the dimensions are too big or too small, not just
// one of them.
//
// Kathleen Biagas, Tue Aug 21 14:17:12 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
void
......@@ -10530,18 +10536,46 @@ avtGenericDatabase::ScaleMesh(vtkDataSet *ds)
{
vtkPointSet *ps = (vtkPointSet *) ds;
vtkPoints *pts = ps->GetPoints();
vtkPoints *newPts = vtkPoints::New();
int npts = pts->GetNumberOfPoints();
vtkPoints *newPts = vtkPoints::New(pts->GetDataType());
vtkIdType npts = pts->GetNumberOfPoints();
newPts->SetNumberOfPoints(npts);
float *np = (float *) newPts->GetVoidPointer(0);
float *p = (float *) pts->GetVoidPointer(0);
int nvals = 3*npts;
for (int i = 0 ; i < nvals ; i++)
if (pts->GetDataType() == VTK_FLOAT)
{
np[i] = p[i] / scaleFactor;
float *np = (float *) newPts->GetVoidPointer(0);
float *p = (float *) pts->GetVoidPointer(0);
int nvals = 3*npts;
for (int i = 0 ; i < nvals ; i++)
{
np[i] = p[i] / scaleFactor;
}
ps->SetPoints(newPts);
newPts->Delete();
}
else if (pts->GetDataType() == VTK_DOUBLE)
{
double *np = (double *) newPts->GetVoidPointer(0);
double *p = (double *) pts->GetVoidPointer(0);
int nvals = 3*npts;
for (int i = 0 ; i < nvals ; i++)
{
np[i] = p[i] / scaleFactor;
}
ps->SetPoints(newPts);
newPts->Delete();
}
else
{
for (int i = 0 ; i < npts ; i++)
{
double *np = pts->GetPoint(i);
np[0] = np[0] / scaleFactor;
np[1] = np[1] / scaleFactor;
np[2] = np[2] / scaleFactor;
newPts->SetPoint(i, np);
}
ps->SetPoints(newPts);
newPts->Delete();
}
ps->SetPoints(newPts);
newPts->Delete();
}
break;
case VTK_RECTILINEAR_GRID:
......@@ -10551,10 +10585,10 @@ avtGenericDatabase::ScaleMesh(vtkDataSet *ds)
in[0] = rg->GetXCoordinates();
in[1] = rg->GetYCoordinates();
in[2] = rg->GetZCoordinates();
vtkFloatArray *out[3];
vtkDataArray *out[3];
for (int i = 0 ; i < 3 ; i++)
{
out[i] = vtkFloatArray::New();
out[i] = in[i]->NewInstance();
int ntuples = in[i]->GetNumberOfTuples();
out[i]->SetNumberOfTuples(ntuples);
for (int j = 0 ; j < ntuples ; j++)
......
......@@ -344,6 +344,9 @@ TransformSingleVector(avtCoordSystemConvert::VectorTransformMethod method,
// to this function; since some of the methods require the original
// and transformed cell/point coordinates, so it has to be done here.
//
// Kathleen Biagas, Tue Aug 21 16:53:09 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
static vtkDataSet *
......@@ -358,7 +361,7 @@ Transform(vtkDataSet *in_ds,
// Transform the points
//
vtkPoints *pts = vtkVisItUtility::GetPoints(in_ds);
vtkPoints *newPts = vtkPoints::New();
vtkPoints *newPts = vtkPoints::New(pts->GetDataType());
newPts->SetNumberOfPoints(numPts);
for (int i = 0 ; i < numPts ; i++)
{
......@@ -524,6 +527,9 @@ Transform(vtkDataSet *in_ds,
// Hank Childs, Mon Feb 28 15:04:00 PST 2011
// Fix wraparound for poly data as well.
//
// Kathleen Biagas, Tue Aug 21 16:53:32 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
static vtkDataSet *
......@@ -568,7 +574,7 @@ FixWraparounds(vtkDataSet *in_ds, int comp_idx)
vtkPoints *pts = ugrid->GetPoints();
int npts = pts->GetNumberOfPoints();
vtkPoints *new_pts = vtkPoints::New();
vtkPoints *new_pts = vtkPoints::New(pts->GetDataType());
new_pts->SetNumberOfPoints(2*npts);
vtkUnstructuredGrid *new_grid = vtkUnstructuredGrid::New();
new_grid->SetPoints(new_pts);
......
......@@ -52,6 +52,7 @@
#include <avtDatasetExaminer.h>
#include <avtExtents.h>
#include <vtkVisItUtility.h>
#include <DebugStream.h>
#include <ImproperUseException.h>
......@@ -160,6 +161,9 @@ avtDisplaceFilter::SetVariable(const std::string &v)
// Hank Childs, Fri Sep 28 07:40:16 PDT 2007
// Fix bug with cell centered data and rectilinear grids.
//
// Kathleen Biagas, Tue Aug 21 16:52:12 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -233,7 +237,7 @@ avtDisplaceFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
sg->SetDimensions(dims);
sg->GetCellData()->ShallowCopy(rg->GetCellData());
sg->GetPointData()->ShallowCopy(rg->GetPointData());
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(in_ds);
int npts = dims[0]*dims[1]*dims[2];
pts->SetNumberOfPoints(npts);
for (int i = 0 ; i < npts ; i++)
......@@ -241,9 +245,9 @@ avtDisplaceFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
int xi = i % dims[0];
int yi = (i / dims[0]) % dims[1];
int zi = i / (dims[0]*dims[1]);
float x = rg->GetXCoordinates()->GetTuple1(xi);
float y = rg->GetYCoordinates()->GetTuple1(yi);
float z = rg->GetZCoordinates()->GetTuple1(zi);
double x = rg->GetXCoordinates()->GetTuple1(xi);
double y = rg->GetYCoordinates()->GetTuple1(yi);
double z = rg->GetZCoordinates()->GetTuple1(zi);
double *vec = vecs->GetTuple3(i);
x += factor*vec[0];
y += factor*vec[1];
......
......@@ -1388,7 +1388,7 @@ avtFacelistFilter::FindEdges(vtkDataSet *in_ds)
outPD->CopyAllocate(inPD, nPtsUsed);
outCD->CopyAllocate(inCD, nEdges);
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(in_ds);
pts->SetNumberOfPoints(nPtsUsed);
out_ds->SetPoints(pts);
pts->Delete();
......
......@@ -55,6 +55,7 @@
#include <DebugStream.h>
#include <VisItException.h>
#include <vtkVisItUtility.h>
using std::string;
......@@ -133,6 +134,9 @@ avtFeatureEdgesFilter::~avtFeatureEdgesFilter()
// Hank Childs, Thu Mar 31 11:16:23 PST 2005
// Fix problem with single cell case ['6105].
//
// Kathleen Biagas, Tue Aug 21 16:50:07 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -169,7 +173,7 @@ avtFeatureEdgesFilter::ExecuteData(vtkDataSet *inDS, int, string)
vtkIdList *ids = cell->GetPointIds();
int npts = ids->GetNumberOfIds();
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(inDS);
pts->SetNumberOfPoints(npts);
outPD->CopyAllocate(inPD, npts);
std::vector<int> origId(npts, -1);
......
......@@ -58,6 +58,7 @@
#include <DebugStream.h>
#include <VisItException.h>
#include <vtkVisItUtility.h>
static bool IsIdentity(vtkMatrix4x4 *);
......@@ -589,6 +590,9 @@ avtTransform::TransformRectilinearToRectilinear(vtkRectilinearGrid *rgrid)
// Dave Pugmire, Fri May 14 08:04:43 EDT 2010
// Flag for vector transformations.
//
// Kathleen Biagas, Tue Aug 21 16:49:12 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -603,7 +607,7 @@ avtTransform::TransformRectilinearToCurvilinear(vtkRectilinearGrid *rgrid)
int numPts = dims[0]*dims[1]*dims[2];
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(rgrid);
pts->SetNumberOfPoints(numPts);
vtkDataArray *x = rgrid->GetXCoordinates();
......@@ -617,13 +621,13 @@ avtTransform::TransformRectilinearToCurvilinear(vtkRectilinearGrid *rgrid)
{
for (int i = 0 ; i < dims[0] ; i++)
{
float inpoint[4];
double inpoint[4];
inpoint[0] = x->GetComponent(i,0);
inpoint[1] = y->GetComponent(j,0);
inpoint[2] = z->GetComponent(k,0);
inpoint[3] = 1.;
float outpoint[4];
double outpoint[4];
t->MultiplyPoint(inpoint, outpoint);
outpoint[0] /= outpoint[3];
......
......@@ -109,6 +109,9 @@ avtWarpFilter::~avtWarpFilter()
// Brad Whitlock, Tue Mar 30 15:33:46 PDT 2010
// Use avtCurveTransform, if it exists, to transform the curve points.
//
// Kathleen Biagas, Tue Aug 21 16:48:31 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
#include <vtkVisItUtility.h>
......@@ -141,8 +144,7 @@ avtWarpFilter::ExecuteData(vtkDataSet *inDS, int, string)
int nPts = xc->GetNumberOfTuples();
vtkPoints *pts = vtkPoints::New();
pts->SetDataType(xc->GetDataType());
vtkPoints *pts = vtkPoints::New(xc->GetDataType());
pts->SetNumberOfPoints(nPts);
vtkCellArray *verts = vtkCellArray::New();
......@@ -156,13 +158,13 @@ avtWarpFilter::ExecuteData(vtkDataSet *inDS, int, string)
pts->SetPoint(i, xc->GetTuple1(i), sc->GetTuple1(i), 0.);
else
{
float inpoint[4];
double inpoint[4];
inpoint[0] = xc->GetTuple1(i);
inpoint[1] = sc->GetTuple1(i);
inpoint[2] = 0.;
inpoint[3] = 1.;
float outpoint[4];
double outpoint[4];
t->MultiplyPoint(inpoint, outpoint);
outpoint[0] /= outpoint[3];
......
This diff is collapsed.
......@@ -1251,8 +1251,8 @@ avtTransparencyActor::PrepareDataset(int input, int subinput)
//
// Create the point list. This will have a lot of repeated points.
//
vtkPoints *pts = vtkPoints::New();
vtkPoints *in_pts = pd->GetPoints();
vtkPoints *pts = vtkPoints::New(in_pts->GetDataType());
pts->SetNumberOfPoints(count);
for (vtkIdType i = 0 ; i < count ; i++)
{
......
......@@ -57,6 +57,7 @@
#include <avtIntervalTree.h>
#include <avtMetaData.h>
#include <avtSpatialBoxSelection.h>
#include <vtkVisItUtility.h>
#include <DebugStream.h>
......@@ -253,7 +254,7 @@ vtkBoxFilter::Execute(void)
// Set up some the VTK vars that will (eventually) be copied over
// to the output.
//
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(input);
pts->Allocate(nPts/4,nPts);
vtkUnstructuredGrid *output = GetOutput();
output->Allocate(nCells);
......
......@@ -119,8 +119,8 @@ vtkPolarTransformFilter::Execute(void)
// First copy over the points. We will transform them to polar coordinates
// as we copy them.
//
vtkPoints *newPts = vtkPoints::New();
vtkPoints *oldPts = input->GetPoints();
vtkPoints *newPts = vtkPoints::New(oldPts->GetDataType());
newPts->Allocate(nPts + 2*nCells); // Justification for this
// large of a buffer is below.
......
......@@ -150,6 +150,10 @@ avtCoordSwapFilter::Equivalent(const AttributeGroup *a)
// Programmer: childs -- generated by xml2avt
// Creation: Wed Feb 2 15:47:40 PST 2005
//
// Modifications:
// Kathleen Biagas, Tue Aug 21 16:06:23 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -258,7 +262,7 @@ avtCoordSwapFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
vtkPointSet *out_ps = (vtkPointSet *) ps->NewInstance();
out_ps->ShallowCopy(ps);
vtkPoints *out_pts = vtkPoints::New();
vtkPoints *out_pts = vtkPoints::New(in_pts->GetDataType());
out_ps->SetPoints(out_pts);
out_pts->Delete();
out_pts->SetNumberOfPoints(npts);
......
......@@ -43,7 +43,6 @@
#include <avtCreateBondsFilter.h>
#include <vtkDataSet.h>
#include <vtkFloatArray.h>
#include <vtkCellData.h>
#include <vtkCellArray.h>
#include <vtkGeometryFilter.h>
......@@ -371,7 +370,11 @@ avtCreateBondsFilter::ExecuteData(vtkDataSet *in_ds, int, string)
// Use the element variable specified in the attributes.
// Support any type of input nodal array.
//
// Kathleen Biagas, Tue Aug 21 16:08:27 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
avtCreateBondsFilter::ExecuteData_Fast(vtkPolyData *in, float maxBondDist,
float minx, float maxx,
......@@ -411,7 +414,7 @@ avtCreateBondsFilter::ExecuteData_Fast(vtkPolyData *in, float maxBondDist,
vtkPolyData *out = in->NewInstance();
vtkPointData *outPD = out->GetPointData();
vtkCellData *outCD = out->GetCellData();
vtkPoints *outPts = vtkPoints::New();
vtkPoints *outPts = vtkPoints::New(inPts->GetDataType());
vtkCellArray *outVerts = vtkCellArray::New();
vtkCellArray *outLines = vtkCellArray::New();
out->GetFieldData()->ShallowCopy(in->GetFieldData());
......@@ -735,6 +738,9 @@ avtCreateBondsFilter::ExecuteData_Fast(vtkPolyData *in, float maxBondDist,
// Use the element variable specified in the attributes.
// Support any type of input nodal array.
//
// Kathleen Biagas, Tue Aug 21 16:08:27 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -773,7 +779,7 @@ avtCreateBondsFilter::ExecuteData_Slow(vtkPolyData *in)
vtkPolyData *out = in->NewInstance();
vtkPointData *outPD = out->GetPointData();
vtkCellData *outCD = out->GetCellData();
vtkPoints *outPts = vtkPoints::New();
vtkPoints *outPts = vtkPoints::New(inPts->GetDataType());
vtkCellArray *outVerts = vtkCellArray::New();
vtkCellArray *outLines = vtkCellArray::New();
out->GetFieldData()->ShallowCopy(in->GetFieldData());
......
......@@ -48,7 +48,7 @@
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkFloatArray.h>
#include <vtkVisItUtility.h>
#include <GeometricHelpers.h>
......@@ -151,6 +151,10 @@ avtDeformSphereGlyphFilter::Equivalent(const AttributeGroup *a)
// Programmer: Jeremy Meredith
// Creation: March 19, 2009
//
// Modifications:
// Kathleen Biagas, Tue Aug 21 16:11:37 MST 2012
// Perserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -181,7 +185,7 @@ avtDeformSphereGlyphFilter::ExecuteData(vtkDataSet *in_ds, int, std::string)
// set up the output data
vtkPolyData *output = vtkPolyData::New();
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(in_ds);
output->SetPoints(pts);
pts->Delete();
vtkCellArray *polys = vtkCellArray::New();
......
......@@ -47,7 +47,6 @@
#include <vtkCellData.h>
#include <vtkDataSetRemoveGhostCells.h>
#include <vtkMaskPoints.h>
#include <vtkFloatArray.h>
#include <vtkIntArray.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
......@@ -1260,6 +1259,8 @@ avtIndexSelectFilter::VerifyInput()
// Creation: April 14, 2010
//
// Modifications:
// Kathleen Biagas, Tue Aug 21 16:14:59 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
......@@ -1298,7 +1299,7 @@ avtIndexSelectFilter::Replicate(vtkDataSet *in_ds, bool wrap[3] )
// Make a new coord with a new value at the end.
vtkDataArray *coor = GetCoordinates(rgrid, d0);
vtkDataArray *coor_new = vtkFloatArray::New();
vtkDataArray *coor_new = coor->NewInstance();
coor_new->SetNumberOfTuples(dims_out[d0]);
for (int i=0; i<dims[d0]; ++i)
coor_new->SetTuple1(i, coor->GetTuple1(i));
......@@ -1329,7 +1330,7 @@ avtIndexSelectFilter::Replicate(vtkDataSet *in_ds, bool wrap[3] )
dims_out[2] = dims_in[2] + (wrap[2] ? 1 : 0);
vtkPoints *pts = sgrid->GetPoints();
vtkPoints *new_pts = vtkPoints::New();
vtkPoints *new_pts = vtkPoints::New(pts->GetDataType());
vtkStructuredGrid *out_sg = vtkStructuredGrid::New();
out_sg->SetDimensions(dims_out);
out_sg->SetPoints(new_pts);
......
......@@ -56,6 +56,7 @@
#include <DebugStream.h>
#include <ImproperUseException.h>
#include <vtkVisItUtility.h>
// ****************************************************************************
// Method: avtMetricThresholdFilter constructor
......@@ -278,12 +279,16 @@ avtMetricThresholdFilter::UpdateDataObjectInfo(void)
// Programmer: Akira Haddox
// Creation: June 20, 2002
//
// Modifications:
// Kathleen Biagas, Tue Aug 21 16:16:32 MST 2012
// Preserve coordinate type.
//
// ****************************************************************************
vtkPoints *
avtMetricThresholdFilter::CreateRectilinearPoints(vtkRectilinearGrid *grid)
{
vtkPoints *pts = vtkPoints::New();
vtkPoints *pts = vtkVisItUtility::NewPoints(grid);
vtkDataArray *xC = grid->GetXCoordinates();
vtkDataArray *yC = grid->GetYCoordinates();
......@@ -299,7 +304,7 @@ avtMetricThresholdFilter::CreateRectilinearPoints(vtkRectilinearGrid *grid)
for (int j = 0 ; j < numY; j++)
for (int k = 0 ; k < numZ; k++)
{
float pt[3];
double pt[3];
pt[0] = xC->GetComponent(i,0);
pt[1] = yC->GetComponent(j,0);
pt[2] = zC->GetComponent(k,0);
......@@ -337,7 +342,7 @@ inline bool Between(double _a, double _b, double _c)
}
inline bool
avtMetricThresholdFilter::PassesTest(int type, float value)
avtMetricThresholdFilter::PassesTest(int type, double value)
{
switch (type)
{
......
......@@ -87,7 +87,7 @@ class avtMetricThresholdFilter : public avtPluginDataTreeIterator
vtkDataSet *ExecuteOnScalarData(vtkDataSet *, vtkDataArray *);
vtkPoints *CreateRectilinearPoints(vtkRectilinearGrid *);
inline bool PassesTest(int type, float value);
inline bool PassesTest(int type, double value);
};
......
......@@ -215,6 +215,10 @@ avtVector avtToroidalPoloidalProjectionFilter::GetCentroid(vtkPoints* inPts)
// Programmer: hari -- generated by xml2avt
// Creation: Tue Feb 1 09:27:46 PDT 2011
//
// Modifications:
// Kathleen Biagas, Tue Aug 21 16:28:11 MST 2012
// Perserve coordinate type.
//
// ****************************************************************************
vtkDataSet *
......@@ -237,7 +241,7 @@ avtToroidalPoloidalProjectionFilter::ExecuteData(vtkDataSet *in_ds,
int nPts = inPts->GetNumberOfPoints();
vtkPoints *outPts = vtkPoints::New();
vtkPoints *outPts = vtkPoints::New(inPts->GetDataType());
outPts->SetNumberOfPoints( nPts );
// double R0 = atts.GetR0();
......
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