cctw  0.2.1
cctwunitcell.cpp
Go to the documentation of this file.
1 #include "cctwunitcell.h"
2 
4  m_A(0),
5  m_B(0),
6  m_C(0),
7  m_Alpha(0),
8  m_Beta(0),
9  m_Gamma(0)
10 {
11 }
12 
13 CctwUnitCell::CctwUnitCell(double a, double b, double c, double alpha, double beta, double gamma) :
14  m_A(a),
15  m_B(b),
16  m_C(c),
17  m_Alpha(alpha),
18  m_Beta(beta),
19  m_Gamma(gamma)
20 {
21 }
22 
24  m_A(lengths.x()),
25  m_B(lengths.y()),
26  m_C(lengths.z()),
27  m_Alpha(angles.x()),
28  m_Beta(angles.y()),
29  m_Gamma(angles.z())
30 {
31 }
32 
33 double CctwUnitCell::a() const
34 {
35  return m_A;
36 }
37 
38 double& CctwUnitCell::a()
39 {
40  return m_A;
41 }
42 
43 double CctwUnitCell::b() const
44 {
45  return m_B;
46 }
47 
48 double& CctwUnitCell::b()
49 {
50  return m_B;
51 }
52 
53 double CctwUnitCell::c() const
54 {
55  return m_C;
56 }
57 
58 double& CctwUnitCell::c()
59 {
60  return m_C;
61 }
62 
63 double CctwUnitCell::alpha() const
64 {
65  return m_Alpha;
66 }
67 
69 {
70  return m_Alpha;
71 }
72 
73 double CctwUnitCell::beta() const
74 {
75  return m_Beta;
76 }
77 
79 {
80  return m_Beta;
81 }
82 
83 double CctwUnitCell::gamma() const
84 {
85  return m_Gamma;
86 }
87 
89 {
90  return m_Gamma;
91 }
92 
93 void CctwUnitCell::setValue(double a, double b, double c, double alpha, double beta, double gamma)
94 {
95  m_A = a;
96  m_B = b;
97  m_C = c;
98  m_Alpha = alpha;
99  m_Beta = beta;
100  m_Gamma = gamma;
101 }
102 
104 {
105  m_A = lengths.x();
106  m_B = lengths.y();
107  m_C = lengths.z();
108 
109  m_Alpha = angles.x();
110  m_Beta = angles.y();
111  m_Gamma = angles.z();
112 }
113 
115 {
116  return CctwDoubleVector3D(m_A, m_B, m_C);
117 }
118 
120 {
122 }
123 
125 {
126  return a()==cell.a() && b()==cell.b() && c()==cell.c() &&
127  alpha()==cell.alpha() && beta()==cell.beta() && gamma()==cell.gamma();
128 }
129 
131 {
132  return a()!=cell.a() || b()!=cell.b() || c()!=cell.c() ||
133  alpha()!=cell.alpha() || beta()!=cell.beta() || gamma()!=cell.gamma();
134 }
135 
136 void CctwUnitCell::setSettingsValue(QSettings *settings, QString name)
137 {
138  settings->beginGroup(name);
139 
140  settings->setValue("a", a());
141  settings->setValue("b", b());
142  settings->setValue("c", c());
143  settings->setValue("alpha", alpha());
144  settings->setValue("beta", beta());
145  settings->setValue("gamma", gamma());
146 
147  settings->endGroup();
148 }
149 
150 void CctwUnitCell::customSaver(const QVariant &val, QSettings *settings, QString name)
151 {
152  CctwUnitCell vec = val.value<CctwUnitCell>();
153 
154  vec.setSettingsValue(settings, name);
155 }
156 
void setValue(double a, double b, double c, double alpha, double beta, double gamma)
bool operator==(const CctwUnitCell &cell) const
double beta() const
double b() const
double m_Alpha
Definition: cctwunitcell.h:50
double a() const
double alpha() const
void setSettingsValue(QSettings *settings, QString name)
T x() const
Definition: cctwvector3d.h:17
CctwDoubleVector3D angles() const
double m_Beta
Definition: cctwunitcell.h:51
T z() const
Definition: cctwvector3d.h:19
CctwDoubleVector3D lengths() const
bool operator!=(const CctwUnitCell &cell) const
double gamma() const
static void customSaver(const QVariant &val, QSettings *settings, QString name)
double c() const
double m_Gamma
Definition: cctwunitcell.h:52
T y() const
Definition: cctwvector3d.h:18
CctwVector3D< double > CctwDoubleVector3D
Definition: cctwvector3d.h:71