find_connected_pores

Bravais.find_connected_pores(throats=[], flatten=False, mode='union')

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:

    ’or’ : (default) All neighbors of the input pores. This is also known as the ‘union’ in set theory or ‘any’ in boolean logic. Both keywords are accepted and treated as ‘or’. ‘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. This is known as ‘exclusive_or’ in set theory, and is an accepted input. ‘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. This is also known as ‘intersection’ in set theory and (somtimes) as ‘all’ in boolean logic. Both keywords are accepted and treated as ‘and’.

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]