mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Increase readability of create_c2c().
Introduce two intermediate variables, c1, and c2, to hold cell numbers during the building of the cell<->cell neighbourhood. This reduces the statement complexity--both for the human reader and the compiler...
This commit is contained in:
parent
c689a82c96
commit
4313d35883
@ -308,7 +308,7 @@ partition_create_c2c(int nc, int nneigh, const int *neigh,
|
|||||||
int **pc2c, int **c2c)
|
int **pc2c, int **c2c)
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret, c1, c2;
|
||||||
|
|
||||||
*pc2c = calloc(nc + 1, sizeof **pc2c);
|
*pc2c = calloc(nc + 1, sizeof **pc2c);
|
||||||
|
|
||||||
@ -337,10 +337,13 @@ partition_create_c2c(int nc, int nneigh, const int *neigh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nneigh; i++) {
|
for (i = 0; i < nneigh; i++) {
|
||||||
if ((neigh[2*i + 0] >= 0) && (neigh[2*i + 1] >= 0)) {
|
c1 = neigh[2*i + 0];
|
||||||
|
c2 = neigh[2*i + 1];
|
||||||
|
|
||||||
|
if ((c1 >= 0) && (c2 >= 0)) {
|
||||||
/* Symmetric Laplace matrix (undirected graph) */
|
/* Symmetric Laplace matrix (undirected graph) */
|
||||||
(*c2c)[(*pc2c)[neigh[2*i + 0] + 1] ++] = neigh[2*i + 1];
|
(*c2c)[ (*pc2c)[ c1 + 1 ] ++ ] = c2;
|
||||||
(*c2c)[(*pc2c)[neigh[2*i + 1] + 1] ++] = neigh[2*i + 0];
|
(*c2c)[ (*pc2c)[ c2 + 1 ] ++ ] = c1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user