Skip to content

Conversation

@rieder
Copy link
Member

@rieder rieder commented Oct 14, 2024

Work for issue #1077

  • Change gd.py to a module for flexibility
  • Create a "GravitationalDynamics64Interface" that inherits from "GravitationalDynamicsInterface" but changes the indexes to 64 bit?

@rieder
Copy link
Member Author

rieder commented Oct 21, 2024

@LourensVeen I think this solution works. I wish it could be done with less code repetition, but I don't immediately see how...

@LourensVeen
Copy link
Member

As a point of terminology: you converted the gd.py module to a gd/ package. A submodule is a git thing that is nice in theory but a pain in practice, and also package here should not be confused with the wheels or tarballs (or, a long time ago, eggs, except that they're still around somewhat too) that you upload to PyPI, which are also packages but of a different kind. Python...

(This comment brought to you by having spent the day wading through the amuse.rfi code which is horribly inconsistently named and frustrating to work with, sorry for taking it out on your PR 😬)

I'm not sure the subdirectory is all that necessary actually, to clean up amuse.community.interface I would start with moving it to amuse.interface and moving the example.py to the documentation. That would leave six files, which would become eight, which is no big deal at all. If there's a split, I'd do it by field, but then we'd probably get amuse.interface and omuse.interface and such.

Copy-pasting and modifying is ugly, but I didn't find a different solution either, and if there is one it may well be worse. I'd like to replace the whole mess that is amuse.rfi with a new implementation and if I end up doing that, then I may be able to design in a better solution for this. Meanwhile it may have to do, unfortunately.

@rieder
Copy link
Member Author

rieder commented Oct 31, 2024

ok to merge, or are changes needed?

@stale
Copy link

stale bot commented Dec 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale Issues that have been around for a while without updates label Dec 30, 2024
@stale stale bot closed this Jan 27, 2025
@rieder rieder reopened this Jan 27, 2025
@stale stale bot removed the status: stale Issues that have been around for a while without updates label Jan 27, 2025
@rieder rieder added kind: feature request The issue requests a feature that AMUSE does not currently have status: stale Issues that have been around for a while without updates labels Jan 27, 2025
@stale stale bot removed the status: stale Issues that have been around for a while without updates label Jan 27, 2025
@rieder rieder requested a review from LourensVeen August 1, 2025 10:14
@rieder
Copy link
Member Author

rieder commented Aug 1, 2025

I completely forgot I had worked on this, but may still be worth merging?

@rieder rieder marked this pull request as ready for review August 1, 2025 10:16
@rieder rieder requested a review from a team as a code owner August 1, 2025 10:16
@LourensVeen
Copy link
Member

Looking at this again, I think it may actually be possible to still share the code, by effectively emulating a C++ template.

We'd make a base interface like

class GravitationalDynamicsInterfaceTemplate(common.CommonCodeInterface):
    _INDEX_TYPE = None

    # contents here, using _INDEX_TYPE instead of "int32"

And then we could define

class GravitationalDynamicsInterface(GravitationalDynamicsInterfaceTemplate):
    _INDEX_TYPE = "int32"

and

class GravitationalDynamics64Interface(GravitationalDynamicsInterfaceTemplate):
    _INDEX_TYPE = "int64"

That is clean type-wise, as the two interfaces don't inherit from each other, and the template would be effectively an abstract base class. Actually, it should probably inherit from abc.ABC because of that.

Not sure if it actually works, but I could code it up and see if it seems worth it?

@HannoSpreeuw HannoSpreeuw moved this from Backlog to Feature Request in Development Board Nov 24, 2025
@HannoSpreeuw HannoSpreeuw moved this from Feature Request to Open PRs in Development Board Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: feature request The issue requests a feature that AMUSE does not currently have

Projects

Status: Open PRs

Development

Successfully merging this pull request may close these issues.

2 participants