Skip to content
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

Fix example of hyperslab block coordinate printing #437

Merged
merged 1 commit into from
Mar 6, 2021
Merged

Fix example of hyperslab block coordinate printing #437

merged 1 commit into from
Mar 6, 2021

Conversation

grimbough
Copy link
Contributor

No sure if you welcome community pull requests, but hopefully this is helpful.

I've notice a small bug in the h5_vds.c example, where it prints the coordinates of the hyperslab blocks. This is the current code:

for (l=0; l<nblocks; l++) {
    printf("(");
    for (k=0; k<RANK2-1; k++) 
        printf("%d,", (int)buf[k]);
    printf("%d) - (", (int)buf[k]);
    for (k=0; k<RANK2-1; k++) 
        printf("%d,", (int)buf[RANK2+k]);
     printf("%d)\n", (int)buf[RANK2+k]);
}

Although it loops over the number of blocks, it doesn't use the block counter when printing the information, and so will just show the coordinates of the first block over and over. The patch is intended to enable printing the coordinates for all blocks.

This behaviour isn't obvious in the current example as none of the hyperslabs consist of more than one block. However, I ended up at the example from H5S_GET_SELECT_HYPER_BLOCKLIST and was trying to use it to understand my own program, where this printing had me confused for a while. Hopefully this might help anyone else copy/pasting the example into their own code in the future.

@epourmal
Copy link

epourmal commented Mar 5, 2021

Thank you for your contribution! Yes, we do encourage PRs from community. The patch looks good to me!

@lrknox lrknox merged commit 150fb83 into HDFGroup:develop Mar 6, 2021
lrknox added a commit that referenced this pull request Mar 10, 2021
* Snapshot version 1.12 release 1-3.  Update  version to 1.12.1-4.

* First cut of the H5 public API documentation. (#80)

* First cut of the H5 public API documentation.

* Added H5Z "bonus track."

* Applied Quincey's patch.

* Added the missing patches from Quincey's original patch.

* H5PL (complete) and basic H5VL API documentation.

* Added H5I API docs.

* Added H5L API docs.

* First installment from Elena's H5T batch.

* Second installment of Elena's H5T batch.

* Final installment of Elena's H5T batch.

* Full set of current H5F documentation. (#105)

* First cut of the H5 public API documentation.

* Added H5Z "bonus track."

* Applied Quincey's patch.

* Added the missing patches from Quincey's original patch.

* H5PL (complete) and basic H5VL API documentation.

* Added H5I API docs.

* Added H5L API docs.

* First installment from Elena's H5T batch.

* Second installment of Elena's H5T batch.

* Final installment of Elena's H5T batch.

* Migrated documentation for SWMR functions.

* Catching up on MDC functions.

* Integrated the H5F MDC function documentation.

* Added MDC and parallel H5F functions.

* Slightly updated main page.

* Added doxygen/dox/H5AC_cache_config_t.dox to MANIFEST.

* Doxygen - added (mostly) beginner functions (#112)

* Doxygen - added (mostly) beginner functions

* Removed duplicate H5Pset_szip function

* Add src/H5module.h to MANIFEST.

* close #195. (#196)

* Update HDF5PluginMacros.cmake

* Update HDF5PluginMacros.cmake

* Avoid aligned access for references by decoding into temporary buffer and then copying the result into the actual buffer.   Update test to be more thorough with using compound datatype fields everywhere. (#206)

* Modify temporary rpath for testing in java example scripts. (#230)

* Fix undefined left shifting of negative numbers (#338)

Undefined Bahavior Sanitizer errored here about left shifting negative numbers.

* Fixes various warnings noticed on Windows (#425)

* Fixes various warnings noticed on Windows

- Adds a prototype for our implementation of vasprintf
- Return type of H5_get_utf16_str() is now non-const
- Fixes possible uninitialized return type in Wremove_utf8
- Better isolation of fork() code in accum.c:test_swmr_write_big()
- Better isolation of non-zlib code in dsets.c:test_filter_delete()
- Removed unused variable in trefer.c:test_reference_cmpnd_obj()

* Fixes clang-format issues

* Fixed clang-tidy readability-misleading-indentation warnings (#427)

* Fixed clang-tidy readability-misleading-indentation warnings

* Reformatted src/H5Zscaleoffset.c with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Fixed clang-tidy readability-redundant-control-flow warnings (#428)

* Fixed clang-tidy readability-redundant-control-flow warnings

Just removed useless trailing return statements.

* Removed blank lines from h5diffgentest.c with clang-format v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Removed bad function pointer casts (#434)

* Removed bad function pointer casts

In one case fixed the actual function signature to be correct.

* Reformat source with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* fix block coordinate printing example (#437)

Co-authored-by: Gerd Heber <[email protected]>
Co-authored-by: bljhdf <[email protected]>
Co-authored-by: H. Joe Lee <[email protected]>
Co-authored-by: Quincey Koziol <[email protected]>
Co-authored-by: Sean McBride <[email protected]>
Co-authored-by: Dana Robinson <[email protected]>
Co-authored-by: Mike Smith <[email protected]>
lrknox added a commit that referenced this pull request Mar 10, 2021
* close #195. (#196)

* Update HDF5PluginMacros.cmake

* Update HDF5PluginMacros.cmake

* Modify temporary rpath for testing in java example scripts. (#230)

* Fix undefined left shifting of negative numbers (#338)

Undefined Bahavior Sanitizer errored here about left shifting negative numbers.

* Update license url (#332)

* Modify temporary rpath for testing in java example scripts.

* Update URL in source file Copyright headers for web copy of COPYING
file - src and test directories.

* Fixed clang-tidy readability-misleading-indentation warnings (#427)

* Fixed clang-tidy readability-misleading-indentation warnings

* Reformatted src/H5Zscaleoffset.c with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Fixed clang-tidy readability-redundant-control-flow warnings (#428)

* Fixed clang-tidy readability-redundant-control-flow warnings

Just removed useless trailing return statements.

* Removed blank lines from h5diffgentest.c with clang-format v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Removed bad function pointer casts (#434)

* Removed bad function pointer casts

In one case fixed the actual function signature to be correct.

* Reformat source with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* fix block coordinate printing example (#437)

Co-authored-by: H. Joe Lee <[email protected]>
Co-authored-by: Sean McBride <[email protected]>
Co-authored-by: Mike Smith <[email protected]>
lrknox added a commit that referenced this pull request Apr 2, 2021
* close #195. (#196)

* Update HDF5PluginMacros.cmake

* Update HDF5PluginMacros.cmake

* Modify temporary rpath for testing in java example scripts. (#230)

* Fix undefined left shifting of negative numbers (#338)

Undefined Bahavior Sanitizer errored here about left shifting negative numbers.

* Update license url (#332)

* Modify temporary rpath for testing in java example scripts.

* Update URL in source file Copyright headers for web copy of COPYING
file - src and test directories.

* Fixed clang-tidy readability-misleading-indentation warnings (#427)

* Fixed clang-tidy readability-misleading-indentation warnings

* Reformatted src/H5Zscaleoffset.c with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Fixed clang-tidy readability-redundant-control-flow warnings (#428)

* Fixed clang-tidy readability-redundant-control-flow warnings

Just removed useless trailing return statements.

* Removed blank lines from h5diffgentest.c with clang-format v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* Removed bad function pointer casts (#434)

* Removed bad function pointer casts

In one case fixed the actual function signature to be correct.

* Reformat source with clang v10.0.1.

Co-authored-by: Larry Knox <[email protected]>

* fix block coordinate printing example (#437)

* Cleans up a couple of MSVC warnings in testhdf5 (#475)
* Fixes a few testhdf5 warnings raised in Visual Studio

Visual Studio is grumpier about treating pointers like integers than
gcc.

* Committing clang-format changes

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Fix typos and grammar errors. (#476)

* Suppresses the tcheck_version test's abort dialog on Windows (#477)

* Suppresses the tcheck_version test's abort dialog on Windows

Windows raises a modal abort/retry/ignore dialog box when CRT
calls abort(). This change installs a report hook that suppresses
the dialog so that the CMake tests don't time out waiting for a
nonexistent user to click a dialog box.

* Committing clang-format changes

* Removes __cdecl from callback

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Fixes various warnings noticed on Windows (#425)

* Fixes various warnings noticed on Windows

- Adds a prototype for our implementation of vasprintf
- Return type of H5_get_utf16_str() is now non-const
- Fixes possible uninitialized return type in Wremove_utf8
- Better isolation of fork() code in accum.c:test_swmr_write_big()
- Better isolation of non-zlib code in dsets.c:test_filter_delete()
- Removed unused variable in trefer.c:test_reference_cmpnd_obj()

* Fixes clang-format issues

Co-authored-by: H. Joe Lee <[email protected]>
Co-authored-by: Sean McBride <[email protected]>
Co-authored-by: Mike Smith <[email protected]>
Co-authored-by: Dana Robinson <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants