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

Method RequestData

IO/NetCDF/vtkNetCDFPOPReader.cxx:178–299  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

176//------------------------------------------------------------------------------
177// Setting extents of the rectilinear grid
178int vtkNetCDFPOPReader::RequestData(vtkInformation* request,
179 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
180{
181 this->UpdateProgress(0);
182 // the default implementation is to do what the old pipeline did find what
183 // output is requesting the data, and pass that into ExecuteData
184 // which output port did the request come from
185 int outputPort = request->Get(vtkDemandDrivenPipeline::FROM_OUTPUT_PORT());
186 // if output port is negative then that means this filter is calling the
187 // update directly, in that case just assume port 0
188 if (outputPort == -1)
189 {
190 outputPort = 0;
191 }
192 // get the data object
193 vtkInformation* outInfo = outputVector->GetInformationObject(outputPort);
194
195 vtkDataObject* output = outInfo->Get(vtkDataObject::DATA_OBJECT());
196 int subext[6];
197 // vtkInformation * outInfo = output->GetInformationObject(0);
198 outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), subext);
199 vtkRectilinearGrid* rgrid = vtkRectilinearGrid::SafeDownCast(output);
200 rgrid->SetExtent(subext);
201 // setup extents for netcdf library to read the netcdf data file
202 size_t start[] = { static_cast<size_t>(subext[4] * this->Stride[2]),
203 static_cast<size_t>(subext[2] * this->Stride[1]),
204 static_cast<size_t>(subext[0] * this->Stride[0]) };
205
206 size_t count[] = { static_cast<size_t>(subext[5] - subext[4] + 1),
207 static_cast<size_t>(subext[3] - subext[2] + 1),
208 static_cast<size_t>(subext[1] - subext[0] + 1) };
209
210 ptrdiff_t rStride[3] = { (ptrdiff_t)this->Stride[2], (ptrdiff_t)this->Stride[1],
211 (ptrdiff_t)this->Stride[0] };
212
213 /*
214 vtkMultiThreaderIDType pid = vtkMultiThreader::GetCurrentThreadID();
215 //The getpid() and getppid() functions are always successful, and no
216 //return value is reserved to indicate an error. So is this check
217 //necessary?
218 if ((pid = vtkMultiThreader::GetCurrentThreadID()) == 0)
219 {
220 std::cerr<< "unable to get pid" << endl;
221 }
222 else
223 {
224 std::cerr << "The process id is " << pid << endl;
225 }
226
227 std::cerr << "subext " << subext[0] << " " << subext[1]
228 << " " << subext[2] << " " << subext[3] << " "
229 << subext[4] << " " << subext[5] << endl;
230 */
231 // initialize memory (raw data space, x y z axis space) and rectilinear grid
232 bool firstPass = true;
233 for (size_t i = 0; i < this->Internals->VariableMap.size(); i++)
234 {
235 if (this->Internals->VariableMap[i] != -1 &&

Callers

nothing calls this directly

Calls 15

nc_inq_varidFunction · 0.85
nc_inq_vardimidFunction · 0.85
nc_get_vara_floatFunction · 0.85
nc_get_vars_floatFunction · 0.85
GetInformationObjectMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
UpdateProgressMethod · 0.45
GetMethod · 0.45
SetExtentMethod · 0.45
sizeMethod · 0.45
GetArraySettingMethod · 0.45

Tested by

no test coverage detected