Skip to content
Snippets Groups Projects
Commit df9a1f12 authored by Timon Habenicht's avatar Timon Habenicht
Browse files

adds KernelConfiguration

parent a92a0b07
No related branches found
No related tags found
No related merge requests found
#ifndef KERNEL_CONFIGURATION_H
#define KERNEL_CONFIGURATION_H
#include <vector>
class KernelConfiguration
{
public:
virtual std::string getMainKernel() = 0;
virtual bool getMultiKernelOn() = 0;
virtual std::vector<int> getMultiKernelLevel() = 0;
virtual std::vector<std::string> getMultiKernelName() = 0;
private:
};
#endif
\ No newline at end of file
#include "KernelConfigurationImp.h"
std::string KernelConfigurationImp::getMainKernel()
{
return mainKernelName;
}
bool KernelConfigurationImp::getMultiKernelOn()
{
return multiKernelOn;
}
std::vector<int> KernelConfigurationImp::getMultiKernelLevel()
{
return multiKernelLevel;
}
std::vector<std::string> KernelConfigurationImp::getMultiKernelName()
{
return multiKernelName;
}
std::shared_ptr<KernelConfigurationImp> KernelConfigurationImp::getNewInstance(std::string kernelName)
{
return std::shared_ptr<KernelConfigurationImp>(new KernelConfigurationImp(kernelName));
}
std::shared_ptr<KernelConfigurationImp> KernelConfigurationImp::getNewInstance(std::string kernelName, std::vector<int> multiKernelLevel, std::vector<std::string> multiKernelName)
{
return std::shared_ptr<KernelConfigurationImp>(new KernelConfigurationImp(kernelName, multiKernelLevel, multiKernelName));
}
KernelConfigurationImp::KernelConfigurationImp(std::string kernelName)
{
this->mainKernelName = kernelName;
multiKernelOn = false;
multiKernelLevel.resize(0);
multiKernelName.resize(0);
}
KernelConfigurationImp::KernelConfigurationImp(std::string mainKernelName, std::vector<int> multiKernelLevel, std::vector<std::string> multiKernelName)
{
this->mainKernelName = mainKernelName;
multiKernelOn = true;
this->multiKernelLevel = multiKernelLevel;
this->multiKernelName = multiKernelName;
}
\ No newline at end of file
#ifndef KERNEL_CONFIGURATION_IMP_H
#define KERNEL_CONFIGURATION_IMP_H
#include "KernelConfiguration.h"
#include <memory>
class KernelConfigurationImp : public KernelConfiguration
{
public:
std::string getMainKernel();
bool getMultiKernelOn();
std::vector<int> getMultiKernelLevel();
std::vector<std::string> getMultiKernelName();
static std::shared_ptr< KernelConfigurationImp> getNewInstance(std::string kernelName);
static std::shared_ptr< KernelConfigurationImp> getNewInstance(std::string mainKernelName, std::vector<int> multiKernelLevel, std::vector<std::string> multiKernelName);
private:
KernelConfigurationImp(std::string kernelName);
KernelConfigurationImp(std::string kernelName, std::vector<int> multiKernelLevel, std::vector<std::string> multiKernelName);
KernelConfigurationImp() {};
std::string mainKernelName;
bool multiKernelOn;
std::vector<int> multiKernelLevel;
std::vector<std::string> multiKernelName;
};
#endif
\ No newline at end of file
......@@ -6,8 +6,7 @@
#include <vector>
class InitialCondition;
class Calculator;
class TestResults;
class KernelConfiguration;
class SimulationParameter
{
......@@ -27,8 +26,7 @@ public:
virtual std::string getFilePath() = 0;
virtual std::vector< int> getDevices() = 0;
virtual std::shared_ptr< InitialCondition> getInitialCondition() = 0;
virtual std::shared_ptr< Calculator> getCalculator() = 0;
virtual std::shared_ptr< TestResults> getTestResults() = 0;
virtual std::shared_ptr< KernelConfiguration> getKernelConfiguration() = 0;
private:
......
#include "SimulationParameterImp.h"
#include "Utilities/TestResults/TestResults.h"
#include <experimental/filesystem>
SimulationParameterImp::SimulationParameterImp(
real viscosity, real lx, real lz, real l0,
SimulationParameterImp::SimulationParameterImp(std::string simName, real viscosity, real lx, real lz, real l0,
unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength,
unsigned int startStepCalculation, unsigned int ySliceForCalculation,
std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels,
bool writeFiles, unsigned int startStepFileWriter,
std::shared_ptr<TestResults> testResults,
bool writeFiles, unsigned int startStepFileWriter,
std::vector<int> devices)
:viscosity(viscosity), lx(lx), l0(l0), lz(lz),
:simName(simName), viscosity(viscosity), lx(lx), l0(l0), lz(lz),
numberOfTimeSteps(numberOfTimeSteps), basisTimeStepLength(basisTimeStepLength),
startStepCalculation(startStepCalculation), ySliceForCalculation(ySliceForCalculation),
gridPath(gridPath), maxLevel(maxLevel), numberOfGridLevels(numberOfGridLevels),
writeFiles(writeFiles), startStepFileWriter(startStepFileWriter),
testResults(testResults), devices(devices)
writeFiles(writeFiles), startStepFileWriter(startStepFileWriter), devices(devices)
{
timeStepLength = basisTimeStepLength*(lx / l0)*(lx / l0);
startTimeCalculation = timeStepLength * startStepCalculation;
......@@ -24,6 +21,13 @@ SimulationParameterImp::SimulationParameterImp(
}
void SimulationParameterImp::generateFilePath(std::string filePath)
{
std::experimental::filesystem::path dir(filePath);
if (!(std::experimental::filesystem::exists(dir)))
std::experimental::filesystem::create_directories(dir);
}
double SimulationParameterImp::getViscosity()
{
return viscosity;
......@@ -94,12 +98,7 @@ std::shared_ptr<InitialCondition> SimulationParameterImp::getInitialCondition()
return initialCondition;
}
std::shared_ptr<Calculator> SimulationParameterImp::getCalculator()
{
return calculator;
}
std::shared_ptr<TestResults> SimulationParameterImp::getTestResults()
std::shared_ptr<KernelConfiguration> SimulationParameterImp::getKernelConfiguration()
{
return testResults;
return kernelConfig;
}
\ No newline at end of file
......@@ -5,8 +5,6 @@
#include "LBM\LB.h"
class SimulationResults;
class SimulationParameterImp : public SimulationParameter
{
public:
......@@ -24,25 +22,26 @@ public:
unsigned int getStartTimeDataWriter();
std::vector< int> getDevices();
std::shared_ptr< InitialCondition> getInitialCondition();
std::shared_ptr< Calculator> getCalculator();
std::shared_ptr< TestResults> getTestResults();
std::shared_ptr< KernelConfiguration> getKernelConfiguration();
protected:
SimulationParameterImp() {};
SimulationParameterImp(real viscosity, real lx, real lz, real l0,
SimulationParameterImp(std::string simName, real viscosity, real lx, real lz, real l0,
unsigned int numberOfTimeSteps, unsigned int basisTimeStepLength,
unsigned int startStepCalculation, unsigned int ySliceForCalculation,
std::string gridPath, unsigned int maxLevel, unsigned int numberOfGridLevels,
bool writeFiles, unsigned int startStepFileWriter,
std::shared_ptr<TestResults> testResults,
std::vector<int> devices);
void generateFilePath(std::string filePath);
real viscosity;
real lx, l0, lz;
unsigned int numberOfTimeSteps, basisTimeStepLength;
unsigned int startStepCalculation, startStepFileWriter, ySliceForCalculation;
std::string gridPath;
std::string filePath;
std::string simName;
bool writeFiles;
std::vector<int> devices;
......@@ -52,9 +51,7 @@ protected:
unsigned int endTime;
std::shared_ptr< InitialCondition> initialCondition;
std::shared_ptr< Calculator> calculator;
std::shared_ptr< SimulationResults> simResults;
std::shared_ptr< TestResults> testResults;
std::shared_ptr< KernelConfiguration> kernelConfig;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment