From 7a39fecc6922ffae3e1a2b1ccd0f4fb86e001d1d Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de>
Date: Sun, 12 Jun 2016 12:35:42 +0200
Subject: [PATCH] copy edit while reading

---
 Core/StandardSamples/SampleBuilderFactory.cpp |  3 ++-
 Core/TestMachinery/PyScriptFutest.cpp         | 20 ++++++++-----------
 Core/Tools/PyGenTools.h                       |  2 +-
 Fit/StandardFits/IMinimizerFutest.cpp         |  8 ++++----
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/Core/StandardSamples/SampleBuilderFactory.cpp b/Core/StandardSamples/SampleBuilderFactory.cpp
index 3e4a8e1e6d9..2361104ff46 100644
--- a/Core/StandardSamples/SampleBuilderFactory.cpp
+++ b/Core/StandardSamples/SampleBuilderFactory.cpp
@@ -229,9 +229,10 @@ SampleBuilderFactory::SampleBuilderFactory()
         "LayersWithAbsorptionBuilder",
         build<LayersWithAbsorptionBuilder>,
         "3 layer system with absorption");
-
 }
 
+//! Retrieves a SampleBuilder from the registry, does the build, and returns the result.
+
 ISample *SampleBuilderFactory::createSample(const std::string& name)
 {
     return createItem(name)->buildSample();
diff --git a/Core/TestMachinery/PyScriptFutest.cpp b/Core/TestMachinery/PyScriptFutest.cpp
index 7c3283a218b..d8e406a4023 100644
--- a/Core/TestMachinery/PyScriptFutest.cpp
+++ b/Core/TestMachinery/PyScriptFutest.cpp
@@ -13,7 +13,11 @@
 //
 // ************************************************************************** //
 
-#include "PyScriptFutest.h"
+#include <memory>
+#include <fstream>
+#include <cstdio>
+#include <cassert>
+
 #include "SimulationFactory.h"
 #include "IntensityDataIOFactory.h"
 #include "IntensityDataFunctions.h"
@@ -21,9 +25,7 @@
 #include "BAPython.h"
 #include "FileSystem.h"
 #include "Utils.h"
-#include <memory>
-#include <fstream>
-#include <cstdio>
+#include "PyScriptFutest.h"
 
 namespace {
 const std::string directory_name_for_failed_tests = "00_failed_tests";
@@ -50,10 +52,7 @@ PyScriptFutest::~PyScriptFutest()
 
 void PyScriptFutest::runTest()
 {
-    if (!m_reference_simulation)
-        throw NullPointerException(
-            "AdvancedGUIFutest::runTest() -> Error. Uninitialized simulation object.");
-
+    assert(m_reference_simulation);
     m_reference_simulation->runSimulation();
 
     // Generate contents of Python script
@@ -70,7 +69,7 @@ void PyScriptFutest::runTest()
     pythonFile << ostr.str();
     pythonFile.close();
 
-    std::string command = std::string(BORNAGAIN_PYTHON_EXE ) + " " + m_pyscript_filename;
+    std::string command = std::string(BORNAGAIN_PYTHON_EXE) + " " + m_pyscript_filename;
     std::cout << "Core simulation will be compared with " << m_output_filename <<
         " generated by command '" << command << "'\n";
     std::system(command.c_str()); // run python script, ignore return value
@@ -80,18 +79,15 @@ int PyScriptFutest::analyseResults()
 {
     const std::unique_ptr<OutputData<double> > P_domain_data(
         IntensityDataIOFactory::readOutputData(m_output_filename+".int"));
-
     const std::unique_ptr<OutputData<double> > P_reference_data(
         m_reference_simulation->getDetectorIntensity());
     m_difference = IntensityDataFunctions::getRelativeDifference(*P_domain_data, *P_reference_data);
     m_result = m_difference > m_threshold ? FAILED_DIFF : SUCCESS;
-
     if (m_result != SUCCESS) {
         // Move failed Python script to failed tests directory
         Utils::FileSystem::CreateDirectory(directory_name_for_failed_tests);
         std::rename( m_pyscript_filename.c_str(), getPyScriptFileNameAndPath().c_str());
     }
-
     return m_result;
 }
 
diff --git a/Core/Tools/PyGenTools.h b/Core/Tools/PyGenTools.h
index 55a57243986..9472d21e7e0 100644
--- a/Core/Tools/PyGenTools.h
+++ b/Core/Tools/PyGenTools.h
@@ -26,7 +26,7 @@ namespace PyGenTools {
         class GISASSimulation* simulation, const std::string& output_filename);
     BA_CORE_API_ std::string getRepresentation(const class IDistribution1D* distribution);
     BA_CORE_API_ std::string getRepresentation(
-        const std::string &indent, const class Geometry::IShape2D* ishape, bool mask_value);
+        const std::string& indent, const class Geometry::IShape2D* ishape, bool mask_value);
     BA_CORE_API_ std::string printBool(double value);
     BA_CORE_API_ std::string printDouble(double input);
     BA_CORE_API_ std::string printNm(double input);
diff --git a/Fit/StandardFits/IMinimizerFutest.cpp b/Fit/StandardFits/IMinimizerFutest.cpp
index 6c63faa007a..f5d8408397a 100644
--- a/Fit/StandardFits/IMinimizerFutest.cpp
+++ b/Fit/StandardFits/IMinimizerFutest.cpp
@@ -80,7 +80,7 @@ int IMinimizerFutest::analyseResults()
                      % m_parameters[i].m_found_value % diff;
     }
 
-    std::cout << getName() << " | " << getDescription() << " | " << getTestResultString() << std::endl;
+    std::cout << getName() << " | " << getDescription() << " | " << getTestResultString() << "\n";
 
     return m_result;
 }
@@ -100,10 +100,10 @@ std::unique_ptr<FitSuite> IMinimizerFutest::createFitSuite()
     minimizer->getOptions()->setMaxIterations(200);
     result->setMinimizer(minimizer);
     for (size_t i = 0; i < m_parameters.size(); ++i) {
-        result->addFitParameter(m_parameters[i].m_name, m_parameters[i].m_start_value,
-                                AttLimits::lowerLimited(0.01), m_parameters[i].m_start_value / 100.);
+        result->addFitParameter(
+            m_parameters[i].m_name, m_parameters[i].m_start_value,
+            AttLimits::lowerLimited(0.01), m_parameters[i].m_start_value / 100.);
     }
-
     return std::move(result);
 }
 
-- 
GitLab