Skip to content

Commit fd377c1

Browse files
committed
More clang-tidy fixes related to variable name length
1 parent 26f7ecd commit fd377c1

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

include/inch/dripline.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <fmt/format.h>
1919

2020
#include <filesystem>
21-
#include <fstream>
2221
#include <string>
2322
#include <utility>
2423
#include <vector>
@@ -53,7 +52,7 @@ class DripLine
5352

5453
/// Delete both due to const members
5554
DripLine& operator=(const DripLine&) = delete;
56-
DripLine& operator=(DripLine&&) = delete;
55+
DripLine& operator=(DripLine&&) = delete;
5756

5857
virtual ~DripLine() = default;
5958

@@ -101,7 +100,10 @@ class DripLine
101100
/// Container to hold each isotope in the drop model data file
102101
struct drop_model_data
103102
{
104-
drop_model_data(const int a, const int z, const double me) : A(a), Z(z), N(a - z), ME(me) {}
103+
drop_model_data(const int mass_number, const int proton_number, const double mass_excess) :
104+
A(mass_number), Z(proton_number), N(mass_number - proton_number), ME(mass_excess)
105+
{
106+
}
105107

106108
int A{ 0 };
107109
int Z{ 0 };
@@ -216,7 +218,7 @@ class DripLine
216218
*
217219
* \return The neutron number of the dripline
218220
*/
219-
inline int GetNeutronDripValue(const int Z) const { return GetDripValue(Z, "Z"); }
221+
inline int GetNeutronDripValue(const int proton_number) const { return GetDripValue(proton_number, "Z"); }
220222

221223
/**
222224
* Wrapper around GetDripValue explicitly for N values and looking for Z
@@ -225,7 +227,7 @@ class DripLine
225227
*
226228
* \return The proton number of the dripline
227229
*/
228-
inline int GetProtonDripValue(const int N) const { return GetDripValue(N, "N"); }
230+
inline int GetProtonDripValue(const int neutron_number) const { return GetDripValue(neutron_number, "N"); }
229231

230232
/**
231233
* Output the dripline data in a consistent format
@@ -236,9 +238,9 @@ class DripLine
236238
*
237239
* \return A std::string to be written to the data file
238240
*/
239-
[[nodiscard]] static inline std::string WriteDataLine(const int N, const int Z)
241+
[[nodiscard]] static inline std::string WriteDataLine(const int neutron_number, const int proton_number)
240242
{
241-
return fmt::format("{0:>3d} {1:>3d}\n", N, Z);
243+
return fmt::format("{0:>3d} {1:>3d}\n", neutron_number, proton_number);
242244
}
243245

244246
/**

src/dripline.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ bool DripLine::readFRDMFile(const bool overwrite) const
4545
}
4646

4747
// Read the remainder of the file into the container created for it
48-
int A{ 0 };
49-
int Z{ 0 };
50-
double ME{ 0.0 };
48+
int mass_number{ 0 };
49+
int proton_number{ 0 };
50+
double mass_excess{ 0.0 };
5151
std::string dummy;
5252

53-
while (modelFile >> A >> Z >> dummy >> ME)
53+
while (modelFile >> mass_number >> proton_number >> dummy >> mass_excess)
5454
{
55-
DripLine::dm_data.emplace_back(A, Z, ME);
55+
DripLine::dm_data.emplace_back(mass_number, proton_number, mass_excess);
5656
}
5757

5858
modelFile.close();
@@ -174,24 +174,25 @@ int DripLine::createFile() const
174174
// For the neutron drip line, loop through all Z and look for the N value when the separation energy is negative
175175
if (the_line == LineType::singleneutron || the_line == LineType::doubleneutron)
176176
{
177-
for (int z = DripLine::single_p_lower_limits.first; z <= Limits::MAX_Z; ++z)
177+
for (auto proton_number = DripLine::single_p_lower_limits.first; proton_number <= Limits::MAX_Z; ++proton_number)
178178
{
179179
// Ignore cases when there is no dripline
180-
if (auto N = GetNeutronDripValue(z); N != 0)
180+
if (auto neutron_number = GetNeutronDripValue(proton_number); neutron_number != 0)
181181
{
182-
fmt::print(dripFile, "{}", WriteDataLine(N, z));
182+
fmt::print(dripFile, "{}", WriteDataLine(neutron_number, proton_number));
183183
}
184184
}
185185
}
186186
// For the proton drip line, loop through all N and look for the Z value when the separation energy is negative
187187
else // must be a proton dripline
188188
{
189-
for (int n = DripLine::single_n_lower_limits.second; n <= Limits::MAX_N; ++n)
189+
for (auto neutron_number = DripLine::single_n_lower_limits.second; neutron_number <= Limits::MAX_N;
190+
++neutron_number)
190191
{
191192
// Ignore cases when there is no dripline
192-
if (auto Z = GetProtonDripValue(n); Z != 0)
193+
if (auto proton_number = GetProtonDripValue(neutron_number); proton_number != 0)
193194
{
194-
fmt::print(dripFile, "{}", WriteDataLine(n, Z));
195+
fmt::print(dripFile, "{}", WriteDataLine(neutron_number, proton_number));
195196
}
196197
}
197198
}

0 commit comments

Comments
 (0)