Skip to content

Commit

Permalink
add p2e
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnala committed Apr 12, 2024
1 parent 2239115 commit 71748d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion skfem/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()

Expand Down

0 comments on commit 71748d4

Please sign in to comment.