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

Method ComputeCellCentroid

Filters/AMR/vtkAMRResampleFilter.cxx:285–301  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

283
284//------------------------------------------------------------------------------
285void vtkAMRResampleFilter::ComputeCellCentroid(vtkUniformGrid* g, vtkIdType cellIdx, double c[3])
286{
287 assert("pre: uniform grid is nullptr" && (g != nullptr));
288 assert("pre: centroid is nullptr" && (c != nullptr));
289 assert("pre: cell index out-of-bounds" && (cellIdx >= 0) && (cellIdx < g->GetNumberOfCells()));
290
291 vtkCell* myCell = g->GetCell(cellIdx);
292 assert("post: cell is nullptr!" && (myCell != nullptr));
293
294 double pc[3]; // the parametric center
295 double* weights = new double[myCell->GetNumberOfPoints()];
296 assert("post: weights vector is nullptr" && (weights != nullptr));
297
298 int subId = myCell->GetParametricCenter(pc);
299 myCell->EvaluateLocation(subId, pc, c, weights);
300 delete[] weights;
301}
302
303//------------------------------------------------------------------------------
304void vtkAMRResampleFilter::TransferToCellCenters(vtkUniformGrid* g, vtkOverlappingAMR* amrds)

Callers 1

TransferToCellCentersMethod · 0.95

Calls 6

assertFunction · 0.50
GetNumberOfCellsMethod · 0.45
GetCellMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetParametricCenterMethod · 0.45
EvaluateLocationMethod · 0.45

Tested by

no test coverage detected