[Paraview] Time based, MultiBlock data set

Mike Jackson imikejackson at gmail.com
Mon Mar 24 16:10:29 EDT 2008


I am porting a custom reader from PV 2.6 to PV 3.cvs-head and I need  
to catch up on the "Time" support.

Basically our file has our data with a varying number of timesteps.  
Everything worked just fine in PV 2.6 but now with PV 3.x I am not  
sure what I really need to have in my PVSM file? I used to have:

   <SourceProxy name="PrdsMultiBlockDislocationReader"
                class="vtkPrdsMultiBlockDislocationReader">
      <StringVectorProperty
         name="FileName"
         command="SetFileName"
         number_of_elements="1">
         <StringListDomain name="files"/>
      </StringVectorProperty>

      <IntVectorProperty
         name="TimeStep"
         command="SetTimeStep"
         number_of_elements="1"
         animateable="1"
         default_values="0"
         information_property="TimestepValues">

        <IntRangeDomain name="range">
           <RequiredProperties>
              <Property name="TimeStepRangeInfo" function="Range"/>
           </RequiredProperties>
        </IntRangeDomain>
      </IntVectorProperty>

      <IntVectorProperty
         name="TimeStepRangeInfo"
         command="GetTimeStepRange"
         information_only="1">
         <SimpleIntInformationHelper/>
      </IntVectorProperty>

      <DoubleVectorProperty
         name="TimestepValues"
         information_only="1">
         <TimeStepsInformationHelper/>
      </DoubleVectorProperty>
    </SourceProxy>

But I am not sure that I need all of that because I believe I should  
be reacting to the timestep that is requested through the pipeline.

My current code looks like this:

   int tsLength = outInfo->Length 
(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
   double* steps = outInfo->Get 
(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
   // Check if a particular time was requested.
   if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS 
()))
   {
     // Get the requested time step. We only supprt requests of a  
single time
     // step in this reader right now
     double *requestedTimeSteps = outInfo->Get 
(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS());
     this->TimeValue = requestedTimeSteps[0];

     // find the first time value larger than requested time value
     // this logic could be improved
     int cnt = 0;
     while (cnt < tsLength-1 && steps[cnt] < this->TimeValue)
       {
       cnt++;
       }
     this->ActualTimeStep = cnt;
   }

   if (this->ActualTimeStep >= this->TimeStepRange[0] && this- 
 >ActualTimeStep <= this->TimeStepRange[1]) {
     vtkSmartPointer<DislocationReader> reader =  
vtkSmartPointer<DislocationReader>::New();
     reader->SetFileName(this->FileName);
     reader->SetTimeStep(this->ActualTimeStep);
     //reader->SetInformationVector(outputVector);
     reader->SetFileOffsets(this->FileOffsets);
     reader->read();
     vtkUnstructuredGrid* grid;
     grid = reader->GetDislocations();
     mb->SetBlock(0, grid);    // Group #0, dataset #i
     grid = reader->GetSimulationBox();
     mb->SetBlock(1, grid);
   } else {
       std::cout << "vtkPrdsMultiBlockDislocationReader: Timestep was  
out of Range: " << this->ActualTimeStep << std::endl;
       std::cout << "vtkPrdsMultiBlockDislocationReader: Timestep  
Range:" << this->TimeStepRange[0] << " -> " << this->TimeStepRange[1]  
<< std::endl;
       return 0;
   }

Is there an example of a reader that supports "time" that I could  
look at to try and figure out what I need to do to get my code to  
work correctly?

Thanks
--
Mike Jackson
imikejackson & gmail * com






More information about the ParaView mailing list