hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
hummingbird::BankBase< T > Class Template Referenceabstract

Base class for banks that store objects of type T by integer ID and look them up by the name given in the JSON input file. More...

#include <bank_base.h>

Public Member Functions

const T & GetByID (const int id) const
 Get the object by its ID.
const T & GetByName (const std::string &name) const
 Get the object by its name in the JSON input file.
int GetIDByName (const std::string &name) const
 Get the ID of an object by its name in the JSON input file.

Protected Member Functions

virtual void Build (const json &json_input)=0
 Build the bank.

Protected Attributes

std::unordered_map< int, T > id_object_map_
 ID to object map.
std::unordered_map< std::string, int > name_id_map_
 name to object ID map

Detailed Description

template<typename T>
class hummingbird::BankBase< T >

Base class for banks that store objects of type T by integer ID and look them up by the name given in the JSON input file.

Template Parameters
TStored object type

Definition at line 21 of file bank_base.h.

Member Function Documentation

◆ Build()

template<typename T>
virtual void hummingbird::BankBase< T >::Build ( const json & json_input)
protectedpure virtual

Build the bank.

Parameters
json_inputJSON input

Implemented in hummingbird::BCBank, hummingbird::MaterialBank, and hummingbird::SourceBank.

◆ GetByID()

template<typename T>
const T & hummingbird::BankBase< T >::GetByID ( const int id) const
inline

Get the object by its ID.

Parameters
idID
Returns
const T&

Definition at line 29 of file bank_base.h.

◆ GetByName()

template<typename T>
const T & hummingbird::BankBase< T >::GetByName ( const std::string & name) const
inline

Get the object by its name in the JSON input file.

Parameters
nameObject name
Returns
const T&

Definition at line 37 of file bank_base.h.

◆ GetIDByName()

template<typename T>
int hummingbird::BankBase< T >::GetIDByName ( const std::string & name) const
inline

Get the ID of an object by its name in the JSON input file.

Parameters
nameObject name
Returns
int

Definition at line 47 of file bank_base.h.

Member Data Documentation

◆ id_object_map_

template<typename T>
std::unordered_map<int, T> hummingbird::BankBase< T >::id_object_map_
protected

ID to object map.

Definition at line 53 of file bank_base.h.

◆ name_id_map_

template<typename T>
std::unordered_map<std::string, int> hummingbird::BankBase< T >::name_id_map_
protected

name to object ID map

Definition at line 56 of file bank_base.h.


The documentation for this class was generated from the following file:
  • /home/runner/work/hummingbird/hummingbird/include/banks/bank_base.h