Skip to content

Commit

Permalink
Revert "Removing returns etc after RAYX_EXIT for consistency"
Browse files Browse the repository at this point in the history
This reverts commit a4f2da4.
  • Loading branch information
Atraxus committed Feb 17, 2025
1 parent 59309c9 commit 46310f7
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Intern/rayx-core/src/Data/DatFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) {
if (sscanf(line.c_str(), "%u %le %le %le", &out->m_lineCount, &out->m_start, &out->m_end, &out->m_step) != 4) {
#endif
RAYX_EXIT << "Failed to parse DatFile \"" << filename << "\", at line 2: \"" << line << "\"";
return false;
}
out->m_Lines.reserve(out->m_lineCount);

Expand All @@ -41,6 +42,7 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) {
if (sscanf(line.c_str(), "%le %le", &e.m_energy, &e.m_weight) != 2) {
#endif
RAYX_EXIT << "Failed to parse DatFile \"" << filename << "\", at line " << lineidx << ": \"" << line << "\"";
return false;
}
out->m_Lines.push_back(e);
out->m_weightSum += e.m_weight;
Expand Down
1 change: 1 addition & 0 deletions Intern/rayx-core/src/Data/Strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ElementType findElementString(const std::string& name) {
} else {
RAYX_LOG << "Could not find element with name: " << name;
RAYX_EXIT << "Error in findElementString(const std::string&): Element not found";
return ElementType::ImagePlane; // or some other default/fallback value
}
}
} // namespace RAYX
3 changes: 3 additions & 0 deletions Intern/rayx-core/src/Data/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ bool paramEnergyDistribution(const rapidxml::xml_node<>* node, const std::filesy
RAYX_EXIT << "paramEnergyDistribution is not implemented for "
"energyDistributionType"
<< static_cast<int>(energyDistributionType) << "!";
return false;
}
}

Expand Down Expand Up @@ -568,6 +569,7 @@ Cutout Parser::parseCutout(DesignPlane plane, std::string type) const {
return parseTotalLength();
} else {
RAYX_EXIT << "parseCutout encountered an invalid design plane!";
return 0.0;
}
};

Expand All @@ -590,6 +592,7 @@ Cutout Parser::parseCutout(DesignPlane plane, std::string type) const {
return serializeTrapezoid(trapezoid);
} else {
RAYX_EXIT << "invalid geometrical shape!";
return {0, {0.0, 0.0, 0.0}};
}
}

Expand Down
2 changes: 2 additions & 0 deletions Intern/rayx-core/src/Element/Behaviour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Cutout mkOpeningCutout(const DesignElement& dele) {
});
} else {
RAYX_EXIT << "unsupported opening type!";
return {};
}
}

Expand All @@ -71,6 +72,7 @@ Cutout mkBeamstopCutout(const DesignElement& dele) {
});
} else {
RAYX_EXIT << "unsupported CentralBeamstop type!";
return {};
}
}

Expand Down
2 changes: 2 additions & 0 deletions Intern/rayx-core/src/Material/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const char* getMaterialName(Material m) {
#undef X
}
RAYX_EXIT << "unknown material in getMaterialName()!";
return nullptr;
}

// std::vector over all materials
Expand All @@ -50,6 +51,7 @@ bool materialFromString(const char* matname, Material* out) {
}
}
RAYX_EXIT << "materialFromString(): material \"" << matname << "\" not found";
return false;
}

MaterialTables loadMaterialTables(std::array<bool, 92> relevantMaterials) {
Expand Down
1 change: 1 addition & 0 deletions Intern/rayx-core/src/Tracer/Tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ inline std::shared_ptr<RAYX::DeviceTracer> createDeviceTracer(DeviceType deviceT
return std::make_shared<RAYX::SimpleTracer<GpuAccHip>>(deviceIndex);
#else
RAYX_EXIT << "Failed to create Tracer with Hip device. Hip was disabled during build.";
return nullptr;
#endif
default: // case DeviceType::Cpu
using CpuAcc = RAYX::DefaultCpuAcc<Dim, Idx>;
Expand Down
1 change: 1 addition & 0 deletions Intern/rayx-core/src/Writer/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ FormatComponent componentFromString(const std::string& comp) {
}
RAYX_WARN << "Cannot evaluate format component \"" << comp << "\"!";
RAYX_EXIT << "A valid format would be \"" << defaultFormatString() << "\"";
return {};
}

Format formatFromString(const std::string& s) {
Expand Down
1 change: 1 addition & 0 deletions Intern/rayx-core/tests/setupTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ double parseDouble(std::string s) {
#endif
RAYX_WARN << "parseDouble failed for string:";
RAYX_EXIT << s;
return false;
}
return d;
}
Expand Down

0 comments on commit 46310f7

Please sign in to comment.