-
Notifications
You must be signed in to change notification settings - Fork 137
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
FEAT: refactoring and implementation to export C matrix #5768
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5768 +/- ##
==========================================
+ Coverage 81.10% 84.77% +3.67%
==========================================
Files 157 157
Lines 61664 61687 +23
==========================================
+ Hits 50010 52296 +2286
+ Misses 11654 9391 -2263 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good @gmalinve :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the feature and the documentation changes.
Could you update the PR description and also raise Exception instead of logging and returning False ?
SOLUTIONS.Maxwell2d.EddyCurrentZ, | ||
SOLUTIONS.Maxwell3d.EddyCurrent, | ||
]: | ||
self.logger.error("RL Matrix can only be exported if solution type is Eddy Current.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you raise an exception here ?
if not matrix_names_list: | ||
self.logger.error("Matrix list is empty, can't export a valid matrix.") | ||
return False | ||
elif matrix_name not in matrix_names_list: | ||
self.logger.error("Matrix name doesn't exist, provide and existing matrix name.") | ||
return False | ||
|
||
if os.path.splitext(output_file)[1] != ".txt": | ||
self.logger.error("File extension must be .txt") | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here (x3)
SOLUTIONS.Maxwell2d.ElectroStaticZ, | ||
SOLUTIONS.Maxwell3d.ElectroStatic, | ||
]: | ||
AEDTRuntimeError("C Matrix can only be exported if solution type is Electrostatic.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AEDTRuntimeError("C Matrix can only be exported if solution type is Electrostatic.") | |
raise AEDTRuntimeError("C Matrix can only be exported if solution type is Electrostatic.") |
if not matrix_names_list: | ||
self.logger.error("Matrix list is empty, can't export a valid matrix.") | ||
return False | ||
elif matrix_name not in matrix_names_list: | ||
self.logger.error("Matrix name doesn't exist, provide and existing matrix name.") | ||
return False | ||
|
||
if os.path.splitext(output_file)[1] != ".txt": | ||
self.logger.error("File extension must be .txt") | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x3
self.logger.error("Invalid matrix type. It has to be either 'RL' or 'C'.") | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again
except Exception: | ||
self.logger.error("Solutions are empty. Solve before exporting.") | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do except Exception as e:
and then raise AEDTRuntimeError(...) from e
?
And the same for other places ?
Description
Please provide a brief description of the changes made in this pull request.
Issue linked
Please mention the issue number or describe the problem this pull request addresses.
Checklist