From 86176c474f8aa3876b49674100c2a5ac70396041 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Thu, 10 Feb 2022 17:19:30 +0100 Subject: [PATCH] [ffpm][coupling] Use problem reference directory The base class no longer uses weak_ptr so this is just directly accessing the problem pointer --- .../staggeredfreeflow/couplingmanager.hh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dumux/multidomain/staggeredfreeflow/couplingmanager.hh b/dumux/multidomain/staggeredfreeflow/couplingmanager.hh index f172d4788f..1ccfd7c754 100644 --- a/dumux/multidomain/staggeredfreeflow/couplingmanager.hh +++ b/dumux/multidomain/staggeredfreeflow/couplingmanager.hh @@ -459,11 +459,8 @@ private: void bindCouplingContext_(Dune::index_constant domainI, const Element& elementI) const { - // The call to this->problem() is expensive because of std::weak_ptr (see base class). Here we try to avoid it if possible. - if (momentumCouplingContext_.empty()) - bindCouplingContext_(domainI, elementI, this->problem(freeFlowMomentumIndex).gridGeometry().elementMapper().index(elementI)); - else - bindCouplingContext_(domainI, elementI, momentumCouplingContext_[0].fvGeometry.gridGeometry().elementMapper().index(elementI)); + const auto eIdx = this->problem(freeFlowMomentumIndex).gridGeometry().elementMapper().index(elementI); + bindCouplingContext_(domainI, elementI, eIdx); } void bindCouplingContext_(Dune::index_constant domainI, @@ -500,11 +497,8 @@ private: void bindCouplingContext_(Dune::index_constant domainI, const Element& elementI) const { - // The call to this->problem() is expensive because of std::weak_ptr (see base class). Here we try to avoid it if possible. - if (massAndEnergyCouplingContext_.empty()) - bindCouplingContext_(domainI, elementI, this->problem(freeFlowMassIndex).gridGeometry().elementMapper().index(elementI)); - else - bindCouplingContext_(domainI, elementI, massAndEnergyCouplingContext_[0].fvGeometry.gridGeometry().elementMapper().index(elementI)); + const auto eIdx = this->problem(freeFlowMassIndex).gridGeometry().elementMapper().index(elementI); + bindCouplingContext_(domainI, elementI, eIdx); } void bindCouplingContext_(Dune::index_constant domainI, -- GitLab