hier::Patch should return shared_ptr by const reference
Is there any reason why hier::Patch does return its class member of type std::shared_ptr's by value instead of by reference to const std::shared_ptr? Each time I want to access the hier::PatchGeometry or hier::PatchData members I have to take a lock to increase the reference count of std::shared_ptr. Returning references instead would allow having the freedom to decide for myself if I want to do this.
Hey @maikel - I think this might just be a hangover from older implementations before we switched over to use std::shared_ptr.
We haven't noticed any performance implications in our applications due to returning the pointers by value. We would be happy to look through at a PR if you would like to make this change.
Ok I will do a pull request soon for SAMRAI::hier::Patch. I wonder if one should sweep through the library and check this for consistency. To be honest, I haven't measured the difference. I just wondered about the generated assembly for (interfacing) our compute kernels.