-
Notifications
You must be signed in to change notification settings - Fork 525
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
simplify mechanism to detect if geometry entity is DAG #3269
base: develop
Are you sure you want to change the base?
Conversation
I'm on board with most of the changes here @gridley! I think you're right, the I would ask that we stick with the |
Hm, gotcha. Can you give an example where building out conditionals on the different enum cases makes more sense than a virtual method? I would think that if we sufficiently design the base classes and behaviors, you shouldn't need to toggle different behaviors at the level of the calling code. For example maybe there should just be a But maybe I'm missing an example where this truly makes sense to switch among different behaviors at the outer calling code level. Take this for example:
This is just not a great design. The universe itself should have a I asked Claude to put a name to the concerns I have here in terms of standard OOP jargon. Here is its response, which I think is pretty correct.
|
And let me add: I'd be happy to include a refactor like that as part of this PR. Ideally, we shouldn't have to check |
Sorry, I should've been more specific here. What I was asking is that the virtual method return a class Surface {
virtual GeometryType geom_type() const { return GeometryType::CSG; };
}; To answer your question more directly though, no, I don't think building out conditionals makes more sense than a virtual method (assuming that you mean a single virtual method to handle surface crossings on the Universe class), but that's not what is being implemented in the current change set and didn't seem to be proposed in the PR description. The update to an The implementation of Happy to discuss further and let me know if I missed the mark on addressing your points here.
There are a number of areas where design could be improved -- 100% agreed!! Such changes would move the PR in a rather new direction and so I'd prefer such a refactor be performed separately. It's a PR that I'd certainly support and be more than happy to review. In light of the current proposed changes focused on simplifying the inheritance and in the absence of such a refactor, I'd still prefer we keep the Thanks to Claude.ai for the input! I'll be making good use of the term "Fortran hangover" often I think. |
OK, this all makes sense then! Baby steps. I'll get your suggested way of doing it in pretty soon. |
87fb06b
to
0afc033
Compare
Hey @pshriwise, sorry to take forever to get your suggestion in. I believe the PR as it stands is fully in line with your suggestion. |
Looks like the CI fail is maybe due to some ncrystal changes that came through recently?
|
Absolutely right @pshriwise, it is related to #3274 ! I will try to add a fix for this as well to #3274 (i.e. rip out gha-install-ncrystal.sh and simply |
Description
There is a somewhat cumbersome
CSGSurface
class that does nothing aside from set a variable called geom_type. We have written accessors, stored this variable on a few types of geometry class, and defined an enum just to handle distinguishing if a surface is aDAGSurface
.Since this variable
geom_type
is only aGeometryType::DAG
if a given entity is of just one subclass type (DAGSurface
), it makes more sense to define a virtual method to handle this. Virtuals are used extensively elsewhere on these geometric entities, so this seamlessly solves the problem of checking whether a surface is a DAGSurface. This is also applied to the cell and universe classes.I ended up making these changes because I want to play with defining a new type of surface, and the distinction of
CSGSurface
didn't make any sense to me here. In fact, I would argue all surfaces here are CSG surfaces; it would be more apt to call this class aNonDAGSurface
. And of course, that would be silly. It's cleanest to just delete.Fixes # (issue)
Checklist