From 5fef738f6d84f4037caa2b4e4c2a82391a170506 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Thu, 26 May 2022 13:43:43 +0200
Subject: [PATCH] ctd

---
 GUI/Model/BaseItem/SessionItem.h           | 4 ++--
 GUI/Model/Device/DetectorItems.cpp         | 8 ++++----
 GUI/Model/Device/DetectorItems.h           | 4 ++--
 GUI/Model/Device/SphericalDetectorItem.cpp | 2 +-
 GUI/Model/Device/SphericalDetectorItem.h   | 2 +-
 GUI/Model/FromDomain/FromDomain.cpp        | 4 ++--
 GUI/Model/Model/JobQueueData.cpp           | 2 +-
 GUI/Model/ToCore/SampleToCore.cpp          | 4 ++--
 GUI/Model/ToCore/SampleToCore.h            | 6 +++---
 GUI/Model/ToCore/SimulationToCore.cpp      | 4 ++--
 GUI/Model/ToCore/SimulationToCore.h        | 6 +++---
 GUI/View/Fit/FitObjectiveBuilder.cpp       | 2 +-
 GUI/View/SampleDesigner/ScriptPanel.cpp    | 2 +-
 GUI/View/Script/PythonScriptWidget.cpp     | 2 +-
 Tests/Functional/GUI/Check.cpp             | 2 +-
 Tests/Unit/GUI/TestParaCrystalItems.cpp    | 2 +-
 16 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/GUI/Model/BaseItem/SessionItem.h b/GUI/Model/BaseItem/SessionItem.h
index 4e0d3430459..93f9b77e598 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 b6ccfa8cb50..c2ccdbcab76 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 fac4c6f401d..3ae2b79972d 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 bedda2adafc..858c82dbdd1 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 6982d905256..c0ab0144e55 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 54c60c36d78..2512a4821b8 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 8c9868199dc..a9a35975656 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 2267f2e9b58..f526c837a98 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 dfa6760b02c..88c879d264d 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 4589751c7b7..78197ce647f 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 0f3ba4b91d4..b0329ac3a59 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 1d4f20d740b..7da8035bdba 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 1cfa725badd..7c5f08ca050 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 cb89cfab9c3..a491ffee492 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 76aaee45de6..692497cee5c 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 d6e6c29b809..7257326f6f1 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);
-- 
GitLab