Commit 0a0e833f authored by Santiago Ospina's avatar Santiago Ospina

Added compile time decision about writing the output

Signed-off-by: default avatarSantiago Ospina <saospina@hugo.iwr.uni-heidelberg.de>
parent 3a37f211
...@@ -57,15 +57,18 @@ RichardsSimulation<Traits>::RichardsSimulation (Dune::MPIHelper& _helper, std::s ...@@ -57,15 +57,18 @@ RichardsSimulation<Traits>::RichardsSimulation (Dune::MPIHelper& _helper, std::s
operator_setup(); operator_setup();
// --- Utility Class Setup --- // // --- Utility Class Setup --- //
const int subsamling_lvl = _inifile.get<int>("output.subsamplingLevel", 0); if constexpr (Traits::write_output)
const auto subsamling_intervals = Dune::refinementLevels(subsamling_lvl); {
auto sub_vtk = std::make_shared<Dune::SubsamplingVTKWriter<GV>>(gv, const int subsamling_lvl = _inifile.get<int>("output.subsamplingLevel", 0);
subsamling_intervals); const auto subsamling_intervals = Dune::refinementLevels(subsamling_lvl);
auto sub_vtk = std::make_shared<Dune::SubsamplingVTKWriter<GV>>(gv,
vtkwriter = std::make_unique<Writer>(sub_vtk, subsamling_intervals);
inifile.get<std::string>("output.fileName"),
inifile.get<std::string>("output.outputPath"), vtkwriter = std::make_unique<Writer>(sub_vtk,
"./"); inifile.get<std::string>("output.fileName"),
inifile.get<std::string>("output.outputPath"),
"./");
}
AdaptivityHandlerFactory adaptivity_fac(inifile,*grid); AdaptivityHandlerFactory adaptivity_fac(inifile,*grid);
adaptivity = adaptivity_fac.create(); adaptivity = adaptivity_fac.create();
...@@ -163,14 +166,17 @@ void RichardsSimulation<Traits>::run () ...@@ -163,14 +166,17 @@ void RichardsSimulation<Traits>::run ()
{ {
const auto time = controller->getTime(); const auto time = controller->getTime();
const RF dt = controller->getDT(); const RF dt = controller->getDT();
write_data(time);
if constexpr (Traits::write_output)
write_data(time);
while(controller->doStep()) { while(controller->doStep()) {
if(!compute_time_step()){ if(!compute_time_step()){
continue; continue;
} }
write_data(controller->getTime()); if constexpr (Traits::write_output)
write_data(controller->getTime());
if(controller->doStep() if(controller->doStep()
&& adaptivity->adapt_grid(*grid, gv, *gfs, *param, *fboundary, && adaptivity->adapt_grid(*grid, gv, *gfs, *param, *fboundary,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment