Skip to content

Commit

Permalink
remove comments in RestrictedFunctionSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
emmarothwell1 committed Jan 26, 2024
1 parent ad148cd commit f299232
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions firedrake/functionspaceimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,8 @@ def __init__(self, function_space, name=None, bcs=[]):
for bc in bcs:
boundary_set = boundary_set.union(set(bc.sub_domain))
self.boundary_set = frozenset(boundary_set)
super().__init__(function_space._mesh.topology, function_space.ufl_element(), function_space.name)
super().__init__(function_space._mesh.topology,
function_space.ufl_element(), function_space.name)
self.function_space = function_space
self.name = name or (function_space.name + "_"
+ "_".join(sorted(
Expand All @@ -1187,9 +1188,6 @@ def set_shared_data(self):
self.global_numbering = sdata.global_numbering

def __eq__(self, other):
# 1: check if other isInstance(RestrictedFunctionSpace)
# 2: check if self.function_space = other.function_space (__super__)
# 3: check if self.boundary_set == other.boundary_set
if not isinstance(other, RestrictedFunctionSpace):
return False
return self.function_space == other.function_space and \
Expand All @@ -1199,18 +1197,14 @@ def __ne__(self, other):
return not self.__eq__(other)

def __hash__(self):
# 1: I want to do a hash similar to before but also add bc.sub_domain
return hash((self.function_space.mesh(), self.function_space.dof_dset,
self.function_space.ufl_element(), self.boundary_set))

def __repr__(self):
# 1: Look at previous __repr__
# 2: Want to display "RestrictedFunctionSpace(FunctionSpace(), ..., bcs)"
return self.__class__.__name__ + "(%r, name=%r, bcs=%r)" % (
str(self.function_space), self.name, self.bcs)

def __str__(self):
# __str__ == __repr__
return self.__repr__()

@utils.cached_property
Expand All @@ -1222,7 +1216,6 @@ def dof_count(self):

def local_to_global_map(self, lgmap=None):
if self.bcs is None or len(self.bcs) == 0:
# Maybe raise an error here or further up in __init__ - should have at least 1 bc to be a RFS?
return lgmap or self.dof_dset.lgmap
for bc in self.bcs:
fs = bc.function_space()
Expand Down

0 comments on commit f299232

Please sign in to comment.