Face Functions

plot3d.facefunctions.create_face_from_diagonals(block: Block, imin: int, jmin: int, kmin: int, imax: int, jmax: int, kmax: int)[source]

Creates a face on a block given a the diagonals defined as (IMIN,JMIN,KMIN), (IMAX, JMAX, KMAX)

Parameters:
  • block (Block) – Block to create a face on

  • imin (int) – Lower Corner IMIN

  • jmin (int) – Lower Corner JMIN

  • kmin (int) – Lower Corner KMIN

  • imax (int) – Upper Corner IMAX

  • jmax (int) – Upper Corner JMAX

  • kmax (int) – Upper Corner

Returns:

Face created from diagonals

Return type:

(Face)

plot3d.facefunctions.find_bounding_faces(blocks: List[Block], connectivity_matrix: ndarray, outer_faces: List[Dict[str, int]], direction: str = 'z')[source]

Finds bounding faces in x,y,z direction so think of this as the xmin and xmax faces of a block. This is useful for translational periodicity where you want the bounds to check

Parameters:
  • blocks (List[Block]) – List of blocks

  • outer_faces (List[Dict[str,int]]) – outer faces as a list of dictionaries

  • direction (str, optional) – Direction to search for. Defaults to “z”.

Returns:

lower_connected_faces_export (List[Dict[str,int]]): Export ready version of lower/left connected faces upper_connected_faces_export (List[Dict[str,int]]): Export ready version of upper/right connected faces lower_connected_faces (List[face]): List of lower/left connected faces upper_connected_faces (List[face]): List of upper/right connected faces

Return type:

(tuple) containing

plot3d.facefunctions.find_closest_block(blocks: List[Block], x: ndarray, y: ndarray, z: ndarray, centroid: ndarray, translational_direction: str = 'x', minvalue: bool = True)[source]

Find the closest block to an extreme in the x,y, or z direction and returns the targetting point. Target point is the reference point where we want the closest block and the closest face

Parameters:
  • x (np.ndarray) – x coordinate of all the blocks’ centroid

  • y (np.ndarray) – y coordinate of all the blocks’ centroid

  • z (np.ndarray) – z coordinate of all the blocks’ centroid

  • centroid (np.ndarray) – centroid (cx,cy,cz)

  • translational_direction (str, optional) – _description_. Defaults to “x”.

  • minvalue (bool, optional) – _description_. Defaults to True.

Returns:

containing

selected block index (int): index of closest block target_x (float): this is the x value where selected block is closest to target_y (float): this is the y value where selected block is closest to target_z (float): this is the z value where selected block is closest to

Return type:

(tuple)

plot3d.facefunctions.find_connected_faces(face_to_search: Face, outer_faces: List[Face], connectivity_matrix: ndarray, blocks: List[Block])[source]

Recursive program to return all the matching faces. Note faces must have the same I,J,K definition so faces will be matching if for example: Face1 IMIN=IMAX and Face2 IMIN=IMAX and they share a common edge (2 vertices)

Parameters:
  • face_to_search (Face) – This is the face to search for

  • outer_faces (List[Face]) – List of outer faces

  • connectivity_matrix (np.ndarray) – block connectivity matrix

  • searched_faces (List[Face]) – Leave this as blank

Returns:

list of all faces that connect with face_to_search and it’s neighbors. Beware of duplicates.

Return type:

List[Face]

plot3d.facefunctions.find_face_nearest_point(faces: List[Face], x: float, y: float, z: float)[source]

Find a face nearest to a given point

Parameters:
  • blocks (List[Block]) – List of blocks

  • faces (List[Face]) – List of faces

  • x (float) – x coordinate of a reference point

  • y (float) – y coordinate of a reference point

  • z (float) – z coordinate of a reference point

plot3d.facefunctions.get_outer_faces(block1: Block)[source]

Get the outer faces of a block

Parameters:

block1 (Block) – A plot3D block

Returns:

Non matching faces of the block List[(Face,Face)]: Matching faces inside the block

Return type:

List[Face]

plot3d.facefunctions.match_faces_dict_to_list(blocks: List[Block], matched_faces: List[Dict[str, int]], gcd: int = 1)[source]

Converts a list of dictionaries representing matched faces to a list of Faces

Parameters:
  • blocks (List[Block]) – List of blocks

  • matched_faces (List[Dict[str,int]]) – List of matched faces represented as a dictionary

  • gcd (int, optional) – _description_. Defaults to 1.

Returns:

_description_

Return type:

_type_

plot3d.facefunctions.outer_face_dict_to_list(blocks: List[Block], outer_faces: List[Dict[str, int]], gcd: int = 1) List[Face][source]

Converts a list of dictionary face representations to a list of faces. Use this only for outer faces

Parameters:
  • blocks (List[Block]) – List of blocks

  • outer_faces (List[Dict[str,int]]) – List of outer faces represented as a dictionary

  • gcd (int, optional) – Greatst common divisor. Defaults to 1.

Returns:

List of Face objects

Return type:

List[Face]

plot3d.facefunctions.split_face(face_to_split: Face, block: Block, imin: int, jmin: int, kmin: int, imax: int, jmax: int, kmax: int)[source]
Splits a face with another face within the same block

picture the split as a two rectangles inside each other

Parameters:
  • face_to_split (Face) – Face on the block to be split

  • block (Block) – Block the split is occuring on

  • imin (int) – IMIN index of the split (diagonals)

  • jmin (int) – JMIN index of the split (diagonals)

  • kmin (int) – KMIN index of the split (diagonals)

  • imax (int) – IMAX index of the split

  • jmax (int) – JMAX index of the split

  • kmax (int) – KMAX index of the split

            left face    top face     right face
 ________       __          __            __
|   __   |     |  |        |__|          |  |     __
|  |__|  |     |  |         __           |  |    |__|  face_to_split/center face
|________|     |__|        |__|          |__|
                        bottom face
Returns:

List of unique faces from the split

Return type:

[List[Faces]]