Skip to content

Commit bb05342

Browse files
committed
Fixed uninitialized and unused variables.
1 parent 5c83ae6 commit bb05342

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

include/particlezoo/IAEA/IAEAHeader.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,13 @@ namespace ParticleZoo::IAEAphspFile
731731
bool wIsStored_;
732732
bool weightIsStored_;
733733

734-
float constantX_;
735-
float constantY_;
736-
float constantZ_;
737-
float constantU_;
738-
float constantV_;
739-
float constantW_;
740-
float constantWeight_;
734+
float constantX_{};
735+
float constantY_{};
736+
float constantZ_{};
737+
float constantU_{};
738+
float constantV_{};
739+
float constantW_{};
740+
float constantWeight_{};
741741

742742
std::vector<EXTRA_FLOAT_TYPE> extraFloatData_;
743743
std::vector<EXTRA_LONG_TYPE> extraLongData_;

include/particlezoo/parallel/HistoryBalancedParallelReader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ namespace ParticleZoo {
171171
std::vector<std::shared_ptr<PhaseSpaceFileReader>> readers_;
172172

173173
bool hasGapsBetweenHistories_;
174-
std::uint64_t totalHistoriesToRead_;
175174
std::uint64_t numberOfOriginalHistories_;
176175
std::uint64_t numberOfParticlesInPhsp_;
177176
std::uint64_t numberOfRepresentedHistories_;

src/PhaseSpaceFileWriter.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ namespace ParticleZoo
4444
historiesToAccountFor_(0),
4545
buffer_(BUFFER_SIZE),
4646
writeParticleDepth_(0),
47-
fixedValues_(fixedValues)
47+
fixedValues_(fixedValues),
48+
flipXDirection_(false),
49+
flipYDirection_(false),
50+
flipZDirection_(false)
4851
{
4952
if (formatType != FormatType::NONE && !file_.is_open())
5053
{

src/egs/egsphspFile.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ namespace ParticleZoo::EGSphspFile
145145

146146
// Writer class implementation
147147
Writer::Writer(const std::string & fileName, const UserOptions & options)
148-
: PhaseSpaceFileWriter("EGS", fileName, options)
148+
: PhaseSpaceFileWriter("EGS", fileName, options), latchOption_(EGSLATCHOPTION::LATCH_OPTION_2)
149149
{
150150
mode_ = EGSMODE::MODE0; // Default mode, MODE2 requires source particles to include ZLAST information
151151

@@ -160,6 +160,23 @@ namespace ParticleZoo::EGSphspFile
160160
throw std::runtime_error("Unsupported EGS phase-space file mode: " + modeStr);
161161
}
162162
}
163+
164+
if (options.contains(EGSLATCHOptionCommand)) {
165+
int latchOptionInt = options.extractIntOption(EGSLATCHOptionCommand);
166+
switch (latchOptionInt) {
167+
case 1:
168+
latchOption_ = EGSLATCHOPTION::LATCH_OPTION_1;
169+
break;
170+
case 2:
171+
latchOption_ = EGSLATCHOPTION::LATCH_OPTION_2;
172+
break;
173+
case 3:
174+
latchOption_ = EGSLATCHOPTION::LATCH_OPTION_3;
175+
break;
176+
default:
177+
throw std::runtime_error("Unsupported EGS LATCH option: " + std::to_string(latchOptionInt));
178+
}
179+
}
163180
}
164181

165182
std::vector<CLICommand> Writer::getFormatSpecificCLICommands() {

src/parallel/HistoryBalancedParallelReader.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ namespace ParticleZoo {
4747

4848
// Get the number of original histories and adjust totalHistoriesToRead_ if necessary
4949
numberOfOriginalHistories_ = readers_[0]->getNumberOfOriginalHistories();
50-
if (numberOfOriginalHistories_ < totalHistoriesToRead_) {
51-
totalHistoriesToRead_ = numberOfOriginalHistories_;
52-
}
5350

5451
// Get the number of particles in the phase space
5552
numberOfParticlesInPhsp_ = readers_[0]->getNumberOfParticles();

0 commit comments

Comments
 (0)