ALPS Project: lattice library

Header file: lattice/latticegraph.h

defines a function to create a graph from a lattice, and a template class that decorates a lattice with a graph.

Synopsis

namespace alps {

template <class LATTICE, class GRAPH>
void make_graph_from_lattice(GRAPH& g,const LATTICE& l);

template <class LATTICE, class GRAPH>
class lattice_graph : public LATTICE
{
public:
typedef LATTICE base_type;
typedef GRAPH graph_type;

typedef typename lattice_traits<base_type>::unit_cell_type unit_cell_type;
typedef typename lattice_traits<base_type>::offset_type offset_type;
typedef typename lattice_traits<base_type>::cell_descriptor cell_descriptor;
typedef typename lattice_traits<base_type>::vector_type vector_type;
typedef typename lattice_traits<base_type>::basis_vector_iterator basis_vector_iterator;
typedef typename lattice_traits<base_type>::cell_iterator cell_iterator;
typedef typename lattice_traits<base_type>::boundary_crossing_type boundary_crossing_type;

typedef typename boost::graph_traits<graph_type>::vertex_iterator vertex_iterator;
typedef typename boost::graph_traits<graph_type>::edge_iterator edge_iterator;

lattice_graph();
template <class L>
lattice_graph(const L&);

const graph_type& graph() const { return graph_;}
graph_type& graph() { return graph_;}
};


template <class L, class G>
struct lattice_traits<lattice_graph<L,G> >
{
typedef typename lattice_graph<L,G>::unit_cell_type unit_cell_type;
typedef typename lattice_graph<L,G>::cell_descriptor cell_descriptor;
typedef typename lattice_graph<L,G>::offset_type offset_type;
typedef typename lattice_graph<L,G>::basis_vector_iterator basis_vector_iterator;
typedef typename lattice_graph<L,G>::cell_iterator cell_iterator;
typedef typename lattice_graph<L,G>::size_type size_type;
typedef typename lattice_graph<L,G>::vector_type vector_type;
typedef typename lattice_graph<L,G>::boundary_crossing_type boundary_crossing_type;
};

}

The make_graph_from_lattice function

template <class L, class G>
void make_graph_from_lattice(G& G,const L& l);
creates a graph from a lattice l that is a model of FiniteLattice and of CoordinateLattice. The unitcell of the graph has to be a model of GraphUnitCell. The graph type G has to be a model of ReflectablePropertyGraph.

The function takes the unit cell graph lattice::graph(lattice::unit_cell(l)) and decorates all cells with this graph, as discussed in the documentation of the the lattice XML schema on http://xml.comp-phys.org/.

The following properties are set if the graph type G supports them:

The lattice_graph adaptor class

takes a lattice and adorns it with a graph. The graph is created by the make_graph_from_lattice function.

Type defintions

typedef LATTICE base_type;
is the underlying lattice type, and also the type from which lattice_graph is derived.
typedef GRAPH graph_type;
is the type of graph that is attached to the lattice. It has to model the ReflectablePropertyGraph concept.
typedef typename lattice_traits<base_type>::unit_cell_type unit_cell_type;
typedef typename lattice_traits<base_type>::offset_type offset_type;
typedef typename lattice_traits<base_type>::cell_descriptor cell_descriptor;
typedef typename lattice_traits<base_type>::vector_type vector_type;
typedef typename lattice_traits<base_type>::basis_vector_iterator basis_vector_iterator;
typedef typename lattice_traits<base_type>::cell_iterator cell_iterator;
typedef typename lattice_traits<base_type>::boundary_crossing_type boundary_crossing_type;
have the same meaning as the corresponding members of the lattice_traits class discussed for the lattice concepts.
typedef typename boost::graph_traits::vertex_iterator vertex_iterator;
typedef typename boost::graph_traits::edge_iterator edge_iterator;
are iterators over the edges and vertices of the graph.

Constructors

lattice_graph();
The default constructor.
template <class L>
lattice_graph(const L&);
copies the lattice given as argument and creates a graph of type graph_type by calling make_graph_from_lattice.

Member functions

const graph_type& graph() const { return graph_;}
graph_type& graph() { return graph_;}
returns the graph associated with the lattice and are used to implement the lattice::graph(l) function.

Traits class

template <class L, class G>
struct lattice_traits<lattice_graph<L,G> >
{
typedef typename lattice_graph<L,G>::unit_cell_type unit_cell_type;
typedef typename lattice_graph<L,G>::cell_descriptor cell_descriptor;
typedef typename lattice_graph<L,G>::offset_type offset_type;
typedef typename lattice_graph<L,G>::basis_vector_iterator basis_vector_iterator;
typedef typename lattice_graph<L,G>::cell_iterator cell_iterator;
typedef typename lattice_graph<L,G>::size_type size_type;
typedef typename lattice_graph<L,G>::vector_type vector_type;
typedef typename lattice_graph<L,G>::boundary_crossing_type boundary_crossing_type;
};
is the traits class for the lattice.

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)