Commit 76a9e183 authored by Jon Woodring's avatar Jon Woodring
Browse files

Merge branch 'pv-master' into scdemo

parents f7ac3519 4107f777
......@@ -91,7 +91,6 @@ void vtkPoints::GetPoints(vtkIdList *ptIds, vtkPoints *fp)
void vtkPoints::ComputeBounds()
{
vtkIdType i;
int j;
double *x;
if ( this->GetMTime() > this->ComputeTime )
......@@ -101,17 +100,12 @@ void vtkPoints::ComputeBounds()
for (i=0; i<this->GetNumberOfPoints(); i++)
{
x = this->GetPoint(i);
for (j=0; j<3; j++)
{
if ( x[j] < this->Bounds[2*j] )
{
this->Bounds[2*j] = x[j];
}
if ( x[j] > this->Bounds[2*j+1] )
{
this->Bounds[2*j+1] = x[j];
}
}
this->Bounds[0] = x[0] < this->Bounds[0] ? x[0] : this->Bounds[0];
this->Bounds[1] = x[0] > this->Bounds[1] ? x[0] : this->Bounds[1];
this->Bounds[2] = x[1] < this->Bounds[2] ? x[1] : this->Bounds[2];
this->Bounds[3] = x[1] > this->Bounds[3] ? x[1] : this->Bounds[3];
this->Bounds[4] = x[2] < this->Bounds[4] ? x[2] : this->Bounds[4];
this->Bounds[5] = x[2] > this->Bounds[5] ? x[2] : this->Bounds[5];
}
this->ComputeTime.Modified();
......
......@@ -91,6 +91,7 @@
#define VTK_MULTIPIECE_DATA_SET 25
#define VTK_DIRECTED_ACYCLIC_GRAPH 26
#define VTK_ARRAY_DATA 27
#define VTK_REEB_GRAPH 28
/*--------------------------------------------------------------------------*/
/* Define a casting macro for use by the constants below. */
......
......@@ -135,6 +135,14 @@ public:
void PrintSelf(ostream& os, vtkIndent indent);
void PrintNodeData(ostream& os, vtkIndent indent);
// Description:
// Return class name of data type. This is one of VTK_STRUCTURED_GRID,
// VTK_STRUCTURED_POINTS, VTK_UNSTRUCTURED_GRID, VTK_POLY_DATA, or
// VTK_RECTILINEAR_GRID (see vtkSetGet.h for definitions).
// THIS METHOD IS THREAD SAFE
virtual int GetDataObjectType() {return VTK_REEB_GRAPH;}
enum
{
ERR_INCORRECT_FIELD = -1,
......
......@@ -79,6 +79,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPointData.h"
#include "vtkDataObject.h"
#include "vtkStdString.h"
#include "vtkCellArray.h"
#include "vtkstd/vector"
......@@ -299,25 +300,26 @@ int vtkPCosmoReader::RequestData(
vtkPoints* points = vtkPoints::New();
points->SetDataTypeToFloat();
points->Allocate(numberOfParticles);
vtkCellArray* cells = vtkCellArray::New();
cells->EstimateSize(numberOfParticles, 1);
vtkFloatArray* vel = vtkFloatArray::New();
vel->SetName("velocity");
vel->SetNumberOfComponents(DIMENSION);
vel->Allocate(numberOfParticles);
vtkFloatArray* m = vtkFloatArray::New();
m->SetName("mass");
m->Allocate(numberOfParticles);
vtkIntArray* uid = vtkIntArray::New();
uid->SetName("tag");
uid->Allocate(numberOfParticles);
vtkIntArray* owner = vtkIntArray::New();
owner->SetName("ghost");
owner->Allocate(numberOfParticles);
vtkUnsignedCharArray* ghost = vtkUnsignedCharArray::New();
ghost->SetName("vtkGhostLevels");
output->Allocate(numberOfParticles);
output->SetPoints(points);
output->GetPointData()->AddArray(vel);
output->GetPointData()->AddArray(m);
output->GetPointData()->AddArray(uid);
output->GetPointData()->AddArray(owner);
output->GetPointData()->AddArray(ghost);
ghost->Allocate(numberOfParticles);
// put it into the correct VTK structure
for(vtkIdType i = 0; i < numberOfParticles; i = i + 1)
......@@ -333,7 +335,7 @@ int vtkPCosmoReader::RequestData(
zz->pop_back();
vtkIdType pid = points->InsertNextPoint(pt);
output->InsertNextCell(1, 1, &pid);
cells->InsertNextCell(1, &pid);
// insert velocity
pt[0] = vx->back();
......@@ -367,7 +369,18 @@ int vtkPCosmoReader::RequestData(
}
// cleanup
output->SetPoints(points);
output->SetCells(1, cells);
output->GetPointData()->AddArray(vel);
output->GetPointData()->AddArray(m);
output->GetPointData()->AddArray(uid);
output->GetPointData()->AddArray(owner);
output->GetPointData()->AddArray(ghost);
output->Squeeze();
points->Delete();
cells->Delete();
vel->Delete();
m->Delete();
uid->Delete();
......
Supports Markdown
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