------------------------------------------------------------------------------
| 1292 | |
| 1293 | //------------------------------------------------------------------------------ |
| 1294 | bool 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 | //------------------------------------------------------------------------------ |
| 1338 | hsize_t vtkHDFWriter::Implementation::GetSubfileNumberOf(const std::string& base, |
no test coverage detected