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

Function count_per_block

Wrapping/Python/vtkmodules/numpy_interface/algorithms.py:370–396  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

368 return _global_per_block(SumPerBlockImpl(), array, axis, controller)
369
370def 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
398def mean_per_block(array, axis=None, controller=None):
399 """Returns the mean of all values along a particular axis (dimension)

Callers 1

mean_per_blockFunction · 0.85

Calls 2

_global_per_blockFunction · 0.85
CountPerBlockImplClass · 0.85

Tested by

no test coverage detected