Return the number of elements of each block in a VTKCompositeDataArray along an axis. - if axis is None, the number of all elements (ntuples * ncomponents) is returned. - if axis is 0, the number of tuples is returned.
(array, axis=None, controller=None)
| 368 | return _global_per_block(SumPerBlockImpl(), array, axis, controller) |
| 369 | |
| 370 | def count_per_block(array, axis=None, controller=None): |
| 371 | """Return the number of elements of each block in a VTKCompositeDataArray |
| 372 | along an axis. |
| 373 | |
| 374 | - if axis is None, the number of all elements (ntuples * ncomponents) is |
| 375 | returned. |
| 376 | - if axis is 0, the number of tuples is returned. |
| 377 | """ |
| 378 | |
| 379 | if axis is not None and axis > 0: |
| 380 | raise ValueError("Only axis=None and axis=0 are supported for count") |
| 381 | |
| 382 | class CountPerBlockImpl: |
| 383 | def op(self): |
| 384 | return array_count |
| 385 | |
| 386 | def op2(self): |
| 387 | return _local_array_count |
| 388 | |
| 389 | def mpi_op(self): |
| 390 | from mpi4py import MPI |
| 391 | return MPI.SUM |
| 392 | |
| 393 | def default(self): |
| 394 | return numpy.float64(0) |
| 395 | |
| 396 | return _global_per_block(CountPerBlockImpl(), array, axis, controller) |
| 397 | |
| 398 | def mean_per_block(array, axis=None, controller=None): |
| 399 | """Returns the mean of all values along a particular axis (dimension) |
no test coverage detected