vectors.py

Define standard vector and matrix functions.

petgem.vectors.deleteDuplicateRows(matrix)[source]

Delete duplicate rows in a matrix. :param ndarray matrix: input matrix to be processed. :return: matrix without duplicate rows :rtype: ndarray

petgem.vectors.findUniqueRows(array, return_index=False, return_inverse=False)[source]

Find unique rows of a two-dimensional numpy array. :param ndarray: array to be processed. :param bool return_index: the indices of array that result in the

unique array.

Parameters

return_inverse (bool) – indices of the unique array that can be used to reconstruct array.

Returns

unique rows.

Return type

ndarray.

petgem.vectors.invConnectivity(M, nP)[source]

This function computes the opposite connectivity matrix of M.

Parameters
  • M (ndarray) – connectivity matrix with dimensions = (nElems,eleOrder)

  • nP (int) – number of nodes/edges/faces in matrix M.

Returns

connectivity matrix with dimensions = (nNodes,S), (nEdges,S) or (nFaces,S)

Return type

ndarray.

Note

eleOrder determines the number of entities per element in matrix M, therefore 4 is the nodal element order, 6 is the edge element order and 3 is the element order of faces. S in the output is the maximum number of elements sharing a given node/edge/face

If M represents a element/nodes connectivity, the function computes a node/elements connectivity.

If M represents a element/edges connectivity, the function computes a edge/elements connectivity.

If M represents a element/faces connectivity, the function computes a faces/elements connectivity.

petgem.vectors.is_duplicate_entry(x)[source]

Compute number of duplicate entries in a vector.

Parameters

x (int-array) – matrix.

Returns

number of duplicate entries.

Return type

int.

petgem.vectors.unitary_test()[source]

Unitary test for vectors.py script.