------------------------------------------------------------------------------ Description: Return -1 if the dataset is explicitly defined by cells of several dimensions or if there is no cell. If the dataset is explicitly defined by cells of a unique dimension, return this dimension. \post valid_range: (result>=-1) && (result<=3)
| 249 | // cells of a unique dimension, return this dimension. |
| 250 | // \post valid_range: (result>=-1) && (result<=3) |
| 251 | int vtkBridgeDataSet::GetCellDimension() |
| 252 | { |
| 253 | int result = 0; |
| 254 | int accu = 0; |
| 255 | |
| 256 | this->ComputeNumberOfCellsAndTypes(); |
| 257 | |
| 258 | if (this->NumberOf0DCells != 0) |
| 259 | { |
| 260 | accu++; |
| 261 | result = 0; |
| 262 | } |
| 263 | if (this->NumberOf1DCells != 0) |
| 264 | { |
| 265 | accu++; |
| 266 | result = 1; |
| 267 | } |
| 268 | if (this->NumberOf2DCells != 0) |
| 269 | { |
| 270 | accu++; |
| 271 | result = 2; |
| 272 | } |
| 273 | if (this->NumberOf3DCells != 0) |
| 274 | { |
| 275 | accu++; |
| 276 | result = 3; |
| 277 | } |
| 278 | if (accu != 1) // no cells at all or several dimensions |
| 279 | { |
| 280 | result = -1; |
| 281 | } |
| 282 | assert("post: valid_range" && (result >= -1) && (result <= 3)); |
| 283 | return result; |
| 284 | } |
| 285 | |
| 286 | //------------------------------------------------------------------------------ |
| 287 | // Description: |
no test coverage detected