------------------------------------------------------------------------------ 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.
| 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. |
| 126 | void 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 | |
| 141 | VTK_ABI_NAMESPACE_END |
| 142 | } // END namespace |
no test coverage detected