pomerol  2.1
Public Member Functions | Protected Member Functions | Protected Attributes
Pomerol::IndexContainer2< ElementType, SourceObject > Class Template Reference

Base class for sparse container types whose elements are addressable by two single-particle indices. More...

#include <IndexContainer2.hpp>

Public Member Functions

template<typename... IndexTypes>
 IndexContainer2 (SourceObject const &Source, IndexClassification< IndexTypes... > const &IndexInfo)
 
void fill (std::set< IndexCombination2 > Indices=std::set< IndexCombination2 >())
 
ElementType & create (IndexCombination2 const &Indices)
 
bool isInContainer (IndexCombination2 const &Indices) const
 
bool isInContainer (ParticleIndex Index1, ParticleIndex Index2) const
 
ElementType & operator() (IndexCombination2 const &Indices)
 
ElementType & operator() (ParticleIndex Index1, ParticleIndex Index2)
 

Protected Member Functions

std::set< IndexCombination2enumerateIndices () const
 

Protected Attributes

ParticleIndex NumIndices
 Each of the two indices can change in the range [0; NumIndices[. More...
 
std::map< IndexCombination2, std::shared_ptr< ElementType > > ElementsMap
 Sparse storage for the elements. More...
 
SourceObject const & Source
 Stored elements are created by calling Source.createElement(Indices). More...
 

Detailed Description

template<typename ElementType, typename SourceObject>
class Pomerol::IndexContainer2< ElementType, SourceObject >

Base class for sparse container types whose elements are addressable by two single-particle indices.

Template Parameters
ElementTypeType of an element.
SourceObjectType of the source object used to create the elements.

Definition at line 37 of file IndexContainer2.hpp.

Constructor & Destructor Documentation

◆ IndexContainer2()

template<typename ElementType , typename SourceObject >
template<typename... IndexTypes>
Pomerol::IndexContainer2< ElementType, SourceObject >::IndexContainer2 ( SourceObject const &  Source,
IndexClassification< IndexTypes... > const &  IndexInfo 
)
inline

Construct from a source object and an index classification object. The container is initially empty and shall be populated with elements by a subsequent call to fill().

Template Parameters
IndexTypesTypes of indices carried by a single creation/annihilation operator.
Parameters
[in]SourceSource object used to create stored elements.
[in]IndexInfoClassification of single-particle indices.

Definition at line 59 of file IndexContainer2.hpp.

Member Function Documentation

◆ create()

template<typename ElementType , typename SourceObject >
ElementType & Pomerol::IndexContainer2< ElementType, SourceObject >::create ( IndexCombination2 const &  Indices)

Create a stored element from the source object by its index combination.

Parameters
[in]IndicesIndex combination of the element to be created.
Returns
Reference to the created element.

Definition at line 125 of file IndexContainer2.hpp.

◆ enumerateIndices()

template<typename ElementType , typename SourceObject >
std::set< IndexCombination2 > Pomerol::IndexContainer2< ElementType, SourceObject >::enumerateIndices
inlineprotected

Generate a complete set of index combinations usable to address elements in the container.

Definition at line 156 of file IndexContainer2.hpp.

◆ fill()

template<typename ElementType , typename SourceObject >
void Pomerol::IndexContainer2< ElementType, SourceObject >::fill ( std::set< IndexCombination2 Indices = std::set<IndexCombination2>())

Fill the container with elements from the source object. Each element is created by calling Source.createElement(IndexCombination).

Parameters
[in]IndicesSet of index combinations of the elements to be created. An empty set results in creation of elements for all possible index combinations.

Definition at line 106 of file IndexContainer2.hpp.

◆ isInContainer() [1/2]

template<typename ElementType , typename SourceObject >
bool Pomerol::IndexContainer2< ElementType, SourceObject >::isInContainer ( IndexCombination2 const &  Indices) const

Check if an element for a given index combination is stored in the container.

Parameters
[in]IndicesIndex combination.

Definition at line 96 of file IndexContainer2.hpp.

◆ isInContainer() [2/2]

template<typename ElementType , typename SourceObject >
bool Pomerol::IndexContainer2< ElementType, SourceObject >::isInContainer ( ParticleIndex  Index1,
ParticleIndex  Index2 
) const

Check if an element for a given index combination is stored in the container.

Parameters
[in]Index1First index in the combination.
[in]Index2Second index in the combination.

Definition at line 101 of file IndexContainer2.hpp.

◆ operator()() [1/2]

template<typename ElementType , typename SourceObject >
ElementType & Pomerol::IndexContainer2< ElementType, SourceObject >::operator() ( IndexCombination2 const &  Indices)

Get a reference to a stored element by its index combination.

Parameters
[in]IndicesIndex combination.

Definition at line 138 of file IndexContainer2.hpp.

◆ operator()() [2/2]

template<typename ElementType , typename SourceObject >
ElementType & Pomerol::IndexContainer2< ElementType, SourceObject >::operator() ( ParticleIndex  Index1,
ParticleIndex  Index2 
)

Get a reference to a stored element by its index combination.

Parameters
[in]Index1First index in the combination.
[in]Index2Second index in the combination.

Definition at line 151 of file IndexContainer2.hpp.

Field Documentation

◆ ElementsMap

template<typename ElementType , typename SourceObject >
std::map<IndexCombination2, std::shared_ptr<ElementType> > Pomerol::IndexContainer2< ElementType, SourceObject >::ElementsMap
protected

Sparse storage for the elements.

Definition at line 42 of file IndexContainer2.hpp.

◆ NumIndices

template<typename ElementType , typename SourceObject >
ParticleIndex Pomerol::IndexContainer2< ElementType, SourceObject >::NumIndices
protected

Each of the two indices can change in the range [0; NumIndices[.

Definition at line 40 of file IndexContainer2.hpp.

◆ Source

template<typename ElementType , typename SourceObject >
SourceObject const& Pomerol::IndexContainer2< ElementType, SourceObject >::Source
protected

Stored elements are created by calling Source.createElement(Indices).

Definition at line 45 of file IndexContainer2.hpp.


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