ALPS Project: lattice library

Header file: lattice/latticelibrary.h

defines a class LatticeLibrary to hold a colection of graphs and lattices, It can be constructed from the <LATTICES> element of the lattice XML schema on http://xml.comp-phys.org/. The graph_helper class can then be used to easily incorporate a lattice library into an application program and create a graph.

Synopsis

namespace alps {
{

class LatticeLibrary
{
public:

typedef hypercubic_lattice<coordinate_lattice<simple_lattice<GraphUnitCell> > > lattice_type;

LatticeLibrary();
LatticeLibrary(std::istream& is);
LatticeLibrary(const XMLTag& tag, std::istream& is);

void read_xml(std::istream& is);
void read_xml(const XMLTag& tag, std::istream& is);

void write_xml(std::ostream&) const;

bool has_graph(const std::string& name) const;
bool has_lattice(const std::string& name) const;


const LatticeGraphDescriptor& lattice_descriptor(const std::string& name) const;
lattice_type lattice(const std::string& name) const;

const coordinate_graph_type& graph(const std::string& name) const;

template <class G>
bool get_graph(G& graph,const std::string& name) const;
};

std::ostream& operator<<(std::ostream&, const LatticeLibrary& l)
std::ostream& operator<<(oxstream&, const LatticeLibrary& l)
std::istream& operator>>(std::istream&, LatticeLibrary& l)

The LatticeLibrary class

Type members

typedef hypercubic_lattice<coordinate_lattice<simple_lattice<GraphUnitCell> > > lattice_type;
is the only type of lattice that can be constructed at the moment. Once other lattice types than hypercubic_lattice become available this class will have to be modified.

Constructors

LatticeLibrary();
an empty library of lattices and graphs.
LatticeLibrary(std::istream& is);
reads XML input from a std::istream, expected to contain a <LATTICES> element, as given by the Lattice XML schema on http://xml.comp-phys.org.
LatticeLibrary(const palmxml::XMLTag& tag, std::istream& is);
The start tag <LATTICES> has already been read and is passed as an XMLTag

Member functions

void read_xml(std::istream& is);
void read_xml(const XMLTag& tag, std::istream& is);
are similar to the cinstructors with corresponding signature. Read additional lattices and graphs.
void write_xml(std::ostream&) const;
writes the contents of the LatticeLibrary using the Lattice XML schema on http://xml.comp-phys.org.
bool has_graph(const std::string& name) const;
returns true if the LatticeLibrary contains a graph with the given name, read from a <GRAPH> element.
bool has_lattice(const std::string& name) const;
returns true if the LatticeLibrary contains a LatticeGraph with the given name, read from a <LATTICEGRAPH> element.
const coordinate_graph_type& graph(const std::string& name) const;
returns a reference to the graph with given name. If the graoh does not exist (has_graph returns false) a std::runtime_error is thrown.
const LatticeGraphDescriptor& lattice_descriptor(const std::string& name) const;
returns a reference to the LatticeGraphDescriptor with given name. If the lattice graph does not exist (has_lattice returns false) a std::runtime_error is thrown.
lattice_type lattice(const std::string& name) const;
returns a lattice built from the lattice descriptor with the given name. If the lattice graph does not exist (has_lattice returns false) a std::runtime_error is thrown.
template <class G>
bool get_graph(G& graph,const std::string& name) const;
If there is a graph with the given name it is copied into the graph argument using the copy_graph function. Otherwise, the graph argument is unchanged and the function returns false.

Input and output operators

std::ostream& operator<<(std::ostream&, const LatticeLibrary& l)
std::ostream& operator<<(oxstream&, const LatticeLibrary& l)
writes the LatticeLibrary using the write_xml member function.
std::istream& operator>>(std::istream&, LatticeLibrary& l)
reads the LatticeLibrary using the read_xml member function.

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)