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

Method BuildOutputGrid

IO/Geometry/vtkChacoReader.cxx:206–336  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

204
205//------------------------------------------------------------------------------
206int vtkChacoReader::BuildOutputGrid(vtkUnstructuredGrid* output)
207{
208 int i = 0;
209 if (this->OpenCurrentFile() != 1)
210 {
211 vtkWarningMacro(<< "Can't open file");
212 return 0;
213 }
214
215 int ncells = this->DataCache->GetNumberOfCells();
216 int haveVertexWeightArrays = 0;
217 int haveEdgeWeightArrays = 0;
218
219 if (ncells && (this->NumberOfVertexWeights > 0))
220 {
221 vtkDoubleArray* da = vtkArrayDownCast<vtkDoubleArray>(
222 this->DataCache->GetPointData()->GetArray(this->VarrayName[0].c_str()));
223
224 haveVertexWeightArrays = (da != nullptr);
225 }
226
227 if (ncells && (this->NumberOfEdgeWeights > 0))
228 {
229 vtkDoubleArray* da = vtkArrayDownCast<vtkDoubleArray>(
230 this->DataCache->GetCellData()->GetArray(this->EarrayName[0].c_str()));
231
232 haveEdgeWeightArrays = (da != nullptr);
233 }
234
235 if (!this->RemakeDataCacheFlag &&
236 ((!haveVertexWeightArrays && this->GenerateVertexWeightArrays) ||
237 (!haveEdgeWeightArrays && this->GenerateEdgeWeightArrays)))
238 {
239 this->RemakeDataCacheFlag = 1;
240 }
241
242 if (this->RemakeDataCacheFlag)
243 {
244 output->Initialize();
245 int rc = this->ReadFile(output);
246
247 if (rc == 0)
248 {
249 this->CloseCurrentFile();
250 return 0;
251 }
252
253 if (this->GenerateGlobalElementIdArray)
254 {
255 this->AddElementIds(output);
256 }
257
258 if (this->GenerateGlobalNodeIdArray)
259 {
260 this->AddNodeIds(output);
261 }
262
263 // Save the output. Next time we execute, it may be simply

Callers 2

RequestDataMethod · 0.95
RequestDataMethod · 0.80

Calls 15

OpenCurrentFileMethod · 0.95
ReadFileMethod · 0.95
CloseCurrentFileMethod · 0.95
AddElementIdsMethod · 0.95
AddNodeIdsMethod · 0.95
CheckAttributesMethod · 0.80
GetGlobalNodeIdArrayNameFunction · 0.70
GetNumberOfCellsMethod · 0.45
GetArrayMethod · 0.45
GetPointDataMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected