From b0d7a9558985adcb5f116413232d34c9e84ebff2 Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Thu, 19 Oct 2017 10:43:35 +0200 Subject: [PATCH] - delete unused old src (moved to VirtualFluidsBasics) - fix includes --- .../geometries/Geometry/Geometry.cu | 2 +- .../grid/GridBuilder/GridBuilderImp.cpp | 4 +- .../GridWrapperCPU/GridWrapperCPU.cpp | 2 +- .../GridWrapperGPU/GridWrapperGPU.cpp | 2 +- .../grid/partition/Partition.cpp | 2 +- .../io/GridVTKWriter/GridVTKWriter.cpp | 2 +- .../io/STLReaderWriter/STLReader.cpp | 2 +- .../io/STLReaderWriter/STLWriter.cpp | 2 +- .../Launchparameter/LaunchParameter.cu | 2 +- src/VirtualFluids_GPU/LBM/Simulation.cpp | 4 +- src/VirtualFluids_GPU/Output/WriteData.cpp | 2 +- src/input/CMakeLists.txt | 26 -- src/input/ConfigInput/ConfigInput.cpp | 263 ------------------ src/input/ConfigInput/ConfigInput.h | 48 ---- src/input/ConfigInput/ConfigInputTest.cpp | 144 ---------- src/input/ConfigInput/package.include | 0 src/input/Input.cpp | 23 -- src/input/Input.h | 22 -- src/input/Input_EXPORT.h | 42 --- src/input/JsonInput/JsonInput.cpp | 66 ----- src/input/JsonInput/JsonInput.h | 32 --- src/input/JsonInput/JsonInputTest.cpp | 117 -------- src/input/JsonInput/package.include | 0 src/input/package.include | 0 src/logger/CMakeLists.txt | 26 -- src/logger/Logger.cpp | 44 --- src/logger/Logger.h | 50 ---- src/logger/Logger_EXPORT.h | 42 --- src/logger/implementations/LoggerImp.cpp | 66 ----- src/logger/implementations/LoggerImp.h | 40 --- src/logger/implementations/LoggerTest.cpp | 27 -- src/logger/implementations/package.include | 0 src/logger/package.include | 0 src/utilities/CMakeLists.txt | 26 -- src/utilities/StringUtil.cpp | 116 -------- src/utilities/StringUtil.h | 40 --- src/utilities/StringUtilTest.cpp | 116 -------- src/utilities/package.include | 0 src/utilities/utilities_EXPORT.h | 42 --- targets/apps/HULC/CMakeLists.txt | 2 +- targets/apps/HULC/main.cpp | 8 +- 41 files changed, 18 insertions(+), 1436 deletions(-) delete mode 100644 src/input/CMakeLists.txt delete mode 100644 src/input/ConfigInput/ConfigInput.cpp delete mode 100644 src/input/ConfigInput/ConfigInput.h delete mode 100644 src/input/ConfigInput/ConfigInputTest.cpp delete mode 100644 src/input/ConfigInput/package.include delete mode 100644 src/input/Input.cpp delete mode 100644 src/input/Input.h delete mode 100644 src/input/Input_EXPORT.h delete mode 100644 src/input/JsonInput/JsonInput.cpp delete mode 100644 src/input/JsonInput/JsonInput.h delete mode 100644 src/input/JsonInput/JsonInputTest.cpp delete mode 100644 src/input/JsonInput/package.include delete mode 100644 src/input/package.include delete mode 100644 src/logger/CMakeLists.txt delete mode 100644 src/logger/Logger.cpp delete mode 100644 src/logger/Logger.h delete mode 100644 src/logger/Logger_EXPORT.h delete mode 100644 src/logger/implementations/LoggerImp.cpp delete mode 100644 src/logger/implementations/LoggerImp.h delete mode 100644 src/logger/implementations/LoggerTest.cpp delete mode 100644 src/logger/implementations/package.include delete mode 100644 src/logger/package.include delete mode 100644 src/utilities/CMakeLists.txt delete mode 100644 src/utilities/StringUtil.cpp delete mode 100644 src/utilities/StringUtil.h delete mode 100644 src/utilities/StringUtilTest.cpp delete mode 100644 src/utilities/package.include delete mode 100644 src/utilities/utilities_EXPORT.h diff --git a/src/GridGenerator/geometries/Geometry/Geometry.cu b/src/GridGenerator/geometries/Geometry/Geometry.cu index 0282f6a81..da5402ac4 100644 --- a/src/GridGenerator/geometries/Geometry/Geometry.cu +++ b/src/GridGenerator/geometries/Geometry/Geometry.cu @@ -5,7 +5,7 @@ #include <GridGenerator/utilities/triangleNeighborFinder/TriangleNeighborFinder.h> #include <time.h> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> #include "Serialization/GeometryMemento.h" #include <GridGenerator/geometries/Triangle/Serialization/TriangleMemento.h> diff --git a/src/GridGenerator/grid/GridBuilder/GridBuilderImp.cpp b/src/GridGenerator/grid/GridBuilder/GridBuilderImp.cpp index e1843e150..69f559e2e 100644 --- a/src/GridGenerator/grid/GridBuilder/GridBuilderImp.cpp +++ b/src/GridGenerator/grid/GridBuilder/GridBuilderImp.cpp @@ -24,12 +24,12 @@ #include <GridGenerator/geometries/Arrow/ArrowImp.h> #include <GridGenerator/utilities/Transformator/ArrowTransformator.h> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> #include <GridGenerator/grid/GridBuilder/GridCpuBuilder/GridCpuBuilder.h> #include <GridGenerator/grid/GridBuilder/GridGpuBuilder/GridGpuBuilder.h> -#include <utilities/StringUtil.h> +#include <utilities/StringUtil/StringUtil.h> #include <GridGenerator/geometries/Geometry/Serialization/GeometryMemento.h> diff --git a/src/GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.cpp b/src/GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.cpp index 10f745bbb..dd25e2914 100644 --- a/src/GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.cpp +++ b/src/GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.cpp @@ -14,7 +14,7 @@ #include <GridGenerator/geometries/Triangle/Triangle.cuh> #include <GridGenerator/geometries/Geometry/Geometry.cuh> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> GridWrapperCPU::GridWrapperCPU(BoundingBox<int> &box, std::string direction) diff --git a/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp b/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp index d0f4587d6..9a555ff56 100644 --- a/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp +++ b/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp @@ -12,7 +12,7 @@ #include <GridGenerator/grid/kernel/runGridKernelGPU.cuh> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> GridWrapperGPU::GridWrapperGPU(BoundingBox<int> &channel, std::string d3Qxx) diff --git a/src/GridGenerator/grid/partition/Partition.cpp b/src/GridGenerator/grid/partition/Partition.cpp index e04aba572..40624dca6 100644 --- a/src/GridGenerator/grid/partition/Partition.cpp +++ b/src/GridGenerator/grid/partition/Partition.cpp @@ -13,7 +13,7 @@ #include <GridGenerator/io/VTKWriterWrapper/UnstructuredGridWrapper.h> #include <GridGenerator/utilities/Transformator/TransformatorImp.h> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> int Partition::calcEdgesFromGraph(const Grid &grid) { diff --git a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp index 1eb5b77c0..05a45d56c 100644 --- a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp +++ b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp @@ -6,7 +6,7 @@ #include <memory> #include <GridGenerator/utilities/Transformator/Transformator.h> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> #include <GridGenerator/grid/Grid.cuh> #include <GridGenerator/geometries/Vertex/Vertex.cuh> diff --git a/src/GridGenerator/io/STLReaderWriter/STLReader.cpp b/src/GridGenerator/io/STLReaderWriter/STLReader.cpp index 7e57f7997..d1018d402 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLReader.cpp +++ b/src/GridGenerator/io/STLReaderWriter/STLReader.cpp @@ -12,7 +12,7 @@ #include <GridGenerator/geometries/BoundingBox/BoundingBox.cuh> #include <GridGenerator/geometries/Geometry/Geometry.cuh> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> std::vector<Triangle> STLReader::readSTL(const std::string& name, const Transformator& trans) { diff --git a/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp b/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp index 1a5ebb713..e4af8692e 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp +++ b/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp @@ -10,7 +10,7 @@ #include <GridGenerator/geometries/Vertex/Vertex.cuh> #include <GridGenerator/geometries/Triangle/Triangle.cuh> -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> void STLWriter::writeSTL(std::vector<Triangle> &vec, const std::string &name, std::shared_ptr<const Transformator> trans, bool writeBinary) diff --git a/src/GridGenerator/utilities/Launchparameter/LaunchParameter.cu b/src/GridGenerator/utilities/Launchparameter/LaunchParameter.cu index a4ee3fcc2..c4132cb07 100644 --- a/src/GridGenerator/utilities/Launchparameter/LaunchParameter.cu +++ b/src/GridGenerator/utilities/Launchparameter/LaunchParameter.cu @@ -1,5 +1,5 @@ #include "LaunchParameter.cuh" -#include <Logger/Logger.h> +#include <utilities/logger/Logger.h> #include "GridGenerator/global.h" #define MAXBLOCKSIZE 65535 diff --git a/src/VirtualFluids_GPU/LBM/Simulation.cpp b/src/VirtualFluids_GPU/LBM/Simulation.cpp index e81dbdccc..03865afe1 100644 --- a/src/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/VirtualFluids_GPU/LBM/Simulation.cpp @@ -17,8 +17,8 @@ #include "Output/WriteData.h" #include "Init/InitLattice.h" -#include "Logger/Logger.h" -#include <utilities/StringUtil.h> +#include <utilities/logger/Logger.h> +#include <utilities/StringUtil/StringUtil.h> diff --git a/src/VirtualFluids_GPU/Output/WriteData.cpp b/src/VirtualFluids_GPU/Output/WriteData.cpp index aa3949aa6..6e0732ce4 100644 --- a/src/VirtualFluids_GPU/Output/WriteData.cpp +++ b/src/VirtualFluids_GPU/Output/WriteData.cpp @@ -5,7 +5,7 @@ #include <sstream> #include <cmath> -#include <utilities/StringUtil.h> +#include <utilities/StringUtil/StringUtil.h> #include "Parameter/Parameter.h" diff --git a/src/input/CMakeLists.txt b/src/input/CMakeLists.txt deleted file mode 100644 index 8630b06d9..000000000 --- a/src/input/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -############################################################# -### PROJECT ### -############################################################# -set(projectName "Input") -project(${projectName}) -MESSAGE(STATUS "Build project \"${projectName}\":") - -############################################################# -### GENERAL MACROS ### -############################################################# -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTarget.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTargetUtilities.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/EndingsToCollect.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FileUtilities.cmake) - -############################################################# -### GENERAL SETTINGS ### -############################################################# -set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") -sharedLibs() - -############################################################# -### SUBDIRECTORIES ### -############################################################# -add_subdirectory(applications/Input) -add_subdirectory(applications/Input.Test) \ No newline at end of file diff --git a/src/input/ConfigInput/ConfigInput.cpp b/src/input/ConfigInput/ConfigInput.cpp deleted file mode 100644 index 75559844a..000000000 --- a/src/input/ConfigInput/ConfigInput.cpp +++ /dev/null @@ -1,263 +0,0 @@ -#include "ConfigInput.h" -#include <errno.h> -#include <algorithm> -#include <sstream> -#include <iostream> -#include <string> - -#define COMMENT '#' - -namespace input -{ - // Trim the given characters from the beginning and end of a string. - // the default is to trim whitespace. If the string is empty or contains - // only the trim characters, an empty string is returned. - std::string trim(const std::string &instring, const std::string &trimstring = std::string(" \t\n")) - { - if (trimstring.size() == 0) - return instring; - std::string temp = ""; - std::string::size_type begpos = instring.find_first_not_of(trimstring); - if (begpos == std::string::npos) - { - return temp; - } - else - { - std::string::size_type endpos = instring.find_last_not_of(trimstring); - temp = instring.substr(begpos, endpos - begpos + 1); - } - return temp; - } - - ConfigInput::ConfigInput(std::istream &stream) : stream(stream) - { - while (!stream.eof()) - this->setTokenValuePair(); - } - - ConfigInput::~ConfigInput() - { - - } - - bool ConfigInput::hasValue(const std::string &key) const - { - bool valueFound = false; - std::string keyCopy = key; - this->makeLower(keyCopy); - if (configEntries.find(keyCopy.c_str()) != configEntries.end()) - valueFound = true; - - return valueFound; - } - - std::string ConfigInput::getValue(const std::string &key) - { - std::string keyCopy = key; - this->makeLower(keyCopy); - if (configEntries.find(keyCopy.c_str()) != configEntries.end()) - return (*configEntries.find(keyCopy.c_str())).second; - return ""; - } - - ////////////////////////////////////////////////////////////////////////// - // private methods // - ////////////////////////////////////////////////////////////////////////// - - void ConfigInput::makeLower(std::string &value) const - { - for (unsigned i = 0; i < value.size(); i++) - value[i] = tolower(value[i]); - } - - void ConfigInput::setTokenValuePair() - { - this->eatWhiteAndComments(true); - - std::string token; - if(!this->setToken(token)) - return; - - std::string value; - this->setValue(value); - - configEntries.insert(String_Pair(token, value)); - } - - bool ConfigInput::setToken(std::string &token) - { - char tokenChar[1024]; - bool foundEqualSign = false; - int charIndex = 0; - - this->findToken(foundEqualSign, tokenChar, charIndex); - - if (!isToken(charIndex, foundEqualSign)) - return false; - - this->nullTerminate(tokenChar, charIndex); - token = tokenChar; - makeLower(token); - return true; - } - - void ConfigInput::findToken(bool &foundEqualSign, char *token, int &i) - { - char ch; - while (!(stream.get(ch)).fail()) - { - if ((ch != '\t')) - { - if ((ch == '=') || (ch == ' ') || (ch == '\n') || (ch == '\r') || (ch == '\t')) - { - foundEqualSign = true; - break; - } - token[i++] = ch; - } - } - } - - - bool ConfigInput::isToken(int charIndex, bool foundEqualSign) - { - if (charIndex == 0) - { - configEntries.insert(String_Pair("", "")); - return false; - } - - if (!foundEqualSign && !advanceToEqualSignOnLine()) - { - configEntries.insert(String_Pair("", "")); - return false; - } - return true; - } - - void ConfigInput::setValue(std::string &value) - { - int charIndex = 0; - char valueChar[1024]; - this->findValue(charIndex, valueChar); - - if (charIndex == 0) - value = ""; - else - { - this->nullTerminate(valueChar, charIndex); - value = valueChar; - value = trim(value); - this->stripLeadingAndTrailingQuotes(value); - } - } - - - int ConfigInput::findValue(int &charIndex, char * value) - { - char ch; - char c = eatWhiteAndComments(false); - if (c != '\n') - { - charIndex = 0; - while (!(stream.get(ch)).fail()) - { - if ((ch == '\t') || (ch == '\r') || (ch == '\n') || (ch == '#')) - { - while (ch != '\n') - { - if (stream.get(ch).fail()) break; - } - break; - } - else - { - value[charIndex++] = ch; - } - } - } - return charIndex; - } - - - - void ConfigInput::stripLeadingAndTrailingQuotes(std::string &m_value) - { - if (m_value[0] == '"') - m_value = m_value.substr(1); - if (m_value[m_value.length() - 1] == '"') - m_value = m_value.substr(0, m_value.length() - 1); - } - - void ConfigInput::nullTerminate(char *value, int &i) - { - value[i++] = '\0'; - } - - bool ConfigInput::advanceToEqualSignOnLine() - { - char ch; - bool foundEqual = false; - while (!(stream.get(ch)).fail()) - { - if (isNewLine(ch) || isCarriageReturn(ch)) - break; - if (isEqualSign(ch)) - { - foundEqual = true; - break; - } - } - return foundEqual; - } - - char ConfigInput::eatWhiteAndComments(bool traverseNewlines) - { - char ch; - bool isComment = false; - - while (!(stream.get(ch)).fail()) - if (isCommentSign(ch)) - isComment = true; - else if (isNewLine(ch)) - { - isComment = false; - if (!traverseNewlines) - return(ch); - } - else if (isRegularChar(isComment, ch)) - { - stream.putback(ch); - return 0; - } - return 0; - } - - bool ConfigInput::isRegularChar(bool isComment, char ch) - { - return (!isComment) && (ch != ' ') && (ch != '\t') && (ch != '\r'); - } - - bool ConfigInput::isCommentSign(char ch) - { - return ch == COMMENT; - } - - bool ConfigInput::isEqualSign(char ch) - { - return ch == '='; - } - - bool ConfigInput::isNewLine(char ch) - { - return ch == '\n'; - } - - bool ConfigInput::isCarriageReturn(char ch) - { - return ch == '\r'; - } - - -} diff --git a/src/input/ConfigInput/ConfigInput.h b/src/input/ConfigInput/ConfigInput.h deleted file mode 100644 index eecb9a4c3..000000000 --- a/src/input/ConfigInput/ConfigInput.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef ConfigInput_H -#define ConfigInput_H -#include <string> -#include <vector> -#include <istream> -#include <memory> -#include <map> -#include <list> - -#include "Input_EXPORT.h" -#include "../Input.h" - -namespace input -{ - class ConfigInput : public Input - { - public: - Input_EXPORT ConfigInput(std::istream &stream); - Input_EXPORT virtual ~ConfigInput(void); - - Input_EXPORT bool hasValue(const std::string &key) const; - Input_EXPORT std::string getValue(const std::string &key); - - protected: - virtual void setTokenValuePair(); - void setValue(std::string &value); - bool setToken(std::string &token); - bool isToken(int charIndex, bool foundEqualSign); - int findValue(int &charIndex, char * value); - void stripLeadingAndTrailingQuotes(std::string &m_value); - void nullTerminate(char * token, int &i); - void findToken(bool &foundEqualSign, char * token, int &i); - char eatWhiteAndComments(bool traverse_newlines = true); - bool isRegularChar(bool isComment, char ch); - bool isNewLine(char ch); - bool isCommentSign(char ch); - bool advanceToEqualSignOnLine(); - bool isCarriageReturn(char ch); - bool isEqualSign(char ch); - void makeLower(std::string &instring) const; - - protected: - std::istream &stream; - typedef std::pair <std::string, std::string> String_Pair; - std::map<std::string, std::string> configEntries; - }; -} -#endif diff --git a/src/input/ConfigInput/ConfigInputTest.cpp b/src/input/ConfigInput/ConfigInputTest.cpp deleted file mode 100644 index e8ae86b03..000000000 --- a/src/input/ConfigInput/ConfigInputTest.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "ConfigInput.h" -#include "gmock/gmock.h" - - - -using namespace input; - - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream( - "key=value\n" - "key2=value2\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringBlankLines) -{ - std::istringstream stringstream( - "\n\n" - "key=value\n" - "\n" - "key2=value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesAfterEqual) -{ - std::istringstream stringstream( - "\n\n" - "key= value\n" - "\n" - "key2= value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - - -TEST(DISABLED_ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesBeforeEqual) -{ - std::istringstream stringstream( - "\n\n" - "key = value\n" - "\n" - "key2 = value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithMissingValue) -{ - std::istringstream stringstream( - "\n\n" - "key= \n" - "\n" - "key2= value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_getValueFromInvalidKey_ShouldReturnEmptyString) -{ - std::istringstream stringstream( - "" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_HasKeyWithInvalidKey_ReturnFalse) -{ - std::istringstream stringstream( - "" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), false); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_HasKeyWithValidKey_ReturnTrue) -{ - std::istringstream stringstream( - "key=value\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), true); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ReturnValueAndIgnoreComments) -{ - std::istringstream stringstream( - "# comment\n" - "key=value\n" - "# comment\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ReturnValue_ShouldIgnoreQuotationMarks) -{ - std::istringstream stringstream( - "# comment\n" - "key=\"value\"\n" - "# comment\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); -} diff --git a/src/input/ConfigInput/package.include b/src/input/ConfigInput/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/input/Input.cpp b/src/input/Input.cpp deleted file mode 100644 index 59628c668..000000000 --- a/src/input/Input.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "Input.h" - -#ifdef BUILD_JSONCPP -#include "JsonInput/JsonInput.h" -#endif - -#include "ConfigInput/ConfigInput.h" - -namespace input -{ - - std::unique_ptr<input::Input> Input::makeInput(std::istream &stream, const std::string &inputType) - { -#ifdef BUILD_JSONCPP - if(inputType == "json") - return std::unique_ptr<Input>(new JsonInput(stream)); -#endif - - return std::make_unique<ConfigInput>(stream); - } - -} - diff --git a/src/input/Input.h b/src/input/Input.h deleted file mode 100644 index 7f274f93d..000000000 --- a/src/input/Input.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef Input_H -#define Input_H - -#include "Input_EXPORT.h" - -#include <string> -#include <memory> -#include <istream> - -namespace input -{ - class Input - { - public: - static Input_EXPORT std::unique_ptr<Input> makeInput(std::istream &stream, const std::string &inputType); - - virtual bool hasValue(const std::string &key) const = 0; - virtual std::string getValue(const std::string &key) = 0; - }; -} - -#endif diff --git a/src/input/Input_EXPORT.h b/src/input/Input_EXPORT.h deleted file mode 100644 index fae1e68fa..000000000 --- a/src/input/Input_EXPORT.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef Input_EXPORT_H -#define Input_EXPORT_H - -#ifdef Input_BUILT_AS_STATIC -# define Input_EXPORT -# define INPUT_NO_EXPORT -#else -# ifndef Input_EXPORT -# ifdef Input_EXPORTS - /* We are building this library */ -# define Input_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define Input_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef INPUT_NO_EXPORT -# define INPUT_NO_EXPORT -# endif -#endif - -#ifndef INPUT_DEPRECATED -# define INPUT_DEPRECATED __declspec(deprecated) -#endif - -#ifndef INPUT_DEPRECATED_EXPORT -# define INPUT_DEPRECATED_EXPORT Input_EXPORT INPUT_DEPRECATED -#endif - -#ifndef INPUT_DEPRECATED_NO_EXPORT -# define INPUT_DEPRECATED_NO_EXPORT INPUT_NO_EXPORT INPUT_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef INPUT_NO_DEPRECATED -# define INPUT_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/src/input/JsonInput/JsonInput.cpp b/src/input/JsonInput/JsonInput.cpp deleted file mode 100644 index 9524e87ed..000000000 --- a/src/input/JsonInput/JsonInput.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifdef BUILD_JSONCPP - -#include "JsonInput.h" - -#include <fstream> -#include <string> -#include <sstream> -#include <vector> -#include <iterator> - -namespace input -{ - template<typename Out> - void split(const std::string &s, char delim, Out result) { - std::stringstream ss; - ss.str(s); - std::string item; - while (std::getline(ss, item, delim)) { - *(result++) = item; - } - } - - std::vector<std::string> split(const std::string &s, char delim) { - std::vector<std::string> elems; - split(s, delim, std::back_inserter(elems)); - return elems; - } - - JsonInput::JsonInput(std::istream &stream) - { - Json::Reader reader; - reader.parse(stream, jsonValue); - } - - bool JsonInput::hasValue(const std::string &key) const - { - auto keys = split(key, ' '); - - if (keys.size() == 1 && !jsonValue[keys[0]].isNull()) - return true; - else if (keys.size() == 2 && !jsonValue[keys[0]][keys[1]].isNull()) - return true; - else if (keys.size() == 3 && !jsonValue[keys[0]][keys[1]][keys[2]].isNull()) - return true; - else - return false; - } - - std::string JsonInput::getValue(const std::string &key) - { - auto keys = split(key, ' '); - - if(keys.size() == 1) - return jsonValue[keys[0]].asString(); - else if (keys.size() == 2) - return jsonValue[keys[0]][keys[1]].asString(); - else if (keys.size() == 3) - return jsonValue[keys[0]][keys[1]][keys[2]].asString(); - else - return ""; - } - - -} - -#endif diff --git a/src/input/JsonInput/JsonInput.h b/src/input/JsonInput/JsonInput.h deleted file mode 100644 index 377f3e29e..000000000 --- a/src/input/JsonInput/JsonInput.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifdef BUILD_JSONCPP - -#ifndef JsonInput_H -#define JsonInput_H - - -#include <string> -#include <json/json.h> - -#include "Input_EXPORT.h" - -#include "../Input.h" - -namespace input -{ - class JsonInput : public Input - { - public: - Input_EXPORT JsonInput(std::istream &stream); - - Input_EXPORT virtual bool hasValue(const std::string &key) const override; - Input_EXPORT virtual std::string getValue(const std::string &key) override; - - private: - Json::Value jsonValue; - - }; -} - -#endif - -#endif diff --git a/src/input/JsonInput/JsonInputTest.cpp b/src/input/JsonInput/JsonInputTest.cpp deleted file mode 100644 index f5df9d9c2..000000000 --- a/src/input/JsonInput/JsonInputTest.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#ifdef BUILD_JSONCPP - -#include "JsonInput.h" -#include "gmock/gmock.h" - - -using namespace input; - - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - "\"key2\": \"value2\"\n" - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWith3DKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream - ( - "{\n" - "\"1Dkey\":\n" - "{\n" - "\"2Dkey\":\n" - "{\n" - "\"key\": \"value\"\n" - "}\n" - "}\n" - "}\n" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("1Dkey 2Dkey key"), "value"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringBlankLines) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - - "\"key2\": \"value2\"\n" - - - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesAfterAndBeforeColon) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - - "\"key2\" : \"value2\"\n" - - - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_getValueFromInvalidKey_ShouldReturnEmptyString) -{ - std::istringstream stringstream( - "" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_HasKeyWithInvalidKey_ReturnFalse) -{ - std::istringstream stringstream( - "" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), false); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_HasKeyWithValidKey_ReturnTrue) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - "\"key2\": \"value2\"\n" - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), true); -} - -#endif diff --git a/src/input/JsonInput/package.include b/src/input/JsonInput/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/input/package.include b/src/input/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/logger/CMakeLists.txt b/src/logger/CMakeLists.txt deleted file mode 100644 index 0e1b9c16a..000000000 --- a/src/logger/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -############################################################# -### PROJECT ### -############################################################# -set(projectName "Logger") -project(${projectName}) -MESSAGE(STATUS "Build project \"${projectName}\":") - -############################################################# -### GENERAL MACROS ### -############################################################# -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTarget.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTargetUtilities.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/EndingsToCollect.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FileUtilities.cmake) - -############################################################# -### GENERAL SETTINGS ### -############################################################# -set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") -sharedLibs() - -############################################################# -### SUBDIRECTORIES ### -############################################################# -add_subdirectory(applications/Logger) -add_subdirectory(applications/Logger.Test) \ No newline at end of file diff --git a/src/logger/Logger.cpp b/src/logger/Logger.cpp deleted file mode 100644 index d4b7d2f15..000000000 --- a/src/logger/Logger.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "Logger.h" -#include "mpi.h" -#include <memory> -#include <iostream> - -#include "implementations/LoggerImp.h" - - - -namespace logging { - - std::unique_ptr<Logger> out = std::unique_ptr<Logger>(new LoggerImp(std::cout));; - - logging::Logger::Level logging::Logger::globalLogLevel = logging::Logger::INTERMEDIATE; - logging::Logger::Level logging::Logger::localLogLevel = logging::Logger::INTERMEDIATE; - bool logging::Logger::printRankNumber = false; - - - logging::Logger::Logger(std::ostream &stream) : stream(stream) - { - - } - - logging::Logger::~Logger() - { - - } - - void logging::Logger::setStream(std::ostream &stream) - { - out = std::unique_ptr<Logger>(new LoggerImp(stream)); - } - - void logging::Logger::setDebugLevel(const Level &level) - { - globalLogLevel = level; - } - - void logging::Logger::enablePrintedRankNumbers(bool print) - { - printRankNumber = print; - } - -} diff --git a/src/logger/Logger.h b/src/logger/Logger.h deleted file mode 100644 index 30863a996..000000000 --- a/src/logger/Logger.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef Logger_H -#define Logger_H - -#include "Logger_EXPORT.h" - -#include <string> -#include <memory> -#include <ostream> - -namespace logging -{ - class Logger_EXPORT Logger - { - protected: - Logger(std::ostream &stream); - - public: - virtual ~Logger(); - - enum Level - { - HIGH = 3, - INTERMEDIATE = 2, - LOW = 1 - }; - - static void setStream(std::ostream &stream); - static void setDebugLevel(const Level &level = Level::HIGH); - static void enablePrintedRankNumbers(bool printRankNumbers); - - virtual Logger& operator<<(const Level &level) = 0; - virtual Logger& operator<<(const std::string &log) = 0; - virtual Logger& operator<<(const int &log) = 0; - virtual Logger& operator<<(const float &log) = 0; - virtual Logger& operator<<(const double &log) = 0; - - protected: - std::ostream &stream; - static Level globalLogLevel; - static Level localLogLevel; - static bool printRankNumber; - - }; - - extern Logger_EXPORT std::unique_ptr<Logger> out; -} - - - -#endif diff --git a/src/logger/Logger_EXPORT.h b/src/logger/Logger_EXPORT.h deleted file mode 100644 index 52405a40d..000000000 --- a/src/logger/Logger_EXPORT.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef Logger_EXPORT_H -#define Logger_EXPORT_H - -#ifdef Logger_BUILT_AS_STATIC -# define Logger_EXPORT -# define LOGGER_NO_EXPORT -#else -# ifndef Logger_EXPORT -# ifdef Logger_EXPORTS - /* We are building this library */ -# define Logger_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define Logger_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef LOGGER_NO_EXPORT -# define LOGGER_NO_EXPORT -# endif -#endif - -#ifndef LOGGER_DEPRECATED -# define LOGGER_DEPRECATED __declspec(deprecated) -#endif - -#ifndef LOGGER_DEPRECATED_EXPORT -# define LOGGER_DEPRECATED_EXPORT Logger_EXPORT LOGGER_DEPRECATED -#endif - -#ifndef LOGGER_DEPRECATED_NO_EXPORT -# define LOGGER_DEPRECATED_NO_EXPORT LOGGER_NO_EXPORT LOGGER_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LOGGER_NO_DEPRECATED -# define LOGGER_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/src/logger/implementations/LoggerImp.cpp b/src/logger/implementations/LoggerImp.cpp deleted file mode 100644 index 16486dcae..000000000 --- a/src/logger/implementations/LoggerImp.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "LoggerImp.h" - -#include "mpi.h" - -#include <memory> -#include <iostream> - -logging::LoggerImp::LoggerImp(std::ostream &stream) : logging::Logger(stream) -{ - -} - -logging::LoggerImp::~LoggerImp() -{ - -} - -logging::Logger& logging::LoggerImp::operator<<(const Level &level) -{ - localLogLevel = level; - return *this; -} - -bool logging::LoggerImp::isLocalLogLevelHighEnough() -{ - return localLogLevel >= globalLogLevel; -} - -logging::Logger& logging::LoggerImp::operator<<(const std::string &message) -{ - return this->log(message); -} - -logging::Logger& logging::LoggerImp::operator<<(const int &message) -{ - return this->log(std::to_string(message)); -} - -logging::Logger& logging::LoggerImp::operator<<(const float &message) -{ - return this->log(std::to_string(message)); -} - -logging::Logger& logging::LoggerImp::operator<<(const double &message) -{ - return this->log(std::to_string(message)); -} - - -logging::Logger& logging::LoggerImp::log(const std::string &message) -{ - if (isLocalLogLevelHighEnough()) - stream << getRankString() + message; - return *this; -} - - - - -std::string logging::LoggerImp::getRankString() -{ - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - return printRankNumber ? "[" + std::to_string(rank) + "] " : ""; -} - diff --git a/src/logger/implementations/LoggerImp.h b/src/logger/implementations/LoggerImp.h deleted file mode 100644 index ceef4198b..000000000 --- a/src/logger/implementations/LoggerImp.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef LoggerImp_H -#define LoggerImp_H - -#include "Logger_EXPORT.h" - -#include <string> -#include <memory> -#include <ostream> - -#include "../Logger.h" - -namespace logging -{ - - class Logger_EXPORT LoggerImp : public Logger - { - public: - LoggerImp(std::ostream &stream); - virtual ~LoggerImp(); - - Logger& operator<<(const Level &level); - Logger& operator<<(const std::string &message); - Logger& operator<<(const int &message); - Logger& operator<<(const float &message); - Logger& operator<<(const double &message); - - - private: - std::string getRankString(); - bool isLocalLogLevelHighEnough(); - - logging::Logger& log(const std::string &message); - - - }; - -} - - -#endif diff --git a/src/logger/implementations/LoggerTest.cpp b/src/logger/implementations/LoggerTest.cpp deleted file mode 100644 index 7d2ca8d04..000000000 --- a/src/logger/implementations/LoggerTest.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "gmock/gmock.h" -#include <fstream> -#include <memory> - -#include "../Logger.h" - - -TEST(LoggerTest, logStringWithoutSettingLevels_WillPutTheLogMesssageIntoTheStream) -{ - std::ostringstream stream; - logging::Logger::setStream(stream); - - *logging::out << "Hello World\n"; - - EXPECT_THAT(stream.str(), "Hello World\n"); -} - -TEST(LoggerTest, logStringWithHighDebugLevel_logOnlyHighLevelMessages) -{ - std::ostringstream stream; - logging::Logger::setStream(stream); - - logging::Logger::setDebugLevel(logging::Logger::HIGH); - *logging::out << logging::Logger::LOW << "Low Debug Message\n" << logging::Logger::HIGH << "HIGH Debug Message\n"; - - EXPECT_THAT(stream.str(), "HIGH Debug Message\n"); -} \ No newline at end of file diff --git a/src/logger/implementations/package.include b/src/logger/implementations/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/logger/package.include b/src/logger/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt deleted file mode 100644 index 4b01f24a7..000000000 --- a/src/utilities/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ - -############################################################# -### PROJECT ### -############################################################# -set(projectName "utilities") -project(${projectName}) -MESSAGE(STATUS "Build project \"${projectName}\":") -############################################################# -### GENERAL MACROS ### -############################################################# -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTarget.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTargetUtilities.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/EndingsToCollect.cmake) -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FileUtilities.cmake) - -############################################################# -### GENERAL SETTINGS ### -############################################################# -set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") -sharedLibs() - -############################################################# -### SUBDIRECTORIES ### -############################################################# -add_subdirectory(applications/utilities) -add_subdirectory(applications/utilities.Test) \ No newline at end of file diff --git a/src/utilities/StringUtil.cpp b/src/utilities/StringUtil.cpp deleted file mode 100644 index 36ebba1e0..000000000 --- a/src/utilities/StringUtil.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "StringUtil.h" - -#include <boost/foreach.hpp> -#include <boost/algorithm/string.hpp> -#include <boost/algorithm/string/predicate.hpp> - -std::string StringUtil::findAndReplace(const std::string &source, const std::string& find, const std::string& replace) -{ - std::string output = source; - size_t j; - for (; (j = output.find(find)) != std::string::npos;) - output.replace(j, find.length(), replace); - return output; -} - -std::string StringUtil::makeUpper(const std::string& instring) -{ - std::string output = instring; - transform(output.begin(), output.end(), output.begin(), ::toupper); - return output; -} - -std::string StringUtil::makeLower(const std::string& instring) -{ - std::string output = instring; - transform(output.begin(), output.end(), output.begin(), ::tolower); - return output; -} - -bool StringUtil::contains(const std::string& source, const char *find) -{ - return (0 != strstr(source.c_str(), find)); -} - -std::string StringUtil::pad(const std::string& input, char pad, int length) -{ - std::string outstring = input; - for (int i = (int)outstring.length(); i < length; ++i) - outstring += pad; - return outstring; -} - -std::string StringUtil::trim(const std::string &input, const std::string &trim /*= std::string(" \t\n")*/) -{ - if (input.size() == 0) - return input; - std::string temp = ""; - std::string::size_type begpos = input.find_first_not_of(trim); - if (begpos == std::string::npos) - { - return temp; - } - else - { - std::string::size_type endpos = input.find_last_not_of(trim); - temp = input.substr(begpos, endpos - begpos + 1); - } - return temp; -} - -int StringUtil::toInt(const std::string &input) -{ - return std::stoi(input); -} - -float StringUtil::toFloat(const std::string &input) -{ - return std::stof(input); -} - -double StringUtil::toDouble(const std::string &input) -{ - return std::stod(input); -} - -bool StringUtil::toBool(const std::string &input) -{ - bool b = 0; - std::string trimmedInput = trim(input); - if (!toBool(b, trimmedInput, std::boolalpha)) - throw "StringUtils::toBool() - Not a bool: " + trimmedInput; - return b; -} - -bool StringUtil::toBool(bool &t, const std::string &input, std::ios_base &(*f)(std::ios_base&)) -{ - std::istringstream iss(input); - return !(iss >> f >> t).fail(); -} - -std::vector<int> StringUtil::toVector(const std::string& input) -{ - std::vector<int> v; - std::vector<std::string> inputEntries; - boost::algorithm::split(inputEntries, input, boost::is_any_of("\t\n ")); - BOOST_FOREACH(std::string entry, inputEntries) - if (entry != "") - v.push_back(toInt(entry)); - return v; -} - -template<typename T> -std::string StringUtil::toString(const T& t) -{ - std::ostringstream stream; - stream << t; - return stream.str(); -} - -template utilities_EXPORT std::string StringUtil::toString<int>(const int& t); - - -bool StringUtil::endsWith(const std::string &input, const std::string &end) -{ - return boost::algorithm::ends_with(input, end); -} \ No newline at end of file diff --git a/src/utilities/StringUtil.h b/src/utilities/StringUtil.h deleted file mode 100644 index 7d3060084..000000000 --- a/src/utilities/StringUtil.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef STRINGUTIL_H -#define STRINGUTIL_H - -#include <algorithm> -#include <sstream> -#include <iostream> -#include <string> -#include <vector> - -#include "utilities_EXPORT.h" - -class StringUtil -{ -public: - static utilities_EXPORT std::string findAndReplace(const std::string &source, const std::string& find, const std::string& replace); - static utilities_EXPORT std::string makeUpper(const std::string& instring); - static utilities_EXPORT std::string makeLower(const std::string& instring); - static utilities_EXPORT bool contains(const std::string& source, const char *find); - static utilities_EXPORT std::string pad(const std::string& input, char pad, int length); - static utilities_EXPORT std::string trim(const std::string &input, const std::string &trim = std::string(" \t\n")); - static utilities_EXPORT int toInt(const std::string &input); - static utilities_EXPORT float toFloat(const std::string &input); - static utilities_EXPORT double toDouble(const std::string &input); - static utilities_EXPORT bool toBool(const std::string &input); - static utilities_EXPORT std::vector<int> toVector(const std::string& s); - template<typename T> - static utilities_EXPORT std::string toString(const T& t); - - static utilities_EXPORT bool endsWith(const std::string &input, const std::string &end); - -private: - StringUtil() {}; - StringUtil(const StringUtil&) {}; - virtual ~StringUtil() {}; - - static bool toBool(bool &t, const std::string &input, std::ios_base &(*f)(std::ios_base&)); -}; - -#endif - diff --git a/src/utilities/StringUtilTest.cpp b/src/utilities/StringUtilTest.cpp deleted file mode 100644 index 18c77d355..000000000 --- a/src/utilities/StringUtilTest.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "gmock/gmock.h" - -#include "StringUtil.h" - -TEST(StringUtilTest, findAndReplace) -{ - std::string source0 = "2232fh"; - std::string source1 = "find_2232fh"; - std::string source2 = "2q232_find_2232fh"; - std::string source3 = "2q232_find"; - std::string source4 = "find_2q232_find"; - std::string source5 = "find_2q2find2_find"; - - std::string find = "find"; - std::string replace = "replace"; - - EXPECT_THAT(StringUtil::findAndReplace(source0, find, replace), "2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source1, find, replace), "replace_2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source2, find, replace), "2q232_replace_2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source3, find, replace), "2q232_replace"); - EXPECT_THAT(StringUtil::findAndReplace(source4, find, replace), "replace_2q232_replace"); - EXPECT_THAT(StringUtil::findAndReplace(source5, find, replace), "replace_2q2replace2_replace"); -} - -TEST(StringUtilTest, makeUpper) -{ - std::string source = "hello123world"; - EXPECT_THAT(StringUtil::makeUpper(source), "HELLO123WORLD"); -} - -TEST(StringUtilTest, makeLower) -{ - std::string source = "HELLO123WORLD"; - EXPECT_THAT(StringUtil::makeLower(source), "hello123world"); -} - -TEST(StringUtilTest, contains_shouldReturnTrue) -{ - std::string source = "fsd8998--++search++d"; - const char* find = "search"; - EXPECT_TRUE(StringUtil::contains(source, find)); -} - -TEST(StringUtilTest, contains_shouldReturnFalse) -{ - std::string source = "fsd8998--++++d"; - const char* find = "search"; - EXPECT_FALSE(StringUtil::contains(source, find)); -} - -TEST(StringUtilTest, pad) -{ - std::string source = "start"; - char pad = '1'; - int length = 6; - EXPECT_THAT(StringUtil::pad(source, pad, length), "start1"); -} - -TEST(StringUtilTest, trimAStringDeletesTrimAtTheStartAndTheEnd) -{ - std::string source = " for after "; - std::string trim = " "; - EXPECT_THAT(StringUtil::trim(source, trim), "for after"); -} - -TEST(StringUtilTest, convertStringToInt) -{ - std::string source = " 1 "; - EXPECT_THAT(StringUtil::toInt(source), 1); -} - -TEST(StringUtilTest, convertStringToFloat) -{ - std::string source = " 1.2 "; - EXPECT_THAT(StringUtil::toFloat(source), testing::FloatEq(1.2f)); -} - -TEST(StringUtilTest, convertStringToDouble) -{ - std::string source = " 1.2 "; - EXPECT_THAT(StringUtil::toDouble(source), testing::DoubleEq(1.2)); -} - -TEST(StringUtilTest, convertStringToBool) -{ - std::string source0 = "false"; - EXPECT_FALSE(StringUtil::toBool(source0)); - - std::string source = "true"; - EXPECT_TRUE(StringUtil::toBool(source)); -} - -TEST(StringUtilTest, toVector) -{ - std::string source = " 1 2 3 "; - auto values = StringUtil::toVector(source); - - EXPECT_THAT(values[0], 1); - EXPECT_THAT(values[1], 2); - EXPECT_THAT(values[2], 3); - - EXPECT_THAT(values.size(), 3); -} - -TEST(StringUtilTest, toString_implementedWithInt) -{ - int i = 123; - EXPECT_THAT(StringUtil::toString(i), "123"); -} - -TEST(StringUtilTest, string_ends_with) -{ - std::string myString = "MyString"; - EXPECT_TRUE(StringUtil::endsWith(myString, "String")); - EXPECT_FALSE(StringUtil::endsWith(myString, "FOO")); -} diff --git a/src/utilities/package.include b/src/utilities/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/utilities/utilities_EXPORT.h b/src/utilities/utilities_EXPORT.h deleted file mode 100644 index 57422a8e4..000000000 --- a/src/utilities/utilities_EXPORT.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef utilities_EXPORT_H -#define utilities_EXPORT_H - -#ifdef utilities_BUILT_AS_STATIC -# define utilities_EXPORT -# define UTILITIES_NO_EXPORT -#else -# ifndef utilities_EXPORT -# ifdef utilities_EXPORTS - /* We are building this library */ -# define utilities_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define utilities_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef UTILITIES_NO_EXPORT -# define UTILITIES_NO_EXPORT -# endif -#endif - -#ifndef UTILITIES_DEPRECATED -# define UTILITIES_DEPRECATED __declspec(deprecated) -#endif - -#ifndef UTILITIES_DEPRECATED_EXPORT -# define UTILITIES_DEPRECATED_EXPORT utilities_EXPORT UTILITIES_DEPRECATED -#endif - -#ifndef UTILITIES_DEPRECATED_NO_EXPORT -# define UTILITIES_DEPRECATED_NO_EXPORT UTILITIES_NO_EXPORT UTILITIES_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef UTILITIES_NO_DEPRECATED -# define UTILITIES_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/targets/apps/HULC/CMakeLists.txt b/targets/apps/HULC/CMakeLists.txt index 1d92587bc..105caf59a 100644 --- a/targets/apps/HULC/CMakeLists.txt +++ b/targets/apps/HULC/CMakeLists.txt @@ -2,7 +2,7 @@ setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) set(linkDirectories "") set(libsToLink GridGenerator VirtualFluids_GPU VirtualFluidsBasics) -set(includeDirectories "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/GridGenerator" "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU") +set(includeDirectories "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/GridGenerator" "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU" "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics") #glob files and save in MY_SRCS include(CMakePackage.cmake) diff --git a/targets/apps/HULC/main.cpp b/targets/apps/HULC/main.cpp index 91a73bae2..47230995c 100644 --- a/targets/apps/HULC/main.cpp +++ b/targets/apps/HULC/main.cpp @@ -1,5 +1,5 @@ #include <memory> -#include <string> +#include <string><utilities/StringUtil/StringUtil.h> #include <fstream> #include <iostream> #include <algorithm> @@ -7,8 +7,8 @@ #include "mpi.h" #include "time.h" -#include <Logger/Logger.h> -#include <Input/Input.h> +#include <utilities/logger/Logger.h> +#include <utilities/input/Input.h> #include <GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.h> #include <GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.h> @@ -25,7 +25,7 @@ #include <VirtualFluids_GPU/Parameter/Parameter.h> #include <VirtualFluids_GPU/DataStructureInitializer/GridProvider.h> -#include <utilities/StringUtil.h> +#include <utilities/StringUtil/StringUtil.h> std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath) { -- GitLab