| 27 | } |
| 28 | |
| 29 | void AddModelToAssembly(vtkPartitionedDataSetCollection* out, vtkStatisticalModel* model, |
| 30 | vtkDataAssembly* assy, int rootAssyNode) |
| 31 | { |
| 32 | if (!model || model->IsEmpty()) |
| 33 | { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | // Iterate model tables, adding each to a new collection of \a out. |
| 38 | // Add hierarchy to \a rootAssyNode of \a assy. |
| 39 | unsigned int nextPartition = out->GetNumberOfPartitionedDataSets(); |
| 40 | for (int tt = 0; tt < vtkStatisticalModel::GetNumberOfTableTypes(); ++tt) |
| 41 | { |
| 42 | auto tableType = static_cast<vtkStatisticalModel::TableType>(tt); |
| 43 | int numTablesThisType = model->GetNumberOfTables(tt); |
| 44 | if (!numTablesThisType) |
| 45 | { |
| 46 | continue; // no tables to add |
| 47 | } |
| 48 | auto tableTypeName = validTableName(vtkStatisticalModel::GetTableTypeName(tableType)); |
| 49 | int typeNode = assy->AddNode(tableTypeName.c_str(), rootAssyNode); |
| 50 | for (int ii = 0; ii < numTablesThisType; ++ii) |
| 51 | { |
| 52 | unsigned int dsidx = nextPartition++; |
| 53 | auto rawTableName = model->GetTableName(tt, ii); |
| 54 | auto tableName = validTableName(rawTableName); |
| 55 | out->SetPartition(dsidx, 0, model->GetTable(tt, ii)); |
| 56 | out->GetMetaData(dsidx)->Set(vtkCompositeDataSet::NAME(), rawTableName.c_str()); |
| 57 | int node = assy->AddNode(tableName.c_str(), typeNode); |
| 58 | assy->AddDataSetIndex(node, dsidx); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | class ModelExtractor : public vtkDataAssemblyVisitor |
| 64 | { |
no test coverage detected