def surrounding_nodes(self, position):
        """ Returns nearest node indices and direction of opposite node.

        :param position: Position inside the mesh to search nearest node for as (x,y,z)
        :return: Nearest node indices and direction of opposite node.
        """

        n_node_index, n_node_position, n_node_error = self.nearest_node(position)

        if n_node_error == 0.0:

            index_mod = []

            for i in range(len(n_node_index)):

                new_point = np.asarray(n_node_position)
                new_point[i] += 1.e-5*np.abs(new_point[i])

                try:
                    self.nearest_node(tuple(new_point))
                    index_mod.append(-1)
                except ValueError:
                    index_mod.append(1)

        else:
            # Check if node_position is larger or smaller in resp. axes than position

            index_mod = []

            for i in range(len(n_node_index)):
                if n_node_position[i] > position[i]:
                    index_mod.append(-1)
                else:
                    index_mod.append(1)

        return tuple(n_node_index), tuple(index_mod)
def surrounding_nodes ( self , position ) : n_node_index , n_node_position , n_node_error = self . nearest_node ( position ) if n_node_error == 0.0 : index_mod = [ ] for i in range ( len ( n_node_index ) ) : new_point = np . asarray ( n_node_position ) new_point [ i ] += 1.e-5 * np . abs ( new_point [ i ] ) try : self . nearest_node ( tuple ( new_point ) ) index_mod . append ( - 1 ) except ValueError : index_mod . append ( 1 ) else : index_mod = [ ] for i in range ( len ( n_node_index ) ) : if n_node_position [ i ] > position [ i ] : index_mod . append ( - 1 ) else : index_mod . append ( 1 ) return tuple ( n_node_index ) , tuple ( index_mod )
Returns nearest node indices and direction of opposite node.

        :param position: Position inside the mesh to search nearest node for as (x,y,z)
        :return: Nearest node indices and direction of opposite node.