diff --git a/dumux/assembly/boxlocalassembler.hh b/dumux/assembly/boxlocalassembler.hh index 81883e967caaac684e628cc9735d981f746aace4..29188da305c3efeee83a0752db71f055823ef7c2 100644 --- a/dumux/assembly/boxlocalassembler.hh +++ b/dumux/assembly/boxlocalassembler.hh @@ -131,12 +131,12 @@ public: const auto pvIdx) { res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - for (const auto& scvJ : scvs(this->fvGeometry())) - { - jac[scvI.dofIndex()][scvJ.dofIndex()][eqIdx] = 0.0; - if (scvI.localDofIndex() == scvJ.localDofIndex()) - jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0; - } + + auto& row = jac[scvI.dofIndex()]; + for (auto col = row.begin(); col != row.end(); ++col) + row[col.index()][eqIdx] = 0.0; + + jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0; // if a periodic dof has Dirichlet values also apply the same Dirichlet values to the other dof if (this->assembler().fvGridGeometry().dofOnPeriodicBoundary(scvI.dofIndex())) @@ -166,12 +166,11 @@ public: const auto eqIdx, const auto pvIdx) { - for (const auto& scvJ : scvs(this->fvGeometry())) - { - jac[scvI.dofIndex()][scvJ.dofIndex()][eqIdx] = 0.0; - if (scvI.localDofIndex() == scvJ.localDofIndex()) - jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0; - } + auto& row = jac[scvI.dofIndex()]; + for (auto col = row.begin(); col != row.end(); ++col) + row[col.index()][eqIdx] = 0.0; + + jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0; }; this->asImp_().evalDirichletBoundaries(applyDirichlet);