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

Method SetComponentName

Common/Core/vtkAbstractArray.cxx:119–154  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

117
118//------------------------------------------------------------------------------
119void vtkAbstractArray::SetComponentName(vtkIdType component, const char* name)
120{
121 if (component < 0 || name == nullptr)
122 {
123 return;
124 }
125 unsigned int index = static_cast<unsigned int>(component);
126 if (this->ComponentNames == nullptr)
127 {
128 // delayed allocate
129 this->ComponentNames = new vtkAbstractArray::vtkInternalComponentNames();
130 }
131
132 if (index == this->ComponentNames->size())
133 {
134 // the array isn't large enough, so we will resize
135 this->ComponentNames->push_back(new std::string(name));
136 return;
137 }
138 else if (index > this->ComponentNames->size())
139 {
140 this->ComponentNames->resize(index + 1, nullptr);
141 }
142
143 // replace an existing element
144 std::string* compName = this->ComponentNames->at(index);
145 if (!compName)
146 {
147 compName = new std::string(name);
148 this->ComponentNames->at(index) = compName;
149 }
150 else
151 {
152 compName->assign(name);
153 }
154}
155
156//------------------------------------------------------------------------------
157const char* vtkAbstractArray::GetComponentName(vtkIdType component) const

Callers 15

CopyComponentNamesMethod · 0.95
CreateArrayMethod · 0.80
InitializeDataCommonFunction · 0.80
GetCGNSDataSetsMethod · 0.80
ReadColorElementMethod · 0.80
readBCDataMethod · 0.80
AllocateVtkArrayMethod · 0.80
ReadArrayMethod · 0.80
TestLegacyArrayMetaDataFunction · 0.80
RequestDataMethod · 0.80

Calls 5

sizeMethod · 0.45
push_backMethod · 0.45
resizeMethod · 0.45
atMethod · 0.45
assignMethod · 0.45

Tested by 6

InitializeDataCommonFunction · 0.64
TestLegacyArrayMetaDataFunction · 0.64
TestNamedComponentsFunction · 0.64