diff --git a/skfem/mesh/mesh.py b/skfem/mesh/mesh.py index 9df63d8b..97d891ec 100644 --- a/skfem/mesh/mesh.py +++ b/skfem/mesh/mesh.py @@ -160,7 +160,7 @@ def p2f(self): @property def p2t(self): - """Return incidence matrix between elements and vertices.""" + """Incidence matrix between elements and vertices.""" from scipy.sparse import coo_matrix t = self.t.flatten('C') return coo_matrix( @@ -171,6 +171,13 @@ def p2t(self): dtype=np.int32, ).tocsc() + @property + def p2e(self): + """Incidence matrix between edges and vertices.""" + p2t = self.p2t + edges = self.edges + return p2t[:, edges[0]].multiply(p2t[:, edges[1]]) + def dim(self): return self.elem.refdom.dim()