Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Angle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand All @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Core.h"

namespace RAYX {
namespace rayx {

struct Rad;

Expand All @@ -33,4 +33,4 @@ struct RAYX_API Rad {
double rad;
};

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/Beamline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Design/DesignElement.h"
#include "Design/DesignSource.h"

namespace RAYX {
namespace rayx {

namespace {
std::string getUniqueUnnamedGroupName() {
Expand Down Expand Up @@ -481,4 +481,4 @@ BeamlineNode* Group::findNodeByObjectId(const size_t objectId) {
return const_cast<BeamlineNode*>(constSelf->findNodeByObjectId(objectId));
}

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/Beamline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -180,4 +180,4 @@ class RAYX_API Group : public BeamlineNode {

using Beamline = Group; // Conceptually, a Beamline is a Group

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/DatFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -63,4 +63,4 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) {
return s.str();
}

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/DatFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/EnergyDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,4 +48,4 @@ struct RAYX_API SeparateEnergies {

using EnergyDistributionVariant = std::variant<DatFile, HardEdge, SoftEdge, SeparateEnergies>;

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Beamline.h"

namespace RAYX {
namespace rayx {

namespace {
std::string getNodeTypeString(const BeamlineNode* node) {
Expand Down Expand Up @@ -107,4 +107,4 @@ DesignElement* BeamlineNode::asElement() {
return static_cast<DesignElement*>(this);
}

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Core.h"

namespace RAYX {
namespace rayx {

class Group;
class DesignSource;
Expand Down Expand Up @@ -117,4 +117,4 @@ class RAYX_API BeamlineNode {
BeamlineNode* m_parent = nullptr;
};

} // namespace RAYX
} // namespace rayx
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Beamline/StringConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Shader/LightSources/LightSource.h"

namespace RAYX {
namespace rayx {

// String conversion functions

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/CanonicalizePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/CanonicalizePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,4 +31,4 @@ std::filesystem::path RAYX_API canonicalizeRepositoryPath(const std::filesystem:
/// `./TerminalApp -i <relPath>`
std::filesystem::path RAYX_API canonicalizeUserPath(const std::filesystem::path& relPath);

} // namespace RAYX
} // namespace rayx
10 changes: 5 additions & 5 deletions Intern/rayx-core/src/Debug/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <sstream>
#include <utility>

namespace RAYX {
namespace rayx {

// The length of filename and line number is 30 characters.
// If it doesn't find, we insert "...".
Expand Down Expand Up @@ -87,7 +87,7 @@ const int PREC = 17; // precision
// the implementation of RAYX_DBG.
// the std::vector<double> v contains the data of the object we intend to log.
void dbg(const std::string& filename, int line, std::string name, std::vector<double> 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;
Expand All @@ -98,16 +98,16 @@ void dbg(const std::string& filename, int line, std::string name, std::vector<do
counter++;
if (counter == 4 && v.size() == 16) { // 4x4 things should be written in 4 rows
counter = 0;
RAYX::Log(filename, line) << s.str();
rayx::Log(filename, line) << s.str();
s = std::stringstream();
}
}
if (counter > 0) { RAYX::Log(filename, line) << s.str(); }
if (counter > 0) { rayx::Log(filename, line) << s.str(); }
}

// The verbose flag used for RAYX_VERB printing.
static bool VERBOSE = false;
void setDebugVerbose(bool b) { VERBOSE = b; }
bool getDebugVerbose() { return VERBOSE; }

} // namespace RAYX
} // namespace rayx
22 changes: 11 additions & 11 deletions Intern/rayx-core/src/Debug/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#define STRING(s) #s

namespace RAYX {
namespace rayx {

/////////////////////////////////////////////////////////////////////////////
// OSTREAM CONVERSION
Expand Down Expand Up @@ -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 <typename T> IgnoreLog & operator<<(T){return *this;
} // namespace RAYX
} // namespace rayx
}
;

Expand All @@ -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.
Expand All @@ -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

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -257,6 +257,6 @@ inline std::vector<double> formatAsVec(const Rays& rays) {

void dbg(const std::string& filename, int line, std::string name, std::vector<double> 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
2 changes: 1 addition & 1 deletion Intern/rayx-core/src/Debug/Instrumentor.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Instrumentor.h"

// if true, benchmarking is active.
bool RAYX::BENCH_FLAG = false;
bool rayx::BENCH_FLAG = false;
8 changes: 4 additions & 4 deletions Intern/rayx-core/src/Debug/Instrumentor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "Core.h"

namespace RAYX {
namespace rayx {

extern bool RAYX_API BENCH_FLAG;
class RAYX_API InstrumentationTimer {
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Intern/rayx-core/src/Design/DesignElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Debug/Debug.h"
#include "Debug/Instrumentor.h"

namespace RAYX {
namespace rayx {

namespace {
std::string getUniqueUnnamedElementName() {
Expand All @@ -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); }
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions Intern/rayx-core/src/Design/DesignElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Element/Element.h"
#include "Value.h"

namespace RAYX {
namespace rayx {

class RAYX_API DesignElement : public BeamlineNode {
public:
Expand Down Expand Up @@ -262,4 +262,4 @@ class RAYX_API DesignElement : public BeamlineNode {
void setRoughnessCoating(double value);
double getRoughnessCoating() const;
};
} // namespace RAYX
} // namespace rayx
Loading