g3d.mesh.geo package

Subpackages

Submodules

g3d.mesh.geo.block module

mesh building block - Block class definition

class g3d.mesh.geo.block.Block(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

class Block (mesh block), extends class Coordinates

Attributes:
X
return:

Y
return:

Z
return:

chigh

global cell index of last cell in block

clow

global cell index of first cell in block

coordinates

block node coordinates

edges

list of block edges

filename

mesh file filename

im

mesh-block number

n_cells

number of cells in block

n_nodes

number of nodes in block

nhigh

global node index of last node in block

ni

number of nodes in the i-direction

nj

number of nodes in the j-direction

nk

number of nodes in the k-direction

nlow

global node index of first node in block

nmc

accumulated cell count in blocks with lower block number

nmp

accumulated node count in blocks with lower block number

pos

file position (file record pointer)

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

add_Coord(c)

add coordinate to block coordinate list input: Coordinate (c)

add_Edge(e[, edge_def])

add edge to block edge list input: Edge (e), edge definition in block reference (optional input)

allocate(*args, **kwargs)

allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=

allocate_XYZ([N])

allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)

allocate_smooth_delta()

allocate coordinate vectors used for mesh smooth operator

apply_face_coordinates(face)

copies face coordinate vector data to Block coordinate placeholders input: Face f

backup_is_allocated()

cell_get_ijk(kc)

get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)

check_face_block_bounds(kc, ld)

check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)

check_volumes()

checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()

copy(b)

copies block definition from specified block input: block example: copy(Block b)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_rotate_Edge(face_def, alpha, **kwargs)

copy_rotate_Face(face_def, npk, alpha, **kwargs)

export_XY(f)

writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)

export_XYZ(f)

writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)

extrude_Face(face_def, edge)

face_offset(original_face, offset_dist, ...)

generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)

fill([vol_def])

fill_2D([w])

fill_Face(face_def)

get_Coord(lp, **kwargs)

get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)

get_Coord_by_tag(tag)

get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)

get_Coord_from_IJK(i, j, k, **kwargs)

get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)

get_Edge(i0, j0, k0, idir, npi)

get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)

get_Edge_by_tag(tag)

get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)

get_Face(N[, normal])

gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)

get_X([lp])

get_XYZ([lp])

get_XYZ_from_IJK(i, j, k)

get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)

get_X_from_IJK(i, j, k)

get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)

get_Y([lp])

get_Y_from_IJK(i, j, k)

get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)

get_Z([lp])

get_Z_from_IJK(i, j, k)

get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)

get_block_sizes()

return block node counts input: no input example: ni, nj, nk = get_block_sizes()

get_cell(i, j, k)

returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)

get_cell_pointers()

returns block range of cell pointers input: no input example: lc = get_cell_pointers()

get_def()

returns block definition input: no input example: im, ni, nj, nk = get_def()

get_delta_arrays()

returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()

get_extreme_values()

get_face_pointers(face_def)

returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction

get_from_backup([reset_bak])

get_glue_pointers(face_def[, face_type])

get_index(i, j, k)

returns local node index input: i, j, k (1-based indices) example:

get_node(i, j, k)

returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)

get_node_pointers()

returns block range of node pointers input: no input example: lp = get_node_pointers()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

import_XY(f)

reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)

import_XYZ(f)

reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)

init_Face_list()

initialize face lists based on block definition

node_get_ijk(kp)

get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)

populate_face_coordinate_placeholders(face)

populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input

print()

prints block definition, block cell and node count

print_XYZ(face_def)

prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)

read_from_file(f)

remove_Coord_by_tag(tag)

remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)

remove_Edge_by_tag(tag)

remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)

reset_smooth_delta()

reset coordinate vectors used for mesh smooth operator

rotate(**kwargs)

scale(sf)

scale block coordinates input: scale factor (sf) example: scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

scatter_face_XYZ(plt, face_def[, m])

generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = 'o')

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_from_key_value(key, value)

sets code parameters from specified key => value data input: key, value valid keys for Block class: 'filename', 'pos', 'ni', 'nj', 'nk' example: set_from_key_value(key, value)

shift(**kwargs)

shift_Face(face_def, **kwargs)

smooth_Face(face_def)

smooth_apply(face_def)

update_counts()

updates node and cell counts

write_to_file(f)

backup

nullify

print_extreme_values

reset_XYZ

add_Coord(c: Coord) → None[source]

add coordinate to block coordinate list input: Coordinate (c)

add_Edge(e: Edge, edge_def: list | None = None) → None[source]

add edge to block edge list input: Edge (e), edge definition in block reference (optional input)

allocate(*args: Any, **kwargs: Any) → None[source]

allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=

allocate_XYZ(N: int | None = None) → None[source]

allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)

allocate_smooth_delta() → None[source]

allocate coordinate vectors used for mesh smooth operator

apply_face_coordinates(face: Face) → None[source]

copies face coordinate vector data to Block coordinate placeholders input: Face f

cell_get_ijk(kc: int) → Tuple[int, int, int][source]

get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)

check_face_block_bounds(kc: int, ld: int) → Tuple[int, int][source]

check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)

check_volumes() → Tuple[int, float, float][source]

checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()

property chigh: int

global cell index of last cell in block

property clow: int

global cell index of first cell in block

property coordinates: list

block node coordinates

copy(b: Block) → None[source]

copies block definition from specified block input: block example: copy(Block b)

copy_rotate_Edge(face_def: list | BlockFace | Face, alpha: float, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • alpha

  • kwargs

copy_rotate_Face(face_def: list | BlockFace | Face, npk: int, alpha: float, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • npk

  • alpha

  • kwargs

property edges: list

list of block edges

export_XY(f: BinaryIO) → None[source]

writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)

export_XYZ(f: BinaryIO) → None[source]

writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)

extrude_Face(face_def: list | BlockFace | Face, edge: Edge) → None[source]
Parameters:
  • face_def

  • edge

face_offset(original_face: Face, offset_dist: float, offset_dir: int, offset_n: int) → None[source]

generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)

property filename: str

mesh file filename

fill(vol_def: list | None = None) → None[source]
Parameters:

vol_def

fill_2D(w: float = 1.0) → None[source]
Parameters:

w

fill_Face(face_def: list | BlockFace | Face) → Tuple[ndarray, ...][source]
Parameters:

face_def

Returns:

get_Coord(lp: int, **kwargs: Any) → Coord[source]

get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)

get_Coord_by_tag(tag: str) → Coord | None[source]

get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)

get_Coord_from_IJK(i: int, j: int, k: int, **kwargs: Any) → Coord[source]

get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)

get_Edge(i0: int, j0: int, k0: int, idir: int, npi: int) → Edge[source]

get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)

get_Edge_by_tag(tag: str) → Edge | None[source]

get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)

get_Face(N: Any, normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) → Face | None[source]

gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)

get_XYZ_from_IJK(i: int, j: int, k: int) → Tuple[float, float, float][source]

get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)

get_X_from_IJK(i: int, j: int, k: int) → float[source]

get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)

get_Y_from_IJK(i: int, j: int, k: int) → float[source]

get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)

get_Z_from_IJK(i: int, j: int, k: int) → float[source]

get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)

get_block_sizes() → Tuple[int, int, int][source]

return block node counts input: no input example: ni, nj, nk = get_block_sizes()

get_cell(i: int, j: int, k: int) → int[source]

returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)

get_cell_pointers() → ndarray[source]

returns block range of cell pointers input: no input example: lc = get_cell_pointers()

get_def() → Tuple[int, int, int, int][source]

returns block definition input: no input example: im, ni, nj, nk = get_def()

get_delta_arrays() → Tuple[ndarray, ...][source]

returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()

get_face_pointers(face_def: list | BlockFace | Face) → Tuple[int, ...][source]

returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction

get_glue_pointers(face_def: list | BlockFace | Face, face_type: Any = FaceType.A_SIDE) → Tuple[ndarray, ...][source]
Parameters:
  • face_def

  • face_type

Returns:

get_index(i: int, j: int, k: int) → int[source]

returns local node index input: i, j, k (1-based indices) example:

get_node(i: int, j: int, k: int) → int[source]

returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)

get_node_pointers() → ndarray[source]

returns block range of node pointers input: no input example: lp = get_node_pointers()

property im: int

mesh-block number

import_XY(f: BinaryIO) → None[source]

reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)

import_XYZ(f: BinaryIO) → None[source]

reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)

init_Face_list() → None[source]

initialize face lists based on block definition

property n_cells: int

number of cells in block

property n_nodes: int

number of nodes in block

property nhigh: int

global node index of last node in block

property ni: int

number of nodes in the i-direction

property nj: int

number of nodes in the j-direction

property nk: int

number of nodes in the k-direction

property nlow: int

global node index of first node in block

property nmc: int

accumulated cell count in blocks with lower block number

property nmp: int

accumulated node count in blocks with lower block number

node_get_ijk(kp: int) → Tuple[int, int, int][source]

get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)

populate_face_coordinate_placeholders(face: Face) → None[source]

populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input

property pos: int

file position (file record pointer)

print() → None[source]

prints block definition, block cell and node count

print_XYZ(face_def: list | BlockFace | Face) → None[source]

prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)

remove_Coord_by_tag(tag: str) → None[source]

remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)

remove_Edge_by_tag(tag: str) → None[source]

remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)

reset_smooth_delta() → None[source]

reset coordinate vectors used for mesh smooth operator

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

scale(sf: float) → None[source]

scale block coordinates input: scale factor (sf) example: scale(sf)

scatter_face_XYZ(plt: Any, face_def: list | BlockFace | Face, m: str = 'o') → None[source]

generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = ‘o’)

set_from_key_value(key: str, value: Any) → bool[source]

sets code parameters from specified key => value data input: key, value valid keys for Block class: ‘filename’, ‘pos’, ‘ni’, ‘nj’, ‘nk’ example: set_from_key_value(key, value)

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

shift_Face(face_def: list | BlockFace | Face, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • kwargs

Returns:

smooth_Face(face_def: list | BlockFace | Face) → None[source]
Parameters:

face_def

smooth_apply(face_def: list | BlockFace | Face) → None[source]
Parameters:

face_def

update_counts() → None[source]

updates node and cell counts

g3d.mesh.geo.coord module

mesh building block - Coord class definition

class g3d.mesh.geo.coord.Coord(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Attributes:
alpha
return:

angle_dim
return:

beta
return:

ialt
return:

shape_factor
return:

spacing
return:

tag

tag (string) used for identification

x
return:

y
return:

z
return:

Methods

add(c)

copy(c, **kwargs)

copies data from specified entity input: entity example: copy(e)

copy_coordinates(c)

copy_settings(c)

divide(c)

get_angle(c, **kwargs)

get_array()

get_delta(c)

get_dist(c)

get_xyz()

length()

multiply(c)

print(**kwargs)

prints entity data

rotate(**kwargs)

scale(f)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_coordinates(xs, ys, zs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

shift(**kwargs)

subtract(c)

add(c: Coord) → Coord[source]
Parameters:

c

Returns:

property alpha: float

return:

property angle_dim: Any

return:

property beta: float

return:

copy(c: Coord, **kwargs: Any) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_coordinates(c: Coord) → None[source]
Parameters:

c

copy_settings(c: Coord) → None[source]
Parameters:

c

divide(c: Coord) → Coord[source]
Parameters:

c

Returns:

get_angle(c: Coord, **kwargs: Any) → Tuple[float, float][source]
Parameters:
  • c

  • kwargs

Returns:

get_array() → ndarray[source]
Returns:

get_delta(c: Coord) → Tuple[float, float, float][source]
Parameters:

c

Returns:

get_dist(c: Coord) → float[source]
Parameters:

c

Returns:

get_xyz() → Tuple[float, float, float][source]
Returns:

property ialt: Any

return:

length() → float[source]
Returns:

multiply(c: Coord) → Coord[source]
Parameters:

c

Returns:

print(**kwargs: Any) → None[source]

prints entity data

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

scale(f: float) → Coord[source]
Parameters:

f

Returns:

scatter_XY(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_XZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_YZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

set_coordinates(xs: float, ys: float, zs: float) → None[source]
Parameters:
  • xs

  • ys

  • zs

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property shape_factor: float

return:

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

property spacing: float

return:

subtract(c: Coord) → Coord[source]
Parameters:

c

Returns:

property x: float

return:

property y: float

return:

property z: float

return:

g3d.mesh.geo.coordinates module

mesh coordinate placeholders (X, Y, Z arrays)

class g3d.mesh.geo.coordinates.Coordinates(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Attributes:
X
return:

Y
return:

Z
return:

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_XYZ([N])

backup_is_allocated()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_extreme_values()

get_from_backup([reset_bak])

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

print()

prints entity data

read_from_file(f)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

write_to_file(f)

backup

nullify

print_extreme_values

reset_XYZ

property X: ndarray

return:

property Y: ndarray

return:

property Z: ndarray

return:

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

backup() → None[source]
backup_is_allocated() → bool[source]
Returns:

copy(e: Coordinates) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_X(*args: Any) → None[source]
Parameters:

args

copy_XYZ(*args: Any) → None[source]
Parameters:

args

copy_Y(*args: Any) → None[source]
Parameters:

args

copy_Z(*args: Any) → None[source]
Parameters:

args

get_X(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_XYZ(lp: int | list[int] | ndarray | None = None) → Tuple[ndarray, ...] | Tuple[float64, ...][source]
Parameters:

lp

Returns:

get_Y(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_Z(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_extreme_values() → Tuple[float64, ...][source]
Returns:

get_from_backup(reset_bak: bool = False) → None[source]
Parameters:

reset_bak

get_x_min_x_max() → Tuple[float64, float64][source]
Returns:

get_y_min_y_max() → Tuple[float64, float64][source]
Returns:

get_z_min_z_max() → Tuple[float64, float64][source]
Returns:

nullify() → None[source]
print_extreme_values() → None[source]
read_from_file(f: BinaryIO) → None[source]
Parameters:

f

reset_XYZ() → None[source]
scale(sf: float) → None[source]
Parameters:

sf

scatter_XY(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_XZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_YZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

set_X(x: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • x

  • lp

set_XYZ(x: float | ndarray, y: float | ndarray, z: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • x

  • y

  • z

  • lp

set_Y(y: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • y

  • lp

set_Z(z: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • z

  • lp

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property size: int

return:

write_to_file(f: BinaryIO) → None[source]
Parameters:

f

property x_max: float64

return:

property x_min: float64

return:

property y_max: float64

return:

property y_min: float64

return:

property z_max: float64

return:

property z_min: float64

return:

g3d.mesh.geo.edge module

mesh building block - Edge class definition

class g3d.mesh.geo.edge.Edge(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

Attributes:
X
return:

Y
return:

Z
return:

alpha
return:

angle_dim
return:

applied
return:

axis
return:

beta
return:

data
return:

direction
return:

distribute
return:

end
return:

h0
return:

h1
return:

i0
return:

ialt
return:

idir
return:

j0
return:

k0
return:

npi
return:

size
return:

start
return:

stretch_rate
return:

tag

tag (string) used for identification

tolerance
return:

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_XYZ([N])

append(e, **kwargs)

backup_is_allocated()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_def(e)

copy_settings(e)

define_Edge(e)

find_index(x, **kwargs)

generate_offset_Edge(offset[, in_plane_vector])

get_Coord(lp)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_angle(**kwargs)

get_def()

get_extreme_values()

get_from_backup([reset_bak])

get_spacing(**kwargs)

get_sub(**kwargs)

get_tangent(lp, **kwargs)

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

prepend(e, **kwargs)

print()

prints entity data

re_distribute_nodes(**kwargs)

read_from_file(f)

rotate(**kwargs)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_coordinates(**kwargs)

set_end_Coord(end)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

set_start_Coord(start)

set_start_end_Coord(start, end)

shift(**kwargs)

write_to_file(f)

backup

distribute_nodes

nullify

print_extreme_values

reset_XYZ

update_end_Coord

update_start_Coord

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

property alpha: float

return:

property angle_dim: Any

return:

append(e: Edge, **kwargs: Any) → None[source]
Parameters:
  • e

  • kwargs

property applied: bool

return:

property axis: Any

return:

property beta: float

return:

copy(e: Edge) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_def(e: Edge) → None[source]
Parameters:

e

copy_settings(e: Edge) → None[source]
Parameters:

e

property data: Any

return:

define_Edge(e: list[int] | int) → None[source]
Parameters:

e

property direction: Any

return:

property distribute: Any

return:

distribute_nodes() → None[source]
property end: Coord

return:

find_index(x: float, **kwargs: Any) → int[source]
Parameters:
  • x

  • kwargs

Returns:

generate_offset_Edge(offset: float, in_plane_vector: ndarray = array([0, 0, 1])) → Edge[source]
Parameters:
  • offset

  • in_plane_vector

Returns:

get_Coord(lp: int) → Coord[source]
Parameters:

lp

Returns:

get_angle(**kwargs: Any) → None | Tuple[float, float][source]
Parameters:

kwargs

Returns:

get_def() → Tuple[int, int, int, int, int][source]
Returns:

get_spacing(**kwargs: Any) → float | float64[source]
Parameters:

kwargs

Returns:

get_sub(**kwargs: Any) → Edge[source]
Parameters:

kwargs

Returns:

get_tangent(lp: int, **kwargs: Any) → Tuple[float, float][source]
Parameters:
  • lp

  • kwargs

Returns:

property h0: float

return:

property h1: float

return:

property i0: int

return:

property ialt: Any

return:

property idir: int

return:

property j0: int

return:

property k0: int

return:

property npi: int

return:

prepend(e: Edge, **kwargs: Any) → None[source]
Parameters:
  • e

  • kwargs

print() → None[source]

prints entity data

re_distribute_nodes(**kwargs: Any) → None[source]
Parameters:

kwargs

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

set_coordinates(**kwargs: Any) → None[source]
Parameters:

kwargs

set_end_Coord(end: Coord | list) → None[source]
Parameters:

end

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

set_start_Coord(start: Coord | list) → None[source]
Parameters:

start

set_start_end_Coord(start: Coord | list, end: Coord | list) → None[source]
Parameters:
  • start

  • end

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

property start: Coord

return:

property stretch_rate: float | str

return:

property tolerance: float

return:

update_end_Coord() → None[source]
update_start_Coord() → None[source]

g3d.mesh.geo.face module

mesh building block - Face class definition

class g3d.mesh.geo.face.Face(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

Attributes:
FMP
return:

FMP_size
return:

X
return:

Y
return:

Z
return:

alpha
return:

check
return:

delta
return:

face_type
return:

i0
return:

idir
return:

im
return:

it
return:

j0
return:

jdir
return:

k0
return:

npi
return:

npj
return:

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_FMP([mf])

allocate_XYZ([N])

backup_is_allocated()

check_FMP_cell_metrics(ic, check_sum)

copy(f)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_def(f)

generate_offset_Face(offset)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_cell_count()

get_def([normal])

get_delta()

get_extreme_values()

get_face_count()

get_from_backup([reset_bak])

get_index(i, j)

get_node(i, j)

get_node_count()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

print()

prints entity data

read_def_from_file(f)

read_from_file(f)

rotate(**kwargs)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_def([f])

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

shift(**kwargs)

write_to_file(f)

backup

deallocate_FMP

nullify

print_extreme_values

reset_XYZ

swap_normal

property FMP: FMP

return:

property FMP_size: int

return:

allocate_FMP(mf: int = 2) → None[source]
Parameters:

mf

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

property alpha: float

return:

property check: str

return:

check_FMP_cell_metrics(ic: int, check_sum: list | ndarray) → None[source]
Parameters:
  • ic

  • check_sum

copy(f: Face) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_def(f: Face) → None[source]
Parameters:

f

deallocate_FMP() → None[source]
property delta: Coord

return:

property face_type: str

return:

generate_offset_Face(offset: float) → Face[source]
Parameters:

offset

Returns:

get_cell_count() → int[source]
Returns:

get_def(normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) → Tuple[int, ...][source]
Parameters:

normal

Returns:

get_delta() → list[float][source]
Returns:

get_face_count() → int[source]
Returns:

get_index(i: int, j: int) → int[source]
Parameters:
  • i

  • j

Returns:

get_node(i: int, j: int) → int[source]
Parameters:
  • i

  • j

Returns:

get_node_count() → int[source]
Returns:

property i0: int

return:

property idir: int

return:

property im: int

return:

property it: int | None

return:

property j0: int

return:

property jdir: int

return:

property k0: int

return:

property npi: int

return:

property npj: int

return:

print() → None[source]

prints entity data

read_def_from_file(f: IO[str]) → None[source]
Parameters:

f

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

set_def(f: Face | list | None = None) → None[source]
Parameters:

f

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

swap_normal() → None[source]
class g3d.mesh.geo.face.Glue(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None)[source]

Bases: object

Attributes:
type
return:

Methods

get_face_defs()

set_face_defs([face_def_A, face_def_B])

get_face_defs() → Tuple[Face, Face][source]
Returns:

set_face_defs(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None) → None[source]
Parameters:
  • face_def_A

  • face_def_B

property type: Any

return:

g3d.mesh.geo.grid module

mesh placeholder - Grid class definition

class g3d.mesh.geo.grid.Grid(*args: Any, **kwargs: Any)[source]

Bases: G3DCode

Attributes:
blocks
return:

n_blocks
return:

n_cells
return:

n_nodes
return:

nodes
return:

tag

tag (string) used for identification

Methods

add_BC(bc, **kwargs)

add_Block(ni[, nj, nk])

add_IO(io, **kwargs)

add_Intf(faceA_def, faceB_def, **kwargs)

add_smooth_face(face_def)

add_smooth_face_glue(faceA_def, faceB_def)

cell_get_block(kc)

cell_get_ijk(kc)

check_volumes()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_Face(faceA_def, faceB_def)

copy_X(im_to, l_to, im_from, l_from)

copy_XYZ(im_to, l_to, im_from, l_from)

copy_Y(im_to, l_to, im_from, l_from)

copy_Z(im_to, l_to, im_from, l_from)

export(*args, **kwargs)

exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)

export_connections([bcf])

get_X(im[, lp])

get_XYZ(im[, lp])

get_Y(im[, lp])

get_Z(im[, lp])

get_extreme_coordinates()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

header(*args, **kwargs)

prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')

hline(*args, **kwargs)

prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)

import_mesh(*args, **kwargs)

imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename

jobname_append(name)

extends jobname with the specified string input: name example: jobname_append(name)

node_get_block(kp)

node_get_ijk(kp)

populate_face_coordinate_placeholders(im, b)

print()

prints entity data

scale(sf)

set(*args, **kwargs)

sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(im, X[, lp])

set_XYZ(im, X, Y, Z[, lp])

set_Y(im, Y[, lp])

set_Z(im, Z[, lp])

set_from_key_value(key, value)

sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)

smooth([N])

allocate_arrays

fill

glue_blocks

nullify_boundary_lists

nullify_smooth_faces

plot_edges_XY

plot_edges_XZ

plot_edges_YZ

print_extreme_values

redefine_ghosts

add_BC(bc: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • bc

  • kwargs

add_Block(ni: int | Block, nj: int = 0, nk: int = 0) → None[source]
Parameters:
  • ni

  • nj

  • nk

add_IO(io: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • io

  • kwargs

add_Intf(faceA_def: Face | list[int], faceB_def: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • faceA_def

  • faceB_def

  • kwargs

add_smooth_face(face_def: Face | list) → None[source]
Parameters:

face_def

add_smooth_face_glue(faceA_def: Face | list, faceB_def: Face | list) → None[source]
Parameters:
  • faceA_def

  • faceB_def

allocate_arrays() → None[source]
property blocks: list

return:

cell_get_block(kc: int) → int[source]
Parameters:

kc

Returns:

cell_get_ijk(kc: int) → Tuple[int, int, int][source]
Parameters:

kc

Returns:

check_volumes() → int[source]
Returns:

copy_Face(faceA_def: Face | list[int], faceB_def: Face | list[int]) → None[source]
Parameters:
  • faceA_def

  • faceB_def

copy_X(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_XYZ(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_Y(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_Z(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

export(*args: Any, **kwargs: Any) → None[source]

exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE)

export_connections(bcf: str = '') → None[source]
Parameters:

bcf

fill() → None[source]
get_X(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_XYZ(im: int, lp: int | None = None) → Tuple[ndarray, ...] | Tuple[float64, ...][source]
Parameters:
  • im

  • lp

Returns:

get_Y(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_Z(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_extreme_coordinates() → Tuple[float64, ...][source]
Returns:

get_x_min_x_max() → Tuple[float64, float64][source]
Returns:

get_y_min_y_max() → Tuple[float64, float64][source]
Returns:

get_z_min_z_max() → Tuple[float64, float64][source]
Returns:

glue_blocks() → None[source]
import_mesh(*args, **kwargs: Any) → None[source]

imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE), ‘msh_file’ -> filename, ‘topo_file’ -> filename

property n_blocks: int

return:

property n_cells: int

return:

property n_nodes: int

return:

node_get_block(kp: int) → int[source]
Parameters:

kp

Returns:

node_get_ijk(kp: int) → Tuple[int, int, int][source]
Parameters:

kp

Returns:

property nodes: Coordinates

return:

nullify_boundary_lists() → None[source]
nullify_smooth_faces() → None[source]
plot_edges_XY() → None[source]
plot_edges_XZ() → None[source]
plot_edges_YZ() → None[source]
populate_face_coordinate_placeholders(im: int, b: Face) → None[source]
Parameters:
  • im

  • b

print() → None[source]

prints entity data

print_extreme_values() → None[source]
redefine_ghosts() → None[source]
scale(sf: float) → None[source]
Parameters:

sf

set_X(im: int, X: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • X

  • lp

set_XYZ(im: int, X: float | ndarray, Y: float | ndarray, Z: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • X

  • Y

  • Z

  • lp

set_Y(im: int, Y: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • Y

  • lp

set_Z(im: int, Z: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • Z

  • lp

set_from_key_value(key: str, value: Any) → bool[source]

sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘verbose’, ‘silent/quiet’, ‘jobname’, ‘working_directory’, ‘dimension’, ‘cuda’, ‘prof’ example: set_from_key_value(key, value)

smooth(N: int = 1) → None[source]
Parameters:

N

g3d.mesh.geo.interp module

grid interpolation routines

class g3d.mesh.geo.interp.BoundaryInterp[source]

Bases: object

Methods

apply(data)

interfaces(mesh)

work()

apply(data: ndarray)[source]
Parameters:

data

interfaces(mesh)[source]
Parameters:

mesh

work()[source]
Returns:

Module contents

g3d/mesh/geo sub library

class g3d.mesh.geo.Block(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

class Block (mesh block), extends class Coordinates

Attributes:
X
return:

Y
return:

Z
return:

chigh

global cell index of last cell in block

clow

global cell index of first cell in block

coordinates

block node coordinates

edges

list of block edges

filename

mesh file filename

im

mesh-block number

n_cells

number of cells in block

n_nodes

number of nodes in block

nhigh

global node index of last node in block

ni

number of nodes in the i-direction

nj

number of nodes in the j-direction

nk

number of nodes in the k-direction

nlow

global node index of first node in block

nmc

accumulated cell count in blocks with lower block number

nmp

accumulated node count in blocks with lower block number

pos

file position (file record pointer)

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

add_Coord(c)

add coordinate to block coordinate list input: Coordinate (c)

add_Edge(e[, edge_def])

add edge to block edge list input: Edge (e), edge definition in block reference (optional input)

allocate(*args, **kwargs)

allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=

allocate_XYZ([N])

allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)

allocate_smooth_delta()

allocate coordinate vectors used for mesh smooth operator

apply_face_coordinates(face)

copies face coordinate vector data to Block coordinate placeholders input: Face f

backup_is_allocated()

cell_get_ijk(kc)

get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)

check_face_block_bounds(kc, ld)

check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)

check_volumes()

checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()

copy(b)

copies block definition from specified block input: block example: copy(Block b)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_rotate_Edge(face_def, alpha, **kwargs)

copy_rotate_Face(face_def, npk, alpha, **kwargs)

export_XY(f)

writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)

export_XYZ(f)

writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)

extrude_Face(face_def, edge)

face_offset(original_face, offset_dist, ...)

generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)

fill([vol_def])

fill_2D([w])

fill_Face(face_def)

get_Coord(lp, **kwargs)

get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)

get_Coord_by_tag(tag)

get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)

get_Coord_from_IJK(i, j, k, **kwargs)

get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)

get_Edge(i0, j0, k0, idir, npi)

get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)

get_Edge_by_tag(tag)

get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)

get_Face(N[, normal])

gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)

get_X([lp])

get_XYZ([lp])

get_XYZ_from_IJK(i, j, k)

get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)

get_X_from_IJK(i, j, k)

get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)

get_Y([lp])

get_Y_from_IJK(i, j, k)

get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)

get_Z([lp])

get_Z_from_IJK(i, j, k)

get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)

get_block_sizes()

return block node counts input: no input example: ni, nj, nk = get_block_sizes()

get_cell(i, j, k)

returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)

get_cell_pointers()

returns block range of cell pointers input: no input example: lc = get_cell_pointers()

get_def()

returns block definition input: no input example: im, ni, nj, nk = get_def()

get_delta_arrays()

returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()

get_extreme_values()

get_face_pointers(face_def)

returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction

get_from_backup([reset_bak])

get_glue_pointers(face_def[, face_type])

get_index(i, j, k)

returns local node index input: i, j, k (1-based indices) example:

get_node(i, j, k)

returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)

get_node_pointers()

returns block range of node pointers input: no input example: lp = get_node_pointers()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

import_XY(f)

reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)

import_XYZ(f)

reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)

init_Face_list()

initialize face lists based on block definition

node_get_ijk(kp)

get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)

populate_face_coordinate_placeholders(face)

populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input

print()

prints block definition, block cell and node count

print_XYZ(face_def)

prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)

read_from_file(f)

remove_Coord_by_tag(tag)

remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)

remove_Edge_by_tag(tag)

remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)

reset_smooth_delta()

reset coordinate vectors used for mesh smooth operator

rotate(**kwargs)

scale(sf)

scale block coordinates input: scale factor (sf) example: scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

scatter_face_XYZ(plt, face_def[, m])

generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = 'o')

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_from_key_value(key, value)

sets code parameters from specified key => value data input: key, value valid keys for Block class: 'filename', 'pos', 'ni', 'nj', 'nk' example: set_from_key_value(key, value)

shift(**kwargs)

shift_Face(face_def, **kwargs)

smooth_Face(face_def)

smooth_apply(face_def)

update_counts()

updates node and cell counts

write_to_file(f)

backup

nullify

print_extreme_values

reset_XYZ

add_Coord(c: Coord) → None[source]

add coordinate to block coordinate list input: Coordinate (c)

add_Edge(e: Edge, edge_def: list | None = None) → None[source]

add edge to block edge list input: Edge (e), edge definition in block reference (optional input)

allocate(*args: Any, **kwargs: Any) → None[source]

allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=

allocate_XYZ(N: int | None = None) → None[source]

allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)

allocate_smooth_delta() → None[source]

allocate coordinate vectors used for mesh smooth operator

apply_face_coordinates(face: Face) → None[source]

copies face coordinate vector data to Block coordinate placeholders input: Face f

cell_get_ijk(kc: int) → Tuple[int, int, int][source]

get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)

check_face_block_bounds(kc: int, ld: int) → Tuple[int, int][source]

check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)

check_volumes() → Tuple[int, float, float][source]

checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()

property chigh: int

global cell index of last cell in block

property clow: int

global cell index of first cell in block

property coordinates: list

block node coordinates

copy(b: Block) → None[source]

copies block definition from specified block input: block example: copy(Block b)

copy_rotate_Edge(face_def: list | BlockFace | Face, alpha: float, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • alpha

  • kwargs

copy_rotate_Face(face_def: list | BlockFace | Face, npk: int, alpha: float, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • npk

  • alpha

  • kwargs

property edges: list

list of block edges

export_XY(f: BinaryIO) → None[source]

writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)

export_XYZ(f: BinaryIO) → None[source]

writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)

extrude_Face(face_def: list | BlockFace | Face, edge: Edge) → None[source]
Parameters:
  • face_def

  • edge

face_offset(original_face: Face, offset_dist: float, offset_dir: int, offset_n: int) → None[source]

generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)

property filename: str

mesh file filename

fill(vol_def: list | None = None) → None[source]
Parameters:

vol_def

fill_2D(w: float = 1.0) → None[source]
Parameters:

w

fill_Face(face_def: list | BlockFace | Face) → Tuple[ndarray, ...][source]
Parameters:

face_def

Returns:

get_Coord(lp: int, **kwargs: Any) → Coord[source]

get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)

get_Coord_by_tag(tag: str) → Coord | None[source]

get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)

get_Coord_from_IJK(i: int, j: int, k: int, **kwargs: Any) → Coord[source]

get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)

get_Edge(i0: int, j0: int, k0: int, idir: int, npi: int) → Edge[source]

get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)

get_Edge_by_tag(tag: str) → Edge | None[source]

get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)

get_Face(N: Any, normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) → Face | None[source]

gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)

get_XYZ_from_IJK(i: int, j: int, k: int) → Tuple[float, float, float][source]

get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)

get_X_from_IJK(i: int, j: int, k: int) → float[source]

get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)

get_Y_from_IJK(i: int, j: int, k: int) → float[source]

get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)

get_Z_from_IJK(i: int, j: int, k: int) → float[source]

get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)

get_block_sizes() → Tuple[int, int, int][source]

return block node counts input: no input example: ni, nj, nk = get_block_sizes()

get_cell(i: int, j: int, k: int) → int[source]

returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)

get_cell_pointers() → ndarray[source]

returns block range of cell pointers input: no input example: lc = get_cell_pointers()

get_def() → Tuple[int, int, int, int][source]

returns block definition input: no input example: im, ni, nj, nk = get_def()

get_delta_arrays() → Tuple[ndarray, ...][source]

returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()

get_face_pointers(face_def: list | BlockFace | Face) → Tuple[int, ...][source]

returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction

get_glue_pointers(face_def: list | BlockFace | Face, face_type: Any = FaceType.A_SIDE) → Tuple[ndarray, ...][source]
Parameters:
  • face_def

  • face_type

Returns:

get_index(i: int, j: int, k: int) → int[source]

returns local node index input: i, j, k (1-based indices) example:

get_node(i: int, j: int, k: int) → int[source]

returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)

get_node_pointers() → ndarray[source]

returns block range of node pointers input: no input example: lp = get_node_pointers()

property im: int

mesh-block number

import_XY(f: BinaryIO) → None[source]

reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)

import_XYZ(f: BinaryIO) → None[source]

reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)

init_Face_list() → None[source]

initialize face lists based on block definition

property n_cells: int

number of cells in block

property n_nodes: int

number of nodes in block

property nhigh: int

global node index of last node in block

property ni: int

number of nodes in the i-direction

property nj: int

number of nodes in the j-direction

property nk: int

number of nodes in the k-direction

property nlow: int

global node index of first node in block

property nmc: int

accumulated cell count in blocks with lower block number

property nmp: int

accumulated node count in blocks with lower block number

node_get_ijk(kp: int) → Tuple[int, int, int][source]

get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)

populate_face_coordinate_placeholders(face: Face) → None[source]

populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input

property pos: int

file position (file record pointer)

print() → None[source]

prints block definition, block cell and node count

print_XYZ(face_def: list | BlockFace | Face) → None[source]

prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)

remove_Coord_by_tag(tag: str) → None[source]

remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)

remove_Edge_by_tag(tag: str) → None[source]

remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)

reset_smooth_delta() → None[source]

reset coordinate vectors used for mesh smooth operator

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

scale(sf: float) → None[source]

scale block coordinates input: scale factor (sf) example: scale(sf)

scatter_face_XYZ(plt: Any, face_def: list | BlockFace | Face, m: str = 'o') → None[source]

generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = ‘o’)

set_from_key_value(key: str, value: Any) → bool[source]

sets code parameters from specified key => value data input: key, value valid keys for Block class: ‘filename’, ‘pos’, ‘ni’, ‘nj’, ‘nk’ example: set_from_key_value(key, value)

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

shift_Face(face_def: list | BlockFace | Face, **kwargs: Any) → None[source]
Parameters:
  • face_def

  • kwargs

Returns:

smooth_Face(face_def: list | BlockFace | Face) → None[source]
Parameters:

face_def

smooth_apply(face_def: list | BlockFace | Face) → None[source]
Parameters:

face_def

update_counts() → None[source]

updates node and cell counts

class g3d.mesh.geo.BlockRegion(*args: Any, **kwargs: Any)[source]

Bases: PrismRegion

Attributes:
alpha
return:

beta
return:

ialt
return:

length
return:

tag

tag (string) used for identification

width
return:

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: BlockRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property width: float

return:

class g3d.mesh.geo.BoxRegion(*args: Any, **kwargs: Any)[source]

Bases: Region

Attributes:
dx
return:

dy
return:

dz
return:

tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: BoxRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

property dx: float

return:

property dy: float

return:

property dz: float

return:

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.Coord(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Attributes:
alpha
return:

angle_dim
return:

beta
return:

ialt
return:

shape_factor
return:

spacing
return:

tag

tag (string) used for identification

x
return:

y
return:

z
return:

Methods

add(c)

copy(c, **kwargs)

copies data from specified entity input: entity example: copy(e)

copy_coordinates(c)

copy_settings(c)

divide(c)

get_angle(c, **kwargs)

get_array()

get_delta(c)

get_dist(c)

get_xyz()

length()

multiply(c)

print(**kwargs)

prints entity data

rotate(**kwargs)

scale(f)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_coordinates(xs, ys, zs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

shift(**kwargs)

subtract(c)

add(c: Coord) → Coord[source]
Parameters:

c

Returns:

property alpha: float

return:

property angle_dim: Any

return:

property beta: float

return:

copy(c: Coord, **kwargs: Any) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_coordinates(c: Coord) → None[source]
Parameters:

c

copy_settings(c: Coord) → None[source]
Parameters:

c

divide(c: Coord) → Coord[source]
Parameters:

c

Returns:

get_angle(c: Coord, **kwargs: Any) → Tuple[float, float][source]
Parameters:
  • c

  • kwargs

Returns:

get_array() → ndarray[source]
Returns:

get_delta(c: Coord) → Tuple[float, float, float][source]
Parameters:

c

Returns:

get_dist(c: Coord) → float[source]
Parameters:

c

Returns:

get_xyz() → Tuple[float, float, float][source]
Returns:

property ialt: Any

return:

length() → float[source]
Returns:

multiply(c: Coord) → Coord[source]
Parameters:

c

Returns:

print(**kwargs: Any) → None[source]

prints entity data

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

scale(f: float) → Coord[source]
Parameters:

f

Returns:

scatter_XY(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_XZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_YZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

set_coordinates(xs: float, ys: float, zs: float) → None[source]
Parameters:
  • xs

  • ys

  • zs

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property shape_factor: float

return:

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

property spacing: float

return:

subtract(c: Coord) → Coord[source]
Parameters:

c

Returns:

property x: float

return:

property y: float

return:

property z: float

return:

class g3d.mesh.geo.Coordinates(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Attributes:
X
return:

Y
return:

Z
return:

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_XYZ([N])

backup_is_allocated()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_extreme_values()

get_from_backup([reset_bak])

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

print()

prints entity data

read_from_file(f)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

write_to_file(f)

backup

nullify

print_extreme_values

reset_XYZ

property X: ndarray

return:

property Y: ndarray

return:

property Z: ndarray

return:

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

backup() → None[source]
backup_is_allocated() → bool[source]
Returns:

copy(e: Coordinates) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_X(*args: Any) → None[source]
Parameters:

args

copy_XYZ(*args: Any) → None[source]
Parameters:

args

copy_Y(*args: Any) → None[source]
Parameters:

args

copy_Z(*args: Any) → None[source]
Parameters:

args

get_X(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_XYZ(lp: int | list[int] | ndarray | None = None) → Tuple[ndarray, ...] | Tuple[float64, ...][source]
Parameters:

lp

Returns:

get_Y(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_Z(lp: int | list[int] | ndarray | None = None) → ndarray | float64[source]
Parameters:

lp

Returns:

get_extreme_values() → Tuple[float64, ...][source]
Returns:

get_from_backup(reset_bak: bool = False) → None[source]
Parameters:

reset_bak

get_x_min_x_max() → Tuple[float64, float64][source]
Returns:

get_y_min_y_max() → Tuple[float64, float64][source]
Returns:

get_z_min_z_max() → Tuple[float64, float64][source]
Returns:

nullify() → None[source]
print_extreme_values() → None[source]
read_from_file(f: BinaryIO) → None[source]
Parameters:

f

reset_XYZ() → None[source]
scale(sf: float) → None[source]
Parameters:

sf

scatter_XY(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_XZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

scatter_YZ(plt: Any, m: str = 'o') → None[source]
Parameters:
  • plt

  • m

set_X(x: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • x

  • lp

set_XYZ(x: float | ndarray, y: float | ndarray, z: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • x

  • y

  • z

  • lp

set_Y(y: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • y

  • lp

set_Z(z: float | ndarray, lp: int | list[int] | ndarray | None = None) → None[source]
Parameters:
  • z

  • lp

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property size: int

return:

write_to_file(f: BinaryIO) → None[source]
Parameters:

f

property x_max: float64

return:

property x_min: float64

return:

property y_max: float64

return:

property y_min: float64

return:

property z_max: float64

return:

property z_min: float64

return:

class g3d.mesh.geo.CylinderRegion(*args: Any, **kwargs: Any)[source]

Bases: PrismRegion

Attributes:
alpha
return:

beta
return:

ialt
return:

length
return:

radius
return:

tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: CylinderRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

property radius: float

return:

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.Edge(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

Attributes:
X
return:

Y
return:

Z
return:

alpha
return:

angle_dim
return:

applied
return:

axis
return:

beta
return:

data
return:

direction
return:

distribute
return:

end
return:

h0
return:

h1
return:

i0
return:

ialt
return:

idir
return:

j0
return:

k0
return:

npi
return:

size
return:

start
return:

stretch_rate
return:

tag

tag (string) used for identification

tolerance
return:

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_XYZ([N])

append(e, **kwargs)

backup_is_allocated()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_def(e)

copy_settings(e)

define_Edge(e)

find_index(x, **kwargs)

generate_offset_Edge(offset[, in_plane_vector])

get_Coord(lp)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_angle(**kwargs)

get_def()

get_extreme_values()

get_from_backup([reset_bak])

get_spacing(**kwargs)

get_sub(**kwargs)

get_tangent(lp, **kwargs)

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

prepend(e, **kwargs)

print()

prints entity data

re_distribute_nodes(**kwargs)

read_from_file(f)

rotate(**kwargs)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_coordinates(**kwargs)

set_end_Coord(end)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

set_start_Coord(start)

set_start_end_Coord(start, end)

shift(**kwargs)

write_to_file(f)

backup

distribute_nodes

nullify

print_extreme_values

reset_XYZ

update_end_Coord

update_start_Coord

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

property alpha: float

return:

property angle_dim: Any

return:

append(e: Edge, **kwargs: Any) → None[source]
Parameters:
  • e

  • kwargs

property applied: bool

return:

property axis: Any

return:

property beta: float

return:

copy(e: Edge) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_def(e: Edge) → None[source]
Parameters:

e

copy_settings(e: Edge) → None[source]
Parameters:

e

property data: Any

return:

define_Edge(e: list[int] | int) → None[source]
Parameters:

e

property direction: Any

return:

property distribute: Any

return:

distribute_nodes() → None[source]
property end: Coord

return:

find_index(x: float, **kwargs: Any) → int[source]
Parameters:
  • x

  • kwargs

Returns:

generate_offset_Edge(offset: float, in_plane_vector: ndarray = array([0, 0, 1])) → Edge[source]
Parameters:
  • offset

  • in_plane_vector

Returns:

get_Coord(lp: int) → Coord[source]
Parameters:

lp

Returns:

get_angle(**kwargs: Any) → None | Tuple[float, float][source]
Parameters:

kwargs

Returns:

get_def() → Tuple[int, int, int, int, int][source]
Returns:

get_spacing(**kwargs: Any) → float | float64[source]
Parameters:

kwargs

Returns:

get_sub(**kwargs: Any) → Edge[source]
Parameters:

kwargs

Returns:

get_tangent(lp: int, **kwargs: Any) → Tuple[float, float][source]
Parameters:
  • lp

  • kwargs

Returns:

property h0: float

return:

property h1: float

return:

property i0: int

return:

property ialt: Any

return:

property idir: int

return:

property j0: int

return:

property k0: int

return:

property npi: int

return:

prepend(e: Edge, **kwargs: Any) → None[source]
Parameters:
  • e

  • kwargs

print() → None[source]

prints entity data

re_distribute_nodes(**kwargs: Any) → None[source]
Parameters:

kwargs

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

set_coordinates(**kwargs: Any) → None[source]
Parameters:

kwargs

set_end_Coord(end: Coord | list) → None[source]
Parameters:

end

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

set_start_Coord(start: Coord | list) → None[source]
Parameters:

start

set_start_end_Coord(start: Coord | list, end: Coord | list) → None[source]
Parameters:
  • start

  • end

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

property start: Coord

return:

property stretch_rate: float | str

return:

property tolerance: float

return:

update_end_Coord() → None[source]
update_start_Coord() → None[source]
class g3d.mesh.geo.Face(*args: Any, **kwargs: Any)[source]

Bases: Coordinates

Attributes:
FMP
return:

FMP_size
return:

X
return:

Y
return:

Z
return:

alpha
return:

check
return:

delta
return:

face_type
return:

i0
return:

idir
return:

im
return:

it
return:

j0
return:

jdir
return:

k0
return:

npi
return:

npj
return:

size
return:

tag

tag (string) used for identification

x_max
return:

x_min
return:

y_max
return:

y_min
return:

z_max
return:

z_min
return:

Methods

allocate_FMP([mf])

allocate_XYZ([N])

backup_is_allocated()

check_FMP_cell_metrics(ic, check_sum)

copy(f)

copies data from specified entity input: entity example: copy(e)

copy_X(*args)

copy_XYZ(*args)

copy_Y(*args)

copy_Z(*args)

copy_def(f)

generate_offset_Face(offset)

get_X([lp])

get_XYZ([lp])

get_Y([lp])

get_Z([lp])

get_cell_count()

get_def([normal])

get_delta()

get_extreme_values()

get_face_count()

get_from_backup([reset_bak])

get_index(i, j)

get_node(i, j)

get_node_count()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

print()

prints entity data

read_def_from_file(f)

read_from_file(f)

rotate(**kwargs)

scale(sf)

scatter_XY(plt[, m])

scatter_XZ(plt[, m])

scatter_YZ(plt[, m])

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(x[, lp])

set_XYZ(x, y, z[, lp])

set_Y(y[, lp])

set_Z(z[, lp])

set_def([f])

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

shift(**kwargs)

write_to_file(f)

backup

deallocate_FMP

nullify

print_extreme_values

reset_XYZ

swap_normal

property FMP: FMP

return:

property FMP_size: int

return:

allocate_FMP(mf: int = 2) → None[source]
Parameters:

mf

allocate_XYZ(N: int | None = None) → None[source]
Parameters:

N

property alpha: float

return:

property check: str

return:

check_FMP_cell_metrics(ic: int, check_sum: list | ndarray) → None[source]
Parameters:
  • ic

  • check_sum

copy(f: Face) → None[source]

copies data from specified entity input: entity example: copy(e)

copy_def(f: Face) → None[source]
Parameters:

f

deallocate_FMP() → None[source]
property delta: Coord

return:

property face_type: str

return:

generate_offset_Face(offset: float) → Face[source]
Parameters:

offset

Returns:

get_cell_count() → int[source]
Returns:

get_def(normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) → Tuple[int, ...][source]
Parameters:

normal

Returns:

get_delta() → list[float][source]
Returns:

get_face_count() → int[source]
Returns:

get_index(i: int, j: int) → int[source]
Parameters:
  • i

  • j

Returns:

get_node(i: int, j: int) → int[source]
Parameters:
  • i

  • j

Returns:

get_node_count() → int[source]
Returns:

property i0: int

return:

property idir: int

return:

property im: int

return:

property it: int | None

return:

property j0: int

return:

property jdir: int

return:

property k0: int

return:

property npi: int

return:

property npj: int

return:

print() → None[source]

prints entity data

read_def_from_file(f: IO[str]) → None[source]
Parameters:

f

rotate(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

set_def(f: Face | list | None = None) → None[source]
Parameters:

f

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

shift(**kwargs: Any) → None[source]
Parameters:

kwargs

Returns:

swap_normal() → None[source]
class g3d.mesh.geo.Glue(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None)[source]

Bases: object

Attributes:
type
return:

Methods

get_face_defs()

set_face_defs([face_def_A, face_def_B])

get_face_defs() → Tuple[Face, Face][source]
Returns:

set_face_defs(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None) → None[source]
Parameters:
  • face_def_A

  • face_def_B

property type: Any

return:

class g3d.mesh.geo.Grid(*args: Any, **kwargs: Any)[source]

Bases: G3DCode

Attributes:
blocks
return:

n_blocks
return:

n_cells
return:

n_nodes
return:

nodes
return:

tag

tag (string) used for identification

Methods

add_BC(bc, **kwargs)

add_Block(ni[, nj, nk])

add_IO(io, **kwargs)

add_Intf(faceA_def, faceB_def, **kwargs)

add_smooth_face(face_def)

add_smooth_face_glue(faceA_def, faceB_def)

cell_get_block(kc)

cell_get_ijk(kc)

check_volumes()

copy(e)

copies data from specified entity input: entity example: copy(e)

copy_Face(faceA_def, faceB_def)

copy_X(im_to, l_to, im_from, l_from)

copy_XYZ(im_to, l_to, im_from, l_from)

copy_Y(im_to, l_to, im_from, l_from)

copy_Z(im_to, l_to, im_from, l_from)

export(*args, **kwargs)

exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)

export_connections([bcf])

get_X(im[, lp])

get_XYZ(im[, lp])

get_Y(im[, lp])

get_Z(im[, lp])

get_extreme_coordinates()

get_x_min_x_max()

get_y_min_y_max()

get_z_min_z_max()

header(*args, **kwargs)

prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')

hline(*args, **kwargs)

prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)

import_mesh(*args, **kwargs)

imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename

jobname_append(name)

extends jobname with the specified string input: name example: jobname_append(name)

node_get_block(kp)

node_get_ijk(kp)

populate_face_coordinate_placeholders(im, b)

print()

prints entity data

scale(sf)

set(*args, **kwargs)

sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_X(im, X[, lp])

set_XYZ(im, X, Y, Z[, lp])

set_Y(im, Y[, lp])

set_Z(im, Z[, lp])

set_from_key_value(key, value)

sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)

smooth([N])

allocate_arrays

fill

glue_blocks

nullify_boundary_lists

nullify_smooth_faces

plot_edges_XY

plot_edges_XZ

plot_edges_YZ

print_extreme_values

redefine_ghosts

add_BC(bc: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • bc

  • kwargs

add_Block(ni: int | Block, nj: int = 0, nk: int = 0) → None[source]
Parameters:
  • ni

  • nj

  • nk

add_IO(io: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • io

  • kwargs

add_Intf(faceA_def: Face | list[int], faceB_def: Face | list[int], **kwargs: Any) → None[source]
Parameters:
  • faceA_def

  • faceB_def

  • kwargs

add_smooth_face(face_def: Face | list) → None[source]
Parameters:

face_def

add_smooth_face_glue(faceA_def: Face | list, faceB_def: Face | list) → None[source]
Parameters:
  • faceA_def

  • faceB_def

allocate_arrays() → None[source]
property blocks: list

return:

cell_get_block(kc: int) → int[source]
Parameters:

kc

Returns:

cell_get_ijk(kc: int) → Tuple[int, int, int][source]
Parameters:

kc

Returns:

check_volumes() → int[source]
Returns:

copy_Face(faceA_def: Face | list[int], faceB_def: Face | list[int]) → None[source]
Parameters:
  • faceA_def

  • faceB_def

copy_X(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_XYZ(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_Y(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

copy_Z(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) → None[source]
Parameters:
  • im_to

  • l_to

  • im_from

  • l_from

export(*args: Any, **kwargs: Any) → None[source]

exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE)

export_connections(bcf: str = '') → None[source]
Parameters:

bcf

fill() → None[source]
get_X(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_XYZ(im: int, lp: int | None = None) → Tuple[ndarray, ...] | Tuple[float64, ...][source]
Parameters:
  • im

  • lp

Returns:

get_Y(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_Z(im: int, lp: int | None = None) → ndarray | float64[source]
Parameters:
  • im

  • lp

Returns:

get_extreme_coordinates() → Tuple[float64, ...][source]
Returns:

get_x_min_x_max() → Tuple[float64, float64][source]
Returns:

get_y_min_y_max() → Tuple[float64, float64][source]
Returns:

get_z_min_z_max() → Tuple[float64, float64][source]
Returns:

glue_blocks() → None[source]
import_mesh(*args, **kwargs: Any) → None[source]

imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE), ‘msh_file’ -> filename, ‘topo_file’ -> filename

property n_blocks: int

return:

property n_cells: int

return:

property n_nodes: int

return:

node_get_block(kp: int) → int[source]
Parameters:

kp

Returns:

node_get_ijk(kp: int) → Tuple[int, int, int][source]
Parameters:

kp

Returns:

property nodes: Coordinates

return:

nullify_boundary_lists() → None[source]
nullify_smooth_faces() → None[source]
plot_edges_XY() → None[source]
plot_edges_XZ() → None[source]
plot_edges_YZ() → None[source]
populate_face_coordinate_placeholders(im: int, b: Face) → None[source]
Parameters:
  • im

  • b

print() → None[source]

prints entity data

print_extreme_values() → None[source]
redefine_ghosts() → None[source]
scale(sf: float) → None[source]
Parameters:

sf

set_X(im: int, X: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • X

  • lp

set_XYZ(im: int, X: float | ndarray, Y: float | ndarray, Z: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • X

  • Y

  • Z

  • lp

set_Y(im: int, Y: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • Y

  • lp

set_Z(im: int, Z: float | ndarray, lp=None) → None[source]
Parameters:
  • im

  • Z

  • lp

set_from_key_value(key: str, value: Any) → bool[source]

sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘verbose’, ‘silent/quiet’, ‘jobname’, ‘working_directory’, ‘dimension’, ‘cuda’, ‘prof’ example: set_from_key_value(key, value)

smooth(N: int = 1) → None[source]
Parameters:

N

class g3d.mesh.geo.IJKRegion(*args: Any, **kwargs: Any)[source]

Bases: Region

Attributes:
i1
return:

i2
return:

im
return:

it
return:

j1
return:

j2
return:

k1
return:

k2
return:

nc
return:

ni
return:

nj
return:

nk
return:

np
return:

tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

get_def()

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_def(im, i1, i2, j1, j2, k1, k2[, it])

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: IJKRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

get_def() → Tuple[int, ...][source]
Returns:

property i1: int

return:

property i2: int

return:

property im: int

return:

property it: int

return:

property j1: int

return:

property j2: int

return:

property k1: int

return:

property k2: int

return:

property nc: int

return:

property ni: int

return:

property nj: int

return:

property nk: int

return:

property np: int

return:

set_def(im, i1, i2, j1, j2, k1, k2, it=0)[source]
Parameters:
  • im

  • i1

  • i2

  • j1

  • j2

  • k1

  • k2

  • it

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.PrismRegion(*args: Any, **kwargs: Any)[source]

Bases: Region

Attributes:
alpha
return:

beta
return:

ialt
return:

length
return:

tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

property alpha

return:

property beta

return:

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: PrismRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

property ialt

return:

property length

return:

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.Region(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Attributes:
tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: Region) → None[source]

copies data from specified entity input: entity example: copy(e)

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.SphereRegion(*args: Any, **kwargs: Any)[source]

Bases: Region

Attributes:
radius
return:

tag

tag (string) used for identification

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: SphereRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

property radius: float

return:

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

class g3d.mesh.geo.XYZRegion(*args: Any, **kwargs: Any)[source]

Bases: Region

Attributes:
tag

tag (string) used for identification

x1
return:

x2
return:

y1
return:

y2
return:

z1
return:

z2
return:

Methods

coord_is_in_region(c)

copy(r)

copies data from specified entity input: entity example: copy(e)

print()

prints entity data

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_key_value(key, value)

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)

coord_is_in_region(c: Coord) → bool[source]
Parameters:

c

Returns:

copy(r: XYZRegion) → None[source]

copies data from specified entity input: entity example: copy(e)

print() → None[source]

prints entity data

set_from_key_value(key: str, value: Any) → bool[source]

sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)

property x1: float

return:

property x2: float

return:

property y1: float

return:

property y2: float

return:

property z1: float

return:

property z2: float

return: