Connectivity

plot3d.connectivity.combinations_of_nearest_blocks(blocks: List[Block], nearest_nblocks: int = 4)[source]

Returns the indices of the nearest 6 blocks based on their centroid

Parameters:
  • block (Block) – block you are interested in

  • blocks (List[Block]) – list of all your blocks

Returns:

combinations of nearest blocks

Return type:

List[Tuple[int,int]]

plot3d.connectivity.connectivity(blocks: List[Block])[source]

Returns a dictionary outlining the connectivity of the blocks along with any exterior surfaces

Parameters:

blocks (List[Block]) – List of all blocks in multi-block plot3d mesh

Returns:

All matching faces formatted as a list of { ‘block1’: {‘block_index’, ‘IMIN’, ‘JMIN’,’KMIN’, ‘IMAX’,’JMAX’,’KMAX’} } (List[Dict]): All exterior surfaces formatted as a list of { ‘block_index’, ‘surfaces’: [{‘IMIN’, ‘JMIN’,’KMIN’, ‘IMAX’,’JMAX’,’KMAX’, ‘ID’}] }

Return type:

(List[Dict])

plot3d.connectivity.connectivity_fast(blocks: List[Block])[source]

Reduces the size of the blocks by a factor of the minimum gcd. This speeds up finding the connectivity

Parameters:

blocks (List[Block]) – Lists of blocks you want to find the connectivity for

Returns:

All matching faces formatted as a list of { ‘block1’: {‘block_index’, ‘IMIN’, ‘JMIN’,’KMIN’, ‘IMAX’,’JMAX’,’KMAX’} } (List[Dict]): All exterior surfaces formatted as a list of { ‘block_index’, ‘surfaces’: [{‘IMIN’, ‘JMIN’,’KMIN’, ‘IMAX’,’JMAX’,’KMAX’, ‘ID’}] }

Return type:

(List[Dict])

plot3d.connectivity.face_matches_to_dict(face1: Face, face2: Face, block1: Block, block2: Block)[source]

Makes sure the diagonal of face 1 match the diagonal of face 2

Parameters:
  • face1 (Face) – Face 1 with block index

  • face2 (Face) – Face 2 with block index

  • block1 (Block) – Block 1

  • block2 (Block) – Block 2

Returns:

dictionary describing the corner matches

Return type:

(dict)

plot3d.connectivity.find_matching_blocks(block1: Block, block2: Block, block1_outer: List[Face], block2_outer: List[Face], tol: float = 1e-06)[source]

Takes two blocks and finds all matching pairs

Parameters:
  • block1 (Block) – Any plot3d Block that is not the same as block2

  • block2 (Block) – Any plot3d Block that is not the same as block1

  • block1_outer (List[Face]) – outer faces for block 1.

  • block2_outer (List[Face]) – Outer faces for block 2

  • tol (float, Optional) – tolerance to use. Defaults to 1E-6

Note

This function was changed to be given an input of outer faces for block 1 and block 2. Outer faces can change and we should use the updated value

Returns:

containing
  • df (pandas.DataFrame): corners of matching pair as block1_corners,block2_corners ([imin,jmin,kmin],[imax,jmax,kmax]), ([imin,jmin,kmin],[imax,jmax,kmax])

  • block1_outer (List[Face]):

  • block2_outer (List[Face]):

Return type:

(tuple)

plot3d.connectivity.get_face_intersection(face1: Face, face2: Face, block1: Block, block2: Block, tol: float = 1e-06)[source]
Get the index of the intersection between two faces located on two different blocks

Face1 needs to be the smaller face.

Parameters:
  • face1 (Face) – An exterior face

  • face2 (Face) – An exterior face from a different block

  • block1 (Block) – block containing face1

  • block2 (Block) – block containing face2

  • tol (float) – matching tolerance

Returns:

containing

  • (pandas.DataFrame): dataframe with matches. Columns = I1, J1, K1, I2, J2, K2

  • (List[Face]): any split faces from block 1

  • (List[Face]): any split faces from block 2

Return type:

(Tuple)

plot3d.connectivity.select_multi_dimensional(T: ndarray, dim1: tuple, dim2: tuple, dim3: tuple)[source]
Takes a block (T) and selects X,Y,Z from the block given a face’s dimensions

theres really no good way to do this in python

Parameters:
  • T (np.ndarray) – arbitrary array so say a full matrix containing X

  • dim1 (tuple) – 20,50 this selects X in the i direction from i=20 to 50

  • dim2 (tuple) – 40,60 this selects X in the j direction from j=40 to 60

  • dim3 (tuple) – 10,20 this selects X in the k direction from k=10 to 20

Returns:

returns X or Y or Z given some range of I,J,K

Return type:

np.ndarray