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

Method FillMetaData

IO/AMR/vtkAMReXGridReader.cxx:108–193  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

106
107//------------------------------------------------------------------------------
108int vtkAMReXGridReader::FillMetaData()
109{
110 this->ReadMetaData();
111 if (!this->Internal->headersAreRead)
112 {
113 // Error: failed to read header files
114 return (-1);
115 }
116
117 this->SetUpDataArraySelections();
118
119 int dimension = this->GetDimension();
120 int numberOfLevels = this->GetNumberOfLevels() + 1;
121 std::vector<unsigned int> numberOfBlocks(numberOfLevels);
122 for (int i = 0; i < numberOfLevels; ++i)
123 {
124 numberOfBlocks[i] = this->Internal->Header->levelSize[i];
125 }
126 this->Metadata->Initialize(numberOfBlocks);
127 // The AMRBox always has 3 dimensions
128 double origin[3] = { 0.0, 0.0, 0.0 };
129 double spacing[3] = { 0.0, 0.0, 0.0 };
130 double blockOrigin[3] = { 0.0, 0.0, 0.0 };
131 int blockDimension[3] = { 1, 1, 1 };
132 for (int i = 0; i < dimension; ++i)
133 {
134 origin[i] = this->Internal->Header->problemDomainLoEnd[i];
135 }
136 this->Metadata->SetOrigin(origin);
137 if (dimension == 3)
138 this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XYZ_GRID);
139 if (dimension == 2)
140 this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XY_PLANE);
141 int boxLo;
142 int boxHi;
143 long globalID = 0;
144 for (int i = 0; i < numberOfLevels; ++i)
145 {
146 for (int cc = 0; cc < dimension; ++cc)
147 {
148 spacing[cc] = this->Internal->Header->cellSize[i][cc];
149 }
150 if (dimension == 2)
151 spacing[2] = spacing[1]; // Add spacing for the 3rd dimension
152 this->Metadata->SetSpacing(i, spacing);
153 if (i == numberOfLevels - 1)
154 {
155 this->Metadata->SetRefinementRatio(i, 1);
156 }
157 else
158 {
159 this->Metadata->SetRefinementRatio(i, this->Internal->Header->refinementRatio[i]);
160 }
161 for (int j = 0; j < this->Internal->LevelHeader[i]->levelBoxArraySize; ++j)
162 {
163 for (int k = 0; k < dimension; ++k)
164 {
165 boxLo = this->Internal->LevelHeader[i]->levelBoxArrays[j][0][k];

Callers

nothing calls this directly

Calls 13

ReadMetaDataMethod · 0.95
GetDimensionMethod · 0.95
GetNumberOfLevelsMethod · 0.95
InitializeMethod · 0.45
SetOriginMethod · 0.45
SetGridDescriptionMethod · 0.45
SetSpacingMethod · 0.45
SetRefinementRatioMethod · 0.45
SetAMRBoxMethod · 0.45
GetInformationMethod · 0.45

Tested by

no test coverage detected