MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / initSimulation

Method initSimulation

Simulator/SimulatorBase.cpp:432–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432void SimulatorBase::initSimulation()
433{
434 const std::string& sceneFile = SceneConfiguration::getCurrent()->getSceneFile();
435 const Utilities::SceneLoader::Scene& scene = SceneConfiguration::getCurrent()->getScene();
436
437#ifdef DL_OUTPUT
438 // copy scene files in output so that the simulation can be reproduced
439 std::string sceneFilePath = FileSystem::normalizePath(m_outputPath + "/scene");
440 FileSystem::makeDirs(sceneFilePath);
441 FileSystem::copyFile(sceneFile, sceneFilePath + "/" + FileSystem::getFileNameWithExt(sceneFile));
442
443 std::string modelsFilePath = FileSystem::normalizePath(m_outputPath + "/models");
444 FileSystem::makeDirs(modelsFilePath);
445 for (unsigned int i = 0; i < scene.boundaryModels.size(); i++)
446 {
447 std::string meshFileName = scene.boundaryModels[i]->meshFile;
448 if (meshFileName != "")
449 {
450 if (FileSystem::isRelativePath(meshFileName))
451 meshFileName = FileSystem::normalizePath(FileSystem::getFilePath(sceneFile) + "/" + meshFileName);
452 FileSystem::copyFile(meshFileName, modelsFilePath + "/" + FileSystem::getFileNameWithExt(meshFileName));
453 }
454 std::string mapFileName = scene.boundaryModels[i]->mapFile;
455 if (mapFileName != "")
456 {
457 if (FileSystem::isRelativePath(mapFileName))
458 mapFileName = FileSystem::normalizePath(FileSystem::getFilePath(sceneFile) + "/" + mapFileName);
459 FileSystem::copyFile(scene.boundaryModels[i]->mapFile, modelsFilePath + "/" + FileSystem::getFileNameWithExt(scene.boundaryModels[i]->mapFile));
460 }
461 std::string samplesFileName = scene.boundaryModels[i]->samplesFile;
462 if (samplesFileName != "")
463 {
464 if (FileSystem::isRelativePath(samplesFileName))
465 samplesFileName = FileSystem::normalizePath(FileSystem::getFilePath(sceneFile) + "/" + samplesFileName);
466 FileSystem::copyFile(samplesFileName, modelsFilePath + "/" + FileSystem::getFileNameWithExt(samplesFileName));
467 }
468 }
469
470 for (unsigned int i = 0; i < scene.fluidModels.size(); i++)
471 {
472 std::string samplesFileName = scene.fluidModels[i]->samplesFile;
473 if (samplesFileName != "")
474 {
475 if (FileSystem::isRelativePath(samplesFileName))
476 samplesFileName = FileSystem::normalizePath(FileSystem::getFilePath(sceneFile) + "/" + samplesFileName);
477 FileSystem::copyFile(samplesFileName, modelsFilePath + "/" + FileSystem::getFileNameWithExt(samplesFileName));
478 }
479 }
480
481 std::string progFilePath = FileSystem::normalizePath(m_outputPath + "/program");
482 FileSystem::makeDirs(progFilePath);
483 FileSystem::copyFile(m_argv[0], progFilePath + "/" + FileSystem::getFileNameWithExt(m_argv[0]));
484 std::string diffFilePath = FileSystem::normalizePath(m_exePath + "/git_diff.txt");
485 FileSystem::copyFile(diffFilePath, progFilePath + "/git_diff.txt");
486 #endif
487
488 Simulation *sim = Simulation::getCurrent();
489 sim->init(scene.particleRadius, scene.sim2D);

Callers 7

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95

Calls 15

createDebugToolsMethod · 0.80
numberOfFluidModelsMethod · 0.80
getFluidModelMethod · 0.80
getDragBaseMethod · 0.80
getSurfaceTensionBaseMethod · 0.80
getViscosityBaseMethod · 0.80
getVorticityBaseMethod · 0.80

Tested by

no test coverage detected