topoptlab.voigt module
- topoptlab.voigt.from_voigt(A_v: ndarray, eng_conv: bool = False) ndarray[source]
Convert 2nd rank tensor into from its Voigt representation to the standard matrix represenation.
- Parameters:
A_v (np.ndarray) – 2nd rank tensor in Voigt represenation (so a column vector) shape (…,(ndim**2 + ndim) /2).
eng_conv (bool) – if True, engineering convention is applied meaning the shear components are scaled by a factor of two in Voigt notation. Usually applies only to strains.
- Returns:
A – 2nd rank tensor in matrix notation shape (…,ndim,ndim).
- Return type:
np.ndarray
- topoptlab.voigt.to_voigt(A: ndarray, eng_conv: bool = False) ndarray[source]
Convert 2nd rank tensor into from the standard matrix represenation to its Voigt representation.
- Parameters:
A (np.ndarray) – 2nd rank tensor in matrix represenation shape (…,ndim, ndim).
eng_conv (bool) – if True, engineering convention is applied meaning the shear components are scaled by a factor of two in Voigt notation. Usually applies only to strains.
- Returns:
A_v – 2nd rank tensor in Voigt notation shape (…,(ndim**2 + ndim) /2).
- Return type:
np.ndarray
- topoptlab.voigt.voigt_index(i: ndarray, j: ndarray, ndim: int) ndarray[source]
Map tensor index pairs (i,j) to Voigt indices for arbitrary dimension.
- Parameters:
i (int or np.ndarray) – first tensor index (1-based).
j (int or np.ndarray) – second tensor index (1-based).
ndim (int) – spatial dimension.
- Returns:
alpha – Voigt index/indices (0-based).
- Return type:
np.ndarray
- topoptlab.voigt.voigt_pair(alpha: ndarray, ndim: int) Tuple[ndarray, ndarray][source]
Map Voigt indices back to tensor index pairs (i,j),
- Parameters:
alpha (int or np.ndarray) – Voigt index/indices (0-based).
ndim (int) – spatial dimension.
- Returns:
i (np.ndarray) – first tensor index (0-based).
j (np.ndarray) – second tensor index (0-based).