SOLIDstate
A C++ library for solid state physics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Ring.hpp
Go to the documentation of this file.
1 
11 #ifndef GEOMETRY_RING_HPP
12 #define GEOMETRY_RING_HPP
13 
14 #include "Geometry.hpp"
15 #include "../Misc/Symmatgen.hpp"
16 
17 namespace solid
18 {
19 
36 template <typename T>
37 class Ring : public Geometry<T>, public IGeometry<T>
38 {
40 
41 private:
49  arma::SpMat<T> RingAdjacency(int L, T value)
50  {
51  arma::SpMat<T> ret(L, L);
52  for (int i = 0; i < L; i++)
53  ret(i, (i + 1) % L) = value;
54  return ret;
55  }
56 
64  void Create(int L, std::string key, T value) override
65  {
66  arma::SpMat<T> tmp(L, L);
67  switch (TermsTypeConverter::dict[key])
68  {
70  for (int i = 0; i < L; i++)
71  tmp(i, i) = value;
72  parameters[key] = tmp;
73  break;
75  tmp = RingAdjacency(L, value);
76  Symmatgen(tmp);
77  parameters[key] = tmp;
78  break;
80  tmp = RingAdjacency(L, value);
81  parameters[key] = tmp;
82  break;
84  tmp = RingAdjacency(L, value);
85  Symmatgen(tmp);
86  parameters[key] = tmp;
87  break;
88  }
89  }
90 
91 public:
98  Ring(int L, initList<T> param)
99  {
100  for (auto const &[key, value] : param)
101  Create(L, key, value);
102  }
103 
110  Ring(int L, uniformParameters<T> &param)
111  {
112  for (auto const &[key, value] : param)
113  Create(L, key, value);
114  }
115 };
116 
117 } // namespace solid
118 
119 #endif
Geometry parrent class.
Definition: Geometry.hpp:55
arma::SpMat< T > RingAdjacency(int L, T value)
Ring Adjacency function for Nonlocal Terms.
Definition: Ring.hpp:49
Ring(int L, initList< T > param)
Construct a new Ring object.
Definition: Ring.hpp:98
void Symmatgen(arma::SpMat< T > &mat)
Symmetrize the matrix by adding transpose to it .
Definition: Symmatgen.hpp:19
std::initializer_list< std::pair< const std::string, T >> initList
typedef for initializer_list
Definition: Geometry.hpp:28
void Create(int L, std::string key, T value) override
Create Ring (IGeometry) object.
Definition: Ring.hpp:64
Parameters< T > parameters
Definition: Geometry.hpp:59
Ring(int L, uniformParameters< T > &param)
Construct a new Ring object.
Definition: Ring.hpp:110
static std::map< std::string, TermsTypeEnum > dict
Dict which contains std::map between label and TermsTypeEnum.
Definition: TermsTypeConverter.hpp:42
Ring (IGeometry implementation) class.
Definition: Ring.hpp:37
Interface for Geometry class.
Definition: Geometry.hpp:44
std::map< std::string, T > uniformParameters
typedef for map<std::string, T>
Definition: Geometry.hpp:36
Geometry class header.