From 27b0c949eda95d0fc97615acee899dd9b67bf781 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 4 Feb 2019 22:50:53 +0100 Subject: Add support for calling a function for each subgrid of Grid2D --- apps/adrian/cylinder2d/playground/cylinder2d.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'apps/adrian/cylinder2d/playground/cylinder2d.cpp') diff --git a/apps/adrian/cylinder2d/playground/cylinder2d.cpp b/apps/adrian/cylinder2d/playground/cylinder2d.cpp index 5b67408..fdcd5a4 100644 --- a/apps/adrian/cylinder2d/playground/cylinder2d.cpp +++ b/apps/adrian/cylinder2d/playground/cylinder2d.cpp @@ -188,17 +188,15 @@ void setBoundaryValues(Grid2D& grid, int iT) } } -void getResults(const std::string& prefix, - Grid2D& grid, +void getResults(Grid2D& grid, + const std::string& prefix, int iT) { - OstreamManager clout(std::cout,"getResults"); - auto& converter = grid.getConverter(); auto& sLattice = grid.getSuperLattice(); auto& sGeometry = grid.getSuperGeometry(); - SuperVTMwriter2D vtmWriter(prefix + "cylinder2d"); + SuperVTMwriter2D vtmWriter(prefix); SuperLatticePhysVelocity2D velocity(sLattice, converter); SuperLatticePhysPressure2D pressure(sLattice, converter); SuperLatticeGeometry2D geometry(sLattice, sGeometry); @@ -265,6 +263,7 @@ int main(int argc, char* argv[]) RelaxationTime(tau), N, PhysCharacteristics); + const Vector domainOrigin = coarseGrid.getSuperGeometry().getStatistics().getMinPhysR(0); const Vector domainExtend = coarseGrid.getSuperGeometry().getStatistics().getPhysExtend(0); @@ -324,11 +323,9 @@ int main(int argc, char* argv[]) timer.update(iT); timer.printStep(); - getResults("level0_", coarseGrid, iT); - getResults("level1_", fineGrid, iT); - getResults("level2_", fineGrid2, iT); - getResults("level3_", fineGrid3, iT); - getResults("level4_", fineGrid4, iT); + coarseGrid.forEachGrid("cylinder2d", [&](Grid2D& grid, const std::string& id) { + getResults(grid, id, iT); + }); takeMeasurements(fineGrid4); } -- cgit v1.2.3