Skip to content

Commit

Permalink
Use std::filesystem::path
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Hahn <[email protected]>
  • Loading branch information
quantumsteve committed Oct 6, 2022
1 parent f92e927 commit 33ce7c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tests/solids/NiO_a4_e48_pp/NiO-fcc-supertwist111-supershift000-S1.h5

# Visual Studio code settings
.vscode/
.cache/

# Doxygen output
doxygen/output/
Expand Down
10 changes: 4 additions & 6 deletions src/QMCWaveFunctions/EinsplineSetBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "QMCWaveFunctions/BandInfo.h"
#include "QMCWaveFunctions/AtomicOrbital.h"
#include "Numerics/HDFNumericAttrib.h"
#include <filesystem>
#include <map>

#define PW_COEFF_NORM_TOLERANCE 1e-6
Expand Down Expand Up @@ -78,14 +79,12 @@ struct Int4less
*/
struct H5OrbSet
{
///type of orbitals defined
int OrbitalType;
///index for the spin set
int SpinSet;
///number of orbitals that belong to this set
int NumOrbs;
///name of the HDF5 file
std::string FileName;
std::filesystem::path FileName;
/** true if a < b
*
* The ordering
Expand All @@ -106,9 +105,8 @@ struct H5OrbSet
return a.FileName < b.FileName;
}

H5OrbSet(const H5OrbSet& a) : SpinSet(a.SpinSet), NumOrbs(a.NumOrbs), FileName(a.FileName) {}
H5OrbSet(std::string name, int spinSet, int numOrbs) : SpinSet(spinSet), NumOrbs(numOrbs), FileName(name) {}
H5OrbSet() {}
H5OrbSet() = default;
};

/** EinsplineSet builder
Expand Down Expand Up @@ -158,7 +156,7 @@ class EinsplineSetBuilder : public SPOSetBuilder
// HDF5-related data and functions //
//////////////////////////////////////
hid_t H5FileID;
std::string H5FileName;
std::filesystem::path H5FileName;
// HDF5 orbital file version
typedef enum
{
Expand Down
4 changes: 2 additions & 2 deletions src/io/hdf/hdf_archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void hdf_archive::set_access_plist(boost::mpi3::communicator& comm, bool request
#endif


bool hdf_archive::create(const std::string& fname, unsigned flags)
bool hdf_archive::create(const std::filesystem::path& fname, unsigned flags)
{
if (Mode[NOIO])
return true;
Expand All @@ -144,7 +144,7 @@ bool hdf_archive::create(const std::string& fname, unsigned flags)
return file_id != is_closed;
}

bool hdf_archive::open(const std::string& fname, unsigned flags)
bool hdf_archive::open(const std::filesystem::path& fname, unsigned flags)
{
if (Mode[NOIO])
return true;
Expand Down
9 changes: 6 additions & 3 deletions src/io/hdf/hdf_archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#include "hdf_pete.h"
#include "hdf_stl.h"
#include "hdf_hyperslab.h"
#include <stack>

#include <bitset>
#include <filesystem>
#include <stack>

#ifdef HAVE_MPI
namespace boost
{
Expand Down Expand Up @@ -114,14 +117,14 @@ class hdf_archive
* @param flags i/o mode
* @return true, if creation is successful
*/
bool create(const std::string& fname, unsigned flags = H5F_ACC_TRUNC);
bool create(const std::filesystem::path& fname, unsigned flags = H5F_ACC_TRUNC);

/** open a file
* @param fname name of hdf5 file
* @param flags i/o mode
* @return file_id, if open is successful
*/
bool open(const std::string& fname, unsigned flags = H5F_ACC_RDWR);
bool open(const std::filesystem::path& fname, unsigned flags = H5F_ACC_RDWR);

///close all the open groups and file
void close();
Expand Down

0 comments on commit 33ce7c3

Please sign in to comment.