CASM  1.1.0
A Clusters Approach to Statistical Mechanics
PermuteIterator.hh
Go to the documentation of this file.
1 #ifndef PermuteIterator_HH
2 #define PermuteIterator_HH
3 
4 #include <vector>
5 
10 
11 namespace CASM {
12 
44  : public std::iterator<std::bidirectional_iterator_tag, PermuteIterator>,
45  public Comparisons<CRTPBase<PermuteIterator>> {
47 
50  std::vector<Permutation> const *m_trans_permute;
51 
54 
55  public:
57 
58  PermuteIterator(const PermuteIterator &iter);
59 
60  PermuteIterator(SupercellSymInfo const &_sym_info, Index _factor_group_index,
61  Index _translation_index);
62 
64 
67  const PermuteIterator &operator*() const;
68 
71  const PermuteIterator *operator->() const;
72 
76 
78  SymGroup const &factor_group() const;
79 
81  SupercellSymInfo const &sym_info() const;
82 
84  Index factor_group_index() const;
85 
88 
90  Index translation_index() const;
91 
93  const Permutation &factor_group_permute() const;
94 
96  const Permutation &translation_permute() const;
97 
100  SymOpRepresentation const &occ_rep(Index b) const;
101 
104  SymOpRepresentation const &local_dof_rep(DoFKey const &_key, Index b) const;
105 
108  SymOpRepresentation const &global_dof_rep(DoFKey const &_key) const;
109 
114  SymOp sym_op() const;
115 
119  Index permute_ind(Index i) const;
120 
121  bool operator<(const PermuteIterator &iter) const;
122 
123  // prefix ++PermuteIterator
125 
126  // postfix PermuteIterator++
128 
129  // prefix --PermuteIterator
131 
132  // postfix PermuteIterator--
134 
139 
140  PermuteIterator inverse() const;
141 
144  PermuteIterator operator*(const PermuteIterator &RHS) const;
145 
146  friend void swap(PermuteIterator &a, PermuteIterator &b);
147 
152  bool is_compatible(const PermuteIterator &other_permute_iterator) const {
153  return (&this->sym_info() == &other_permute_iterator->sym_info());
154  }
155 
156  private:
158 
159  bool eq_impl(const PermuteIterator &iter) const;
160 };
161 
164 template <typename IterType>
165 IterType begin_next_fg_op(IterType it, IterType end) {
166  Index tfg = it->factor_group_index();
167  for (++it; it != end; ++it) {
168  if (it->factor_group_index() != tfg) break;
169  }
170  return it;
171 }
172 
178 template <typename PermuteIteratorContainer>
179 SymGroup make_point_group(const PermuteIteratorContainer &container,
180  const Lattice &supercell_lattice) {
181  return make_point_group(container.begin(), container.end(),
183 }
184 
186 template <typename PermuteIteratorIt>
187 SymGroup make_point_group(PermuteIteratorIt begin, PermuteIteratorIt end,
188  const Lattice &supercell_lattice);
189 
195 template <typename PermuteIteratorContainer>
196 SymGroup make_sym_group(const PermuteIteratorContainer &container,
197  const Lattice &supercell_lattice) {
198  return make_sym_group(container.begin(), container.end(), supercell_lattice);
199 }
200 
202 template <typename PermuteIteratorIt>
203 SymGroup make_sym_group(PermuteIteratorIt begin, PermuteIteratorIt end,
204  const Lattice &supercell_lattice);
205 
212 template <typename PermuteIteratorContainer>
213 std::unique_ptr<SymGroup> make_unique_sym_group(
214  const PermuteIteratorContainer &container,
215  const Lattice &supercell_lattice) {
216  return make_unique_sym_group(container.begin(), container.end(),
218 }
219 
221 template <typename PermuteIteratorIt>
222 std::unique_ptr<SymGroup> make_unique_sym_group(
223  PermuteIteratorIt begin, PermuteIteratorIt end,
224  const Lattice &supercell_lattice);
225 
227 bool site_indices_are_invariant(PermuteIterator const &permute_it,
228  std::set<Index> const &site_indices);
229 
230 jsonParser &to_json(const PermuteIterator &clust, jsonParser &json);
231 
232 class SupercellSymInfo;
233 
234 template <typename T>
235 struct jsonConstructor;
236 
237 template <>
239  static PermuteIterator from_json(const jsonParser &json,
240  const SupercellSymInfo &scel_info);
241 };
242 
243 namespace adapter {
244 
245 template <typename ToType, typename FromType>
246 struct Adapter;
247 
249 template <>
251  SymOp operator()(PermuteIterator const &adaptable) const;
252 };
253 } // namespace adapter
254 
256 } // namespace CASM
257 #endif
Index prim_factor_group_index() const
Return the prim factor group index.
bool operator<(const PermuteIterator &iter) const
SupercellSymInfo const * m_sym_info
SupercellSymInfo const & sym_info() const
Reference the SupercellSymInfo containing the operations being pointed at.
bool is_compatible(const PermuteIterator &other_permute_iterator) const
PermuteIterator begin_next_fg_op() const
SymOpRepresentation const & global_dof_rep(DoFKey const &_key) const
Index factor_group_index() const
Return the supercell factor group index.
const Permutation & translation_permute() const
Return the translation permutation being pointed at.
SymOpRepresentation const & local_dof_rep(DoFKey const &_key, Index b) const
bool eq_impl(const PermuteIterator &iter) const
PermuteIterator inverse() const
PermuteIterator & operator--()
Index translation_index() const
Return the index into the supercell translation permutations.
const PermuteIterator * operator->() const
Returns a pointer to this.
const Permutation & factor_group_permute() const
Return the factor group permutation being pointed at.
SymOpRepresentation const & occ_rep(Index b) const
const PermuteIterator & operator*() const
Returns a reference to this.
friend void swap(PermuteIterator &a, PermuteIterator &b)
Permutation combined_permute() const
Index permute_ind(Index i) const
PermuteIterator & operator=(PermuteIterator iter)
PermuteIterator & operator++()
std::vector< Permutation > const * m_trans_permute
SymGroup const & factor_group() const
Reference the SupercellSymInfo::factor_group()
A class that collects all symmetry information for for performing symmetry transformations on the sit...
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
SymOpRepresentation is the base class for anything describes a symmetry operation.
VectorXdSupercellSymInfoFormatter supercell_lattice()
Main CASM namespace.
Definition: APICommand.hh:8
IterType begin_next_fg_op(IterType it, IterType end)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
SymGroup make_sym_group(const PermuteIteratorContainer &container, const Lattice &supercell_lattice)
Returns a SymGroup generated from a container of PermuteIterator.
bool site_indices_are_invariant(PermuteIterator const &permute_it, std::set< Index > const &site_indices)
Return true if the permutation does not mix given sites and other sites.
std::string DoFKey
Definition: DoFDecl.hh:7
std::unique_ptr< SymGroup > make_unique_sym_group(const PermuteIteratorContainer &container, const Lattice &supercell_lattice)
Returns a std::unique_ptr<SymGroup> generated from a container of PermuteIterator.
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
SymGroup make_point_group(const PermuteIteratorContainer &container, const Lattice &supercell_lattice)
Returns a SymGroup generated from a container of PermuteIterator.
Helper struct for constructing objects that need additional data.
Definition: jsonParser.hh:548
static ReturnType from_json(const jsonParser &json)
Default from_json is equivalent to.
Definition: jsonParser.hh:551
Implements other comparisons in terms of '<'.
Definition: Comparisons.hh:25