Commit d20b6fe6 authored by Mark Olesen's avatar Mark Olesen

PV3FoamReader - minor changes

  - remove TimeRange property from XML. Not needed for discrete time data
  - represent Lagrangian data as VTK_VERTEX for simple visualization
parent 4ba0be80
......@@ -27,13 +27,6 @@
</Documentation>
</DoubleVectorProperty>
<!-- Send continuous time info to the animation panel -->
<DoubleVectorProperty
name="TimeRange"
information_only="1">
<TimeRangeInformationHelper/>
</DoubleVectorProperty>
<!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty
name="PartArrayInfo"
......
......@@ -186,7 +186,6 @@ int vtkPV3FoamReader::RequestInformation
int nTimeSteps = 0;
double* timeSteps = foamData_->findTimes(nTimeSteps);
// set identical time steps for all ports
for (int infoI = 0; infoI < nInfo; ++infoI)
{
......
......@@ -103,10 +103,8 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
// Get times list
instantList Times = runTime.times();
int foundIndex = Time::findClosestTimeIndex(Times, requestedTime);
int nearestIndex = foundIndex;
if (foundIndex < 0)
int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
if (nearestIndex < 0)
{
nearestIndex = 0;
}
......@@ -146,7 +144,7 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
<< " fieldsChanged=" << fieldsChanged_ << endl;
}
return foundIndex;
return nearestIndex;
}
......
......@@ -716,6 +716,7 @@ public:
return timeIndex_;
}
// Access
//- Debug information
......
......@@ -36,6 +36,7 @@ Description
#include "vtkPV3FoamPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
......@@ -75,15 +76,25 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkpoints->Allocate( parcels.size() );
vtkcells->Allocate( parcels.size() );
vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{
vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
vtkcells->InsertNextCell(1, &particleId);
particleId++;
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
vtkmesh->SetVerts(vtkcells);
vtkcells->Delete();
}
if (debug)
......
......@@ -35,8 +35,8 @@ Description
// VTK includes
#include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
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