PSCF v1.1
SymmetryGroup.h
1#ifndef PSCF_SYMMETRY_GROUP_H
2#define PSCF_SYMMETRY_GROUP_H
3
4/*
5* Pscfatico - Simulation Package for Polymeric and Molecular Liquids
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11//#include <iostream>
12#include <vector>
13
14namespace Pscf
15{
16
35 template <class Symmetry>
37 {
38
39 public:
40
47
52
57
63
72 bool add(Symmetry& symmetry);
73
77 void makeCompleteGroup();
78
84 void clear();
85
92 const Symmetry* find(const Symmetry& symmetry) const;
93
97 const Symmetry& identity() const;
98
102 int size() const;
103
109 Symmetry& operator [] (int i);
110
116 const Symmetry& operator [] (int i) const;
117
126 bool operator == (SymmetryGroup<Symmetry> const & other) const;
127
136 bool operator != (SymmetryGroup<Symmetry> const & other) const;
137
141 bool isValid() const;
142
143 private:
144
145 // Array of symmetry elements
146 std::vector<Symmetry> elements_;
147
148 // Identity element
149 Symmetry identity_;
150
151 };
152
153
154 // Inline member function definitions
155
156 /*
157 * Return the current size of the group.
158 */
159 template <class Symmetry>
160 inline
162 { return elements_.size(); }
163
164 /*
165 * Return identity element.
166 */
167 template <class Symmetry>
168 inline
169 const Symmetry& SymmetryGroup<Symmetry>::identity() const
170 { return identity_; }
171
172 /*
173 * Element access operator (by reference).
174 */
175 template <class Symmetry>
176 inline
178 { return elements_[i]; }
179
180 /*
181 * Element access operator (by reference).
182 */
183 template <class Symmetry>
184 inline
185 const Symmetry& SymmetryGroup<Symmetry>::operator [] (int i) const
186 { return elements_[i]; }
187
188 #ifndef PSCF_SYMMETRY_GROUP_TPP
189 template <int D> class SpaceSymmetry;
190 extern template class SymmetryGroup< SpaceSymmetry<1> >;
191 extern template class SymmetryGroup< SpaceSymmetry<2> >;
192 extern template class SymmetryGroup< SpaceSymmetry<3> >;
193 #endif
194
195}
196#endif
A SpaceSymmetry represents a crystallographic space group symmetry.
Class template for a group of elements.
Definition: SymmetryGroup.h:37
bool operator!=(SymmetryGroup< Symmetry > const &other) const
Inequality operator.
const Symmetry & identity() const
Return a reference to the identity element.
void clear()
Remove all elements except the identity.
bool operator==(SymmetryGroup< Symmetry > const &other) const
Equality operator.
~SymmetryGroup()
Destructor.
SymmetryGroup()
Default constructor.
const Symmetry * find(const Symmetry &symmetry) const
Find a symmetry within a group.
Symmetry & operator[](int i)
Element access operator (by reference).
bool isValid() const
Return true if valid complete group, or throw an Exception.
int size() const
Return number of elements in group (i.e., the order of the group).
SymmetryGroup< Symmetry > & operator=(const SymmetryGroup< Symmetry > &other)
Assignment operator.
bool add(Symmetry &symmetry)
Add a new element to the group.
void makeCompleteGroup()
Generate a complete group from the current elements.
C++ namespace for polymer self-consistent field theory (PSCF).