------------------------------------------------------------------------------
| 206 | |
| 207 | //------------------------------------------------------------------------------ |
| 208 | int vtkHyperTreeGridPlaneCutter::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 209 | { |
| 210 | vtkPolyData* output = vtkPolyData::SafeDownCast(outputDO); |
| 211 | if (!output) |
| 212 | { |
| 213 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 214 | return 0; |
| 215 | } |
| 216 | |
| 217 | // This filter works only with 3D grids |
| 218 | if (input->GetDimension() != 3) |
| 219 | { |
| 220 | vtkErrorMacro(<< "Bad input dimension:" << input->GetDimension()); |
| 221 | return 0; |
| 222 | } |
| 223 | |
| 224 | // Reset Data |
| 225 | this->Reset(); |
| 226 | output->Initialize(); |
| 227 | |
| 228 | // Retrieve input point data |
| 229 | this->InData = input->GetCellData(); |
| 230 | |
| 231 | // Retrieve material mask |
| 232 | this->InMask = input->HasMask() ? input->GetMask() : nullptr; |
| 233 | |
| 234 | // Compute cut on dual or primal input depending on specification |
| 235 | if (this->Dual) |
| 236 | { |
| 237 | // Initialize output point data |
| 238 | this->OutData = output->GetPointData(); |
| 239 | this->OutData->CopyAllocate(this->InData); |
| 240 | |
| 241 | // Storage for leaf indices |
| 242 | if (this->Leaves == nullptr) |
| 243 | { |
| 244 | this->Leaves = vtkIdList::New(); |
| 245 | } |
| 246 | this->Leaves->SetNumberOfIds(8); |
| 247 | |
| 248 | // Initialize storage for dual geometry |
| 249 | if (this->Centers == nullptr) |
| 250 | { |
| 251 | this->Centers = vtkPoints::New(); |
| 252 | } |
| 253 | this->Centers->SetNumberOfPoints(8); |
| 254 | |
| 255 | // Convert plane parameters into normal/origin specification |
| 256 | unsigned int maxId = 0; |
| 257 | if (fabs(this->Plane[1]) > fabs(this->Plane[0])) |
| 258 | { |
| 259 | maxId = 1; |
| 260 | } |
| 261 | if (fabs(this->Plane[2]) > fabs(this->Plane[maxId])) |
| 262 | { |
| 263 | maxId = 2; |
| 264 | } |
| 265 | double origin[] = { 0., 0., 0. }; |
nothing calls this directly
no test coverage detected