[vtkusers] interpolating using RungaKutta4

tom fogal tfogal at apollo.sr.unh.edu
Thu Aug 26 11:12:24 EDT 2004


I'm trying to interpolate a point using RungaKutta4 and I'm not getting
the results I would have expected.

   float seed[2][3];
   float delT = 0.5;
   float unused;
   vtkInterpolateDataSetAttributes *IntDataSetAttr;
   vtkInterpolatedVelocityField    *IntVelField;
   vtkRungaKutta4                  *RG4;
   MyCustomReaderObject            *src[2];

   ... initialize data ...

   IntDataSetAttr->AddInput(src[0]->GetOutput());
   IntDataSetAttr->AddInput(src[1]->GetOutput());
   IntDataSetAttr->SetT(0.5);
   IntDataSetAttr->Update();
   IntVelField->AddDataSet(IntDataSetAttr->GetOutput());
   IntVelField->SelectVectors("V");
   RG4->SetFunctionSet(IntVelField);

   seed[0][0] = 0.1;
   seed[0][1] = 0.2;
   seed[0][2] = 0.3;
   seed[1][0] = 0.5;
   seed[1][1] = 0.6;
   seed[1][2] = 0.7;
   // seed[1] is for return value
   RG4->ComputeNextStep(seed[0], seed[1], 0.0, delT, unused, unused);

   std::cout << "interpolated points (start \t finish):\n"
             << "\t x: " << seed[0][0] << '\t' << seed[1][0] << '\n'
             << "\t y: " << seed[0][1] << '\t' << seed[1][1] << '\n'
             << "\t z: " << seed[0][2] << '\t' << seed[1][2] << '\n';

I used to not set seed[1] but I was curious to see if it would use
those values. ComputeNextStep seems to only copy seed[0] to seed[1].
Any ideas what I'm doing wrong here? How is one supposed to use
RungaKutta4 ?

TIA,

-tom



More information about the vtkusers mailing list