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

Method GetScalarFieldCriticalIndex

Common/DataModel/vtkPolyData.cxx:1810–2025  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1808
1809//------------------------------------------------------------------------------
1810int vtkPolyData::GetScalarFieldCriticalIndex(vtkIdType pointId, vtkDataArray* scalarField)
1811{
1812 /*
1813 * implements scalar field critical point classification for manifold
1814 * 2D meshes.
1815 */
1816
1817 /*
1818 * returned value:
1819 * -4: no such field
1820 * -3: attribute check failed
1821 * -2: non 2-manifold star
1822 * -1: regular point
1823 * 0: minimum
1824 * 1: saddle
1825 * 2: maximum
1826 */
1827
1828 bool is_min = true, is_max = true;
1829 vtkIdList *starTriangleList = vtkIdList::New(), *lowerLinkPointList = vtkIdList::New(),
1830 *upperLinkPointList = vtkIdList::New(), *pointList = nullptr;
1831 double pointFieldValue = scalarField->GetComponent(pointId, 0);
1832
1833 if (this->GetNumberOfPoints() != scalarField->GetNumberOfTuples())
1834 {
1835 return vtkPolyData::ERR_INCORRECT_FIELD;
1836 }
1837
1838 /* make sure the connectivity is built */
1839 if (!this->Links)
1840 {
1841 this->BuildLinks();
1842 }
1843
1844 /* build the lower and upper links */
1845 this->GetPointCells(pointId, starTriangleList);
1846 int starNb = starTriangleList->GetNumberOfIds();
1847 for (int i = 0; i < starNb; i++)
1848 {
1849 vtkCell* c = this->GetCell(starTriangleList->GetId(i));
1850 pointList = c->GetPointIds();
1851 int pointNb = pointList->GetNumberOfIds();
1852 if (pointNb != 3)
1853 {
1854 starTriangleList->Delete();
1855 lowerLinkPointList->Delete();
1856 upperLinkPointList->Delete();
1857 return vtkPolyData::ERR_NON_MANIFOLD_STAR;
1858 }
1859
1860 for (int j = 0; j < pointNb; j++)
1861 {
1862 vtkIdType currentPointId = pointList->GetId(j);
1863
1864 /* quick check for extrema */
1865 double neighborFieldValue = scalarField->GetComponent(currentPointId, 0);
1866 if ((currentPointId != pointId) && (neighborFieldValue == pointFieldValue))
1867 {

Callers

nothing calls this directly

Calls 15

BuildLinksMethod · 0.95
GetPointCellsMethod · 0.95
GetCellMethod · 0.95
InsertUniqueIdMethod · 0.80
IsIdMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetComponentMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected