Skip to content

Commit 33ce7c3

Browse files
committed
Use std::filesystem::path
Signed-off-by: Steven Hahn <[email protected]>
1 parent f92e927 commit 33ce7c3

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ tests/solids/NiO_a4_e48_pp/NiO-fcc-supertwist111-supershift000-S1.h5
1919

2020
# Visual Studio code settings
2121
.vscode/
22+
.cache/
2223

2324
# Doxygen output
2425
doxygen/output/

src/QMCWaveFunctions/EinsplineSetBuilder.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "QMCWaveFunctions/BandInfo.h"
2828
#include "QMCWaveFunctions/AtomicOrbital.h"
2929
#include "Numerics/HDFNumericAttrib.h"
30+
#include <filesystem>
3031
#include <map>
3132

3233
#define PW_COEFF_NORM_TOLERANCE 1e-6
@@ -78,14 +79,12 @@ struct Int4less
7879
*/
7980
struct H5OrbSet
8081
{
81-
///type of orbitals defined
82-
int OrbitalType;
8382
///index for the spin set
8483
int SpinSet;
8584
///number of orbitals that belong to this set
8685
int NumOrbs;
8786
///name of the HDF5 file
88-
std::string FileName;
87+
std::filesystem::path FileName;
8988
/** true if a < b
9089
*
9190
* The ordering
@@ -106,9 +105,8 @@ struct H5OrbSet
106105
return a.FileName < b.FileName;
107106
}
108107

109-
H5OrbSet(const H5OrbSet& a) : SpinSet(a.SpinSet), NumOrbs(a.NumOrbs), FileName(a.FileName) {}
110108
H5OrbSet(std::string name, int spinSet, int numOrbs) : SpinSet(spinSet), NumOrbs(numOrbs), FileName(name) {}
111-
H5OrbSet() {}
109+
H5OrbSet() = default;
112110
};
113111

114112
/** EinsplineSet builder
@@ -158,7 +156,7 @@ class EinsplineSetBuilder : public SPOSetBuilder
158156
// HDF5-related data and functions //
159157
//////////////////////////////////////
160158
hid_t H5FileID;
161-
std::string H5FileName;
159+
std::filesystem::path H5FileName;
162160
// HDF5 orbital file version
163161
typedef enum
164162
{

src/io/hdf/hdf_archive.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void hdf_archive::set_access_plist(boost::mpi3::communicator& comm, bool request
133133
#endif
134134

135135

136-
bool hdf_archive::create(const std::string& fname, unsigned flags)
136+
bool hdf_archive::create(const std::filesystem::path& fname, unsigned flags)
137137
{
138138
if (Mode[NOIO])
139139
return true;
@@ -144,7 +144,7 @@ bool hdf_archive::create(const std::string& fname, unsigned flags)
144144
return file_id != is_closed;
145145
}
146146

147-
bool hdf_archive::open(const std::string& fname, unsigned flags)
147+
bool hdf_archive::open(const std::filesystem::path& fname, unsigned flags)
148148
{
149149
if (Mode[NOIO])
150150
return true;

src/io/hdf/hdf_archive.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
#include "hdf_pete.h"
2222
#include "hdf_stl.h"
2323
#include "hdf_hyperslab.h"
24-
#include <stack>
24+
2525
#include <bitset>
26+
#include <filesystem>
27+
#include <stack>
28+
2629
#ifdef HAVE_MPI
2730
namespace boost
2831
{
@@ -114,14 +117,14 @@ class hdf_archive
114117
* @param flags i/o mode
115118
* @return true, if creation is successful
116119
*/
117-
bool create(const std::string& fname, unsigned flags = H5F_ACC_TRUNC);
120+
bool create(const std::filesystem::path& fname, unsigned flags = H5F_ACC_TRUNC);
118121

119122
/** open a file
120123
* @param fname name of hdf5 file
121124
* @param flags i/o mode
122125
* @return file_id, if open is successful
123126
*/
124-
bool open(const std::string& fname, unsigned flags = H5F_ACC_RDWR);
127+
bool open(const std::filesystem::path& fname, unsigned flags = H5F_ACC_RDWR);
125128

126129
///close all the open groups and file
127130
void close();

0 commit comments

Comments
 (0)