ALPS Project: lattice library
Header file: lattice/simplelattice.h
defines a template class simple_lattice, which makes a lattice from a unit cell and cell type.
Synopsis
namespace alps {
template <class UnitCell=EmptyUnitCell, class Cell = simple_cell<UnitCell> >
class simple_lattice {
public:
typedef UnitCell unit_cell_type;
typedef Cell cell_descriptor;
typedef typename lattice::dimensional_traits<unit_cell_type>::dimension_type dimension_type;
typedef typename cell_traits< cell_descriptor>::offset_type offset_type;
simple_lattice();
template<class U2, class C2> simple_lattice(const simple_lattice<U2,C2>& l);
simple_lattice(const unit_cell_type& c);
unit_cell_type& unit_cell();
const unit_cell_type& unit_cell() const;
cell_descriptor cell(offset_type o) const;
dimension_type dimension() const;
};
template <class UnitCell, class Cell>
struct lattice_traits<simple_lattice<UnitCell,Cell> >
{
typedef typename simple_lattice<UnitCell,Cell>::unit_cell_type unit_cell_type;
typedef typename simple_lattice<UnitCell,Cell>::cell_descriptor cell_descriptor;
typedef typename simple_lattice<UnitCell,Cell>::offset_type offset_type;
};
}
The simple_lattice class
describes a lattice and fulfills the
Lattice requirements.
Template parameters
It takes two template arguments:
- the type of the unit cell. This type has to fulfill the
UnitCell requirements.
- the type of the cell. It has to fulfill the
Cell requirements
and defaults to simple_cell.
Type definitions
typedef UnitCell unit_cell_type;
typedef Cell cell_descriptor;
typedefs for the template parameters.
typedef typename lattice::dimensional_traits<unit_cell_type>::dimension_type dimension_type;
the type for the dimension of the lattice.
typedef typename cell_traits< cell_descriptor>::offset_type offset_type;
the offset type of the cell.
Constructors
simple_lattice();
the default constructor.
template<class U2, class C2> simple_lattice(const simple_lattice<U2,C2>& l);
the copy constructors.
simple_lattice(const unit_cell_type& c);
constracts from a unitcell.
Member functions
unit_cell_type& unit_cell();
const unit_cell_type& unit_cell() const;
return the unit cell.
cell_descriptor cell(offset_type o) const;
returns a cell with a given offset
dimension_type dimension();
returns the dimension of the lattice.
Traits class
template <class UnitCell, class Cell>
struct lattice_traits<simple_lattice<UnitCell,Cell> >
{
typedef typename simple_lattice<UnitCell,Cell>::unit_cell_type unit_cell_type;
typedef typename simple_lattice<UnitCell,Cell>::cell_descriptor cell_descriptor;
typedef typename simple_lattice<UnitCell,Cell>::offset_type offset_type;
};
is the traits class for the lattice.
copyright (c) 2000-2004 by
Matthias Troyer and
Synge Todo