Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
materials::element Class Reference

The description of an element. More...

#include <bayeux/materials/element.h>

Inheritance diagram for materials::element:
datatools::i_tree_dumpable

Public Types

enum  build_flag_type { BF_NIST_COMPOSITION = datatools::bit_mask::bit00, BF_LOCK = datatools::bit_mask::bit31 }
 Build flags. More...
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 

Public Member Functions

 element ()
 Defaut Constructor. More...
 
 element (const std::string &name_, int z_, unsigned int build_flags_=0)
 Normal Constructor. More...
 
 element (const char *name_, int z_, unsigned int build_flags_=0)
 Normal Constructor. More...
 
 element (const std::string &name_, int z_, double molar_mass_, unsigned int build_flags_=0)
 Normal Constructor. More...
 
 element (const char *name_, int z_, double molar_mass_, unsigned int build_flags_=0)
 Normal Constructor. More...
 
 element (const std::string &name_, const std::string &symbol_="", unsigned int build_flags_=0)
 Normal Constructor. More...
 
 element (const char *name_, const char *symbol_="", unsigned int build_flags_=0)
 Normal Constructor. More...
 
virtual ~element ()
 Destructor. More...
 
bool is_built_by_isotopic_composition () const
 Return true if the element is built by isotopic composition. More...
 
void set_name (const std::string &name_)
 Set the name of the element. More...
 
void set_z (int z_)
 Set the Z (number of protons) & the chemical symbol of the element. More...
 
void set_z (const std::string &symbol_)
 Set the Z (number of protons) & the chemical symbol of the element. More...
 
void set_molar_mass (double molar_mass_)
 Set the molar mass of the element [g/mol]. More...
 
void add_isotope (const isotope &iso_ref_, double weight_=1.0, bool owned_=false)
 Add an isotope with weight. More...
 
void add_isotope (const isotope *iso_ptr_, double weight_=1.0)
 Add an isotope with weight. More...
 
void build (unsigned int build_flags_=0)
 Build the element : norm weights, compute molar mass. More...
 
void build_from_nist ()
 Build the element using NIST composition data, then normalize weights, compute molar mass. More...
 
const std::string & get_name () const
 Return the name. More...
 
const std::string & get_symbol () const
 Return the chemical symbol. More...
 
int get_z () const
 Return the number of protons (Z). More...
 
double get_molar_mass () const
 Return the molar mass [g/mol]. More...
 
bool is_locked () const
 Return true if composition is valid, weights are normalized and molar mass is computed. More...
 
void lock ()
 Lock the element data structure. More...
 
void unlock ()
 Unlock the element data structure. More...
 
const isotope_weight_map_typeget_composition () const
 Return the isotopic composition of the element. More...
 
const datatools::propertiesget_properties () const
 Get reference of auxiliary properties. More...
 
datatools::propertiesgrab_properties ()
 Get reference of auxiliary properties. More...
 
void reset ()
 Reset. More...
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Smart print. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 Main new interface method for printing. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 

Static Public Attributes

static const int Z_UNDEFINED = -1
 

Protected Member Functions

void _set_defaults ()
 Set default values. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 

Detailed Description

The description of an element.

Member Enumeration Documentation

◆ build_flag_type

Build flags.

Enumerator
BF_NIST_COMPOSITION 

Build from the NIST table.

BF_LOCK 

Lock after building.

Constructor & Destructor Documentation

◆ element() [1/7]

materials::element::element ( )

Defaut Constructor.

◆ element() [2/7]

materials::element::element ( const std::string &  name_,
int  z_,
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
z_: Z of the element
build_flags_: On the fly building

◆ element() [3/7]

materials::element::element ( const char *  name_,
int  z_,
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
z_: Z of the element
build_flags_: On the fly building

◆ element() [4/7]

materials::element::element ( const std::string &  name_,
int  z_,
double  molar_mass_,
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
z_: Z of the element
molar_mass_: Molar mass of the element
build_flags_: On the fly building

◆ element() [5/7]

materials::element::element ( const char *  name_,
int  z_,
double  molar_mass_,
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
z_: Z of the element
molar_mass_: Molar mass of the element
build_flags_: On the fly building

◆ element() [6/7]

materials::element::element ( const std::string &  name_,
const std::string &  symbol_ = "",
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
symbol_: Chemical symbol of the element
build_flags_: On the fly building

◆ element() [7/7]

materials::element::element ( const char *  name_,
const char *  symbol_ = "",
unsigned int  build_flags_ = 0 
)
explicit

Normal Constructor.

Parameters
name_: Name of the element
symbol_: Chemical symbol of the element
build_flags_: On the fly building

◆ ~element()

virtual materials::element::~element ( )
virtual

Destructor.

Member Function Documentation

◆ _set_defaults()

void materials::element::_set_defaults ( )
protected

Set default values.

◆ add_isotope() [1/2]

void materials::element::add_isotope ( const isotope iso_ref_,
double  weight_ = 1.0,
bool  owned_ = false 
)

Add an isotope with weight.

◆ add_isotope() [2/2]

void materials::element::add_isotope ( const isotope iso_ptr_,
double  weight_ = 1.0 
)

Add an isotope with weight.

◆ build()

void materials::element::build ( unsigned int  build_flags_ = 0)

Build the element : norm weights, compute molar mass.

◆ build_from_nist()

void materials::element::build_from_nist ( )

Build the element using NIST composition data, then normalize weights, compute molar mass.

◆ get_composition()

const isotope_weight_map_type& materials::element::get_composition ( ) const

Return the isotopic composition of the element.

◆ get_molar_mass()

double materials::element::get_molar_mass ( ) const

Return the molar mass [g/mol].

double g_per_mol = CLHEP::g/CLHPE::mol;
double molar_mass = 12.34 * g_per_mol;
elmt.set_molar_mass(molar_mass/g_per_mol);
double reloaded_molar_mass = elmt.get_molar_mass() * g_per_mol;

◆ get_name()

const std::string& materials::element::get_name ( ) const

Return the name.

◆ get_properties()

const datatools::properties& materials::element::get_properties ( ) const

Get reference of auxiliary properties.

◆ get_symbol()

const std::string& materials::element::get_symbol ( ) const

Return the chemical symbol.

◆ get_z()

int materials::element::get_z ( ) const

Return the number of protons (Z).

◆ grab_properties()

datatools::properties& materials::element::grab_properties ( )

Get reference of auxiliary properties.

◆ is_built_by_isotopic_composition()

bool materials::element::is_built_by_isotopic_composition ( ) const

Return true if the element is built by isotopic composition.

◆ is_locked()

bool materials::element::is_locked ( ) const

Return true if composition is valid, weights are normalized and molar mass is computed.

◆ lock()

void materials::element::lock ( )

Lock the element data structure.

◆ reset()

void materials::element::reset ( )

Reset.

◆ set_molar_mass()

void materials::element::set_molar_mass ( double  molar_mass_)

Set the molar mass of the element [g/mol].

double g_per_mol = CLHEP::g / CLHEP::mol;
double molar_mass = 12.34 * g_per_mol;
elmt.set_molar_mass(molar_mass / g_per_mol);

or

double molar_mass = 12.34; // implicit [g/mol]
elmt.set_molar_mass(molar_mass);

◆ set_name()

void materials::element::set_name ( const std::string &  name_)

Set the name of the element.

◆ set_z() [1/2]

void materials::element::set_z ( int  z_)

Set the Z (number of protons) & the chemical symbol of the element.

◆ set_z() [2/2]

void materials::element::set_z ( const std::string &  symbol_)

Set the Z (number of protons) & the chemical symbol of the element.

◆ tree_dump()

virtual void materials::element::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Smart print.

Reimplemented from datatools::i_tree_dumpable.

◆ unlock()

void materials::element::unlock ( )

Unlock the element data structure.

Member Data Documentation

◆ Z_UNDEFINED

const int materials::element::Z_UNDEFINED = -1
static

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