Skip to content

Commit

Permalink
HDF5: Remove unnecessary casting (AMReX-Codes#4036)
Browse files Browse the repository at this point in the history
## Summary
Removes an unnecessary cast and now correctly compares variables of the
same signedness, fixing some compiler warnings.

## Checklist

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
arnav-singhal authored Jul 17, 2024
1 parent 8b3ffe6 commit fdea28f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Src/Extern/HDF5/AMReX_ParticleHDF5.H
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
hsize_t chunk_size;
if (H5Pget_layout(dcpl_int) == H5D_CHUNKED) {
if (H5Pget_chunk(dcpl_int, 1, &chunk_size) > -1) {
if ((int)chunk_size > total_int_size) {
if (chunk_size > total_int_size) {
H5Pset_chunk(dcpl_int, 1, &total_int_size);
}
}
Expand Down Expand Up @@ -808,9 +808,10 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
}
}
#endif

if (H5Pget_layout(dcpl_real) == H5D_CHUNKED) {
if (H5Pget_chunk(dcpl_real, 1, &chunk_size) > -1) {
if ((int)chunk_size > total_real_size) {
if (chunk_size > total_real_size) {
H5Pset_chunk(dcpl_real, 1, &total_real_size);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Src/Extern/HDF5/AMReX_PlotFileUtilHDF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void WriteMultiLevelPlotfileHDF5SingleDset (const std::string& plotfilename,
if (H5Pget_layout(lev_dcpl_id) == H5D_CHUNKED) {
hsize_t chunk_size;
if (H5Pget_chunk(lev_dcpl_id, 1, &chunk_size) > -1) {
if ((int)chunk_size > hs_allprocsize[0]) {
if (chunk_size > hs_allprocsize[0]) {
H5Pset_chunk(lev_dcpl_id, 1, hs_allprocsize);
}
}
Expand Down Expand Up @@ -1195,7 +1195,7 @@ void WriteMultiLevelPlotfileHDF5MultiDset (const std::string& plotfilename,
if (H5Pget_layout(lev_dcpl_id) == H5D_CHUNKED) {
hsize_t chunk_size;
if (H5Pget_chunk(lev_dcpl_id, 1, &chunk_size) > -1) {
if ((int)chunk_size > hs_allprocsize[0]) {
if (chunk_size > hs_allprocsize[0]) {
H5Pset_chunk(lev_dcpl_id, 1, hs_allprocsize);
}
}
Expand Down

0 comments on commit fdea28f

Please sign in to comment.