PV3FoamReader - minor changes

- remove TimeRange property from XML. Not needed for discrete time data
  - represent Lagrangian data as VTK_VERTEX for simple visualization
This commit is contained in:
Mark Olesen
2008-08-05 21:41:47 +02:00
parent 6ffd5a3358
commit de195bf1fd
6 changed files with 17 additions and 15 deletions

View File

@ -27,13 +27,6 @@
</Documentation> </Documentation>
</DoubleVectorProperty> </DoubleVectorProperty>
<!-- Send continuous time info to the animation panel -->
<DoubleVectorProperty
name="TimeRange"
information_only="1">
<TimeRangeInformationHelper/>
</DoubleVectorProperty>
<!-- Available Parts (volume, patches, lagrangian) array --> <!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty <StringVectorProperty
name="PartArrayInfo" name="PartArrayInfo"

View File

@ -186,7 +186,6 @@ int vtkPV3FoamReader::RequestInformation
int nTimeSteps = 0; int nTimeSteps = 0;
double* timeSteps = foamData_->findTimes(nTimeSteps); double* timeSteps = foamData_->findTimes(nTimeSteps);
// set identical time steps for all ports // set identical time steps for all ports
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
{ {

View File

@ -103,10 +103,8 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();
int foundIndex = Time::findClosestTimeIndex(Times, requestedTime); int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
int nearestIndex = foundIndex; if (nearestIndex < 0)
if (foundIndex < 0)
{ {
nearestIndex = 0; nearestIndex = 0;
} }
@ -146,7 +144,7 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime)
<< " fieldsChanged=" << fieldsChanged_ << endl; << " fieldsChanged=" << fieldsChanged_ << endl;
} }
return foundIndex; return nearestIndex;
} }

View File

@ -716,6 +716,7 @@ public:
return timeIndex_; return timeIndex_;
} }
// Access // Access
//- Debug information //- Debug information

View File

@ -36,6 +36,7 @@ Description
#include "vtkPV3FoamPoints.H" #include "vtkPV3FoamPoints.H"
// VTK includes // VTK includes
#include "vtkCellArray.h"
#include "vtkPoints.h" #include "vtkPoints.h"
#include "vtkPolyData.h" #include "vtkPolyData.h"
@ -75,15 +76,25 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
vtkmesh = vtkPolyData::New(); vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( parcels.size() ); vtkCellArray* vtkcells = vtkCellArray::New();
vtkpoints->Allocate( parcels.size() );
vtkcells->Allocate( parcels.size() );
vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter) forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{ {
vtkPV3FoamInsertNextPoint(vtkpoints, iter().position()); vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
vtkcells->InsertNextCell(1, &particleId);
particleId++;
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete(); vtkpoints->Delete();
vtkmesh->SetVerts(vtkcells);
vtkcells->Delete();
} }
if (debug) if (debug)

View File

@ -35,8 +35,8 @@ Description
// VTK includes // VTK includes
#include "vtkCellArray.h" #include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h" #include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //