hops
H5FileDriver_misc.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017-2018, Adrien Devresse <adrien.devresse@epfl.ch>
3  * Juan Hernando <juan.hernando@epfl.ch>
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE_1_0.txt or copy at
7  * http://www.boost.org/LICENSE_1_0.txt)
8  *
9  */
10 #ifndef H5FILEDRIVER_MISC_HPP
11 #define H5FILEDRIVER_MISC_HPP
12 
13 #include <H5Ppublic.h>
14 
15 #ifdef H5_HAVE_PARALLEL
16 #include <H5FDmpi.h>
17 #endif
18 
19 namespace HighFive {
20 
21 namespace {
22 
23 template <typename Comm, typename Info>
24 class MPIOFileAccess
25 {
26 public:
27  MPIOFileAccess(Comm comm, Info info)
28  : _comm(comm)
29  , _info(info)
30  {}
31 
32  void apply(const hid_t list) const {
33  if (H5Pset_fapl_mpio(list, _comm, _info) < 0) {
34  HDF5ErrMapper::ToException<FileException>(
35  "Unable to set-up MPIO Driver configuration");
36  }
37  }
38 private:
39  Comm _comm;
40  Info _info;
41 };
42 
43 } //namespace
44 
45 template <typename Comm, typename Info>
46 inline MPIOFileDriver::MPIOFileDriver(Comm comm, Info info) {
47  add(MPIOFileAccess<Comm, Info>(comm, info));
48 }
49 
50 } // namespace HighFive
51 
52 #endif // H5FILEDRIVER_MISC_HPP
HighFive::MPIOFileDriver::MPIOFileDriver
MPIOFileDriver(Comm mpi_comm, Info mpi_info)
Definition: H5FileDriver_misc.hpp:46
HighFive::PropertyList::add
void add(const P &property)
Definition: H5PropertyList_misc.hpp:99
HighFive
Definition: H5_definitions.hpp:15