15. connectivity — A class and functions for handling nodal connectivity.¶
This module defines a specialized array class for representing nodal connectivity. This is e.g. used in mesh models, where geometry is represented by a set of numbered points (nodes) and the geometric elements are described by refering to the node numbers. In a mesh model, points common to adjacent elements are unique, and adjacency of elements can easily be detected from common node numbers.
-
class
connectivity.Connectivity(data=[], dtyp=None, copy=False, nplex=0, eltype=None)[source]¶ A class for handling element to node connectivity.
A connectivity object is a 2-dimensional integer array with all non-negative values. Each row of the array defines an element by listing the numbers of its lower entity types. A typical use is a
Meshobject, where each element is defined in function of its nodes. While in a Mesh the word ‘node’ will normally refer to a geometrical point, here we will use ‘node’ for the lower entity whatever its nature is. It doesn’t even have to be a geometrical entity.Note
The current implementation limits a Connectivity object to numbers that are smaller than 2**31. That is however largely sufficient for all practical cases.
In a row (element), the same node number may occur more than once, though usually all numbers in a row are different. Rows containing duplicate numbers are called degenerate elements. Rows containing the same node sets, albeit different permutations thereof, are called duplicates.
- Parameters
data (int array_like) – Data to initialize the Connectivity. The data should be 2-dim with shape
(nelems,nplex), wherenelemsis the number of elements andnplexis the plexitude of the elements.dtyp (float datatype, optional) – It not provided, the datatype of
datais used.copy (bool, optional) – If True, the data are copied. The default setting will try to use the original data if possible, e.g. if
datais a correctly shaped and typednumpy.ndarray.nplex (int, optional) – The plexitude of the data. This can be specified to force a check on the plexitude of the data, or to set the plexitude for an empty Connectivity. If an
eltypeis specified, the plexitude of the element type will override this value.eltype (str or
elements.ElementTypesubclass, optional) – The element type associated with the Connectivity. It can be either a subclass of:class:elements.ElementType or thenameof such a subclass. If not provided, a non-typed Connectivity will result.
- Raises
ValueError – If
nplexis provided and the specifieddatado not match the specified plexitude.
Notes
The Connectivity class has no knowledge about the geometrical meaning of the element types. In most cases the use of its subclass
Elemsis therefore more appropriate.Empty Connectivities with
nelems==0andnplex > 0can be useful, but a Connectivity withnplex==0generally is not.See also
Elemsa subclass that holds geometrical information about the element types and is used to create
Meshgeometries.
Examples
>>> Connectivity([[0,1,2],[0,1,3],[0,3,2],[0,5,3]]) Connectivity([[0, 1, 2], [0, 1, 3], [0, 3, 2], [0, 5, 3]])
>>> Connectivity(np.array([],dtype=at.Int).reshape(0,3)) Connectivity([], shape=(0, 3))