Face Functions

plot3d.facefunctions.create_face_from_diagonals(block: Block, imin: int, jmin: int, kmin: int, imax: int, jmax: int, kmax: int) Face[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.faces_match(face1: Tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[_ScalarT]]], face2: Tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[_ScalarT]]], tol: float = 1e-12) Tuple[bool, Tuple[bool, bool] | None][source]

Compare two block faces and return whether they match and the flip required on face2 to match face1. Returns (True, (flip_ud, flip_lr)) if matching, otherwise (False, None).

plot3d.facefunctions.find_bounding_faces(blocks: List[Block], outer_faces: List[Dict[str, int]], direction: str = 'z', side: str = 'both', tol_rel: float = 1e-08, node_tol_xyz: float = 1e-06) Tuple[List[Dict[str, int]], List[Dict[str, int]], List[Face], List[Face]][source]

Find outer bounding faces at the global min/max of a given direction (‘x’,’y’,’z’). Uses node-sharing BFS to gather continuous boundary patches across blocks.

Parameters:
  • blocks – list of Block

  • outer_faces – optional precomputed outer faces (dict form)

  • direction – ‘x’,’y’,’z’

  • side – ‘both’ | ‘min’ | ‘max’

  • tol_rel – relative tolerance against global extreme value

  • node_tol_xyz – absolute node matching tolerance (geometry units)

Returns:

lower_connected_faces_export, upper_connected_faces_export, lower_connected_faces, upper_connected_faces

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 targeting 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_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.find_matching_faces(block1, block2, tol=1e-08)[source]

Returns a tuple (face1_name, face2_name, flip_flags) if a matching face is found. Otherwise returns (None, None, None).

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]]