CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DB::ImportT< _ConfigType > Class Template Referenceabstract

#include <Import.hh>

+ Inheritance diagram for CASM::DB::ImportT< _ConfigType >:

Detailed Description

template<typename _ConfigType>
class CASM::DB::ImportT< _ConfigType >

Generic ConfigType-dependent part of Import.

Definition at line 66 of file Import.hh.

Public Types

using ConfigType = _ConfigType
 

Public Member Functions

 ImportT (const PrimClex &primclex, const StructureMap< ConfigType > &mapper, ImportSettings const &_set, std::string report_dir)
 Constructor. More...
 
template<typename PathIterator >
void import (PathIterator begin, PathIterator end)
 
ImportSettings const & settings () const
 

Protected Member Functions

virtual DataFormatter< ConfigIO::Result_import_formatter () const =0
 Allow ConfigType to specialize the report formatting for 'import'. More...
 
const PrimClexprimclex () const
 
Database< Supercell > & db_supercell () const
 Path to default calctype training_data directory for config. More...
 
template<typename ConfigType >
Database< ConfigType > & db_config () const
 
PropertiesDatabasedb_props () const
 Uses primclex().settings().default_clex().calctype. More...
 
std::string calc_dir (const std::string configname) const
 Path to default calctype training_data directory for config. More...
 
bool has_existing_files (const std::string &to_configname) const
 Return true if there are existing files in the traning_data directory for a particular configuration. More...
 
bool has_existing_data (const std::string &to_configname) const
 Return true if there are existing files in the traning_data directory for a particular configuration. More...
 
bool has_existing_data_or_files (const std::string &to_configname) const
 
bool no_change (const std::string &configname) const
 Check if 'properties.calc.json' file has not changed since last read. More...
 
void rm_files (const std::string &configname, bool dry_run) const
 Remove existing files in the traning_data directory for a particular configuration. More...
 
void cp_files (ConfigIO::Result &res, bool dry_run, bool copy_additional_files) const
 Copy files in the same directory as properties.calc.json into the traning_data directory for a particular configuration. More...
 

Static Protected Member Functions

static std::string resolve_struc_path (std::string pos_path, PrimClex const &_pclex)
 Checks if pos_path can be used to resolve a properties.calc.json, and return its path Return path to properties.calc.json or POSCAR-type file that will be imported checking a couple possible locations relative to pos_path. More...
 

Private Member Functions

void _import_report (std::vector< ConfigIO::Result > &results) const
 
void _copy_files (std::vector< ConfigIO::Result > &results) const
 

Private Attributes

const StructureMap< ConfigType > & m_structure_mapper
 
ImportSettings m_set
 
std::string m_report_dir
 
const PrimClexm_primclex
 
std::function< PropertiesDatabase &()> m_db_props_func
 

Member Typedef Documentation

◆ ConfigType

template<typename _ConfigType >
using CASM::DB::ImportT< _ConfigType >::ConfigType = _ConfigType

Definition at line 68 of file Import.hh.

Constructor & Destructor Documentation

◆ ImportT()

template<typename _ConfigType >
CASM::DB::ImportT< _ConfigType >::ImportT ( const PrimClex primclex,
const StructureMap< ConfigType > &  mapper,
ImportSettings const &  _set,
std::string  report_dir 
)

Constructor.

Definition at line 86 of file Import_impl.hh.

Member Function Documentation

◆ _copy_files()

template<typename _ConfigType >
void CASM::DB::ImportT< _ConfigType >::_copy_files ( std::vector< ConfigIO::Result > &  results) const
private

Definition at line 185 of file Import_impl.hh.

◆ _import_formatter()

template<typename _ConfigType >
virtual DataFormatter<ConfigIO::Result> CASM::DB::ImportT< _ConfigType >::_import_formatter ( ) const
protectedpure virtual

Allow ConfigType to specialize the report formatting for 'import'.

Implemented in CASM::DB::Import< Configuration >.

◆ _import_report()

template<typename _ConfigType >
void CASM::DB::ImportT< _ConfigType >::_import_report ( std::vector< ConfigIO::Result > &  results) const
private

Definition at line 223 of file Import_impl.hh.

◆ calc_dir()

std::string CASM::DB::ConfigData::calc_dir ( const std::string  configname) const
inherited

Path to default calctype training_data directory for config.

Definition at line 237 of file ConfigData.cc.

◆ cp_files()

void CASM::DB::ConfigData::cp_files ( ConfigIO::Result res,
bool  dry_run,
bool  copy_additional_files 
) const
inherited

Copy files in the same directory as properties.calc.json into the traning_data directory for a particular configuration.

  • First: calc_props_path = _calc_properties_path(pos_path) to get properties.calc.json location
  • If calc_props_path.empty(), return
  • else if !copy_additional_files copy properties.calc.json file only and return
  • else, recursively copy all files from calc_props_path.remove_filename() to the training data directory for the current calctype
Returns
{did_cp, did_cp_more}:
  • did_cp: if properties.calc.json file was found and copied
  • did_cp_more: if additional files were found and copied

Definition at line 307 of file ConfigData.cc.

◆ db_config()

template<typename ConfigType >
Database< ConfigType > & CASM::DB::ConfigData::db_config
inherited

Definition at line 22 of file ConfigData_impl.hh.

◆ db_props()

PropertiesDatabase & CASM::DB::ConfigData::db_props ( ) const
inherited

Uses primclex().settings().default_clex().calctype.

Definition at line 234 of file ConfigData.cc.

◆ db_supercell()

Database< Supercell > & CASM::DB::ConfigData::db_supercell ( ) const
inherited

Path to default calctype training_data directory for config.

Definition at line 230 of file ConfigData.cc.

◆ has_existing_data()

bool CASM::DB::ConfigData::has_existing_data ( const std::string &  to_configname) const
inherited

Return true if there are existing files in the traning_data directory for a particular configuration.

Return true if there is data already associated with a particular configuration.

Definition at line 257 of file ConfigData.cc.

◆ has_existing_data_or_files()

bool CASM::DB::ConfigData::has_existing_data_or_files ( const std::string &  to_configname) const
inherited

Definition at line 261 of file ConfigData.cc.

◆ has_existing_files()

bool CASM::DB::ConfigData::has_existing_files ( const std::string &  to_configname) const
inherited

Return true if there are existing files in the traning_data directory for a particular configuration.

Definition at line 247 of file ConfigData.cc.

◆ import()

template<typename _ConfigType >
template<typename PathIterator >
void CASM::DB::ImportT< _ConfigType >::import ( PathIterator  begin,
PathIterator  end 
)

Definition at line 97 of file Import_impl.hh.

◆ no_change()

bool CASM::DB::ConfigData::no_change ( const std::string &  configname) const
inherited

Check if 'properties.calc.json' file has not changed since last read.

Check if 'properties.calc.json' file has not changed since last read

  • Compares 'data_timestamp' && fs::last_write_time

Definition at line 269 of file ConfigData.cc.

◆ primclex()

const PrimClex& CASM::DB::ConfigData::primclex ( ) const
inlineinherited

Definition at line 152 of file ConfigData.hh.

◆ resolve_struc_path()

std::string CASM::DB::ConfigData::resolve_struc_path ( std::string  pos_path,
PrimClex const &  _pclex 
)
staticinherited

Checks if pos_path can be used to resolve a properties.calc.json, and return its path Return path to properties.calc.json or POSCAR-type file that will be imported checking a couple possible locations relative to pos_path.

checks: 1) is a JSON file? is pos_path ends in ".json" or ".JSON", return pos_path 2) assume pos_path is /path/to/POS, checks for /path/to/calctype.current/properties.calc.json 3) assume pos_path is /path/to/POS, checks for /path/to/properties.calc.json else returns pos_path

Definition at line 222 of file ConfigData.cc.

◆ rm_files()

void CASM::DB::ConfigData::rm_files ( const std::string &  configname,
bool  dry_run 
) const
inherited

Remove existing files in the traning_data directory for a particular configuration.

Definition at line 282 of file ConfigData.cc.

◆ settings()

template<typename _ConfigType >
ImportSettings const& CASM::DB::ImportT< _ConfigType >::settings ( ) const
inline

Definition at line 77 of file Import.hh.

Member Data Documentation

◆ m_db_props_func

std::function<PropertiesDatabase &()> CASM::DB::ConfigData::m_db_props_func
privateinherited

Definition at line 192 of file ConfigData.hh.

◆ m_primclex

const PrimClex& CASM::DB::ConfigData::m_primclex
privateinherited

Definition at line 191 of file ConfigData.hh.

◆ m_report_dir

template<typename _ConfigType >
std::string CASM::DB::ImportT< _ConfigType >::m_report_dir
private

Definition at line 94 of file Import.hh.

◆ m_set

template<typename _ConfigType >
ImportSettings CASM::DB::ImportT< _ConfigType >::m_set
private

Definition at line 92 of file Import.hh.

◆ m_structure_mapper

template<typename _ConfigType >
const StructureMap<ConfigType>& CASM::DB::ImportT< _ConfigType >::m_structure_mapper
private

Definition at line 90 of file Import.hh.


The documentation for this class was generated from the following files: