gmsh_scripts.block

Submodules

Package Contents

Classes

Block

Basic building block of the mesh

Layer

Matrix

Matrix

Matrix

class gmsh_scripts.block.Block(points=None, curves=None, surfaces=None, volume=None, do_register=True, do_register_children=True, do_unregister=False, do_unregister_children=True, do_unregister_boolean=False, transforms=None, self_transforms=None, do_quadrate=False, do_structure=True, structure=None, structure_type=None, zone=None, boolean_level=None, path=None, parent=None, children=None, children_transforms=None)

Basic building block of the mesh

Block is a cuboid with 8 points, 12 curves, 6 surfaces and 1 volume.

Axes
Y
Z X
NX, NY and NZ are negative X, Y and Z directions
Points
NZ:
P1 P0
P2 P3
Z:
P5 P4
P6 P7
Curves
X direction curves from P0 by right-hand rule:
C0: P1 -> P0
C1: P5 -> P4
C2: P6 -> P7
C3: P2 -> P3
Y direction curves from P0 by right-hand rule:
C4: P3 -> P0
C5: P2 -> P1
C6: P6 -> P5
C7: P7 -> P4
Z direction curves from P0 by right-hand rule:
C8: P0 -> P4
C9: P1 -> P5
C10: P2 -> P6
C11: P3 -> P7
Surfaces
NX surface
S0: C5 -> C9 -> -C6 -> -C10
X surface
S1: -C4 -> C11 -> C7 -> -C8
NY surface
S2: -C3 -> C10 -> C2 -> -C11
Y surface
S3: C0 -> C8 -> -C1 -> -C9
NZ surface
S4: -C0 -> -C5 -> C3 -> C4
Z surface
S5: C1 -> -C7 -> -C2 -> C6
Paramètres:
  • points (list of dict, list of list, list) – 8 corner points of the block

  • curves (list of dict, list of list, list, list of Curve) – 12 edge curves of the block

  • surfaces (list of dict, list of list, list, list of Surface) – 6 boundary surfaces of the block

  • volume (list of dict, list of list, list, list of Volume) – volumes of the block (1 by now, TODO several volumes)

  • do_register (bool or int) – register Block in the registry

  • do_unregister (bool) – unregister Block from the registry

  • do_register_children (bool) – invoke register for children

  • do_unregister_children (bool) – invoke unregister for children 0 - not unregister 1 - unregister in any case if you are owner 2 - decide to unregister by all owners 3 - decide to unregister by all members

  • transforms (list of dict, list of list, list of Transform) – points and curves points transforms (Translation, Rotation, Coordinate Change, etc)

  • do_quadrate (list of dict, bool) – transform triangles to quadrangles for surfaces and tetrahedra to hexahedra for volumes

  • structure (list of dict, list of list, list of Transform) – make structured mesh instead of unstructured by some rule

  • parent (Block) – parent of the Block

  • children (list of Block) – children of the Block

  • children_transforms (list of list of dict, list of list of list, list of list of Transform) – transforms for children Blocks

  • boolean_level (int) – Block boolean level, if the Block level > another Block level, then intersected volume joins to the Block, if levels are equal third Block is created, if None - don’t do boolean

curves_points = [[1, 0], [5, 4], [6, 7], [2, 3], [3, 0], [2, 1], [6, 5], [7, 4], [0, 4], [1, 5], [2, 6], [3, 7]]
surfaces_curves = [[5, 9, 6, 10], [4, 11, 7, 8], [10, 2, 11, 3], [0, 8, 1, 9], [0, 5, 3, 4], [7, 2, 6, 1]]
surfaces_curves_signs = [None, None, None, None, None, None]
static parse_points(points)
static parse_curves(curves)
static parse_surfaces(surfaces)
static parse_volumes(volumes)
static parse_transforms(transforms, parent)
static parse_structure(structure, do_structure)
static parse_do_quadrate(do_quadrate)
static parse_zone(zone)
static parse_structure_type(structure_type)

Parse structure type

# https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/Mesh/meshGRegionTransfinite.cpp

Transfinite surface meshes

s4 +—–c3—–+ s3
c4 c2

s1 +—–c1—–+ s2

f(u,v) = (1-u) c4(v) + u c2(v) + (1-v) c1(u) + v c3(u) - [ (1-u)(1-v) s1 + u(1-v) s2 + uv s3 + (1-u)v s4 ]

Transfinite volume meshes

a0 s0 s1 f0 s0 s1 s5 s4 s6

s7 s6 a1 s1 s2 f1 s1 s2 s6 s5 *

——- a2 s3 s2 f2 s3 s2 s6 s7 /| |\s4 |\ a3 s0 s3 f3 s0 s3 s7 s4 / | | *-------* s5 a4 s4 s5 f4 s0 s1 s2 s3 s7/s4/ |s2 | | s2| | a5 s5 s6 f5 s4 s5 s6 s7 —* s5

s3 -|—– | a6 s7 s6 | / |
| | a7 s4 s7 | / |

——- a8 s0 s4 |/ |

v w s0 s1 a9 s1 s5 ——-
| a10 s2 s6 v w s3/s0 s1
*–u a11 s3 s7 |

*–u

TODO How to create other types? (RLL, LRL, LLR, RRR)

Tried to rotate volume_points = [0, 1, 2, 3, 4, 5, 6, 7] # LLL volume_points = [1, 2, 3, 0, 5, 6, 7, 4] # LRR volume_points = [2, 3, 0, 1, 6, 7, 4, 5] # RRL volume_points = [3, 0, 1, 2, 7, 4, 5, 6] # RLR Tried to swap top and bottom volume_points = [4, 5, 6, 7, 0, 1, 2, 3] # RRL volume_points = [5, 6, 7, 4, 1, 2, 3, 0] # RLR volume_points = [6, 7, 4, 5, 2, 3, 0, 1] # LLL volume_points = [7, 4, 5, 6, 3, 0, 1, 2] # LRR Tried to reverse volume_points = [3, 2, 1, 0, 7, 6, 5, 4] # RLR volume_points = [0, 3, 2, 1, 4, 7, 6, 5] # LLL volume_points = [1, 0, 3, 2, 5, 4, 7, 6] # LRR volume_points = [2, 1, 0, 3, 6, 5, 4, 7] # RRL Tried to swap top and bottom with reverse after volume_points = [7, 6, 5, 4, 3, 2, 1, 0] # LRR volume_points = [4, 7, 6, 5, 0, 3, 2, 1] # RRL volume_points = [5, 4, 7, 6, 1, 0, 3, 2] # RLR volume_points = [6, 5, 4, 7, 2, 1, 0, 3] # LLL

Paramètres:

structure_type (str) – LLL, LRR, LRR or RRL, L/R - Left/Right triangles arrangement of X (NX), Y (NY), Z (NZ) surfaces respectively, e.g. LRR - Left arrangement for X and NX surfaces, Right for Y and NY, Right for Z and NZ

Renvoie:

tuple of:
surfaces_arrangement (list of str): surfaces arrangement:

Left or Right (AlternateLeft and AlternateRight are incompatible with structured meshes)

surfaces_points (list of list of int): surfaces points tags

(s1, s2, s3, s4)

volume_points (list of int): volume points tags

(s0, s1, s2, s3, s4, s5, s6, s7)

Type renvoyé:

tuple

register()
add_child(child, transforms=None)
transform()
register_points()
register_curve_points()
register_curves()
register_curves_loops()
register_surfaces()
register_surfaces_loops()
register_volumes()
register_structure()
register_quadrate()
pre_unregister()
unregister()
make_tree()

Tree of blocks

Renvoie:

children of blocks

Type renvoyé:

dict

class gmsh_scripts.block.Layer(layer=None, layer_curves=None, layer_types=None, items_do_register_map=None, items_do_register_children_map=None, items_do_register_mask=None, items_do_unregister_map=None, items_do_unregister_children_map=None, items_do_unregister_boolean_map=None, items_do_quadrate_map=None, items_do_structure_map=None, items_boolean_level_map=None, items_zone=None, items_zone_map=None, items_transforms=None, items_transforms_map=None, items_self_transforms=None, items_self_transforms_map=None, items_children=None, items_children_map=None, items_children_transforms=None, items_children_transforms_map=None, points=None, curves=None, surfaces=None, volume=None, do_register=False, do_unregister=False, do_register_children=True, do_unregister_children=True, do_unregister_boolean=False, transforms=None, self_transforms=None, do_quadrate=False, do_structure=True, structure=None, structure_type='LLL', zone=None, parent=None, children=None, children_transforms=None, boolean_level=None, path=None)

Bases: gmsh_scripts.block.matrix.Matrix

Matrix

Args:

static parse_layers_map(old_layers, n2o_l2l_l2l, default=None)
static parse_layers_block_map(m, default, new2old, item_types=())
static parse_layers_block_mask(m, default, new2old, item_types=())
static get_layers_curves(parsed_layers_curves, parsed_g2l_b2b_l2l, parsed_layers_coordinates)

Parse layers curves

Paramètres:
  • parsed_layers_curves (list of list) – curves of layers

  • parsed_g2l_b2b_l2l (dict) – local index of a block of the matrix to local index of a block of the parsed layer

  • parsed_layers_coordinates (list of list) – layers

Renvoie:

curves (list) curves map of the matrix (list)

Type renvoyé:

tuple

static get_structure_type(parsed_g2l_b2b_l2l)
class gmsh_scripts.block.Matrix(matrix=None, items_curves=None, items_curves_map=None, items_do_register_map=None, items_do_register_children_map=None, items_do_unregister_map=None, items_do_unregister_children_map=None, items_do_unregister_boolean_map=None, items_transforms=None, items_transforms_map=None, items_self_transforms=None, items_self_transforms_map=None, items_do_quadrate_map=None, items_do_structure_map=None, items_structure_type=None, items_structure_type_map=None, items_zone=None, items_zone_map=None, items_boolean_level_map=None, items_children=None, items_children_map=None, items_children_transforms=None, items_children_transforms_map=None, points=None, curves=None, surfaces=None, volume=None, do_register=False, do_register_children=True, do_unregister=False, do_unregister_children=True, do_unregister_boolean=False, transforms=None, self_transforms=None, do_quadrate=False, do_structure=True, structure=None, structure_type='LLL', zone=None, boolean_level=None, path=None, parent=None, children=None, children_transforms=None)

Bases: gmsh_scripts.block.block.Block

Matrix

Args:

static evaluate_items_values(values, b2ids, gm=0.0, gs=None, gcs='Cartesian')
static parse_matrix_items_map(m, default, new2old, item_types=(bool, str, int, float))