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

Method ConsumeNextAlgorithmParameter

Filters/Statistics/vtkKMeansStatistics.cxx:88–137  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

86
87//------------------------------------------------------------------------------
88std::size_t vtkKMeansStatistics::ConsumeNextAlgorithmParameter(
89 vtkStringToken parameterName, const std::string& algorithmParameters)
90{
91 using namespace vtk::literals;
92 std::size_t consumed = 0;
93 switch (parameterName.GetHash())
94 {
95 case "default_number_of_clusters"_hash:
96 {
97 int value;
98 if ((consumed = this->ConsumeInt(algorithmParameters, value)))
99 {
100 this->SetDefaultNumberOfClusters(value);
101 }
102 }
103 break;
104 case "k_values_array_name"_hash:
105 {
106 std::string name;
107 if ((consumed = this->ConsumeString(algorithmParameters, name)))
108 {
109 this->SetKValuesArrayName(name.c_str());
110 }
111 }
112 break;
113 case "max_num_iterations"_hash:
114 {
115 int value;
116 if ((consumed = this->ConsumeInt(algorithmParameters, value)))
117 {
118 this->SetMaxNumIterations(value);
119 }
120 }
121 break;
122 case "tolerance"_hash:
123 {
124 double tolerance;
125 if ((consumed = this->ConsumeDouble(algorithmParameters, tolerance)))
126 {
127 this->SetTolerance(tolerance);
128 }
129 }
130 break;
131 default:
132 consumed =
133 this->Superclass::ConsumeNextAlgorithmParameter(parameterName, algorithmParameters);
134 break;
135 }
136 return consumed;
137}
138
139//------------------------------------------------------------------------------
140int vtkKMeansStatistics::InitializeDataAndClusterCenters(vtkTable* inParameters, vtkTable* inData,

Callers

nothing calls this directly

Calls 6

GetHashMethod · 0.80
ConsumeIntMethod · 0.80
ConsumeStringMethod · 0.80
ConsumeDoubleMethod · 0.80
c_strMethod · 0.45
SetToleranceMethod · 0.45

Tested by

no test coverage detected