Source code for polymesh.cells.t3
# -*- coding: utf-8 -*-
from typing import Tuple, List
import numpy as np
from numpy import ndarray
from sympy import symbols
from ..polygon import Triangle
from ..utils.cells.gauss import Gauss_Legendre_Tri_1
from ..utils.cells.t3 import (
shp_T3_multi,
dshp_T3_multi,
shape_function_matrix_T3_multi,
monoms_T3,
)
[docs]class T3(Triangle):
"""
A class to handle 3-noded triangles.
See Also
--------
:class:`~polymesh.polygon.Triangle`
"""
shpfnc = shp_T3_multi
shpmfnc = shape_function_matrix_T3_multi
dshpfnc = dshp_T3_multi
monomsfnc = monoms_T3
quadrature = {
"full": Gauss_Legendre_Tri_1(),
}
[docs] @classmethod
def polybase(cls) -> Tuple[List]:
"""
Retruns the polynomial base of the master element.
Returns
-------
list
A list of SymPy symbols.
list
A list of monomials.
"""
locvars = r, s = symbols("r s", real=True)
monoms = [1, r, s]
return locvars, monoms
[docs] @classmethod
def lcoords(cls) -> ndarray:
"""
Returns local coordinates of the cell.
Returns
-------
numpy.ndarray
"""
return np.array([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]])
[docs] @classmethod
def lcenter(cls) -> ndarray:
"""
Returns the local coordinates of the center of the cell.
Returns
-------
numpy.ndarray
"""
return np.array([[1 / 3, 1 / 3]])