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

Method RequestData

IO/ParallelNetCDF/vtkPNetCDFPOPReader.cxx:274–461  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Setting extents of the rectilinear grid

Source from the content-addressed store, hash-verified

272//------------------------------------------------------------------------------
273// Setting extents of the rectilinear grid
274int vtkPNetCDFPOPReader::RequestData(vtkInformation* request,
275 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
276{
277 this->UpdateProgress(0);
278 // the default implementation is to do what the old pipeline did find what
279 // output is requesting the data, and pass that into ExecuteData
280 // which output port did the request come from
281 int outputPort = request->Get(vtkDemandDrivenPipeline::FROM_OUTPUT_PORT());
282 // if output port is negative then that means this filter is calling the
283 // update directly, in that case just assume port 0
284 if (outputPort == -1)
285 {
286 outputPort = 0;
287 }
288
289 // get the data object
290 vtkInformation* outInfo = outputVector->GetInformationObject(outputPort);
291 vtkDataObject* output = outInfo->Get(vtkDataObject::DATA_OBJECT());
292
293 int subext[6];
294 // vtkInformation * outInfo = output->GetInformationObject(0);
295 outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), subext);
296
297 vtkRectilinearGrid* rgrid = vtkRectilinearGrid::SafeDownCast(output);
298 rgrid->SetExtent(subext);
299
300 size_t count[] = { static_cast<size_t>(subext[5] - subext[4] + 1),
301 static_cast<size_t>(subext[3] - subext[2] + 1),
302 static_cast<size_t>(subext[1] - subext[0] + 1) };
303
304 // initialize memory (raw data space, x y z axis space) and rectilinear grid
305 bool firstPass = true;
306 for (size_t i = 0; i < this->Internals->VariableMap.size(); i++)
307 {
308 if (this->Internals->VariableMap[i] != -1 &&
309 this->Internals->VariableArraySelection->GetArraySetting(this->Internals->VariableMap[i]) !=
310 0)
311 {
312 // varidp is probably i in which case nc_inq_varid isn't needed
313 int varidp = VTK_INT_MIN;
314 if (IsReaderRank())
315 {
316 nc_inq_varid(this->NCDFFD,
317 this->Internals->VariableArraySelection->GetArrayName(this->Internals->VariableMap[i]),
318 &varidp);
319 }
320
321 if (firstPass)
322 {
323 firstPass = false;
324 // Get the latitude, longitude & depth values: the first reader process
325 // does the read and broadcasts to everyone
326
327 // set up start and stride values for this process's data (count is already set)
328 size_t start[] = { static_cast<size_t>(subext[4]), static_cast<size_t>(subext[2]),
329 static_cast<size_t>(subext[0]) };
330
331 ptrdiff_t rStride[3] = { (ptrdiff_t)this->Stride[2], (ptrdiff_t)this->Stride[1],

Callers

nothing calls this directly

Calls 15

IsFirstReaderRankMethod · 0.95
nc_inq_varidFunction · 0.85
nc_inq_vardimidFunction · 0.85
nc_get_vars_floatFunction · 0.85
GetInformationObjectMethod · 0.80
GetNumberOfProcessesMethod · 0.80
NoBlockReceiveMethod · 0.80
WaitAllMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
UpdateProgressMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected