Skip to content

Commit

Permalink
implemented: Mesh.get_area()
Browse files Browse the repository at this point in the history
  • Loading branch information
leuraph committed Jan 16, 2024
1 parent a4efc50 commit db66d61
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions p1afempy/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ def get_area(self) -> np.ndarray:
"""
returns the area of each element
"""
# TODO implement
return np.zeros(self.elements.shape[0])
c1 = self.coordinates[self.elements[:, 0], :]
d21 = self.coordinates[self.elements[:, 1], :] - c1
d31 = self.coordinates[self.elements[:, 2], :] - c1

# vector of element areas 4*|T|
return 0.5 * (d21[:, 0]*d31[:, 1] - d21[:, 1] * d31[:, 0])


class BoundaryCondition:
Expand Down

0 comments on commit db66d61

Please sign in to comment.