CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ConfigDoFCompare.hh
Go to the documentation of this file.
1 #ifndef CASM_ConfigDoFCompare
2 #define CASM_ConfigDoFCompare
3 
5 
6 namespace CASM {
7 
13  class ConfigDoFCompare {
18 
19  public:
20 
31  template<typename ConfigDoFIsEquivalentType>
32  ConfigDoFCompare(std::unique_ptr<ConfigDoFIsEquivalentType> f) :
33  m_f(f) {}
34 
35 
37  bool operator()(const Configuration &other) const {
38  return (*this)(other.configdof());
39  }
40 
42  bool operator()(const ConfigDoF &other) const {
43  if((*m_f)(other)) {
44  return false;
45  }
46  return m_f->is_less();
47  }
48 
50  bool operator()(const PermuteIterator &A) const {
51  if((*m_f)(A)) {
52  return false;
53  }
54  return m_f->is_less();
55  }
56 
58  bool operator()(const PermuteIterator &A, const PermuteIterator &B) const {
59  if((*m_f)(A, B)) {
60  return false;
61  }
62  return m_f->is_less();
63  }
64 
65  private:
67 
68  };
69 
73  template<typename ConfigDoFIsEquivalentType, typename ...Args>
75  return ConfigDoFCompare(notstd::make_unique<ConfigDoFIsEquivalentType>(std::forward<Args>(args)...));
76  }
77 
79 }
80 
81 #endif
Wrapper class for generic less than comparison of ConfigDoF.
const ConfigDoF & configdof() const
const Access the DoF
Main CASM namespace.
Definition: complete.cpp:8
bool operator()(const Configuration &other) const
Return config < other.
bool operator()(const PermuteIterator &A) const
Return config < A*config.
ConfigDoFCompare make_dof_compare(Args &&...args)
A container class for the different degrees of freedom a Configuration might have.
Definition: ConfigDoF.hh:27
notstd::cloneable_ptr< DoFIsEquivalent::ConfigDoFIsEquivalentBase > m_f
ConfigDoFCompare(std::unique_ptr< ConfigDoFIsEquivalentType > f)
Construct a ConfigDoFCompare object for a particular DoF type.
bool operator()(const ConfigDoF &other) const
Return config < other.
bool operator()(const PermuteIterator &A, const PermuteIterator &B) const
Return A*config < B*config.
A Configuration represents the values of all degrees of freedom in a Supercell.