CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ConfigIOSelected.cc
Go to the documentation of this file.
2 
3 namespace CASM {
4  namespace ConfigIO {
5 
6  void Selected::init(const Configuration &_tmplt) const {
7  if(m_selection.size() == 0) {
8  if(m_selection_name.empty())
9  m_selection_name = "MASTER";
11  }
12  else if(m_selection_name.empty()) {
14  if(m_selection_name.empty())
15  m_selection_name = "unknown";
16  }
17  }
18 
19  std::unique_ptr<Selected> Selected::clone() const {
20  return std::unique_ptr<Selected>(this->_clone());
21  }
22 
24  return new Selected(*this);
25  }
26 
27  std::string Selected::short_header(const Configuration &_config) const {
28  return name() + "(" + m_selection_name + ")";
29  }
30 
31  bool Selected::evaluate(const Configuration &_config) const {
32  return m_selection.selected(_config.name());
33  }
34 
35  bool Selected::parse_args(const std::string &args) {
36  if(m_selection.size() || m_selection_name.size()) {
37  return false;
38  }
39 
40  m_selection_name = args;
41  return true;
42  }
43  }
44 }
ConstConfigSelection m_selection
const std::string & name() const
Returns a name for the formatter, which becomes the tag used for parsing.
PrimClex & get_primclex() const
Get the PrimClex for this Configuration.
bool parse_args(const std::string &args) override
bool selected(const std::string &configname) const
check if configuration is selected (returns false if 'configname' cannot be found ...
bool evaluate(const Configuration &_config) const override
Main CASM namespace.
Definition: complete.cpp:8
std::unique_ptr< Selected > clone() const
void init(const Configuration &_tmplt) const override
std::string name() const
SCELV_A_B_C_D_E_F/i.
std::string short_header(const Configuration &_config) const override
Selected * _clone() const override
Clone.
ConfigSelection< true > ConstConfigSelection
A Configuration represents the values of all degrees of freedom in a Supercell.
Returns true if configuration is specified in given selection (default: MASTER)
const std::string & name() const