ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
SquareLattice Class Reference

#include <lattice.hpp>

Inheritance diagram for SquareLattice:
lattice_impl

Public Types

typedef int pos_t
 

Public Member Functions

 SquareLattice (BaseParameters &parms)
 
std::vector< int > forward (int p) const
 
std::vector< int > all (int p) const
 
int size () const
 
int maximum_vertex_type () const
 
boost::any get_prop_ (std::string const &property, std::vector< pos_t > const &pos) const
 
template<class T >
get_prop (std::string property, pos_t site) const
 
template<class T >
get_prop (std::string property, pos_t bond1, pos_t bond2) const
 
template<class T >
get_prop (std::string property, std::vector< pos_t > const &positions) const
 

Detailed Description

Definition at line 141 of file lattice.hpp.

Member Typedef Documentation

typedef int lattice_impl::pos_t
inherited

Definition at line 41 of file lattice.h.

Constructor & Destructor Documentation

SquareLattice::SquareLattice ( BaseParameters parms)
inline

Definition at line 144 of file lattice.hpp.

145  : L_(parms["L"])
146  , W_(parms["W"])
147  , a(parms["a"])
148  { }

Member Function Documentation

std::vector<int> SquareLattice::all ( int  p) const
inlinevirtual

Implements lattice_impl.

Definition at line 171 of file lattice.hpp.

172  {
173  std::vector<int> ret = forward(p);
174  if (p >= 1 && p % W_ != 0)
175  ret.push_back(p-1);
176  if (p >= W_)
177  ret.push_back(p-W_);
178 
179  return ret;
180  }
std::vector< int > forward(int p) const
Definition: lattice.hpp:156
std::vector<int> SquareLattice::forward ( int  p) const
inlinevirtual

Implements lattice_impl.

Definition at line 156 of file lattice.hpp.

157  {
158  std::vector<int> ret;
159  if (p+1 < L_*W_ && (p+1) % W_ != 0)
160  ret.push_back(p+1);
161  if (p+W_ < L_*W_)
162  ret.push_back(p+W_);
163 
164  // maquis::cout << p << " -> ";
165  // std::copy(ret.begin(), ret.end(), std::ostream_iterator<int>(maquis::cout, " "));
166  // maquis::cout << std::endl;
167 
168  return ret;
169  }
template<class T >
T lattice_impl::get_prop ( std::string  property,
pos_t  site 
) const
inlineinherited

Definition at line 49 of file lattice.h.

51  {
52  return boost::any_cast<T>(get_prop_(property, std::vector<pos_t>(1, site)));
53  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
template<class T >
T lattice_impl::get_prop ( std::string  property,
pos_t  bond1,
pos_t  bond2 
) const
inlineinherited

Definition at line 55 of file lattice.h.

57  {
58  std::vector<pos_t> v(2);
59  v[0] = bond1; v[1] = bond2;
60  return boost::any_cast<T>(get_prop_(property, v));
61  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
template<class T >
T lattice_impl::get_prop ( std::string  property,
std::vector< pos_t > const &  positions 
) const
inlineinherited

Definition at line 63 of file lattice.h.

65  {
66  return boost::any_cast<T>(get_prop_(property, positions));
67  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
boost::any SquareLattice::get_prop_ ( std::string const &  property,
std::vector< pos_t > const &  pos 
) const
inlinevirtual

Implements lattice_impl.

Definition at line 190 of file lattice.hpp.

191  {
192  if (property == "label" && pos.size() == 1)
193  return boost::any( site_label(pos[0]) );
194  else if (property == "label" && pos.size() == 2)
195  return boost::any( bond_label(pos[0], pos[1]) );
196  else if (property == "type" && pos.size() == 1)
197  return boost::any( 0 );
198  else if (property == "type" && pos.size() == 2)
199  return boost::any( 0 );
200  else if (property == "x" && pos.size() == 1)
201  return boost::any( x(pos[0]) );
202  else if (property == "y" && pos.size() == 1)
203  return boost::any( y(pos[0]) );
204  else if (property == "wraps_pbc" && pos.size() == 2)
205  return boost::any( false );
206  else {
207  std::ostringstream ss;
208  ss << "No property '" << property << "' with " << pos.size() << " points implemented.";
209  throw std::runtime_error(ss.str());
210  return boost::any();
211  }
212  }
int SquareLattice::maximum_vertex_type ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 184 of file lattice.hpp.

185  {
186  return 0;
187  }
int SquareLattice::size ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 182 of file lattice.hpp.

182 { return L_*W_; }

The documentation for this class was generated from the following file: