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

Quadric surface small fixes #18

Merged
merged 3 commits into from
Nov 22, 2024
Merged
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
15 changes: 7 additions & 8 deletions src/openmc_cad_adapter/gqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def characterize_general_quadratic( surface ): #s surface
else:
delta = -1 if det_Ac < 0 else 1

eigen_results = np.linalg.eig(Aa)
signs = np.array([ 0, 0, 0 ])
for i in range( 0, 3 ):
if eigen_results.eigenvalues[ i ] > -1 * gq_tol:
eigenvalues, eigenvectors = np.linalg.eig(Aa)
signs = np.array([0, 0, 0])
for i in range(0, 3):
if eigenvalues[i] > -1 * gq_tol:
signs[i] = 1
else:
signs[i] = -1
Expand All @@ -58,7 +58,7 @@ def characterize_general_quadratic( surface ): #s surface

Aai = np.linalg.pinv( Aa )

C = Aai * B
C = np.dot(Aai, B)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good good catch. Thank you


dx = C[0]
dy = C[1]
Expand All @@ -69,7 +69,7 @@ def characterize_general_quadratic( surface ): #s surface
K_ = K_[0]

if rank_Aa == 2 and rank_Ac == 3 and S == 1:
delta = -1 if K_ * signs[0] else 1
delta = -1 if K_ * signs[0] < 0 else 1

D = -1 if K_ * signs[0] else 1

Expand Down Expand Up @@ -113,8 +113,7 @@ def find_type( rAa, rAc, delta, S, D ):
#set the translation
translation = C

rotation_matrix = eigen_results.eigenvectors
eigenvalues = eigen_results.eigenvalues
rotation_matrix = eigenvectors

for i in range( 0, 3 ):
if abs(eigenvalues[i]) < gq_tol:
Expand Down
Loading