diff options
Remove unnecessary managed pointers
Diffstat (limited to 'apps')
-rw-r--r-- | apps/adrian/poiseuille2d/poiseuille2d.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index 3d263fa..8b8640e 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -186,114 +186,114 @@ int main(int argc, char* argv[]) const Vector<T,2> coarseExtend {lx, ly}; IndicatorCuboid2D<T> coarseCuboid(coarseExtend, coarseOrigin); - auto coarseGrid = Grid2D<T,DESCRIPTOR>::make(coarseCuboid, N, baseTau, Re); - prepareGeometry(coarseGrid->getConverter(), coarseGrid->getSuperGeometry()); + Grid2D<T,DESCRIPTOR> coarseGrid(coarseCuboid, N, baseTau, Re); + prepareGeometry(coarseGrid.getConverter(), coarseGrid.getSuperGeometry()); const Vector<T,2> fineExtend {3.0, 1.5}; const Vector<T,2> fineOrigin {0.8, (ly-fineExtend[1])/2}; - auto fineGrid = &coarseGrid->refine(fineOrigin, fineExtend); - prepareGeometry(fineGrid->getConverter(), fineGrid->getSuperGeometry()); + auto& fineGrid = coarseGrid.refine(fineOrigin, fineExtend); + prepareGeometry(fineGrid.getConverter(), fineGrid.getSuperGeometry()); - auto refinedOverlap = fineGrid->getRefinedOverlap(); - coarseGrid->getSuperGeometry().rename(1,0,*refinedOverlap); - coarseGrid->getSuperGeometry().rename(2,0,*refinedOverlap); + auto refinedOverlap = fineGrid.getRefinedOverlap(); + coarseGrid.getSuperGeometry().rename(1,0,*refinedOverlap); + coarseGrid.getSuperGeometry().rename(2,0,*refinedOverlap); BGKdynamics<T, DESCRIPTOR> coarseBulkDynamics( - coarseGrid->getConverter().getLatticeRelaxationFrequency(), + coarseGrid.getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta<T, DESCRIPTOR>()); - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> coarseSBoundaryCondition(coarseGrid->getSuperLattice()); + sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> coarseSBoundaryCondition(coarseGrid.getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(coarseSBoundaryCondition); prepareLattice( - coarseGrid->getConverter(), - coarseGrid->getSuperLattice(), + coarseGrid.getConverter(), + coarseGrid.getSuperLattice(), coarseBulkDynamics, coarseSBoundaryCondition, - coarseGrid->getSuperGeometry()); + coarseGrid.getSuperGeometry()); BGKdynamics<T, DESCRIPTOR> fineBulkDynamics( - fineGrid->getConverter().getLatticeRelaxationFrequency(), + fineGrid.getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta<T, DESCRIPTOR>()); - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition(fineGrid->getSuperLattice()); + sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition(fineGrid.getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition); const Vector<T,2> fineExtend2 {0.6, 0.4}; const Vector<T,2> fineOrigin2 {1.05, (ly-fineExtend2[1])/2}; - auto fineGrid2 = &fineGrid->refine(fineOrigin2, fineExtend2); - prepareGeometry(fineGrid2->getConverter(), fineGrid2->getSuperGeometry()); + auto& fineGrid2 = fineGrid.refine(fineOrigin2, fineExtend2); + prepareGeometry(fineGrid2.getConverter(), fineGrid2.getSuperGeometry()); - auto refinedOverlap2 = fineGrid2->getRefinedOverlap(); - fineGrid->getSuperGeometry().rename(1,0,*refinedOverlap2); - fineGrid->getSuperGeometry().rename(2,0,*refinedOverlap2); + auto refinedOverlap2 = fineGrid2.getRefinedOverlap(); + fineGrid.getSuperGeometry().rename(1,0,*refinedOverlap2); + fineGrid.getSuperGeometry().rename(2,0,*refinedOverlap2); prepareLattice( - fineGrid->getConverter(), - fineGrid->getSuperLattice(), + fineGrid.getConverter(), + fineGrid.getSuperLattice(), fineBulkDynamics, fineSBoundaryCondition, - fineGrid->getSuperGeometry()); + fineGrid.getSuperGeometry()); BGKdynamics<T, DESCRIPTOR> fineBulkDynamics2( - fineGrid2->getConverter().getLatticeRelaxationFrequency(), + fineGrid2.getConverter().getLatticeRelaxationFrequency(), instances::getBulkMomenta<T, DESCRIPTOR>()); - sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition2(fineGrid2->getSuperLattice()); + sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition2(fineGrid2.getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition2); prepareLattice( - fineGrid2->getConverter(), - fineGrid2->getSuperLattice(), + fineGrid2.getConverter(), + fineGrid2.getSuperLattice(), fineBulkDynamics2, fineSBoundaryCondition2, - fineGrid2->getSuperGeometry()); + fineGrid2.getSuperGeometry()); clout << "starting simulation..." << endl; Timer<T> timer( - coarseGrid->getConverter().getLatticeTime(maxPhysT), - coarseGrid->getSuperGeometry().getStatistics().getNvoxel()); + coarseGrid.getConverter().getLatticeTime(maxPhysT), + coarseGrid.getSuperGeometry().getStatistics().getNvoxel()); util::ValueTracer<T> converge( - fineGrid2->getConverter().getLatticeTime(physInterval), + fineGrid2.getConverter().getLatticeTime(physInterval), residuum); timer.start(); - for (int iT = 0; iT < coarseGrid->getConverter().getLatticeTime(maxPhysT); ++iT) { + for (int iT = 0; iT < coarseGrid.getConverter().getLatticeTime(maxPhysT); ++iT) { if (converge.hasConverged()) { clout << "Simulation converged." << endl; break; } - coarseGrid->collideAndStream(); + coarseGrid.collideAndStream(); getResults( "coarse_", - coarseGrid->getSuperLattice(), - coarseGrid->getConverter(), + coarseGrid.getSuperLattice(), + coarseGrid.getConverter(), iT, - coarseGrid->getSuperGeometry(), + coarseGrid.getSuperGeometry(), timer, converge.hasConverged()); getResults( "fine_", - fineGrid->getSuperLattice(), - fineGrid->getConverter(), + fineGrid.getSuperLattice(), + fineGrid.getConverter(), iT, - fineGrid->getSuperGeometry(), + fineGrid.getSuperGeometry(), timer, converge.hasConverged()); getResults( "fine2_", - fineGrid2->getSuperLattice(), - fineGrid2->getConverter(), + fineGrid2.getSuperLattice(), + fineGrid2.getConverter(), iT, - fineGrid2->getSuperGeometry(), + fineGrid2.getSuperGeometry(), timer, converge.hasConverged()); - converge.takeValue(fineGrid2->getSuperLattice().getStatistics().getAverageEnergy(), true); + converge.takeValue(fineGrid2.getSuperLattice().getStatistics().getAverageEnergy(), true); } timer.stop(); |