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

Method WriteSumStepsPolyData

IO/HDF/vtkHDFWriterImplementation.cxx:1294–1335  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1292
1293//------------------------------------------------------------------------------
1294bool vtkHDFWriter::Implementation::WriteSumStepsPolyData(hid_t group, const char* name)
1295{
1296 vtkDebugWithObjectMacro(
1297 this->Writer, "Creating polydata steps sum " << name << " in " << this->GetGroupName(group));
1298
1299 vtkHDF::ScopedH5DHandle dataset = this->OpenDataset(group, name);
1300 if (dataset == H5I_INVALID_HID)
1301 {
1302 return false;
1303 }
1304
1305 // Create VTK Array of size nbPrimitives * nbTimeSteps
1306 vtkNew<vtkIdTypeArray> totalsArray;
1307 totalsArray->SetNumberOfComponents(static_cast<int>(this->PrimitiveNames.size()));
1308 totalsArray->SetNumberOfTuples(this->Writer->NumberOfTimeSteps);
1309
1310 // For each timestep, sum each primitive from all pieces
1311 for (int step = 0; step < this->Writer->NumberOfTimeSteps; step++)
1312 {
1313 totalsArray->SetTuple4(step, 0, 0, 0, 0);
1314 vtkDebugWithObjectMacro(this->Writer, "timestep " << step);
1315 for (int prim = 0; prim < static_cast<int>(this->PrimitiveNames.size()); prim++)
1316 {
1317 vtkDebugWithObjectMacro(this->Writer, "primitive " << prim);
1318 // Collect size for the current time step in each subfile for each primitive
1319 for (std::size_t part = 0; part < this->Subfiles.size(); part++)
1320 {
1321 auto current = totalsArray->GetComponent(step, prim);
1322 vtkDebugWithObjectMacro(this->Writer, "part " << part << " value " << current);
1323 totalsArray->SetComponent(step, prim,
1324 current + this->GetSubfileNumberOf(this->GetGroupName(group), name, part, step, prim));
1325 }
1326 }
1327 }
1328
1329 if (!this->AddArrayToDataset(dataset, totalsArray))
1330 {
1331 return false;
1332 }
1333
1334 return true;
1335}
1336
1337//------------------------------------------------------------------------------
1338hsize_t vtkHDFWriter::Implementation::GetSubfileNumberOf(const std::string& base,

Callers 1

UpdateStepsGroupMethod · 0.80

Calls 10

GetGroupNameMethod · 0.95
OpenDatasetMethod · 0.95
GetSubfileNumberOfMethod · 0.95
AddArrayToDatasetMethod · 0.95
SetTuple4Method · 0.80
SetNumberOfComponentsMethod · 0.45
sizeMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetComponentMethod · 0.45
SetComponentMethod · 0.45

Tested by

no test coverage detected