MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

IO/Geometry/vtkMFIXReader.cxx:151–194  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

149
150//------------------------------------------------------------------------------
151int vtkMFIXReader::RequestData(vtkInformation* vtkNotUsed(request),
152 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
153{
154 vtkInformation* outInfo = outputVector->GetInformationObject(0);
155 vtkUnstructuredGrid* output =
156 vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
157 vtkDebugMacro(<< "Reading MFIX file");
158
159 // Save the time value in the output data information.
160 int length = outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
161 double* steps = outInfo->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
162
163 if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
164 {
165 // Get the requested time step. We only support requests of a single time
166 // step in this reader right now
167 double requestedTimeStep = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
168
169 // find the timestep with the closest value
170 int cnt = 0;
171 int closestStep = 0;
172 double minDist = -1;
173 for (cnt = 0; cnt < length; cnt++)
174 {
175 double tdist = (steps[cnt] - requestedTimeStep > requestedTimeStep - steps[cnt])
176 ? steps[cnt] - requestedTimeStep
177 : requestedTimeStep - steps[cnt];
178 if (minDist < 0 || tdist < minDist)
179 {
180 minDist = tdist;
181 closestStep = cnt;
182 }
183 }
184 this->CurrentTimeStep = closestStep;
185 }
186 else
187 {
188 this->CurrentTimeStep = this->TimeStep;
189 }
190
191 this->MakeMesh(output);
192 output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(), steps[this->CurrentTimeStep]);
193 return 1;
194}
195
196//------------------------------------------------------------------------------
197void vtkMFIXReader::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 7

MakeMeshMethod · 0.95
GetInformationObjectMethod · 0.80
GetMethod · 0.45
LengthMethod · 0.45
HasMethod · 0.45
SetMethod · 0.45
GetInformationMethod · 0.45

Tested by

no test coverage detected