Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Update CoordinateMapping interface for normals/tangents #230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tsfc/fem.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,19 @@ def detJ_at(self, point):
context = PointSetContext(**config)
return map_expr_dag(context.translator, expr)

def reference_normals(self):
def reference_normals(self, normalized=True):
if not (isinstance(self.interface.fiat_cell, UFCSimplex) and
self.interface.fiat_cell.get_spatial_dimension() == 2):
raise NotImplementedError("Only works for triangles for now")
return gem.Literal(numpy.asarray([self.interface.fiat_cell.compute_normal(i) for i in range(3)]))
cn = (self.interface.fiat_cell.compute_normal if normalized
else self.interface.fiat_cell.compute_scaled_normal)
return gem.Literal(numpy.asarray([cn(i) for i in range(3)]))

def reference_edge_tangents(self):
return gem.Literal(numpy.asarray([self.interface.fiat_cell.compute_edge_tangent(i) for i in range(3)]))
def reference_edge_tangents(self, normalized=False):
ct = (self.interface.fiat_cell.compute_normalized_edge_tangent
if normalized else self.interface.fiat_cell.compute_edge_tangent)

return gem.Literal(numpy.asarray([ct(i) for i in range(3)]))

def physical_tangents(self):
if not (isinstance(self.interface.fiat_cell, UFCSimplex) and
Expand Down