Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Member Functions | Private Attributes
mty::lha::LHABlock Class Reference

LHABlock, containing a vector of LHAElement. More...

#include <lhaData.h>

Public Member Functions

 LHABlock ()=default
 Default constructor.
 
 ~LHABlock ()=default
 Default destructor.
 
 LHABlock (std::string const &)
 Constructor with one (optional) parameter. More...
 
std::string const & getName () const
 
void setName (std::string const &t_name)
 Sets the name of the block. More...
 
bool isName (std::string_view t_name) const
 
std::optional< LHAElementgetElement (size_t id) const
 Returns the first element (if found) with id id. More...
 
std::optional< LHAElementgetElement (size_t id, size_t id_sup=-1) const
 Returns the first element (if found) with id id and position pos. More...
 
std::vector< LHAElementgetMultipleElements (size_t id) const
 Returns all the elements for a given id. If there is multiple ones, for example a matrix, they are stored linearly in the container. More...
 
void sortElements ()
 Sorts the elements in the block using Comparator::compare().
 
void addElement (size_t id, size_t id_sup, FloatType value)
 Adds an elements to the block. More...
 
void addElement (size_t id, FloatType value)
 Adds an elements to the block. More...
 
void addElement (LHAElement const &t_element)
 Adds an elements to the block. More...
 
void addElement (LHAElement &&t_element)
 Adds an elements to the block. More...
 

Private Attributes

std::string name
 Name of the block.
 
std::vector< LHAElementelements
 Vector of LHAElement in the block.
 

Detailed Description

LHABlock, containing a vector of LHAElement.

When reading a LHA File, all elements of a given block are stored in a LHABlock.

See also
LHAElement

Constructor & Destructor Documentation

◆ LHABlock()

mty::lha::LHABlock::LHABlock ( std::string const &  t_name)

Constructor with one (optional) parameter.

Parameters
t_nameName of the block.

Member Function Documentation

◆ addElement() [1/4]

void mty::lha::LHABlock::addElement ( size_t  id,
size_t  id_sup,
FloatType  value 
)

Adds an elements to the block.

Parameters
idId of the element.
id_supSupplementary id for the element.
valueValue of the element.

◆ addElement() [2/4]

void mty::lha::LHABlock::addElement ( size_t  id,
FloatType  value 
)

Adds an elements to the block.

Parameters
idId of the element.
valueValue of the element.

◆ addElement() [3/4]

void mty::lha::LHABlock::addElement ( LHAElement const &  t_element)

Adds an elements to the block.

Parameters
t_elementLHAElement to add in the block.

◆ addElement() [4/4]

void mty::lha::LHABlock::addElement ( LHAElement &&  t_element)

Adds an elements to the block.

Parameters
t_elementLHAElement to add in the block.

◆ getElement() [1/2]

std::optional< LHAElement > mty::lha::LHABlock::getElement ( size_t  id) const

Returns the first element (if found) with id id.

Parameters
idId of the element to search.
Returns
A std::optional containing the first element with id id if found.
std::nullopt else.

◆ getElement() [2/2]

std::optional< LHAElement > mty::lha::LHABlock::getElement ( size_t  id,
size_t  id_sup = -1 
) const

Returns the first element (if found) with id id and position pos.

Parameters
idId of the element to search.
posMatrix coordinates of the elements.
Returns
A std::optional containing the first element corresponding to id and pos if found.
std::nullopt else.

◆ getMultipleElements()

std::vector< LHAElement > mty::lha::LHABlock::getMultipleElements ( size_t  id) const

Returns all the elements for a given id. If there is multiple ones, for example a matrix, they are stored linearly in the container.

Parameters
idId of the elements to return.
Returns
The LHAElement with id id.
Note
If the sortElements() has been called, the elements in the vector are sorted by position (if more than one). In that case, for a matrix, elements are sorted by row and by column ((0, 0) (0, 1) (1, 0) (1, 1) etc).

◆ getName()

std::string const& mty::lha::LHABlock::getName ( ) const
inline
Returns
The name of the block.

◆ setName()

void mty::lha::LHABlock::setName ( std::string const &  t_name)
inline

Sets the name of the block.

Parameters
t_nameNew name of the block.

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