Add some comments and limit to 3 dimensions.

This commit is contained in:
osae
2015-09-10 18:23:00 +02:00
parent 299aa77e18
commit 565fa4278e

View File

@@ -59,13 +59,22 @@ const double* beginCellCentroids(const UnstructuredGrid& grid)
double cellCenterDepth(const UnstructuredGrid& grid, int cell_index)
{
// This method is an alternative to the method cellCentroidCoordinate(...) below.
// The cell center depth is computed as a raw average of cell corner depths.
// For cornerpoint grids, this is likely to give slightly different depths that seem
// to agree with eclipse.
assert(grid.dimensions == 3);
const int nd = 3; // Assuming 3-dimensional grid ...
const int nv = 8; // Assuming 2*4 vertices ...
double zz = 0.0;
// Traverse the bottom and top cell-face
for (int i=grid.cell_facepos[cell_index+1]-2; i<grid.cell_facepos[cell_index+1]; ++i) {
// Traverse the vertices associated with each face
for (int j=grid.face_nodepos[grid.cell_faces[i]]; j<grid.face_nodepos[grid.cell_faces[i]+1]; ++j) {
zz += (grid.node_coordinates+dimensions(grid)*(grid.face_nodes[j]))[2];
zz += (grid.node_coordinates+nd*(grid.face_nodes[j]))[nd-1];
}
}
return zz/8.0;
return zz/nv;
}
double cellCentroidCoordinate(const UnstructuredGrid& grid, int cell_index,