find_connected_pores#

Network.find_connected_pores(throats=[], flatten=False, mode='or')[source]#

Return a list of pores connected to the given list of throats

Parameters:
  • throats (array_like) – List of throats numbers

  • flatten (bool, optional) – If True (default) a 1D array of unique pore numbers is returned. If False each location in the the returned array contains a sub-arras of neighboring pores for each input throat, in the order they were sent.

  • mode (str) –

    Specifies logic to filter the resulting list. Options are:

    mode

    meaning

    ’or’

    All neighbors of the input pores. Also accepts ‘any’ and ‘union’.

    ’xor’

    Only neighbors of one and only one input pore. This is useful for counting the pores that are not shared by any of the input pores. Also accepts ‘exclusive_or’.

    ’xnor’

    Neighbors that are shared by two or more input pores. This is equivalent to counting all neighbors with ‘or’, minus those found with ‘xor’, and is useful for finding neighbors that the inputs have in common.

    ’and’

    Only neighbors shared by all input pores. Also accepts ‘intersection’ and ‘all’

Returns:

  • 1D array (if flatten is True) or ndarray of arrays (if

  • flatten is False)

Examples

>>> import openpnm as op
>>> pn = op.network.Cubic(shape=[5, 5, 5])
>>> Ps = pn.find_connected_pores(throats=[0, 1])
>>> print(Ps)
[[0 1]
 [1 2]]
>>> Ps = pn.find_connected_pores(throats=[0, 1], flatten=True)
>>> print(Ps)
[0 1 2]