MCPcopy Create free account
hub / github.com/Kitware/ParaView / CopyFromArrayInternal

Method CopyFromArrayInternal

Remoting/Core/vtkPVArrayInformation.cxx:288–354  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

286
287//----------------------------------------------------------------------------
288void vtkPVArrayInformation::CopyFromArrayInternal(
289 vtkAbstractArray* array, GetRangeFunctor& getRangeFn)
290{
291 assert(array != nullptr);
292 this->Name = array->GetName() ? array->GetName() : "";
293 this->DataType = array->GetDataType();
294 this->NumberOfTuples = array->GetNumberOfTuples();
295
296 const int numComponents = array->GetNumberOfComponents();
297 this->Components.resize(numComponents + 1); // extra 1 for magnitude.
298
299 // set default names.
300 for (int comp = -1; comp < numComponents; ++comp)
301 {
302 auto& compInfo = this->Components.at(comp + 1);
303 compInfo.DefaultName = vtkPVPostFilter::DefaultComponentName(comp, numComponents);
304 }
305
306 // set custom component names, if non-null.
307 if (array->HasAComponentName())
308 {
309 for (int comp = 0; comp < numComponents; ++comp)
310 {
311 auto& compInfo = this->Components.at(comp + 1);
312 if (auto name = array->GetComponentName(comp))
313 {
314 compInfo.Name = name;
315 }
316 }
317 }
318
319 auto dataArray = vtkDataArray::SafeDownCast(array);
320 if (dataArray && dataArray->IsNumeric())
321 {
322 for (int comp = -1; comp < numComponents; ++comp)
323 {
324 auto& compInfo = this->Components.at(comp + 1);
325 getRangeFn(dataArray, comp, compInfo);
326 }
327 }
328 else if (auto sarray = vtkStringArray::SafeDownCast(array))
329 {
330 for (vtkIdType cc = 0;
331 this->StringValues.size() < MAX_STRING_VALUES && cc < sarray->GetNumberOfValues(); ++cc)
332 {
333 auto value = sarray->GetValue(cc);
334 if (!value.empty())
335 {
336 this->StringValues.push_back(value);
337 }
338 }
339 }
340
341 if (array->HasInformation())
342 {
343 vtkInformation* info = array->GetInformation();
344 vtkInformationIterator* it = vtkInformationIterator::New();
345 it->SetInformationWeak(info);

Callers 1

CopyFromArrayMethod · 0.95

Calls 15

GetComponentNameMethod · 0.80
GetNumberOfValuesMethod · 0.80
push_backMethod · 0.80
GetInformationMethod · 0.80
GetLocationMethod · 0.80
NewFunction · 0.50
GetNameMethod · 0.45
GetNumberOfComponentsMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
GetValueMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected