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

Code fixes and website improvements #555

Merged
merged 8 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/poster/example1_hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void data_io() {
std::vector<double> data(50, 1);

// Open a file
file_id = H5Fcreate("/tmp/new_file.h5", H5F_ACC_TRUNC, H5P_DEFAULT);
file_id = H5Fcreate("new_file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

// Create a group
group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
Expand Down
2 changes: 1 addition & 1 deletion doc/poster/example1_highfive.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <highfive/H5File.hpp>

using namespace HighFive;
using HighFive::File;

void write_io() {
std::vector<int> d1(50, 1);
Expand Down
4 changes: 1 addition & 3 deletions doc/poster/example6.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <iostream>
#include <string>
#include <vector>

#include <mpi.h>

Expand Down Expand Up @@ -42,7 +40,7 @@ int main(int argc, char** argv) {
// write it to the associated mpi_rank
dset.select({std::size_t(mpi_rank), 0}, {1, 2}).write(data);

} catch (Exception& err) {
} catch (const Exception& err) {
// catch and print any HDF5 error
std::cerr << err.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, 1);
Expand Down
8 changes: 6 additions & 2 deletions doc/poster/example_boost.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <algorithm>
#include <complex>

#define H5_USE_BOOST 1

#include <boost/multi_array.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
Expand All @@ -15,5 +16,8 @@ void data_io() {

HighFive::File file("multi_array_complex.h5", HighFive::File::Truncate);

HighFive::DataSet dataset = file.createDataSet("multi_array", multi_array);
HighFive::DataSet dataset =
file.createDataSet<complex_t>("multi_array", HighFive::DataSpace::From(multi_array));

dataset.write(multi_array);
}
4 changes: 3 additions & 1 deletion doc/poster/example_boost_ublas.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <iostream>

#define H5_USE_BOOST 1

// In some versions of Boost (starting with 1.64), you have to
// include the serialization header before ublas
#include <boost/serialization/vector.hpp>
Expand Down Expand Up @@ -38,7 +40,7 @@ void data_io() {

std::cout << "Matrix result:\n" << result << std::endl;

} catch (Exception& err) {
} catch (const Exception& err) {
// catch and print any HDF5 error
std::cerr << err.what() << std::endl;
}
Expand Down
4 changes: 3 additions & 1 deletion doc/poster/example5.cpp → doc/poster/example_eigen.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <iostream>

#define H5_USE_EIGEN 1

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

Expand Down Expand Up @@ -27,7 +29,7 @@ void data_io(void) {
Eigen::MatrixXd result;
dset.read(result);

} catch (Exception& err) {
} catch (const Exception& err) {
std::cerr << err.what() << std::endl;
}
}
15 changes: 9 additions & 6 deletions doc/poster/example2.cpp → doc/poster/example_props.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <HighFive>
#include <highfive/H5File.hpp>

using HighFive;
using namespace HighFive;

void write_data() {
int write_data() {
FileDriver fdrv;

fdrv.add(FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST));
Expand All @@ -12,10 +12,13 @@ void write_data() {

GroupCreateProps props;
props.add(EstimatedLinkInfo(1000, 500));
props.add(Chunking(std::vector<hsize_t>{2, 2}));
props.add(Deflate(9));
auto group = file.createGroup("g", props);

DataSetCreateProps dsprops;
dsprops.add(Chunking(std::vector<hsize_t>{2, 2}));
dsprops.add(Deflate(9));


std::vector<int> d1(100000, 1);
group.createDataSet("dset1", d1);
group.createDataSet("dset1", d1, dsprops);
}
82 changes: 43 additions & 39 deletions doc/poster/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
background-color: #f8f9fa;
font-size: small;
}
.godbolt {
cursor: pointer;
}
</style>
</head>

Expand Down Expand Up @@ -88,13 +91,17 @@ <h2>Basic use of HighFive</h2>
<tbody>
<tr>
<td>
<div class="code container"><img src="godbolt.org.ico" id="gb_example1_highfive" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example1_highfive"></div></pre>
<div class="card w-100">
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example1_highfive" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example1_highfive"></div></pre>
</div>
</div>
</td>
<td>
<div class="code container"><img src="godbolt.org.ico" id="gb_example1_hdf5" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example1_hdf5"></div></pre>
<div class="card w-100">
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example1_hdf5" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example1_hdf5"></div></pre>
</div>
</div>
</td>
</tr>
Expand All @@ -104,14 +111,14 @@ <h2>Basic use of HighFive</h2>

<div class="container mb-5">
<h2>Support for HDF5 advanced features</h2>
<p>Its simplified data-management does not come at a loss of of HDF5's fledibility and
<p>Its simplified data-management does not come at a loss of HDF5's flexibility and
advanced features and tunable parameters are exposed through a simple interface. File
version bounds can be read and written to define object compatibility, the metadata
block size can be set. Group properties for compression, chunking and link info
estimates can be set and read:</p>
<div class="card w-75">
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example2" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example2"></div></pre>
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example_props" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example_props"></div></pre>
</div>
</div>
</div>
Expand All @@ -124,8 +131,8 @@ <h2>Complex data types</h2>
achieved through various templated converters. Additionally, HighFive supports enums and
various string types.</p>
<div class="card w-75">
<div class="card-body">
<ul class="nav nav-tabs" id="highfive-type-support" role="tablist">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" id="highfive-type-support" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="compound-tab" data-bs-toggle="tab"
data-bs-target="#compound" type="button" role="tab" aria-controls="compound"
Expand All @@ -149,33 +156,26 @@ <h2>Complex data types</h2>
type="button" role="tab" aria-controls="eigen" aria-selected="false">Eigen</button>
</li>
</ul>
<div class="tab-content" id="highfive-type-support-content">
<div class="tab-pane fade show active" id="compound" role="tabpanel"
aria-labelledby="compound-tab">
<div class="code container"><img src="godbolt.org.ico" id="gb_example3" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example3"></div></pre>
</div>
</div>
<div class="tab-pane fade" id="boost" role="tabpanel" aria-labelledby="boost-tab">
<div class="code container"><img src="godbolt.org.ico" id="gb_example_boost" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example_boost"></div></pre>
</div>
</div>
<div class="tab-pane fade" id="boost-ublas" role="tabpanel"
aria-labelledby="boost-ublas-tab">
<div class="code container"><img src="godbolt.org.ico" id="gb_example_boost_ublas" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example_boost_ublas"></div></pre>
</div>
</div>
<div class="tab-pane fade" id="eigen" role="tabpanel" aria-labelledby="eigen-tab">
<div class="code container"><img src="godbolt.org.ico" id="gb_example_boost_ublas" width=16 height=16 class="godbolt float-end">
<pre class="font-monospace"><div class="example" id="example5"></div></pre>
</div>
</div>
</div>
<div class="tab-content code card-body" id="highfive-type-support-content">
<div class="tab-pane fade show active" id="compound" role="tabpanel" aria-labelledby="compound-tab">
<img src="godbolt.org.ico" id="gb_example3" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example3"></div></pre>
</div>
<div class="tab-pane fade" id="boost" role="tabpanel" aria-labelledby="boost-tab">
<img src="godbolt.org.ico" id="gb_example_boost" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example_boost"></div></pre>
</div>
<div class="tab-pane fade" id="boost-ublas" role="tabpanel" aria-labelledby="boost-ublas-tab">
<img src="godbolt.org.ico" id="gb_example_boost_ublas" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example_boost_ublas"></div></pre>
</div>
<div class="tab-pane fade" id="eigen" role="tabpanel" aria-labelledby="eigen-tab">
<img src="godbolt.org.ico" id="gb_example_eigen" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example_eigen"></div></pre>
</div>
</div>
</div>

</div>
<div class="container mb-5">
<h2>HighFive for parallel applications</h2>
Expand All @@ -185,7 +185,7 @@ <h2>HighFive for parallel applications</h2>
initialized. No other special API calls are required since all necessary provisions are
handled transparently.</p>
<div class="card w-75">
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example6" width=16 height=16 class="godbolt float-end">
<div class="code card-body"><img src="godbolt.org.ico" id="gb_example6" width=32 height=32 class="godbolt float-end img-thumbnail">
<pre class="font-monospace"><div class="example" id="example6"></div></pre>
</div>
</div>
Expand All @@ -204,11 +204,15 @@ <h2>Obtaining and building HighFive</h2>
</div> <!-- top level container -->
<div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-left">
<a href="/" class="mb-3 me-2 mb-md-0 text-muted text-decoration-none lh-1">
<svg class="bi" width="30" height="24"><use xlink:href="#bootstrap"></use></svg>
</a>
<span class="text-muted">© 2022 Blue Brain Project/EPFL</span>
<div class="col-md-8 d-flex align-items-left">
<span class="text-muted">© 2022 Blue Brain Project/EPFL<br>
<small>The development of this software was supported by funding to the Blue Brain
Project, a research center of the École polytechnique fédérale de Lausanne (EPFL),
from the Swiss government's ETH Board of the Swiss Federal Institutes of
Technology.</small>
</span><br>
<span class="text-muted">
</span>
</div>
<div class="col-md-4 justify-content-end list-unstyled d-flex">
<span class="text-muted">Boost Software License 1.0</span>
Expand Down
1 change: 1 addition & 0 deletions include/highfive/H5PropertyList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class Deflate {

private:
friend DataSetCreateProps;
friend GroupCreateProps;
void apply(hid_t hid) const;
const unsigned _level;
};
Expand Down
2 changes: 1 addition & 1 deletion src/examples/create_attribute_string_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(void) {
std::cout << "attribute: " << attr << std::endl;
}

} catch (Exception& err) {
} catch (const Exception& err) {
// catch and print any HDF5 error
std::cerr << err.what() << std::endl;
}
Expand Down