Skip to content

Commit

Permalink
Add and use <highfive/highfive.hpp>. (#818)
Browse files Browse the repository at this point in the history
The header `<highfive/highfive.hpp>` is the top-level header for
everything HighFive. It's recommended to use it instead of the other
headers, unless compilation time is a concern. However, currently
`<highfive/H5File.hpp>` includes almost all of HighFive. Hence, the
savings are likely very modest, if any.
  • Loading branch information
1uc authored Nov 1, 2023
1 parent 858c7d9 commit 12ee208
Show file tree
Hide file tree
Showing 39 changed files with 55 additions and 114 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ It integrates nicely with other CMake projects by defining (and exporting) a Hig
#### Write a std::vector<int> to 1D HDF5 dataset and read it back

```c++
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
2 changes: 1 addition & 1 deletion doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Okay, on to configure, compile and install. The CMake commands are
### Confirming It Works
We again need a dummy file called `dummy.cpp` with the following contents

#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

int main() {
auto file = HighFive::File("foo.h5", HighFive::File::Create);
Expand Down
2 changes: 1 addition & 1 deletion doc/poster/example3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>


typedef struct {
Expand Down
4 changes: 1 addition & 3 deletions doc/poster/example6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

#include <mpi.h>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>


int main(int argc, char** argv) {
Expand Down
4 changes: 1 addition & 3 deletions doc/poster/example_boost.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include <complex>

#define H5_USE_BOOST 1
#include <highfive/highfive.hpp>

#include <boost/multi_array.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>

using complex_t = std::complex<double>;

Expand Down
2 changes: 1 addition & 1 deletion doc/poster/example_boost_ublas.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <iostream>

#define H5_USE_BOOST 1
#include <highfive/highfive.hpp>

// In some versions of Boost (starting with 1.64), you have to
// include the serialization header before ublas
#include <boost/serialization/vector.hpp>

#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <highfive/H5File.hpp>

using namespace HighFive;

Expand Down
1 change: 1 addition & 0 deletions doc/poster/example_easy_highfive.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <xtensor/xarray.hpp>

#include <highfive/H5Easy.hpp>

int main() {
Expand Down
2 changes: 1 addition & 1 deletion doc/poster/example_props.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
14 changes: 14 additions & 0 deletions include/highfive/highfive.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <highfive/H5Attribute.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5DataType.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5FileDriver.hpp>
#include <highfive/H5Group.hpp>
#include <highfive/H5PropertyList.hpp>
#include <highfive/H5Reference.hpp>
#include <highfive/H5Selection.hpp>
#include <highfive/H5Utility.hpp>
#include <highfive/H5Version.hpp>
2 changes: 1 addition & 1 deletion src/benchmarks/highfive_bench.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>
#include <vector>

const std::vector<std::vector<int>> data(1000000, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
Expand Down
2 changes: 1 addition & 1 deletion src/examples/boost_multi_array_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define H5_USE_BOOST

#include <boost/multi_array.hpp>
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
5 changes: 2 additions & 3 deletions src/examples/boost_multiarray_complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
#undef H5_USE_BOOST
#define H5_USE_BOOST

#include <highfive/highfive.hpp>

#include <boost/multi_array.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>

typedef std::complex<double> complex_t;

Expand Down
3 changes: 2 additions & 1 deletion src/examples/boost_ublas_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
#undef H5_USE_BOOST
#define H5_USE_BOOST

#include <highfive/highfive.hpp>

// In some versions of Boost (starting with 1.64), you have to include the serialization header
// before ublas
#include <boost/serialization/vector.hpp>

#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <highfive/H5File.hpp>

using namespace HighFive;

Expand Down
2 changes: 1 addition & 1 deletion src/examples/compound_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Compound datatype test :: May 2021
// //////////////////////////////////

#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>


typedef struct {
Expand Down
5 changes: 1 addition & 4 deletions src/examples/create_attribute_string_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5Attribute.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
4 changes: 1 addition & 3 deletions src/examples/create_dataset_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

// Create a dataset name "dset" of double 4x6
int main(void) {
Expand Down
4 changes: 1 addition & 3 deletions src/examples/create_dataset_half_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#include <string>
#include <vector>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

const std::string FILE_NAME("create_dataset_half_float_example.h5");
const std::string DATASET_NAME("dset");
Expand Down
3 changes: 1 addition & 2 deletions src/examples/create_datatype.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <iostream>

#include <highfive/H5File.hpp>
#include <highfive/H5DataType.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
4 changes: 1 addition & 3 deletions src/examples/create_extensible_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

const std::string FILE_NAME("create_extensible_dataset_example.h5");
const std::string DATASET_NAME("dset");
Expand Down
5 changes: 2 additions & 3 deletions src/examples/create_large_attribute.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include <H5Fpublic.h>
#include <highfive/H5File.hpp>
#include <highfive/H5Group.hpp>
#include <numeric>
#include <vector>

#include <highfive/highfive.hpp>

int main() {
std::vector<double> large_attr(16000, 0.0);

Expand Down
2 changes: 1 addition & 1 deletion src/examples/create_page_allocated_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

// This example requires HDF5 version 1.10.1 or newer.
#if H5_VERSION_GE(1, 10, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/examples/hl_hdf5_inmemory_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <iostream>
#include <vector>

#include <highfive/highfive.hpp>

#include <highfive/H5File.hpp>
#include <hdf5_hl.h>

using namespace HighFive;
Expand Down
5 changes: 1 addition & 4 deletions src/examples/parallel_hdf5_collective_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

#include <mpi.h>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5PropertyList.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("parallel_collective_example.h5");
const std::string dataset_name("dset");
Expand Down
5 changes: 1 addition & 4 deletions src/examples/parallel_hdf5_independent_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

#include <mpi.h>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5PropertyList.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("parallel_independent_example.h5");

Expand Down
4 changes: 1 addition & 3 deletions src/examples/read_write_dataset_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
4 changes: 1 addition & 3 deletions src/examples/read_write_fixedlen_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include <iostream>
#include <string>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
4 changes: 1 addition & 3 deletions src/examples/read_write_raw_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("read_write_raw_ptr.h5");
const std::string dataset_name("array");
Expand Down
4 changes: 1 addition & 3 deletions src/examples/read_write_single_scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("read_write_scalar.h5");
const std::string dataset_name("single_scalar");
Expand Down
4 changes: 1 addition & 3 deletions src/examples/read_write_vector_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
5 changes: 1 addition & 4 deletions src/examples/read_write_vector_dataset_references.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
#include <string>
#include <vector>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5Reference.hpp>
#include <highfive/highfive.hpp>

// create a dataset 1D from a vector of int
void write_dataset() {
Expand Down
2 changes: 1 addition & 1 deletion src/examples/readme_snippet.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <highfive/H5File.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
6 changes: 1 addition & 5 deletions src/examples/renaming_objects.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#include <highfive/H5File.hpp>
#include <highfive/H5Group.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5Attribute.hpp>
#include <highfive/highfive.hpp>

using namespace HighFive;

Expand Down
4 changes: 1 addition & 3 deletions src/examples/select_by_id_dataset_cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("select_partial_string.h5");
const std::string dataset_name("message");
Expand Down
4 changes: 1 addition & 3 deletions src/examples/select_partial_dataset_cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include <string>
#include <vector>

#include <highfive/H5File.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/highfive.hpp>

const std::string file_name("select_partial_example.h5");
const std::string dataset_name("dset");
Expand Down
16 changes: 1 addition & 15 deletions tests/test_dependent_library/include/simpleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,7 @@

// Include all headers here to catch any missing `inline` statements, since
// they will be included by two different compilation units.
#include <highfive/H5Attribute.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5DataType.hpp>
#include <highfive/H5Easy.hpp>
#include <highfive/H5Exception.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5FileDriver.hpp>
#include <highfive/H5Group.hpp>
#include <highfive/H5Object.hpp>
#include <highfive/H5PropertyList.hpp>
#include <highfive/H5Reference.hpp>
#include <highfive/H5Selection.hpp>
#include <highfive/H5Utility.hpp>
#include <highfive/H5Version.hpp>
#include <highfive/highfive.hpp>

// Boost should always be found in this setup
#include <boost/numeric/ublas/matrix.hpp>
Expand Down
8 changes: 1 addition & 7 deletions tests/unit/test_all_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
*/
#include <string>

#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
#include <highfive/H5Group.hpp>
#include <highfive/H5Reference.hpp>
#include <highfive/H5Utility.hpp>

#include <catch2/catch_template_test_macros.hpp>

#include <highfive/highfive.hpp>
#include "tests_high_five.hpp"

using namespace HighFive;
Expand Down
Loading

0 comments on commit 12ee208

Please sign in to comment.