From a3707ec0046c8da05fdce237d33f3dc31ba083ea Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 21 Apr 2021 11:25:31 +0200
Subject: [PATCH] rm DetectorUtils; sole fct to local namespace

---
 Core/Export/SimulationToPython.cpp | 15 +++++++++++++--
 Device/Detector/DetectorUtils.cpp  | 27 ---------------------------
 Device/Detector/DetectorUtils.h    | 26 --------------------------
 3 files changed, 13 insertions(+), 55 deletions(-)
 delete mode 100644 Device/Detector/DetectorUtils.cpp
 delete mode 100644 Device/Detector/DetectorUtils.h

diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp
index f1ca9dcd12b..f76de21c481 100644
--- a/Core/Export/SimulationToPython.cpp
+++ b/Core/Export/SimulationToPython.cpp
@@ -28,7 +28,6 @@
 #include "Core/Simulation/SpecularSimulation.h"
 #include "Device/Beam/FootprintGauss.h"
 #include "Device/Beam/FootprintSquare.h"
-#include "Device/Detector/DetectorUtils.h"
 #include "Device/Detector/RectangularDetector.h"
 #include "Device/Detector/RegionOfInterest.h"
 #include "Device/Detector/SphericalDetector.h"
@@ -42,6 +41,7 @@
 using pyfmt::indent;
 
 namespace {
+
 //! Returns a function that converts a coordinate to a Python code snippet with appropiate unit
 std::function<std::string(double)> printFunc(const IDetector* detector)
 {
@@ -52,6 +52,17 @@ std::function<std::string(double)> printFunc(const IDetector* detector)
     throw std::runtime_error("SimulationToPython::defineMasks() -> Error. Unknown detector units.");
 }
 
+bool isQuadraticDetector(const IDetector2D& det)
+{
+    ASSERT(det.dimension() == 2);
+    if (det.axis(0).size() != det.axis(1).size())
+        return false;
+    if (std::abs(det.axis(0).span() - det.axis(1).span())
+        > 1e-12 * (det.axis(0).span() + det.axis(1).span()))
+        return false;
+    return true;
+}
+
 //! returns true if it is (0, -1, 0) vector
 bool isDefaultDirection(const kvector_t direction)
 {
@@ -138,7 +149,7 @@ std::string defineDetector(const ISimulation* simulation)
     if (const auto* const det = dynamic_cast<const SphericalDetector*>(detector)) {
         ASSERT(det->dimension() == 2);
         result << indent() << "detector = ba.SphericalDetector(";
-        if (DetectorUtils::isQuadratic(*det)) {
+        if (isQuadraticDetector(*det)) {
             result << det->axis(0).size() << ", " << pyfmt::printDegrees(det->axis(0).span())
                    << ", " << pyfmt::printDegrees(det->axis(0).center()) << ", "
                    << pyfmt::printDegrees(det->axis(1).center());
diff --git a/Device/Detector/DetectorUtils.cpp b/Device/Detector/DetectorUtils.cpp
deleted file mode 100644
index 683170b0967..00000000000
--- a/Device/Detector/DetectorUtils.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      Device/Detector/DetectorUtils.cpp
-//! @brief     Implements namespace DetectorUtils.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#include "Device/Detector/DetectorUtils.h"
-#include "Device/Detector/IDetector2D.h"
-
-bool DetectorUtils::isQuadratic(const IDetector2D& det)
-{
-    ASSERT(det.dimension() == 2);
-    if (det.axis(0).size() != det.axis(1).size())
-        return false;
-    if (std::abs(det.axis(0).span() - det.axis(1).span())
-        > 1e-12 * (det.axis(0).span() + det.axis(1).span()))
-        return false;
-    return true;
-}
diff --git a/Device/Detector/DetectorUtils.h b/Device/Detector/DetectorUtils.h
deleted file mode 100644
index 9fd0672099f..00000000000
--- a/Device/Detector/DetectorUtils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      Device/Detector/DetectorUtils.h
-//! @brief     Defines namespace DetectorUtils.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#ifndef BORNAGAIN_DEVICE_DETECTOR_DETECTORUTILS_H
-#define BORNAGAIN_DEVICE_DETECTOR_DETECTORUTILS_H
-
-class IDetector2D;
-
-namespace DetectorUtils {
-
-bool isQuadratic(const IDetector2D& det);
-
-} // namespace DetectorUtils
-
-#endif // BORNAGAIN_DEVICE_DETECTOR_DETECTORUTILS_H
-- 
GitLab