Skip to content

Commit

Permalink
Encapsulate the min N and Z values in the class
Browse files Browse the repository at this point in the history
The drip lines do not start at N=0,Z=0 so store their actual start
values within the class.

Realted to #8 & #9
  • Loading branch information
php1ic committed Jun 17, 2019
1 parent dffc14b commit 9e8a6b7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
21 changes: 16 additions & 5 deletions include/dripline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ enum class LineType
class DripLine
{
public:
DripLine(double nMass, double pMass, int minZ, int maxZ, int minN, int maxN, LineType line) :
DripLine(double nMass, double pMass, int _Zmin, int _Zmax, int _Nmin, int _Nmax, LineType line) :
neutron_mass(nMass),
proton_mass(pMass),
Zmin(minZ),
Zmax(maxZ),
Nmin(minN),
Nmax(maxN),
Zmin(_Zmin),
Zmax(_Zmax),
Nmin(_Nmin),
Nmax(_Nmax),
the_line(line)
{
}
Expand Down Expand Up @@ -79,6 +79,17 @@ class DripLine
/// The colour of the drip line when drawn
mutable std::string line_colour;

/// Lowest N and Z values for the single neutron drip line
static constexpr std::pair<int, int> single_n_lower_limits{ 17, 8 };
/// Lowest N and Z values for the single proton drip line
static constexpr std::pair<int, int> single_p_lower_limits{ 8, 11 };

/// Lowest N and Z values for the double neutron drip line
static constexpr std::pair<int, int> double_n_lower_limits{ 20, 8 };
/// Lowest N and Z values for the double proton drip line
static constexpr std::pair<int, int> double_p_lower_limits{ 8, 14 };


/**
* Allow the drip line to be any colour
*
Expand Down
16 changes: 8 additions & 8 deletions include/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,26 @@ class Options
/// File contain user isotopes to be drawn
mutable std::string personal_isotopes = "";
/// File name the chart will be written to, without extension, this is added in the code
mutable std::string outfile = "chart";
mutable std::string outfile = "chart";
/// Input file name
mutable std::string inputfile = "";

/// Output file options will be written to
mutable std::string options = "options.in";
mutable std::string options = "options.in";
/// Absolute path that will be prepended to others files so they can be located
mutable std::string path = "./";
mutable std::string path = "./";
/// R-process data file
mutable std::string r_proc_path = "r-process.dat";
mutable std::string r_proc_path = "r-process.dat";
/// Single particle neutron drip line file
mutable std::string neutron_drip = "neutron.drip";
mutable std::string neutron_drip = "neutron.drip";
/// Single particle proton drip line file
mutable std::string proton_drip = "proton.drip";
mutable std::string proton_drip = "proton.drip";
/// Two particle neutron drip line file
mutable std::string two_neutron_drip = "2neutron.drip";
/// Two particle proton drip line file
mutable std::string two_proton_drip = "2proton.drip";
mutable std::string two_proton_drip = "2proton.drip";
/// Finite-range drop model data file
mutable std::string FRDM = "FRLDM_ME.tbl";
mutable std::string FRDM = "FRLDM_ME.tbl";

/// How much of the chart will be drawn
mutable ChartSelection chart_selection = ChartSelection::FULL_CHART;
Expand Down
12 changes: 8 additions & 4 deletions src/chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ void Chart::writeEPS(std::vector<Nuclide>& nuc, Options& draw, Partition& part)
if (draw.single_drip_lines > 0)
{
const std::string dripLineColour = { "purple" };
if (draw.single_drip_lines != 2 && (draw.Nmax > 17 && draw.Zmax > 8))
if (draw.single_drip_lines != 2
&& (draw.Nmax > DripLine::single_n_lower_limits.first && draw.Zmax > DripLine::single_n_lower_limits.second))
{
const DripLine snDrip(nuc[0].NUBASE_ME / 1.0e3,
nuc[1].NUBASE_ME / 1.0e3,
Expand All @@ -273,7 +274,8 @@ void Chart::writeEPS(std::vector<Nuclide>& nuc, Options& draw, Partition& part)
snDrip.EPSWriteLine(outFile);
}

if (draw.single_drip_lines != 3 && (draw.Nmax > 8 && draw.Zmax > 11))
if (draw.single_drip_lines != 3
&& (draw.Nmax > DripLine::single_p_lower_limits.first && draw.Zmax > DripLine::single_p_lower_limits.second))
{
const DripLine spDrip(nuc[0].NUBASE_ME / 1.0e3,
nuc[1].NUBASE_ME / 1.0e3,
Expand All @@ -297,7 +299,8 @@ void Chart::writeEPS(std::vector<Nuclide>& nuc, Options& draw, Partition& part)
if (draw.double_drip_lines > 0)
{
const std::string dripLineColour = { "darkgreen" };
if (draw.double_drip_lines != 2 && (draw.Nmax > 20 && draw.Zmax > 8))
if (draw.double_drip_lines != 2
&& (draw.Nmax > DripLine::double_n_lower_limits.first && draw.Zmax > DripLine::double_n_lower_limits.second))
{
const DripLine dnDrip(nuc[0].NUBASE_ME / 1.0e3,
nuc[1].NUBASE_ME / 1.0e3,
Expand All @@ -312,7 +315,8 @@ void Chart::writeEPS(std::vector<Nuclide>& nuc, Options& draw, Partition& part)
dnDrip.EPSWriteLine(outFile);
}

if (draw.double_drip_lines != 3 && (draw.Nmax > 8 && draw.Zmax > 14))
if (draw.double_drip_lines != 3
&& (draw.Nmax > DripLine::double_p_lower_limits.first && draw.Zmax > DripLine::double_p_lower_limits.second))
{
const DripLine dpDrip(nuc[0].NUBASE_ME / 1.0e3,
nuc[1].NUBASE_ME / 1.0e3,
Expand Down

0 comments on commit 9e8a6b7

Please sign in to comment.