diff --git a/GUI/Model/BaseItem/SessionItem.h b/GUI/Model/BaseItem/SessionItem.h index 4e0d3430459994ac7c1743664265a044698f0a22..93f9b77e59881690a25f4c09de43d4c0316f9a4d 100644 --- a/GUI/Model/BaseItem/SessionItem.h +++ b/GUI/Model/BaseItem/SessionItem.h @@ -174,11 +174,11 @@ class GroupInfo; //! //! Since UI and core are using completely unrelated objects, a conversion between the two //! components is necessary. This is done with the functions in namespace TransformFromDomain -//! and TransformToDomain. +//! and TransformToCore. //! //! For IParticle this looks like this: //! \code -//! std::unique_ptr<IParticle> GUI::Transform::ToDomain::createIParticle(const SessionItem& +//! std::unique_ptr<IParticle> GUI::Transform::ToCore::createIParticle(const SessionItem& //! item) //! { //! std::unique_ptr<IParticle> P_particle; diff --git a/GUI/Model/Device/DetectorItems.cpp b/GUI/Model/Device/DetectorItems.cpp index b6ccfa8cb50b88e2b8ee04300b34a488e7c81a18..c2ccdbcab76bb018abfa13499e70f68e95d695fa 100644 --- a/GUI/Model/Device/DetectorItems.cpp +++ b/GUI/Model/Device/DetectorItems.cpp @@ -26,7 +26,7 @@ DetectorItem::DetectorItem() {} std::unique_ptr<IDetector2D> DetectorItem::createDetector() const { auto result = createDomainDetector(); - addMasksToDomain(result.get()); + addMasksToCore(result.get()); if (auto resFunc = createResolutionFunction()) result->setResolutionFunction(*resFunc); @@ -56,12 +56,12 @@ SelectionDescriptor<ResolutionFunctionItem*> DetectorItem::resolutionFunctionSel std::unique_ptr<IResolutionFunction2D> DetectorItem::createResolutionFunction() const { - return m_resolutionFunction->createResolutionFunction(axesToDomainUnitsFactor()); + return m_resolutionFunction->createResolutionFunction(axesToCoreUnitsFactor()); } -void DetectorItem::addMasksToDomain(IDetector2D* detector) const +void DetectorItem::addMasksToCore(IDetector2D* detector) const { - const double scale = axesToDomainUnitsFactor(); + const double scale = axesToCoreUnitsFactor(); const auto maskItems = m_maskItems.maskItems(); for (auto maskIter = maskItems.rbegin(); maskIter != maskItems.rend(); maskIter++) { if (auto* roiItem = dynamic_cast<RegionOfInterestItem*>(*maskIter)) { diff --git a/GUI/Model/Device/DetectorItems.h b/GUI/Model/Device/DetectorItems.h index fac4c6f401de0aaa64e9b8a427a1b9656403389b..3ae2b79972dd835c996afadf30094f49cdaab259 100644 --- a/GUI/Model/Device/DetectorItems.h +++ b/GUI/Model/Device/DetectorItems.h @@ -54,7 +54,7 @@ public: T* setResolutionFunctionType(); //! Scales the values provided by axes (to perform deg->rad conversion on the way to domain). - virtual double axesToDomainUnitsFactor() const { return 1.0; } + virtual double axesToCoreUnitsFactor() const { return 1.0; } protected: DetectorItem(); @@ -62,7 +62,7 @@ protected: virtual std::unique_ptr<IDetector2D> createDomainDetector() const = 0; std::unique_ptr<IResolutionFunction2D> createResolutionFunction() const; - void addMasksToDomain(IDetector2D* detector) const; + void addMasksToCore(IDetector2D* detector) const; protected: MaskItems m_maskItems; //!< for creation of domain detector; only filled and relevant in jobs diff --git a/GUI/Model/Device/SphericalDetectorItem.cpp b/GUI/Model/Device/SphericalDetectorItem.cpp index bedda2adafc4cc6b2038d790b566ffbbc9f15b3b..858c82dbdd1409fc52d7e304a38c832ef02cf4a5 100644 --- a/GUI/Model/Device/SphericalDetectorItem.cpp +++ b/GUI/Model/Device/SphericalDetectorItem.cpp @@ -93,7 +93,7 @@ void SphericalDetectorItem::setYSize(size_t ny) m_alphaAxis.setNbins(ny); } -double SphericalDetectorItem::axesToDomainUnitsFactor() const +double SphericalDetectorItem::axesToCoreUnitsFactor() const { return Units::deg; } diff --git a/GUI/Model/Device/SphericalDetectorItem.h b/GUI/Model/Device/SphericalDetectorItem.h index 6982d9052561c9b17cb0ccc0d82fb3391e294fdd..c0ab0144e55c0b3f120ac2c82bb14c167c5c9403 100644 --- a/GUI/Model/Device/SphericalDetectorItem.h +++ b/GUI/Model/Device/SphericalDetectorItem.h @@ -29,7 +29,7 @@ public: void setXSize(size_t nx) override; void setYSize(size_t ny) override; - double axesToDomainUnitsFactor() const override; + double axesToCoreUnitsFactor() const override; AXIS_PROPERTY(phiAxis); AXIS_PROPERTY(alphaAxis); diff --git a/GUI/Model/FromDomain/FromDomain.cpp b/GUI/Model/FromDomain/FromDomain.cpp index 54c60c36d7898b6be0f423f8392ed7c7cdcdc295..2512a4821b85963ba8b2fb98dc9060efe184c5c4 100644 --- a/GUI/Model/FromDomain/FromDomain.cpp +++ b/GUI/Model/FromDomain/FromDomain.cpp @@ -531,7 +531,7 @@ void GUI::Transform::FromDomain::setDetectorResolution(DetectorItem* detector_it p_convfunc->getResolutionFunction2D())) { auto* item = detector_item->setResolutionFunctionType<ResolutionFunction2DGaussianItem>(); - const double scale = 1.0 / detector_item->axesToDomainUnitsFactor(); + const double scale = 1.0 / detector_item->axesToCoreUnitsFactor(); item->setSigmaX(scale * resfunc->sigmaX()); item->setSigmaY(scale * resfunc->sigmaY()); } else { @@ -633,7 +633,7 @@ void GUI::Transform::FromDomain::setDetectorMasks(DetectorItem* detector_item, const IDetector& detector = simulation.detector(); if ((detector.detectorMask() && detector.detectorMask()->hasMasks()) || detector.hasExplicitRegionOfInterest()) { - const double scale = 1.0 / detector_item->axesToDomainUnitsFactor(); + const double scale = 1.0 / detector_item->axesToCoreUnitsFactor(); setMaskContainer(&detector_item->maskItems(), detector, scale); } } diff --git a/GUI/Model/Model/JobQueueData.cpp b/GUI/Model/Model/JobQueueData.cpp index 8c9868199dcf6aa75a7f73b23384c6279e557652..a9a3597565687bd9d6546fb816bfe7200927fbca 100644 --- a/GUI/Model/Model/JobQueueData.cpp +++ b/GUI/Model/Model/JobQueueData.cpp @@ -45,7 +45,7 @@ void JobQueueData::runJob(JobItem* jobItem) throw Error("JobQueueData::runJob() -> Error. ISimulation is already existing."); try { - auto simulation = GUI::Transform::ToDomain::itemsToSimulation( + auto simulation = GUI::Transform::ToCore::itemsToSimulation( jobItem->sampleItem(), jobItem->instrumentItem(), jobItem->simulationOptionsItem()); m_simulations[identifier] = simulation.release(); } catch (const std::exception& ex) { diff --git a/GUI/Model/ToCore/SampleToCore.cpp b/GUI/Model/ToCore/SampleToCore.cpp index 2267f2e9b582b33b6cc9d14e15f411068c9dcad3..f526c837a98336cacc86e0e0f472622c5a8d557a 100644 --- a/GUI/Model/ToCore/SampleToCore.cpp +++ b/GUI/Model/ToCore/SampleToCore.cpp @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/Model/ToCore/SampleToCore.cpp -//! @brief Implements class TransformToDomain +//! @brief Implements class TransformToCore //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -129,7 +129,7 @@ std::unique_ptr<LayerRoughness> itemToLayerRoughness(LayerBasicRoughnessItem* ro } // namespace -std::unique_ptr<MultiLayer> GUI::Transform::ToDomain::itemToSample(const MultiLayerItem& sampleItem) +std::unique_ptr<MultiLayer> GUI::Transform::ToCore::itemToSample(const MultiLayerItem& sampleItem) { auto P_sample = createMultiLayer(sampleItem); for (auto* layerItem : sampleItem.layers()) { diff --git a/GUI/Model/ToCore/SampleToCore.h b/GUI/Model/ToCore/SampleToCore.h index dfa6760b02cb790e483c6b0bafb46b310df2c07b..88c879d264df4fd0a5deb192ace4159b72e7379e 100644 --- a/GUI/Model/ToCore/SampleToCore.h +++ b/GUI/Model/ToCore/SampleToCore.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/Model/ToCore/SampleToCore.h -//! @brief Defines namespace GUI::Transform::ToDomain +//! @brief Defines namespace GUI::Transform::ToCore //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -24,10 +24,10 @@ class MultiLayer; class LayerBasicRoughnessItem; class LayerRoughness; -namespace GUI::Transform::ToDomain { +namespace GUI::Transform::ToCore { std::unique_ptr<MultiLayer> itemToSample(const MultiLayerItem& item); -} // namespace GUI::Transform::ToDomain +} // namespace GUI::Transform::ToCore #endif // BORNAGAIN_GUI_MODEL_TOCORE_SAMPLETOCORE_H diff --git a/GUI/Model/ToCore/SimulationToCore.cpp b/GUI/Model/ToCore/SimulationToCore.cpp index 4589751c7b7dee8d48c0945c69cfd38612cf9543..78197ce647f66ef5a09bf9680e53aa67a7923544 100644 --- a/GUI/Model/ToCore/SimulationToCore.cpp +++ b/GUI/Model/ToCore/SimulationToCore.cpp @@ -172,14 +172,14 @@ DepthProbeSimulation* createDepthProbeSimulation(std::unique_ptr<MultiLayer> sam std::unique_ptr<ISimulation> -GUI::Transform::ToDomain::itemsToSimulation(const MultiLayerItem* sampleItem, +GUI::Transform::ToCore::itemsToSimulation(const MultiLayerItem* sampleItem, const InstrumentItem* instrumentItem, const SimulationOptionsItem& optionsItem) { ASSERT(sampleItem); ASSERT(instrumentItem); - std::unique_ptr<MultiLayer> sample = GUI::Transform::ToDomain::itemToSample(*sampleItem); + std::unique_ptr<MultiLayer> sample = GUI::Transform::ToCore::itemToSample(*sampleItem); std::unique_ptr<ISimulation> result; if (const auto* gisasInstrument = dynamic_cast<const GISASInstrumentItem*>(instrumentItem)) diff --git a/GUI/Model/ToCore/SimulationToCore.h b/GUI/Model/ToCore/SimulationToCore.h index 0f3ba4b91d431bb269420daadfc71c2c616e8629..b0329ac3a592f1c3a873ef1b5c5e1b7bdd1dee3f 100644 --- a/GUI/Model/ToCore/SimulationToCore.h +++ b/GUI/Model/ToCore/SimulationToCore.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/Model/ToCore/SimulationToCore.h -//! @brief Defines namespace GUI::Transform::ToDomain +//! @brief Defines namespace GUI::Transform::ToCore //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -24,7 +24,7 @@ class SimulationOptionsItem; //! Contains functions to build the domain simulation from instrument and sample models. -namespace GUI::Transform::ToDomain { +namespace GUI::Transform::ToCore { //! Creates domain simulation from sample and instrument items. @@ -32,6 +32,6 @@ std::unique_ptr<ISimulation> itemsToSimulation(const MultiLayerItem* sampleItem, const InstrumentItem* instrumentItem, const SimulationOptionsItem& optionsItem); -} // namespace GUI::Transform::ToDomain +} // namespace GUI::Transform::ToCore #endif // BORNAGAIN_GUI_MODEL_TOCORE_SIMULATIONTOCORE_H diff --git a/GUI/View/Fit/FitObjectiveBuilder.cpp b/GUI/View/Fit/FitObjectiveBuilder.cpp index 1d4f20d740b9539b2f00899fdf7509b28f32c7fa..7da8035bdba78b7424eca8860c1fff4a100df436 100644 --- a/GUI/View/Fit/FitObjectiveBuilder.cpp +++ b/GUI/View/Fit/FitObjectiveBuilder.cpp @@ -116,7 +116,7 @@ FitObjectiveBuilder::buildSimulation(const mumufit::Parameters& params) const std::unique_lock<std::mutex> lock(build_simulation_mutex); update_fit_parameters(params); - return GUI::Transform::ToDomain::itemsToSimulation( + return GUI::Transform::ToCore::itemsToSimulation( m_jobItem->sampleItem(), m_jobItem->instrumentItem(), m_jobItem->simulationOptionsItem()); } diff --git a/GUI/View/SampleDesigner/ScriptPanel.cpp b/GUI/View/SampleDesigner/ScriptPanel.cpp index 1cfa725badd23a27ff113f0e2eb5673ca686bb96..7c5f08ca05008dd42b57112309e8b2f9b28895c0 100644 --- a/GUI/View/SampleDesigner/ScriptPanel.cpp +++ b/GUI/View/SampleDesigner/ScriptPanel.cpp @@ -107,7 +107,7 @@ QString ScriptPanel::generateCodeSnippet() QString result; try { - auto sample = GUI::Transform::ToDomain::itemToSample(*m_currentMultiLayerItem); + auto sample = GUI::Transform::ToCore::itemToSample(*m_currentMultiLayerItem); result.append(QString::fromStdString(Py::Export::sampleCode(*sample))); } catch (const std::exception& ex) { QString message = diff --git a/GUI/View/Script/PythonScriptWidget.cpp b/GUI/View/Script/PythonScriptWidget.cpp index cb89cfab9c30f9846ca1127dff4289192b9fa95a..a491ffee492e9567f3d83f0221f3419a427c723c 100644 --- a/GUI/View/Script/PythonScriptWidget.cpp +++ b/GUI/View/Script/PythonScriptWidget.cpp @@ -93,7 +93,7 @@ void PythonScriptWidget::generatePythonScript(const MultiLayerItem* sampleItem, try { const auto simulation = - GUI::Transform::ToDomain::itemsToSimulation(sampleItem, instrumentItem, optionItem); + GUI::Transform::ToCore::itemsToSimulation(sampleItem, instrumentItem, optionItem); QString code = QString::fromStdString(Py::Export::simulationPlotCode(*simulation)); m_textEdit->clear(); diff --git a/Tests/Functional/GUI/Check.cpp b/Tests/Functional/GUI/Check.cpp index 76aaee45de6be8d32676a532ef2f3db12682db41..692497cee5c54a476f49f3674225c75bfd409346 100644 --- a/Tests/Functional/GUI/Check.cpp +++ b/Tests/Functional/GUI/Check.cpp @@ -41,7 +41,7 @@ std::unique_ptr<ISimulation> indirectSimulation(const ISimulation& sim) std::unique_ptr<SimulationOptionsItem> optionsItem( GUI::Transform::FromDomain::createSimulationOptions(sim)); - return GUI::Transform::ToDomain::itemsToSimulation( + return GUI::Transform::ToCore::itemsToSimulation( sampleItem.get(), instrumentItems->collectedItems().front(), *optionsItem); } diff --git a/Tests/Unit/GUI/TestParaCrystalItems.cpp b/Tests/Unit/GUI/TestParaCrystalItems.cpp index d6e6c29b809f817428323baaf725018386bf0bd5..7257326f6f13c0854a564a250b6c040048566b3e 100644 --- a/Tests/Unit/GUI/TestParaCrystalItems.cpp +++ b/Tests/Unit/GUI/TestParaCrystalItems.cpp @@ -12,7 +12,7 @@ class TestParaCrystalItems : public ::testing::Test { }; -TEST_F(TestParaCrystalItems, Para2DFromToDomain) +TEST_F(TestParaCrystalItems, Para2DFromToCore) { double length1(10.0), length2(20.0), angle(45.0), xi(90.0); double damping_length(1000.0), domain_size1(50.0), domain_size2(100.0);