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