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

Function AddModelToAssembly

Filters/Statistics/vtkExtractStatisticalModelTables.cxx:29–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void 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
63class ModelExtractor : public vtkDataAssemblyVisitor
64{

Callers 2

VisitMethod · 0.85
RequestDataMethod · 0.85

Calls 13

GetNumberOfTableTypesFunction · 0.85
validTableNameFunction · 0.85
GetTableNameMethod · 0.80
AddDataSetIndexMethod · 0.80
IsEmptyMethod · 0.45
GetNumberOfTablesMethod · 0.45
AddNodeMethod · 0.45
c_strMethod · 0.45
SetPartitionMethod · 0.45
GetTableMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected