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

Method FillMetaData

IO/AMR/vtkAMRFlashReader.cxx:157–207  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

155
156//------------------------------------------------------------------------------
157int vtkAMRFlashReader::FillMetaData()
158{
159 assert("pre: Internal Flash Reader is nullptr" && (this->Internal != nullptr));
160 assert("pre: metadata object is nullptr" && (this->Metadata != nullptr));
161
162 this->Internal->ReadMetaData();
163
164 double origin[3];
165 std::vector<unsigned int> blocksPerLevel;
166 this->ComputeStats(this->Internal, blocksPerLevel, origin);
167
168 this->Metadata->Initialize(blocksPerLevel);
169 this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XYZ_GRID);
170 this->Metadata->SetOrigin(origin);
171
172 std::vector<int> b2level;
173 b2level.resize(this->Internal->NumberOfLevels + 1, 0);
174
175 for (int i = 0; i < this->Internal->NumberOfBlocks; ++i)
176 {
177 FlashReaderBlock& theBlock = this->Internal->Blocks[i];
178
179 // Start numbering levels from 0!
180 int level = this->Internal->Blocks[i].Level - 1;
181 int id = b2level[level];
182 int internalIdx = i;
183 int* dims = this->Internal->BlockGridDimensions;
184
185 // compute spacing
186 double spacing[3];
187 for (int d = 0; d < 3; ++d)
188 {
189 spacing[d] =
190 (dims[d] > 1) ? (theBlock.MaxBounds[d] - theBlock.MinBounds[d]) / (dims[d] - 1.0) : 1.0;
191 }
192
193 // compute AMRBox
194 vtkAMRBox box(
195 theBlock.MinBounds, dims, spacing, origin, vtkStructuredData::VTK_STRUCTURED_XYZ_GRID);
196
197 this->Metadata->SetSpacing(level, spacing);
198 this->Metadata->SetAMRBox(level, id, box);
199 this->Metadata->SetAMRBlockSourceIndex(level, id, internalIdx);
200
201 b2level[level]++;
202 } // END for all blocks
203
204 this->SetMaxLevel(this->Internal->NumberOfLevels);
205
206 return (1);
207}
208
209//------------------------------------------------------------------------------
210vtkUniformGrid* vtkAMRFlashReader::GetAMRGrid(int blockIdx)

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected