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

Method FillMetaData

IO/AMR/vtkAMREnzoReader.cxx:314–362  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

312
313//------------------------------------------------------------------------------
314int vtkAMREnzoReader::FillMetaData()
315{
316 assert("pre: Internal Enzo Reader is nullptr" && (this->Internal != nullptr));
317 assert("pre: metadata object is nullptr" && (this->Metadata != nullptr));
318 if (!this->IsReady)
319 {
320 return 0;
321 }
322
323 this->Internal->ReadMetaData();
324
325 double origin[3];
326 std::vector<unsigned int> blocksPerLevel;
327 this->ComputeStats(this->Internal, blocksPerLevel, origin);
328
329 this->Metadata->Initialize(blocksPerLevel);
330 this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XYZ_GRID);
331 this->Metadata->SetOrigin(origin);
332
333 std::vector<int> b2level(this->Internal->NumberOfLevels + 1, 0);
334 for (int block = 0; block < this->Internal->NumberOfBlocks; ++block)
335 {
336 vtkEnzoReaderBlock& theBlock = this->Internal->Blocks[block + 1];
337 int level = theBlock.Level;
338 int internalIdx = block;
339 int id = b2level[level];
340
341 // compute spacing
342 double spacing[3];
343 for (int d = 0; d < 3; ++d)
344 {
345 spacing[d] = (theBlock.BlockNodeDimensions[d] > 1)
346 ? (theBlock.MaxBounds[d] - theBlock.MinBounds[d]) / (theBlock.BlockNodeDimensions[d] - 1.0)
347 : 1.0;
348 }
349 // compute AMRBox
350 vtkAMRBox box(theBlock.MinBounds, theBlock.BlockNodeDimensions, spacing, origin,
351 vtkStructuredData::VTK_STRUCTURED_XYZ_GRID);
352
353 // set meta data
354 this->Metadata->SetSpacing(level, spacing);
355 this->Metadata->SetAMRBox(level, id, box);
356 this->Metadata->SetAMRBlockSourceIndex(level, id, internalIdx);
357 b2level[level]++;
358 }
359 this->Metadata->GenerateParentChildInformation();
360 this->Metadata->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(), this->Internal->DataTime);
361 return (1);
362}
363
364//------------------------------------------------------------------------------
365vtkUniformGrid* vtkAMREnzoReader::GetAMRGrid(int blockIdx)

Callers 1

RequestInformationMethod · 0.45

Calls 12

ComputeStatsMethod · 0.95
assertFunction · 0.50
ReadMetaDataMethod · 0.45
InitializeMethod · 0.45
SetGridDescriptionMethod · 0.45
SetOriginMethod · 0.45
SetSpacingMethod · 0.45
SetAMRBoxMethod · 0.45
SetMethod · 0.45
GetInformationMethod · 0.45

Tested by

no test coverage detected