TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::mesh::prod< Ms >

#include <triqs/mesh/prod.hpp>

Detailed Description

template<Mesh... Ms>
requires (((n_variables<Ms> == 1) and ...) and (not(std::is_reference_v<Ms> or ...)))
class triqs::mesh::prod< Ms >

Product mesh type for combining multiple meshes.

A product mesh combines various triqs::mesh::Mesh types and satisfies the triqs::mesh::Mesh concept itself. It is defined by the individual meshes in the product and it is iterated over in C-order, i.e. the last mesh in the product is the fastest varying one, while the first mesh is the slowest. In the following, we use \(M = M_1 \times \dots \times M_k \) to denote a product mesh combining the \( k \) meshes \( M_1, \dots, M_k \).

A product mesh has the following properties:

  • The number of meshes in the product is \( k \) and can be queried with triqs::mesh::n_variables.
  • Its mesh points are tuples of size \( k \). The i-th element in the tuple is a mesh point \( \in M_i \).
  • Each mesh point is identified by a unique tuple of indices \( \mathbf{n} = (n_1, n_2, \dots, n_k) \), where \( n_i \) is a valid index of \( M_i \).
  • The size of the mesh is \( N = N_1 \dots N_k \), where \( N_i \) is the size of \( M_i \).
  • An index \( \mathbf{n} \) is mapped to the corresponding data index \( \mathbf{d}(\mathbf{n}) = (d_1(n_1), \dots, d_k(n_k)) \), where \( d_i \) is a data index of \( M_i \). The inverse map is \( \mathbf{n}( \mathbf{d}) = (n_1(d_1), \dots, n_k(d_k)) \).

Green's function containers that are based on a product mesh store function values, coefficients, etc. depending on the mesh types of its components. For example, a GF defined on a product mesh consisting of a triqs::mesh::brzone and a triqs::mesh::dlr_imtime mesh stores the function values at the DLR interpolation nodes \( \tau_l \) for every \( \mathbf{k} \)-point. Function evaluation is done in general by calling triqs::mesh::evaluate.

Template Parameters
Mstriqs::mesh::Mesh types.

Definition at line 138 of file prod.hpp.

Public Types

using data_index_t = std::tuple<typename Ms::data_index_t...>
 Data index type.
using index_t = std::tuple<typename Ms::index_t...>
 Index type.
using m_tuple_t = std::tuple<Ms...>
 Underlying tuple type.
using mesh_point_t = prod_mesh_point<Ms...>
 Mesh point type.

Public Member Functions

 prod ()=default
 Default constructor calls the default constructor of all its components.
 prod (Ms const &...ms)
 Construct a product mesh with the given meshes \( M_1, \dots, M_k \).
template<typename... U>
 prod (std::tuple< U... > const &mt)
 Construct a product mesh \( M = M_1 \times \dots \times M_k \) from the given tuple of meshes.
m_tuple_tas_tuple ()
 Get the underlying tuple of individual meshes, i.e. \( (M_1, \dots, M_k) \).
m_tuple_t const & as_tuple () const
 Get the underlying tuple of individual meshes, i.e. \( (M_1, \dots, M_k) \).
auto begin () const
 Get an iterator to the beginning of the mesh.
auto cbegin () const
 Get a const iterator to the beginning of the mesh.
auto cend () const
 Get a const iterator to the end of the mesh.
m_tuple_tcomponents ()
 Get the underlying tuple of individual meshes, i.e. \( (M_1, \dots, M_k) \).
void deserialize (auto &ar)
 Deserialize the mesh from a generic archive.
auto end () const
 Get an iterator to the end of the mesh.
template<typename... Args>
bool is_index_valid (Args const &...ns) const
 Check if the given indices \( n_1, \dots, n_k \) are valid.
template<typename... Args>
bool is_index_valid (index_t const &n) const
 Check if given index tuple \( \mathbf{n} = (n_1, \dots, n_k) \) is valid.
uint64_t mesh_hash () const
 Get the hash value of the mesh.
mesh_point_t operator() (index_t const &n) const
 Function call operator to access a mesh point by its index tuple \( \mathbf{n} \).
bool operator== (prod const &m) const
 Equal-to comparison operator compares the tuple of meshes in the product.
mesh_point_t operator[] (data_index_t const &d) const
 Subscript operator to access a mesh point by its data index tuple \( \mathbf{d} \).
void serialize (auto &ar) const
 Serialize the mesh to a generic archive.
long size () const
 Get the size \( N \) of the mesh, i.e. the product of the sizes of its components.
auto size_of_components () const
 Get the sizes of the components as a std::array, i.e. \( (N_1, \dots, N_k) \).
data_index_t to_data_index (index_t const &n) const
 Map an index tuple \( \mathbf{n} \) to its corresponding data index tuple \( \mathbf{d}(\mathbf{n}) \).
index_t to_index (data_index_t const &d) const
 Map a data index tuple \( \mathbf{d} \) to its corresponding index tuple \( \mathbf{n}(\mathbf{d}) \).

Static Public Member Functions

static std::string hdf5_format ()
 Get the HDF5 format tag.

Friends

void h5_read (h5::group g, std::string name, prod &m)
 Read a triqs::mesh::prod mesh from HDF5.
void h5_write (h5::group g, std::string name, prod const &m)
 Write a triqs::mesh::prod mesh to HDF5.
std::ostream & operator<< (std::ostream &sout, prod const &m)
 Write a triqs::mesh::prod mesh to a std::ostream.

Constructor & Destructor Documentation

◆ prod() [1/2]

template<Mesh... Ms>
triqs::mesh::prod< Ms >::prod ( Ms const &... ms)
inline

Construct a product mesh with the given meshes \( M_1, \dots, M_k \).

Parameters
msMeshes to be combined into a product mesh \( M = M_1 \times \dots \times M_k \).

Definition at line 159 of file prod.hpp.

◆ prod() [2/2]

template<Mesh... Ms>
template<typename... U>
triqs::mesh::prod< Ms >::prod ( std::tuple< U... > const & mt)
inline

Construct a product mesh \( M = M_1 \times \dots \times M_k \) from the given tuple of meshes.

Parameters
mtTuple of meshes, i.e. \( (M_1, \dots, M_k) \).

Definition at line 168 of file prod.hpp.

Member Function Documentation

◆ deserialize()

template<Mesh... Ms>
void triqs::mesh::prod< Ms >::deserialize ( auto & ar)
inline

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 317 of file prod.hpp.

◆ is_index_valid() [1/2]

template<Mesh... Ms>
template<typename... Args>
bool triqs::mesh::prod< Ms >::is_index_valid ( Args const &... ns) const
inlinenodiscard

Check if the given indices \( n_1, \dots, n_k \) are valid.

Parameters
nsIndices \( n_1, \dots, n_k \) to check.
Returns
True if \( 0 \leq n_i < N_i \; \forall i \), false otherwise.

Definition at line 179 of file prod.hpp.

◆ is_index_valid() [2/2]

template<Mesh... Ms>
template<typename... Args>
bool triqs::mesh::prod< Ms >::is_index_valid ( index_t const & n) const
inlinenodiscard

Check if given index tuple \( \mathbf{n} = (n_1, \dots, n_k) \) is valid.

Parameters
nIndex tuple \( \mathbf{n} \) to check.
Returns
True if \( 0 \leq n_i < N_i \; \forall i \), false otherwise.

Definition at line 189 of file prod.hpp.

◆ operator()()

template<Mesh... Ms>
mesh_point_t triqs::mesh::prod< Ms >::operator() ( index_t const & n) const
inlinenodiscard

Function call operator to access a mesh point by its index tuple \( \mathbf{n} \).

Each index \( n_i \) in the tuple is used to access the mesh point in the corresponding mesh component \( M_i \).

Parameters
nIndex tuple \( \mathbf{n} \) of the mesh point.
Returns
mesh_point_t containing the mesh points of the components.

Definition at line 240 of file prod.hpp.

◆ operator[]()

template<Mesh... Ms>
mesh_point_t triqs::mesh::prod< Ms >::operator[] ( data_index_t const & d) const
inlinenodiscard

Subscript operator to access a mesh point by its data index tuple \( \mathbf{d} \).

Each data index \( d_i \) in the tuple is used to access the mesh point in the corresponding mesh component \( M_i \).

Parameters
dData index tuple \( \mathbf{d} \) of the mesh point.
Returns
mesh_point_t containing the mesh points of the components.

Definition at line 226 of file prod.hpp.

◆ serialize()

template<Mesh... Ms>
void triqs::mesh::prod< Ms >::serialize ( auto & ar) const
inline

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 311 of file prod.hpp.

◆ to_data_index()

template<Mesh... Ms>
data_index_t triqs::mesh::prod< Ms >::to_data_index ( index_t const & n) const
inlinenodiscard

Map an index tuple \( \mathbf{n} \) to its corresponding data index tuple \( \mathbf{d}(\mathbf{n}) \).

Parameters
nIndex tuple \( \mathbf{n} = (n_1, \dots, n_k) \) to map.
Returns
Data index tuple \( \mathbf{d}(\mathbf{n}) = (d_1(n_1), \dots, d_k(n_k)) \).

Definition at line 200 of file prod.hpp.

◆ to_index()

template<Mesh... Ms>
index_t triqs::mesh::prod< Ms >::to_index ( data_index_t const & d) const
inlinenodiscard

Map a data index tuple \( \mathbf{d} \) to its corresponding index tuple \( \mathbf{n}(\mathbf{d}) \).

Parameters
dData index tuple \( \mathbf{d} = (d_1, \dots, d_k) \) to map.
Returns
Index tuple \( \mathbf{n}(\mathbf{d}) = (n_1(d_1), \dots, n_k(d_k)) \).

Definition at line 212 of file prod.hpp.

◆ h5_read

template<Mesh... Ms>
void h5_read ( h5::group g,
std::string name,
prod< Ms > & m )
friend

Read a triqs::mesh::prod mesh from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
mMesh object to be read into.

Definition at line 343 of file prod.hpp.

◆ h5_write

template<Mesh... Ms>
void h5_write ( h5::group g,
std::string name,
prod< Ms > const & m )
friend

Write a triqs::mesh::prod mesh to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
mMesh object to be written.

Definition at line 329 of file prod.hpp.

◆ operator<<

template<Mesh... Ms>
std::ostream & operator<< ( std::ostream & sout,
prod< Ms > const & m )
friend

Write a triqs::mesh::prod mesh to a std::ostream.

Parameters
soutstd::ostream object.
mMesh to be written.
Returns
Reference to std::ostream object.

Definition at line 301 of file prod.hpp.


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