Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tdim mapping input #238

Merged
merged 5 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG_SINCE_LAST_VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove tdim input from mappings functions
2 changes: 1 addition & 1 deletion symfem/finite_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def map_to_cell(
for ds in dofs_by_type.values():
mapped_dofs = self.dofs[ds[0]].perform_mapping(
[basis[d] for d in ds],
forward_map, inverse_map, self.reference.tdim)
forward_map, inverse_map)
for d_n, mdof in zip(ds, mapped_dofs):
functions[d_n] = mdof

Expand Down
23 changes: 9 additions & 14 deletions symfem/functionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,20 @@ def entity_number(self) -> int:
return self.entity[1]

def perform_mapping(
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType, tdim: int
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType
) -> typing.List[AnyFunction]:
"""Map functions to a cell.

Args:
fs: functions
map: Map from the reference cell to a physical cell
inverse_map: Map to the reference cell from a physical cell
tdim: The topological dimension of the cell

Returns:
Mapped functions
"""
assert self.mapping is not None
return [getattr(mappings, self.mapping)(f, map, inverse_map, tdim) for f in fs]
return [getattr(mappings, self.mapping)(f, map, inverse_map) for f in fs]

def entity_tex(self) -> str:
"""Get the entity the DOF is associated with in TeX format.
Expand Down Expand Up @@ -387,15 +386,14 @@ def adjusted_dof_point(self) -> PointType:
return self.dof_point()

def perform_mapping(
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType, tdim: int
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType
) -> typing.List[AnyFunction]:
"""Map functions to a cell.

Args:
fs: functions
map: Map from the reference cell to a physical cell
inverse_map: Map to the reference cell from a physical cell
tdim: The topological dimension of the cell

Returns:
Mapped functions
Expand Down Expand Up @@ -882,15 +880,13 @@ def __init__(self, reference: Reference, f_in: FunctionInput,
assert len(f) == self.integral_domain.tdim
self.f = mappings.contravariant(
f, self.integral_domain.get_map_to_self(),
self.integral_domain.get_inverse_map_to_self(),
self.integral_domain.tdim)
self.integral_domain.get_inverse_map_to_self())
elif f.is_matrix:
assert f.shape[0] == self.integral_domain.tdim
assert f.shape[1] == self.integral_domain.tdim
self.f = mappings.double_contravariant(
f, self.integral_domain.get_map_to_self(),
self.integral_domain.get_inverse_map_to_self(),
self.integral_domain.tdim)
self.integral_domain.get_inverse_map_to_self())
else:
self.f = f

Expand Down Expand Up @@ -1078,15 +1074,14 @@ def _eval_symbolic(self, function: AnyFunction) -> AnyFunction:
return integrand.integral(self.integral_domain)

def perform_mapping(
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType, tdim: int
self, fs: typing.List[AnyFunction], map: PointType, inverse_map: PointType
) -> typing.List[AnyFunction]:
"""Map functions to a cell.

Args:
fs: functions
map: Map from the reference cell to a physical cell
inverse_map: Map to the reference cell from a physical cell
tdim: The topological dimension of the cell

Returns:
Mapped functions
Expand Down Expand Up @@ -1155,13 +1150,13 @@ def __init__(self, reference: Reference,
if self.f.is_vector and len(self.f) != reference.gdim:
self.f = mappings.contravariant(
self.f, id_def.get_map_to_self(),
id_def.get_inverse_map_to_self(), id_def.tdim)
id_def.get_inverse_map_to_self())
elif self.f.is_matrix:
assert self.f.shape[0] == id_def.tdim
assert self.f.shape[1] == id_def.tdim
self.f = mappings.double_contravariant(
self.f, id_def.get_map_to_self(),
id_def.get_inverse_map_to_self(), id_def.tdim)
id_def.get_inverse_map_to_self())

# Map from default reference to reference
if map_function and reference != reference.default_reference():
Expand All @@ -1170,7 +1165,7 @@ def __init__(self, reference: Reference,
mf = getattr(mappings, f"{mapping}_inverse_transpose")
self.f = mf(self.f, reference.get_map_to_self(),
reference.get_inverse_map_to_self(),
reference.tdim, substitute=False)
substitute=False)
self.f *= id_def.volume() / self.integral_domain.volume()

def _eval_symbolic(self, function: AnyFunction) -> AnyFunction:
Expand Down
Loading
Loading