mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Apply suggestions from code review
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
c88bd49597
commit
c29ffa947d
2 changed files with 6 additions and 6 deletions
|
|
@ -541,9 +541,9 @@ class PlaneMixin(metaclass=ABCMeta):
|
|||
|
||||
def rotate(self, rotation, pivot=(0., 0., 0.), order='xyz', inplace=False):
|
||||
pivot = np.asarray(pivot)
|
||||
rotation = np.asarray(rotation)
|
||||
rotation = np.asarray(rotation, dtype=float)
|
||||
|
||||
# Allow rotaiton matrix to be passed in directly, otherwise build it
|
||||
# Allow rotation matrix to be passed in directly, otherwise build it
|
||||
if rotation.ndim == 2:
|
||||
check_type('surface rotation', rotation, Iterable, Real)
|
||||
check_length('surface rotation', rotation.ravel(), 9)
|
||||
|
|
@ -1108,7 +1108,7 @@ class QuadricMixin(metaclass=ABCMeta):
|
|||
def rotate(self, rotation, pivot=(0., 0., 0.), order='xyz', inplace=False):
|
||||
# Get pivot and rotation matrix
|
||||
pivot = np.asarray(pivot)
|
||||
rotation = np.asarray(rotation)
|
||||
rotation = np.asarray(rotation, dtype=float)
|
||||
|
||||
# Allow rotaiton matrix to be passed in directly, otherwise build it
|
||||
if rotation.ndim == 2:
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ def test_plane():
|
|||
|
||||
# rotate method
|
||||
yp = openmc.YPlane(abs(s.d)/math.sqrt(s.a**2 + s.b**2 + s.c**2))
|
||||
psi = math.degrees(np.arctan2(1, 2))
|
||||
phi = math.degrees(np.arctan2(1, np.sqrt(5)))
|
||||
psi = math.degrees(math.atan2(1, 2))
|
||||
phi = math.degrees(math.atan2(1, math.sqrt(5)))
|
||||
sr = s.rotate((phi, 0., psi), order='zyx')
|
||||
assert yp.normalize() == pytest.approx(sr.normalize())
|
||||
# test rotation ordering
|
||||
phi = math.degrees(np.arctan2(1, np.sqrt(2)))
|
||||
phi = math.degrees(math.atan2(1, math.sqrt(2)))
|
||||
sr = s.rotate((0., -45., phi), order='xyz')
|
||||
assert yp.normalize() == pytest.approx(sr.normalize())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue