[vtkusers] SetTimeValue() not work in vtkOpenFOAMReader.cxx

Sehoon Lee sehooi at gmail.com
Tue Jan 31 06:43:42 EST 2017


Hello!
I'm trying to test vtkOpenFOAMReader.cxx(vtk-6.2) with a sample cavity data.
I got stuck in changing timestep using SetTimeValue().

The result of the following code shows the timestep is not changed at all.
[sehooi at master02 bin]$ test
Scalar range: -4.36666, 4.84854
Scalar range: -4.36666, 4.84854

The expected result is
Scalar range: -4.36666, 4.84854
Scalar range: -4.36666, *4.84853*

Anything wrong in my code?
Thanks in advance.

   vtkSmartPointer<vtkOpenFOAMReader> reader =
vtkSmartPointer<vtkOpenFOAMReader>::New();
   reader->SetFileName("/home/sehooi/cavity/cavity.foam");
   reader->Update();

   reader->SetTimeValue(0.5);
   reader->ReadZonesOn();
   reader->Update();

   vtkUnstructuredGrid *block0 = 
      vtkUnstructuredGrid::SafeDownCast(reader->GetOutput()->GetBlock(0));
   block0->GetCellData()->SetActiveScalars("p");
   std::cout << "Scalar range: "
             << block0->GetCellData()->GetScalars()->GetRange()[0] << ", "
             << block0->GetCellData()->GetScalars()->GetRange()[1] <<
std::endl;

   reader->SetTimeValue(1.0);
   reader->ReadZonesOn();
   reader->Update();

   block0 =
vtkUnstructuredGrid::SafeDownCast(reader->GetOutput()->GetBlock(0));
   block0->GetCellData()->SetActiveScalars("p");
   std::cout << "Scalar range: "
             << block0->GetCellData()->GetScalars()->GetRange()[0] << ", "
             << block0->GetCellData()->GetScalars()->GetRange()[1] <<
std::endl;



--
View this message in context: http://vtk.1045678.n5.nabble.com/SetTimeValue-not-work-in-vtkOpenFOAMReader-cxx-tp5741995.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list