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

Method SetFieldDataInfo

IO/XML/vtkXMLReader.cxx:1801–1905  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1799
1800//------------------------------------------------------------------------------
1801int vtkXMLReader::SetFieldDataInfo(
1802 vtkXMLDataElement* eDSA, int association, vtkIdType numTuples, vtkInformationVector*(&infoVector))
1803{
1804 if (!eDSA)
1805 {
1806 return 1;
1807 }
1808
1809 char* attributeName[vtkDataSetAttributes::NUM_ATTRIBUTES];
1810
1811 for (int i = 0; i < vtkDataSetAttributes::NUM_ATTRIBUTES; i++)
1812 {
1813 const char* attrName = vtkDataSetAttributes::GetAttributeTypeAsString(i);
1814 const char* name = eDSA->GetAttribute(attrName);
1815 if (name)
1816 {
1817 attributeName[i] = new char[strlen(name) + 1];
1818 strcpy(attributeName[i], name);
1819 }
1820 else
1821 {
1822 attributeName[i] = nullptr;
1823 }
1824 }
1825
1826 if (!infoVector)
1827 {
1828 infoVector = vtkInformationVector::New();
1829 }
1830
1831 vtkInformation* info = nullptr;
1832
1833 // Cycle through each data array
1834 for (int i = 0; i < eDSA->GetNumberOfNestedElements(); i++)
1835 {
1836 vtkXMLDataElement* eNested = eDSA->GetNestedElement(i);
1837 int components, dataType, activeFlag = 0;
1838
1839 info = vtkInformation::New();
1840 info->Set(vtkDataObject::FIELD_ASSOCIATION(), association);
1841 info->Set(vtkDataObject::FIELD_NUMBER_OF_TUPLES(), numTuples);
1842
1843 const char* name = eNested->GetAttribute("Name");
1844 if (!name)
1845 {
1846 this->InformationError = 1;
1847 break;
1848 }
1849 info->Set(vtkDataObject::FIELD_NAME(), name);
1850
1851 // Search for matching attribute name
1852 for (int j = 0; j < vtkDataSetAttributes::NUM_ATTRIBUTES; j++)
1853 {
1854 if (attributeName[j] && !strcmp(name, attributeName[j]))
1855 {
1856 // set appropriate bit to indicate an active attribute type
1857 activeFlag |= 1 << j;
1858 break;

Callers 4

Calls 10

GetLocalDataTypeMethod · 0.95
GetNestedElementMethod · 0.80
GetWordTypeAttributeMethod · 0.80
GetScalarAttributeMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetAttributeMethod · 0.45
SetMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected