From ffeae7432331252ef351d84fb29ae306d4f2eabe Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Tue, 24 Mar 2020 18:29:10 +0100
Subject: [PATCH] Fix includes; Included before through BL/Error.h.

StringTools.h and FileTools.h mostly. fstream in few places.
---
 Applications/ApplicationsLib/ProjectData.cpp          |  3 +--
 Applications/DataExplorer/VtkVis/VtkRaster.cpp        |  3 ++-
 Applications/FileIO/GocadIO/GocadSGridReader.cpp      |  4 ++--
 Applications/Utils/FileConverter/Mesh2Raster.cpp      |  9 +++++----
 .../Utils/ModelPreparation/PartitionMesh/Metis.cpp    |  2 +-
 .../PartitionMesh/NodeWiseMeshPartitioner.cpp         |  5 ++---
 BaseLib/Algorithm.h                                   |  2 ++
 ChemistryLib/CreateChemicalSolverInterface.cpp        |  6 ++++--
 ChemistryLib/PhreeqcIO.cpp                            |  9 +++++----
 ProcessLib/SurfaceFlux/SurfaceFluxData.h              |  4 ++--
 Tests/FileIO/TestBoostGmlInterface.cpp                | 11 +++++------
 Tests/FileIO_Qt/TestQtGmlInterface.cpp                | 11 +++++------
 Tests/GeoLib/IO/TestGLIReader.cpp                     | 10 +++++-----
 13 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp
index c009113176a..252444ea3e2 100644
--- a/Applications/ApplicationsLib/ProjectData.cpp
+++ b/Applications/ApplicationsLib/ProjectData.cpp
@@ -25,7 +25,7 @@
 #include "BaseLib/Algorithm.h"
 #include "BaseLib/ConfigTree.h"
 #include "BaseLib/FileTools.h"
-
+#include "BaseLib/StringTools.h"
 #include "GeoLib/GEOObjects.h"
 #include "MaterialLib/MPL/CreateMedium.h"
 #include "MathLib/Curve/CreatePiecewiseLinearCurve.h"
@@ -33,7 +33,6 @@
 #include "MeshGeoToolsLib/CreateSearchLength.h"
 #include "MeshGeoToolsLib/SearchLength.h"
 #include "MeshLib/Mesh.h"
-
 #include "NumLib/ODESolver/ConvergenceCriterion.h"
 #include "ProcessLib/CreateJacobianAssembler.h"
 #include "ProcessLib/DeactivatedSubdomain.h"
diff --git a/Applications/DataExplorer/VtkVis/VtkRaster.cpp b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
index 52bf15f7f8b..592cea37641 100644
--- a/Applications/DataExplorer/VtkVis/VtkRaster.cpp
+++ b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
@@ -34,9 +34,10 @@
 #endif
 
 #include <memory>
-#include "BaseLib/Logging.h"
 
 #include "Applications/FileIO/AsciiRasterInterface.h"
+#include "BaseLib/FileTools.h"
+#include "BaseLib/Logging.h"
 #include "BaseLib/StringTools.h"
 #include "GeoLib/Raster.h"
 
diff --git a/Applications/FileIO/GocadIO/GocadSGridReader.cpp b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
index e36974c3748..b7787bc7d28 100644
--- a/Applications/FileIO/GocadIO/GocadSGridReader.cpp
+++ b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
@@ -10,13 +10,13 @@
 #include "GocadSGridReader.h"
 
 #include <algorithm>
+#include <boost/tokenizer.hpp>
 #include <cstddef>
 #include <fstream>
 #include <iostream>
 #include <sstream>
 
-#include <boost/tokenizer.hpp>
-
+#include "BaseLib/FileTools.h"
 #include "MeshLib/Elements/Hex.h"
 #include "MeshLib/Elements/Quad.h"
 #include "MeshLib/Mesh.h"
diff --git a/Applications/Utils/FileConverter/Mesh2Raster.cpp b/Applications/Utils/FileConverter/Mesh2Raster.cpp
index b74d64d0cea..d8506ed5c9a 100644
--- a/Applications/Utils/FileConverter/Mesh2Raster.cpp
+++ b/Applications/Utils/FileConverter/Mesh2Raster.cpp
@@ -8,18 +8,19 @@
  *              http://www.opengeosys.org/LICENSE.txt
  */
 
+#include <tclap/CmdLine.h>
+
+#include <fstream>
 #include <memory>
 #include <string>
 
-#include <tclap/CmdLine.h>
-
-#include "InfoLib/GitInfo.h"
 #include "GeoLib/AABB.h"
+#include "InfoLib/GitInfo.h"
 #include "MeshLib/IO/readMeshFromFile.h"
 #include "MeshLib/Mesh.h"
+#include "MeshLib/MeshEditing/ProjectPointOnMesh.h"
 #include "MeshLib/MeshSearch/MeshElementGrid.h"
 #include "MeshLib/Node.h"
-#include "MeshLib/MeshEditing/ProjectPointOnMesh.h"
 
 int main(int argc, char* argv[])
 {
diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/Metis.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/Metis.cpp
index 2dec1a4d2bc..d6163759c39 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/Metis.cpp
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/Metis.cpp
@@ -9,7 +9,7 @@
  *
  */
 
-#include <iostream>
+#include <fstream>
 
 #include "BaseLib/Error.h"
 #include "MeshLib/Elements/Element.h"
diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
index bde23546675..ef0ee9fbe9a 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
@@ -18,11 +18,10 @@
 #include <numeric>
 #include <unordered_map>
 
-#include "BaseLib/Logging.h"
-
 #include "BaseLib/Error.h"
+#include "BaseLib/FileTools.h"
+#include "BaseLib/Logging.h"
 #include "BaseLib/Stream.h"
-
 #include "MeshLib/IO/VtkIO/VtuInterface.h"
 
 namespace ApplicationUtils
diff --git a/BaseLib/Algorithm.h b/BaseLib/Algorithm.h
index 66c82f8e372..38461a984cc 100644
--- a/BaseLib/Algorithm.h
+++ b/BaseLib/Algorithm.h
@@ -15,7 +15,9 @@
 #include <cassert>
 #include <typeindex>
 #include <typeinfo>
+
 #include "Error.h"
+#include "StringTools.h"
 
 namespace BaseLib
 {
diff --git a/ChemistryLib/CreateChemicalSolverInterface.cpp b/ChemistryLib/CreateChemicalSolverInterface.cpp
index 9203c2dc38c..a69a5f0d481 100644
--- a/ChemistryLib/CreateChemicalSolverInterface.cpp
+++ b/ChemistryLib/CreateChemicalSolverInterface.cpp
@@ -9,6 +9,10 @@
  */
 
 #include "CreateChemicalSolverInterface.h"
+
+#include <iphreeqc/src/src/phreeqcpp/cxxKinetics.h>
+
+#include "BaseLib/FileTools.h"
 #include "Common/CreateReactionRate.h"
 #include "MeshLib/Mesh.h"
 #include "PhreeqcIO.h"
@@ -34,8 +38,6 @@
 #include "PhreeqcKernelData/CreateKineticReactant.h"
 #include "PhreeqcKernelData/ReactionRate.h"
 
-#include <iphreeqc/src/src/phreeqcpp/cxxKinetics.h>
-
 namespace
 {
 std::string parseDatabasePath(BaseLib::ConfigTree const& config)
diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp
index 54735950347..c196dc42380 100644
--- a/ChemistryLib/PhreeqcIO.cpp
+++ b/ChemistryLib/PhreeqcIO.cpp
@@ -8,14 +8,17 @@
  *
  */
 
+#include "PhreeqcIO.h"
+
+#include <iphreeqc/src/src/IPhreeqc.h>
+
 #include <boost/algorithm/string.hpp>
 #include <cmath>
-#include <iostream>
+#include <fstream>
 
 #include "BaseLib/Algorithm.h"
 #include "BaseLib/ConfigTreeUtil.h"
 #include "MeshLib/Mesh.h"
-#include "PhreeqcIO.h"
 #include "PhreeqcIOData/AqueousSolution.h"
 #include "PhreeqcIOData/Dump.h"
 #include "PhreeqcIOData/EquilibriumReactant.h"
@@ -26,8 +29,6 @@
 #include "PhreeqcIOData/Surface.h"
 #include "PhreeqcIOData/UserPunch.h"
 
-#include <iphreeqc/src/src/IPhreeqc.h>
-
 namespace ChemistryLib
 {
 namespace PhreeqcIOData
diff --git a/ProcessLib/SurfaceFlux/SurfaceFluxData.h b/ProcessLib/SurfaceFlux/SurfaceFluxData.h
index af4e21ed62b..d103e7a7e0e 100644
--- a/ProcessLib/SurfaceFlux/SurfaceFluxData.h
+++ b/ProcessLib/SurfaceFlux/SurfaceFluxData.h
@@ -10,11 +10,11 @@
 
 #pragma once
 
-#include "BaseLib/Logging.h"
-
 #include <memory>
 #include <string>
 
+#include "BaseLib/FileTools.h"
+#include "BaseLib/Logging.h"
 #include "MeshLib/IO/readMeshFromFile.h"
 // TODO used for output, if output classes are ready this has to be changed
 #include "MeshLib/IO/writeMeshToFile.h"
diff --git a/Tests/FileIO/TestBoostGmlInterface.cpp b/Tests/FileIO/TestBoostGmlInterface.cpp
index acdeca0fd1e..3b8ea261eee 100644
--- a/Tests/FileIO/TestBoostGmlInterface.cpp
+++ b/Tests/FileIO/TestBoostGmlInterface.cpp
@@ -14,14 +14,13 @@
 
 #include <cstdio>
 
-#include "gtest/gtest.h"
-
+#include "BaseLib/StringTools.h"
+#include "GeoLib/GEOObjects.h"
+#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
+#include "InfoLib/TestInfo.h"
 #include "Tests/FileIO/TestGmlInterface.h"
-
 #include "filesystem.h"
-#include "InfoLib/TestInfo.h"
-#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
-#include "GeoLib/GEOObjects.h"
+#include "gtest/gtest.h"
 
 TEST_F(TestGmlInterface, BoostXmlGmlWriterReaderTest)
 {
diff --git a/Tests/FileIO_Qt/TestQtGmlInterface.cpp b/Tests/FileIO_Qt/TestQtGmlInterface.cpp
index bf361f4e7af..b033576b4ea 100644
--- a/Tests/FileIO_Qt/TestQtGmlInterface.cpp
+++ b/Tests/FileIO_Qt/TestQtGmlInterface.cpp
@@ -14,14 +14,13 @@
 
 #include <cstdio>
 
-#include "gtest/gtest.h"
-
+#include "BaseLib/StringTools.h"
+#include "GeoLib/GEOObjects.h"
+#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
+#include "InfoLib/TestInfo.h"
 #include "Tests/FileIO/TestGmlInterface.h"
-
 #include "filesystem.h"
-#include "InfoLib/TestInfo.h"
-#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
-#include "GeoLib/GEOObjects.h"
+#include "gtest/gtest.h"
 
 TEST_F(TestGmlInterface, QtXmlGmlWriterReaderTest)
 {
diff --git a/Tests/GeoLib/IO/TestGLIReader.cpp b/Tests/GeoLib/IO/TestGLIReader.cpp
index d71c3f1aa47..9058d7d8b91 100644
--- a/Tests/GeoLib/IO/TestGLIReader.cpp
+++ b/Tests/GeoLib/IO/TestGLIReader.cpp
@@ -10,15 +10,15 @@
  *
  */
 
-#include <fstream>
 #include <cstdio>
+#include <fstream>
 
-#include "gtest/gtest.h"
-
-#include "filesystem.h"
-#include "InfoLib/TestInfo.h"
 #include "Applications/FileIO/Legacy/OGSIOVer4.h"
+#include "BaseLib/StringTools.h"
 #include "GeoLib/GEOObjects.h"
+#include "InfoLib/TestInfo.h"
+#include "filesystem.h"
+#include "gtest/gtest.h"
 
 class OGSIOVer4InterfaceTest : public ::testing::Test
 {
-- 
GitLab