-
Notifications
You must be signed in to change notification settings - Fork 35
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
[alt to #281] Isolate hdf5 as a dependency of Cello's disk component #365
Conversation
@jobordner could you please give a bit more context? Should we decline PR #281 and go with this one, or does that require some discussion? |
I think this looks great! I'll be happy to close 281. My 1 suggestion is that we declare a type alias called something |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so as I said just above this looks great to me! I've closed #281.
There are 2 things I would recommend changing. Let me know if you disagree with any of the suggestions. Then I would be happy to approve the PR.
The suggestions include:
-
Rather than using
int64_t
orhid
as the argument and return type of all of theFileHdf5
methods, I would define a custom type (sayh5_int_t
) that aliasesint64_t
and use that instead.-
To be a little more concrete, here's what I'm (roughly) suggesting:
- add a line like the following
to either
// this type is identical to the hdf5 library's `hid` type. We define this type // here, so that we can explicitly avoid including <hdf5.h> in any headers typedef int64_t h5_int_t;
src/Cello/_disk.hpp
or to the top ofsrc/Cello/disk_FileHdf5.hpp
. - replace all occurrences of
int64_t
insrc/Cello/_disk.[ch]pp
withh5_int_t
- add a line like the following
-
I think making this change will help clarify our intent for future generations. (Back when when I first read this code, I was unfamiliar with how the hdf5 library worked. If we were simply passing around
int64_t
rather thanhid
, I would have been fairly confused).
-
-
Less importantly, it might be nice to make a minor tweak to
src/Cello/CMakeLists.txt
to indicate that other components don't need to link against the hdf5 library.-
I would suggest replacing the following lines
# with minimal refactoring, we could make HDF5_C a privately linked library target_link_libraries(disk PUBLIC HDF5_C PRIVATE pngwriter PUBLIC error )
with this snippet
target_link_libraries(disk PRIVATE HDF5_C PRIVATE pngwriter PUBLIC error )
(essentially, you would remove the comment and make the
HDF5_C
library into a private dependency of thedisk
component) -
Definitely feel free to punt on this. I could always handle this later.
-
We've decided that this PR can be merged with 1 approval. |
I've made the above changes, using the name " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes! Let's merge once the tests pass!
Alternative to PR #281 to relocate
#include "hdf5.h"
from_disk.hpp
todisk_FileHdf5.cpp
.