TBTK
TBTK::IndexTree Class Reference

Data structure for mapping physical indices to a linear index. More...

#include <IndexTree.h>

Inheritance diagram for TBTK::IndexTree:
TBTK::Serializable

Classes

class  Iterator
 

Public Types

enum  SearchMode { StrictMatch, IgnoreWildcards, MatchWildcards }
 
- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 

Public Member Functions

 IndexTree ()
 
 IndexTree (const std::string &serialization, Mode mode)
 
virtual ~IndexTree ()
 
void add (const Index &index)
 
void generateLinearMap ()
 
int getLinearIndex (const Index &index, SearchMode searchMode=SearchMode::StrictMatch, bool returnNegativeForMissingIndex=false) const
 
Index getPhysicalIndex (int linearIndex) const
 
int getSize () const
 
std::vector< unsigned int > getSubindicesMatching (int i, const Index &index, SearchMode searchMode) const
 
std::vector< IndexgetIndexList (const Index &pattern) const
 
Iterator begin () const
 
std::string serialize (Mode mode) const
 

Additional Inherited Members

- Static Public Member Functions inherited from TBTK::Serializable
static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
- Static Protected Member Functions inherited from TBTK::Serializable
static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
static std::string serialize (bool b, Mode mode)
 
static void deserialize (const std::string &serialization, bool *b, Mode mode)
 
static std::string serialize (int i, Mode mode)
 
static void deserialize (const std::string &serialization, int *i, Mode mode)
 
static std::string serialize (unsigned int u, Mode mode)
 
static void deserialize (const std::string &serialization, unsigned int *u, Mode mode)
 
static std::string serialize (double d, Mode mode)
 
static void deserialize (const std::string &serialization, double *d, Mode mode)
 
static std::string serialize (std::complex< double > c, Mode mode)
 
static void deserialize (const std::string &serialization, std::complex< double > *c, Mode mode)
 
static std::string serialize (Statistics s, Mode mode)
 
static void deserialize (const std::string &serialization, Statistics *s, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Detailed Description

Data structure for mapping physical indices to a linear index.

Member Enumeration Documentation

Enum class for selecting mode used to search indices with getLinearIndex().

Constructor & Destructor Documentation

TBTK::IndexTree::IndexTree ( )

Constructor.

TBTK::IndexTree::IndexTree ( const std::string &  serialization,
Mode  mode 
)

Constructor. Constructs the IndexTree from a serialization string.

virtual TBTK::IndexTree::~IndexTree ( )
virtual

Destructor.

Member Function Documentation

void TBTK::IndexTree::add ( const Index index)

Add index.

Iterator TBTK::IndexTree::begin ( ) const

Returns Iterator initialized to point at first Index.

void TBTK::IndexTree::generateLinearMap ( )

Generate linear map.

std::vector<Index> TBTK::IndexTree::getIndexList ( const Index pattern) const

Generate a list of indices satisfying the specified pattern.

int TBTK::IndexTree::getLinearIndex ( const Index index,
SearchMode  searchMode = SearchMode::StrictMatch,
bool  returnNegativeForMissingIndex = false 
) const

Get linear index.

Index TBTK::IndexTree::getPhysicalIndex ( int  linearIndex) const

Get physical index.

int TBTK::IndexTree::getSize ( ) const
inline

Get size.

std::vector<unsigned int> TBTK::IndexTree::getSubindicesMatching ( int  i,
const Index index,
SearchMode  searchMode 
) const

Get subindex.

std::string TBTK::IndexTree::serialize ( Mode  mode) const
virtual

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