As seen in the previous section (Geometry), the base for the elements and the FE space is the topology (cells and mesh).
A cell (the support of the element) is combined with shape functions to form an element. Additionally, the element contains the T matrix used to assemble the local element matrix into the global matrix. When refining the element, the T matrix is adapted using the S matrices (they are also present in the element).
The basic class for the elements is spc_Element. The following classes are derived from it:
The local element matrices are assembled using the T matrices:
((AT)T T)T = TT A T
All elements together form the Finite Element space. The space consists of continuous piecewise polynomials. To enforce continuity, the T matrices in the elements have to take their neigbours into account. T matrices are implemented in spc_TMatrix in sparse notation (as most entries are zero).
This is done in the rebuild process of the space. During this process, the old space is removed and a new space is built. The first step in the rebuild process is to determine the level of refinement and the polynomial degree of each cell in the original mesh. In the same time (and hidden from the user) the topology is refined to handle this. The second step in the rebuild process is building the list of active elements in the space and for each element calculate the T matrix.
The basic class for the space is spc_Space. hp_HP2d is derived from it and represents a two dimensional hp-FE space.