Use std::filesystem::path

Signed-off-by: Steven Hahn <hahnse@ornl.gov>
This commit is contained in:
Steven Hahn 2022-10-06 12:29:18 -04:00
parent f92e927150
commit 33ce7c3ea4
4 changed files with 13 additions and 11 deletions

1
.gitignore vendored
View File

@ -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/

View File

@ -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
@ -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
@ -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
@ -158,7 +156,7 @@ public:
// HDF5-related data and functions //
//////////////////////////////////////
hid_t H5FileID;
std::string H5FileName;
std::filesystem::path H5FileName;
// HDF5 orbital file version
typedef enum
{

View File

@ -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;
@ -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;

View File

@ -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
{
@ -114,14 +117,14 @@ public:
* @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();