-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add EllipticArc Module #112
Conversation
This looks like a useful addition. It supersedes the CircularArc curve. The CircularArc module could be removed if another constructor with only those parameters needed for a circle is added to this class. Discussion is needed on that, since there would be no point in having both in the long run. At first glance, the new code looks clean and tidy. |
I can work with Garrett to put a generic together for this. Would you want to support both keys in the control file for backwards compatibility? |
@fluidnumerics-joe Thanks. Yes, both keys should be allowed in the control file, just which constructor is called (and the data type) is all that would be needed to be changed, and we'd have backward compatibility (very important). |
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 for adding this new curve class! I left a few (mainly cosmetic) suggestions.
Benchmarks/TestGeneratorControlFiles/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Benchmarks/TestGeneratorControlFiles/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Benchmarks/TestGeneratorControlFiles/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Examples/2D/RotatedEllipseWithSubregions/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Examples/2D/RotatedEllipseWithSubregions/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Examples/2D/RotatedEllipseWithSubregions/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Examples/2D/RotatedEllipseWithSubregions/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Co-authored-by: Andrew Winters <[email protected]>
Co-authored-by: Andrew Winters <[email protected]>
Co-authored-by: Andrew Winters <[email protected]>
…ons.control Co-authored-by: Andrew Winters <[email protected]>
…ons.control Co-authored-by: Andrew Winters <[email protected]>
…ons.control Co-authored-by: Andrew Winters <[email protected]>
…ons.control Co-authored-by: Andrew Winters <[email protected]>
…regions.control Co-authored-by: Andrew Winters <[email protected]>
…regions.control Co-authored-by: Andrew Winters <[email protected]>
…regions.control Co-authored-by: Andrew Winters <[email protected]>
…regions.control Co-authored-by: Andrew Winters <[email protected]>
Thanks for the corrections. Yes, the rotation is now considered for the exact solution in the test. Benchmark was added to the correct directory as well. (For posterity, I will also note that the flag is Separate initializers for |
What you have works just fine as it is. I thought about the two "import" routines and don't see any reason to change that. One could be clever with arrays of strings and accessing them according to the type, but that's just not worth doing. So I'm good! |
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.
Just a few final small suggestions. I added an updated figure link such that we can remove the need to add the Allfeatures.png
file from the docs
folder.
Benchmarks/TestGeneratorControlFiles/RotatedEllipseWithSubregions.control
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
+ Coverage 74.88% 75.05% +0.16%
==========================================
Files 68 68
Lines 10429 10519 +90
Branches 2 2
==========================================
+ Hits 7810 7895 +85
- Misses 2619 2624 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@andrewwinters5000 Thanks for the catches. Makes perfect sense with the AllFeatures image. Is there an expected way to test for |
You would do these in the TestCurves subroutine. Once you set up either the ellipse or the circle you can call the tangent routine and compare the result to the exact. I'm not sure that the initDefaultEllipse serves any purpose, TBH, and I think it can be eliminated, but if you keep it you can call it to init an ellipse and then immediately destruct it. Note that normally the initDefaultXXX would call the "designated initializer", which is "the initializer with the most arguments" i.e. `initWithParametersNameAndID_SMEllipticArc' with a set of default parameters. As for the print routine, I put that in for debugging purposes long ago... it has no useful purpose beyond that so those routines have not been tested. But to test one would open a STATUS='SCRATCH' file and write to that unit and then read it in and see if what is there is correct. But like I said, none of those have been tested for any of the classes. This code was written before testing, and the testing framework was written post code, so tests have been added after the fact as we go along. |
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 @garrettbyrd ! Everything looks good from my side of things. The testing you have added looks good and exercises most of the relevant code.
All sounds good. I went ahead and eliminated All of this to say, as for the |
Looks like it passes the tests. I need to look at the documentation to make sure that's up to date (I think Andrew did that) and if so, then I am good to go. I'll be back... |
Ah, I think you misunderstood the print test. The print argument takes the unit to which the print will be written. So you shouldn't have changed the printDescription routines, but rather open the scratch unit in the test routine and pass that unit number to printDescription. |
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.
Everything look good to me with respec to the features and testing. Just a point of clarification. For existing control files, as long as one replaces the keyword "Arc" with "Circular Arc" then the appropriate constructor will be called, right? I am looking toward updating the Julia front end to add this new functionality while maintaining backwards compatibility.
Updated the control file grammar in the comments. Added the keywords used to construct an elliptic arc, etc.
The control key for a circle hasn't changed. There are two now: Then you can either use the old block as before (backward compatibility) for the circle, or the new one for the ellipse. I have updated the comments in the header of the control file reader with all the keywords. |
Move the scratch iUnit open to test routine out of the printDescription procedure.
I moved the opening of the scratch files into the test procedure and out of printDescription and updated the comments in SMModel for the new control block for the elliptic curve. The tests run with sufficient coverage now. |
Use newunit to generate an unused file unit. Remove extraneous lines in TestPrintDescription
Fix SAVEd bug introduced in last commit.
Excellent. Thanks for the test cleanup. |
This PR implements an
EllipticArc
module that is used to generate elliptic curves. It behaves similarly to theCircularArc
module, except that it requiresxRadius
,yRadius
, (for major and minor axes) and optionalrotation
parameters.An example has been included, and the documentation has also been updated. Any usage of "Arc" in the previous documentation has been relabeled as "Circular Arc" for clarity.
Below is a visualization of the region produced from
Examples/2D/RotatedEllipseWithSubregions/RotatedEllipseWithSubregions.control
: