From d12f3f9eb04a686e97d4625500a6f834ca7bde4b Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 15:39:36 +0200 Subject: Adapt refinement to meta-descriptor --- src/refinement/coupler2D.hh | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/refinement/coupler2D.hh') diff --git a/src/refinement/coupler2D.hh b/src/refinement/coupler2D.hh index c2b27db..800986d 100644 --- a/src/refinement/coupler2D.hh +++ b/src/refinement/coupler2D.hh @@ -30,32 +30,32 @@ namespace olb { -template class DESCRIPTOR> +template T Coupler2D::getScalingFactor() const { const T coarseTau = _coarse.getConverter().getLatticeRelaxationTime(); return (coarseTau - 0.25) / coarseTau; } -template class DESCRIPTOR> +template T Coupler2D::getInvScalingFactor() const { return 1./getScalingFactor(); } -template class DESCRIPTOR> +template const Vector& Coupler2D::getFineLatticeR(int y) const { return _fineLatticeR[y]; } -template class DESCRIPTOR> +template const Vector& Coupler2D::getCoarseLatticeR(int y) const { return _coarseLatticeR[y]; } -template class DESCRIPTOR> +template Coupler2D::Coupler2D(Grid2D& coarse, Grid2D& fine, Vector origin, Vector extend): _coarse(coarse), @@ -86,13 +86,13 @@ Coupler2D::Coupler2D(Grid2D& coarse, Grid2D class DESCRIPTOR> +template FineCoupler2D::FineCoupler2D(Grid2D& coarse, Grid2D& fine, Vector origin, Vector extend): Coupler2D(coarse, fine, origin, extend), _c2f_rho(this->_coarseSize), _c2f_u(this->_coarseSize, Vector(T{})), - _c2f_fneq(this->_coarseSize, Vector::q>(T{})) + _c2f_fneq(this->_coarseSize, Vector(T{})) { OstreamManager clout(std::cout,"C2F"); @@ -104,7 +104,7 @@ FineCoupler2D::FineCoupler2D(Grid2D& coarse, Grid2D< clout << "fine size: " << this->_fineSize << std::endl; } -template class DESCRIPTOR> +template void FineCoupler2D::store() { auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -114,7 +114,7 @@ void FineCoupler2D::store() const auto pos = this->getCoarseLatticeR(y); T rho{}; T u[2] {}; - T fNeq[DESCRIPTOR::q] {}; + T fNeq[DESCRIPTOR::q] {}; Cell coarseCell; coarseLattice.get(pos, coarseCell); lbHelpers::computeRhoU(coarseCell, rho, u); @@ -122,7 +122,7 @@ void FineCoupler2D::store() _c2f_rho[y] = Vector(rho); _c2f_u[y] = Vector(u); - _c2f_fneq[y] = Vector::q>(fNeq); + _c2f_fneq[y] = Vector(fNeq); } } @@ -156,7 +156,7 @@ Vector order4interpolation(const std::vector>& data, int y) } -template class DESCRIPTOR> +template void FineCoupler2D::interpolate() { auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -173,14 +173,14 @@ void FineCoupler2D::interpolate() _c2f_rho[y] = order2interpolation(Vector(rho), _c2f_rho[y]); _c2f_u[y] = order2interpolation(Vector(u), _c2f_u[y]); - T fNeq[DESCRIPTOR::q] {}; + T fNeq[DESCRIPTOR::q] {}; lbHelpers::computeFneq(coarseCell, fNeq, rho, u); - _c2f_fneq[y] = order2interpolation(Vector::q>(fNeq), _c2f_fneq[y]); + _c2f_fneq[y] = order2interpolation(Vector(fNeq), _c2f_fneq[y]); } } -template class DESCRIPTOR> +template void FineCoupler2D::couple() { const auto& coarseLattice = this->_coarse.getSuperLattice(); @@ -191,14 +191,14 @@ void FineCoupler2D::couple() const auto& coarsePos = this->getCoarseLatticeR(y); const auto& finePos = this->getFineLatticeR(2*y); - T fEq[DESCRIPTOR::q] {}; + T fEq[DESCRIPTOR::q] {}; Cell coarseCell; coarseLattice.get(coarsePos, coarseCell); lbHelpers::computeFeq(coarseCell, fEq); Cell cell; fineLattice.get(finePos, cell); - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { cell[iPop] = fEq[iPop] + this->getScalingFactor() * _c2f_fneq[y][iPop]; } fineLattice.set(finePos, cell); @@ -216,7 +216,7 @@ void FineCoupler2D::couple() Cell fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -235,7 +235,7 @@ void FineCoupler2D::couple() Cell fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -254,7 +254,7 @@ void FineCoupler2D::couple() Cell fineCell; fineLattice.get(finePos, fineCell); - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { fineCell[iPop] = lbHelpers::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop]; } @@ -264,30 +264,30 @@ void FineCoupler2D::couple() } -template class DESCRIPTOR> +template void computeRestrictedFneq(const SuperLattice2D& lattice, Vector latticeR, - T restrictedFneq[DESCRIPTOR::q]) + T restrictedFneq[DESCRIPTOR::q]) { - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { - const auto neighbor = latticeR + Vector {0, DESCRIPTOR::c[iPop][0], DESCRIPTOR::c[iPop][1]}; + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + const auto neighbor = latticeR + Vector {0, descriptors::c(iPop,0), descriptors::c(iPop,1)}; Cell cell; lattice.get(neighbor, cell); - T fNeq[DESCRIPTOR::q] {}; + T fNeq[DESCRIPTOR::q] {}; lbHelpers::computeFneq(cell, fNeq); - for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) { + for (int jPop=0; jPop < DESCRIPTOR::q; ++jPop) { restrictedFneq[jPop] += fNeq[jPop]; } } - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { - restrictedFneq[iPop] /= DESCRIPTOR::q; + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + restrictedFneq[iPop] /= DESCRIPTOR::q; } } -template class DESCRIPTOR> +template CoarseCoupler2D::CoarseCoupler2D( Grid2D& coarse, Grid2D& fine, Vector origin, Vector extend): @@ -303,7 +303,7 @@ CoarseCoupler2D::CoarseCoupler2D( clout << "coarse size: " << this->_coarseSize << std::endl; } -template class DESCRIPTOR> +template void CoarseCoupler2D::couple() { const auto& fineLattice = this->_fine.getSuperLattice(); @@ -314,18 +314,18 @@ void CoarseCoupler2D::couple() const auto& finePos = this->getFineLatticeR(2*y); const auto& coarsePos = this->getCoarseLatticeR(y); - T fEq[DESCRIPTOR::q] {}; + T fEq[DESCRIPTOR::q] {}; Cell fineCell; fineLattice.get(finePos, fineCell); lbHelpers::computeFeq(fineCell, fEq); - T fNeq[DESCRIPTOR::q] {}; + T fNeq[DESCRIPTOR::q] {}; computeRestrictedFneq(fineLattice, finePos, fNeq); Cell coarseCell; coarseLattice.get(coarsePos, coarseCell); - for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) { coarseCell[iPop] = fEq[iPop] + this->getInvScalingFactor() * fNeq[iPop]; } -- cgit v1.2.3