diff --git a/Intern/rayx-core/src/Angle.cpp b/Intern/rayx-core/src/Angle.cpp index ff9c88bba..d95973b2f 100644 --- a/Intern/rayx-core/src/Angle.cpp +++ b/Intern/rayx-core/src/Angle.cpp @@ -6,7 +6,7 @@ #include "Debug/Instrumentor.h" #include "Shader/Constants.h" -namespace RAYX { +namespace rayx { /// Converts an angle in degrees to radians. Rad Deg::toRad() const { return Rad(deg * PI / 180); } @@ -18,4 +18,4 @@ double Rad::sin() const { return std::sin(rad); } double Rad::cos() const { return std::cos(rad); } double Rad::tan() const { return std::tan(rad); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Angle.h b/Intern/rayx-core/src/Angle.h index 377276690..39db16735 100644 --- a/Intern/rayx-core/src/Angle.h +++ b/Intern/rayx-core/src/Angle.h @@ -6,7 +6,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { struct Rad; @@ -33,4 +33,4 @@ struct RAYX_API Rad { double rad; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/Beamline.cpp b/Intern/rayx-core/src/Beamline/Beamline.cpp index e896f0299..f1ef3e6f8 100644 --- a/Intern/rayx-core/src/Beamline/Beamline.cpp +++ b/Intern/rayx-core/src/Beamline/Beamline.cpp @@ -8,7 +8,7 @@ #include "Design/DesignElement.h" #include "Design/DesignSource.h" -namespace RAYX { +namespace rayx { namespace { std::string getUniqueUnnamedGroupName() { @@ -481,4 +481,4 @@ BeamlineNode* Group::findNodeByObjectId(const size_t objectId) { return const_cast(constSelf->findNodeByObjectId(objectId)); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/Beamline.h b/Intern/rayx-core/src/Beamline/Beamline.h index 23177cbdf..acc0ccd40 100644 --- a/Intern/rayx-core/src/Beamline/Beamline.h +++ b/Intern/rayx-core/src/Beamline/Beamline.h @@ -11,7 +11,7 @@ #include "Design/DesignSource.h" #include "Node.h" -namespace RAYX { +namespace rayx { /** * A beamline group that can contain child nodes (elements, sources, or other groups). @@ -180,4 +180,4 @@ class RAYX_API Group : public BeamlineNode { using Beamline = Group; // Conceptually, a Beamline is a Group -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/DatFile.cpp b/Intern/rayx-core/src/Beamline/DatFile.cpp index fd0b0cea8..837d259f1 100644 --- a/Intern/rayx-core/src/Beamline/DatFile.cpp +++ b/Intern/rayx-core/src/Beamline/DatFile.cpp @@ -7,7 +7,7 @@ #include "Debug/Debug.h" #include "Random.h" -namespace RAYX { +namespace rayx { bool DatFile::load(const std::filesystem::path& filename, DatFile* out) { try { std::ifstream s(filename); @@ -63,4 +63,4 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) { return s.str(); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/DatFile.h b/Intern/rayx-core/src/Beamline/DatFile.h index 28ad55a48..92a7ad2d0 100644 --- a/Intern/rayx-core/src/Beamline/DatFile.h +++ b/Intern/rayx-core/src/Beamline/DatFile.h @@ -7,7 +7,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { /** This struct represents one line of a .DAT file. */ struct DatEntry { double m_energy; @@ -34,4 +34,4 @@ struct DatFile { /** creates a valid .DAT file from this struct (may be used for testing) */ [[maybe_unused]] std::string dump(); }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/Definitions.h b/Intern/rayx-core/src/Beamline/Definitions.h index baf222cb4..42bbfd89d 100644 --- a/Intern/rayx-core/src/Beamline/Definitions.h +++ b/Intern/rayx-core/src/Beamline/Definitions.h @@ -2,7 +2,7 @@ #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { enum class GratingMount { Deviation, Incidence }; enum class ParaboloidType { Focussing, Collimate }; enum class CurvatureType { @@ -26,4 +26,4 @@ enum class FigureRotation { Yes, Plane, A11 }; // Thus they need a bit of extra handling to convert them to the shaders XZ plane. enum class DesignPlane { XY, XZ }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/EnergyDistribution.h b/Intern/rayx-core/src/Beamline/EnergyDistribution.h index 88df98265..fc2f60a44 100644 --- a/Intern/rayx-core/src/Beamline/EnergyDistribution.h +++ b/Intern/rayx-core/src/Beamline/EnergyDistribution.h @@ -5,7 +5,7 @@ #include "Core.h" #include "DatFile.h" -namespace RAYX { +namespace rayx { enum class SpreadType { HardEdge, SoftEdge, SeparateEnergies }; // default WhiteBand enum class EnergyDistributionType { File, Values, Total, Param }; // default ET_VALUES @@ -48,4 +48,4 @@ struct RAYX_API SeparateEnergies { using EnergyDistributionVariant = std::variant; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/Node.cpp b/Intern/rayx-core/src/Beamline/Node.cpp index 1d1cc65f4..19193fc76 100644 --- a/Intern/rayx-core/src/Beamline/Node.cpp +++ b/Intern/rayx-core/src/Beamline/Node.cpp @@ -4,7 +4,7 @@ #include "Beamline.h" -namespace RAYX { +namespace rayx { namespace { std::string getNodeTypeString(const BeamlineNode* node) { @@ -107,4 +107,4 @@ DesignElement* BeamlineNode::asElement() { return static_cast(this); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/Node.h b/Intern/rayx-core/src/Beamline/Node.h index 3f414eb06..4c7e2d41a 100644 --- a/Intern/rayx-core/src/Beamline/Node.h +++ b/Intern/rayx-core/src/Beamline/Node.h @@ -6,7 +6,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { class Group; class DesignSource; @@ -117,4 +117,4 @@ class RAYX_API BeamlineNode { BeamlineNode* m_parent = nullptr; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Beamline/StringConversion.h b/Intern/rayx-core/src/Beamline/StringConversion.h index 3f9d70b06..435bee03d 100644 --- a/Intern/rayx-core/src/Beamline/StringConversion.h +++ b/Intern/rayx-core/src/Beamline/StringConversion.h @@ -6,7 +6,7 @@ #include "Shader/LightSources/LightSource.h" -namespace RAYX { +namespace rayx { // String conversion functions @@ -210,4 +210,4 @@ inline std::ostream& operator<<(std::ostream& os, const ElementType v) { return inline std::ostream& operator<<(std::ostream& os, const EventType v) { return streamEnum(os, v, EventTypeToString); } inline std::ostream& operator<<(std::ostream& os, const CutoutType v) { return streamEnum(os, v, CutoutTypeToString); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/CanonicalizePath.cpp b/Intern/rayx-core/src/CanonicalizePath.cpp index 31df551dd..b4c401066 100644 --- a/Intern/rayx-core/src/CanonicalizePath.cpp +++ b/Intern/rayx-core/src/CanonicalizePath.cpp @@ -5,7 +5,7 @@ #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { /// this function assumes that `base` is already an absolute path std::filesystem::path canonicalize(const std::filesystem::path& relPath, const std::filesystem::path& base) { @@ -22,4 +22,4 @@ std::filesystem::path canonicalizeRepositoryPath(const std::filesystem::path& re std::filesystem::path canonicalizeUserPath(const std::filesystem::path& relPath) { return canonicalize(relPath, std::filesystem::current_path()); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/CanonicalizePath.h b/Intern/rayx-core/src/CanonicalizePath.h index 1c06e8a45..b640f9aa9 100644 --- a/Intern/rayx-core/src/CanonicalizePath.h +++ b/Intern/rayx-core/src/CanonicalizePath.h @@ -6,7 +6,7 @@ #include "Core.h" #include "FileIO.h" -namespace RAYX { +namespace rayx { /// `relPath` is a path relative to the root of the RAY-X git repository (i.e. /// where .git lies). canonicalizeRepositoryPath(relPath) yields an absolute @@ -31,4 +31,4 @@ std::filesystem::path RAYX_API canonicalizeRepositoryPath(const std::filesystem: /// `./TerminalApp -i ` std::filesystem::path RAYX_API canonicalizeUserPath(const std::filesystem::path& relPath); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Debug/Debug.cpp b/Intern/rayx-core/src/Debug/Debug.cpp index 180edf88f..b529f1817 100644 --- a/Intern/rayx-core/src/Debug/Debug.cpp +++ b/Intern/rayx-core/src/Debug/Debug.cpp @@ -3,7 +3,7 @@ #include #include -namespace RAYX { +namespace rayx { // The length of filename and line number is 30 characters. // If it doesn't find, we insert "...". @@ -87,7 +87,7 @@ const int PREC = 17; // precision // the implementation of RAYX_DBG. // the std::vector v contains the data of the object we intend to log. void dbg(const std::string& filename, int line, std::string name, std::vector v) { - RAYX::Log(filename, line) << std::move(name) << ":"; + rayx::Log(filename, line) << std::move(name) << ":"; int counter = 0; // stores the number of elements in the stringstream std::stringstream s; @@ -98,11 +98,11 @@ void dbg(const std::string& filename, int line, std::string name, std::vector 0) { RAYX::Log(filename, line) << s.str(); } + if (counter > 0) { rayx::Log(filename, line) << s.str(); } } // The verbose flag used for RAYX_VERB printing. @@ -110,4 +110,4 @@ static bool VERBOSE = false; void setDebugVerbose(bool b) { VERBOSE = b; } bool getDebugVerbose() { return VERBOSE; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Debug/Debug.h b/Intern/rayx-core/src/Debug/Debug.h index 6dad95508..28d59deb3 100644 --- a/Intern/rayx-core/src/Debug/Debug.h +++ b/Intern/rayx-core/src/Debug/Debug.h @@ -40,7 +40,7 @@ #define STRING(s) #s -namespace RAYX { +namespace rayx { ///////////////////////////////////////////////////////////////////////////// // OSTREAM CONVERSION @@ -139,7 +139,7 @@ struct RAYX_API Verb { // An empty implementation used in release when using "debug-only" prints like RAYX_D_LOG. struct RAYX_API IgnoreLog{template IgnoreLog & operator<<(T){return *this; -} // namespace RAYX +} // namespace rayx } ; @@ -150,10 +150,10 @@ extern void RAYX_API (*error_fn)(); // Defines the actual RAYX logging macros using the structs defined above. // The __FILE__ and __LINE__ macros contain the current filename and linenumber. // They are defined for us by c++ https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html -#define RAYX_LOG RAYX::Log(__FILE__, __LINE__) -#define RAYX_WARN RAYX::Warn(__FILE__, __LINE__) -#define RAYX_EXIT RAYX::Exit(__FILE__, __LINE__) -#define RAYX_VERB RAYX::Verb(__FILE__, __LINE__) +#define RAYX_LOG rayx::Log(__FILE__, __LINE__) +#define RAYX_WARN rayx::Warn(__FILE__, __LINE__) +#define RAYX_EXIT rayx::Exit(__FILE__, __LINE__) +#define RAYX_VERB rayx::Verb(__FILE__, __LINE__) #ifdef RAYX_DEBUG_MODE // In debug mode, RAYX_D_LOG is just the same as RAYX_LOG. @@ -164,10 +164,10 @@ extern void RAYX_API (*error_fn)(); #else // In release mode, RAYX_D_LOG instead calls the IgnoreLog, hence discarding the print. -#define RAYX_D_LOG RAYX::IgnoreLog() -#define RAYX_D_WARN RAYX::IgnoreLog() -#define RAYX_D_ERR RAYX::IgnoreLog() -#define RAYX_D_VERB RAYX::IgnoreLog() +#define RAYX_D_LOG rayx::IgnoreLog() +#define RAYX_D_WARN rayx::IgnoreLog() +#define RAYX_D_ERR rayx::IgnoreLog() +#define RAYX_D_VERB rayx::IgnoreLog() #endif ///////////////////////////////////////////////////////////////////////////// @@ -257,6 +257,6 @@ inline std::vector formatAsVec(const Rays& rays) { void dbg(const std::string& filename, int line, std::string name, std::vector v); -#define RAYX_DBG(C) RAYX::dbg(__FILE__, __LINE__, #C, RAYX::formatAsVec(C)) +#define RAYX_DBG(C) rayx::dbg(__FILE__, __LINE__, #C, rayx::formatAsVec(C)) } // namespace RAYX diff --git a/Intern/rayx-core/src/Debug/Instrumentor.cpp b/Intern/rayx-core/src/Debug/Instrumentor.cpp index 02168816b..60f3732dc 100644 --- a/Intern/rayx-core/src/Debug/Instrumentor.cpp +++ b/Intern/rayx-core/src/Debug/Instrumentor.cpp @@ -1,4 +1,4 @@ #include "Instrumentor.h" // if true, benchmarking is active. -bool RAYX::BENCH_FLAG = false; \ No newline at end of file +bool rayx::BENCH_FLAG = false; \ No newline at end of file diff --git a/Intern/rayx-core/src/Debug/Instrumentor.h b/Intern/rayx-core/src/Debug/Instrumentor.h index 3db6cf515..7bb0a051c 100644 --- a/Intern/rayx-core/src/Debug/Instrumentor.h +++ b/Intern/rayx-core/src/Debug/Instrumentor.h @@ -12,7 +12,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { extern bool RAYX_API BENCH_FLAG; class RAYX_API InstrumentationTimer { @@ -49,12 +49,12 @@ class RAYX_API InstrumentationTimer { bool m_canPrint; }; -} // namespace RAYX +} // namespace rayx // Define profiling macros -#define RAYX_PROFILE_SCOPE(name) ::RAYX::InstrumentationTimer timer##__LINE__(name, false) +#define RAYX_PROFILE_SCOPE(name) ::rayx::InstrumentationTimer timer##__LINE__(name, false) // Allows for printing of benchmarking results if BENCH_FLAG is set to true -#define RAYX_PROFILE_SCOPE_STDOUT(name) ::RAYX::InstrumentationTimer timer##__LINE__(name, true) +#define RAYX_PROFILE_SCOPE_STDOUT(name) ::rayx::InstrumentationTimer timer##__LINE__(name, true) #if !defined(__PRETTY_FUNCTION__) && !defined(__GNUC__) #define __PRETTY_FUNCTION__ __FUNCSIG__ #endif diff --git a/Intern/rayx-core/src/Design/DesignElement.cpp b/Intern/rayx-core/src/Design/DesignElement.cpp index bc0ef78d8..738572e0b 100644 --- a/Intern/rayx-core/src/Design/DesignElement.cpp +++ b/Intern/rayx-core/src/Design/DesignElement.cpp @@ -6,7 +6,7 @@ #include "Debug/Debug.h" #include "Debug/Instrumentor.h" -namespace RAYX { +namespace rayx { namespace { std::string getUniqueUnnamedElementName() { @@ -15,18 +15,18 @@ std::string getUniqueUnnamedElementName() { } } // unnamed namespace -DesignElement::DesignElement() : m_elementParameters(RAYX::Map()) { +DesignElement::DesignElement() : m_elementParameters(rayx::Map()) { setName(getUniqueUnnamedElementName()); setPosition(glm::dvec4(0)); setOrientation(glm::dmat4(1.0)); - setType(RAYX::ElementType::Undefined); + setType(rayx::ElementType::Undefined); } -DesignElement::DesignElement(std::string name) : m_elementParameters(RAYX::Map()) { +DesignElement::DesignElement(std::string name) : m_elementParameters(rayx::Map()) { setName(std::move(name)); setPosition(glm::dvec4(0)); setOrientation(glm::dmat4(1.0)); - setType(RAYX::ElementType::Undefined); + setType(rayx::ElementType::Undefined); } DesignElement::DesignElement(DesignElement&& other) noexcept { m_elementParameters = std::move(other.m_elementParameters); } @@ -561,4 +561,4 @@ double DesignElement::getThicknessCoating() const { return m_elementParameters[" void DesignElement::setRoughnessCoating(double value) { m_elementParameters["roughnessCoating"] = value; } double DesignElement::getRoughnessCoating() const { return m_elementParameters["roughnessCoating"].as_double(); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Design/DesignElement.h b/Intern/rayx-core/src/Design/DesignElement.h index 01056e7c7..0e161e50a 100644 --- a/Intern/rayx-core/src/Design/DesignElement.h +++ b/Intern/rayx-core/src/Design/DesignElement.h @@ -4,7 +4,7 @@ #include "Element/Element.h" #include "Value.h" -namespace RAYX { +namespace rayx { class RAYX_API DesignElement : public BeamlineNode { public: @@ -262,4 +262,4 @@ class RAYX_API DesignElement : public BeamlineNode { void setRoughnessCoating(double value); double getRoughnessCoating() const; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Design/DesignSource.cpp b/Intern/rayx-core/src/Design/DesignSource.cpp index 3488ac711..40a91ccb0 100644 --- a/Intern/rayx-core/src/Design/DesignSource.cpp +++ b/Intern/rayx-core/src/Design/DesignSource.cpp @@ -5,7 +5,7 @@ #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { namespace { std::string getUniqueUnnamedSourceName() { @@ -14,18 +14,18 @@ std::string getUniqueUnnamedSourceName() { } } // unnamed namespace -DesignSource::DesignSource() : m_elementParameters(RAYX::Map()) { +DesignSource::DesignSource() : m_elementParameters(rayx::Map()) { setName(getUniqueUnnamedSourceName()); setPosition(glm::dvec4(0)); setOrientation(glm::dmat4(1.0)); - setType(RAYX::ElementType::Undefined); + setType(rayx::ElementType::Undefined); } -DesignSource::DesignSource(std::string name) : m_elementParameters(RAYX::Map()) { +DesignSource::DesignSource(std::string name) : m_elementParameters(rayx::Map()) { setName(std::move(name)); setPosition(glm::dvec4(0)); setOrientation(glm::dmat4(1.0)); - setType(RAYX::ElementType::Undefined); + setType(rayx::ElementType::Undefined); } DesignSource::DesignSource(DesignSource&& other) noexcept { m_elementParameters = std::move(other.m_elementParameters); } @@ -295,4 +295,4 @@ void DesignSource::setRayList(std::shared_ptr& rays) { m_elementParameters std::shared_ptr DesignSource::getRayList() const { return m_elementParameters["rayList"].as_rayList(); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Design/DesignSource.h b/Intern/rayx-core/src/Design/DesignSource.h index 25da2ceb4..eb387c7c2 100644 --- a/Intern/rayx-core/src/Design/DesignSource.h +++ b/Intern/rayx-core/src/Design/DesignSource.h @@ -3,7 +3,7 @@ #include "Beamline/Node.h" #include "Value.h" -namespace RAYX { +namespace rayx { class RAYX_API DesignSource : public BeamlineNode { public: @@ -146,4 +146,4 @@ class RAYX_API DesignSource : public BeamlineNode { std::shared_ptr getRayList() const; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Design/Value.cpp b/Intern/rayx-core/src/Design/Value.cpp index 3547a38bb..50a7a5cba 100644 --- a/Intern/rayx-core/src/Design/Value.cpp +++ b/Intern/rayx-core/src/Design/Value.cpp @@ -2,7 +2,7 @@ #include -namespace RAYX { +namespace rayx { DesignMap DesignMap::clone() const { DesignMap copy; @@ -245,4 +245,4 @@ DesignMap::ConstIterator DesignMap::end() const { throw std::runtime_error("Calling end() on non-map!"); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Design/Value.h b/Intern/rayx-core/src/Design/Value.h index 4a56d613b..4b3b24e4a 100644 --- a/Intern/rayx-core/src/Design/Value.h +++ b/Intern/rayx-core/src/Design/Value.h @@ -16,7 +16,7 @@ #include "Material/Material.h" #include "Rml/xml.h" -namespace RAYX { +namespace rayx { enum class ValueType { Undefined, @@ -253,4 +253,4 @@ class RAYX_API DesignMap { Variant m_variant; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Behaviour.cpp b/Intern/rayx-core/src/Element/Behaviour.cpp index 198960dc4..c93214a25 100644 --- a/Intern/rayx-core/src/Element/Behaviour.cpp +++ b/Intern/rayx-core/src/Element/Behaviour.cpp @@ -5,7 +5,7 @@ #include "Design/DesignElement.h" #include "Shader/Utils.h" -namespace RAYX { +namespace rayx { Behaviour makeBehaviour(const DesignElement& dele) { switch (dele.getBehaviourType()) { @@ -158,4 +158,4 @@ Behaviour makeFoil(const DesignElement& dele) { }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Behaviour.h b/Intern/rayx-core/src/Element/Behaviour.h index d3177e01e..7c866cfdf 100644 --- a/Intern/rayx-core/src/Element/Behaviour.h +++ b/Intern/rayx-core/src/Element/Behaviour.h @@ -4,7 +4,7 @@ #include "Cutout.h" #include "Variant.h" -namespace RAYX { +namespace rayx { #undef m_private_serialization_params @@ -85,4 +85,4 @@ Behaviour makeSlit(const DesignElement& dele); Behaviour makeRZPBehaviour(const DesignElement& dele); Behaviour makeFoil(const DesignElement& dele); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Coating.h b/Intern/rayx-core/src/Element/Coating.h index 9fc6dd002..2c3601cbd 100644 --- a/Intern/rayx-core/src/Element/Coating.h +++ b/Intern/rayx-core/src/Element/Coating.h @@ -5,7 +5,7 @@ #include "Core.h" #include "Variant.h" -namespace RAYX { +namespace rayx { enum class SurfaceCoatingType { SubstrateOnly, // No coating, only substrate @@ -37,4 +37,4 @@ struct CoatingTypes { using Coating = Variant; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Cutout.h b/Intern/rayx-core/src/Element/Cutout.h index c86fb1f4b..8c79db160 100644 --- a/Intern/rayx-core/src/Element/Cutout.h +++ b/Intern/rayx-core/src/Element/Cutout.h @@ -3,7 +3,7 @@ #include "Core.h" #include "Variant.h" -namespace RAYX { +namespace rayx { // Cutout types: // a subset of points of the XZ-plane. used to limit the potentially infinite surfaces. @@ -73,4 +73,4 @@ struct RAYX_API CutoutTypes { using Cutout = Variant; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Element.cpp b/Intern/rayx-core/src/Element/Element.cpp index 4267087d7..80b2d491b 100644 --- a/Intern/rayx-core/src/Element/Element.cpp +++ b/Intern/rayx-core/src/Element/Element.cpp @@ -4,7 +4,7 @@ #include "Design/DesignElement.h" -namespace RAYX { +namespace rayx { // No additional implementation needed for now since the structs do not have member functions @@ -80,4 +80,4 @@ OpticalElementAndTransform makeElement(const DesignElement& dele, Behaviour beha }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Element.h b/Intern/rayx-core/src/Element/Element.h index 8664ab7a0..405d1db06 100644 --- a/Intern/rayx-core/src/Element/Element.h +++ b/Intern/rayx-core/src/Element/Element.h @@ -13,7 +13,7 @@ #include "Shader/SlopeError.h" #include "Surface.h" -namespace RAYX { +namespace rayx { class DesignElement; @@ -77,4 +77,4 @@ struct OpticalElementAndTransform { OpticalElementAndTransform makeElement(const DesignElement& dele, Behaviour behaviour, Surface surface, DesignPlane plane = DesignPlane::XZ, std::optional cutout = {}); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Surface.cpp b/Intern/rayx-core/src/Element/Surface.cpp index d1ff46440..8646a2ace 100644 --- a/Intern/rayx-core/src/Element/Surface.cpp +++ b/Intern/rayx-core/src/Element/Surface.cpp @@ -3,7 +3,7 @@ #include "Beamline/Beamline.h" #include "Design/DesignElement.h" -namespace RAYX { +namespace rayx { Surface makeSurface(const DesignElement& dele) { switch (dele.getCurvatureType()) { @@ -76,7 +76,7 @@ Surface makeCylinder(const DesignElement& dele) { } Surface makeCone(const DesignElement& dele) { - RAYX::Rad incidence = dele.getGrazingIncAngle(); + rayx::Rad incidence = dele.getGrazingIncAngle(); double entranceArmLength = dele.getEntranceArmLength(); double exitArmLength = dele.getExitArmLength(); @@ -267,4 +267,4 @@ Surface makeQuadric(const DesignElement& dele) { return dele.getExpertsOptics(); Surface makeCubic(const DesignElement& dele) { return dele.getExpertsCubic(); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Element/Surface.h b/Intern/rayx-core/src/Element/Surface.h index 4cba87a19..bd7fc71a9 100644 --- a/Intern/rayx-core/src/Element/Surface.h +++ b/Intern/rayx-core/src/Element/Surface.h @@ -3,7 +3,7 @@ #include "Core.h" #include "Variant.h" -namespace RAYX { +namespace rayx { enum class ToroidType { Convex, @@ -81,4 +81,4 @@ Surface makeSphere(double radius); //< creates a sphere from th Surface makePlane(); //< creates a plane surface Surface makeParaboloid(const DesignElement& dele); //< creates a Paraboloid from the parameters given in ` dele`. -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/FileIO.cpp b/Intern/rayx-core/src/FileIO.cpp index ed127dd78..882a1e4c2 100644 --- a/Intern/rayx-core/src/FileIO.cpp +++ b/Intern/rayx-core/src/FileIO.cpp @@ -3,7 +3,7 @@ #include "CanonicalizePath.h" #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { std::optional> readFile(const std::string& filename, const uint32_t count) { std::vector data; @@ -70,4 +70,4 @@ void writeFile(const std::vector& data, const std::string& filename, co file.close(); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/FileIO.h b/Intern/rayx-core/src/FileIO.h index cb86037ca..b767a92d9 100644 --- a/Intern/rayx-core/src/FileIO.h +++ b/Intern/rayx-core/src/FileIO.h @@ -6,7 +6,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { // The readFile functions return {} if an error occured while opening the file. // We prefered this over an exception, as you typically forget to handle them. @@ -18,4 +18,4 @@ std::optional> readFileAlign32(const std::string& filename void RAYX_API writeFile(const std::vector& data, const std::string& filename, const uint32_t count = 0); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Material/Material.cpp b/Intern/rayx-core/src/Material/Material.cpp index 3add8e560..bc220f442 100644 --- a/Intern/rayx-core/src/Material/Material.cpp +++ b/Intern/rayx-core/src/Material/Material.cpp @@ -10,7 +10,7 @@ #include "NffTable.h" #include "PalikTable.h" -namespace RAYX { +namespace rayx { /** * returns the name of the material: @@ -106,4 +106,4 @@ MaterialTables loadMaterialTables(std::array relevantMaterials) { return out; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Material/Material.h b/Intern/rayx-core/src/Material/Material.h index cf238288f..be7220891 100644 --- a/Intern/rayx-core/src/Material/Material.h +++ b/Intern/rayx-core/src/Material/Material.h @@ -5,7 +5,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { /** * This enum class is the c++ perspective on the Materials stored in @@ -39,4 +39,4 @@ struct RAYX_API MaterialTables { // the tables will later be written to the mat and matIdx buffers of shader.comp MaterialTables RAYX_API loadMaterialTables(std::array relevantMaterials); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Material/NffTable.cpp b/Intern/rayx-core/src/Material/NffTable.cpp index 2446598fb..873a30de6 100644 --- a/Intern/rayx-core/src/Material/NffTable.cpp +++ b/Intern/rayx-core/src/Material/NffTable.cpp @@ -7,7 +7,7 @@ #include "Debug/Debug.h" #include "Rml/Locate.h" -namespace RAYX { +namespace rayx { bool NffTable::load(const char* element, NffTable* out) { std::string elementString = element; @@ -46,4 +46,4 @@ bool NffTable::load(const char* element, NffTable* out) { return true; } -} // namespace RAYX \ No newline at end of file +} // namespace rayx \ No newline at end of file diff --git a/Intern/rayx-core/src/Material/NffTable.h b/Intern/rayx-core/src/Material/NffTable.h index 802b9127c..a67fdd5d0 100644 --- a/Intern/rayx-core/src/Material/NffTable.h +++ b/Intern/rayx-core/src/Material/NffTable.h @@ -6,7 +6,7 @@ // This file defines the NffEntry. #include "../Shader/RefractiveIndex.h" -namespace RAYX { +namespace rayx { /** This struct represents the contents of a .NKP file. * * Example usage: @@ -27,4 +27,4 @@ struct NffTable { // double interpolate(double x) const; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Material/PalikTable.cpp b/Intern/rayx-core/src/Material/PalikTable.cpp index 38b63f795..702994ac5 100644 --- a/Intern/rayx-core/src/Material/PalikTable.cpp +++ b/Intern/rayx-core/src/Material/PalikTable.cpp @@ -6,7 +6,7 @@ #include "Debug/Debug.h" #include "Rml/Locate.h" -namespace RAYX { +namespace rayx { bool PalikTable::load(const char* element, PalikTable* out) { std::string elementString = element; @@ -44,4 +44,4 @@ bool PalikTable::load(const char* element, PalikTable* out) { return true; } -} // namespace RAYX \ No newline at end of file +} // namespace rayx \ No newline at end of file diff --git a/Intern/rayx-core/src/Material/PalikTable.h b/Intern/rayx-core/src/Material/PalikTable.h index 5cff40d2b..1d7805e3b 100644 --- a/Intern/rayx-core/src/Material/PalikTable.h +++ b/Intern/rayx-core/src/Material/PalikTable.h @@ -6,7 +6,7 @@ // This file defines the PalikEntry. #include "../Shader/RefractiveIndex.h" -namespace RAYX { +namespace rayx { /** This struct represents the contents of a .NKP file. * * Example usage: @@ -26,4 +26,4 @@ struct PalikTable { // double interpolate(double x) const; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/ObjectMask.h b/Intern/rayx-core/src/ObjectMask.h index 32ac777bc..f33f91fac 100644 --- a/Intern/rayx-core/src/ObjectMask.h +++ b/Intern/rayx-core/src/ObjectMask.h @@ -6,7 +6,7 @@ #include "Core.h" #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { class RAYX_API ObjectIndexMask { ObjectIndexMask(const std::vector& sourceMask, const std::vector& elementMask) @@ -144,4 +144,4 @@ class RAYX_API ObjectMask { Variant m_variant; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Random.cpp b/Intern/rayx-core/src/Random.cpp index e41067a5a..fcfdd19c7 100644 --- a/Intern/rayx-core/src/Random.cpp +++ b/Intern/rayx-core/src/Random.cpp @@ -7,7 +7,7 @@ static std::mt19937 RNG; -namespace RAYX { +namespace rayx { void fixSeed(uint32_t seed) { RNG.seed(seed); } @@ -50,4 +50,4 @@ double randomNormal(double mu, double sigma) { return z0; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Random.h b/Intern/rayx-core/src/Random.h index 0b9dd8491..1cb4e17d4 100644 --- a/Intern/rayx-core/src/Random.h +++ b/Intern/rayx-core/src/Random.h @@ -10,7 +10,7 @@ // It is crucial that all of our random implementations yield the same values (with a fixed seed) across all hardware, compilers and platforms! -namespace RAYX { +namespace rayx { // fixed-seed tests operate on this seed. const uint32_t FIXED_SEED = 42; @@ -40,4 +40,4 @@ double RAYX_API randomDoubleInRange(double a, double b); // `mean` is evidently the mean of the distribution, while `stddev` is the standard deviation (often written as sigma). double RAYX_API randomNormal(double mean, double stddev); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/RayAttrMask.cpp b/Intern/rayx-core/src/RayAttrMask.cpp index bc1a3fb69..edbc58de8 100644 --- a/Intern/rayx-core/src/RayAttrMask.cpp +++ b/Intern/rayx-core/src/RayAttrMask.cpp @@ -2,7 +2,7 @@ #include -namespace RAYX { +namespace rayx { int countSetBits(const RayAttrMask mask) { return std::bitset>(RayAttrMask::RayAttrMaskCount)>( @@ -42,4 +42,4 @@ RayAttrMask rayAttrStringsToRayAttrMask(const std::vector& strings) return attr; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/RayAttrMask.h b/Intern/rayx-core/src/RayAttrMask.h index aad65df7c..336399bda 100644 --- a/Intern/rayx-core/src/RayAttrMask.h +++ b/Intern/rayx-core/src/RayAttrMask.h @@ -53,7 +53,7 @@ RAYX_X_MACRO_RAY_ATTR_EVENT_TYPE \ RAYX_X_MACRO_RAY_ATTR_RAND_COUNTER -namespace RAYX { +namespace rayx { #define X(type, name, flag) static_assert(std::is_nothrow_move_constructible_v); // ensure efficient moves RAYX_X_MACRO_RAY_ATTR @@ -150,4 +150,4 @@ RAYX_API std::vector getRayAttrNames(); */ RAYX_API RayAttrMask rayAttrStringsToRayAttrMask(const std::vector& strings); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rays.cpp b/Intern/rayx-core/src/Rays.cpp index 71cf14d20..bcd4b3ee0 100644 --- a/Intern/rayx-core/src/Rays.cpp +++ b/Intern/rayx-core/src/Rays.cpp @@ -6,7 +6,7 @@ #include "Debug/Instrumentor.h" -namespace RAYX { +namespace rayx { Rays Rays::copy() const { RAYX_PROFILE_FUNCTION_STDOUT(); @@ -140,7 +140,7 @@ Rays Rays::filterByLastEventInPath() const { const auto attr = attrMask(); Rays result; #define X(type, name, flag) \ - if (RAYX::contains(attr, RayAttrMask::flag)) { \ + if (rayx::contains(attr, RayAttrMask::flag)) { \ result.name.resize(indices.size()); \ std::transform(indices.begin(), indices.end(), result.name.begin(), [this](const int i) { return name[i]; }); \ } @@ -154,7 +154,7 @@ bool Rays::isValid() const { const auto sz = size(); #define X(type, name, flag) \ - if (RAYX::contains(attr, RayAttrMask::flag) && static_cast(name.size()) != sz) return false; + if (rayx::contains(attr, RayAttrMask::flag) && static_cast(name.size()) != sz) return false; RAYX_X_MACRO_RAY_ATTR #undef X return true; @@ -170,4 +170,4 @@ bool operator==(const Rays& lhs, const Rays& rhs) { bool operator!=(const Rays& lhs, const Rays& rhs) { return !(lhs == rhs); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rays.h b/Intern/rayx-core/src/Rays.h index 150b4f256..f7b33fd7d 100644 --- a/Intern/rayx-core/src/Rays.h +++ b/Intern/rayx-core/src/Rays.h @@ -6,7 +6,7 @@ #include "Debug/Instrumentor.h" #include "RayAttrMask.h" -namespace RAYX { +namespace rayx { /** * @brief A structure representing a collection of rays and their attributes. @@ -270,4 +270,4 @@ static_assert(std::is_nothrow_move_constructible_v); // ensure efficient bool RAYX_API operator==(const Rays& lhs, const Rays& rhs); bool RAYX_API operator!=(const Rays& lhs, const Rays& rhs); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/DesignElementWriter.h b/Intern/rayx-core/src/Rml/DesignElementWriter.h index 2472b88cb..4ca3b4d7a 100644 --- a/Intern/rayx-core/src/Rml/DesignElementWriter.h +++ b/Intern/rayx-core/src/Rml/DesignElementWriter.h @@ -11,7 +11,7 @@ #include "Core.h" #include "Element/Cutout.h" -namespace RAYX { +namespace rayx { /** * Set all Parameters for each optical Element a RML file can define. @@ -278,4 +278,4 @@ void getFoil(xml::Parser parser, DesignElement* de) { de->setRoughnessSubstrate(parser.parseRoughnessSubstrate()); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/DesignSourceWriter.h b/Intern/rayx-core/src/Rml/DesignSourceWriter.h index e192c63ba..0525de56d 100644 --- a/Intern/rayx-core/src/Rml/DesignSourceWriter.h +++ b/Intern/rayx-core/src/Rml/DesignSourceWriter.h @@ -9,7 +9,7 @@ #include "Core.h" #include "Element/Cutout.h" -namespace RAYX { +namespace rayx { void setAllMandatory(xml::Parser parser, DesignSource* ds) { ds->setName(parser.name()); @@ -125,4 +125,4 @@ void setSimpleUndulatorSource(xml::Parser parser, DesignSource* ds) { ds->setElectronSigmaYs(parser.parseElectronSigmaYs()); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/Importer.cpp b/Intern/rayx-core/src/Rml/Importer.cpp index c74bc6e57..c13005ad0 100644 --- a/Intern/rayx-core/src/Rml/Importer.cpp +++ b/Intern/rayx-core/src/Rml/Importer.cpp @@ -15,9 +15,9 @@ #include "Element/Element.h" #include "Rml/xml.h" -using RAYX::ElementType; +using rayx::ElementType; -void parseElement(RAYX::xml::Parser parser, RAYX::DesignElement* de) { +void parseElement(rayx::xml::Parser parser, rayx::DesignElement* de) { switch (parser.type()) { case ElementType::ImagePlane: getImageplane(parser, de); @@ -75,10 +75,10 @@ void parseElement(RAYX::xml::Parser parser, RAYX::DesignElement* de) { } } -namespace RAYX { +namespace rayx { void addBeamlineObjectFromXML(rapidxml::xml_node<>* node, Group& group, std::filesystem::path filepath) { - RAYX::xml::Parser parser(node, filepath); + rayx::xml::Parser parser(node, filepath); ElementType type = parser.type(); std::unique_ptr ds = std::make_unique(); @@ -178,4 +178,4 @@ Beamline importBeamline(const std::filesystem::path& filepath) { return root; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/Importer.h b/Intern/rayx-core/src/Rml/Importer.h index 066ac3498..8d6e691b9 100644 --- a/Intern/rayx-core/src/Rml/Importer.h +++ b/Intern/rayx-core/src/Rml/Importer.h @@ -5,10 +5,10 @@ #include "Beamline/Beamline.h" #include "Core.h" -namespace RAYX { +namespace rayx { // This is the central point where the beamline is loaded from an RML file. // Any future plans for other formats, will *not* use this Importer. It's intended for XML. RAYX_API Beamline importBeamline(const std::filesystem::path&); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/Locate.cpp b/Intern/rayx-core/src/Rml/Locate.cpp index 4f63bdced..0f3e834e0 100644 --- a/Intern/rayx-core/src/Rml/Locate.cpp +++ b/Intern/rayx-core/src/Rml/Locate.cpp @@ -16,7 +16,7 @@ #include -namespace RAYX { +namespace rayx { // Adds a new lookup path where the handler will search for resources void ResourceHandler::addLookUpPath(const std::filesystem::path& path) { @@ -119,4 +119,4 @@ std::filesystem::path ResourceHandler::getResourcePath(const std::filesystem::pa // Retrieve the full path of a font based on the platform std::filesystem::path ResourceHandler::getFontPath(const std::filesystem::path& relativePath) { return getFullPath(RAYX_FONTS_DIR, relativePath); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/Locate.h b/Intern/rayx-core/src/Rml/Locate.h index 81cc53f5e..6fde66e2c 100644 --- a/Intern/rayx-core/src/Rml/Locate.h +++ b/Intern/rayx-core/src/Rml/Locate.h @@ -6,7 +6,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { class RAYX_API ResourceHandler { public: @@ -36,4 +36,4 @@ class RAYX_API ResourceHandler { std::vector lookUpPaths; // Maintains insertion order }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Rml/xml.cpp b/Intern/rayx-core/src/Rml/xml.cpp index 5ba0c6aef..5a668b7de 100644 --- a/Intern/rayx-core/src/Rml/xml.cpp +++ b/Intern/rayx-core/src/Rml/xml.cpp @@ -13,7 +13,7 @@ #include "Element/Element.h" #include "Shader/Constants.h" -namespace RAYX::xml { +namespace rayx::xml { // general scope functions: @@ -542,4 +542,4 @@ double Parser::parseAdditionalOrder() const { return additionalZeroOrder; } -} // namespace RAYX::xml +} // namespace rayx::xml diff --git a/Intern/rayx-core/src/Rml/xml.h b/Intern/rayx-core/src/Rml/xml.h index 6c2be465e..34895f39a 100644 --- a/Intern/rayx-core/src/Rml/xml.h +++ b/Intern/rayx-core/src/Rml/xml.h @@ -18,7 +18,7 @@ #include "Shader/LightSources/LightSource.h" #include "Shader/SlopeError.h" -namespace RAYX { +namespace rayx { // forward declarations: class EnergyDistribution; @@ -232,4 +232,4 @@ struct RAYX_API Parser { /// This superclass DesignObject could mostly keep the API of the xml::Parser, to make the transition trivial. using DesignObject = xml::Parser; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/ApplySlopeError.cpp b/Intern/rayx-core/src/Shader/ApplySlopeError.cpp index 8e2bbf997..02099c0fb 100644 --- a/Intern/rayx-core/src/Shader/ApplySlopeError.cpp +++ b/Intern/rayx-core/src/Shader/ApplySlopeError.cpp @@ -3,7 +3,7 @@ #include "Constants.h" #include "Rand.h" -namespace RAYX { +namespace rayx { /** turn the normal vector through x_rad and z_rad @@ -92,4 +92,4 @@ glm::dvec3 applySlopeError(glm::dvec3 normal, SlopeError error, int O_type, Rand return normal; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/ApplySlopeError.h b/Intern/rayx-core/src/Shader/ApplySlopeError.h index c7bd195a1..a37bf88a3 100644 --- a/Intern/rayx-core/src/Shader/ApplySlopeError.h +++ b/Intern/rayx-core/src/Shader/ApplySlopeError.h @@ -3,7 +3,7 @@ #include "Core.h" #include "InvocationState.h" -namespace RAYX { +namespace rayx { struct Rand; @@ -36,4 +36,4 @@ slope error in either x or z direction or the unmodified normal otherwise. */ RAYX_FN_ACC glm::dvec3 applySlopeError(glm::dvec3 normal, SlopeError error, int O_type, Rand& __restrict rand); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Approx.cpp b/Intern/rayx-core/src/Shader/Approx.cpp index 16a33cc6e..12ca918d6 100644 --- a/Intern/rayx-core/src/Shader/Approx.cpp +++ b/Intern/rayx-core/src/Shader/Approx.cpp @@ -2,7 +2,7 @@ #include "Constants.h" -namespace RAYX { +namespace rayx { // double pow simple RAYX_FN_ACC @@ -12,4 +12,4 @@ double RAYX_API dpow(double a, int b) { return res; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Approx.h b/Intern/rayx-core/src/Shader/Approx.h index ccd2b00ca..1039e7004 100644 --- a/Intern/rayx-core/src/Shader/Approx.h +++ b/Intern/rayx-core/src/Shader/Approx.h @@ -2,8 +2,8 @@ #include "Core.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC double RAYX_API dpow(double a, int b); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Behave.cpp b/Intern/rayx-core/src/Shader/Behave.cpp index 00ace5b7f..4579cb91a 100644 --- a/Intern/rayx-core/src/Shader/Behave.cpp +++ b/Intern/rayx-core/src/Shader/Behave.cpp @@ -15,7 +15,7 @@ #include "Transmission.h" #include "Utils.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC void behaveCrystal(detail::Ray& __restrict ray, const Behaviour::Crystal& __restrict crystal, const CollisionPoint& __restrict col) { @@ -257,4 +257,4 @@ void behave(detail::Ray& __restrict ray, const CollisionPoint& __restrict col, c }); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Behave.h b/Intern/rayx-core/src/Shader/Behave.h index af23ae9ea..c7ebcdb56 100644 --- a/Intern/rayx-core/src/Shader/Behave.h +++ b/Intern/rayx-core/src/Shader/Behave.h @@ -5,7 +5,7 @@ #include "InvocationState.h" #include "Ray.h" -namespace RAYX { +namespace rayx { /// Each `behave*` function gets a `Ray ray` (in element-coords), the element itself, a randomness counter and the `Collision col`. /// `col.hitpoint` expresses where the given ray will hit the element (in element-coords). @@ -29,4 +29,4 @@ RAYX_FN_ACC void behaveImagePlane(detail::Ray& __restrict ray); RAYX_FN_ACC void behave(detail::Ray& __restrict ray, const CollisionPoint& __restrict col, const OpticalElement& __restrict element, const int* __restrict materialIndices, const double* __restrict materialTable); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Collision.cpp b/Intern/rayx-core/src/Shader/Collision.cpp index 21ccb5474..113172bb9 100644 --- a/Intern/rayx-core/src/Shader/Collision.cpp +++ b/Intern/rayx-core/src/Shader/Collision.cpp @@ -12,7 +12,7 @@ namespace { constexpr double COLLISION_EPSILON = 1e-6; } // unnamed namespace -namespace RAYX { +namespace rayx { /************************************************************** * Quadric collision @@ -546,4 +546,4 @@ OptCollisionWithElement findCollisionWithElements(glm::dvec3 rayPosition, glm::d return CollisionWithElement{.point = *best_col, .elementIndex = best_element}; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Collision.h b/Intern/rayx-core/src/Shader/Collision.h index 9626febd8..d3bfca693 100644 --- a/Intern/rayx-core/src/Shader/Collision.h +++ b/Intern/rayx-core/src/Shader/Collision.h @@ -8,7 +8,7 @@ #include "Rand.h" #include "Ray.h" -namespace RAYX { +namespace rayx { struct RAYX_API CollisionPoint { glm::dvec3 hitpoint; @@ -45,4 +45,4 @@ RAYX_FN_ACC OptCollisionWithElement findCollisionWithElements(glm::dvec3 rayPosi const OpticalElement* __restrict elements, const ObjectTransform* __restrict, const int numSources, const int numElements, Rand& __restrict rand); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Complex.h b/Intern/rayx-core/src/Shader/Complex.h index 3f13c70f9..a7065e5cb 100644 --- a/Intern/rayx-core/src/Shader/Complex.h +++ b/Intern/rayx-core/src/Shader/Complex.h @@ -11,7 +11,7 @@ #include #endif -namespace RAYX { +namespace rayx { namespace complex { template @@ -110,60 +110,60 @@ RAYX_FN_ACC inline cvec3 polar(glm::dvec3 mag, glm::dvec3 theta) { return cvec3(polar(mag.x, theta.x), polar(mag.y, theta.y), polar(mag.z, theta.z)); } } // namespace complex -} // namespace RAYX +} // namespace rayx namespace glm { template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(vec<3, RAYX::complex::tcomplex, Q> const& v, T scalar) { - return vec<3, RAYX::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(vec<3, rayx::complex::tcomplex, Q> const& v, T scalar) { + return vec<3, rayx::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(vec<3, T, Q> const& v, RAYX::complex::tcomplex scalar) { - return vec<3, RAYX::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(vec<3, T, Q> const& v, rayx::complex::tcomplex scalar) { + return vec<3, rayx::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(vec<3, RAYX::complex::tcomplex, Q> const& v, - RAYX::complex::tcomplex scalar) { - return vec<3, RAYX::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(vec<3, rayx::complex::tcomplex, Q> const& v, + rayx::complex::tcomplex scalar) { + return vec<3, rayx::complex::tcomplex, Q>(v.x * scalar, v.y * scalar, v.z * scalar); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(T scalar, vec<3, RAYX::complex::tcomplex, Q> const& v) { - return vec<3, RAYX::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(T scalar, vec<3, rayx::complex::tcomplex, Q> const& v) { + return vec<3, rayx::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(RAYX::complex::tcomplex scalar, vec<3, T, Q> const& v) { - return vec<3, RAYX::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(rayx::complex::tcomplex scalar, vec<3, T, Q> const& v) { + return vec<3, rayx::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, RAYX::complex::tcomplex, Q> operator*(RAYX::complex::tcomplex scalar, - vec<3, RAYX::complex::tcomplex, Q> const& v) { - return vec<3, RAYX::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); +GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, rayx::complex::tcomplex, Q> operator*(rayx::complex::tcomplex scalar, + vec<3, rayx::complex::tcomplex, Q> const& v) { + return vec<3, rayx::complex::tcomplex, Q>(scalar * v.x, scalar * v.y, scalar * v.z); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, RAYX::complex::tcomplex, Q>::col_type operator*( - mat<3, 3, T, Q> const& m, typename mat<3, 3, RAYX::complex::tcomplex, Q>::row_type const& v) { - return typename mat<3, 3, RAYX::complex::tcomplex, Q>::col_type( +GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, rayx::complex::tcomplex, Q>::col_type operator*( + mat<3, 3, T, Q> const& m, typename mat<3, 3, rayx::complex::tcomplex, Q>::row_type const& v) { + return typename mat<3, 3, rayx::complex::tcomplex, Q>::col_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z, m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, RAYX::complex::tcomplex, Q>::row_type operator*( - typename mat<3, 3, RAYX::complex::tcomplex, Q>::col_type const& v, mat<3, 3, T, Q> const& m) { - return typename mat<3, 3, RAYX::complex::tcomplex, Q>::row_type( +GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, rayx::complex::tcomplex, Q>::row_type operator*( + typename mat<3, 3, rayx::complex::tcomplex, Q>::col_type const& v, mat<3, 3, T, Q> const& m) { + return typename mat<3, 3, rayx::complex::tcomplex, Q>::row_type( m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z, m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z, m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z); } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, RAYX::complex::tcomplex, Q> operator*(mat<3, 3, T, Q> const& m1, - mat<3, 3, RAYX::complex::tcomplex, Q> const& m2) { - using namespace RAYX::complex; +GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, rayx::complex::tcomplex, Q> operator*(mat<3, 3, T, Q> const& m1, + mat<3, 3, rayx::complex::tcomplex, Q> const& m2) { + using namespace rayx::complex; T const SrcA00 = m1[0][0]; T const SrcA01 = m1[0][1]; @@ -195,9 +195,9 @@ GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, RAYX::complex::tcomplex, Q> operat } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, RAYX::complex::tcomplex, Q> operator*(mat<3, 3, RAYX::complex::tcomplex, Q> const& m1, +GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, rayx::complex::tcomplex, Q> operator*(mat<3, 3, rayx::complex::tcomplex, Q> const& m1, mat<3, 3, T, Q> const& m2) { - using namespace RAYX::complex; + using namespace rayx::complex; tcomplex const SrcA00 = m1[0][0]; tcomplex const SrcA01 = m1[0][1]; @@ -229,9 +229,9 @@ GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, RAYX::complex::tcomplex, Q> operat } template -GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, RAYX::complex::tcomplex, Q> operator*(mat<3, 3, RAYX::complex::tcomplex, Q> const& m1, - mat<3, 3, RAYX::complex::tcomplex, Q> const& m2) { - using namespace RAYX::complex; +GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, rayx::complex::tcomplex, Q> operator*(mat<3, 3, rayx::complex::tcomplex, Q> const& m1, + mat<3, 3, rayx::complex::tcomplex, Q> const& m2) { + using namespace rayx::complex; tcomplex const SrcA00 = m1[0][0]; tcomplex const SrcA01 = m1[0][1]; diff --git a/Intern/rayx-core/src/Shader/Constants.h b/Intern/rayx-core/src/Shader/Constants.h index 3e176f936..99614fe8c 100644 --- a/Intern/rayx-core/src/Shader/Constants.h +++ b/Intern/rayx-core/src/Shader/Constants.h @@ -6,7 +6,7 @@ #include "EventType.h" #include "ImageType.h" -namespace RAYX { +namespace rayx { /// inverse nanometer-electron volt relationship / reziprocal factor constexpr double INV_NM_TO_EVOLT = 1239.841984332002622; @@ -51,4 +51,4 @@ constexpr double ELECTRIC_PERMITIVITY_MULTIPLIES_SPEED_OF_LIGHT = 2.654418727992 constexpr double ELECTRON_RADIUS = 2.8179403205e-6; // Classical electron radius (nm) // constexpr double ELECTRON_RADIUS = (ELEMENTARY_CHARGE / (SPEED_OF_LIGHT * SPEED_OF_LIGHT)) * 1.e9; // Classical electron radius in nm -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Crystal.h b/Intern/rayx-core/src/Shader/Crystal.h index 941b34a10..8aa9343e0 100644 --- a/Intern/rayx-core/src/Shader/Crystal.h +++ b/Intern/rayx-core/src/Shader/Crystal.h @@ -7,7 +7,7 @@ #include "Core.h" #include "Utils.h" -namespace RAYX { +namespace rayx { // ********************************************************** // Function to calculate the local normal incidence angle theta @@ -162,4 +162,4 @@ inline complex::Complex computeR(complex::Complex eta, double structureFactorReF } } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Cubic.cpp b/Intern/rayx-core/src/Shader/Cubic.cpp index 513fd5176..611b8d389 100644 --- a/Intern/rayx-core/src/Shader/Cubic.cpp +++ b/Intern/rayx-core/src/Shader/Cubic.cpp @@ -1,6 +1,6 @@ #include "Cubic.h" -namespace RAYX { +namespace rayx { // rotates for the cubic collision by angle alpha (taken from RAY-UI) RAYX_FN_ACC @@ -22,4 +22,4 @@ glm::dvec3 RAYX_API cubicDirection(const glm::dvec3& __restrict rayDirection, do return glm::dvec3(0, dy, dz); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Cubic.h b/Intern/rayx-core/src/Shader/Cubic.h index c9e3f8ab3..c01ea5349 100644 --- a/Intern/rayx-core/src/Shader/Cubic.h +++ b/Intern/rayx-core/src/Shader/Cubic.h @@ -3,11 +3,11 @@ #include "Core.h" #include "Ray.h" -namespace RAYX { +namespace rayx { // TODO: doku RAYX_FN_ACC glm::dvec3 RAYX_API cubicPosition(const glm::dvec3& __restrict rayPosition, const double alpha); RAYX_FN_ACC glm::dvec3 RAYX_API cubicDirection(const glm::dvec3& __restrict rayDirection, double alph); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/CutoutFns.cpp b/Intern/rayx-core/src/Shader/CutoutFns.cpp index d80e64725..7d99d249a 100644 --- a/Intern/rayx-core/src/Shader/CutoutFns.cpp +++ b/Intern/rayx-core/src/Shader/CutoutFns.cpp @@ -3,7 +3,7 @@ #include "Throw.h" #include "Variant.h" -namespace RAYX { +namespace rayx { // checks whether the point (x, z) is within the cutout. RAYX_FN_ACC @@ -130,4 +130,4 @@ void RAYX_API assertCutoutSubset(Cutout c1, Cutout c2) { } } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/CutoutFns.h b/Intern/rayx-core/src/Shader/CutoutFns.h index db6f270d9..3207de0dd 100644 --- a/Intern/rayx-core/src/Shader/CutoutFns.h +++ b/Intern/rayx-core/src/Shader/CutoutFns.h @@ -4,7 +4,7 @@ #include "Element/Cutout.h" -namespace RAYX { +namespace rayx { // checks whether the point (x, z) is within the cutout. RAYX_FN_ACC bool RAYX_API inCutout(Cutout cutout, double x, double z); @@ -21,4 +21,4 @@ RAYX_FN_ACC glm::dvec2 RAYX_API cutoutBoundingBox(Cutout cutout); // (might not find all Ellipsoid vs Trapezoid violations) RAYX_FN_ACC void RAYX_API assertCutoutSubset(Cutout c1, Cutout c2); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Diffraction.cpp b/Intern/rayx-core/src/Shader/Diffraction.cpp index b3309ec98..0b0acca13 100644 --- a/Intern/rayx-core/src/Shader/Diffraction.cpp +++ b/Intern/rayx-core/src/Shader/Diffraction.cpp @@ -4,7 +4,7 @@ #include "Constants.h" #include "Rand.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC double RAYX_API fact(int a) { @@ -98,4 +98,4 @@ void fraun_diff(double dim, double wl, double& __restrict dAngle, Rand& __restri } } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Diffraction.h b/Intern/rayx-core/src/Shader/Diffraction.h index 261621eea..588c049d5 100644 --- a/Intern/rayx-core/src/Shader/Diffraction.h +++ b/Intern/rayx-core/src/Shader/Diffraction.h @@ -3,7 +3,7 @@ #include "Core.h" #include "InvocationState.h" -namespace RAYX { +namespace rayx { struct Rand; @@ -33,4 +33,4 @@ RAYX_FN_ACC void bessel_diff(double radius, double wl, double& dphi, double& dps */ RAYX_FN_ACC void fraun_diff(double dim, double wl, double& dAngle, Rand& rand); -} // namespace RAYX \ No newline at end of file +} // namespace rayx \ No newline at end of file diff --git a/Intern/rayx-core/src/Shader/Efficiency.h b/Intern/rayx-core/src/Shader/Efficiency.h index 50af580fb..290462b83 100644 --- a/Intern/rayx-core/src/Shader/Efficiency.h +++ b/Intern/rayx-core/src/Shader/Efficiency.h @@ -4,7 +4,7 @@ #include "ElectricField.h" #include "Rand.h" -namespace RAYX { +namespace rayx { struct FresnelCoeffs { double s; @@ -245,4 +245,4 @@ inline ElectricField interceptFoil(const ElectricField incidentElectricField, co return transmittElectricField; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/ElectricField.h b/Intern/rayx-core/src/Shader/ElectricField.h index 05df65e50..29f64bbd1 100644 --- a/Intern/rayx-core/src/Shader/ElectricField.h +++ b/Intern/rayx-core/src/Shader/ElectricField.h @@ -3,7 +3,7 @@ #include "Complex.h" #include "Constants.h" -namespace RAYX { +namespace rayx { using Stokes = glm::dvec4; using ElectricField = cvec3; @@ -199,4 +199,4 @@ inline ElectricField electricFieldToStokes(const ElectricField field, const glm: return localElectricFieldToStokes(globalToLocalElectricField(field, rotation)); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/EventType.h b/Intern/rayx-core/src/Shader/EventType.h index aceb67630..974d9ff78 100644 --- a/Intern/rayx-core/src/Shader/EventType.h +++ b/Intern/rayx-core/src/Shader/EventType.h @@ -4,7 +4,7 @@ #include "Throw.h" -namespace RAYX { +namespace rayx { // TODO: doc this enum and all its members enum class EventType : uint32_t { @@ -64,4 +64,4 @@ RAYX_FN_ACC constexpr inline EventTypeMask eventTypeToMask(const EventType event return static_cast(std::underlying_type_t(1) << static_cast>(eventType)); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/ImageType.h b/Intern/rayx-core/src/Shader/ImageType.h index 7663fec66..3bd946f33 100644 --- a/Intern/rayx-core/src/Shader/ImageType.h +++ b/Intern/rayx-core/src/Shader/ImageType.h @@ -2,7 +2,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { // The ImageType is a parameter within the RZP. // It's different possible values are listed below. @@ -12,4 +12,4 @@ constexpr int IT_POINT2HORIZONTAL_LINE = 4; constexpr int IT_POINT2HORIZONTAL_DIVERGENT_LINE = 5; constexpr int IT_ASTIGMATIC2ASTIGMATIC = 12; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/InvocationState.h b/Intern/rayx-core/src/Shader/InvocationState.h index 94c305da9..5f99e13cc 100644 --- a/Intern/rayx-core/src/Shader/InvocationState.h +++ b/Intern/rayx-core/src/Shader/InvocationState.h @@ -3,7 +3,7 @@ #include "Element/Element.h" #include "RaysPtr.h" -namespace RAYX { +namespace rayx { /// Expresses whether we force sequential tracing, or we use dynamic tracing. /// We prefer this over a boolean, as calling eg. the trace function with an argument of `true` has no obvious meaning. @@ -33,4 +33,4 @@ struct RAYX_API MutableState { bool* __restrict storedFlags; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/CircleSource.cpp b/Intern/rayx-core/src/Shader/LightSources/CircleSource.cpp index 4faf3b827..6974b21c4 100644 --- a/Intern/rayx-core/src/Shader/LightSources/CircleSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/CircleSource.cpp @@ -4,7 +4,7 @@ #include "Design/DesignSource.h" #include "Shader/Constants.h" -namespace RAYX { +namespace rayx { CircleSource::CircleSource(const DesignSource& dSource) : LightSourceBase(dSource) { m_pol = dSource.getStokes(); @@ -90,4 +90,4 @@ glm::dvec3 CircleSource::getDirection(Rand& __restrict rand) const { return glm::dvec3(al, am, an); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/CircleSource.h b/Intern/rayx-core/src/Shader/LightSources/CircleSource.h index 6d49a75ec..1a2e0aeec 100644 --- a/Intern/rayx-core/src/Shader/LightSources/CircleSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/CircleSource.h @@ -3,7 +3,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { class RAYX_API CircleSource : public LightSourceBase { public: @@ -31,4 +31,4 @@ class RAYX_API CircleSource : public LightSourceBase { // std::vector m_source_lengths; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/DipoleSource.cpp b/Intern/rayx-core/src/Shader/LightSources/DipoleSource.cpp index a622d87a2..8f6ea7cc8 100644 --- a/Intern/rayx-core/src/Shader/LightSources/DipoleSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/DipoleSource.cpp @@ -11,7 +11,7 @@ #include "Shader/EventType.h" #include "Shader/Utils.h" -namespace RAYX { +namespace rayx { // TODO: why does this source get seeded with randomDouble in the constructor? // TODO: do we only use schwinger log? @@ -499,4 +499,4 @@ PsiAndStokes DipoleSource::getPsiandStokes(double en, Rand& __restrict rand) con return psiandstokes; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/DipoleSource.h b/Intern/rayx-core/src/Shader/LightSources/DipoleSource.h index 780105461..ad882a69c 100644 --- a/Intern/rayx-core/src/Shader/LightSources/DipoleSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/DipoleSource.h @@ -5,7 +5,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { struct PsiAndStokes { glm::dvec4 stokes; @@ -81,4 +81,4 @@ class RAYX_API DipoleSource : public LightSourceBase { double m_verDivergence; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.cpp b/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.cpp index f9455ce40..beaffd9ee 100644 --- a/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.cpp @@ -21,7 +21,7 @@ int binarySearchPrefix(const double* __restrict prefixWeights, int size, double } // unnamed namespace -namespace RAYX { +namespace rayx { RAYX_FN_ACC double selectEnergy(const HardEdge& __restrict hardEdge, Rand& __restrict rand) { const auto a = hardEdge.m_centerEnergy - hardEdge.m_energySpread / 2.0; @@ -61,4 +61,4 @@ RAYX_FN_ACC double selectEnergy(const EnergyDistributionDataVariant& __restrict return std::visit([&](const T& __restrict value) { return selectEnergy(value, rand); }, energyDistribution); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.h b/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.h index 8132e007b..0212d8c13 100644 --- a/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.h +++ b/Intern/rayx-core/src/Shader/LightSources/EnergyDistributions/EnergyDistribution.h @@ -4,7 +4,7 @@ #include "Core.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { struct EnergyDistributionList { double* __restrict prefixWeights; @@ -23,4 +23,4 @@ RAYX_FN_ACC double selectEnergy(const SeparateEnergies& __restrict separateEnerg RAYX_FN_ACC double selectEnergy(const EnergyDistributionList& __restrict energyDistributionList, Rand& __restrict rand); RAYX_FN_ACC double selectEnergy(const EnergyDistributionDataVariant& __restrict energyDistribution, Rand& __restrict rand); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/LightSource.cpp b/Intern/rayx-core/src/Shader/LightSources/LightSource.cpp index 884d0c365..b703a7459 100644 --- a/Intern/rayx-core/src/Shader/LightSources/LightSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/LightSource.cpp @@ -5,7 +5,7 @@ #include "Beamline/EnergyDistribution.h" #include "Design/DesignSource.h" -namespace RAYX { +namespace rayx { LightSourceBase::LightSourceBase(const DesignSource& dSource) : m_numberOfRays(static_cast(dSource.getNumberOfRays())) {} // needed for many of the light sources, from two angles to one direction vector @@ -17,4 +17,4 @@ glm::dvec3 LightSourceBase::getDirectionFromAngles(const double phi, const doubl return {al, am, an}; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/LightSource.h b/Intern/rayx-core/src/Shader/LightSources/LightSource.h index 8361b3147..aa7ceef94 100644 --- a/Intern/rayx-core/src/Shader/LightSources/LightSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/LightSource.h @@ -11,7 +11,7 @@ #include "Rml/xml.h" #include "Shader/Ray.h" -namespace RAYX { +namespace rayx { enum class SourceDist { Uniform, Gaussian, Thirds, Circle }; // SourceDist::Thirds represents PixelSource Footprint enum class ElectronEnergyOrientation { Clockwise, Counterclockwise }; @@ -32,4 +32,4 @@ class RAYX_API LightSourceBase { int32_t m_numberOfRays; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/MatrixSource.cpp b/Intern/rayx-core/src/Shader/LightSources/MatrixSource.cpp index 44f19fb52..9f92f411a 100644 --- a/Intern/rayx-core/src/Shader/LightSources/MatrixSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/MatrixSource.cpp @@ -7,7 +7,7 @@ #include "Rml/xml.h" #include "Shader/Constants.h" -namespace RAYX { +namespace rayx { MatrixSource::MatrixSource(const DesignSource& dSource) : LightSourceBase(dSource), @@ -72,4 +72,4 @@ detail::Ray MatrixSource::genRay(const int rayPathIndex, const int sourceId, con }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/MatrixSource.h b/Intern/rayx-core/src/Shader/LightSources/MatrixSource.h index 364368f25..fee971e0f 100644 --- a/Intern/rayx-core/src/Shader/LightSources/MatrixSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/MatrixSource.h @@ -3,7 +3,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { class DesignSource; @@ -24,4 +24,4 @@ class RAYX_API MatrixSource : public LightSourceBase { double m_sourceWidth; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/PixelSource.cpp b/Intern/rayx-core/src/Shader/LightSources/PixelSource.cpp index 98dffda88..01dd79ae6 100644 --- a/Intern/rayx-core/src/Shader/LightSources/PixelSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/PixelSource.cpp @@ -4,7 +4,7 @@ #include "Design/DesignSource.h" #include "Shader/Constants.h" -namespace RAYX { +namespace rayx { PixelSource::PixelSource(const DesignSource& deso) : LightSourceBase(deso), @@ -76,4 +76,4 @@ detail::Ray PixelSource::genRay(const int rayPathIndex, const int sourceId, cons }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/PixelSource.h b/Intern/rayx-core/src/Shader/LightSources/PixelSource.h index 5237261d6..84bbc65f8 100644 --- a/Intern/rayx-core/src/Shader/LightSources/PixelSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/PixelSource.h @@ -3,7 +3,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { class RAYX_API PixelSource : public LightSourceBase { public: @@ -26,4 +26,4 @@ class RAYX_API PixelSource : public LightSourceBase { // std::vector m_source_lengths; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/PointSource.cpp b/Intern/rayx-core/src/Shader/LightSources/PointSource.cpp index 2de6e37be..42ea30090 100644 --- a/Intern/rayx-core/src/Shader/LightSources/PointSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/PointSource.cpp @@ -7,7 +7,7 @@ #include "Random.h" #include "Shader/Constants.h" -namespace RAYX { +namespace rayx { namespace { /** @@ -84,4 +84,4 @@ RAYX_FN_ACC detail::Ray PointSource::genRay(const int rayPathIndex, const int so }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/PointSource.h b/Intern/rayx-core/src/Shader/LightSources/PointSource.h index 3088ec266..535fce514 100644 --- a/Intern/rayx-core/src/Shader/LightSources/PointSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/PointSource.h @@ -3,7 +3,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { class RAYX_API PointSource : public LightSourceBase { public: @@ -30,4 +30,4 @@ class RAYX_API PointSource : public LightSourceBase { // std::vector m_source_lengths; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/RayListSource.h b/Intern/rayx-core/src/Shader/LightSources/RayListSource.h index 48a0a4dc7..f0a9fdeaf 100644 --- a/Intern/rayx-core/src/Shader/LightSources/RayListSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/RayListSource.h @@ -3,10 +3,10 @@ #include "LightSource.h" #include "Rays.h" -namespace RAYX { +namespace rayx { struct RAYX_API RayListSource { RaysPtr rays; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.cpp b/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.cpp index 259efde25..46200d86a 100644 --- a/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.cpp +++ b/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.cpp @@ -3,7 +3,7 @@ #include "Design/DesignSource.h" #include "Shader/Utils.h" -namespace RAYX { +namespace rayx { namespace { double calcUndulatorSigma(const SigmaType sigmaType, const double photonWaveLength, const double undulatorLength) { @@ -120,4 +120,4 @@ detail::Ray SimpleUndulatorSource::genRay(const int rayPathIndex, const int sour }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.h b/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.h index fbba7043c..06b3faa78 100644 --- a/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.h +++ b/Intern/rayx-core/src/Shader/LightSources/SimpleUndulatorSource.h @@ -3,7 +3,7 @@ #include "LightSource.h" #include "Shader/Rand.h" -namespace RAYX { +namespace rayx { class RAYX_API SimpleUndulatorSource : public LightSourceBase { public: @@ -34,4 +34,4 @@ class RAYX_API SimpleUndulatorSource : public LightSourceBase { // std::vector m_source_lengths; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LineDensity.cpp b/Intern/rayx-core/src/Shader/LineDensity.cpp index d2ca1f226..a04bc8768 100644 --- a/Intern/rayx-core/src/Shader/LineDensity.cpp +++ b/Intern/rayx-core/src/Shader/LineDensity.cpp @@ -4,7 +4,7 @@ #include "ImageType.h" #include "Throw.h" -namespace RAYX { +namespace rayx { /** Computes the adjusted line density at a specific z-coordinate for variable line spacing (VLS) gratings, * considering both the surface orientation and polynomial VLS parameters. @@ -198,4 +198,4 @@ void RAYX_API RZPLineDensity(const glm::dvec3& __restrict position, const glm::d DZ = (-bi - bm) / (WL * Ord); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/LineDensity.h b/Intern/rayx-core/src/Shader/LineDensity.h index 9203ce6fb..62c425f77 100644 --- a/Intern/rayx-core/src/Shader/LineDensity.h +++ b/Intern/rayx-core/src/Shader/LineDensity.h @@ -4,7 +4,7 @@ #include "Element/Behaviour.h" #include "Ray.h" -namespace RAYX { +namespace rayx { /** variable line spacing for gratings @params @@ -24,4 +24,4 @@ given direction on the grating RAYX_FN_ACC void RAYX_API RZPLineDensity(const glm::dvec3& __restrict position, const glm::dvec3& __restrict normal, const Behaviour::RZP& __restrict b, double& __restrict DX, double& __restrict DZ); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Rand.cpp b/Intern/rayx-core/src/Shader/Rand.cpp index 1d7cee928..83428995e 100644 --- a/Intern/rayx-core/src/Shader/Rand.cpp +++ b/Intern/rayx-core/src/Shader/Rand.cpp @@ -4,7 +4,7 @@ #include "Constants.h" -namespace RAYX { +namespace rayx { constexpr RandCounter RNG_KEY = (RandCounter(0xc8e4fd15) << 32) | RandCounter(0x4ce32f6d); @@ -53,4 +53,4 @@ double RAYX_API squaresNormalRNG(RandCounter& ctr, double mu, double sigma) { return Z; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Rand.h b/Intern/rayx-core/src/Shader/Rand.h index 8f04f7097..a5fa18481 100644 --- a/Intern/rayx-core/src/Shader/Rand.h +++ b/Intern/rayx-core/src/Shader/Rand.h @@ -4,7 +4,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { /// Internal type for the random counter-based RNG using RandCounter = uint64_t; @@ -74,4 +74,4 @@ struct Rand { RandCounter counter; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Ray.h b/Intern/rayx-core/src/Shader/Ray.h index 5c3248c9a..e2fa17a9e 100644 --- a/Intern/rayx-core/src/Shader/Ray.h +++ b/Intern/rayx-core/src/Shader/Ray.h @@ -7,7 +7,7 @@ #include "EventType.h" #include "Rand.h" -namespace RAYX::detail { +namespace rayx::detail { // this struct is for the usage inside a kernel // it is padded for optimal memory access on the CPU @@ -35,4 +35,4 @@ struct Ray { // make sure Ray is not copy constructable/assignable to protect it from costly copies static_assert(!std::is_copy_constructible_v && !std::is_copy_assignable_v); -} // namespace RAYX::detail +} // namespace rayx::detail diff --git a/Intern/rayx-core/src/Shader/RaysPtr.h b/Intern/rayx-core/src/Shader/RaysPtr.h index 7e4c0e5a2..af6f360ab 100644 --- a/Intern/rayx-core/src/Shader/RaysPtr.h +++ b/Intern/rayx-core/src/Shader/RaysPtr.h @@ -2,7 +2,7 @@ #include "Rays.h" -namespace RAYX { +namespace rayx { // this struct is analog to struct Rays. It contains pointers to the attribute arrays struct RaysPtr { @@ -35,4 +35,4 @@ struct RaysPtr { } }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/RecordEvent.h b/Intern/rayx-core/src/Shader/RecordEvent.h index 5ff43f2ae..25efefd8b 100644 --- a/Intern/rayx-core/src/Shader/RecordEvent.h +++ b/Intern/rayx-core/src/Shader/RecordEvent.h @@ -3,7 +3,7 @@ #include "Ray.h" #include "RaysPtr.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC inline int getRecordIndex(const int gid, const int numRecorded, const int gridStride) { return gid + numRecorded * gridStride; } @@ -81,4 +81,4 @@ inline bool storeRay(const int i, bool* __restrict storedFlags, RaysPtr& __restr return true; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Refrac.cpp b/Intern/rayx-core/src/Shader/Refrac.cpp index 51cbe098d..92453eeed 100644 --- a/Intern/rayx-core/src/Shader/Refrac.cpp +++ b/Intern/rayx-core/src/Shader/Refrac.cpp @@ -2,7 +2,7 @@ #include "Ray.h" -namespace RAYX { +namespace rayx { /** calculates refracted ray @@ -59,4 +59,4 @@ glm::dvec3 refract_dvec3(glm::dvec3 I, glm::dvec3 N, double eta) { return eta * I + (eta * cosi - sqrt(cost2)) * N; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Refrac.h b/Intern/rayx-core/src/Shader/Refrac.h index 7c138c832..3b7c887b4 100644 --- a/Intern/rayx-core/src/Shader/Refrac.h +++ b/Intern/rayx-core/src/Shader/Refrac.h @@ -6,7 +6,7 @@ #include "Ray.h" #include "Utils.h" -namespace RAYX { +namespace rayx { /** calculates refracted ray @@ -27,4 +27,4 @@ RAYX_FN_ACC void refrac2D(detail::Ray& __restrict ray, glm::dvec3 normal, double */ RAYX_FN_ACC glm::dvec3 refract_dvec3(glm::dvec3 I, glm::dvec3 N, double eta); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/RefractiveIndex.cpp b/Intern/rayx-core/src/Shader/RefractiveIndex.cpp index ee5f83e5b..ab2d37e7b 100644 --- a/Intern/rayx-core/src/Shader/RefractiveIndex.cpp +++ b/Intern/rayx-core/src/Shader/RefractiveIndex.cpp @@ -2,7 +2,7 @@ #include "Throw.h" -namespace RAYX { +namespace rayx { // The materialTable table consists of all the entries from the Palik & Nff tables for all materials that were loaded into the shader. // Thus, when you want to get some concrete palik entry for a particular element, you need the materialIndices table to "know where to look" in @@ -163,4 +163,4 @@ glm::dvec2 RAYX_API getAtomicMassAndRho(int material) { return glm::dvec2(0.0, 0.0); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/RefractiveIndex.h b/Intern/rayx-core/src/Shader/RefractiveIndex.h index 53a2aaa88..94d204dac 100644 --- a/Intern/rayx-core/src/Shader/RefractiveIndex.h +++ b/Intern/rayx-core/src/Shader/RefractiveIndex.h @@ -3,7 +3,7 @@ #include "Complex.h" #include "InvocationState.h" -namespace RAYX { +namespace rayx { /// Both of these structs are used to effectively calculate the Refractive Index of some material when hit by a photon with a particular m_energy. /// The PalikEntry represents the the complex-valued refractive index directly as n + ik. @@ -39,4 +39,4 @@ RAYX_FN_ACC complex::Complex RAYX_API getRefractiveIndex(double energy, int mate // returns dvec2(atomic mass, density) extracted from materials.xmacro RAYX_FN_ACC glm::dvec2 RAYX_API getAtomicMassAndRho(int material); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/SlopeError.h b/Intern/rayx-core/src/Shader/SlopeError.h index 3f965c772..d5bf435a1 100644 --- a/Intern/rayx-core/src/Shader/SlopeError.h +++ b/Intern/rayx-core/src/Shader/SlopeError.h @@ -1,6 +1,6 @@ #pragma once -namespace RAYX { +namespace rayx { /** * @brief Structure to represent slope error parameters. @@ -15,4 +15,4 @@ struct SlopeError { double m_cylindricalBowingRadius; ///< Radius of cylindrical bowing (unused). }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/SphericalCoords.cpp b/Intern/rayx-core/src/Shader/SphericalCoords.cpp index f5063a123..58878612c 100644 --- a/Intern/rayx-core/src/Shader/SphericalCoords.cpp +++ b/Intern/rayx-core/src/Shader/SphericalCoords.cpp @@ -1,6 +1,6 @@ #include "SphericalCoords.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC void RAYX_API sphericalCoordsToDirection(double phi, double psi, glm::dvec3& out_direction) { @@ -18,4 +18,4 @@ void RAYX_API directionToSphericalCoords(glm::dvec3 direction, double& out_phi, out_phi = glm::atan(direction.x, direction.y); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/SphericalCoords.h b/Intern/rayx-core/src/Shader/SphericalCoords.h index ade7077b4..ada453547 100644 --- a/Intern/rayx-core/src/Shader/SphericalCoords.h +++ b/Intern/rayx-core/src/Shader/SphericalCoords.h @@ -4,7 +4,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { // Consider this https://en.wikipedia.org/wiki/Spherical_coordinate_system. // But we fix the radius r = 1, as we only care to express direction, not distance. @@ -15,4 +15,4 @@ namespace RAYX { RAYX_FN_ACC void RAYX_API sphericalCoordsToDirection(double phi, double psi, glm::dvec3& out_direction); RAYX_FN_ACC void RAYX_API directionToSphericalCoords(glm::dvec3 direction, double& out_phi, double& out_psi); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Trace.cpp b/Intern/rayx-core/src/Shader/Trace.cpp index 1a6b0ac2a..a84727df7 100644 --- a/Intern/rayx-core/src/Shader/Trace.cpp +++ b/Intern/rayx-core/src/Shader/Trace.cpp @@ -5,7 +5,7 @@ #include "RecordEvent.h" #include "Utils.h" -namespace RAYX { +namespace rayx { #define assertObjectIdInBounds(object_id, numObjects) \ _debug_assert(0 <= object_id && object_id < numObjects, "error: ray object id '%d' is out of bounds [0, %d)", object_id, numObjects); @@ -109,4 +109,4 @@ void traceNonSequential(const int gid, const ConstState& __restrict constState, } } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Trace.h b/Intern/rayx-core/src/Shader/Trace.h index cbec77881..8af4179b6 100644 --- a/Intern/rayx-core/src/Shader/Trace.h +++ b/Intern/rayx-core/src/Shader/Trace.h @@ -3,9 +3,9 @@ #include "Core.h" #include "InvocationState.h" -namespace RAYX { +namespace rayx { RAYX_FN_ACC void traceSequential(const int gid, const ConstState& __restrict constState, MutableState& __restrict mutableState); RAYX_FN_ACC void traceNonSequential(const int gid, const ConstState& __restrict constState, MutableState& __restrict mutableState); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Shader/Transmission.h b/Intern/rayx-core/src/Shader/Transmission.h index 0107b635b..dc31620c1 100644 --- a/Intern/rayx-core/src/Shader/Transmission.h +++ b/Intern/rayx-core/src/Shader/Transmission.h @@ -2,7 +2,7 @@ #include "Efficiency.h" #include "Utils.h" -namespace RAYX { +namespace rayx { /** * @brief Calculates the transmission through a single thin film layer using Fresnel equations. @@ -70,4 +70,4 @@ inline ComplexFresnelCoeffs computeTransmittance(double wavelength, complex::Com return {.s = ts_total, .p = tp_total}; } -} // namespace RAYX \ No newline at end of file +} // namespace rayx \ No newline at end of file diff --git a/Intern/rayx-core/src/Shader/Utils.h b/Intern/rayx-core/src/Shader/Utils.h index 6012403af..62931f2e4 100644 --- a/Intern/rayx-core/src/Shader/Utils.h +++ b/Intern/rayx-core/src/Shader/Utils.h @@ -3,7 +3,7 @@ #include "Ray.h" #include "Throw.h" -namespace RAYX { +namespace rayx { /** * converts energy (eV) to wavelength (nm) @@ -33,4 +33,4 @@ inline void RAYX_API rayMatrixMult(const glm::dmat4& __restrict m, glm::dvec3& _ rayElectricField = glm::dmat3(m) * rayElectricField; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/Accelerator.h b/Intern/rayx-core/src/Tracer/Accelerator.h index 83a952cf4..6580f3936 100644 --- a/Intern/rayx-core/src/Tracer/Accelerator.h +++ b/Intern/rayx-core/src/Tracer/Accelerator.h @@ -4,7 +4,7 @@ #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { template constexpr inline auto getBlockSize() { @@ -49,4 +49,4 @@ inline auto getWorkDivForAcc(alpaka::Idx numElements) { }; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/DeviceConfig.cpp b/Intern/rayx-core/src/Tracer/DeviceConfig.cpp index cc336d3bf..fc561c04c 100644 --- a/Intern/rayx-core/src/Tracer/DeviceConfig.cpp +++ b/Intern/rayx-core/src/Tracer/DeviceConfig.cpp @@ -10,8 +10,8 @@ namespace { -using DeviceType = RAYX::DeviceConfig::DeviceType; -using Device = RAYX::DeviceConfig::Device; +using DeviceType = rayx::DeviceConfig::DeviceType; +using Device = rayx::DeviceConfig::Device; using Index = Device::Index; using Score = Device::Score; @@ -119,7 +119,7 @@ std::string deviceTypeToString(DeviceType deviceType) { } // unnamed namespace -namespace RAYX { +namespace rayx { DeviceConfig::DeviceConfig(DeviceType fetchedDeviceType) : devices(getAvailableDevices(fetchedDeviceType)), m_fetchedDeviceType(fetchedDeviceType) {} @@ -192,4 +192,4 @@ DeviceConfig& DeviceConfig::enableBestDevice(DeviceType deviceType) { return *this; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/DeviceConfig.h b/Intern/rayx-core/src/Tracer/DeviceConfig.h index 048ebdb74..319b14309 100644 --- a/Intern/rayx-core/src/Tracer/DeviceConfig.h +++ b/Intern/rayx-core/src/Tracer/DeviceConfig.h @@ -5,7 +5,7 @@ #include "Core.h" -namespace RAYX { +namespace rayx { struct RAYX_API DeviceConfig { enum RAYX_API DeviceType { @@ -52,4 +52,4 @@ struct RAYX_API DeviceConfig { DeviceType m_fetchedDeviceType; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/DeviceTracer.h b/Intern/rayx-core/src/Tracer/DeviceTracer.h index 7da1b9722..ce0cbb24e 100644 --- a/Intern/rayx-core/src/Tracer/DeviceTracer.h +++ b/Intern/rayx-core/src/Tracer/DeviceTracer.h @@ -8,7 +8,7 @@ #include "Rays.h" #include "Shader/InvocationState.h" -namespace RAYX { +namespace rayx { /** * @brief DeviceTracer is an interface to a tracer implementation @@ -22,4 +22,4 @@ class RAYX_API DeviceTracer { const int maxEvents, const int maxBatchSize) = 0; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/GenRays.h b/Intern/rayx-core/src/Tracer/GenRays.h index 0fdafc582..a91390ba7 100644 --- a/Intern/rayx-core/src/Tracer/GenRays.h +++ b/Intern/rayx-core/src/Tracer/GenRays.h @@ -19,7 +19,7 @@ #include "Shader/RecordEvent.h" #include "Util.h" -namespace RAYX { +namespace rayx { namespace { struct GenRaysKernel { @@ -312,4 +312,4 @@ struct GenRays { double m_seed; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/MegaKernelTracer.h b/Intern/rayx-core/src/Tracer/MegaKernelTracer.h index 57679dd4f..91ad92316 100644 --- a/Intern/rayx-core/src/Tracer/MegaKernelTracer.h +++ b/Intern/rayx-core/src/Tracer/MegaKernelTracer.h @@ -12,7 +12,7 @@ #include "Shader/Trace.h" #include "Util.h" -namespace RAYX { +namespace rayx { namespace { constexpr int WARP_SIZE = 32; @@ -376,4 +376,4 @@ class MegaKernelTracer : public DeviceTracer { } }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/Tracer.cpp b/Intern/rayx-core/src/Tracer/Tracer.cpp index c5bf27ae4..8f90d2df5 100644 --- a/Intern/rayx-core/src/Tracer/Tracer.cpp +++ b/Intern/rayx-core/src/Tracer/Tracer.cpp @@ -6,21 +6,21 @@ namespace { -using DeviceType = RAYX::DeviceConfig::DeviceType; -using DeviceIndex = RAYX::DeviceConfig::Device::Index; +using DeviceType = rayx::DeviceConfig::DeviceType; +using DeviceIndex = rayx::DeviceConfig::Device::Index; -inline std::shared_ptr createDeviceTracer(DeviceType deviceType, DeviceIndex deviceIndex) { +inline std::shared_ptr createDeviceTracer(DeviceType deviceType, DeviceIndex deviceIndex) { switch (deviceType) { case DeviceType::GpuCuda: #if defined(RAYX_CUDA_ENABLED) - return std::make_shared>(deviceIndex); + return std::make_shared>(deviceIndex); #else RAYX_EXIT << "Failed to create Tracer with Cuda device. Cuda was disabled during build."; return nullptr; #endif case DeviceType::GpuHip: #if defined(RAYX_HIP_ENABLED) - eturn std::make_shared>(deviceIndex); + eturn std::make_shared>(deviceIndex); #else RAYX_EXIT << "Failed to create Tracer with Hip device. Hip was disabled during build."; return nullptr; @@ -32,15 +32,15 @@ inline std::shared_ptr createDeviceTracer(DeviceType deviceT RAYX_WARN << "warning: rayx-core was compiled without OpenMP. The CPU tracer will run in a single thread."; using TagCpu = alpaka::TagCpuSerial; #endif - return std::make_shared>(deviceIndex); + return std::make_shared>(deviceIndex); } } -int defaultNonSequentialMaxEvents(const int numObjects) { return RAYX::defaultMaxEvents(numObjects); } +int defaultNonSequentialMaxEvents(const int numObjects) { return rayx::defaultMaxEvents(numObjects); } } // unnamed namespace -namespace RAYX { +namespace rayx { Tracer::Tracer(const DeviceConfig& deviceConfig) { if (deviceConfig.enabledDevicesCount() != 1) RAYX_EXIT << "The number of selected devices must be exactly 1!"; @@ -71,4 +71,4 @@ Rays Tracer::trace(const Group& group, const Sequential sequential, const Object return rays; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/Tracer.h b/Intern/rayx-core/src/Tracer/Tracer.h index ab4771070..ae30e2fd0 100644 --- a/Intern/rayx-core/src/Tracer/Tracer.h +++ b/Intern/rayx-core/src/Tracer/Tracer.h @@ -10,7 +10,7 @@ #include "Rays.h" // Abstract Tracer base class. -namespace RAYX { +namespace rayx { // this value is picked in a 'good' way if it can divide number of rays without rest. for a number of rays picked by humans, this // value is probably good. though, if it could be power of two, the shader would benefit @@ -48,4 +48,4 @@ class RAYX_API Tracer { std::shared_ptr m_deviceTracer; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Tracer/Util.h b/Intern/rayx-core/src/Tracer/Util.h index d7aca9e7a..c51b46170 100644 --- a/Intern/rayx-core/src/Tracer/Util.h +++ b/Intern/rayx-core/src/Tracer/Util.h @@ -8,7 +8,7 @@ #include "Shader/Rand.h" #include "Shader/RaysPtr.h" -namespace RAYX { +namespace rayx { template using OptBuf = std::optional, int32_t>>; @@ -142,4 +142,4 @@ inline void execWithValidWorkDiv(DevAcc devAcc, Queue q, const int numElements, alpaka::exec(q, workDiv, kernel, std::forward(args)...); } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Variant.h b/Intern/rayx-core/src/Variant.h index 02a947d59..b3766160f 100644 --- a/Intern/rayx-core/src/Variant.h +++ b/Intern/rayx-core/src/Variant.h @@ -14,7 +14,7 @@ namespace variant = cuda::std; namespace variant = std; #endif -namespace RAYX { +namespace rayx { /** * @brief A variant class that extends a base class and holds a variant of types Ts. @@ -26,9 +26,9 @@ namespace RAYX { * struct TypeA { int a; }; * struct TypeB { double b; }; * }; - * using MyVariant = RAYX::Variant; + * using MyVariant = rayx::Variant; * // or if you want to extend functionality - * struct ExtendedBase : public RAYX::Variant { + * struct ExtendedBase : public rayx::Variant { * // Additional functionality * }; * ``` @@ -95,4 +95,4 @@ class Variant : public Base { variant::variant m_variant; }; -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Writer/CsvWriter.cpp b/Intern/rayx-core/src/Writer/CsvWriter.cpp index 9beb93560..48b63c524 100644 --- a/Intern/rayx-core/src/Writer/CsvWriter.cpp +++ b/Intern/rayx-core/src/Writer/CsvWriter.cpp @@ -7,7 +7,7 @@ #include "Beamline/StringConversion.h" #include "Debug/Debug.h" -namespace RAYX { +namespace rayx { namespace fs = std::filesystem; @@ -269,4 +269,4 @@ Rays readCsv(const fs::path& filepath) { return rays; } -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Writer/CsvWriter.h b/Intern/rayx-core/src/Writer/CsvWriter.h index 621decb00..c088e1386 100644 --- a/Intern/rayx-core/src/Writer/CsvWriter.h +++ b/Intern/rayx-core/src/Writer/CsvWriter.h @@ -7,9 +7,9 @@ #include "Shader/Ray.h" #include "Tracer/Tracer.h" -namespace RAYX { +namespace rayx { void RAYX_API writeCsv(const std::filesystem::path& filepath, const Rays& rays); Rays RAYX_API readCsv(const std::filesystem::path& filepath); -} // namespace RAYX +} // namespace rayx diff --git a/Intern/rayx-core/src/Writer/H5Writer.cpp b/Intern/rayx-core/src/Writer/H5Writer.cpp index 0c0ca2293..1d5d112c7 100644 --- a/Intern/rayx-core/src/Writer/H5Writer.cpp +++ b/Intern/rayx-core/src/Writer/H5Writer.cpp @@ -10,14 +10,14 @@ // declare user types for HighFive namespace { inline HighFive::DataType highfive_create_type_EventType() { - return HighFive::EnumType({ - {"HitElement", RAYX::EventType::HitElement}, - {"TooManyEvents", RAYX::EventType::TooManyEvents}, - {"Absorbed", RAYX::EventType::Absorbed}, - {"Uninitialized", RAYX::EventType::Uninitialized}, - {"BeyondHorizon", RAYX::EventType::BeyondHorizon}, - {"FatalError", RAYX::EventType::FatalError}, - {"Emitted", RAYX::EventType::Emitted}, + return HighFive::EnumType({ + {"HitElement", rayx::EventType::HitElement}, + {"TooManyEvents", rayx::EventType::TooManyEvents}, + {"Absorbed", rayx::EventType::Absorbed}, + {"Uninitialized", rayx::EventType::Uninitialized}, + {"BeyondHorizon", rayx::EventType::BeyondHorizon}, + {"FatalError", rayx::EventType::FatalError}, + {"Emitted", rayx::EventType::Emitted}, }); } @@ -28,10 +28,10 @@ inline HighFive::DataType highfive_create_type_Complex() { }); } } // unnamed namespace -HIGHFIVE_REGISTER_TYPE(RAYX::EventType, highfive_create_type_EventType); -HIGHFIVE_REGISTER_TYPE(RAYX::complex::Complex, highfive_create_type_Complex); +HIGHFIVE_REGISTER_TYPE(rayx::EventType, highfive_create_type_EventType); +HIGHFIVE_REGISTER_TYPE(rayx::complex::Complex, highfive_create_type_Complex); -namespace RAYX { +namespace rayx { // TODO: this function should not require, that attr is known beforehand. Mabye we should use attr only to further exclude attributes? Or provide an // extra attr that is repsonsible to check for existence? @@ -131,6 +131,6 @@ void appendH5(const std::filesystem::path& filepath, const Rays& rays, const Ray } catch (const std::exception& e) { RAYX_EXIT << "exception caught while attempting to write h5 file: " << e.what(); } } -} // namespace RAYX +} // namespace rayx #endif diff --git a/Intern/rayx-core/src/Writer/H5Writer.h b/Intern/rayx-core/src/Writer/H5Writer.h index 795ff18ee..4009c3d56 100644 --- a/Intern/rayx-core/src/Writer/H5Writer.h +++ b/Intern/rayx-core/src/Writer/H5Writer.h @@ -4,7 +4,7 @@ #include "Rays.h" -namespace RAYX { +namespace rayx { #ifndef NO_H5 RAYX_API Rays readH5Rays(const std::filesystem::path& filepath, const RayAttrMask attr = RayAttrMask::All); @@ -15,4 +15,4 @@ RAYX_API void writeH5(const std::filesystem::path& filepath, const std::vector(numSources)); + m_rays = convertRaysToBundleHistory(rayx::readH5Rays(rayFilePath), static_cast(numSources)); #else std::string rayFilePath = rmlPath.string().substr(0, rmlPath.string().size() - 4) + ".csv"; - m_rays = convertRaysToBundleHistory(RAYX::readCsv(rayFilePath), static_cast(numSources)); + m_rays = convertRaysToBundleHistory(rayx::readCsv(rayFilePath), static_cast(numSources)); #endif sortRaysByElement(m_rays, m_sortedRays, numElements); } void Application::loadBeamline(const std::filesystem::path& rmlPath) { - m_Beamline = std::make_unique(RAYX::importBeamline(rmlPath)); - m_UIParams.simulationInfo.maxEvents = RAYX::defaultMaxEvents(m_Beamline->numObjects()); + m_Beamline = std::make_unique(rayx::importBeamline(rmlPath)); + m_UIParams.simulationInfo.maxEvents = rayx::defaultMaxEvents(m_Beamline->numObjects()); } diff --git a/Intern/rayx-ui/src/Application.h b/Intern/rayx-ui/src/Application.h index 021f27848..4754cb154 100644 --- a/Intern/rayx-ui/src/Application.h +++ b/Intern/rayx-ui/src/Application.h @@ -88,7 +88,7 @@ class Application { // Caching, Helpers, and other stuff std::filesystem::path m_RMLPath; ///< Path to the RML file - std::unique_ptr m_Beamline; ///< Beamline + std::unique_ptr m_Beamline; ///< Beamline BundleHistory m_rays; ///< All rays std::vector> m_sortedRays; ///< Rays sorted by element bool m_buildElementsNeeded = true; diff --git a/Intern/rayx-ui/src/BundleHistory.cpp b/Intern/rayx-ui/src/BundleHistory.cpp index 8eec7798d..7dec33591 100644 --- a/Intern/rayx-ui/src/BundleHistory.cpp +++ b/Intern/rayx-ui/src/BundleHistory.cpp @@ -1,6 +1,6 @@ #include "BundleHistory.h" -BundleHistory convertRaysToBundleHistory(RAYX::Rays rays, const int numSources) { +BundleHistory convertRaysToBundleHistory(rayx::Rays rays, const int numSources) { RAYX_PROFILE_FUNCTION_STDOUT(); rays = rays.sortByPathIdAndPathEventId(); diff --git a/Intern/rayx-ui/src/BundleHistory.h b/Intern/rayx-ui/src/BundleHistory.h index eb4d3699d..641313870 100644 --- a/Intern/rayx-ui/src/BundleHistory.h +++ b/Intern/rayx-ui/src/BundleHistory.h @@ -7,10 +7,10 @@ // TODO: this object oriented api to Ray is to be reworked struct Ray { glm::dvec3 m_position; - RAYX::EventType m_eventType; + rayx::EventType m_eventType; glm::dvec3 m_direction; double m_energy; - RAYX::ElectricField m_field; + rayx::ElectricField m_field; double m_pathLength; int m_order; int m_lastElement; @@ -22,4 +22,4 @@ static_assert(std::is_default_constructible_v); using RayHistory = std::vector; using BundleHistory = std::vector; -BundleHistory convertRaysToBundleHistory(RAYX::Rays rays, const int numSources); +BundleHistory convertRaysToBundleHistory(rayx::Rays rays, const int numSources); diff --git a/Intern/rayx-ui/src/CommandParser.cpp b/Intern/rayx-ui/src/CommandParser.cpp index 3d90e9218..3d960698b 100644 --- a/Intern/rayx-ui/src/CommandParser.cpp +++ b/Intern/rayx-ui/src/CommandParser.cpp @@ -44,11 +44,11 @@ CommandParser::CommandParser(int _argc, char* const* _argv) : m_cli11{std::make_ } if (m_args.m_verbose) { - RAYX::setDebugVerbose(true); + rayx::setDebugVerbose(true); RAYX_VERB << "Verbose logging enabled."; } if (m_args.m_benchmark) { RAYX_VERB << "Starting in Benchmark Mode.\n"; - RAYX::BENCH_FLAG = true; + rayx::BENCH_FLAG = true; } } diff --git a/Intern/rayx-ui/src/GraphicsCore/Texture.cpp b/Intern/rayx-ui/src/GraphicsCore/Texture.cpp index 7fed1e407..eeb738899 100644 --- a/Intern/rayx-ui/src/GraphicsCore/Texture.cpp +++ b/Intern/rayx-ui/src/GraphicsCore/Texture.cpp @@ -18,7 +18,7 @@ Texture::Texture(const Device& device) m_layout{VK_IMAGE_LAYOUT_UNDEFINED}, m_usageFlags{VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT}, m_aspectFlags{VK_IMAGE_ASPECT_COLOR_BIT} { - std::vector data = dataFromPath(RAYX::ResourceHandler::getInstance().getResourcePath("Textures/default.png")); + std::vector data = dataFromPath(rayx::ResourceHandler::getInstance().getResourcePath("Textures/default.png")); createImage(VK_IMAGE_TILING_OPTIMAL, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); createImageView(); createSampler(); diff --git a/Intern/rayx-ui/src/RayProcessing.cpp b/Intern/rayx-ui/src/RayProcessing.cpp index 9297db849..bc9bd1ada 100644 --- a/Intern/rayx-ui/src/RayProcessing.cpp +++ b/Intern/rayx-ui/src/RayProcessing.cpp @@ -58,7 +58,7 @@ size_t getMaxEvents(const BundleHistory& bundleHist) { * Depending on the event type associated with the ray, the function produces visual lines that represent * ray segments, colored based on the event type. */ -std::vector getRays(const BundleHistory& rayCache, const RAYX::Beamline& beamline, RayFilterFunction filterFunction, uint32_t amountOfRays) { +std::vector getRays(const BundleHistory& rayCache, const rayx::Beamline& beamline, RayFilterFunction filterFunction, uint32_t amountOfRays) { RAYX_PROFILE_FUNCTION_STDOUT(); std::vector rays; @@ -70,7 +70,7 @@ std::vector getRays(const BundleHistory& rayCache, const RAYX::Beamline& b // compile all elements auto compiledElements = beamline.compileElements(); std::vector sourceWorldPositions; - RAYX::Group::accumulateLightSourcesWorldPositions(beamline, glm::dvec4(0, 0, 0, 1), glm::dmat4(1), sourceWorldPositions); + rayx::Group::accumulateLightSourcesWorldPositions(beamline, glm::dvec4(0, 0, 0, 1), glm::dmat4(1), sourceWorldPositions); for (size_t i : rayIndices) { if (i >= maxRayIndex) { @@ -89,9 +89,9 @@ std::vector getRays(const BundleHistory& rayCache, const RAYX::Beamline& b RAYX_EXIT << "Trying to access out-of-bounds index with element ID: " << event.m_lastElement; } glm::vec4 worldPos = compiledElements[static_cast(event.m_lastElement)].transform.m_outTrans * glm::vec4(event.m_position, 1.0f); - glm::vec4 originColor = (event.m_eventType == RAYX::EventType::HitElement) ? YELLOW : WHITE; - glm::vec4 pointColor = (event.m_eventType == RAYX::EventType::HitElement) ? ORANGE - : (event.m_eventType == RAYX::EventType::Absorbed) ? RED + glm::vec4 originColor = (event.m_eventType == rayx::EventType::HitElement) ? YELLOW : WHITE; + glm::vec4 pointColor = (event.m_eventType == rayx::EventType::HitElement) ? ORANGE + : (event.m_eventType == rayx::EventType::Absorbed) ? RED : WHITE; ColorVertex origin = {rayLastPos, originColor}; diff --git a/Intern/rayx-ui/src/RayProcessing.h b/Intern/rayx-ui/src/RayProcessing.h index ac1f59d69..999a085d5 100644 --- a/Intern/rayx-ui/src/RayProcessing.h +++ b/Intern/rayx-ui/src/RayProcessing.h @@ -17,7 +17,7 @@ using RayFilterFunction = std::function(const BundleHistory& * @return A vector of lines, which visually represents the paths of rays in the beamline. */ -std::vector getRays(const BundleHistory& rayCache, const RAYX::Beamline& beamline, RayFilterFunction filterFunction, uint32_t amountOfRays); +std::vector getRays(const BundleHistory& rayCache, const rayx::Beamline& beamline, RayFilterFunction filterFunction, uint32_t amountOfRays); void sortRaysByElement(const BundleHistory& rays, std::vector>& sortedRays, size_t numElements); diff --git a/Intern/rayx-ui/src/RenderSystem/GridRenderSystem.cpp b/Intern/rayx-ui/src/RenderSystem/GridRenderSystem.cpp index 62475e182..fe0069d2a 100644 --- a/Intern/rayx-ui/src/RenderSystem/GridRenderSystem.cpp +++ b/Intern/rayx-ui/src/RenderSystem/GridRenderSystem.cpp @@ -21,8 +21,8 @@ void GridRenderSystem::render(FrameInfo& frameInfo, [[maybe_unused]] const std:: RenderSystem::Input GridRenderSystem::fillInput(VkRenderPass renderPass) const { return RenderSystem::Input{.renderPass = renderPass, - .vertShaderPath = RAYX::ResourceHandler::getInstance().getResourcePath("Shaders/grid_shader_vert.spv").string(), - .fragShaderPath = RAYX::ResourceHandler::getInstance().getResourcePath("Shaders/grid_shader_frag.spv").string(), + .vertShaderPath = rayx::ResourceHandler::getInstance().getResourcePath("Shaders/grid_shader_vert.spv").string(), + .fragShaderPath = rayx::ResourceHandler::getInstance().getResourcePath("Shaders/grid_shader_frag.spv").string(), .bindingDescriptions = std::vector{}, .attributeDescriptions = std::vector{}, .topology = std::nullopt, diff --git a/Intern/rayx-ui/src/RenderSystem/ObjectRenderSystem.cpp b/Intern/rayx-ui/src/RenderSystem/ObjectRenderSystem.cpp index 30722a915..581ba96d3 100644 --- a/Intern/rayx-ui/src/RenderSystem/ObjectRenderSystem.cpp +++ b/Intern/rayx-ui/src/RenderSystem/ObjectRenderSystem.cpp @@ -32,8 +32,8 @@ void ObjectRenderSystem::render(FrameInfo& frameInfo, const std::vector setLayout, +void Scene::buildRaysRObject(const rayx::Beamline& beamline, UIRayInfo& rayInfo, std::shared_ptr setLayout, std::shared_ptr descriptorPool) { RAYX_PROFILE_FUNCTION_STDOUT(); std::vector rays; @@ -83,7 +83,7 @@ void Scene::buildRaysRObject(const RAYX::Beamline& beamline, UIRayInfo& rayInfo, } } -std::vector Scene::getRObjectInputs(const RAYX::Beamline& beamline, const std::vector>& sortedRays, +std::vector Scene::getRObjectInputs(const rayx::Beamline& beamline, const std::vector>& sortedRays, bool buildTexture) { // RAYX_PROFILE_FUNCTION_STDOUT(); auto elements = beamline.getElements(); diff --git a/Intern/rayx-ui/src/Scene.h b/Intern/rayx-ui/src/Scene.h index 350df25f0..c7fff67e8 100644 --- a/Intern/rayx-ui/src/Scene.h +++ b/Intern/rayx-ui/src/Scene.h @@ -25,10 +25,10 @@ class Scene { }; void buildRayCache(UIRayInfo& rayInfo, const BundleHistory& rays); - void buildRaysRObject(const RAYX::Beamline& beamline, UIRayInfo& rayInfo, std::shared_ptr setLayout, + void buildRaysRObject(const rayx::Beamline& beamline, UIRayInfo& rayInfo, std::shared_ptr setLayout, std::shared_ptr descriptorPool); - std::vector getRObjectInputs(const RAYX::Beamline& beamline, const std::vector>& sortedRays, + std::vector getRObjectInputs(const rayx::Beamline& beamline, const std::vector>& sortedRays, bool buildTexture); void buildRObjectsFromInput(std::vector&& inputs, std::shared_ptr setLayout, diff --git a/Intern/rayx-ui/src/Simulator.cpp b/Intern/rayx-ui/src/Simulator.cpp index 90acc2f46..b22a84b2a 100644 --- a/Intern/rayx-ui/src/Simulator.cpp +++ b/Intern/rayx-ui/src/Simulator.cpp @@ -5,7 +5,7 @@ #include "Writer/H5Writer.h" // constructor -Simulator::Simulator() { m_seq = RAYX::Sequential::No; } +Simulator::Simulator() { m_seq = rayx::Sequential::No; } void Simulator::runSimulation() { if (!m_readyForSimulation) { @@ -13,9 +13,9 @@ void Simulator::runSimulation() { return; } // Run rayx core - if (!m_maxEvents) { m_maxEvents = RAYX::defaultMaxEvents(m_Beamline.numObjects()); } + if (!m_maxEvents) { m_maxEvents = rayx::defaultMaxEvents(m_Beamline.numObjects()); } - const auto rays = m_Tracer->trace(m_Beamline, m_seq, RAYX::ObjectMask::allElements(), RAYX::RayAttrMask::All, static_cast(m_maxEvents), + const auto rays = m_Tracer->trace(m_Beamline, m_seq, rayx::ObjectMask::allElements(), rayx::RayAttrMask::All, static_cast(m_maxEvents), static_cast(m_max_batch_size)); const auto bundleHist = convertRaysToBundleHistory(rays.copy(), m_Beamline.numSources()); @@ -23,7 +23,7 @@ void Simulator::runSimulation() { for (auto& ray : bundleHist) { for (auto& event : ray) { - if (event.m_eventType == RAYX::EventType::TooManyEvents) { notEnoughEvents = true; } + if (event.m_eventType == rayx::EventType::TooManyEvents) { notEnoughEvents = true; } } } @@ -39,38 +39,38 @@ void Simulator::runSimulation() { path += ".h5"; #ifndef NO_H5 - RAYX::writeH5(path, m_Beamline.getObjectNames(), rays); + rayx::writeH5(path, m_Beamline.getObjectNames(), rays); #else - RAYX::writeCsv(path, rays); + rayx::writeCsv(path, rays); #endif } -void Simulator::setSimulationParameters(const std::filesystem::path& RMLPath, const RAYX::Beamline& beamline, +void Simulator::setSimulationParameters(const std::filesystem::path& RMLPath, const rayx::Beamline& beamline, const UISimulationInfo& simulationInfo) { const auto deviceAlreadyEnabled = m_deviceConfig.devices[simulationInfo.deviceIndex].enable; if (!deviceAlreadyEnabled) { m_deviceConfig.disableAllDevices().enableDeviceByIndex(simulationInfo.deviceIndex); - m_Tracer = std::make_unique(m_deviceConfig); + m_Tracer = std::make_unique(m_deviceConfig); } m_RMLPath = RMLPath; - m_Beamline = std::move(*static_cast(beamline.clone().get())); + m_Beamline = std::move(*static_cast(beamline.clone().get())); m_max_batch_size = simulationInfo.maxBatchSize; - m_seq = simulationInfo.sequential ? RAYX::Sequential::Yes : RAYX::Sequential::No; + m_seq = simulationInfo.sequential ? rayx::Sequential::Yes : rayx::Sequential::No; m_maxEvents = simulationInfo.maxEvents; if (simulationInfo.fixedSeed) { if (simulationInfo.seed != -1) { - RAYX::fixSeed(simulationInfo.seed); + rayx::fixSeed(simulationInfo.seed); } else - RAYX::fixSeed(RAYX::FIXED_SEED); + rayx::fixSeed(rayx::FIXED_SEED); } else { - RAYX::randomSeed(); + rayx::randomSeed(); } m_readyForSimulation = true; } std::vector Simulator::getAvailableDevices() { auto deviceNames = std::vector(); - for (const RAYX::DeviceConfig::Device& device : m_deviceConfig.devices) deviceNames.push_back(device.name); + for (const rayx::DeviceConfig::Device& device : m_deviceConfig.devices) deviceNames.push_back(device.name); return deviceNames; } diff --git a/Intern/rayx-ui/src/Simulator.h b/Intern/rayx-ui/src/Simulator.h index 250560a05..d2fba2a91 100644 --- a/Intern/rayx-ui/src/Simulator.h +++ b/Intern/rayx-ui/src/Simulator.h @@ -9,18 +9,18 @@ class Simulator { public: Simulator(); void runSimulation(); - void setSimulationParameters(const std::filesystem::path& RMLPath, const RAYX::Beamline& beamline, const UISimulationInfo& simulationInfo); + void setSimulationParameters(const std::filesystem::path& RMLPath, const rayx::Beamline& beamline, const UISimulationInfo& simulationInfo); std::vector getAvailableDevices(); private: uint32_t m_maxEvents = 0; std::filesystem::path m_RMLPath; ///< Path to the RML file - RAYX::Beamline m_Beamline; ///< Beamline + rayx::Beamline m_Beamline; ///< Beamline uint64_t m_max_batch_size = 100000; - std::unique_ptr m_Tracer; - RAYX::Sequential m_seq = RAYX::Sequential::No; - RAYX::DeviceConfig m_deviceConfig; ///< List of available devices. Selection of device for tracing + std::unique_ptr m_Tracer; + rayx::Sequential m_seq = rayx::Sequential::No; + rayx::DeviceConfig m_deviceConfig; ///< List of available devices. Selection of device for tracing bool m_readyForSimulation = false; // after Simulation diff --git a/Intern/rayx-ui/src/Triangulation/GeometryUtils.cpp b/Intern/rayx-ui/src/Triangulation/GeometryUtils.cpp index af7627743..be7cad6fd 100644 --- a/Intern/rayx-ui/src/Triangulation/GeometryUtils.cpp +++ b/Intern/rayx-ui/src/Triangulation/GeometryUtils.cpp @@ -10,18 +10,18 @@ * Given a Cutout object, this function calculates and returns the width and * length depending on the cutout's type (rectangle, ellipse, trapezoid, etc.). */ -std::pair getRectangularDimensions(const RAYX::Cutout& cutout) { +std::pair getRectangularDimensions(const rayx::Cutout& cutout) { double width = 0.0; double length = 0.0; cutout.visit([&](const T& arg) { - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { width = arg.m_width; length = arg.m_length; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { width = arg.m_diameter_x; length = arg.m_diameter_z; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { width = std::max(arg.m_widthA, arg.m_widthB); length = arg.m_length; } else { @@ -52,7 +52,7 @@ void Outline::calculateForElliptical(double diameterA, double diameterB) { // Calculate vertices for (uint32_t i = 0; i < numVertices; i++) { - double angle = 2.0f * RAYX::PI * i / numVertices; + double angle = 2.0f * rayx::PI * i / numVertices; glm::vec4 pos = {-diameterA * cos(angle) / 2.0f, 0, diameterB * sin(angle) / 2.0f, 1.0f}; vertices.emplace_back(pos, OPT_ELEMENT_COLOR); } diff --git a/Intern/rayx-ui/src/Triangulation/GeometryUtils.h b/Intern/rayx-ui/src/Triangulation/GeometryUtils.h index a24594f73..bdbcf84b3 100644 --- a/Intern/rayx-ui/src/Triangulation/GeometryUtils.h +++ b/Intern/rayx-ui/src/Triangulation/GeometryUtils.h @@ -17,4 +17,4 @@ struct Outline { * @param cutout Reference to the Cutout object. * @return A pair containing width and length as double values. */ -std::pair getRectangularDimensions(const RAYX::Cutout& cutout); +std::pair getRectangularDimensions(const rayx::Cutout& cutout); diff --git a/Intern/rayx-ui/src/Triangulation/TraceTriangulation.cpp b/Intern/rayx-ui/src/Triangulation/TraceTriangulation.cpp index 72052a60a..85dd577ea 100644 --- a/Intern/rayx-ui/src/Triangulation/TraceTriangulation.cpp +++ b/Intern/rayx-ui/src/Triangulation/TraceTriangulation.cpp @@ -26,11 +26,11 @@ std::vector> createRayGrid(size_t size, double width, double le pos = glm::dvec3(x, distanceToObj, z); dir = glm::dvec3(0.0f, -1.0f, 0.0f); const auto stokes = glm::dvec4(1.0f, 0.0f, 0.0f, 0.0f); - const auto field = RAYX::stokesToElectricFieldWithBaseConvention(stokes, dir); + const auto field = rayx::stokesToElectricFieldWithBaseConvention(stokes, dir); Ray ray = { .m_position = pos, - .m_eventType = RAYX::EventType::Emitted, + .m_eventType = rayx::EventType::Emitted, .m_direction = dir, .m_energy = 1.0f, .m_field = field, @@ -51,21 +51,21 @@ std::vector> createRayGrid(size_t size, double width, double le * cutout. Using CPU-based ray tracing, it computes the intersections between rays and the optical element's surface within the cutout. The ray * intersections are then grouped into triangles based on the grid, and a RenderObject representing these triangles is returned. */ -void traceTriangulation(const RAYX::OpticalElement compiled, std::vector& vertices, std::vector& indices) { - using DeviceType = RAYX::DeviceConfig::DeviceType; - auto tracer = RAYX::Tracer(RAYX::DeviceConfig(DeviceType::Cpu).enableBestDevice()); +void traceTriangulation(const rayx::OpticalElement compiled, std::vector& vertices, std::vector& indices) { + using DeviceType = rayx::DeviceConfig::DeviceType; + auto tracer = rayx::Tracer(rayx::DeviceConfig(DeviceType::Cpu).enableBestDevice()); constexpr size_t gridSize = 20; auto [width, length] = getRectangularDimensions(compiled.m_cutout); BundleHistory rayGrid = createRayGrid(gridSize, width, length); - std::vector> collisionGrid(gridSize, std::vector(gridSize, std::nullopt)); + std::vector> collisionGrid(gridSize, std::vector(gridSize, std::nullopt)); for (size_t i = 0; i < gridSize; ++i) { for (size_t j = 0; j < gridSize; ++j) { const auto& ray = rayGrid[i][j]; - RAYX::OptCollisionPoint collision = - RAYX::findCollisionInElementCoordsWithoutSlopeError(ray.m_position, ray.m_direction, compiled.m_surface, compiled.m_cutout, true); + rayx::OptCollisionPoint collision = + rayx::findCollisionInElementCoordsWithoutSlopeError(ray.m_position, ray.m_direction, compiled.m_surface, compiled.m_cutout, true); collisionGrid[i][j] = collision; } } diff --git a/Intern/rayx-ui/src/Triangulation/TraceTriangulation.h b/Intern/rayx-ui/src/Triangulation/TraceTriangulation.h index 5b9721263..fd47b50c3 100644 --- a/Intern/rayx-ui/src/Triangulation/TraceTriangulation.h +++ b/Intern/rayx-ui/src/Triangulation/TraceTriangulation.h @@ -14,16 +14,16 @@ * * @return RenderObject containing the vertices and indices needed for rendering the triangulated rays. * - * @note This function uses the RAYX::MegaKernelTracer for ray tracing and relies on a grid-based approach for tracing rays. + * @note This function uses the rayx::MegaKernelTracer for ray tracing and relies on a grid-based approach for tracing rays. * * Example usage: * @code{cpp} - * RAYX::OpticalElement element = ...; + * rayx::OpticalElement element = ...; * Device device = ...; * RenderObject renderObj = traceTriangulation(element, device); * @endcode */ -void traceTriangulation(const RAYX::OpticalElement compiled, std::vector& vertices, std::vector& indices); +void traceTriangulation(const rayx::OpticalElement compiled, std::vector& vertices, std::vector& indices); // ------ Helper functions ------ diff --git a/Intern/rayx-ui/src/Triangulation/Triangulate.cpp b/Intern/rayx-ui/src/Triangulation/Triangulate.cpp index cfc086fcc..7eb165a6c 100644 --- a/Intern/rayx-ui/src/Triangulation/Triangulate.cpp +++ b/Intern/rayx-ui/src/Triangulation/Triangulate.cpp @@ -61,11 +61,11 @@ double absoluteAngle(const Point2D& p1, const Point2D& p2) { return atan2(p2.x - VertexType toVertexType(const Point2D& prev, const Point2D& current, const Point2D& next) { double angle = atan2(next.x - current.x, next.y - current.y) - atan2(prev.x - current.x, prev.y - current.y); - if (angle < 0) { angle += RAYX::PI * 2; } + if (angle < 0) { angle += rayx::PI * 2; } if (prev < current && next < current) { - return angle < RAYX::PI ? Start : Split; + return angle < rayx::PI ? Start : Split; } else if (prev > current && next > current) { - return angle < RAYX::PI ? End : Merge; + return angle < rayx::PI ? End : Merge; } else { return Regular; } @@ -356,18 +356,18 @@ void triangulate(const PolygonComplex& poly, std::vector& points, // Cutout to Outline conversion // Holes are represented by polygons in clockwise order -PolygonSimple calculateOutlineFromCutout(const RAYX::Cutout& cutout, std::vector& vertices, bool clockwise = false) { +PolygonSimple calculateOutlineFromCutout(const rayx::Cutout& cutout, std::vector& vertices, bool clockwise = false) { constexpr double defWidthHeight = 50.0f; Outline outline; cutout.visit([&](const T& cutout_type) { - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { outline.calculateForQuadrilateral(cutout_type.m_widthA, cutout_type.m_widthB, cutout_type.m_length, cutout_type.m_length); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { outline.calculateForQuadrilateral(cutout_type.m_width, cutout_type.m_width, cutout_type.m_length, cutout_type.m_length); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { outline.calculateForElliptical(cutout_type.m_diameter_x, cutout_type.m_diameter_z); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { outline.calculateForQuadrilateral(defWidthHeight, defWidthHeight, defWidthHeight, defWidthHeight); } else { RAYX_EXIT << "Unknown cutout opening shape!"; @@ -390,11 +390,11 @@ PolygonSimple calculateOutlineFromCutout(const RAYX::Cutout& cutout, std::vector return indices; } -void planarTriangulation(const RAYX::OpticalElement compiled, std::vector& vertices, std::vector& indices) { +void planarTriangulation(const rayx::OpticalElement compiled, std::vector& vertices, std::vector& indices) { // The slit behaviour needs special attention, since it is basically three cutouts (the slit, the beamstop and the opening) PolygonComplex poly; compiled.m_behaviour.visit([&](const T& behaviour) { - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { poly.push_back(calculateOutlineFromCutout(behaviour.m_beamstopCutout, vertices)); poly.push_back(calculateOutlineFromCutout(compiled.m_cutout, vertices)); poly.push_back(calculateOutlineFromCutout(behaviour.m_openingCutout, vertices, true)); // Hole -> Clockwise order @@ -405,7 +405,7 @@ void planarTriangulation(const RAYX::OpticalElement compiled, std::vector& vertices, std::vector& indices) { +void triangulateObject(const rayx::OpticalElement compiled, std::vector& vertices, std::vector& indices) { // RAYX_PROFILE_FUNCTION_STDOUT(); compiled.m_surface.visit([&](const T& surface) { - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { planarTriangulation(compiled, vertices, indices); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { if (isPlanar(surface)) { planarTriangulation(compiled, vertices, indices); } else { traceTriangulation(compiled, vertices, indices); } - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { traceTriangulation(compiled, vertices, indices); } else { RAYX_EXIT << "Unknown element type: " << typeid(T).name(); diff --git a/Intern/rayx-ui/src/Triangulation/Triangulate.h b/Intern/rayx-ui/src/Triangulation/Triangulate.h index 6dd7e7356..be6261944 100644 --- a/Intern/rayx-ui/src/Triangulation/Triangulate.h +++ b/Intern/rayx-ui/src/Triangulation/Triangulate.h @@ -11,4 +11,4 @@ * @param elements A vector of optical elements to be triangulated. * @return A vector of RenderObject, which are the triangulated version of the input elements. */ -void triangulateObject(const RAYX::OpticalElement compiled, std::vector& vertices, std::vector& indices); +void triangulateObject(const rayx::OpticalElement compiled, std::vector& vertices, std::vector& indices); diff --git a/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.cpp b/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.cpp index 8386c9411..4ed50fa8f 100644 --- a/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.cpp +++ b/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.cpp @@ -21,10 +21,10 @@ void BeamlineDesignHandler::showBeamlineDesignWindow(UIBeamlineInfo& uiInfo) { } if (uiInfo.selectedNode->isSource()) { - const auto srcPtr = static_cast(uiInfo.selectedNode); + const auto srcPtr = static_cast(uiInfo.selectedNode); if (srcPtr) { showParameters(srcPtr->m_elementParameters, uiInfo.elementsChanged, SelectedType::LightSource); } } else if (uiInfo.selectedNode->isElement()) { - const auto elemPtr = static_cast(uiInfo.selectedNode); + const auto elemPtr = static_cast(uiInfo.selectedNode); if (elemPtr) { showParameters(elemPtr->m_elementParameters, uiInfo.elementsChanged, SelectedType::OpticalElement); } } else if (uiInfo.selectedNode->isGroup()) { ImGui::Text("Group editing is to be implemented still..."); @@ -33,7 +33,7 @@ void BeamlineDesignHandler::showBeamlineDesignWindow(UIBeamlineInfo& uiInfo) { } } -void BeamlineDesignHandler::showParameters(RAYX::DesignMap& parameters, bool& changed, SelectedType type) { +void BeamlineDesignHandler::showParameters(rayx::DesignMap& parameters, bool& changed, SelectedType type) { // Collect existing members of each group std::map> existingGroups; std::vector nonGroupedKeys; @@ -93,7 +93,7 @@ void BeamlineDesignHandler::showParameters(RAYX::DesignMap& parameters, bool& ch }); for (const auto& groupKey : sortedGroupKeys) { - RAYX::DesignMap& element = parameters[groupKey]; + rayx::DesignMap& element = parameters[groupKey]; createInputField(groupKey, element, changed, type, 1); // Start with nesting level 1 for grouped items } @@ -101,13 +101,13 @@ void BeamlineDesignHandler::showParameters(RAYX::DesignMap& parameters, bool& ch } } else { // It's a non-grouped parameter - RAYX::DesignMap& element = parameters[key]; + rayx::DesignMap& element = parameters[key]; createInputField(key, element, changed, type, 0); // Non-grouped items have nesting level 0 } } } -void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::DesignMap& element, bool& changed, SelectedType type, +void BeamlineDesignHandler::createInputField(const std::string& key, rayx::DesignMap& element, bool& changed, SelectedType type, int nestingLevel = 0) { ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue; @@ -119,7 +119,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig // Align label to the left ImGui::AlignTextToFramePadding(); - if (element.type() != RAYX::ValueType::Map) { + if (element.type() != rayx::ValueType::Map) { ImGui::Text("%s:", key.c_str()); // Align input field to the right ImGui::SameLine(rightAlignPosition); @@ -133,14 +133,14 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig // type,geometricalShape and openingShape need to be a drowdown instead of a string/int input if (key == "type") { auto currentEl = element.as_elementType(); - int currentItem = int(std::distance(RAYX::ElementTypeToString.begin(), RAYX::ElementTypeToString.find(currentEl))); + int currentItem = int(std::distance(rayx::ElementTypeToString.begin(), rayx::ElementTypeToString.find(currentEl))); static bool isDisabled = true; // TODO: Enable after SRI release has been built if (true) { ImGui::BeginDisabled(); } - if (ImGui::BeginCombo("##combo", currentItem >= 0 ? RAYX::ElementTypeToString.at(currentEl).c_str() : "")) { + if (ImGui::BeginCombo("##combo", currentItem >= 0 ? rayx::ElementTypeToString.at(currentEl).c_str() : "")) { [[maybe_unused]] int n = 0; - for (const auto& pair : RAYX::ElementTypeToString) { + for (const auto& pair : rayx::ElementTypeToString) { bool isSelected = (currentEl == pair.first); if (ImGui::Selectable(pair.second.c_str(), isSelected)) { element = pair.first; @@ -184,7 +184,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } else { // dynamic handling of different types switch (element.type()) { - case RAYX::ValueType::Double: { + case rayx::ValueType::Double: { double input = element.as_double(); if (std::isnan(input) || std::isinf(input)) { @@ -208,7 +208,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig break; } - case RAYX::ValueType::Int: { + case rayx::ValueType::Int: { int input = element.as_int(); if (ImGui::InputInt("##int", &input, 0, 0, flags)) { element = input; @@ -216,7 +216,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::Bool: { + case rayx::ValueType::Bool: { bool input = element.as_bool(); if (ImGui::Checkbox("##bool", &input)) { element = input; @@ -224,7 +224,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::String: { + case rayx::ValueType::String: { static bool isDisabled = true; // TODO: Enable after SRI release has been built if (true) { ImGui::BeginDisabled(); } @@ -243,7 +243,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig if (isDisabled) { ImGui::EndDisabled(); } break; } - case RAYX::ValueType::Dvec4: { + case rayx::ValueType::Dvec4: { auto currentValue = element.as_dvec4(); double vals[4] = {currentValue.x, currentValue.y, currentValue.z, currentValue.w}; bool changedLocal = false; @@ -259,7 +259,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::Dmat4x4: { + case rayx::ValueType::Dmat4x4: { auto currentValue = element.as_dmat4x4(); bool changedLocal = false; for (int row = 0; row < 4; ++row) { @@ -281,10 +281,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::SpreadType: { + case rayx::ValueType::SpreadType: { auto currentValue = element.as_energySpreadType(); - if (ImGui::BeginCombo("##spreadtype", RAYX::SpreadTypeToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::SpreadTypeToString) { + if (ImGui::BeginCombo("##spreadtype", rayx::SpreadTypeToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::SpreadTypeToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -296,10 +296,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::EnergyDistributionType: { + case rayx::ValueType::EnergyDistributionType: { auto currentValue = element.as_energyDistributionType(); - if (ImGui::BeginCombo("##energydisttype", RAYX::EnergyDistributionTypeToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::EnergyDistributionTypeToString) { + if (ImGui::BeginCombo("##energydisttype", rayx::EnergyDistributionTypeToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::EnergyDistributionTypeToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -311,10 +311,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::SourceDist: { + case rayx::ValueType::SourceDist: { auto currentValue = element.as_sourceDist(); - if (ImGui::BeginCombo("##sourcedist", RAYX::SourceDistToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::SourceDistToString) { + if (ImGui::BeginCombo("##sourcedist", rayx::SourceDistToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::SourceDistToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -326,10 +326,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::ElectronEnergyOrientation: { + case rayx::ValueType::ElectronEnergyOrientation: { auto currentValue = element.as_electronEnergyOrientation(); - if (ImGui::BeginCombo("##electronenergyorientation", RAYX::ElectronEnergyOrientationToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::ElectronEnergyOrientationToString) { + if (ImGui::BeginCombo("##electronenergyorientation", rayx::ElectronEnergyOrientationToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::ElectronEnergyOrientationToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -341,10 +341,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::EnergySpreadUnit: { + case rayx::ValueType::EnergySpreadUnit: { auto currentValue = element.as_energySpreadUnit(); - if (ImGui::BeginCombo("##energyspreadunit", RAYX::EnergySpreadUnitToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::EnergySpreadUnitToString) { + if (ImGui::BeginCombo("##energyspreadunit", rayx::EnergySpreadUnitToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::EnergySpreadUnitToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -356,10 +356,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::SigmaType: { + case rayx::ValueType::SigmaType: { auto currentValue = element.as_sigmaType(); - if (ImGui::BeginCombo("##sigmatype", RAYX::SigmaTypeToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::SigmaTypeToString) { + if (ImGui::BeginCombo("##sigmatype", rayx::SigmaTypeToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::SigmaTypeToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -371,19 +371,19 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::Rad: { - RAYX::Rad currentValue = element.as_rad(); + case rayx::ValueType::Rad: { + rayx::Rad currentValue = element.as_rad(); double input = currentValue.rad; if (ImGui::InputDouble("##rad", &input, 0.0, 0.0, "%.6f", flags)) { - element = RAYX::Rad(input); + element = rayx::Rad(input); changed = true; } break; } - case RAYX::ValueType::Material: { - RAYX::Material currentValue = element.as_material(); - if (ImGui::BeginCombo("##material", RAYX::MaterialToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::MaterialToString) { + case rayx::ValueType::Material: { + rayx::Material currentValue = element.as_material(); + if (ImGui::BeginCombo("##material", rayx::MaterialToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::MaterialToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -395,10 +395,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::CentralBeamstop: { + case rayx::ValueType::CentralBeamstop: { auto currentValue = element.as_centralBeamStop(); - if (ImGui::BeginCombo("##centralbeamstop", RAYX::CentralBeamstopToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::CentralBeamstopToString) { + if (ImGui::BeginCombo("##centralbeamstop", rayx::CentralBeamstopToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::CentralBeamstopToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -410,10 +410,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::FigureRotation: { + case rayx::ValueType::FigureRotation: { auto currentValue = element.as_figureRotation(); - if (ImGui::BeginCombo("##figurerotation", RAYX::FigureRotationToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::FigureRotationToString) { + if (ImGui::BeginCombo("##figurerotation", rayx::FigureRotationToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::FigureRotationToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -425,10 +425,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::CurvatureType: { + case rayx::ValueType::CurvatureType: { auto currentValue = element.as_curvatureType(); - if (ImGui::BeginCombo("##curvaturetype", RAYX::CurvatureTypeToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::CurvatureTypeToString) { + if (ImGui::BeginCombo("##curvaturetype", rayx::CurvatureTypeToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::CurvatureTypeToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -440,10 +440,10 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } break; } - case RAYX::ValueType::BehaviourType: { + case rayx::ValueType::BehaviourType: { auto currentValue = element.as_behaviourType(); - if (ImGui::BeginCombo("##behaviourtype", RAYX::BehaviourTypeToString.at(currentValue).c_str())) { - for (const auto& [value, name] : RAYX::BehaviourTypeToString) { + if (ImGui::BeginCombo("##behaviourtype", rayx::BehaviourTypeToString.at(currentValue).c_str())) { + for (const auto& [value, name] : rayx::BehaviourTypeToString) { bool isSelected = (currentValue == value); if (ImGui::Selectable(name.c_str(), isSelected)) { element = value; @@ -456,7 +456,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig break; } // manual sorting is not yet implemented for the map type - case RAYX::ValueType::Map: { + case rayx::ValueType::Map: { auto currentValue = element.as_map(); if (ImGui::CollapsingHeader(key.c_str())) { ImGui::Indent(); @@ -486,11 +486,11 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig } // this needs a lot of parameters and handling - case RAYX::ValueType::Surface: + case rayx::ValueType::Surface: // not sure if needed - case RAYX::ValueType::Cutout: - case RAYX::ValueType::CylinderDirection: + case rayx::ValueType::Cutout: + case rayx::ValueType::CylinderDirection: break; default: ImGui::Text("Unsupported type"); diff --git a/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.h b/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.h index 42cd418a9..112106be8 100644 --- a/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.h +++ b/Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.h @@ -8,8 +8,8 @@ class BeamlineDesignHandler { void showBeamlineDesignWindow(UIBeamlineInfo& uiBeamlineInfo); private: - void showParameters(RAYX::DesignMap& parameters, bool& changed, SelectedType type); - void createInputField(const std::string& key, RAYX::DesignMap& element, bool& changed, SelectedType type, int nestingLevel); + void showParameters(rayx::DesignMap& parameters, bool& changed, SelectedType type); + void createInputField(const std::string& key, rayx::DesignMap& element, bool& changed, SelectedType type, int nestingLevel); bool caseInsensitiveCompare(const std::string& a, const std::string& b); diff --git a/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.cpp b/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.cpp index 44a6f6644..09e596eaf 100644 --- a/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.cpp +++ b/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.cpp @@ -17,7 +17,7 @@ BeamlineOutliner::BeamlineOutliner() {} BeamlineOutliner::~BeamlineOutliner() {} // Recursive helper: render a Group and its children as an ImGui tree. -void BeamlineOutliner::renderImGuiTreeFromGroup(RAYX::Group* group, RAYX::BeamlineNode*& selected, CameraController& cam, int depth) { +void BeamlineOutliner::renderImGuiTreeFromGroup(rayx::Group* group, rayx::BeamlineNode*& selected, CameraController& cam, int depth) { if (!group) return; int ctr = 0; for (auto& child : *group) { @@ -25,9 +25,9 @@ void BeamlineOutliner::renderImGuiTreeFromGroup(RAYX::Group* group, RAYX::Beamli // Use the node's name if possible. if (child->isElement()) { - label = static_cast(child.get())->getName(); + label = static_cast(child.get())->getName(); } else if (child->isSource()) { - label = static_cast(child.get())->getName(); + label = static_cast(child.get())->getName(); } else if (child->isGroup()) { label = "Group"; } @@ -48,7 +48,7 @@ void BeamlineOutliner::renderImGuiTreeFromGroup(RAYX::Group* group, RAYX::Beamli // If this node is a Group and is open, recursively render its children. if (nodeOpen && child->isGroup()) { - auto* childGroupPtr = static_cast(child.get()); + auto* childGroupPtr = static_cast(child.get()); renderImGuiTreeFromGroup(childGroupPtr, selected, cam, depth + 1); ImGui::TreePop(); } diff --git a/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.h b/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.h index ea8ef74fa..0ea63ee29 100644 --- a/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.h +++ b/Intern/rayx-ui/src/UserInterface/BeamlineOutliner.h @@ -19,5 +19,5 @@ class BeamlineOutliner { private: // Recursive helper that renders the tree starting at a given Group. - void renderImGuiTreeFromGroup(RAYX::Group* group, RAYX::BeamlineNode*& selected, CameraController& cam, int depth = 0); + void renderImGuiTreeFromGroup(rayx::Group* group, rayx::BeamlineNode*& selected, CameraController& cam, int depth = 0); }; diff --git a/Intern/rayx-ui/src/UserInterface/Settings.h b/Intern/rayx-ui/src/UserInterface/Settings.h index 549c08070..b93220bb0 100644 --- a/Intern/rayx-ui/src/UserInterface/Settings.h +++ b/Intern/rayx-ui/src/UserInterface/Settings.h @@ -50,8 +50,8 @@ struct UISimulationInfo { enum class SelectedType { None = -1, LightSource = 0, OpticalElement = 1, Group = 2 }; struct UIBeamlineInfo { - RAYX::Beamline* beamline = nullptr; // Beamline optional, lifetime managed by Application - RAYX::BeamlineNode* selectedNode = nullptr; // Selection optional, lifetime managed by Beamline + rayx::Beamline* beamline = nullptr; // Beamline optional, lifetime managed by Application + rayx::BeamlineNode* selectedNode = nullptr; // Selection optional, lifetime managed by Beamline bool elementsChanged = false; }; diff --git a/Intern/rayx-ui/src/UserInterface/UIHandler.cpp b/Intern/rayx-ui/src/UserInterface/UIHandler.cpp index bea6da03f..91eae36f3 100644 --- a/Intern/rayx-ui/src/UserInterface/UIHandler.cpp +++ b/Intern/rayx-ui/src/UserInterface/UIHandler.cpp @@ -129,7 +129,7 @@ UIHandler::UIHandler(const Window& window, const Device& device, VkFormat imageF // Upload fonts { // Setup style - const std::filesystem::path fontPath = RAYX::ResourceHandler::getInstance().getFontPath("Fonts/Roboto-Regular.ttf"); + const std::filesystem::path fontPath = rayx::ResourceHandler::getInstance().getFontPath("Fonts/Roboto-Regular.ttf"); m_fonts.push_back(m_IO.Fonts->AddFontFromFileTTF(fontPath.string().c_str(), 8.0f)); m_fonts.push_back(m_IO.Fonts->AddFontFromFileTTF(fontPath.string().c_str(), 16.0f)); m_fonts.push_back(m_IO.Fonts->AddFontFromFileTTF(fontPath.string().c_str(), 32.0f)); diff --git a/Intern/rayx/src/CommandParser.cpp b/Intern/rayx/src/CommandParser.cpp index a249d2d7b..5aedbb1d1 100644 --- a/Intern/rayx/src/CommandParser.cpp +++ b/Intern/rayx/src/CommandParser.cpp @@ -53,7 +53,7 @@ CliArgs parseCliArgs(const int argc, char const* const* const argv) { app.add_flag("-a,--append", args.append, "Append to existing output file. Default: overwrite existing output file"); app.add_flag("-S,--sequential", args.sequential, "Trace sequentially"); app.add_option("-s,--seed", args.seed, "Specify a seed to be used for tracing"); - app.add_flag("-f,--default-seed", args.defaultSeed, std::format("Use default seed for tracing: {}", RAYX::FIXED_SEED)); + app.add_flag("-f,--default-seed", args.defaultSeed, std::format("Use default seed for tracing: {}", rayx::FIXED_SEED)); app.add_flag("-x,--cpu", args.cpu, "Enable CPU devices. Can be combined with --gpu. Affects --list-devices and --device-index. Default behaviour if neither --cpu and " "--gpu are provided: Both will be enabled"); @@ -66,14 +66,14 @@ CliArgs parseCliArgs(const int argc, char const* const* const argv) { app.add_flag("-V,--verbose", args.verbose, "Dump more information"); app.add_option("-m,--maxevents", args.maxEvents, "Maximum number of events per ray. Default: A multiple of the number of objects to record events for"); - app.add_option("-b,--batch-size", args.batchSize, std::format("Batch size for tracing. Default: {}", RAYX::DEFAULT_BATCH_SIZE)); + app.add_option("-b,--batch-size", args.batchSize, std::format("Batch size for tracing. Default: {}", rayx::DEFAULT_BATCH_SIZE)); app.add_option("-n,--number-of-rays", args.numberOfRays, "Override the number of rays for all sources"); app.add_flag("-B,--benchmark", args.benchmark, "Dump benchmark durations"); app.add_flag("-O,--sort-by-object-id", args.sortByObjectId, "Sort rays by object_id before writing to output file"); app.add_option("-R,--record-indices", args.objectRecordIndices, "Record events only for specific sources / elements. Use --dump to list the objects of a beamline"); - auto formatAttrNames = RAYX::getRayAttrNames(); + auto formatAttrNames = rayx::getRayAttrNames(); auto formatAttrNamesStr = std::string(); for (const auto attrName : formatAttrNames) formatAttrNamesStr += "\n\t" + attrName; app.add_option( diff --git a/Intern/rayx/src/TerminalApp.cpp b/Intern/rayx/src/TerminalApp.cpp index cc9035fc0..e8428ecc4 100644 --- a/Intern/rayx/src/TerminalApp.cpp +++ b/Intern/rayx/src/TerminalApp.cpp @@ -24,13 +24,13 @@ namespace fs = std::filesystem; namespace { -void dumpBeamlineObjects(const RAYX::Beamline* beamline) { +void dumpBeamlineObjects(const rayx::Beamline* beamline) { const auto sources = beamline->getSources(); std::cout << "\tsources (" << sources.size() << "):" << std::endl; int objectIndex = 0; for (const auto* source : sources) { - std::cout << "\t- [" << objectIndex << "] '" << source->getName() << "' \t(type: " << RAYX::ElementTypeToString.at(source->getType()) + std::cout << "\t- [" << objectIndex << "] '" << source->getName() << "' \t(type: " << rayx::ElementTypeToString.at(source->getType()) << ", number of rays: " << source->getNumberOfRays() << ")" << std::endl; ++objectIndex; } @@ -39,8 +39,8 @@ void dumpBeamlineObjects(const RAYX::Beamline* beamline) { std::cout << "\telements (" << elements.size() << "):" << std::endl; for (const auto& element : elements) { - const auto curvature = RAYX::CurvatureTypeToString.at(element->getCurvatureType()); - const auto behaviour = RAYX::BehaviourTypeToString.at(element->getBehaviourType()); + const auto curvature = rayx::CurvatureTypeToString.at(element->getCurvatureType()); + const auto behaviour = rayx::BehaviourTypeToString.at(element->getBehaviourType()); std::cout << "\t- [" << objectIndex << "] '" << element->getName() << "' \t(curvature: " << curvature << ", behviour: " << behaviour << ")" << std::endl; ++objectIndex; @@ -49,7 +49,7 @@ void dumpBeamlineObjects(const RAYX::Beamline* beamline) { void dumpBeamline(const fs::path& filepath) { std::cout << "dumping beamline meta data from: " << filepath << std::endl; - const auto beamline = std::make_unique(RAYX::importBeamline(filepath.string())); + const auto beamline = std::make_unique(rayx::importBeamline(filepath.string())); dumpBeamlineObjects(beamline.get()); } @@ -149,7 +149,7 @@ void TerminalApp::traceRmlAndExportRays(const fs::path& inputFilepath) { std::cout << "Processing: " << inputFilepath << std::endl; // record mask for attributes. determine which ray attributes should be recorded - const auto attrRecordMask = RAYX::rayAttrStringsToRayAttrMask(m_cliArgs.attrRecordMask); + const auto attrRecordMask = rayx::rayAttrStringsToRayAttrMask(m_cliArgs.attrRecordMask); const auto beamline = loadBeamline(inputFilepath); @@ -178,16 +178,16 @@ void TerminalApp::traceRmlAndExportRays(const fs::path& inputFilepath) { std::cout << " Exported rays to: " << fs::absolute(outputFilepath) << std::endl; } -RAYX::Beamline TerminalApp::loadBeamline(const fs::path& filepath) { +rayx::Beamline TerminalApp::loadBeamline(const fs::path& filepath) { RAYX_PROFILE_FUNCTION_STDOUT(); - auto beamline = RAYX::importBeamline(filepath); + auto beamline = rayx::importBeamline(filepath); // override number of rays for all sources if (m_cliArgs.numberOfRays) { - beamline.traverse([n = *m_cliArgs.numberOfRays](RAYX::BeamlineNode& node) -> bool { + beamline.traverse([n = *m_cliArgs.numberOfRays](rayx::BeamlineNode& node) -> bool { if (node.isSource()) { - auto* source = static_cast(&node); + auto* source = static_cast(&node); source->setNumberOfRays(n); } return false; @@ -197,23 +197,23 @@ RAYX::Beamline TerminalApp::loadBeamline(const fs::path& filepath) { return beamline; } -RAYX::Rays TerminalApp::traceBeamline(const RAYX::Beamline& beamline, const RAYX::RayAttrMask attrRecordMask) { +rayx::Rays TerminalApp::traceBeamline(const rayx::Beamline& beamline, const rayx::RayAttrMask attrRecordMask) { RAYX_PROFILE_FUNCTION_STDOUT(); // dump beamline objects - if (RAYX::getDebugVerbose()) { dumpBeamlineObjects(&beamline); } + if (rayx::getDebugVerbose()) { dumpBeamlineObjects(&beamline); } const size_t numSources = beamline.numSources(); const size_t numElements = beamline.numElements(); // record mask for elements. determine which elements should be recorded auto objectRecordMask = m_cliArgs.objectRecordIndices.empty() - ? RAYX::ObjectIndexMask::all(numSources, numElements) - : RAYX::ObjectIndexMask::byIndices(numSources, numElements, m_cliArgs.objectRecordIndices); + ? rayx::ObjectIndexMask::all(numSources, numElements) + : rayx::ObjectIndexMask::byIndices(numSources, numElements, m_cliArgs.objectRecordIndices); if (m_cliArgs.objectRecordIndices.empty()) { RAYX_VERB << "Record indices is empty. Defaulting to recording all elements"; } - if (RAYX::getDebugVerbose()) { + if (rayx::getDebugVerbose()) { const auto objectNames = beamline.getObjectNames(); RAYX_VERB << "Recording objects:"; for (int i = 0; i < objectRecordMask.numObjects(); ++i) { @@ -223,7 +223,7 @@ RAYX::Rays TerminalApp::traceBeamline(const RAYX::Beamline& beamline, const RAYX } // sequential / non-sequential tracing - RAYX::Sequential sequential = m_cliArgs.sequential ? RAYX::Sequential::Yes : RAYX::Sequential::No; + rayx::Sequential sequential = m_cliArgs.sequential ? rayx::Sequential::Yes : rayx::Sequential::No; // max events to record per ray path const auto maxEvents = m_cliArgs.maxEvents; @@ -232,13 +232,13 @@ RAYX::Rays TerminalApp::traceBeamline(const RAYX::Beamline& beamline, const RAYX const auto maxBatchSize = m_cliArgs.batchSize; // in order to validate the events later, we always want to get the event types - const auto attrRecordMaskTrace = attrRecordMask | RAYX::RayAttrMask::EventType; + const auto attrRecordMaskTrace = attrRecordMask | rayx::RayAttrMask::EventType; // do the trace auto rays = m_tracer->trace(beamline, sequential, objectRecordMask, attrRecordMaskTrace, maxEvents, maxBatchSize); if (m_cliArgs.sortByObjectId) { - if (!(attrRecordMask & RAYX::RayAttrMask::ObjectId)) + if (!(attrRecordMask & rayx::RayAttrMask::ObjectId)) RAYX_WARN << "Cannot sort by object_id, because object_id is not recorded. Please add object_id to the attribute record mask."; rays = rays.sortByObjectId(); @@ -253,18 +253,18 @@ RAYX::Rays TerminalApp::traceBeamline(const RAYX::Beamline& beamline, const RAYX return rays; } -void TerminalApp::validateEvents(const RAYX::Rays& rays) { +void TerminalApp::validateEvents(const rayx::Rays& rays) { RAYX_PROFILE_FUNCTION_STDOUT(); const auto eventTypes = - std::ranges::fold_left(rays.event_type.begin(), rays.event_type.end(), RAYX::EventTypeMask::None, - [](RAYX::EventTypeMask acc, const RAYX::EventType eventType) { return acc | RAYX::eventTypeToMask(eventType); }); + std::ranges::fold_left(rays.event_type.begin(), rays.event_type.end(), rayx::EventTypeMask::None, + [](rayx::EventTypeMask acc, const rayx::EventType eventType) { return acc | rayx::eventTypeToMask(eventType); }); - if (!!(eventTypes & RAYX::EventTypeMask::Uninitialized)) std::cout << "warning: one or more events in output are uninitialized" << std::endl; - if (!!(eventTypes & RAYX::EventTypeMask::FatalError)) std::cout << "warning: fatal error detected for one or more events" << std::endl; - if (!!(eventTypes & RAYX::EventTypeMask::BeyondHorizon)) + if (!!(eventTypes & rayx::EventTypeMask::Uninitialized)) std::cout << "warning: one or more events in output are uninitialized" << std::endl; + if (!!(eventTypes & rayx::EventTypeMask::FatalError)) std::cout << "warning: fatal error detected for one or more events" << std::endl; + if (!!(eventTypes & rayx::EventTypeMask::BeyondHorizon)) std::cout << "warning: one or more events in output have gone beyond the horizon while refracting" << std::endl; - if (!!(eventTypes & RAYX::EventTypeMask::TooManyEvents)) + if (!!(eventTypes & rayx::EventTypeMask::TooManyEvents)) std::cout << "warning: capacity of events exceeded. could not record all events! consider increasing max events." << std::endl; } @@ -290,23 +290,23 @@ void TerminalApp::run() { return; } - if (m_cliArgs.verbose) { RAYX::setDebugVerbose(true); } + if (m_cliArgs.verbose) { rayx::setDebugVerbose(true); } if (m_cliArgs.defaultSeed) { - RAYX::fixSeed(RAYX::FIXED_SEED); + rayx::fixSeed(rayx::FIXED_SEED); } else if (m_cliArgs.seed) { - RAYX::fixSeed(*m_cliArgs.seed); + rayx::fixSeed(*m_cliArgs.seed); } else { - RAYX::randomSeed(); + rayx::randomSeed(); } if (m_cliArgs.benchmark) { RAYX_VERB << "Starting in Benchmark Mode.\n"; - RAYX::BENCH_FLAG = true; + rayx::BENCH_FLAG = true; } auto argToDeviceType = [&] { - using DeviceType = RAYX::DeviceConfig::DeviceType; + using DeviceType = rayx::DeviceConfig::DeviceType; if (m_cliArgs.cpu == m_cliArgs.gpu) return DeviceType::All; return m_cliArgs.cpu ? DeviceType::Cpu : DeviceType::Gpu; }; @@ -314,19 +314,19 @@ void TerminalApp::run() { auto deviceType = argToDeviceType(); if (m_cliArgs.listDevices) { - RAYX::DeviceConfig(deviceType).dumpDevices(); + rayx::DeviceConfig(deviceType).dumpDevices(); exit(0); } // Choose Hardware auto getDevice = [&] { if (m_cliArgs.deviceId) { - return RAYX::DeviceConfig(deviceType).enableDeviceByIndex(*m_cliArgs.deviceId); + return rayx::DeviceConfig(deviceType).enableDeviceByIndex(*m_cliArgs.deviceId); } else { - return RAYX::DeviceConfig(deviceType).enableBestDevice(); + return rayx::DeviceConfig(deviceType).enableBestDevice(); } }; - m_tracer = std::make_unique(getDevice()); + m_tracer = std::make_unique(getDevice()); if (!m_cliArgs.inputPaths.size()) RAYX_EXIT << "Please provide an input RML file or directory. Use --help for more information"; @@ -337,8 +337,8 @@ void TerminalApp::run() { std::cout << "Done. Processed " << rmlCounter << " RML file(s)" << std::endl; } -fs::path TerminalApp::exportRays(const fs::path& inputFilepath, const std::vector& objectNames, const RAYX::Rays& rays, - const RAYX::RayAttrMask attrRecordMask) { +fs::path TerminalApp::exportRays(const fs::path& inputFilepath, const std::vector& objectNames, const rayx::Rays& rays, + const rayx::RayAttrMask attrRecordMask) { RAYX_PROFILE_FUNCTION_STDOUT(); if (rays.empty()) return {}; @@ -359,17 +359,17 @@ fs::path TerminalApp::exportRays(const fs::path& inputFilepath, const std::vecto } if (m_cliArgs.csv) { - RAYX::writeCsv(outputFilepath, rays); - const auto rays2 = RAYX::readCsv(outputFilepath); + rayx::writeCsv(outputFilepath, rays); + const auto rays2 = rayx::readCsv(outputFilepath); std::cout << (rays == rays2) << std::endl; } else { #ifdef NO_H5 RAYX_EXIT << "writeH5 called during NO_H5 (HDF5 disabled during build)"; #else if (m_cliArgs.append) - RAYX::appendH5(outputFilepath, rays, attrRecordMask); + rayx::appendH5(outputFilepath, rays, attrRecordMask); else - RAYX::writeH5(outputFilepath, objectNames, rays, attrRecordMask); + rayx::writeH5(outputFilepath, objectNames, rays, attrRecordMask); #endif } diff --git a/Intern/rayx/src/TerminalApp.h b/Intern/rayx/src/TerminalApp.h index acc233baa..fd048f0e3 100644 --- a/Intern/rayx/src/TerminalApp.h +++ b/Intern/rayx/src/TerminalApp.h @@ -20,15 +20,15 @@ class TerminalApp { private: int tracePath(const std::filesystem::path& path); void traceRmlAndExportRays(const std::filesystem::path& path); - RAYX::Beamline loadBeamline(const std::filesystem::path& filepath); - RAYX::Rays traceBeamline(const RAYX::Beamline& beamline, const RAYX::RayAttrMask attr); - void validateEvents(const RAYX::Rays& rays); + rayx::Beamline loadBeamline(const std::filesystem::path& filepath); + rayx::Rays traceBeamline(const rayx::Beamline& beamline, const rayx::RayAttrMask attr); + void validateEvents(const rayx::Rays& rays); /// write rays to file /// @returns the output filename (either .csv or .h5) - std::filesystem::path exportRays(const std::filesystem::path& filepath, const std::vector& objectNames, const RAYX::Rays& rays, - const RAYX::RayAttrMask attr); + std::filesystem::path exportRays(const std::filesystem::path& filepath, const std::vector& objectNames, const rayx::Rays& rays, + const rayx::RayAttrMask attr); - std::unique_ptr m_tracer; + std::unique_ptr m_tracer; CliArgs m_cliArgs; };