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
alps_lattice Class Reference

#include <lattice.hpp>

Inheritance diagram for alps_lattice:
lattice_impl

Public Types

typedef lattice_impl::pos_t pos_t
 
typedef alps::graph_helper graph_type
 
typedef graph_type::site_descriptor site_descriptor
 
typedef graph_type::site_iterator site_iterator
 

Public Member Functions

 alps_lattice (const alps::Parameters &p)
 
std::vector< pos_tforward (pos_t p) const
 
std::vector< pos_tall (pos_t p) const
 
pos_t size () const
 
int maximum_vertex_type () const
 
boost::any get_prop_ (std::string const &property, std::vector< pos_t > const &pos) const
 
const graph_typealps_graph () 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 41 of file lattice.hpp.

Member Typedef Documentation

typedef alps::graph_helper alps_lattice::graph_type

Definition at line 46 of file lattice.hpp.

Definition at line 45 of file lattice.hpp.

typedef graph_type::site_descriptor alps_lattice::site_descriptor

Definition at line 47 of file lattice.hpp.

typedef graph_type::site_iterator alps_lattice::site_iterator

Definition at line 48 of file lattice.hpp.

Constructor & Destructor Documentation

alps_lattice::alps_lattice ( const alps::Parameters &  p)
inline

Definition at line 50 of file lattice.hpp.

51  : parms(p)
52  , graph(parms)
53  {
54  // storing lattice informations
55  forward_.resize(size());
56  backward_.resize(size());
57 
58  for (graph_type::bond_iterator it=graph.bonds().first; it!=graph.bonds().second; ++it) {
59  graph_type::size_type s, t;
60  s = graph.vertex_index(graph.source(*it));
61  t = graph.vertex_index(graph.target(*it));
62 
63  forward_[s].push_back(t);
64  backward_[t].push_back(s);
65 
66  bond_index_map[s][t] = graph.edge_index(*it);
67  bond_index_map[t][s] = graph.edge_index(*it);
68  }
69  }
pos_t size() const
Definition: lattice.hpp:82

Member Function Documentation

std::vector<pos_t> alps_lattice::all ( pos_t  p) const
inlinevirtual

Implements lattice_impl.

Definition at line 75 of file lattice.hpp.

76  {
77  std::vector<pos_t> ret = forward_[p];
78  std::copy(backward_[p].begin(), backward_[p].end(), std::back_inserter(ret));
79  return ret;
80  }
const graph_type& alps_lattice::alps_graph ( ) const
inline

Definition at line 114 of file lattice.hpp.

115  {
116  return graph;
117  }
std::vector<pos_t> alps_lattice::forward ( pos_t  p) const
inlinevirtual

Implements lattice_impl.

Definition at line 71 of file lattice.hpp.

72  {
73  return forward_[p];
74  }
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 alps_lattice::get_prop_ ( std::string const &  property,
std::vector< pos_t > const &  pos 
) const
inlinevirtual

Implements lattice_impl.

Definition at line 92 of file lattice.hpp.

93  {
94  if (property == "label" && pos.size() == 1)
95  return boost::any( alps::site_label(graph.graph(), graph.site(pos[0])) );
96  else if (property == "label" && pos.size() == 2)
97  return boost::any( alps::bond_label(graph.graph(), graph.bond(bond_index_map[pos[0]][pos[1]])) );
98  else if (property == "type" && pos.size() == 1)
99  return boost::any( static_cast<int>(graph.site_type(graph.site(pos[0]))) );
100  else if (property == "type" && pos.size() == 2)
101  return boost::any( static_cast<int>(graph.bond_type(graph.bond(bond_index_map[pos[0]][pos[1]]))) );
102  else if (property == "wraps_pbc" && pos.size() == 2)
103  return boost::any( static_cast<bool>(boost::get(alps::boundary_crossing_t(),
104  graph.graph(),
105  graph.bond(bond_index_map[pos[0]][pos[1]]))) );
106  else {
107  std::ostringstream ss;
108  ss << "No property '" << property << "' with " << pos.size() << " points implemented.";
109  throw std::runtime_error(ss.str());
110  return boost::any();
111  }
112  }
int alps_lattice::maximum_vertex_type ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 87 of file lattice.hpp.

88  {
89  return alps::maximum_vertex_type(graph.graph());
90  }
pos_t alps_lattice::size ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 82 of file lattice.hpp.

83  {
84  return graph.num_sites();
85  }

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