- DelaunayVoronoiDual.find_neighbor_throats(pores, mode='union', flatten=True)¶
Returns a list of throats neighboring the given pore(s)
pores (array_like) – Indices of pores whose neighbors are sought
flatten (bool, optional) – If
True(default) a 1D array of unique throat indices is returned. If
Falsethe returned array contains arrays of neighboring throat indices for each input pore, 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’.
True, returns a 1D array of throat indices
filtered according to the specified mode. If
False, returns a list of lists, where each list contains the
neighbors of the corresponding input pores.
logicoptions are applied to neighboring bonds only, thus it is not possible to obtain bonds that are part of the global set but not neighbors. This is because (a) the list of global bonds might be very large, and (b) it is not possible to return a list of neighbors for each input site if global sites are considered.
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5]) >>> Ts = pn.find_neighbor_throats(pores=[0, 1]) >>> print(Ts) [ 0 1 100 101 200 201] >>> Ts = pn.find_neighbor_throats(pores=[0, 1], flatten=False) >>> print(Ts) [ 0 100 200] >>> print(Ts) [ 0 1 101 201]