PRISM
 v0.0.0
Loading...
Searching...
No Matches
SpeciesBase.h
1#pragma once
2#include <string>
3#include <iostream>
4
5namespace prism
6{
11{
12public:
16 SpeciesBase(const std::string & name);
17 virtual ~SpeciesBase() {}
19 bool operator==(const SpeciesBase & other) const;
21 bool operator!=(const SpeciesBase & other) const;
23 const std::string & name() const { return _name; }
28 double mass() const { return _mass; }
33 double molarMass() const { return _molar_mass; }
35 int chargeNumber() const { return _charge_num; }
37 double charge() const { return _charge; }
39 const std::string & latexRepresentation() const { return _latex_name; }
40
41protected:
43 std::string _name;
45 double _mass;
49 double _charge;
53 std::string _latex_name;
54
55private:
61 std::string checkName(const std::string & name);
65 virtual void setMass() = 0;
69 virtual void setCharge() = 0;
71 virtual void setLatexName() = 0;
72};
73}
74
75template <>
76struct std::hash<prism::SpeciesBase>
77{
82 size_t operator()(const prism::SpeciesBase & obj) const;
83};
Base class for species and subspecies.
Definition SpeciesBase.h:11
int chargeNumber() const
Getter method for the charge number of the species.
Definition SpeciesBase.h:35
int _charge_num
The level of charge ex: Ar-4 this is -4.
Definition SpeciesBase.h:51
double _molar_mass
the molar mass of the species
Definition SpeciesBase.h:47
const std::string & latexRepresentation() const
Getter method for the latex name of the species.
Definition SpeciesBase.h:39
bool operator!=(const SpeciesBase &other) const
Comparison for checking whether or not the two are not equal
Definition SpeciesBase.C:40
const std::string & name() const
Getter method for the name of species.
Definition SpeciesBase.h:23
SpeciesBase(const std::string &name)
Definition SpeciesBase.C:10
double molarMass() const
Getter method for the molar mass of the species molar mass is in g / mol.
Definition SpeciesBase.h:33
bool operator==(const SpeciesBase &other) const
Comparison operator checks if the two base species have the same name.
Definition SpeciesBase.C:34
double _charge
the charge of the spcies in coulomb
Definition SpeciesBase.h:49
std::string _name
The full std::string of the species base.
Definition SpeciesBase.h:43
double charge() const
Getter method for the charge of the species.
Definition SpeciesBase.h:37
double _mass
The mass of an individual instance of the species.
Definition SpeciesBase.h:45
double mass() const
Getter method for the mass of the species mass of the species is in kg.
Definition SpeciesBase.h:28
std::string _latex_name
The name of the spcies formatted for printing in a latex_table.
Definition SpeciesBase.h:53
size_t operator()(const prism::SpeciesBase &obj) const
Custom hash function based only on the name of the species.