1 #ifndef CASM_FileEnumerator
2 #define CASM_FileEnumerator
23 bool _all_settings =
false,
24 bool _relative =
false);
27 template<
typename OutputIterator>
31 template<
typename OutputIterator>
32 OutputIterator
bset_files(OutputIterator result);
35 template<
typename OutputIterator>
39 template<
typename OutputIterator>
40 OutputIterator
eci_files(OutputIterator result);
43 template<
typename OutputIterator>
47 template<
typename OutputIterator>
51 template<
typename OutputIterator>
61 template<
typename OutputIterator>
65 template<
typename OutputIterator>
97 m_primclex(_primclex),
98 m_dir(m_primclex.
dir()),
99 m_set(m_primclex.settings()),
100 m_all_settings(_all_settings),
101 m_relative(_relative),
102 m_all_bset(m_dir.all_bset()),
103 m_all_calctype(m_dir.all_calctype()),
104 m_all_property(m_dir.all_property()) {}
111 auto b = path.string().size();
112 return fs::path(path.string().substr(a, b));
118 template<
typename OutputIterator>
120 if(fs::exists(path)) {
127 template<
typename OutputIterator>
129 std::vector<fs::path> all;
133 if(!fs::exists(location)) {
136 fs::directory_iterator it(location);
137 fs::directory_iterator end_it;
138 for(; it != end_it; ++it) {
139 if(fs::is_regular_file(*it)) {
157 template<
typename OutputIterator>
159 std::vector<fs::path> v {
164 for(
auto it = v.begin(); it != v.end(); ++it) {
177 template<
typename OutputIterator>
197 template<
typename OutputIterator>
206 for(
auto ref : all_ref) {
221 template<
typename OutputIterator>
234 for(
auto ref : all_ref) {
237 for(
auto eci : all_eci) {
253 template<
typename OutputIterator>
268 for(
auto scel_it = scel_begin; scel_it != scel_end; ++scel_it) {
276 for(
auto it = begin; it != end; ++it) {
286 template<
typename OutputIterator>
298 for(
auto it = begin; it != end; ++it) {
310 template<
typename OutputIterator>
315 std::string pattern =
"calctype.";
316 for(; it != end; ++it) {
321 if(fs::is_directory(*it)) {
322 std::string
dir = it->path().filename().string();
323 if(dir.substr(0, pattern.size()) == pattern) {
331 if(fs::is_regular_file(*it)) {
fs::path eci(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.json.
const PrimClex & m_primclex
boost::container::stable_vector< Supercell > & get_supercell_list()
Access entire supercell_list.
fs::path _if_relative(fs::path path)
make paths relative to m_primclex.get_path() if m_relative
fs::path composition_axes() const
Return composition axes file path.
fs::path SCEL() const
Return SCEL path.
Specification of CASM project directory structure.
fs::path get_path() const
Return casm project directory path.
OutputIterator _all_that_exist(OutputIterator result, fs::path location)
Get all regular files that exist in directory 'location'.
std::vector< std::string > m_all_property
fs::path calculated_properties(std::string configname, std::string calctype) const
Return calculated properties file path.
fs::path calc_settings_dir(std::string calctype) const
Return calculation settings directory path, for global settings.
fs::path supercell_calc_settings_dir(std::string scelname, std::string calctype) const
Return calculation settings directory path, for supercell specific settings.
fs::path configuration_calc_settings_dir(std::string configname, std::string calctype) const
Return calculation settings directory path, for configuration specific settings.
fs::path prim() const
Return prim.json path.
std::vector< std::string > all_eci(std::string property, std::string calctype, std::string ref, std::string bset) const
Check filesystem directory structure and return list of all eci names.
config_iterator config_begin()
Configuration iterator: begin.
config_iterator config_end()
Configuration iterator: end.
OutputIterator all_calc_files(OutputIterator result)
Enumerate all training data files.
fs::path enumerator_plugins() const
Return enumerators plugin dir.
OutputIterator calc_settings_files(OutputIterator result)
Enumerate calculation settings files.
fs::path bspecs(std::string bset) const
Return basis function specs (bspecs.json) file path.
std::string name() const
Get project name.
fs::path crystal_point_group() const
Return crystal_point_group.json path.
std::vector< std::string > m_all_calctype
OutputIterator basic_files(OutputIterator result)
Enumerate all setting independent files.
Read/modify settings of an already existing CASM project.
fs::path project_settings() const
Return project_settings.json path.
OutputIterator calc_status_files(OutputIterator result)
Enumerate calculation status files.
fs::path clust(std::string bset) const
fs::path eci_out(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.out.
fs::path clexulator_src(std::string project, std::string bset) const
Returns path to global clexulator source file.
OutputIterator eci_files(OutputIterator result)
Enumerate eci files.
fs::path basis(std::string bset) const
fs::path PRIM() const
Return PRIM path.
OutputIterator _if_exists(OutputIterator result, fs::path path)
output path if it exists
OutputIterator reference_files(OutputIterator result)
Enumerate reference files.
PrimClex is the top-level data structure for a CASM project.
fs::path calc_status(std::string configname, std::string calctype) const
Return calculation status file path.
fs::path lattice_point_group() const
Return lattice_point_group.json path.
Lists all files in a CASM project, for use with 'casm files' command.
fs::path config_list() const
Return master config_list.json file path.
OutputIterator bset_files(OutputIterator result)
Enumerate bset files.
FileEnumerator(const PrimClex &_primclex, bool _all_settings=false, bool _relative=false)
A CASM project file enumerator.
fs::path factor_group() const
Return factor_group.json path.
std::vector< std::string > m_all_bset
const ClexDescription & default_clex() const
fs::path chemical_reference(std::string calctype, std::string ref) const
Return chemical reference file path.
std::vector< std::string > all_ref(std::string calctype) const
Check filesystem directory structure and return list of all ref names for a given calctype...
fs::path training_data() const
Return 'training_data' directorty path.