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

Method GenerateRepresentation

Common/DataModel/vtkStaticCellLocator.cxx:1555–1700  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Produce a polygonal representation of the locator. Each bin which contains a potential cell candidate contributes to the representation. Note that since the locator has only a single level, the level method parameter is ignored.

Source from the content-addressed store, hash-verified

1553// since the locator has only a single level, the level method parameter is
1554// ignored.
1555void vtkStaticCellLocator::GenerateRepresentation(int vtkNotUsed(level), vtkPolyData* pd)
1556{
1557 // Make sure locator has been built successfully
1558 this->BuildLocator();
1559 if (!this->Processor)
1560 {
1561 return;
1562 }
1563
1564 vtkNew<vtkPoints> pts;
1565 pts->SetDataTypeToFloat();
1566 vtkNew<vtkCellArray> polys;
1567 pd->SetPoints(pts);
1568 pd->SetPolys(polys);
1569
1570 int* dims = this->Divisions;
1571 int i, j, k;
1572 vtkIdType idx, kOffset, jOffset, kSlice = dims[0] * dims[1], pIds[8];
1573 double* s = this->H;
1574 double x[3], xT[3], origin[3];
1575 origin[0] = this->Bounds[0];
1576 origin[1] = this->Bounds[2];
1577 origin[2] = this->Bounds[4];
1578
1579 // A locator is used to avoid duplicate points
1580 vtkNew<vtkMergePoints> locator;
1581 locator->InitPointInsertion(pts, this->Bounds, dims[0] * dims[1] * dims[2]);
1582
1583 for (k = 0; k < dims[2]; k++)
1584 {
1585 x[2] = origin[2] + k * s[2];
1586 kOffset = k * kSlice;
1587 for (j = 0; j < dims[1]; j++)
1588 {
1589 x[1] = origin[1] + j * s[1];
1590 jOffset = j * dims[0];
1591 for (i = 0; i < dims[0]; i++)
1592 {
1593 x[0] = origin[0] + i * s[0];
1594 idx = i + jOffset + kOffset;
1595
1596 // Check to see if bin contains anything
1597 // If so, insert up to eight points and six quad faces (depending on
1598 // local topology).
1599 if (!this->Processor->IsEmpty(idx))
1600 {
1601 // Points in (i-j-k) order. A locator is used to avoid duplicate points.
1602 locator->InsertUniquePoint(x, pIds[0]);
1603 xT[0] = x[0] + s[0];
1604 xT[1] = x[1];
1605 xT[2] = x[2];
1606 locator->InsertUniquePoint(xT, pIds[1]);
1607 xT[0] = x[0];
1608 xT[1] = x[1] + s[1];
1609 xT[2] = x[2];
1610 locator->InsertUniquePoint(xT, pIds[2]);
1611 xT[0] = x[0] + s[0];
1612 xT[1] = x[1] + s[1];

Callers

nothing calls this directly

Calls 8

BuildLocatorMethod · 0.95
SetPolysMethod · 0.80
InsertCellPointMethod · 0.80
SetPointsMethod · 0.45
InitPointInsertionMethod · 0.45
IsEmptyMethod · 0.45
InsertUniquePointMethod · 0.45
InsertNextCellMethod · 0.45

Tested by

no test coverage detected