Skip to content

Commit

Permalink
removed commented section
Browse files Browse the repository at this point in the history
  • Loading branch information
Olender committed Oct 18, 2024
1 parent 1206087 commit 9702d81
Showing 1 changed file with 18 additions and 288 deletions.
306 changes: 18 additions & 288 deletions spyro/receivers/changing_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,9 @@ def change_to_reference_quad(p, cell_vertices):
return (pnx, pny)


def change_to_reference_hexa(p, cell_vertices):
def change_to_reference_hexa(p, cell_vertices, based_on_extruded=True):
"""
Changes variables to reference hexahedron
Changes variables to reference hexahedron.
Parameters
----------
p : tuple
Expand All @@ -475,292 +474,23 @@ def change_to_reference_hexa(p, cell_vertices):
tuple
Point location in reference hexahedron
"""
a = cell_vertices[0]
b = cell_vertices[1]
c = cell_vertices[2]
d = cell_vertices[4]

ra = (0.0, 0.0, 0.0)
rb = (0.0, 0.0, 1.0)
rc = (0.0, 1.0, 0.0)
rd = (1.0, 0.0, 0.0)
if based_on_extruded:
a = cell_vertices[0]
b = cell_vertices[1]
c = cell_vertices[2]
d = cell_vertices[4]

reference_coordinates = [ra, rb, rc, rd]
tet_cell_vertices = [a, b, c, d]
ra = (0.0, 0.0, 0.0)
rb = (0.0, 0.0, 1.0)
rc = (0.0, 1.0, 0.0)
rd = (1.0, 0.0, 0.0)

return change_to_reference_tetrahedron(
p, tet_cell_vertices, reference_coordinates=reference_coordinates
)
reference_coordinates = [ra, rb, rc, rd]
tet_cell_vertices = [a, b, c, d]

# det = (
# xa * yb * zc
# - xa * yc * zb
# - xb * ya * zc
# + xb * yc * za
# + xc * ya * zb
# - xc * yb * za
# - xa * yb * zd
# + xa * yd * zb
# + xb * ya * zd
# - xb * yd * za
# - xd * ya * zb
# + xd * yb * za
# + xa * yc * zd
# - xa * yd * zc
# - xc * ya * zd
# + xc * yd * za
# + xd * ya * zc
# - xd * yc * za
# - xb * yc * zd
# + xb * yd * zc
# + xc * yb * zd
# - xc * yd * zb
# - xd * yb * zc
# + xd * yc * zb
# )
# a11 = (
# (xnc * (ya * zb - yb * za - ya * zd + yd * za + yb * zd - yd * zb))
# / det
# - (xnd * (ya * zb - yb * za - ya * zc + yc * za + yb * zc - yc * zb))
# / det
# - (xnb * (ya * zc - yc * za - ya * zd + yd * za + yc * zd - yd * zc))
# / det
# + (xna * (yb * zc - yc * zb - yb * zd + yd * zb + yc * zd - yd * zc))
# / det
# )
# a12 = (
# (xnd * (xa * zb - xb * za - xa * zc + xc * za + xb * zc - xc * zb))
# / det
# - (xnc * (xa * zb - xb * za - xa * zd + xd * za + xb * zd - xd * zb))
# / det
# + (xnb * (xa * zc - xc * za - xa * zd + xd * za + xc * zd - xd * zc))
# / det
# - (xna * (xb * zc - xc * zb - xb * zd + xd * zb + xc * zd - xd * zc))
# / det
# )
# a13 = (
# (xnc * (xa * yb - xb * ya - xa * yd + xd * ya + xb * yd - xd * yb))
# / det
# - (xnd * (xa * yb - xb * ya - xa * yc + xc * ya + xb * yc - xc * yb))
# / det
# - (xnb * (xa * yc - xc * ya - xa * yd + xd * ya + xc * yd - xd * yc))
# / det
# + (xna * (xb * yc - xc * yb - xb * yd + xd * yb + xc * yd - xd * yc))
# / det
# )
# a14 = (
# (
# xnd
# * (
# xa * yb * zc
# - xa * yc * zb
# - xb * ya * zc
# + xb * yc * za
# + xc * ya * zb
# - xc * yb * za
# )
# )
# / det
# - (
# xnc
# * (
# xa * yb * zd
# - xa * yd * zb
# - xb * ya * zd
# + xb * yd * za
# + xd * ya * zb
# - xd * yb * za
# )
# )
# / det
# + (
# xnb
# * (
# xa * yc * zd
# - xa * yd * zc
# - xc * ya * zd
# + xc * yd * za
# + xd * ya * zc
# - xd * yc * za
# )
# )
# / det
# - (
# xna
# * (
# xb * yc * zd
# - xb * yd * zc
# - xc * yb * zd
# + xc * yd * zb
# + xd * yb * zc
# - xd * yc * zb
# )
# )
# / det
# )
# a21 = (
# (ync * (ya * zb - yb * za - ya * zd + yd * za + yb * zd - yd * zb))
# / det
# - (ynd * (ya * zb - yb * za - ya * zc + yc * za + yb * zc - yc * zb))
# / det
# - (ynb * (ya * zc - yc * za - ya * zd + yd * za + yc * zd - yd * zc))
# / det
# + (yna * (yb * zc - yc * zb - yb * zd + yd * zb + yc * zd - yd * zc))
# / det
# )
# a22 = (
# (ynd * (xa * zb - xb * za - xa * zc + xc * za + xb * zc - xc * zb))
# / det
# - (ync * (xa * zb - xb * za - xa * zd + xd * za + xb * zd - xd * zb))
# / det
# + (ynb * (xa * zc - xc * za - xa * zd + xd * za + xc * zd - xd * zc))
# / det
# - (yna * (xb * zc - xc * zb - xb * zd + xd * zb + xc * zd - xd * zc))
# / det
# )
# a23 = (
# (ync * (xa * yb - xb * ya - xa * yd + xd * ya + xb * yd - xd * yb))
# / det
# - (ynd * (xa * yb - xb * ya - xa * yc + xc * ya + xb * yc - xc * yb))
# / det
# - (ynb * (xa * yc - xc * ya - xa * yd + xd * ya + xc * yd - xd * yc))
# / det
# + (yna * (xb * yc - xc * yb - xb * yd + xd * yb + xc * yd - xd * yc))
# / det
# )
# a24 = (
# (
# ynd
# * (
# xa * yb * zc
# - xa * yc * zb
# - xb * ya * zc
# + xb * yc * za
# + xc * ya * zb
# - xc * yb * za
# )
# )
# / det
# - (
# ync
# * (
# xa * yb * zd
# - xa * yd * zb
# - xb * ya * zd
# + xb * yd * za
# + xd * ya * zb
# - xd * yb * za
# )
# )
# / det
# + (
# ynb
# * (
# xa * yc * zd
# - xa * yd * zc
# - xc * ya * zd
# + xc * yd * za
# + xd * ya * zc
# - xd * yc * za
# )
# )
# / det
# - (
# yna
# * (
# xb * yc * zd
# - xb * yd * zc
# - xc * yb * zd
# + xc * yd * zb
# + xd * yb * zc
# - xd * yc * zb
# )
# )
# / det
# )
# a31 = (
# (znc * (ya * zb - yb * za - ya * zd + yd * za + yb * zd - yd * zb))
# / det
# - (znd * (ya * zb - yb * za - ya * zc + yc * za + yb * zc - yc * zb))
# / det
# - (znb * (ya * zc - yc * za - ya * zd + yd * za + yc * zd - yd * zc))
# / det
# + (zna * (yb * zc - yc * zb - yb * zd + yd * zb + yc * zd - yd * zc))
# / det
# )
# a32 = (
# (znd * (xa * zb - xb * za - xa * zc + xc * za + xb * zc - xc * zb))
# / det
# - (znc * (xa * zb - xb * za - xa * zd + xd * za + xb * zd - xd * zb))
# / det
# + (znb * (xa * zc - xc * za - xa * zd + xd * za + xc * zd - xd * zc))
# / det
# - (zna * (xb * zc - xc * zb - xb * zd + xd * zb + xc * zd - xd * zc))
# / det
# )
# a33 = (
# (znc * (xa * yb - xb * ya - xa * yd + xd * ya + xb * yd - xd * yb))
# / det
# - (znd * (xa * yb - xb * ya - xa * yc + xc * ya + xb * yc - xc * yb))
# / det
# - (znb * (xa * yc - xc * ya - xa * yd + xd * ya + xc * yd - xd * yc))
# / det
# + (zna * (xb * yc - xc * yb - xb * yd + xd * yb + xc * yd - xd * yc))
# / det
# )
# a34 = (
# (
# znd
# * (
# xa * yb * zc
# - xa * yc * zb
# - xb * ya * zc
# + xb * yc * za
# + xc * ya * zb
# - xc * yb * za
# )
# )
# / det
# - (
# znc
# * (
# xa * yb * zd
# - xa * yd * zb
# - xb * ya * zd
# + xb * yd * za
# + xd * ya * zb
# - xd * yb * za
# )
# )
# / det
# + (
# znb
# * (
# xa * yc * zd
# - xa * yd * zc
# - xc * ya * zd
# + xc * yd * za
# + xd * ya * zc
# - xd * yc * za
# )
# )
# / det
# - (
# zna
# * (
# xb * yc * zd
# - xb * yd * zc
# - xc * yb * zd
# + xc * yd * zb
# + xd * yb * zc
# - xd * yc * zb
# )
# )
# / det
# )

# pnx = px * a11 + py * a12 + pz * a13 + a14
# pny = px * a21 + py * a22 + pz * a23 + a24
# pnz = px * a31 + py * a32 + pz * a33 + a34

# return (pnx, pny, pnz)
return change_to_reference_tetrahedron(
p, tet_cell_vertices, reference_coordinates=reference_coordinates
)
else:
raise ValueError("Not yet implemented.")

Check warning on line 496 in spyro/receivers/changing_coordinates.py

View check run for this annotation

Codecov / codecov/patch

spyro/receivers/changing_coordinates.py#L496

Added line #L496 was not covered by tests

0 comments on commit 9702d81

Please sign in to comment.