CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ConfigDoFCompare.hh
Go to the documentation of this file.
1 #ifndef CASM_ConfigDoFCompare
2 #define CASM_ConfigDoFCompare
3 
5 
6 namespace CASM {
7 
19  public:
33  template <typename ConfigDoFIsEquivalentType>
34  ConfigDoFCompare(std::unique_ptr<ConfigDoFIsEquivalentType> f) : m_f(f) {}
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 
66  bool operator()(const PermuteIterator &A, const Configuration &other) const {
67  if ((*m_f)(A, other.configdof())) {
68  return false;
69  }
70  return m_f->is_less();
71  }
72 
74  bool operator()(const PermuteIterator &A, const ConfigDoF &other) const {
75  if ((*m_f)(A, other)) {
76  return false;
77  }
78  return m_f->is_less();
79  }
80 
82  bool operator()(const PermuteIterator &A, const PermuteIterator &B,
83  const Configuration &other) const {
84  if ((*m_f)(A, B, other.configdof())) {
85  return false;
86  }
87  return m_f->is_less();
88  }
89 
91  bool operator()(const PermuteIterator &A, const PermuteIterator &B,
92  const ConfigDoF &other) const {
93  if ((*m_f)(A, B, other)) {
94  return false;
95  }
96  return m_f->is_less();
97  }
98 
99  private:
101 };
102 
106 template <typename ConfigDoFIsEquivalentType, typename... Args>
108  return ConfigDoFCompare(notstd::make_unique<ConfigDoFIsEquivalentType>(
109  std::forward<Args>(args)...));
110 }
111 
113 } // namespace CASM
114 
115 #endif
Wrapper class for generic less than comparison of ConfigDoF.
ConfigDoFCompare(std::unique_ptr< ConfigDoFIsEquivalentType > f)
Construct a ConfigDoFCompare object for a particular DoF type.
bool operator()(const PermuteIterator &A) const
Return config < A*config.
bool operator()(const PermuteIterator &A, const ConfigDoF &other) const
Return config < A*other.
bool operator()(const PermuteIterator &A, const Configuration &other) const
Return config < A*other.
bool operator()(const PermuteIterator &A, const PermuteIterator &B, const Configuration &other) const
Return A*config < B*other.
notstd::cloneable_ptr< ConfigDoFIsEquivalent::Base > m_f
bool operator()(const PermuteIterator &A, const PermuteIterator &B, const ConfigDoF &other) const
Return A*config < B*other.
bool operator()(const PermuteIterator &A, const PermuteIterator &B) const
Return A*config < B*config.
ConfigDoFCompare make_dof_compare(Args &&... args)
bool operator()(const Configuration &other) const
Return config < other.
bool operator()(const ConfigDoF &other) const
Return config < other.
const ConfigDoF & configdof() const
const Access the DoF
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
Main CASM namespace.
Definition: APICommand.hh:8