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

Function ComputeCellCenter

Examples/AMR/Cxx/AMRCommon.h:126–139  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Computes the cell center for the cell corresponding to cellIdx w.r.t. the given grid. The cell center is stored in the supplied buffer c.

Source from the content-addressed store, hash-verified

124// Computes the cell center for the cell corresponding to cellIdx w.r.t.
125// the given grid. The cell center is stored in the supplied buffer c.
126void ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3])
127{
128 assert("pre: grid != NULL" && (grid != nullptr));
129 assert("pre: Null cell center buffer" && (c != nullptr));
130 assert("pre: cellIdx in bounds" && (cellIdx >= 0) && (cellIdx < grid->GetNumberOfCells()));
131
132 vtkCell* myCell = grid->GetCell(cellIdx);
133 assert("post: cell is NULL" && (myCell != nullptr));
134
135 double pCenter[3];
136 std::vector<double> weights(myCell->GetNumberOfPoints());
137 int subId = myCell->GetParametricCenter(pCenter);
138 myCell->EvaluateLocation(subId, pCenter, c, weights.data());
139}
140
141VTK_ABI_NAMESPACE_END
142} // END namespace

Callers 2

AttachPulseToGridFunction · 0.70
AttachPulseToGridFunction · 0.70

Calls 7

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

Tested by

no test coverage detected