TkN 2.3
Toolkit for Nuclei
Loading...
Searching...
No Matches
tkmanager Class Reference

Manages the database loading and provides access to the physics properties. More...

Detailed Description

Manages the database loading and provides access to the physics properties.

The TkN data manager is key part of the TkN library. It reads the TkN sqlite3 database, build the C++ structures in memory and make the links between these structures and any object created by the user. This way, the level scheme of a nucleus is only built once, even if the user create the corresponding nucleus millions times.

Is also allows the user to easily browse the full database via the use of the gmanager singleton. For example, we can loop on all the existing nuclei using:

cpp for(const auto &nuc : gmanager->get_nuclei()) { ... }

As seen previously with the levels and decays, we can also use a lambda expression to filter the list of nuclei, e.g. the carbon isotopes: cpp for(const auto &nuc : gmanager->get_nuclei( [](auto nuc) { return (nuc->get_z()==6 && !nuc->get_level_scheme()->get_levels().empty()); })) { cout << nuc->get_symbol() << " "; } cout << endl; shell 8C 9C 10C 11C 12C 13C 14C 15C 16C 17C 18C 19C 20C 22C

Some tools are also provided to easily loop on the Z or N known ranges:

cpp for(const auto &znucs : gmanager->get_map_of_nuclei_per_z()) { cout<<znucs.first<<" "; }

shell 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118

cpp auto CarbonIsotopes = gmanager->get_map_of_nuclei_per_z().at(6); for(auto &nuc : CarbonIsotopes) { cout<<nuc->get_symbol()<<" "; }

shell 8C 9C 10C 11C 12C 13C 14C 15C 16C 17C 18C 19C 20C 21C 22C 23C

Definition at line 73 of file tkmanager.h.

#include <tkmanager.h>

Public Member Functions

 tkmanager ()
 
virtual ~tkmanager ()
 
std::vector< tkn_drip_pointget_drip_line (const std::string &_type, bool reduce_per_Z=true)
 Get the drip line for a given type (optionally reduced per Z)
 
const tkstringget_element_symbol (int _charge)
 returns the element symbol for a given proton number
 
const std::map< tkstring, shared_ptr< tknucleus > > & get_map_of_nuclei ()
 return a map of nuclei sorted by name
 
const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_a ()
 return a map of nuclei vector sorted by a
 
const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_n ()
 return a map of nuclei vector sorted by n
 
const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_z ()
 return a map of nuclei vector sorted by z
 
int get_new_decay_id ()
 define a new unique decay id
 
int get_new_level_id ()
 define a new unique level id
 
const vector< shared_ptr< tknucleus > > & get_nuclei ()
 return a vector containing all the known nuclei
 
vector< shared_ptr< tknucleus > > get_nuclei (std::function< bool(shared_ptr< tknucleus >)>const &_selection)
 return a vector containing all the known nuclei filtered by the lambda function
 
const vector< shared_ptr< tknucleus > > & get_nuclei_for_a (int a)
 return a vector containing all the known nuclei for a given a
 
const vector< shared_ptr< tknucleus > > & get_nuclei_for_n (int n)
 return a vector containing all the known nuclei for a given n
 
const vector< shared_ptr< tknucleus > > & get_nuclei_for_z (int z)
 return a vector containing all the known nuclei for a given z
 
shared_ptr< tknucleusget_nucleus (const tkstring &_nuc)
 return a shared pointer to a nucleus from its name
 
shared_ptr< tknucleusget_nucleus (int _z, int _a)
 return a shared pointer to a nucleus from its z an a
 
bool is_level_scheme_loaded (const tkstring &_nuc)
 returns true if the level scheme has already been loaded
 
bool known_element (int _z)
 is the element Z is known
 
bool known_element (tkstring _nuc, int &_z)
 is the element symbol is known (ex: "C")
 
bool known_nucleus (int _z, int _a)
 is the nucleus Z and A known
 
bool known_nucleus (tkstring _nuc)
 is the nucleus symbol known (ex: "12C")
 
void preload_level_schemes (bool _verbose=false)
 preload all the level schemes from the database
 
void set_max_decay_id (int _id)
 define the max value of the attributed level ids
 
void set_max_level_id (int _id)
 define the max value of the attributed level ids
 

Static Public Member Functions

static tkmanagerthe_data_manager ()
 

Friends

class tknucleus
 

Constructor & Destructor Documentation

◆ tkmanager()

tkmanager ( )

Definition at line 119 of file tkmanager.cpp.

◆ ~tkmanager()

~tkmanager ( )
virtual

Definition at line 128 of file tkmanager.cpp.

Member Function Documentation

◆ get_drip_line()

std::vector< tkn_drip_point > get_drip_line ( const std::string & _type,
bool reduce_per_Z = true )

Get the drip line for a given type (optionally reduced per Z)

Return drip-line data points for a given quantity type.

Loads data on-demand from the default JSON file if not already available.

Parameters
_typeQuantity type: "S1n", "S2n", "S1p", or "S2p".
reduce_per_ZIf true, keep at most one (Z,N) per Z: the entry with the minimal absolute value of value_mev. If false (default), return the full set for that type.
Returns
Vector of drip-line points sorted by (Z,N). Empty if type is unknown.
Note
This function expects a JSON file like "nuclei_quantities.json" containing an array of {Z,N,S1n,S1n_sigma,...} objects.
Data extracted from the supplementary material of: L. Neufcourt, Y. Cao, S. A. Giuliani, W. Nazarewicz, E. Olsen, O. B. Tarasov, "Quantified limits of the nuclear landscape", Phys. Rev. C 101, 044307 (2020).
// Example usage:
auto all_s2n = gmanager->get_drip_line("S2n");
auto reduced_s2n = gmanager->get_drip_line("S2n", true);

Definition at line 576 of file tkmanager.cpp.

◆ get_element_symbol()

const tkstring & get_element_symbol ( int _charge)
inline

returns the element symbol for a given proton number

Definition at line 123 of file tkmanager.h.

◆ get_map_of_nuclei()

const std::map< tkstring, shared_ptr< tknucleus > > & get_map_of_nuclei ( )
inline

return a map of nuclei sorted by name

Definition at line 132 of file tkmanager.h.

◆ get_map_of_nuclei_per_a()

const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_a ( )
inline

return a map of nuclei vector sorted by a

Definition at line 136 of file tkmanager.h.

◆ get_map_of_nuclei_per_n()

const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_n ( )
inline

return a map of nuclei vector sorted by n

Definition at line 138 of file tkmanager.h.

◆ get_map_of_nuclei_per_z()

const std::map< int, std::vector< shared_ptr< tknucleus > > > & get_map_of_nuclei_per_z ( )
inline

return a map of nuclei vector sorted by z

Definition at line 134 of file tkmanager.h.

◆ get_new_decay_id()

int get_new_decay_id ( )

define a new unique decay id

Definition at line 443 of file tkmanager.cpp.

◆ get_new_level_id()

int get_new_level_id ( )

define a new unique level id

Definition at line 436 of file tkmanager.cpp.

◆ get_nuclei() [1/2]

const vector< shared_ptr< tknucleus > > & get_nuclei ( )
inline

return a vector containing all the known nuclei

Definition at line 129 of file tkmanager.h.

◆ get_nuclei() [2/2]

vector< shared_ptr< tknucleus > > get_nuclei ( std::function< bool(shared_ptr< tknucleus >)>const & _selection)

return a vector containing all the known nuclei filtered by the lambda function

Parameters
_selectionlambda function to filter the list of nuclei to be returned

Example:

#include "tkmanager.h"
for(const auto &nuc : gmanager->get_nuclei( [](auto nuc) {
return (nuc->get_z()==6 && !nuc->get_level_scheme()->get_levels().empty());
})) {
cout << nuc->get_symbol() << " ";
} cout << endl;
8C 9C 10C 11C 12C 13C 14C 15C 16C 17C 18C 19C 20C 22C

Definition at line 417 of file tkmanager.cpp.

◆ get_nuclei_for_a()

const vector< shared_ptr< tknucleus > > & get_nuclei_for_a ( int a)
inline

return a vector containing all the known nuclei for a given a

Definition at line 143 of file tkmanager.h.

◆ get_nuclei_for_n()

const vector< shared_ptr< tknucleus > > & get_nuclei_for_n ( int n)
inline

return a vector containing all the known nuclei for a given n

Definition at line 145 of file tkmanager.h.

◆ get_nuclei_for_z()

const vector< shared_ptr< tknucleus > > & get_nuclei_for_z ( int z)
inline

return a vector containing all the known nuclei for a given z

Definition at line 141 of file tkmanager.h.

◆ get_nucleus() [1/2]

shared_ptr< tknucleus > get_nucleus ( const tkstring & _nuc)
inline

return a shared pointer to a nucleus from its name

Definition at line 148 of file tkmanager.h.

◆ get_nucleus() [2/2]

shared_ptr< tknucleus > get_nucleus ( int _z,
int _a )
inline

return a shared pointer to a nucleus from its z an a

Definition at line 150 of file tkmanager.h.

◆ is_level_scheme_loaded()

bool is_level_scheme_loaded ( const tkstring & _nuc)
inline

returns true if the level scheme has already been loaded

Definition at line 109 of file tkmanager.h.

◆ known_element() [1/2]

bool known_element ( int _z)
inline

is the element Z is known

Definition at line 121 of file tkmanager.h.

◆ known_element() [2/2]

bool known_element ( tkstring _nuc,
int & _z )

is the element symbol is known (ex: "C")

Definition at line 425 of file tkmanager.cpp.

◆ known_nucleus() [1/2]

bool known_nucleus ( int _z,
int _a )
inline

is the nucleus Z and A known

Definition at line 117 of file tkmanager.h.

◆ known_nucleus() [2/2]

bool known_nucleus ( tkstring _nuc)
inline

is the nucleus symbol known (ex: "12C")

Definition at line 115 of file tkmanager.h.

◆ preload_level_schemes()

void preload_level_schemes ( bool _verbose = false)

preload all the level schemes from the database

Definition at line 392 of file tkmanager.cpp.

◆ set_max_decay_id()

void set_max_decay_id ( int _id)
inline

define the max value of the attributed level ids

Definition at line 160 of file tkmanager.h.

◆ set_max_level_id()

void set_max_level_id ( int _id)
inline

define the max value of the attributed level ids

Definition at line 158 of file tkmanager.h.

◆ the_data_manager()

tkmanager * the_data_manager ( )
static

Definition at line 106 of file tkmanager.cpp.

Friends And Related Symbol Documentation

◆ tknucleus

friend class tknucleus
friend

Definition at line 75 of file tkmanager.h.


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