mesh.Mesh.connect#

classmethod Mesh.connect(meshlist, div=1, degree=1, loop=False, fix=True, eltype=None)#

Connect a sequence of topologically congruent Meshes into a hypermesh.

Parameters#

meshlist: list of Mesh

All Mesh objects must have the same element type. The Coords objects of these Meshes should have the exact same shape.

degree: int

The degree of the connection. Currently only degree 1 and 2 are supported:

  • If degree is 1, this results in hyperelements of a linear degree in the connection direction.

  • If degree is 2, quadratic hyperelements are created from one Mesh item and the next two in the list. Note that all Mesh items should contain the same number of nodes, even for higher order elements where the intermediate planes contain less nodes.

loop: bool, optional

If True, the connections will loop around the list and connect back to the first. This is accomplished by adding the first Mesh item back at the end of the list.

div: seed

This parameter can only be used for degree==1.

With this parameter the generated connections can be further subdivided along the connection direction. div can be any of the values accepted by smartSeed(), or a list thereof. In the latter case, the length of the list should be one less than the length of the meshlist. Each pair of consecutive items from the coordinate list will be connected using the seeds generated by the corresponding value from div, passed to smartSeed().

If seed values are specified directly as a list of floats, the list should start with a value 0.0 and end with 1.0.

fix: bool

If True (default), elements with negative volumes are automatically corrected after connecting the meshes. This is done by calling fix_volumes(), which reverses the orientation of elements that have negative volume to ensure positive volume.

eltype: str or ElementType, optional

The element type of the constructed hypermesh. Normally, this is set automatically from the base element type and the connection degree. If a different element type is specified, a final conversion to the requested element type is attempted (using convert()).

Returns#

Mesh

The hypermesh obtained by connecting consecutive slices of the meshes in meshlist.

Examples#

>>> M1 = Mesh(eltype='line2')
>>> M2 = M1.translate([0.0, 1.0, 0.0])
>>> quad = Mesh.connect([M1,M2], div=2)
>>> print(quad.report(full=True))
Mesh: n_nodes: 6, n_elems: 2, plexitude: 4, level: 2, eltype: quad4
  BBox: [0. 0. 0.], [1. 1. 0.]
  Size: [1. 1. 0.]
  Length: 4.0  Area: 1.0
  Coords: [[0.  0.  0. ]
           [1.  0.  0. ]
           [0.  0.5 0. ]
           [1.  0.5 0. ]
           [0.  1.  0. ]
           [1.  1.  0. ]]
  Elems: [[0 1 3 2]
          [2 3 5 4]]
>>> tri = Mesh.connect([M1,M2], div=2, eltype='tri3')
>>> print(tri.elems)
[[0 1 3]
 [3 2 0]
 [2 3 5]
 [5 4 2]]
>>> M3 = M1.translate([0.0, 2.0, 0.0])
>>> quad2 = Mesh.connect([M1,M2,M3], div=[1,2])
>>> print(quad2.report(full=True))
Mesh: n_nodes: 8, n_elems: 3, plexitude: 4, level: 2, eltype: quad4
  BBox: [0. 0. 0.], [1. 2. 0.]
  Size: [1. 2. 0.]
  Length: 6.0  Area: 2.0
  Coords: [[0.  0.  0. ]
           [1.  0.  0. ]
           [0.  1.  0. ]
           [1.  1.  0. ]
           [0.  1.5 0. ]
           [1.  1.5 0. ]
           [0.  2.  0. ]
           [1.  2.  0. ]]
  Elems: [[0 1 3 2]
          [2 3 5 4]
          [4 5 7 6]]