parthenon-hpc-lab / parthenon

Parthenon AMR infrastructure
https://parthenon-hpc-lab.github.io/parthenon/
Other
105 stars 33 forks source link

[WIP] Take ownership of `Param`s #1115

Open BenWibking opened 3 weeks ago

BenWibking commented 3 weeks ago

PR Summary

When Params are created or updated, it takes ownership of the object passed with std::move.

PR Checklist

BenWibking commented 3 weeks ago

@Yurlungur is there a reason for a custom Params container? Could this be replaced with a wrapper around a std::unordered_map<std::string, std::any>?

Although I see that std::any only works for copy-constructible objects...

Yurlungur commented 2 weeks ago

Thanks for taking a stab at this!

@Yurlungur is there a reason for a custom Params container? Could this be replaced with a wrapper around a std::unordered_map<std::string, std::any>?

We wrote Params when Parthenon was C++14 only. So at the time it wasn't an option. In principle, I think it could be replaced with std::any modulo the issue with copy constructible types.

I am somewhat concerned also about how this will interact with I/O. In principle it should all work though.