diff --git a/CMakeLists.txt b/CMakeLists.txt index a0a46ed652ed3b586e56af163a749a86edf3c5be..03ed97b484e3cd3fc53d73d2ad0247f12503ea9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ project(VirtualFluids CXX) set(CMAKE_BUILD_TYPE Release) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/src/basics/Core/Input/ConfigData/ConfigData.h b/src/basics/Core/Input/ConfigData/ConfigData.h deleted file mode 100644 index 48e2f5a348a5c9a8c746cd467da47a96bf2ac17a..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigData/ConfigData.h +++ /dev/null @@ -1,217 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigData.h -//! \ingroup ConfigData -//! \author Soeren Peters, Martin Schoenherr -//======================================================================================= -#ifndef CONFIGDATA_H -#define CONFIGDATA_H - -#include "../../DataTypes.h" - -#include <memory> -#include <vector> - -class ConfigData -{ -public: - virtual ~ConfigData() = default; - - virtual real getViscosity() = 0; - virtual uint getNumberOfDevices() = 0; - virtual std::vector<uint> getDevices() = 0; - virtual std::string getOutputPath() = 0; - virtual std::string getPrefix() = 0; - virtual std::string getGridPath() = 0; - virtual bool getPrintOutputFiles() = 0; - virtual bool getGeometryValues() = 0; - virtual bool getCalc2ndOrderMoments() = 0; - virtual bool getCalc3rdOrderMoments() = 0; - virtual bool getCalcHighOrderMoments() = 0; - virtual bool getReadGeo() = 0; - virtual bool getCalcMedian() = 0; - virtual bool getCalcDragLift() = 0; - virtual bool getCalcCp() = 0; - virtual bool getWriteVeloASCIIfiles() = 0; - virtual bool getCalcPlaneConc() = 0; - virtual bool getConcFile() = 0; - virtual bool getStreetVelocityFile() = 0; - virtual bool getUseMeasurePoints() = 0; - virtual bool getUseWale() = 0; - virtual bool getUseInitNeq() = 0; - virtual bool getSimulatePorousMedia() = 0; - virtual uint getD3Qxx() = 0; - virtual uint getTEnd() = 0; - virtual uint getTOut() = 0; - virtual uint getTStartOut() = 0; - virtual uint getTimeCalcMedStart() = 0; - virtual uint getTimeCalcMedEnd() = 0; - virtual uint getPressInID() = 0; - virtual uint getPressOutID() = 0; - virtual uint getPressInZ() = 0; - virtual uint getPressOutZ() = 0; - virtual bool getDiffOn() = 0; - virtual uint getDiffMod() = 0; - virtual real getDiffusivity() = 0; - virtual real getTemperatureInit() = 0; - virtual real getTemperatureBC() = 0; - virtual real getVelocity() = 0; - virtual real getViscosityRatio() = 0; - virtual real getVelocityRatio() = 0; - virtual real getDensityRatio() = 0; - virtual real getPressRatio() = 0; - virtual real getRealX() = 0; - virtual real getRealY() = 0; - virtual real getFactorPressBC() = 0; - virtual std::string getGeometryFileC() = 0; - virtual std::string getGeometryFileM() = 0; - virtual std::string getGeometryFileF() = 0; - virtual uint getClockCycleForMP() = 0; - virtual uint getTimestepForMP() = 0; - virtual real getForcingX() = 0; - virtual real getForcingY() = 0; - virtual real getForcingZ() = 0; - virtual real getQuadricLimiterP() = 0; - virtual real getQuadricLimiterM() = 0; - virtual real getQuadricLimiterD() = 0; - virtual bool getCalcParticles() = 0; - virtual int getParticleBasicLevel() = 0; - virtual int getParticleInitLevel() = 0; - virtual int getNumberOfParticles() = 0; - virtual real getStartXHotWall() = 0; - virtual real getEndXHotWall() = 0; - virtual std::vector<std::string> getPossNeighborFilesX() = 0; - virtual std::vector<std::string> getPossNeighborFilesY() = 0; - virtual std::vector<std::string> getPossNeighborFilesZ() = 0; - // virtual std::vector<std::string> getPossNeighborFilesX() = 0; - // virtual std::vector<std::string> getPossNeighborFilesY() = 0; - // virtual std::vector<std::string> getPossNeighborFilesZ() = 0; - virtual int getTimeDoCheckPoint() = 0; - virtual int getTimeDoRestart() = 0; - virtual bool getDoCheckPoint() = 0; - virtual bool getDoRestart() = 0; - virtual uint getMaxLevel() = 0; - virtual std::vector<int> getGridX() = 0; - virtual std::vector<int> getGridY() = 0; - virtual std::vector<int> getGridZ() = 0; - virtual std::vector<int> getDistX() = 0; - virtual std::vector<int> getDistY() = 0; - virtual std::vector<int> getDistZ() = 0; - virtual std::vector<bool> getNeedInterface() = 0; - virtual std::string getMainKernel() = 0; - virtual bool getMultiKernelOn() = 0; - virtual std::vector<int> getMultiKernelLevel() = 0; - virtual std::vector<std::string> getMultiKernelName() = 0; - - virtual bool isViscosityInConfigFile() = 0; - virtual bool isNumberOfDevicesInConfigFile() = 0; - virtual bool isDevicesInConfigFile() = 0; - virtual bool isOutputPathInConfigFile() = 0; - virtual bool isPrefixInConfigFile() = 0; - virtual bool isGridPathInConfigFile() = 0; - virtual bool isPrintOutputFilesInConfigFile() = 0; - virtual bool isGeometryValuesInConfigFile() = 0; - virtual bool isCalc2ndOrderMomentsInConfigFile() = 0; - virtual bool isCalc3rdOrderMomentsInConfigFile() = 0; - virtual bool isCalcHighOrderMomentsInConfigFile() = 0; - virtual bool isReadGeoInConfigFile() = 0; - virtual bool isCalcMedianInConfigFile() = 0; - virtual bool isCalcDragLiftInConfigFile() = 0; - virtual bool isCalcCpInConfigFile() = 0; - virtual bool isWriteVeloASCIIfilesInConfigFile() = 0; - virtual bool isCalcPlaneConcInConfigFile() = 0; - virtual bool isConcFileInConfigFile() = 0; - virtual bool isStreetVelocityFileInConfigFile() = 0; - virtual bool isUseMeasurePointsInConfigFile() = 0; - virtual bool isUseWaleInConfigFile() = 0; - virtual bool isUseInitNeqInConfigFile() = 0; - virtual bool isSimulatePorousMediaInConfigFile() = 0; - virtual bool isD3QxxInConfigFile() = 0; - virtual bool isTEndInConfigFile() = 0; - virtual bool isTOutInConfigFile() = 0; - virtual bool isTStartOutInConfigFile() = 0; - virtual bool isTimeCalcMedStartInConfigFile() = 0; - virtual bool isTimeCalcMedEndInConfigFile() = 0; - virtual bool isPressInIDInConfigFile() = 0; - virtual bool isPressOutIDInConfigFile() = 0; - virtual bool isPressInZInConfigFile() = 0; - virtual bool isPressOutZInConfigFile() = 0; - virtual bool isDiffOnInConfigFile() = 0; - virtual bool isDiffModInConfigFile() = 0; - virtual bool isDiffusivityInConfigFile() = 0; - virtual bool isTemperatureInitInConfigFile() = 0; - virtual bool isTemperatureBCInConfigFile() = 0; - // virtual bool isViscosityInConfigFile() = 0; - virtual bool isVelocityInConfigFile() = 0; - virtual bool isViscosityRatioInConfigFile() = 0; - virtual bool isVelocityRatioInConfigFile() = 0; - virtual bool isDensityRatioInConfigFile() = 0; - virtual bool isPressRatioInConfigFile() = 0; - virtual bool isRealXInConfigFile() = 0; - virtual bool isRealYInConfigFile() = 0; - virtual bool isFactorPressBCInConfigFile() = 0; - virtual bool isGeometryFileCInConfigFile() = 0; - virtual bool isGeometryFileMInConfigFile() = 0; - virtual bool isGeometryFileFInConfigFile() = 0; - virtual bool isClockCycleForMPInConfigFile() = 0; - virtual bool isTimestepForMPInConfigFile() = 0; - virtual bool isForcingXInConfigFile() = 0; - virtual bool isForcingYInConfigFile() = 0; - virtual bool isForcingZInConfigFile() = 0; - virtual bool isQuadricLimiterPInConfigFile() = 0; - virtual bool isQuadricLimiterMInConfigFile() = 0; - virtual bool isQuadricLimiterDInConfigFile() = 0; - virtual bool isCalcParticlesInConfigFile() = 0; - virtual bool isParticleBasicLevelInConfigFile() = 0; - virtual bool isParticleInitLevelInConfigFile() = 0; - virtual bool isNumberOfParticlesInConfigFile() = 0; - virtual bool isNeighborWSBInConfigFile() = 0; - virtual bool isStartXHotWallInConfigFile() = 0; - virtual bool isEndXHotWallInConfigFile() = 0; - virtual bool isPossNeighborFilesXInConfigFile() = 0; - virtual bool isPossNeighborFilesYInConfigFile() = 0; - virtual bool isPossNeighborFilesZInConfigFile() = 0; - virtual bool isTimeDoCheckPointInConfigFile() = 0; - virtual bool isTimeDoRestartInConfigFile() = 0; - virtual bool isDoCheckPointInConfigFile() = 0; - virtual bool isDoRestartInConfigFile() = 0; - virtual bool isMaxLevelInConfigFile() = 0; - virtual bool isGridXInConfigFile() = 0; - virtual bool isGridYInConfigFile() = 0; - virtual bool isGridZInConfigFile() = 0; - virtual bool isDistXInConfigFile() = 0; - virtual bool isDistYInConfigFile() = 0; - virtual bool isDistZInConfigFile() = 0; - virtual bool isNeedInterfaceInConfigFile() = 0; - virtual bool isMainKernelInConfigFile() = 0; - virtual bool isMultiKernelOnInConfigFile() = 0; - virtual bool isMultiKernelLevelInConfigFile() = 0; - virtual bool isMultiKernelNameInConfigFile() = 0; -}; -#endif diff --git a/src/basics/Core/Input/ConfigData/ConfigDataImp.cpp b/src/basics/Core/Input/ConfigData/ConfigDataImp.cpp deleted file mode 100644 index e18785148f16cd77676ff5af03308c0f6028ab4a..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigData/ConfigDataImp.cpp +++ /dev/null @@ -1,866 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigDataImp.cpp -//! \ingroup ConfigData -//! \author Soeren Peters, Martin Schoenherr -//======================================================================================= -#include "ConfigDataImp.h" - -std::shared_ptr<ConfigDataImp> ConfigDataImp::getNewInstance() -{ - return std::shared_ptr<ConfigDataImp>(new ConfigDataImp()); -} - -real ConfigDataImp::getViscosity() { return this->viscosity; } - -uint ConfigDataImp::getNumberOfDevices() { return this->numberOfDevices; } - -std::vector<uint> ConfigDataImp::getDevices() { return this->devices; } - -std::string ConfigDataImp::getOutputPath() { return this->outputPath; } - -std::string ConfigDataImp::getPrefix() { return this->prefix; } - -std::string ConfigDataImp::getGridPath() { return this->gridPath; } - -bool ConfigDataImp::getPrintOutputFiles() { return this->printOutputFiles; } - -bool ConfigDataImp::getGeometryValues() { return this->geometryValues; } - -bool ConfigDataImp::getCalc2ndOrderMoments() { return this->calc2ndOrderMoments; } - -bool ConfigDataImp::getCalc3rdOrderMoments() { return this->calc3rdOrderMoments; } - -bool ConfigDataImp::getCalcHighOrderMoments() { return this->calcHighOrderMoments; } - -bool ConfigDataImp::getReadGeo() { return this->readGeo; } - -bool ConfigDataImp::getCalcMedian() { return this->calcMedian; } - -bool ConfigDataImp::getCalcDragLift() { return this->calcDragLift; } - -bool ConfigDataImp::getCalcCp() { return this->calcCp; } - -bool ConfigDataImp::getWriteVeloASCIIfiles() { return this->writeVeloASCIIfiles; } - -bool ConfigDataImp::getCalcPlaneConc() { return this->calcPlaneConc; } - -bool ConfigDataImp::getConcFile() { return this->concFile; } - -bool ConfigDataImp::getStreetVelocityFile() { return this->streetVelocityFile; } - -bool ConfigDataImp::getUseMeasurePoints() { return this->useMeasurePoints; } - -bool ConfigDataImp::getUseWale() { return this->useWale; } - -bool ConfigDataImp::getUseInitNeq() { return this->useInitNeq; } - -bool ConfigDataImp::getSimulatePorousMedia() { return this->simulatePorousMedia; } - -uint ConfigDataImp::getD3Qxx() { return this->d3Qxx; } - -uint ConfigDataImp::getTEnd() { return this->tEnd; } - -uint ConfigDataImp::getTOut() { return this->tOut; } - -uint ConfigDataImp::getTStartOut() { return this->tStartOut; } - -uint ConfigDataImp::getTimeCalcMedStart() { return this->timeCalcMedStart; } - -uint ConfigDataImp::getTimeCalcMedEnd() { return this->timeCalcMedEnd; } - -uint ConfigDataImp::getPressInID() { return this->pressInID; } - -uint ConfigDataImp::getPressOutID() { return this->pressOutID; } - -uint ConfigDataImp::getPressInZ() { return this->pressInZ; } - -uint ConfigDataImp::getPressOutZ() { return this->pressOutZ; } - -bool ConfigDataImp::getDiffOn() { return this->diffOn; } - -uint ConfigDataImp::getDiffMod() { return this->diffMod; } - -real ConfigDataImp::getDiffusivity() { return this->diffusivity; } - -real ConfigDataImp::getTemperatureInit() { return this->temperatureInit; } - -real ConfigDataImp::getTemperatureBC() { return this->temperatureBC; } - -real ConfigDataImp::getVelocity() { return this->velocity; } - -real ConfigDataImp::getViscosityRatio() { return this->viscosityRatio; } - -real ConfigDataImp::getVelocityRatio() { return this->velocityRatio; } - -real ConfigDataImp::getDensityRatio() { return this->densityRatio; } - -real ConfigDataImp::getPressRatio() { return this->pressRatio; } - -real ConfigDataImp::getRealX() { return this->realX; } - -real ConfigDataImp::getRealY() { return this->realY; } - -real ConfigDataImp::getFactorPressBC() { return this->factorPressBC; } - -std::string ConfigDataImp::getGeometryFileC() { return this->geometryFileC; } - -std::string ConfigDataImp::getGeometryFileM() { return this->geometryFileM; } - -std::string ConfigDataImp::getGeometryFileF() { return this->geometryFileF; } - -uint ConfigDataImp::getClockCycleForMP() { return this->clockCycleForMP; } - -uint ConfigDataImp::getTimestepForMP() { return this->timestepForMP; } - -real ConfigDataImp::getForcingX() { return this->forcingX; } - -real ConfigDataImp::getForcingY() { return this->forcingY; } - -real ConfigDataImp::getForcingZ() { return this->forcingZ; } - -real ConfigDataImp::getQuadricLimiterP() { return this->quadricLimiterP; } - -real ConfigDataImp::getQuadricLimiterM() { return this->quadricLimiterM; } - -real ConfigDataImp::getQuadricLimiterD() { return this->quadricLimiterD; } - -bool ConfigDataImp::getCalcParticles() { return this->calcParticles; } - -int ConfigDataImp::getParticleBasicLevel() { return this->particleBasicLevel; } - -int ConfigDataImp::getParticleInitLevel() { return this->particleInitLevel; } - -int ConfigDataImp::getNumberOfParticles() { return this->numberOfParticles; } - -real ConfigDataImp::getStartXHotWall() { return this->startXHotWall; } - -real ConfigDataImp::getEndXHotWall() { return this->endXHotWall; } - -std::vector<std::string> ConfigDataImp::getPossNeighborFilesX() { return this->possNeighborFilesX; } - -std::vector<std::string> ConfigDataImp::getPossNeighborFilesY() { return this->possNeighborFilesY; } - -std::vector<std::string> ConfigDataImp::getPossNeighborFilesZ() { return this->possNeighborFilesZ; } - -int ConfigDataImp::getTimeDoCheckPoint() { return this->timeDoCheckPoint; } - -int ConfigDataImp::getTimeDoRestart() { return this->timeDoRestart; } - -bool ConfigDataImp::getDoCheckPoint() { return this->doCheckPoint; } - -bool ConfigDataImp::getDoRestart() { return this->doRestart; } - -uint ConfigDataImp::getMaxLevel() { return this->maxLevel; } - -std::vector<int> ConfigDataImp::getGridX() { return this->gridX; } - -std::vector<int> ConfigDataImp::getGridY() { return this->gridY; } - -std::vector<int> ConfigDataImp::getGridZ() { return this->gridZ; } - -std::vector<int> ConfigDataImp::getDistX() { return this->distX; } - -std::vector<int> ConfigDataImp::getDistY() { return this->distY; } - -std::vector<int> ConfigDataImp::getDistZ() { return this->distZ; } - -std::vector<bool> ConfigDataImp::getNeedInterface() { return this->needInterface; } - -std::string ConfigDataImp::getMainKernel() { return this->mainKernel; } - -bool ConfigDataImp::getMultiKernelOn() { return this->multiKernelOn; } - -std::vector<int> ConfigDataImp::getMultiKernelLevel() { return this->multiKernelLevel; } - -std::vector<std::string> ConfigDataImp::getMultiKernelName() { return this->multiKernelName; } - -void ConfigDataImp::setViscosity(real viscosity) -{ - this->viscosity = viscosity; - this->isViscosity = true; -} - -void ConfigDataImp::setNumberOfDevices(uint numberOfDevices) -{ - this->numberOfDevices = numberOfDevices; - this->isNumberOfDevices = true; -} - -void ConfigDataImp::setDevices(std::vector<uint> devices) -{ - this->devices = devices; - this->isDevices = true; -} - -void ConfigDataImp::setOutputPath(std::string outputPath) -{ - this->outputPath = outputPath; - this->isOutputPath = true; -} - -void ConfigDataImp::setPrefix(std::string prefix) -{ - this->prefix = prefix; - this->isPrefix = true; -} - -void ConfigDataImp::setGridPath(std::string gridPath) -{ - this->gridPath = gridPath; - this->isGridPath = true; -} - -void ConfigDataImp::setPrintOutputFiles(bool printOutputFiles) -{ - this->printOutputFiles = printOutputFiles; - this->isPrintOutputFiles = true; -} - -void ConfigDataImp::setGeometryValues(bool geometryValues) -{ - this->geometryValues = geometryValues; - this->isGeometryValues = true; -} - -void ConfigDataImp::setCalc2ndOrderMoments(bool calc2ndOrderMoments) -{ - this->calc2ndOrderMoments = calc2ndOrderMoments; - this->isCalc2ndOrderMoments = true; -} - -void ConfigDataImp::setCalc3rdOrderMoments(bool calc3rdOrderMoments) -{ - this->calc3rdOrderMoments = calc3rdOrderMoments; - this->isCalc3rdOrderMoments = true; -} - -void ConfigDataImp::setCalcHighOrderMoments(bool calcHighOrderMoments) -{ - this->calcHighOrderMoments = calcHighOrderMoments; - this->isCalcHighOrderMoments = true; -} - -void ConfigDataImp::setReadGeo(bool readGeo) -{ - this->readGeo = readGeo; - this->isReadGeo = true; -} - -void ConfigDataImp::setCalcMedian(bool calcMedian) -{ - this->calcMedian = calcMedian; - this->isCalcMedian = true; -} - -void ConfigDataImp::setCalcDragLift(bool calcDragLift) -{ - this->calcDragLift = calcDragLift; - this->isCalcDragLift = true; -} - -void ConfigDataImp::setCalcCp(bool calcCp) -{ - this->calcCp = calcCp; - this->isCalcCp = true; -} - -void ConfigDataImp::setWriteVeloASCIIfiles(bool writeVeloASCIIfiles) -{ - this->writeVeloASCIIfiles = writeVeloASCIIfiles; - this->isWriteVeloASCII = true; -} - -void ConfigDataImp::setCalcPlaneConc(bool calcPlaneConc) -{ - this->calcPlaneConc = calcPlaneConc; - this->isCalcPlaneConc = true; -} - -void ConfigDataImp::setConcFile(bool concFile) -{ - this->concFile = concFile; - this->isConcFile = true; -} - -void ConfigDataImp::setStreetVelocityFile(bool streetVelocityFile) -{ - this->streetVelocityFile = streetVelocityFile; - this->isStreetVelocityFile = true; -} - -void ConfigDataImp::setUseMeasurePoints(bool useMeasurePoints) -{ - this->useMeasurePoints = useMeasurePoints; - this->isUseMeasurePoints = true; -} - -void ConfigDataImp::setUseWale(bool useWale) -{ - this->useWale = useWale; - this->isUseWale = true; -} - -void ConfigDataImp::setUseInitNeq(bool useInitNeq) -{ - this->useInitNeq = useInitNeq; - this->isUseInitNeq = true; -} - -void ConfigDataImp::setSimulatePorousMedia(bool simulatePorousMedia) -{ - this->simulatePorousMedia = simulatePorousMedia; - this->isSimulatePorousMedia = true; -} - -void ConfigDataImp::setD3Qxx(uint d3Qxx) -{ - this->d3Qxx = d3Qxx; - this->isD3Qxx = true; -} - -void ConfigDataImp::setTEnd(uint tEnd) -{ - this->tEnd = tEnd; - this->isTEnd = true; -} - -void ConfigDataImp::setTOut(uint tOut) -{ - this->tOut = tOut; - this->isTOut = true; -} - -void ConfigDataImp::setTStartOut(uint tStartOut) -{ - this->tStartOut = tStartOut; - this->isTStartOut = true; -} - -void ConfigDataImp::setTimeCalcMedStart(uint timeCalcMedStart) -{ - this->timeCalcMedStart = timeCalcMedStart; - this->isTimeCalcMedStart = true; -} - -void ConfigDataImp::setTimeCalcMedEnd(uint timeCalcMedEnd) -{ - this->timeCalcMedEnd = timeCalcMedEnd; - this->isTimeCalcMedEnd = true; -} - -void ConfigDataImp::setPressInID(uint pressInID) -{ - this->pressInID = pressInID; - this->isPressInID = true; -} - -void ConfigDataImp::setPressOutID(uint pressOutID) -{ - this->pressOutID = pressOutID; - this->isPressOutID = true; -} - -void ConfigDataImp::setPressInZ(uint pressInZ) -{ - this->pressInZ = pressInZ; - this->isPressInZ = true; -} - -void ConfigDataImp::setPressOutZ(uint pressOutZ) -{ - this->pressOutZ = pressOutZ; - this->isPressOutZ = true; -} - -void ConfigDataImp::setDiffOn(bool diffOn) -{ - this->diffOn = diffOn; - this->isDiffOn = true; -} - -void ConfigDataImp::setDiffMod(uint diffMod) -{ - this->diffMod = diffMod; - this->isDiffMod = true; -} - -void ConfigDataImp::setDiffusivity(real diffusivity) -{ - this->diffusivity = diffusivity; - this->isDiffusivity = true; -} - -void ConfigDataImp::setTemperatureInit(real temperatureInit) -{ - this->temperatureInit = temperatureInit; - this->isTemperatureInit = true; -} - -void ConfigDataImp::setTemperatureBC(real temperatureBC) -{ - this->temperatureBC = temperatureBC; - this->isTemperatureBC = true; -} - -// void ConfigDataImp::setViscosity(real viscosity) -//{ -// this->viscosity = viscosity; -// this->isViscosity = true; -//} - -void ConfigDataImp::setVelocity(real velocity) -{ - this->velocity = velocity; - this->isVelocity = true; -} - -void ConfigDataImp::setViscosityRatio(real viscosityRatio) -{ - this->viscosityRatio = viscosityRatio; - this->isViscosityRatio = true; -} - -void ConfigDataImp::setVelocityRatio(real velocityRatio) -{ - this->velocityRatio = velocityRatio; - this->isVelocityRatio = true; -} - -void ConfigDataImp::setDensityRatio(real densityRatio) -{ - this->densityRatio = densityRatio; - this->isDensityRatio = true; -} - -void ConfigDataImp::setPressRatio(real pressRatio) -{ - this->pressRatio = pressRatio; - this->isPressRatio = true; -} - -void ConfigDataImp::setRealX(real realX) -{ - this->realX = realX; - this->isRealX = true; -} - -void ConfigDataImp::setRealY(real realY) -{ - this->realY = realY; - this->isRealY = true; -} - -void ConfigDataImp::setFactorPressBC(real factorPressBC) -{ - this->factorPressBC = factorPressBC; - this->isFactorPressBC = true; -} - -void ConfigDataImp::setGeometryFileC(std::string geometryFileC) -{ - this->geometryFileC = geometryFileC; - this->isGeometryFileC = true; -} - -void ConfigDataImp::setGeometryFileM(std::string geometryFileM) -{ - this->geometryFileM = geometryFileM; - this->isGeometryFileM = true; -} - -void ConfigDataImp::setGeometryFileF(std::string geometryFileF) -{ - this->geometryFileF = geometryFileF; - this->isGeometryFileF = true; -} - -void ConfigDataImp::setClockCycleForMP(uint clockCycleForMP) -{ - this->clockCycleForMP = clockCycleForMP; - this->isClockCycleForMP = true; -} - -void ConfigDataImp::setTimestepForMP(uint timestepForMP) -{ - this->timestepForMP = timestepForMP; - this->isTimestepForMP = true; -} - -void ConfigDataImp::setForcingX(real forcingX) -{ - this->forcingX = forcingX; - this->isForcingX = true; -} - -void ConfigDataImp::setForcingY(real forcingY) -{ - this->forcingY = forcingY; - this->isForcingY = true; -} - -void ConfigDataImp::setForcingZ(real forcingZ) -{ - this->forcingZ = forcingZ; - this->isForcingZ = true; -} - -void ConfigDataImp::setQuadricLimiterP(real quadricLimiterP) -{ - this->quadricLimiterP = quadricLimiterP; - this->isQuadricLimiterP = true; -} - -void ConfigDataImp::setQuadricLimiterM(real quadricLimiterM) -{ - this->quadricLimiterM = quadricLimiterM; - this->isQuadricLimiterM = true; -} - -void ConfigDataImp::setQuadricLimiterD(real quadricLimiterD) -{ - this->quadricLimiterD = quadricLimiterD; - this->isQuadricLimiterD = true; -} - -void ConfigDataImp::setCalcParticles(bool calcParticles) -{ - this->calcParticles = calcParticles; - this->isCalcParticles = true; -} - -void ConfigDataImp::setParticleBasicLevel(int particleBasicLevel) -{ - this->particleBasicLevel = particleBasicLevel; - this->isParticleBasicLevel = true; -} - -void ConfigDataImp::setParticleInitLevel(int particleInitLevel) -{ - this->particleInitLevel = particleInitLevel; - this->isParticleInitLevel = true; -} - -void ConfigDataImp::setNumberOfParticles(int numberOfParticles) -{ - this->numberOfParticles = numberOfParticles; - this->isNumberOfParticles = true; -} - -void ConfigDataImp::setStartXHotWall(real startXHotWall) -{ - this->startXHotWall = startXHotWall; - this->isStartXHotWall = true; -} - -void ConfigDataImp::setEndXHotWall(real endXHotWall) -{ - this->endXHotWall = endXHotWall; - this->isEndXHotWall = true; -} - -void ConfigDataImp::setPossNeighborFilesX(const std::vector<std::string> &possNeighborFilesX) -{ - this->possNeighborFilesX = possNeighborFilesX; - this->isPossNeighborFilesX = true; -} - -void ConfigDataImp::setPossNeighborFilesY(const std::vector<std::string> &possNeighborFilesY) -{ - this->possNeighborFilesY = possNeighborFilesY; - this->isPossNeighborFilesY = true; -} - -void ConfigDataImp::setPossNeighborFilesZ(const std::vector<std::string> &possNeighborFilesZ) -{ - this->possNeighborFilesZ = possNeighborFilesZ; - this->isPossNeighborFilesZ = true; -} - -void ConfigDataImp::setTimeDoCheckPoint(int timeDoCheckPoint) -{ - this->timeDoCheckPoint = timeDoCheckPoint; - this->isTimeDoCheckPoint = true; -} - -void ConfigDataImp::setTimeDoRestart(int timeDoRestart) -{ - this->timeDoRestart = timeDoRestart; - this->isTimeDoRestart = true; -} - -void ConfigDataImp::setDoCheckPoint(bool doCheckPoint) -{ - this->doCheckPoint = doCheckPoint; - this->isDoCheckPoint = true; -} - -void ConfigDataImp::setDoRestart(bool doRestart) -{ - this->doRestart = doRestart; - this->isDoRestart = true; -} - -void ConfigDataImp::setMaxLevel(uint maxLevel) -{ - this->maxLevel = maxLevel; - this->isMaxLevel = true; -} - -void ConfigDataImp::setGridX(const std::vector<int> &gridX) -{ - this->gridX = gridX; - this->isGridX = true; -} - -void ConfigDataImp::setGridY(const std::vector<int> &gridY) -{ - this->gridY = gridY; - this->isGridY = true; -} - -void ConfigDataImp::setGridZ(const std::vector<int> &gridZ) -{ - this->gridZ = gridZ; - this->isGridZ = true; -} - -void ConfigDataImp::setDistX(const std::vector<int> &distX) -{ - this->distX = distX; - this->isDistX = true; -} - -void ConfigDataImp::setDistY(const std::vector<int> &distY) -{ - this->distY = distY; - this->isDistY = true; -} - -void ConfigDataImp::setDistZ(const std::vector<int> &distZ) -{ - this->distZ = distZ; - this->isDistZ = true; -} - -void ConfigDataImp::setNeedInterface(const std::vector<bool> &needInterface) -{ - this->needInterface = needInterface; - this->isNeedInterface = true; -} - -void ConfigDataImp::setMainKernel(const std::string &mainKernel) -{ - this->mainKernel = mainKernel; - this->isMainKernel = true; -} - -void ConfigDataImp::setMultiKernelOn(bool multiKernelOn) -{ - this->multiKernelOn = multiKernelOn; - this->isMultiKernelOn = true; -} - -void ConfigDataImp::setMultiKernelLevel(const std::vector<int> &multiKernelLevel) -{ - this->multiKernelLevel = multiKernelLevel; - this->isMultiKernelLevel = true; -} - -void ConfigDataImp::setMultiKernelName(const std::vector<std::string> &multiKernelName) -{ - this->multiKernelName = multiKernelName; - this->isMultiKernelName = true; -} - -bool ConfigDataImp::isCalc2ndOrderMomentsInConfigFile() { return this->isCalc2ndOrderMoments; } - -bool ConfigDataImp::isCalc3rdOrderMomentsInConfigFile() { return this->isCalc2ndOrderMoments; } - -bool ConfigDataImp::isCalcHighOrderMomentsInConfigFile() { return this->isCalcHighOrderMoments; } - -bool ConfigDataImp::isReadGeoInConfigFile() { return this->isReadGeo; } - -bool ConfigDataImp::isCalcMedianInConfigFile() { return this->isCalcMedian; } - -bool ConfigDataImp::isCalcDragLiftInConfigFile() { return this->isCalcDragLift; } - -bool ConfigDataImp::isCalcCpInConfigFile() { return this->isCalcCp; } - -bool ConfigDataImp::isWriteVeloASCIIfilesInConfigFile() { return this->isWriteVeloASCII; } - -bool ConfigDataImp::isCalcPlaneConcInConfigFile() { return this->isCalcPlaneConc; } - -bool ConfigDataImp::isConcFileInConfigFile() { return this->isConcFile; } - -bool ConfigDataImp::isStreetVelocityFileInConfigFile() { return this->isStreetVelocityFile; } - -bool ConfigDataImp::isUseMeasurePointsInConfigFile() { return this->isUseMeasurePoints; } - -bool ConfigDataImp::isUseWaleInConfigFile() { return this->isUseWale; } - -bool ConfigDataImp::isUseInitNeqInConfigFile() { return this->isUseInitNeq; } - -bool ConfigDataImp::isSimulatePorousMediaInConfigFile() { return this->isSimulatePorousMedia; } - -bool ConfigDataImp::isD3QxxInConfigFile() { return this->isD3Qxx; } - -bool ConfigDataImp::isTEndInConfigFile() { return this->isTEnd; } - -bool ConfigDataImp::isTOutInConfigFile() { return this->isTOut; } - -bool ConfigDataImp::isTStartOutInConfigFile() { return this->isTStartOut; } - -bool ConfigDataImp::isTimeCalcMedStartInConfigFile() { return this->isTimeCalcMedStart; } - -bool ConfigDataImp::isTimeCalcMedEndInConfigFile() { return this->isTimeCalcMedEnd; } - -bool ConfigDataImp::isPressInIDInConfigFile() { return this->isPressInID; } - -bool ConfigDataImp::isPressOutIDInConfigFile() { return this->isPressOutID; } - -bool ConfigDataImp::isPressInZInConfigFile() { return this->isPressInZ; } - -bool ConfigDataImp::isPressOutZInConfigFile() { return this->isPressOutZ; } - -bool ConfigDataImp::isDiffOnInConfigFile() { return this->isDiffOn; } - -bool ConfigDataImp::isDiffModInConfigFile() { return this->isDiffMod; } - -bool ConfigDataImp::isDiffusivityInConfigFile() { return this->isDiffusivity; } - -bool ConfigDataImp::isTemperatureInitInConfigFile() { return this->isTemperatureInit; } - -bool ConfigDataImp::isTemperatureBCInConfigFile() { return this->isTemperatureBC; } - -bool ConfigDataImp::isViscosityInConfigFile() { return this->isViscosity; } - -bool ConfigDataImp::isNumberOfDevicesInConfigFile() { return this->isNumberOfDevices; } - -bool ConfigDataImp::isDevicesInConfigFile() { return this->isDevices; } - -bool ConfigDataImp::isOutputPathInConfigFile() { return this->isOutputPath; } - -bool ConfigDataImp::isPrefixInConfigFile() { return this->isPrefix; } - -bool ConfigDataImp::isGridPathInConfigFile() { return this->isGridPath; } - -bool ConfigDataImp::isPrintOutputFilesInConfigFile() { return this->isPrintOutputFiles; } - -bool ConfigDataImp::isGeometryValuesInConfigFile() { return this->isGeometryValues; } - -bool ConfigDataImp::isVelocityInConfigFile() { return this->isVelocity; } - -bool ConfigDataImp::isViscosityRatioInConfigFile() { return this->isViscosityRatio; } - -bool ConfigDataImp::isVelocityRatioInConfigFile() { return this->isVelocityRatio; } - -bool ConfigDataImp::isDensityRatioInConfigFile() { return this->isDensityRatio; } - -bool ConfigDataImp::isPressRatioInConfigFile() { return this->isPressRatio; } - -bool ConfigDataImp::isRealXInConfigFile() { return this->isRealX; } - -bool ConfigDataImp::isRealYInConfigFile() { return this->isRealY; } - -bool ConfigDataImp::isFactorPressBCInConfigFile() { return this->isFactorPressBC; } - -bool ConfigDataImp::isGeometryFileCInConfigFile() { return this->isGeometryFileC; } - -bool ConfigDataImp::isGeometryFileMInConfigFile() { return this->isGeometryFileM; } - -bool ConfigDataImp::isGeometryFileFInConfigFile() { return this->isGeometryFileF; } - -bool ConfigDataImp::isClockCycleForMPInConfigFile() { return this->isClockCycleForMP; } - -bool ConfigDataImp::isTimestepForMPInConfigFile() { return this->isTimestepForMP; } - -bool ConfigDataImp::isForcingXInConfigFile() { return this->isForcingX; } - -bool ConfigDataImp::isForcingYInConfigFile() { return this->isForcingY; } - -bool ConfigDataImp::isForcingZInConfigFile() { return this->isForcingZ; } - -bool ConfigDataImp::isQuadricLimiterPInConfigFile() { return this->isQuadricLimiterP; } - -bool ConfigDataImp::isQuadricLimiterMInConfigFile() { return this->isQuadricLimiterM; } - -bool ConfigDataImp::isQuadricLimiterDInConfigFile() { return this->isQuadricLimiterD; } - -bool ConfigDataImp::isCalcParticlesInConfigFile() { return this->isCalcParticles; } - -bool ConfigDataImp::isParticleBasicLevelInConfigFile() { return this->isParticleBasicLevel; } - -bool ConfigDataImp::isParticleInitLevelInConfigFile() { return this->isParticleInitLevel; } - -bool ConfigDataImp::isNumberOfParticlesInConfigFile() { return this->isNumberOfParticles; } - -bool ConfigDataImp::isNeighborWSBInConfigFile() { return this->isNeighborWSB; } - -bool ConfigDataImp::isStartXHotWallInConfigFile() { return this->isStartXHotWall; } - -bool ConfigDataImp::isEndXHotWallInConfigFile() { return this->isEndXHotWall; } - -bool ConfigDataImp::isPossNeighborFilesXInConfigFile() { return this->isPossNeighborFilesX; } - -bool ConfigDataImp::isPossNeighborFilesYInConfigFile() { return this->isPossNeighborFilesY; } - -bool ConfigDataImp::isPossNeighborFilesZInConfigFile() { return this->isPossNeighborFilesZ; } - -bool ConfigDataImp::isTimeDoCheckPointInConfigFile() { return this->isTimeDoCheckPoint; } - -bool ConfigDataImp::isTimeDoRestartInConfigFile() { return this->isTimeDoCheckPoint; } - -bool ConfigDataImp::isDoCheckPointInConfigFile() { return this->isDoCheckPoint; } - -bool ConfigDataImp::isDoRestartInConfigFile() { return this->isDoRestart; } - -bool ConfigDataImp::isMaxLevelInConfigFile() { return this->isMaxLevel; } - -bool ConfigDataImp::isGridXInConfigFile() { return this->isGridX; } - -bool ConfigDataImp::isGridYInConfigFile() { return this->isGridY; } - -bool ConfigDataImp::isGridZInConfigFile() { return this->isGridZ; } - -bool ConfigDataImp::isDistXInConfigFile() { return this->isDistX; } - -bool ConfigDataImp::isDistYInConfigFile() { return this->isDistY; } - -bool ConfigDataImp::isDistZInConfigFile() { return this->isDistZ; } - -bool ConfigDataImp::isNeedInterfaceInConfigFile() { return this->isNeedInterface; } - -bool ConfigDataImp::isMainKernelInConfigFile() { return this->isMainKernel; } - -bool ConfigDataImp::isMultiKernelOnInConfigFile() { return this->isMultiKernelOn; } - -bool ConfigDataImp::isMultiKernelLevelInConfigFile() { return this->isMultiKernelLevel; } - -bool ConfigDataImp::isMultiKernelNameInConfigFile() { return this->isMultiKernelName; } diff --git a/src/basics/Core/Input/ConfigData/ConfigDataImp.h b/src/basics/Core/Input/ConfigData/ConfigDataImp.h deleted file mode 100644 index 7ceb1c60fe06406b50587d40318de1b40beaa2f6..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigData/ConfigDataImp.h +++ /dev/null @@ -1,479 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigDataImp.h -//! \ingroup ConfigData -//! \author Soeren Peters, Martin Schoenherr -//======================================================================================= -#ifndef CONFIGDATAIMP_H -#define CONFIGDATAIMP_H - -#include "ConfigData.h" - -#include <memory> -#include <string> - -class ConfigDataImp : public ConfigData -{ -public: - static std::shared_ptr<ConfigDataImp> getNewInstance(); - - real getViscosity() override; - uint getNumberOfDevices() override; - std::vector<uint> getDevices() override; - std::string getOutputPath() override; - std::string getPrefix() override; - std::string getGridPath() override; - bool getPrintOutputFiles() override; - bool getGeometryValues() override; - bool getCalc2ndOrderMoments() override; - bool getCalc3rdOrderMoments() override; - bool getCalcHighOrderMoments() override; - bool getReadGeo() override; - bool getCalcMedian() override; - bool getCalcDragLift() override; - bool getCalcCp() override; - bool getWriteVeloASCIIfiles() override; - bool getCalcPlaneConc() override; - bool getConcFile() override; - bool getStreetVelocityFile() override; - bool getUseMeasurePoints() override; - bool getUseWale() override; - bool getUseInitNeq() override; - bool getSimulatePorousMedia() override; - uint getD3Qxx() override; - uint getTEnd() override; - uint getTOut() override; - uint getTStartOut() override; - uint getTimeCalcMedStart() override; - uint getTimeCalcMedEnd() override; - uint getPressInID() override; - uint getPressOutID() override; - uint getPressInZ() override; - uint getPressOutZ() override; - bool getDiffOn() override; - uint getDiffMod() override; - real getDiffusivity() override; - real getTemperatureInit() override; - real getTemperatureBC() override; - real getVelocity() override; - real getViscosityRatio() override; - real getVelocityRatio() override; - real getDensityRatio() override; - real getPressRatio() override; - real getRealX() override; - real getRealY() override; - real getFactorPressBC() override; - std::string getGeometryFileC() override; - std::string getGeometryFileM() override; - std::string getGeometryFileF() override; - uint getClockCycleForMP() override; - uint getTimestepForMP() override; - real getForcingX() override; - real getForcingY() override; - real getForcingZ() override; - real getQuadricLimiterP() override; - real getQuadricLimiterM() override; - real getQuadricLimiterD() override; - bool getCalcParticles() override; - int getParticleBasicLevel() override; - int getParticleInitLevel() override; - int getNumberOfParticles() override; - real getStartXHotWall() override; - real getEndXHotWall() override; - std::vector<std::string> getPossNeighborFilesX() override; - std::vector<std::string> getPossNeighborFilesY() override; - std::vector<std::string> getPossNeighborFilesZ() override; - // std::vector<std::string> getPossNeighborFilesX(); - // std::vector<std::string> getPossNeighborFilesY(); - // std::vector<std::string> getPossNeighborFilesZ(); - int getTimeDoCheckPoint() override; - int getTimeDoRestart() override; - bool getDoCheckPoint() override; - bool getDoRestart() override; - uint getMaxLevel() override; - std::vector<int> getGridX() override; - std::vector<int> getGridY() override; - std::vector<int> getGridZ() override; - std::vector<int> getDistX() override; - std::vector<int> getDistY() override; - std::vector<int> getDistZ() override; - std::vector<bool> getNeedInterface() override; - std::string getMainKernel() override; - bool getMultiKernelOn() override; - std::vector<int> getMultiKernelLevel() override; - std::vector<std::string> getMultiKernelName() override; - - void setViscosity(real viscosity); - void setNumberOfDevices(uint numberOfDevices); - void setDevices(std::vector<uint> devices); - void setOutputPath(std::string outputPath); - void setPrefix(std::string prefix); - void setGridPath(std::string gridPath); - void setPrintOutputFiles(bool printOutputFiles); - void setGeometryValues(bool geometryValues); - void setCalc2ndOrderMoments(bool calc2ndOrderMoments); - void setCalc3rdOrderMoments(bool calc3rdOrderMoments); - void setCalcHighOrderMoments(bool calcHighOrderMoment); - void setReadGeo(bool readGeo); - void setCalcMedian(bool calcMedian); - void setCalcDragLift(bool calcDragLift); - void setCalcCp(bool calcCp); - void setWriteVeloASCIIfiles(bool writeVeloASCIIfiles); - void setCalcPlaneConc(bool calcPlaneConc); - void setConcFile(bool concFile); - void setStreetVelocityFile(bool streetVelocityFile); - void setUseMeasurePoints(bool useMeasurePoints); - void setUseWale(bool useWale); - void setUseInitNeq(bool useInitNeq); - void setSimulatePorousMedia(bool simulatePorousMedia); - void setD3Qxx(uint d3Qxx); - void setTEnd(uint tEnd); - void setTOut(uint tOut); - void setTStartOut(uint tStartOut); - void setTimeCalcMedStart(uint timeCalcMedStart); - void setTimeCalcMedEnd(uint timeCalcMedEnd); - void setPressInID(uint pressInID); - void setPressOutID(uint pressOutID); - void setPressInZ(uint pressInZ); - void setPressOutZ(uint pressOutZ); - void setDiffOn(bool diffOn); - void setDiffMod(uint diffMod); - void setDiffusivity(real diffusivity); - void setTemperatureInit(real temperatureInit); - void setTemperatureBC(real temperatureBC); - // void setViscosity(real viscosity); - void setVelocity(real velocity); - void setViscosityRatio(real viscosityRatio); - void setVelocityRatio(real velocityRatio); - void setDensityRatio(real fensityRatio); - void setPressRatio(real pressRatio); - void setRealX(real realX); - void setRealY(real realY); - void setFactorPressBC(real factorPressBC); - void setGeometryFileC(std::string geometryFileC); - void setGeometryFileM(std::string geometryFileM); - void setGeometryFileF(std::string geometryFileF); - void setClockCycleForMP(uint clockCycleForMP); - void setTimestepForMP(uint timestepForMP); - void setForcingX(real forcingX); - void setForcingY(real forcingY); - void setForcingZ(real forcingZ); - void setQuadricLimiterP(real quadricLimiterP); - void setQuadricLimiterM(real quadricLimiterM); - void setQuadricLimiterD(real quadricLimiterD); - void setCalcParticles(bool calcParticles); - void setParticleBasicLevel(int particleBasicLevel); - void setParticleInitLevel(int particleInitLevel); - void setNumberOfParticles(int numberOfParticles); - void setStartXHotWall(real startXHotWall); - void setEndXHotWall(real endXHotWall); - void setPossNeighborFilesX(const std::vector<std::string> &possNeighborFilesX); - void setPossNeighborFilesY(const std::vector<std::string> &possNeighborFilesY); - void setPossNeighborFilesZ(const std::vector<std::string> &possNeighborFilesZ); - // void setPossNeighborFilesX(std::vector<std::string> possNeighborFilesX); - // void setPossNeighborFilesY(std::vector<std::string> possNeighborFilesY); - // void setPossNeighborFilesZ(std::vector<std::string> possNeighborFilesZ); - void setTimeDoCheckPoint(int timeDoCheckPoint); - void setTimeDoRestart(int timeDoRestart); - void setDoCheckPoint(bool doCheckPoint); - void setDoRestart(bool doRestart); - void setMaxLevel(uint maxLevel); - void setGridX(const std::vector<int> &gridX); - void setGridY(const std::vector<int> &gridY); - void setGridZ(const std::vector<int> &gridZ); - void setDistX(const std::vector<int> &distX); - void setDistY(const std::vector<int> &distY); - void setDistZ(const std::vector<int> &distZ); - void setNeedInterface(const std::vector<bool> &needInterface); - void setMainKernel(const std::string &mainKernel); - void setMultiKernelOn(bool multiKernelOn); - void setMultiKernelLevel(const std::vector<int> &multiKernelLevel); - void setMultiKernelName(const std::vector<std::string> &multiKernelName); - - bool isViscosityInConfigFile() override; - bool isNumberOfDevicesInConfigFile() override; - bool isDevicesInConfigFile() override; - bool isOutputPathInConfigFile() override; - bool isPrefixInConfigFile() override; - bool isGridPathInConfigFile() override; - bool isPrintOutputFilesInConfigFile() override; - bool isGeometryValuesInConfigFile() override; - bool isCalc2ndOrderMomentsInConfigFile() override; - bool isCalc3rdOrderMomentsInConfigFile() override; - bool isCalcHighOrderMomentsInConfigFile() override; - bool isReadGeoInConfigFile() override; - bool isCalcMedianInConfigFile() override; - bool isCalcDragLiftInConfigFile() override; - bool isCalcCpInConfigFile() override; - bool isWriteVeloASCIIfilesInConfigFile() override; - bool isCalcPlaneConcInConfigFile() override; - bool isConcFileInConfigFile() override; - bool isStreetVelocityFileInConfigFile() override; - bool isUseMeasurePointsInConfigFile() override; - bool isUseWaleInConfigFile() override; - bool isUseInitNeqInConfigFile() override; - bool isSimulatePorousMediaInConfigFile() override; - bool isD3QxxInConfigFile() override; - bool isTEndInConfigFile() override; - bool isTOutInConfigFile() override; - bool isTStartOutInConfigFile() override; - bool isTimeCalcMedStartInConfigFile() override; - bool isTimeCalcMedEndInConfigFile() override; - bool isPressInIDInConfigFile() override; - bool isPressOutIDInConfigFile() override; - bool isPressInZInConfigFile() override; - bool isPressOutZInConfigFile() override; - bool isDiffOnInConfigFile() override; - bool isDiffModInConfigFile() override; - bool isDiffusivityInConfigFile() override; - bool isTemperatureInitInConfigFile() override; - bool isTemperatureBCInConfigFile() override; - // bool isViscosityInConfigFile(); - bool isVelocityInConfigFile() override; - bool isViscosityRatioInConfigFile() override; - bool isVelocityRatioInConfigFile() override; - bool isDensityRatioInConfigFile() override; - bool isPressRatioInConfigFile() override; - bool isRealXInConfigFile() override; - bool isRealYInConfigFile() override; - bool isFactorPressBCInConfigFile() override; - bool isGeometryFileCInConfigFile() override; - bool isGeometryFileMInConfigFile() override; - bool isGeometryFileFInConfigFile() override; - bool isClockCycleForMPInConfigFile() override; - bool isTimestepForMPInConfigFile() override; - bool isForcingXInConfigFile() override; - bool isForcingYInConfigFile() override; - bool isForcingZInConfigFile() override; - bool isQuadricLimiterPInConfigFile() override; - bool isQuadricLimiterMInConfigFile() override; - bool isQuadricLimiterDInConfigFile() override; - bool isCalcParticlesInConfigFile() override; - bool isParticleBasicLevelInConfigFile() override; - bool isParticleInitLevelInConfigFile() override; - bool isNumberOfParticlesInConfigFile() override; - bool isNeighborWSBInConfigFile() override; - bool isStartXHotWallInConfigFile() override; - bool isEndXHotWallInConfigFile() override; - bool isPossNeighborFilesXInConfigFile() override; - bool isPossNeighborFilesYInConfigFile() override; - bool isPossNeighborFilesZInConfigFile() override; - bool isTimeDoCheckPointInConfigFile() override; - bool isTimeDoRestartInConfigFile() override; - bool isDoCheckPointInConfigFile() override; - bool isDoRestartInConfigFile() override; - bool isMaxLevelInConfigFile() override; - bool isGridXInConfigFile() override; - bool isGridYInConfigFile() override; - bool isGridZInConfigFile() override; - bool isDistXInConfigFile() override; - bool isDistYInConfigFile() override; - bool isDistZInConfigFile() override; - bool isNeedInterfaceInConfigFile() override; - bool isMainKernelInConfigFile() override; - bool isMultiKernelOnInConfigFile() override; - bool isMultiKernelLevelInConfigFile() override; - bool isMultiKernelNameInConfigFile() override; - -private: - ConfigDataImp() = default; - - real viscosity { 0. }; - uint numberOfDevices { 0 }; - std::vector<uint> devices; - std::string outputPath; - std::string prefix; - std::string gridPath; - bool printOutputFiles { false }; - bool geometryValues { false }; - bool calc2ndOrderMoments { false }; - bool calc3rdOrderMoments { false }; - bool calcHighOrderMoments { false }; - bool readGeo { false }; - bool calcMedian { false }; - bool calcDragLift { false }; - bool calcCp { false }; - bool writeVeloASCIIfiles { false }; - bool calcPlaneConc { false }; - bool concFile { false }; - bool streetVelocityFile { false }; - bool useMeasurePoints { false }; - bool useWale { false }; - bool useInitNeq { false }; - bool simulatePorousMedia { false }; - uint d3Qxx { 0 }; - uint tEnd { 0 }; - uint tOut { 0 }; - uint tStartOut { 0 }; - uint timeCalcMedStart { 0 }; - uint timeCalcMedEnd { 0 }; - uint pressInID { 0 }; - uint pressOutID { 0 }; - uint pressInZ { 0 }; - uint pressOutZ { 0 }; - bool diffOn { false }; - uint diffMod { 0 }; - real diffusivity { 0. }; - real temperatureInit { 0. }; - real temperatureBC { 0. }; - // real viscosity { 0 }; - real velocity { 0. }; - real viscosityRatio { 0. }; - real velocityRatio { 0. }; - real densityRatio { 0. }; - real pressRatio { 0. }; - real realX { 0. }; - real realY { 0. }; - real factorPressBC { 0. }; - std::string geometryFileC; - std::string geometryFileM; - std::string geometryFileF; - uint clockCycleForMP { 0 }; - uint timestepForMP { 0 }; - real forcingX { 0. }; - real forcingY { 0. }; - real forcingZ { 0. }; - real quadricLimiterP { 0. }; - real quadricLimiterM { 0. }; - real quadricLimiterD { 0. }; - bool calcParticles { false }; - int particleBasicLevel { 0 }; - int particleInitLevel { 0 }; - int numberOfParticles { 0 }; - real startXHotWall { 0. }; - real endXHotWall { 0. }; - std::vector<std::string> possNeighborFilesX; - std::vector<std::string> possNeighborFilesY; - std::vector<std::string> possNeighborFilesZ; - // std::vector<std::string> possNeighborFilesX; - // std::vector<std::string> possNeighborFilesY; - // std::vector<std::string> possNeighborFilesZ; - int timeDoCheckPoint { 0 }; - int timeDoRestart { 0 }; - bool doCheckPoint{ false }; - bool doRestart{ false }; - int maxLevel { 0 }; - std::vector<int> gridX; - std::vector<int> gridY; - std::vector<int> gridZ; - std::vector<int> distX; - std::vector<int> distY; - std::vector<int> distZ; - std::vector<bool> needInterface; - std::string mainKernel; - bool multiKernelOn{ false }; - std::vector<int> multiKernelLevel; - std::vector<std::string> multiKernelName; - - bool isViscosity { false }; - bool isNumberOfDevices {false}; - bool isDevices { false }; - bool isOutputPath { false }; - bool isPrefix { false }; - bool isGridPath { false }; - bool isPrintOutputFiles { false }; - bool isGeometryValues { false }; - bool isCalc2ndOrderMoments { false }; - bool isCalc3rdOrderMoments { false }; - bool isCalcHighOrderMoments { false }; - bool isReadGeo { false }; - bool isCalcMedian { false }; - bool isCalcDragLift { false }; - bool isCalcCp { false }; - bool isWriteVeloASCII { false }; - bool isCalcPlaneConc { false }; - bool isConcFile { false }; - bool isStreetVelocityFile { false }; - bool isUseMeasurePoints { false }; - bool isUseWale { false }; - bool isUseInitNeq { false }; - bool isSimulatePorousMedia { false }; - bool isD3Qxx { false }; - bool isTEnd { false }; - bool isTOut { false }; - bool isTStartOut { false }; - bool isTimeCalcMedStart { false }; - bool isTimeCalcMedEnd { false }; - bool isPressInID { false }; - bool isPressOutID { false }; - bool isPressInZ { false }; - bool isPressOutZ { false }; - bool isDiffOn { false }; - bool isDiffMod { false }; - bool isDiffusivity { false }; - bool isTemperatureInit { false }; - bool isTemperatureBC { false }; - // bool isViscosity { false }; - bool isVelocity { false }; - bool isViscosityRatio { false }; - bool isVelocityRatio { false }; - bool isDensityRatio { false }; - bool isPressRatio { false }; - bool isRealX { false }; - bool isRealY { false }; - bool isFactorPressBC { false }; - bool isGeometryFileC { false }; - bool isGeometryFileM { false }; - bool isGeometryFileF { false }; - bool isClockCycleForMP { false }; - bool isTimestepForMP { false }; - bool isForcingX { false }; - bool isForcingY { false }; - bool isForcingZ { false }; - bool isQuadricLimiterP { false }; - bool isQuadricLimiterM { false }; - bool isQuadricLimiterD { false }; - bool isCalcParticles { false }; - bool isParticleBasicLevel { false }; - bool isParticleInitLevel { false }; - bool isNumberOfParticles { false }; - bool isNeighborWSB { false }; - bool isStartXHotWall { false }; - bool isEndXHotWall { false }; - bool isPossNeighborFilesX { false }; - bool isPossNeighborFilesY { false }; - bool isPossNeighborFilesZ { false }; - bool isTimeDoCheckPoint { false }; - bool isTimeDoRestart { false }; - bool isDoCheckPoint { false }; - bool isDoRestart { false }; - bool isMaxLevel { false }; - bool isGridX { false }; - bool isGridY { false }; - bool isGridZ { false }; - bool isDistX { false }; - bool isDistY { false }; - bool isDistZ { false }; - bool isNeedInterface { false }; - bool isMainKernel { false }; - bool isMultiKernelOn { false }; - bool isMultiKernelLevel { false }; - bool isMultiKernelName { false }; -}; -#endif diff --git a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp b/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp deleted file mode 100644 index f440d30ddb706b55b1055dffcdf2fb217e7b2148..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp +++ /dev/null @@ -1,294 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigFileReader.cpp -//! \ingroup ConfigFileReader -//! \author Soeren Peters -//======================================================================================= -#include "ConfigFileReader.h" -#include "../../StringUtilities/StringUtil.h" -#include "../ConfigData/ConfigDataImp.h" -#include "../Input.h" - -#include <fstream> -#include <iostream> - -std::shared_ptr<ConfigFileReader> ConfigFileReader::getNewInstance() -{ - return std::shared_ptr<ConfigFileReader>(new ConfigFileReader()); -} - -std::shared_ptr<ConfigData> ConfigFileReader::readConfigFile(const char* filePath) const -{ - std::cout << filePath << std::endl; - std::shared_ptr<ConfigDataImp> data = ConfigDataImp::getNewInstance(); - std::ifstream stream; - stream.open(filePath, std::ios::in); - if (stream.fail()) - throw std::runtime_error("can not open config file!"); - std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config"); - - if (input->getValue("NumberOfDevices") != "") - data->setNumberOfDevices(StringUtil::toInt(input->getValue("NumberOfDevices"))); - - if (input->getValue("Devices") != "") - data->setDevices(StringUtil::toUintVector(input->getValue("Devices"))); - - if (input->getValue("Path") != "") - data->setOutputPath(input->getValue("Path")); - - if (input->getValue("Prefix") != "") - data->setPrefix(input->getValue("Prefix")); - - if (input->getValue("GridPath") != "") - data->setGridPath(input->getValue("GridPath")); - else { - std::cout << "GridPath has to be defined!" << std::endl; - exit(1); - } - - if (input->getValue("WriteGrid") != "") - data->setPrintOutputFiles(StringUtil::toBool(input->getValue("WriteGrid"))); - - if (input->getValue("GeometryValues") != "") - data->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); - - if (input->getValue("calc2ndOrderMoments") != "") - data->setCalc2ndOrderMoments(StringUtil::toBool(input->getValue("calc2ndOrderMoments"))); - - if (input->getValue("calc3rdOrderMoments") != "") - data->setCalc3rdOrderMoments(StringUtil::toBool(input->getValue("calc3rdOrderMoments"))); - - if (input->getValue("calcHigherOrderMoments") != "") - data->setCalcHighOrderMoments(StringUtil::toBool(input->getValue("calcHigherOrderMoments"))); - - if (input->getValue("ReadGeometry") != "") - data->setReadGeo(StringUtil::toBool(input->getValue("ReadGeometry"))); - - if (input->getValue("calcMedian") != "") - data->setCalcMedian(StringUtil::toBool(input->getValue("calcMedian"))); - - if (input->getValue("UseConcFile") != "") - data->setConcFile(StringUtil::toBool(input->getValue("UseConcFile"))); - - if (input->getValue("UseStreetVelocityFile") != "") - data->setStreetVelocityFile(StringUtil::toBool(input->getValue("UseStreetVelocityFile"))); - - if (input->getValue("UseMeasurePoints") != "") - data->setUseMeasurePoints(StringUtil::toBool(input->getValue("UseMeasurePoints"))); - - if (input->getValue("UseWale") != "") - data->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); - - if (input->getValue("UseInitNeq") != "") - data->setUseInitNeq(StringUtil::toBool(input->getValue("UseInitNeq"))); - - if (input->getValue("SimulatePorousMedia") != "") - data->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); - - if (input->getValue("D3Qxx") != "") - data->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - - if (input->getValue("TimeEnd") != "") - data->setTEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - - if (input->getValue("TimeOut") != "") - data->setTOut(StringUtil::toInt(input->getValue("TimeOut"))); - - if (input->getValue("TimeStartOut") != "") - data->setTStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); - - if (input->getValue("TimeStartCalcMedian") != "") - data->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); - - if (input->getValue("TimeEndCalcMedian") != "") - data->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); - - if (input->getValue("PressInID") != "") - data->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); - - if (input->getValue("PressOutID") != "") - data->setPressOutID(StringUtil::toInt(input->getValue("PressOutID"))); - - if (input->getValue("PressInZ") != "") - data->setPressInZ(StringUtil::toInt(input->getValue("PressInZ"))); - - if (input->getValue("PressOutZ") != "") - data->setPressOutZ(StringUtil::toInt(input->getValue("PressOutZ"))); - ////////////////////////////////////////////////////////////////////////// - if (input->getValue("DiffOn") != "") - data->setDiffOn(StringUtil::toBool(input->getValue("DiffOn"))); - - if (input->getValue("DiffMod") != "") - data->setDiffMod(StringUtil::toInt(input->getValue("DiffMod"))); - - if (input->getValue("Diffusivity") != "") - data->setDiffusivity(StringUtil::toFloat(input->getValue("Diffusivity"))); - - if (input->getValue("Temp") != "") - data->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); - - if (input->getValue("TempBC") != "") - data->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); - ////////////////////////////////////////////////////////////////////////// - if (input->getValue("Viscosity_LB") != "") - data->setViscosity(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - - if (input->getValue("Velocity_LB") != "") - data->setVelocity(StringUtil::toFloat(input->getValue("Velocity_LB"))); - - if (input->getValue("Viscosity_Ratio_World_to_LB") != "") - data->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); - - if (input->getValue("Velocity_Ratio_World_to_LB") != "") - data->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); - - if (input->getValue("Density_Ratio_World_to_LB") != "") - data->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); - - if (input->getValue("Delta_Press") != "") - data->setPressRatio(StringUtil::toFloat(input->getValue("Delta_Press"))); - - if (input->getValue("SliceRealX") != "") - data->setRealX(StringUtil::toFloat(input->getValue("SliceRealX"))); - - if (input->getValue("SliceRealY") != "") - data->setRealY(StringUtil::toFloat(input->getValue("SliceRealY"))); - - if (input->getValue("FactorPressBC") != "") - data->setFactorPressBC(StringUtil::toFloat(input->getValue("FactorPressBC"))); - - if (input->getValue("GeometryC") != "") - data->setGeometryFileC(input->getValue("GeometryC")); - - if (input->getValue("GeometryM") != "") - data->setGeometryFileM(input->getValue("GeometryM")); - - if (input->getValue("GeometryF") != "") - data->setGeometryFileF(input->getValue("GeometryF")); - ////////////////////////////////////////////////////////////////////////// - if (input->getValue("measureClockCycle") != "") - data->setClockCycleForMP(StringUtil::toInt(input->getValue("measureClockCycle"))); - - if (input->getValue("measureTimestep") != "") - data->setTimestepForMP(StringUtil::toInt(input->getValue("measureTimestep"))); - ////////////////////////////////////////////////////////////////////////// - // Forcing - if (input->getValue("ForcingX") != "") - data->setForcingX(StringUtil::toFloat(input->getValue("ForcingX"))); - if (input->getValue("ForcingY") != "") - data->setForcingY(StringUtil::toFloat(input->getValue("ForcingY"))); - if (input->getValue("ForcingZ") != "") - data->setForcingZ(StringUtil::toFloat(input->getValue("ForcingZ"))); - ////////////////////////////////////////////////////////////////////////// - // Quadric Limiters - if (input->getValue("QuadricLimiterP") != "") - data->setQuadricLimiterP(StringUtil::toFloat(input->getValue("QuadricLimiterP"))); - if (input->getValue("QuadricLimiterM") != "") - data->setQuadricLimiterM(StringUtil::toFloat(input->getValue("QuadricLimiterM"))); - if (input->getValue("QuadricLimiterD") != "") - data->setQuadricLimiterD(StringUtil::toFloat(input->getValue("QuadricLimiterD"))); - ////////////////////////////////////////////////////////////////////////// - // Particles - if (input->getValue("calcParticles") != "") - data->setCalcParticles(StringUtil::toBool(input->getValue("calcParticles"))); - - if (input->getValue("baseLevel") != "") - data->setParticleBasicLevel(StringUtil::toInt(input->getValue("baseLevel"))); - - if (input->getValue("initLevel") != "") - data->setParticleInitLevel(StringUtil::toInt(input->getValue("initLevel"))); - - if (input->getValue("numberOfParticles") != "") - data->setNumberOfParticles(StringUtil::toInt(input->getValue("numberOfParticles"))); - - if (input->getValue("startXHotWall") != "") - data->setStartXHotWall(real(StringUtil::toDouble(input->getValue("startXHotWall")))); - - if (input->getValue("endXHotWall") != "") - data->setEndXHotWall(real(StringUtil::toDouble(input->getValue("endXHotWall")))); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Restart - if (input->getValue("TimeDoCheckPoint") != "") - data->setTimeDoCheckPoint(StringUtil::toInt(input->getValue("TimeDoCheckPoint"))); - - if (input->getValue("TimeDoRestart") != "") - data->setTimeDoRestart(StringUtil::toInt(input->getValue("TimeDoRestart"))); - - if (input->getValue("DoCheckPoint") != "") - data->setDoCheckPoint(StringUtil::toBool(input->getValue("DoCheckPoint"))); - - if (input->getValue("DoRestart") != "") - data->setDoRestart(StringUtil::toBool(input->getValue("DoRestart"))); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (input->getValue("NOGL") != "") - data->setMaxLevel(StringUtil::toInt(input->getValue("NOGL"))); - - if (input->getValue("GridX") != "") - data->setGridX(StringUtil::toIntVector(input->getValue("GridX"))); - - if (input->getValue("GridY") != "") - data->setGridY(StringUtil::toIntVector(input->getValue("GridY"))); - - if (input->getValue("GridZ") != "") - data->setGridZ(StringUtil::toIntVector(input->getValue("GridZ"))); - - if (input->getValue("DistX") != "") - data->setDistX(StringUtil::toIntVector(input->getValue("DistX"))); - - if (input->getValue("DistY") != "") - data->setDistY(StringUtil::toIntVector(input->getValue("DistY"))); - - if (input->getValue("DistZ") != "") - data->setDistZ(StringUtil::toIntVector(input->getValue("DistZ"))); - - if (input->getValue("NeedInterface") != "") - data->setNeedInterface(StringUtil::toBoolVector(input->getValue("NeedInterface"))); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Kernel - if (input->getValue("MainKernelName") != "") - data->setMainKernel(input->getValue("MainKernelName")); - - if (input->getValue("MultiKernelOn") != "") - data->setMultiKernelOn(StringUtil::toBool(input->getValue("MultiKernelOn"))); - - if (input->getValue("MultiKernelLevel") != "") - data->setMultiKernelLevel(StringUtil::toIntVector(input->getValue("MultiKernelLevel"))); - - if (input->getValue("MultiKernelName") != "") - data->setMultiKernelName(StringUtil::toStringVector(input->getValue("MultiKernelName"))); - - if (StringUtil::toStringVector(input->getValue("MultiKernelName")).size() != - StringUtil::toIntVector(input->getValue("MultiKernelLevel")).size()) { - std::cout << "MultiKernelName and MultiKernelLevel has to be of same size!" << std::endl; - exit(1); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - return data; -} diff --git a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.h b/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.h deleted file mode 100644 index 29d88cc5394799ed2547219bdfe34597b4b7ceea..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.h +++ /dev/null @@ -1,54 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigFileReader.h -//! \ingroup ConfigFileReader -//! \author Soeren Peters -//======================================================================================= -#ifndef CONFIGFILEREADER_H -#define CONFIGFILEREADER_H - - -#include <memory> -#include <string> - -#include "basics_export.h" - -class ConfigData; - -class ConfigFileReader -{ -public: - BASICS_EXPORT static std::shared_ptr<ConfigFileReader> getNewInstance(); - - BASICS_EXPORT std::shared_ptr<ConfigData> readConfigFile(const char* filePath) const; - -private: - ConfigFileReader() = default; -}; -#endif diff --git a/src/basics/Core/Input/ConfigInput/ConfigInput.cpp b/src/basics/Core/Input/ConfigInput/ConfigInput.cpp deleted file mode 100644 index 55ed498d4710cd799995377c69e6c130292f5073..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigInput/ConfigInput.cpp +++ /dev/null @@ -1,254 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigInput.cpp -//! \ingroup ConfigInput -//! \author Soeren Peters -//======================================================================================= -#include "ConfigInput.h" -#include <algorithm> -#include <cerrno> -#include <iostream> -#include <sstream> -#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() = default; - -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 (size_t 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'; } - -} // namespace input diff --git a/src/basics/Core/Input/ConfigInput/ConfigInput.h b/src/basics/Core/Input/ConfigInput/ConfigInput.h deleted file mode 100644 index 50c9f05bf698320ad57c6999ea5c8bded820e6e5..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/ConfigInput/ConfigInput.h +++ /dev/null @@ -1,80 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file ConfigInput.h -//! \ingroup ConfigInput -//! \author Soeren Peters -//======================================================================================= -#ifndef ConfigInput_H -#define ConfigInput_H -#include <istream> -#include <list> -#include <map> -#include <memory> -#include <string> -#include <vector> - -#include "../Input.h" -#include "basics_export.h" - -namespace input -{ -class ConfigInput : public Input -{ -public: - BASICS_EXPORT ConfigInput(std::istream &stream); - BASICS_EXPORT ~ConfigInput() override; - - BASICS_EXPORT bool hasValue(const std::string &key) const override; - BASICS_EXPORT std::string getValue(const std::string &key) override; - -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; - using String_Pair = std::pair<std::string, std::string>; - std::map<std::string, std::string> configEntries; -}; -} // namespace input -#endif diff --git a/src/basics/Core/Input/Input.cpp b/src/basics/Core/Input/Input.cpp deleted file mode 100644 index d439ddbcedb236692e0ea2fd42cb77639fc7253c..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/Input.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Input.cpp -//! \ingroup Input -//! \author Soeren Peters -//======================================================================================= -#include "Input.h" - -#include <memory> - -#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); -} - -} // namespace input diff --git a/src/basics/Core/Input/Input.h b/src/basics/Core/Input/Input.h deleted file mode 100644 index fc1f456fa0e12ce1e096cf3390a28c94d5aeb0a1..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/Input.h +++ /dev/null @@ -1,56 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Input.h -//! \ingroup Input -//! \author Soeren Peters -//======================================================================================= -#ifndef Input_H -#define Input_H - -#include "basics_export.h" - -#include <istream> -#include <memory> -#include <string> - -namespace input -{ -class Input -{ -public: - static BASICS_EXPORT std::unique_ptr<Input> makeInput(std::istream &stream, const std::string &inputType); - - virtual ~Input() = default; - - virtual bool hasValue(const std::string &key) const = 0; - virtual std::string getValue(const std::string &key) = 0; -}; -} // namespace input - -#endif diff --git a/src/basics/Core/Input/JsonInput/JsonInput.cpp b/src/basics/Core/Input/JsonInput/JsonInput.cpp deleted file mode 100644 index 1c440ea16b4ab35fe2de514b298c6488c33d5a90..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/JsonInput/JsonInput.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file JsonInput.cpp -//! \ingroup JsonInput -//! \author Soeren Peters -//======================================================================================= -#ifdef BUILD_JSONCPP - -#include "JsonInput.h" - -#include <fstream> -#include <iterator> -#include <sstream> -#include <string> -#include <vector> - -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 ""; -} - -} // namespace input - -#endif diff --git a/src/basics/Core/Input/JsonInput/JsonInput.h b/src/basics/Core/Input/JsonInput/JsonInput.h deleted file mode 100644 index 1f73698feef68ec55f96eb69678fbc806821335b..0000000000000000000000000000000000000000 --- a/src/basics/Core/Input/JsonInput/JsonInput.h +++ /dev/null @@ -1,62 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file JsonInput.h -//! \ingroup JsonInput -//! \author Soeren Peters -//======================================================================================= -#ifdef BUILD_JSONCPP - -#ifndef JsonInput_H -#define JsonInput_H - -#include <json/json.h> -#include <string> - -#include "basics_export.h" - -#include "../Input.h" - -namespace input -{ -class JsonInput : public Input -{ -public: - BASICS_EXPORT JsonInput(std::istream &stream); - - BASICS_EXPORT virtual bool hasValue(const std::string &key) const override; - BASICS_EXPORT virtual std::string getValue(const std::string &key) override; - -private: - Json::Value jsonValue; -}; -} // namespace input - -#endif - -#endif diff --git a/src/basics/Core/VectorTypes.h b/src/basics/Core/VectorTypes.h index e5ab70312bd106628e9357f445b05e1f61fd76a9..2ca45b359397c712b8b8695b9a99b4c5f8c324d1 100644 --- a/src/basics/Core/VectorTypes.h +++ b/src/basics/Core/VectorTypes.h @@ -52,7 +52,7 @@ #include "RealConstants.h" struct BASICS_EXPORT Vec3 { - real x{ c0o1 }, y{ c0o1 }, z{ c0o1 }; + real x{ 0. }, y{ 0. }, z{ 0. }; __host__ __device__ Vec3(real x, real y, real z) : x(x), y(y), z(z) {} Vec3() = default; diff --git a/src/basics/basics/utilities/UbFileInputASCII.cpp b/src/basics/basics/utilities/UbFileInputASCII.cpp index 78b355118ec516123515497c1a3b6c9a5da1380c..f988c52f7e381b988830a4506c72e77221c177d9 100644 --- a/src/basics/basics/utilities/UbFileInputASCII.cpp +++ b/src/basics/basics/utilities/UbFileInputASCII.cpp @@ -30,6 +30,7 @@ //! \ingroup utilities //! \author Soeren Freudiger, Sebastian Geller //======================================================================================= +#include <algorithm> #include <basics/utilities/UbFileInputASCII.h> #include <cstring> @@ -170,7 +171,7 @@ bool UbFileInputASCII::containsString(const string &var) } /*==========================================================*/ int UbFileInputASCII::readIntegerAfterString(const string &var) -// last change [10.3.2004] at [9:46] +// last change [29.6.2021] at [13:52] // suchts in einer Datei nach varname und gibt den dahinter stehenden int-Wert zurueck // z.B. timesteps 9 { @@ -187,14 +188,16 @@ int UbFileInputASCII::readIntegerAfterString(const string &var) " wasn't found in " + this->filename)); } while (strstr(line, var.c_str()) != line); // Ende Schleife, wenn varname ganz in zeile vorkommt - strcpy(line, (line + strlen(var.c_str()))); // zeile um "varname" kuerzen - while ((line[0] == ' ') || (line[0] == '\t')) - strcpy(line, (line + 1)); // Whitespaces entfernen + std::string temp{ line }; + temp = temp.substr(var.size()); // zeile um "varname" kuerzen + + temp.erase(std::remove(temp.begin(), temp.end(), ' '), temp.end()); // remove whitespace + temp.erase(std::remove(temp.begin(), temp.end(), '\t'), temp.end()); // remove tabs - return (atoi(line)); // Umwandlung in int + return std::stoi(temp); } /*==========================================================*/ -// last change [10.3.2004] at [9:46] +// last change [29.6.2021] at [13:52] // sucht in einer Datei nach varname und gibt den dahinter stehenden int-Wert zurueck // z.B. nue 9.5 double UbFileInputASCII::readDoubleAfterString(const string &var) @@ -213,14 +216,16 @@ double UbFileInputASCII::readDoubleAfterString(const string &var) } while (/*!strncmp(varname,line,sizeof(varname))==0*/ strstr(line, var.c_str()) != line); // Ende Schleife, wenn varname ganz in zeile vorkommt - strcpy(line, (line + strlen(var.c_str()))); // zeile um "varname" kuerzen - while ((line[0] == ' ') || (line[0] == '\t')) - strcpy(line, (line + 1)); // Whitespaces entfernen + std::string temp{ line }; + temp = temp.substr(var.size()); // zeile um "varname" kuerzen + + temp.erase(std::remove(temp.begin(), temp.end(), ' '), temp.end()); // remove whitespace + temp.erase(std::remove(temp.begin(), temp.end(), '\t'), temp.end()); // remove tabs - return (atof(line)); // Umwandlung in double + return std::stod(temp); } /*==========================================================*/ -// [9.9.2002] +// last change [29.6.2021] at [13:52] // liefert string-Wert der hinter dem uebergebenen char feld in der datei infile steht // zudem wird der wert in die uebergebene variable value uebertragen (falls man das ergebniss als char benoetig) string UbFileInputASCII::readStringAfterString(const string &var) //,char *value) @@ -239,15 +244,13 @@ string UbFileInputASCII::readStringAfterString(const string &var) //,char *value " wasn't found in " + this->filename)); } while (strstr(line, var.c_str()) != line); // Ende Schleife, wenn varname ganz in zeile vorkommt - strcpy(line, (line + strlen(var.c_str()))); // zeile um "varname" kuerzen - while ((line[0] == ' ') || (line[0] == '\t')) - strcpy(line, (line + 1)); // Whitespaces entfernen + std::string temp{ line }; + temp = temp.substr(var.size()); // zeile um "varname" kuerzen - char *p; - p = strtok(line, " "); // schneidet alles "ab und inklusive space " nach namen ab - p = strtok(line, "\t"); // schneidet alles "ab und inklusive tab " nach namen ab + temp.erase(std::remove(temp.begin(), temp.end(), ' '), temp.end()); // remove whitespace + temp.erase(std::remove(temp.begin(), temp.end(), '\t'), temp.end()); // remove tabs - return static_cast<string>(p); // Umwandlung in string + return temp; } /*==========================================================*/ // last change [10.3.2004] at [9:46] diff --git a/src/basics/basics/utilities/UbFileInputASCIITest.cfg b/src/basics/basics/utilities/UbFileInputASCIITest.cfg new file mode 100644 index 0000000000000000000000000000000000000000..294d58cd2eae2819366e4f9cb2e49195e4fd518a --- /dev/null +++ b/src/basics/basics/utilities/UbFileInputASCIITest.cfg @@ -0,0 +1 @@ +test = 1 diff --git a/src/basics/basics/utilities/UbFileInputASCIITest.cpp b/src/basics/basics/utilities/UbFileInputASCIITest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87cb5ce58eb359239d3c3e29babf04e600edc64c --- /dev/null +++ b/src/basics/basics/utilities/UbFileInputASCIITest.cpp @@ -0,0 +1,18 @@ +#include <gmock/gmock.h> +#include <filesystem> + +#include <basics/utilities/UbFileInputASCII.h> + + +TEST(UbFileInputASCIITest, readIntegerAfterString) +{ + // assuming that the config files is stored parallel to this file. + std::filesystem::path filePath = __FILE__; + filePath.replace_filename("UbFileInputASCIITest.cfg"); + + UbFileInputASCII sut {filePath.string()}; + + const int actual = sut.readIntegerAfterString("test ="); + + EXPECT_THAT(actual, testing::Eq(1)); +} diff --git a/src/basics/config/ConfigurationFile.cpp b/src/basics/config/ConfigurationFile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..026d13e15486c46a7056e061ea075a03c9c06f9f --- /dev/null +++ b/src/basics/config/ConfigurationFile.cpp @@ -0,0 +1,133 @@ +#include "ConfigurationFile.h" + + +#include <map> +#include <vector> +#include <sstream> +#include <string> +#include <fstream> +#include <iostream> +#include <stdlib.h> + +#include <basics/basics/utilities/UbException.h> + + +namespace vf::basics +{ + +void ConfigurationFile::clear() +{ + data.clear(); +} +////////////////////////////////////////////////////////////////////////// +bool ConfigurationFile::load(const std::string& file) +{ + std::ifstream inFile(file.c_str()); + + if (!inFile.good()) + { + UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file "+file+"!")); + } + + while (inFile.good() && ! inFile.eof()) + { + std::string line; + getline(inFile, line); + + // filter out comments + if (!line.empty()) + { + size_t pos = line.find('#'); + + if (pos != std::string::npos) + { + line = line.substr(0, pos); + } + } + + // split line into key and value + if (!line.empty()) + { + size_t pos = line.find('='); + + if (pos != std::string::npos) + { + std::string key = trim(line.substr(0, pos)); + std::string value = trim(line.substr(pos + 1)); + + if (!key.empty() && !value.empty()) + { + data[key] = value; + } + } + } + } + + return true; +} + +////////////////////////////////////////////////////////////////////////// +template<> +bool ConfigurationFile::fromString<bool>(const std::string& str) const +{ + return str == "true"; +} + +////////////////////////////////////////////////////////////////////////// +bool ConfigurationFile::contains(const std::string& key) const +{ + return data.find(key) != data.end(); +} +////////////////////////////////////////////////////////////////////////// +std::string ConfigurationFile::getString(const std::string& key) const +{ + std::map<std::string, std::string>::const_iterator iter = data.find(key); + + if (iter != data.end()) + { + std::string value = iter->second; + return value; + } + else + { + UB_THROW(UbException(UB_EXARGS, "The parameter \"" + key + "\" is missing!")); + } +} +////////////////////////////////////////////////////////////////////////// +std::string ConfigurationFile::trim(const std::string& str) +{ + size_t first = str.find_first_not_of(" \t\n\r"); + + if (first != std::string::npos) + { + size_t last = str.find_last_not_of(" \t\n\r"); + + return str.substr(first, last - first + 1); + } + else + { + return ""; + } +} +////////////////////////////////////////////////////////////////////////// +void ConfigurationFile::split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty) const +{ + std::ostringstream word; + for (size_t n = 0; n < input.size(); ++n) + { + if (std::string::npos == separators.find(input[n])) + word << input[n]; + else + { + if (!word.str().empty() || !remove_empty) + lst.push_back(word.str()); + word.str(""); + } + } + if (!word.str().empty() || !remove_empty) + lst.push_back(word.str()); +} +////////////////////////////////////////////////////////////////////////// + + +} diff --git a/src/basics/config/ConfigurationFile.h b/src/basics/config/ConfigurationFile.h new file mode 100644 index 0000000000000000000000000000000000000000..ef7e7c9f06f94cabb3ba9cbefe95c8ee75736958 --- /dev/null +++ b/src/basics/config/ConfigurationFile.h @@ -0,0 +1,143 @@ +#ifndef BASICS_CONFIGURATIONFILE_H +#define BASICS_CONFIGURATIONFILE_H + +#include <map> +#include <vector> +#include <sstream> +#include <string> +#include <fstream> +#include <iostream> +#include <stdlib.h> + +#include <basics/basics/utilities/UbException.h> + +//! \brief Simple configuration file +//! \details The Configuration class presented here can read and keep values of any configuration file written in a format like this: +//!# +//!# Simulation parameters +//!# +//! +//!nbDimensions = 2 +//!temperature = 25.001 +//!epsilon = 1.013e-14 +//!writeLogFile = false # NOTE: Set to "true" in debug mode only. +//! # Logging slows down the program. +//!errorMessage = the simulation failed +//!origin = 0.0 0.0 0.0 # x, y, z of origin +//! +//!Example how to use it: +//! +//!ConfigurationFile config; +//!config.load(configname); +//! +//!int nbDimensions = config.getValue<int>("nbDimensions"); +//!float temperature = config.getValue<float>("temperature"); +//!double epsilon = config.getValue<double>("epsilon"); +//!bool writeLogFile = config.getValue<bool>("writeLogFile"); +//!string errorMessage = config.getValue<string>("errorMessage"); +//!vector<double> origin = config.getVector<double>("origin"); +//! +//! \author Konstantin Kutscher + + +namespace vf::basics +{ + + +class ConfigurationFile +{ +public: + //! clear all values + void clear(); + + //! load a configuration file + bool load(const std::string& File); + + //! check if value associated with given key exists + bool contains(const std::string& key) const; + + //! get vector with key + template<class T> + std::vector<T> getVector(const std::string& key) const; + + //! get value with key + template<class T> + T getValue(const std::string& key) const; + +private: + //! the container + std::map<std::string, std::string> data; + + //! get string with key + std::string getString(const std::string& key) const; + + //! remove leading and trailing tabs and spaces + static std::string trim(const std::string& str); + + //! convert string to data type T + template<class T> + T fromString(const std::string& str) const; + + void split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty = true) const; +}; + + +////////////////////////////////////////////////////////////////////////// +template<class T> +std::vector<T> ConfigurationFile::getVector(const std::string& key) const +{ + std::string str = getString(key); + std::vector<T> v; + std::vector<std::string> strings; + split(strings, str, "\t\n\r;, "); + for (std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it) + { + if (*it != "") + { + v.push_back(fromString<T>(*it)); + } + } + return v; +} +////////////////////////////////////////////////////////////////////////// +template<class T> +T ConfigurationFile::fromString(const std::string& str) const +{ + std::istringstream stream(str); + T t; + stream >> t; + return t; +} + +template<> +bool ConfigurationFile::fromString<bool>(const std::string& str) const; + +////////////////////////////////////////////////////////////////////////// +template<class T> +T ConfigurationFile::getValue(const std::string& key) const +{ + std::string str = getString(key); + bool bFlag = false; + if ((std::string)typeid(T).name() == (std::string)typeid(bool).name()) + { + bFlag = true; + } + + std::istringstream iss(str); + T x; + iss >> x; + if (!iss && !bFlag) + UB_THROW(UbException(UB_EXARGS, " cannot convert \"" + str + "\" to type <" + static_cast<std::string>(typeid(x).name()) + ">")); + + if (bFlag) + { + bool value = (str == "true"); + x = value; + } + + return x; +} + +} + +#endif diff --git a/src/basics/geometry3d/GbTriFaceMesh3D.cpp b/src/basics/geometry3d/GbTriFaceMesh3D.cpp index 3afc6aa4bdece92fe1139d7521222a8c92528ce1..7da89fc9bf0565ec7862939ffa652b3ff1880a4f 100644 --- a/src/basics/geometry3d/GbTriFaceMesh3D.cpp +++ b/src/basics/geometry3d/GbTriFaceMesh3D.cpp @@ -1143,22 +1143,23 @@ void GbTriFaceMesh3D::readMeshFromSTLFileBinary(string filename, bool removeRedu } char title[80]; int nFaces; - fread(title, 80, 1, f); - fread((void *)&nFaces, 4, 1, f); + size_t sizef = fread(title, 80, 1, f); + sizef = fread((void *)&nFaces, 4, 1, f); float v[12]; // normal=3, vertices=3*3 = 12 unsigned short uint16; // Every Face is 50 Bytes: Normal(3*float), Vertices(9*float), 2 Bytes Spacer for (int i = 0; i < nFaces; ++i) { for (size_t j = 0; j < 12; ++j) { - fread((void *)&v[j], sizeof(float), 1, f); + sizef = fread((void *)&v[j], sizeof(float), 1, f); } - fread((void *)&uint16, sizeof(unsigned short), 1, f); // spacer between successive faces + sizef = fread((void *)&uint16, sizeof(unsigned short), 1, f); // spacer between successive faces nodes->push_back(GbTriFaceMesh3D::Vertex(v[3], v[4], v[5])); nodes->push_back(GbTriFaceMesh3D::Vertex(v[6], v[7], v[8])); nodes->push_back(GbTriFaceMesh3D::Vertex(v[9], v[10], v[11])); triangles->push_back(GbTriFaceMesh3D::TriFace(nr, nr + 1, nr + 2)); nr += 3; } + (void)sizef; fclose(f); if (removeRedundantNodes) { diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h index fa3defd96c4012cb53cbd7d559771c0f07ae85d5..839e0036bbc6b0f5d28bec5da3a0abe637b7adca 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h @@ -103,7 +103,7 @@ private: static void emitNoCoarseGridExistsWarning(); static void emitGridIsNotInCoarseGridWarning(); - Object *solidObject; + Object *solidObject = nullptr; uint numberOfLayersFine; uint numberOfLayersBetweenLevels;