Switch loop ordering for better cache performance.

This commit is contained in:
Atgeirr Flø Rasmussen
2012-08-27 13:17:27 +02:00
parent 9bb76d74cc
commit 5182fef48d

View File

@@ -243,8 +243,8 @@ namespace Opm
// matrix data.
std::fill(surfacevol, surfacevol + n*np, 0.0);
for (int i = 0; i < n; ++i) {
for (int row = 0; row < np; ++row) {
for (int col = 0; col < np; ++col) {
for (int col = 0; col < np; ++col) {
for (int row = 0; row < np; ++row) {
surfacevol[i*np + row] += A[i*np*np + row + col*np] * saturation[i*np + col];
}
}