danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
94 stars 223 forks source link

give different inject modules distinctive names? #511

Open rieder opened 5 months ago

rieder commented 5 months ago

Phantom has a number of modules that are called inject ("inject_asteroidwind", "inject_bondi.f90", etc.). I guess this was done because they are never used together, and they are chosen with compile time options.

However, it becomes an issue when I want to build a single Phantom library for AMUSE, with the option to choose which inject module to use at runtime. This is currently not possible - I have to build different libraries for each option that I want to make available. This is impractical, especially since I can't use descriptive function names to point to the different inject modules (e.g. create_new_wind for inject_wind, etc.).

Would it be ok if I would change these modules so that they are given distinctive names, with the module to use chosen via a configuration option? I could do this in a way that the module(s) built can still be selected via a Makefile option - but the different modules could then be combined in a single library.

danieljprice commented 5 months ago

Yes in general I think this is a good idea, as it fits with the general move towards fewer compile-time options, instead the type of injection can be a runtime option. We could perhaps leave an inject_custom.f90 which could be replaceable at compile time but I think a few of the well supported ones should be included by default… that said they are often quite tied to the particular setup employed

rieder commented 5 months ago

I'll make a PR for this then.