From 05abd20c9ca63b988f6f95648287dea33e8c4070 Mon Sep 17 00:00:00 2001 From: Jannis Maier Date: Tue, 21 Jan 2025 13:56:28 +0100 Subject: [PATCH] Almost fixed the test suite --- Intern/rayx-core/src/Beamline/Beamline.cpp | 32 ++++---- Intern/rayx-core/src/Beamline/Beamline.h | 10 +-- Intern/rayx-core/src/Data/Importer.cpp | 11 ++- Intern/rayx-core/src/Data/xml.cpp | 4 +- Intern/rayx-core/src/Debug/Debug.cpp | 4 + Intern/rayx-core/src/Design/DesignElement.cpp | 1 + Intern/rayx-core/src/Design/DesignSource.cpp | 19 +++-- Intern/rayx-core/src/Design/DesignSource.h | 2 +- Intern/rayx-core/src/Tracer/SimpleTracer.h | 2 +- Intern/rayx-core/src/Tracer/Tracer.cpp | 2 +- Intern/rayx-core/tests/setupTests.cpp | 8 +- Intern/rayx-core/tests/testRml.cpp | 82 ++++++++++--------- Intern/rayx-core/tests/testShader.cpp | 4 +- Intern/rayx-core/tests/testSources.cpp | 10 +-- 14 files changed, 99 insertions(+), 92 deletions(-) diff --git a/Intern/rayx-core/src/Beamline/Beamline.cpp b/Intern/rayx-core/src/Beamline/Beamline.cpp index 6f6aae13..227c2720 100644 --- a/Intern/rayx-core/src/Beamline/Beamline.cpp +++ b/Intern/rayx-core/src/Beamline/Beamline.cpp @@ -41,7 +41,7 @@ void Group::addChild(const BeamlineNode& child) { children.push_back(child); } std::vector Group::getInputRays(int thread_count) const { RAYX_PROFILE_FUNCTION_STDOUT(); - std::vector sources = getAllSources(); + std::vector sources = getSources(); if (sources.size() == 0) { return {}; @@ -76,7 +76,7 @@ std::vector Group::getInputRays(int thread_count) const { } MaterialTables Group::calcMinimalMaterialTables() const { - std::vector elements = getAllElements(); + std::vector elements = getElements(); std::array relevantMaterials{}; relevantMaterials.fill(false); @@ -102,7 +102,7 @@ std::vector Group::compile() const { } // Retrieve all DesignElements (deep) -std::vector Group::getAllElements() const { +std::vector Group::getElements() const { std::vector elements; traverse([&elements](const BeamlineNode& node) { if (std::holds_alternative(node)) { @@ -112,18 +112,8 @@ std::vector Group::getAllElements() const { return elements; } -size_t Group::numberOfElements() const { - size_t count = 0; - traverse([&count](const BeamlineNode& node) { - if (std::holds_alternative(node)) { - count++; - } - }); - return count; -} - // Retrieve all DesignSources (deep) -std::vector Group::getAllSources() const { +std::vector Group::getSources() const { std::vector sources; traverse([&sources](const BeamlineNode& node) { if (std::holds_alternative(node)) { @@ -133,7 +123,17 @@ std::vector Group::getAllSources() const { return sources; } -size_t Group::numberOfSources() const { +size_t Group::numElements() const { + size_t count = 0; + traverse([&count](const BeamlineNode& node) { + if (std::holds_alternative(node)) { + count++; + } + }); + return count; +} + +size_t Group::numSources() const { size_t count = 0; traverse([&count](const BeamlineNode& node) { if (std::holds_alternative(node)) { @@ -144,7 +144,7 @@ size_t Group::numberOfSources() const { } // Retrieve all Groups (deep) -std::vector Group::getAllGroups() const { +std::vector Group::getGroups() const { std::vector groups; traverse([&groups](const BeamlineNode& node) { if (std::holds_alternative(node)) { diff --git a/Intern/rayx-core/src/Beamline/Beamline.h b/Intern/rayx-core/src/Beamline/Beamline.h index 40a74d5b..8004d2b3 100644 --- a/Intern/rayx-core/src/Beamline/Beamline.h +++ b/Intern/rayx-core/src/Beamline/Beamline.h @@ -35,11 +35,11 @@ class Group { std::vector compile() const; // New methods for retrieving elements, sources, and groups - std::vector getAllElements() const; - std::vector getAllSources() const; - size_t numberOfElements() const; - size_t numberOfSources() const; - std::vector getAllGroups() const; + std::vector getElements() const; + std::vector getSources() const; + std::vector getGroups() const; + size_t numElements() const; + size_t numSources() const; // Getter & Setter const glm::dvec4& getPosition() const { return m_position; } diff --git a/Intern/rayx-core/src/Data/Importer.cpp b/Intern/rayx-core/src/Data/Importer.cpp index 1ec1818f..54027395 100644 --- a/Intern/rayx-core/src/Data/Importer.cpp +++ b/Intern/rayx-core/src/Data/Importer.cpp @@ -115,16 +115,17 @@ void handleObjectCollection(rapidxml::xml_node<>* collection, Group& group, cons if (strcmp(object->name(), "object") == 0) { addBeamlineObjectFromXML(object, group, filename); } else if (strcmp(object->name(), "group") == 0) { - Group group; auto groupOpt = xml::parseGroup(object); if (!groupOpt) { RAYX_EXIT << "parseGroup failed!"; } - auto g = groupOpt.value(); + Group nestedGroup = groupOpt.value(); // Recursively parse all objects from within the group. - handleObjectCollection(object, group, filename); + handleObjectCollection(object, nestedGroup, filename); + // Add the group to the beamline. + group.addChild(nestedGroup); } else if (strcmp(object->name(), "param") != 0) { RAYX_EXIT << "received weird object->name(): " << object->name(); } @@ -163,9 +164,7 @@ Beamline importBeamline(const std::filesystem::path& filename) { // For each group we call handleObjectCollection recursively, and push the group onto the group context stack. handleObjectCollection(xml_beamline, root, filename); - Beamline beamline; - // TODO - return beamline; + return root; } } // namespace RAYX diff --git a/Intern/rayx-core/src/Data/xml.cpp b/Intern/rayx-core/src/Data/xml.cpp index faf5347a..b72cad7a 100644 --- a/Intern/rayx-core/src/Data/xml.cpp +++ b/Intern/rayx-core/src/Data/xml.cpp @@ -434,13 +434,13 @@ std::optional parseGroup(rapidxml::xml_node<>* node) { if (auto position = paramPosition(node); position) { group.setPosition(*position); } else { - return std::nullopt; + group.setPosition(glm::dvec4(0, 0, 0, 1)); } if (auto orientation = paramOrientation(node); orientation) { group.setOrientation(*orientation); } else { - return std::nullopt; + group.setOrientation(glm::dmat4(1)); } return group; diff --git a/Intern/rayx-core/src/Debug/Debug.cpp b/Intern/rayx-core/src/Debug/Debug.cpp index 60f25d7c..57f64634 100644 --- a/Intern/rayx-core/src/Debug/Debug.cpp +++ b/Intern/rayx-core/src/Debug/Debug.cpp @@ -86,6 +86,10 @@ Verb::~Verb() { } } +// The default error_fn value. Exit with an error code of 1. +void exit1() { exit(1); } +void (*error_fn)() = exit1; + const int PREC = 17; // precision // the implementation of RAYX_DBG. diff --git a/Intern/rayx-core/src/Design/DesignElement.cpp b/Intern/rayx-core/src/Design/DesignElement.cpp index 28fa2041..b3281091 100644 --- a/Intern/rayx-core/src/Design/DesignElement.cpp +++ b/Intern/rayx-core/src/Design/DesignElement.cpp @@ -6,6 +6,7 @@ namespace RAYX { +// TODO: This needs to apply group transformations OpticalElement DesignElement::compile() const { RAYX_PROFILE_FUNCTION_STDOUT(); if (getType() == ElementType::ExpertsMirror) { diff --git a/Intern/rayx-core/src/Design/DesignSource.cpp b/Intern/rayx-core/src/Design/DesignSource.cpp index 311ed26e..02e3aabb 100644 --- a/Intern/rayx-core/src/Design/DesignSource.cpp +++ b/Intern/rayx-core/src/Design/DesignSource.cpp @@ -6,30 +6,31 @@ #include "Debug/Debug.h" namespace RAYX { -std::vector DesignSource::compile(int i) const { - std::vector ray; +// TODO: This needs to apply group transformations +std::vector DesignSource::compile(int numThreads) const { + std::vector rays; if (getType() == ElementType::PointSource) { PointSource ps(*this); - ray = ps.getRays(i); + rays = ps.getRays(numThreads); } else if (getType() == ElementType::MatrixSource) { MatrixSource ms(*this); - ray = ms.getRays(i); + rays = ms.getRays(numThreads); } else if (getType() == ElementType::DipoleSource) { DipoleSource ds(*this); - ray = ds.getRays(i); + rays = ds.getRays(numThreads); } else if (getType() == ElementType::PixelSource) { PixelSource ps(*this); - ray = ps.getRays(i); + rays = ps.getRays(numThreads); } else if (getType() == ElementType::CircleSource) { CircleSource cs(*this); - ray = cs.getRays(i); + rays = cs.getRays(numThreads); } else if (getType() == ElementType::SimpleUndulatorSource) { SimpleUndulatorSource su(*this); - ray = su.getRays(i); + rays = su.getRays(numThreads); } - return ray; + return rays; } void DesignSource::setName(std::string s) { m_elementParameters["name"] = s; } diff --git a/Intern/rayx-core/src/Design/DesignSource.h b/Intern/rayx-core/src/Design/DesignSource.h index 7e7eb41e..8d79c663 100644 --- a/Intern/rayx-core/src/Design/DesignSource.h +++ b/Intern/rayx-core/src/Design/DesignSource.h @@ -7,7 +7,7 @@ namespace RAYX { struct RAYX_API DesignSource { DesignMap m_elementParameters; - std::vector compile(int thread_count) const; + std::vector compile(int numThreads) const; void setStokeslin0(double value); void setStokeslin45(double value); diff --git a/Intern/rayx-core/src/Tracer/SimpleTracer.h b/Intern/rayx-core/src/Tracer/SimpleTracer.h index 1130d554..404f0e56 100644 --- a/Intern/rayx-core/src/Tracer/SimpleTracer.h +++ b/Intern/rayx-core/src/Tracer/SimpleTracer.h @@ -128,7 +128,7 @@ BundleHistory SimpleTracer::trace(const Group& group, Sequential seq, uint6 RAYX_VERB << "maxEvents: " << maxEvents; // don't trace if there are no optical elements - if (group.numberOfElements() == 0) { + if (group.numElements() == 0) { // an empty history suffices, nothing is happening to the rays! BundleHistory result; return result; diff --git a/Intern/rayx-core/src/Tracer/Tracer.cpp b/Intern/rayx-core/src/Tracer/Tracer.cpp index d5b4fd9f..9cae5605 100644 --- a/Intern/rayx-core/src/Tracer/Tracer.cpp +++ b/Intern/rayx-core/src/Tracer/Tracer.cpp @@ -75,7 +75,7 @@ BundleHistory convertToBundleHistory(const std::vector& rays) { } int Tracer::defaultMaxEvents(const Group* group) { - if (group) return group->numberOfElements() * 2 + 8; + if (group) return group->numElements() * 2 + 8; return 32; } diff --git a/Intern/rayx-core/tests/setupTests.cpp b/Intern/rayx-core/tests/setupTests.cpp index d993949f..98e4d1a5 100644 --- a/Intern/rayx-core/tests/setupTests.cpp +++ b/Intern/rayx-core/tests/setupTests.cpp @@ -77,7 +77,7 @@ void writeToOutputCSV(const RAYX::BundleHistory& hist, std::string filename) { RAYX::BundleHistory traceRML(std::string filename) { auto beamline = loadBeamline(filename); - return tracer->trace(beamline, Sequential::No, DEFAULT_BATCH_SIZE, 1, beamline.m_DesignElements.size() + 2); + return tracer->trace(beamline, Sequential::No, DEFAULT_BATCH_SIZE, 1, beamline.numElements() + 2); } std::vector extractLastHit(const RAYX::BundleHistory& hist) { @@ -179,18 +179,18 @@ std::optional lastSequentialHit(RayHistory ray_hist, uint32_t beamlin // returns the rayx rays converted to be ray-UI compatible. std::vector rayUiCompat(std::string filename, Sequential seq = Sequential::No) { auto beamline = loadBeamline(filename); - BundleHistory hist = tracer->trace(beamline, seq, DEFAULT_BATCH_SIZE, 1, beamline.m_DesignElements.size() + 2); + BundleHistory hist = tracer->trace(beamline, seq, DEFAULT_BATCH_SIZE, 1, beamline.numElements() + 2); std::vector out; for (auto ray_hist : hist) { - auto opt_ray = lastSequentialHit(ray_hist, beamline.m_DesignElements.size()); + auto opt_ray = lastSequentialHit(ray_hist, beamline.numElements()); if (opt_ray) { auto orig_r = *opt_ray; auto r = orig_r; int elem = (int)r.m_lastElement; - double btype = beamline.m_DesignElements[elem].compile().m_behaviour.m_type; // m_element.m_behaviour.m_type; + double btype = beamline.getElements()[elem].compile().m_behaviour.m_type; // m_element.m_behaviour.m_type; // these types of behaviours indicate that Ray-UI uses a DesignPlane::XY for this. // Thus, (as rayx uses an XZ plane) to allow comparison with Ray-UI we need to swap the y and z coordinates here. if (btype == BTYPE_IMAGE_PLANE || btype == BTYPE_SLIT) { diff --git a/Intern/rayx-core/tests/testRml.cpp b/Intern/rayx-core/tests/testRml.cpp index c85a7c79..ebb9062c 100644 --- a/Intern/rayx-core/tests/testRml.cpp +++ b/Intern/rayx-core/tests/testRml.cpp @@ -1,49 +1,51 @@ #include "setupTests.h" TEST_F(TestSuite, allBeamlineObjects) { - auto b = loadBeamline("allBeamlineObjects"); - CHECK_EQ(b.m_DesignSources.size(), 6); // Point, Circle, Dipole, Matrix, Pixel, simple Undulator - CHECK_EQ(b.m_DesignElements.size(), - 12); // Cone, Cylinder, Ellipsoid, Paraboloid, plane mirror, toroid, slit, sphere grating, plane grating, - // sphere mirror, rzp, image plane + RAYX::Beamline bl = loadBeamline("allBeamlineObjects"); + // Point, Circle, Dipole, Matrix, Pixel, simple Undulator + CHECK_EQ(bl.numSources(), 6); + // Cone, Cylinder, Ellipsoid, Paraboloid, plane mirror, toroid, slit, sphere grating, plane grating, sphere mirror, rzp, image plane + CHECK_EQ(bl.numElements(), 12); } TEST_F(TestSuite, loadDatFile) { - auto b = loadBeamline("loadDatFile"); - CHECK_EQ(b.m_DesignSources.size(), 1); - CHECK_EQ(b.m_DesignElements.size(), 1); + RAYX::Beamline bl = loadBeamline("loadDatFile"); + CHECK_EQ(bl.numSources(), 1); + CHECK_EQ(bl.numElements(), 1); // This only works due to fixed seeding! // The loaded DAT file only has the 3 energies 12, 15, 17 with equal probability. - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 15, 0.1); - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 17, 0.1); - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 17, 0.1); - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 12, 0.1); + RAYX::DesignSource source0 = bl.getSources()[0]; + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 15, 0.1); + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 17, 0.1); + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 17, 0.1); + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 12, 0.1); } TEST_F(TestSuite, loadDatFile2) { - auto b = loadBeamline("loadDatFile2"); - CHECK_EQ(b.m_DesignSources.size(), 1); - CHECK_EQ(b.m_DesignElements.size(), 1); + RAYX::Beamline bl = loadBeamline("loadDatFile2"); + CHECK_EQ(bl.numSources(), 1); + CHECK_EQ(bl.numElements(), 1); // This only works due to fixed seeding! // The loaded DAT file only has the 3 energies 12, 15, 17 with - but it uses soft band. - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 14.7, 0.1); - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 17.1, 0.1); - CHECK_EQ(b.m_DesignSources[0].getEnergyDistribution().selectEnergy(), 16.7, 0.1); + RAYX::DesignSource source0 = bl.getSources()[0]; + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 14.7, 0.1); + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 17.1, 0.1); + CHECK_EQ(source0.getEnergyDistribution().selectEnergy(), 16.7, 0.1); } TEST_F(TestSuite, loadGroups) { - auto b = loadBeamline("loadGroups"); - CHECK_EQ(b.m_DesignSources.size(), 1); - CHECK_EQ(b.m_DesignElements.size(), 4); + RAYX::Beamline bl = loadBeamline("loadGroups"); + CHECK_EQ(bl.numSources(), 1); + CHECK_EQ(bl.numElements(), 4); } TEST_F(TestSuite, groupTransform) { - auto b = loadBeamline("groupTransform"); - CHECK_EQ(b.m_DesignSources.size(), 1); - CHECK_EQ(b.m_DesignElements.size(), 1); - auto m = b.m_DesignElements[0].compile().m_inTrans; + RAYX::Beamline bl = loadBeamline("groupTransform"); + CHECK_EQ(bl.numSources(), 1); + CHECK_EQ(bl.numElements(), 1); + auto m = bl.getElements()[0].compile().m_inTrans; glm::dmat4x4 correct = { 1, 0, 0, 0, // 0, 1, 0, 0, // @@ -80,7 +82,7 @@ TEST_F(TestSuite, testEnergyDistribution) { for (auto values : testinput) { auto beamline = loadBeamline(values.rmlFile); - auto energy = beamline.m_DesignSources[0].getEnergyDistribution().selectEnergy(); + auto energy = beamline.getSources()[0].getEnergyDistribution().selectEnergy(); CHECK_EQ(energy, values.energy, 0.1); } @@ -89,7 +91,7 @@ TEST_F(TestSuite, testEnergyDistribution) { TEST_F(TestSuite, testParaboloidQuad) { auto beamline = loadBeamline("paraboloid_matrix_IP"); - OpticalElement para = beamline.m_DesignElements[0].compile(); + OpticalElement para = beamline.getElements()[0].compile(); auto parabo = deserializeQuadric(para.m_surface); CHECK_EQ(1, parabo.m_a11); @@ -107,7 +109,7 @@ TEST_F(TestSuite, testParaboloidQuad) { TEST_F(TestSuite, testSphereQuad) { auto beamline = loadBeamline("SphereMirrorDefault"); - OpticalElement sph = beamline.m_DesignElements[0].compile(); + OpticalElement sph = beamline.getElements()[0].compile(); auto sphere = deserializeQuadric(sph.m_surface); CHECK_EQ(1, sphere.m_a11); @@ -125,7 +127,7 @@ TEST_F(TestSuite, testSphereQuad) { TEST_F(TestSuite, testEllipsoidQuad) { auto beamline = loadBeamline("Ellipsoid"); - OpticalElement elli = beamline.m_DesignElements[0].compile(); + OpticalElement elli = beamline.getElements()[0].compile(); auto ellips = deserializeQuadric(elli.m_surface); CHECK_EQ(1, ellips.m_a11); @@ -143,7 +145,7 @@ TEST_F(TestSuite, testEllipsoidQuad) { TEST_F(TestSuite, testCylinderQuad) { auto beamline = loadBeamline("CylinderDefault"); - OpticalElement cyli = beamline.m_DesignElements[0].compile(); + OpticalElement cyli = beamline.getElements()[0].compile(); auto cylinder = deserializeQuadric(cyli.m_surface); CHECK_EQ(0, cylinder.m_a11); @@ -161,7 +163,7 @@ TEST_F(TestSuite, testCylinderQuad) { TEST_F(TestSuite, testConeQuad) { auto beamline = loadBeamline("Cone"); - OpticalElement con = beamline.m_DesignElements[0].compile(); + OpticalElement con = beamline.getElements()[0].compile(); auto cone = deserializeQuadric(con.m_surface); CHECK_EQ(0.903353, cone.m_a11, 0.001); @@ -179,7 +181,7 @@ TEST_F(TestSuite, testConeQuad) { TEST_F(TestSuite, testToroidSurface) { auto beamline = loadBeamline("toroid"); - OpticalElement trid = beamline.m_DesignElements[0].compile(); + OpticalElement trid = beamline.getElements()[0].compile(); auto toroid = deserializeToroid(trid.m_surface); CHECK_EQ(10470.4917, toroid.m_longRadius, 0.001); @@ -189,7 +191,7 @@ TEST_F(TestSuite, testToroidSurface) { TEST_F(TestSuite, testExpertsOptic) { auto beamline = loadBeamline("toroid"); - OpticalElement trid = beamline.m_DesignElements[0].compile(); + OpticalElement trid = beamline.getElements()[0].compile(); auto toroid = deserializeToroid(trid.m_surface); CHECK_EQ(10470.4917, toroid.m_longRadius, 0.001); @@ -204,9 +206,9 @@ TEST_F(TestSuite, testExpertsOptic) { TEST_F(TestSuite, testTwoSourcesInOneRML) { auto beamline = loadBeamline("twoSourcesTest"); - DesignSource dipolesource = beamline.m_DesignSources[0]; + DesignSource dipolesource = beamline.getSources()[0]; - DesignSource pointsource = beamline.m_DesignSources[1]; + DesignSource pointsource = beamline.getSources()[1]; CHECK_EQ(100, dipolesource.getEnergy()); CHECK_EQ(150.24724068638105, pointsource.getEnergyDistribution().selectEnergy()); @@ -216,9 +218,9 @@ TEST_F(TestSuite, testTwoSourcesInOneRML) { } TEST_F(TestSuite, groupTransform2) { - auto b = loadBeamline("groupTransform2"); - CHECK_EQ(b.m_DesignSources.size(), 1); - CHECK_EQ(b.m_DesignElements.size(), 1); + RAYX::Beamline bl = loadBeamline("groupTransform2"); + CHECK_EQ(bl.numSources(), 1); + CHECK_EQ(bl.numElements(), 1); glm::dmat4x4 yz_swap = { 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, @@ -241,8 +243,8 @@ TEST_F(TestSuite, groupTransform2) { glm::dmat4x4 orientationCorrect = groupOr * elementOr; glm::dvec4 positionCorrect = groupPos + (groupOr * elementPos); - glm::dmat4x4 inTrans = b.m_DesignElements[0].compile().m_inTrans * yz_swap; - glm::dmat4x4 outTrans = b.m_DesignElements[0].compile().m_outTrans * yz_swap; + glm::dmat4x4 inTrans = bl.getElements()[0].compile().m_inTrans * yz_swap; + glm::dmat4x4 outTrans = bl.getElements()[0].compile().m_outTrans * yz_swap; glm::dmat4x4 orientationResult = glm::dmat4x4(glm::dmat3x3(inTrans)); glm::dvec4 positionResult = outTrans * glm::dvec4(0, 0, 0, 1); diff --git a/Intern/rayx-core/tests/testShader.cpp b/Intern/rayx-core/tests/testShader.cpp index 409ec9cb..ecf587ad 100644 --- a/Intern/rayx-core/tests/testShader.cpp +++ b/Intern/rayx-core/tests/testShader.cpp @@ -1345,7 +1345,7 @@ TEST_F(TestSuite, testBesselDipole) { }}; auto beamline = loadBeamline("dipole_plain"); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; DipoleSource dipolesource(src); for (auto values : inouts) { @@ -1382,7 +1382,7 @@ TEST_F(TestSuite, testSchwingerDipole) { }}; auto beamline = loadBeamline("dipole_plain"); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; DipoleSource dipolesource(src); diff --git a/Intern/rayx-core/tests/testSources.cpp b/Intern/rayx-core/tests/testSources.cpp index 35771a28..25284153 100644 --- a/Intern/rayx-core/tests/testSources.cpp +++ b/Intern/rayx-core/tests/testSources.cpp @@ -93,7 +93,7 @@ TEST_F(TestSuite, DipoleEnergyDistribution) { TEST_F(TestSuite, PixelPositionTest) { auto beamline = loadBeamline("PixelSource"); auto rays = beamline.getInputRays(); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; auto width = src.getSourceWidth(); auto height = src.getSourceHeight(); auto hordiv = src.getHorDivergence(); @@ -107,7 +107,7 @@ TEST_F(TestSuite, PixelPositionTest) { TEST_F(TestSuite, DipoleZDistribution) { auto beamline = loadBeamline("dipole_plain"); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; auto rays = beamline.getInputRays(); checkZDistribution(rays, 0, 2.2); @@ -147,7 +147,7 @@ TEST_F(TestSuite, testInterpolationFunctionDipole) { }; auto beamline = loadBeamline("dipole_plain"); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; DipoleSource dipolesource(src); for (auto values : inouts) { @@ -169,7 +169,7 @@ TEST_F(TestSuite, testVerDivergenceDipole) { }}; auto beamline = loadBeamline("dipole_plain"); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; DipoleSource dipolesource(src); for (auto values : inouts) { @@ -196,7 +196,7 @@ TEST_F(TestSuite, testLightsourceGetters) { }}; for (auto values : rmlinputs) { auto beamline = loadBeamline(values.rmlFile); - DesignSource src = beamline.m_DesignSources[0]; + DesignSource src = beamline.getSources()[0]; auto test2 = values.horDivergence; auto test4 = values.sourceDepth;