Skip to content

Commit

Permalink
SimulationController -> SimulationFacade
Browse files Browse the repository at this point in the history
  • Loading branch information
chrxh committed Oct 16, 2024
1 parent 373620e commit 1a12723
Show file tree
Hide file tree
Showing 103 changed files with 1,432 additions and 1,250 deletions.
26 changes: 13 additions & 13 deletions source/Cli/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Base/StringHelper.h"
#include "Base/FileLogger.h"
#include "EngineInterface/SerializerService.h"
#include "EngineImpl/SimulationControllerImpl.h"
#include "EngineImpl/SimulationFacadeImpl.h"

int main(int argc, char** argv)
{
Expand Down Expand Up @@ -47,15 +47,15 @@ int main(int argc, char** argv)
//run simulation
auto startTimepoint = std::chrono::steady_clock::now();

auto simController = std::make_shared<_SimulationControllerImpl>();
simController->newSimulation("", simData.auxiliaryData.timestep, simData.auxiliaryData.generalSettings, simData.auxiliaryData.simulationParameters);
simController->setClusteredSimulationData(simData.mainData);
simController->setStatisticsHistory(simData.statistics);
simController->setRealTime(simData.auxiliaryData.realTime);
std::cout << "Device: " << simController->getGpuName() << std::endl;
auto simulationFacade = std::make_shared<_SimulationFacadeImpl>();
simulationFacade->newSimulation("", simData.auxiliaryData.timestep, simData.auxiliaryData.generalSettings, simData.auxiliaryData.simulationParameters);
simulationFacade->setClusteredSimulationData(simData.mainData);
simulationFacade->setStatisticsHistory(simData.statistics);
simulationFacade->setRealTime(simData.auxiliaryData.realTime);
std::cout << "Device: " << simulationFacade->getGpuName() << std::endl;
std::cout << "Start simulation" << std::endl;

simController->calcTimesteps(timesteps);
simulationFacade->calcTimesteps(timesteps);

auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - startTimepoint).count();
auto tps = ms != 0 ? 1000.0f * toFloat(timesteps) / toFloat(ms) : 0.0f;
Expand All @@ -65,11 +65,11 @@ int main(int argc, char** argv)

//write output simulation file
std::cout << "Writing output" << std::endl;
simData.auxiliaryData.timestep = static_cast<uint32_t>(simController->getCurrentTimestep());
simData.mainData = simController->getClusteredSimulationData();
simData.auxiliaryData.simulationParameters = simController->getSimulationParameters();
simData.statistics = simController->getStatisticsHistory().getCopiedData();
simData.auxiliaryData.realTime = simController->getRealTime();
simData.auxiliaryData.timestep = static_cast<uint32_t>(simulationFacade->getCurrentTimestep());
simData.mainData = simulationFacade->getClusteredSimulationData();
simData.auxiliaryData.simulationParameters = simulationFacade->getSimulationParameters();
simData.statistics = simulationFacade->getStatisticsHistory().getCopiedData();
simData.auxiliaryData.realTime = simulationFacade->getRealTime();
if (outputFilename.empty()) {
std::cout << "No output file given." << std::endl;
return 1;
Expand Down
4 changes: 2 additions & 2 deletions source/EngineImpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ add_library(EngineImpl
Definitions.h
EngineWorker.cpp
EngineWorker.h
SimulationControllerImpl.cpp
SimulationControllerImpl.h)
SimulationFacadeImpl.cpp
SimulationFacadeImpl.h)

target_link_libraries(EngineImpl Base)
target_link_libraries(EngineImpl EngineGpuKernels)
Expand Down
Loading

0 comments on commit 1a12723

Please sign in to comment.