Skip to content

Commit

Permalink
Write out logic more explicitly for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Nov 30, 2023
1 parent f5e59d6 commit 406cc55
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions aerosandbox/geometry/airfoil/airfoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,19 @@ def __eq__(self, other: "Airfoil") -> bool:
return False

# At this point, we know that the types are the same, so we can compare the attributes
return all([ # If all of these are true, they're equal
self.name == other.name,
np.allclose(self.coordinates, other.coordinates) if
self.coordinates.shape == other.coordinates.shape else False,
])
if self.name != other.name: # If the names are different, they're not equal
return False

if self.coordinates.shape != other.coordinates.shape: # If the coordinates are different shapes, they're not equal
return False

try:
return np.allclose(
self.coordinates,
other.coordinates
)
except Exception:
return False

def to_kulfan_airfoil(self,
n_weights_per_side: int = 8,
Expand Down

0 comments on commit 406cc55

Please sign in to comment.