1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPMultiResolutionGenericIOReader.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPMultiResolutionGenericIOReader.h"
#include "vtkCallbackCommand.h"
#include "vtkCompositeDataPipeline.h"
#include "vtkDataArraySelection.h"
#include "vtkFileSeriesReader.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkPGenericIOMultiBlockReader.h"
#include "vtkSmartPointer.h"
#include "vtkStringArray.h"
#include "vtkUnstructuredGrid.h"
#include "vtk_jsoncpp.h"
#include <algorithm>
#include <cassert>
#include <map>
#include <set>
#include <string>
#include <sstream>
struct resolution_t
{
std::string FileName;
vtkSmartPointer< vtkFileSeriesReader > Reader;
};
class vtkPMultiResolutionGenericIOReader::vtkInternal
{
public:
std::vector< resolution_t > Resolutions;
int NumberOfBlocksPerLevel;
Json::Reader JsonReader;
void AddLevel(int level)
{
resolution_t newLevel;
newLevel.Reader = vtkSmartPointer< vtkFileSeriesReader >::New();
vtkNew< vtkPGenericIOMultiBlockReader > internalReader;
newLevel.Reader->SetReader(internalReader.GetPointer());
newLevel.Reader->SetFileNameMethod("SetFileName");
this->Resolutions.insert(this->Resolutions.begin() + level, newLevel);
}
#define JSON_READ_ERROR() std::cerr << "Error reading in JSON" << std::endl; \
return false
vtkPGenericIOMultiBlockReader* GetReaderForLevel(int level)
{
return vtkPGenericIOMultiBlockReader::SafeDownCast(
this->Resolutions[level].Reader->GetReader());
}
void Clear()
{
this->Resolutions.clear();
this->NumberOfBlocksPerLevel = -1;
}
bool ParseJson(const std::string& parentDir, std::istream& jsonIn)
{
Json::Value root;
if (!JsonReader.parse(jsonIn,root))
{
JSON_READ_ERROR();
}
if (!root.isMember("levels"))
{
JSON_READ_ERROR();
}
const Json::Value& levelsArray = root.get("levels",Json::Value::nullRef);
if (!levelsArray.isArray())
{
JSON_READ_ERROR();
}
for (Json::Value::ArrayIndex i = 0; i < levelsArray.size(); ++i)
{
const Json::Value& level = levelsArray[i];
if (!level.isMember("timesteps"))
{
JSON_READ_ERROR();
}
const Json::Value& timestepsArray = level.get("timesteps",Json::Value::nullRef);
if (!timestepsArray.isArray())
{
JSON_READ_ERROR();
}
this->AddLevel(i);
std::map< double, std::string > timeFiles;
for (Json::Value::ArrayIndex j = 0; j < timestepsArray.size(); ++j)
{
const Json::Value& timestep = timestepsArray[j];
if (!(timestep.isMember("time") && timestep.isMember("file")))
{
JSON_READ_ERROR();
}
const Json::Value& time = timestep.get("time",Json::Value::nullRef);
const Json::Value& file = timestep.get("file",Json::Value::nullRef);
if (!time.isNumeric())
{
JSON_READ_ERROR();
}
double t = time.asDouble();
std::string f = file.asString();
// allow paths relative to the config file
if (f[0] != '/')
{
f = parentDir + f;
}
timeFiles.insert(std::pair< double, std::string >(t,f));
}
for (std::map< double, std::string >::iterator itr = timeFiles.begin();
itr != timeFiles.end(); ++itr)
{
// vtkFileSeriesReader ignores time on inputs unless they already have
// a time range, but iteration over the map ensures they are in order...
// Eventually we may need to take into account the time in the JSON,
// which is why it is there.
this->Resolutions[i].Reader->AddFileName(itr->second.c_str());
}
}
return true;
}
};
vtkStandardNewMacro(vtkPMultiResolutionGenericIOReader);
//----------------------------------------------------------------------------
vtkPMultiResolutionGenericIOReader::vtkPMultiResolutionGenericIOReader()
{
this->Internal = new vtkInternal();
this->FileName = NULL;
this->Internal->NumberOfBlocksPerLevel = -1;
this->SetNumberOfInputPorts(0);
this->SetNumberOfOutputPorts(1);
this->XAxisVariableName = NULL;
this->YAxisVariableName = NULL;
this->ZAxisVariableName = NULL;
this->SetXAxisVariableName("x");
this->SetYAxisVariableName("y");
this->SetZAxisVariableName("z");
this->PointDataArraySelection = vtkDataArraySelection::New();
this->SelectionObserver = vtkCallbackCommand::New();
this->SelectionObserver->SetCallback(
&vtkPMultiResolutionGenericIOReader::SelectionModifiedCallback);
this->SelectionObserver->SetClientData(this);
this->PointDataArraySelection->AddObserver(
vtkCommand::ModifiedEvent,this->SelectionObserver);
}
//----------------------------------------------------------------------------
vtkPMultiResolutionGenericIOReader::~vtkPMultiResolutionGenericIOReader()
{
this->SetFileName(NULL);
delete this->Internal;
this->PointDataArraySelection->RemoveObserver(this->SelectionObserver);
this->SelectionObserver->Delete();
this->PointDataArraySelection->Delete();
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
bool vtkPMultiResolutionGenericIOReader::CanReadFile(const char* fName)
{
std::string filename(fName);
std::string::size_type it = filename.find_last_of(".");
std::string extension(filename, it+1, filename.length());
return extension == "gios";
}
//----------------------------------------------------------------------------
static inline bool SetStringProperty(char* & destStr, const char* newStr)
{
if (destStr == NULL && newStr == NULL) return false;
if (destStr && newStr && strcmp(destStr,newStr) == 0) return false;
delete [] destStr;
if (newStr)
{
size_t n = strlen(newStr) +1;
char* cp1 = new char[n];
const char* cp2 = newStr;
destStr = cp1;
do { *cp1++ = *cp2++; } while (--n);
}
else
{
destStr = NULL;
}
return true;
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SetFileName(const char* fname)
{
this->Internal->Clear();
if (!SetStringProperty(this->FileName,fname)) return;
if (fname)
{
std::ifstream fis(this->FileName);
std::string filename(this->FileName);
std::string::size_type idx = filename.find_last_of("/");
std::string parentDir(filename,0,idx+1);
if (!this->Internal->ParseJson(parentDir,fis))
{
// clear any partially read data if reading failed for some reason
this->Internal->Resolutions.clear();
}
else
{
// sync selected data arrays
this->PointDataArraySelection->CopySelections(
this->Internal->GetReaderForLevel(0)->GetPointDataArraySelection());
// sync x,y,z axes
for (int i = 0; i < this->GetNumberOfLevels(); ++i)
{
vtkPGenericIOMultiBlockReader* r = this->Internal->GetReaderForLevel(i);
r->SetXAxisVariableName(this->XAxisVariableName);
r->SetYAxisVariableName(this->YAxisVariableName);
r->SetZAxisVariableName(this->ZAxisVariableName);
}
}
}
this->Modified();
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SetXAxisVariableName(const char* arg)
{
if (SetStringProperty(this->XAxisVariableName,arg))
{
this->Modified();
for (unsigned i = 0; i < this->Internal->Resolutions.size(); ++i)
{
this->Internal->GetReaderForLevel(i)->SetXAxisVariableName(arg);
}
}
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SetYAxisVariableName(const char* arg)
{
if (SetStringProperty(this->YAxisVariableName,arg))
{
this->Modified();
for (unsigned i = 0; i < this->Internal->Resolutions.size(); ++i)
{
this->Internal->GetReaderForLevel(i)->SetYAxisVariableName(arg);
}
}
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SetZAxisVariableName(const char* arg)
{
if (SetStringProperty(this->ZAxisVariableName,arg))
{
this->Modified();
for (unsigned i = 0; i < this->Internal->Resolutions.size(); ++i)
{
this->Internal->GetReaderForLevel(i)->SetZAxisVariableName(arg);
}
}
}
//----------------------------------------------------------------------------
vtkStringArray* vtkPMultiResolutionGenericIOReader::GetArrayList()
{
if (this->GetNumberOfLevels() > 0)
{
return this->Internal->GetReaderForLevel(0)->GetArrayList();
}
else
{
return NULL;
}
}
//----------------------------------------------------------------------------
bool vtkPMultiResolutionGenericIOReader::InsertLevel(const char* fileName, int level)
{
if (fileName == NULL)
{
return false;
}
assert(this->Internal != NULL);
if (level < 0 || static_cast<unsigned>(level) > this->Internal->Resolutions.size())
{
vtkErrorMacro(<< "Level is out of range.");
return false;
}
//this->Internal->AddLevel(level,fileName);
if (this->GetNumberOfLevels() != 0)
{
this->Internal->GetReaderForLevel(level)->GetPointDataArraySelection()
->CopySelections(this->PointDataArraySelection);
}
else
{
this->PointDataArraySelection->CopySelections(
this->Internal->GetReaderForLevel(level)->GetPointDataArraySelection());
}
this->Modified();
return true;
}
//----------------------------------------------------------------------------
int vtkPMultiResolutionGenericIOReader::GetNumberOfLevels() const
{
assert(this->Internal != NULL);
return this->Internal->Resolutions.size();
}
//----------------------------------------------------------------------------
const char* vtkPMultiResolutionGenericIOReader::GetFileNameForLevel(int level) const
{
assert(this->Internal != NULL);
if (level < 0 || static_cast<unsigned>(level) >= this->Internal->Resolutions.size())
{
return (const char*) NULL;
}
return this->Internal->Resolutions[level].FileName.c_str();
}
//----------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::RemoveAllLevels()
{
this->Internal->Resolutions.clear();
this->Modified();
}
//------------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SelectionModifiedCallback(
vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(eid), void* clientdata, void* vtkNotUsed(calldata))
{
assert(clientdata != NULL);
vtkPMultiResolutionGenericIOReader* reader =
static_cast<vtkPMultiResolutionGenericIOReader*>(clientdata);
for (int i = 0; i < reader->GetNumberOfLevels(); ++i)
{
reader->Internal->GetReaderForLevel(i)->GetPointDataArraySelection()
->CopySelections(reader->PointDataArraySelection);
}
reader->Modified();
}
//------------------------------------------------------------------------------
int vtkPMultiResolutionGenericIOReader::GetNumberOfPointArrays()
{
return this->PointDataArraySelection->GetNumberOfArrays();
}
//------------------------------------------------------------------------------
const char* vtkPMultiResolutionGenericIOReader::GetPointArrayName(int i)
{
assert("pre: array index is out-of-bounds!" &&
(i >= 0) && (i < this->GetNumberOfPointArrays()));
return this->PointDataArraySelection->GetArrayName(i);
}
//------------------------------------------------------------------------------
int vtkPMultiResolutionGenericIOReader::GetPointArrayStatus(const char* name)
{
assert(this->PointDataArraySelection->ArrayExists(name));
return this->PointDataArraySelection->ArrayIsEnabled(name);
}
//------------------------------------------------------------------------------
void vtkPMultiResolutionGenericIOReader::SetPointArrayStatus(
const char* name, int status)
{
if (!this->PointDataArraySelection->ArrayExists(name))
{
assert(this->Internal->Resolutions.size() > 1);
this->PointDataArraySelection->CopySelections(
this->Internal->GetReaderForLevel(0)->GetPointDataArraySelection());
vtkPMultiResolutionGenericIOReader::SelectionModifiedCallback(NULL,0l,(void*)this,NULL);
assert(this->PointDataArraySelection->ArrayExists(name));
}
if (status)
{
this->PointDataArraySelection->EnableArray(name);
}
else
{
this->PointDataArraySelection->DisableArray(name);
}
for (int i = 0; i < this->GetNumberOfLevels(); ++i)
{
if (this->Internal->GetReaderForLevel(i)->GetArrayList()->LookupValue(name) >=0)
{
this->Internal->GetReaderForLevel(i)->SetPointArrayStatus(name,status);
}
}
}
void printBoundsOfBlockInfo(vtkMultiBlockDataSet* ds,int offset)
{
for (unsigned i = 0; i < ds->GetNumberOfBlocks(); ++i)
{
vtkInformation* info = ds->GetMetaData(i);
std::cerr << "Bounds for block " << (i + offset) << ": ";
if (info->Has(vtkCompositeDataPipeline::BOUNDS()))
{
double bb[6];
info->Get(vtkCompositeDataPipeline::BOUNDS(),bb);
std::cerr << "[ ";
for (int j = 0; j < 6; ++j)
{
std::cerr << bb[j] << ", ";
}
std::cerr << "]" << std::endl;
}
}
}
//----------------------------------------------------------------------------
int vtkPMultiResolutionGenericIOReader::RequestInformation(vtkInformation *request,
vtkInformationVector** inputVector, vtkInformationVector* outputVector)
{
// call the superclass's method
this->Superclass::RequestInformation(request,inputVector,outputVector);
// get the output info object
vtkInformation* outInfo = outputVector->GetInformationObject(0);
assert(outInfo != NULL);
// this filter does handle streaming pieces of the dataset
outInfo->Set(CAN_HANDLE_PIECE_REQUEST(),1);
// create a dummy dataset that will have the right structure
vtkSmartPointer< vtkMultiBlockDataSet > infoSet =
vtkSmartPointer< vtkMultiBlockDataSet >::New();
infoSet->SetNumberOfBlocks(this->GetNumberOfLevels());
this->Internal->NumberOfBlocksPerLevel = -1;
// request the information from each internal reader and put them
// into the information object for this reader as blocks
for (unsigned i = 0; i < this->Internal->Resolutions.size(); ++i)
{
vtkMultiBlockDataSet* dataSet;
this->Internal->Resolutions[i].Reader->ProcessRequest(
request,inputVector,outputVector);
if (i == 0)
{
this->PointDataArraySelection->CopySelections(
this->Internal->GetReaderForLevel(0)->GetPointDataArraySelection());
}
dataSet = vtkMultiBlockDataSet::SafeDownCast(
outInfo->Get(
vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA()));
// also make sure that they have the same number of blocks
// (important for this kind of data)
if (this->Internal->NumberOfBlocksPerLevel == -1)
{
this->Internal->NumberOfBlocksPerLevel =
dataSet->GetNumberOfBlocks();
}
else if ((unsigned)(this->Internal->NumberOfBlocksPerLevel) !=
dataSet->GetNumberOfBlocks())
{
vtkErrorMacro(<< "Wrong number of blocks in level " << i);
return 0;
}
// printBoundsOfBlockInfo(dataSet,i * this->Internal->NumberOfBlocksPerLevel);
infoSet->SetBlock(i,dataSet);
outInfo->Remove(
vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA());
}
// We assume all datasets have blocks with the same bounds. The rest of the pipeline
// does not know this, so this loop first finds which resolution has bounds and copies
// those bounds to all the other resolutions for each block
for (int i = 0; i < this->Internal->NumberOfBlocksPerLevel; ++i) // for each block
{
double bounds[6] = {0,0,0,0,0,0};
// find the resolution with nonzero bounds (zero is default from GenericIO reader
for (unsigned j = 0; j < this->Internal->Resolutions.size(); ++j)
{
if (bounds[0] == 0 && bounds[1] == 0)
{
static_cast<vtkMultiBlockDataSet*>(
infoSet->GetBlock(j))
->GetMetaData(i)->Get(vtkStreamingDemandDrivenPipeline::BOUNDS(),bounds);
}
}
// copy bounds to all resolutions
for (unsigned j = 0; j < this->Internal->Resolutions.size(); ++j)
{
static_cast<vtkMultiBlockDataSet*>(
infoSet->GetBlock(j))
->GetMetaData(i)->Set(vtkStreamingDemandDrivenPipeline::BOUNDS(),bounds,6);
}
}
std::cerr.flush();
// return the computed object as the composite data metadata
outInfo->Set(vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA(),
infoSet.GetPointer());
return 1;
}
//----------------------------------------------------------------------------
// This function is a binary search that returns the index of where the item
// should be inserted if it is not already present. More precisely, it
// returns the minimum index i such that vec[i] <= value && value < vec[i+1].
// If the item is greater than every item in the array, it returns the size of
// the array and if the item is less than every item in the array it returns 0.
// NOTE: as per binary search, vec should be a sorted array of ints
int binSearch(int* vec,int size, int value)
{
// handle boundary conditions
if (vec[0] > value)
{
return 0;
}
if (vec[size-1] < value)
{
return size;
}
// loop invariants:
// vec[min] is always <= value
// vec[max] is alwasy > value
int min = 0, max = size;
while (min < max -1)
{
int mid = (min+max)/2;
if (vec[mid] <= value)
{
min = mid;
}
else
{
max = mid;
}
}
return min;
}
int vtkPMultiResolutionGenericIOReader::RequestUpdateExtent(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
// The vtkFileSeriesReader needs this to be called to update its timestep
for (unsigned i = 0; i < this->Internal->Resolutions.size(); ++i)
{
this->Internal->Resolutions[i].Reader->ProcessRequest(request,inputVector,outputVector);
this->Internal->GetReaderForLevel(i)->GetPointDataArraySelection()
->CopySelections(this->PointDataArraySelection);
}
return 1;
}
//----------------------------------------------------------------------------
int vtkPMultiResolutionGenericIOReader::RequestData(vtkInformation *request,
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector)
{
// Get the output dataset
vtkInformation* outInfo = outputVector->GetInformationObject(0);
assert(outInfo != NULL);
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::GetData(outputVector,0);
assert(output != NULL);
// set the number of blocks
output->SetNumberOfBlocks(this->GetNumberOfLevels());
int size;
std::vector<int> idVector;
// find out which parts of the dataset we need to load
if (outInfo->Has(vtkCompositeDataPipeline::LOAD_REQUESTED_BLOCKS()))
{
int* ids;
size = outInfo->Length(vtkCompositeDataPipeline::UPDATE_COMPOSITE_INDICES());
ids = outInfo->Get(vtkCompositeDataPipeline::UPDATE_COMPOSITE_INDICES());
idVector.resize(size);
std::copy(ids,ids+size,idVector.begin());
}
// default to loading all of the lowest level of detail
else
{
for (int j = 0; j < this->Internal->NumberOfBlocksPerLevel; ++j)
{
idVector.push_back(j);
}
size = idVector.size();
}
// sort the requested blocks
std::sort(idVector.begin(),idVector.end());
// compute the block ids relative to the file (the internal reader needs these)
std::vector<int> localIdVector;
for (unsigned i = 0; i < idVector.size(); ++i)
{
localIdVector.push_back(idVector[i] % this->Internal->NumberOfBlocksPerLevel);
}
// these mark the beginning and end of the local ids for the internal reader
// for the current itertion of the loop
int lBound = 0, uBound;
for (int i = 0; i < this->GetNumberOfLevels(); ++i)
{
// compute new bounds for current reader's blocks
uBound = binSearch(&idVector[0],idVector.size(),this->Internal->NumberOfBlocksPerLevel*(i+1));
int levelSize = uBound - lBound;
vtkNew< vtkMultiBlockDataSet > dataset;
if (levelSize > 0)
{
// create a new request
vtkNew< vtkInformation > internalRequestData;
internalRequestData->Set(vtkDemandDrivenPipeline::REQUEST_DATA());
internalRequestData->Copy(request);
// create a new output info
vtkNew< vtkInformation > internalOutInfo;
internalOutInfo->CopyEntry(outInfo,vtkStreamingDemandDrivenPipeline::TIME_STEPS());
internalOutInfo->CopyEntry(outInfo,vtkStreamingDemandDrivenPipeline::TIME_RANGE());
internalOutInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(),
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()));
internalOutInfo->Set(vtkDataObject::DATA_OBJECT(),dataset.GetPointer());
internalOutInfo->Set(vtkCompositeDataPipeline::UPDATE_COMPOSITE_INDICES(),
&localIdVector[lBound],levelSize);
internalOutInfo->Set(vtkCompositeDataPipeline::LOAD_REQUESTED_BLOCKS(),1);
// put the output info in a vector
vtkNew< vtkInformationVector > internalOutVector;
internalOutVector->Append(internalOutInfo.GetPointer());
// ask the internal reader for its data
this->Internal->Resolutions[i].Reader->ProcessRequest(
internalRequestData.GetPointer(),(vtkInformationVector**)NULL,
internalOutVector.GetPointer());
// set the block in our output to the output of the internal reader
}
else
{
dataset->SetNumberOfBlocks(this->Internal->NumberOfBlocksPerLevel);
}
output->SetBlock(i,dataset.GetPointer());
// the next reader's blocks will start where this one's blocks ended
lBound = uBound;
if (i == 0)
{
output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),
dataset->GetInformation()->Get(vtkDataObject::DATA_TIME_STEP()));
}
}
return 1;
}
|