Generate 2D normals of length equal to face area.

This commit is contained in:
Bård Skaflestad
2012-02-27 10:09:06 +01:00
parent 53f05d3eab
commit 2bc15fb31b

View File

@@ -707,14 +707,14 @@ fill_cart_geometry_2d(struct UnstructuredGrid *G,
/* Faces with x-normal */ /* Faces with x-normal */
for (j=0; j<ny; ++j) { for (j=0; j<ny; ++j) {
for (i=0; i<nx+1; ++i) { for (i=0; i<nx+1; ++i) {
*fnormals++ = 1; dy = y[j + 1] - y[j];
*fnormals++ = dy;
*fnormals++ = 0; *fnormals++ = 0;
*fcentroids++ = x[i]; *fcentroids++ = x[i];
*fcentroids++ = (y[j] + y[j + 1]) / 2.0; *fcentroids++ = (y[j] + y[j + 1]) / 2.0;
dy = y[j + 1] - y[j];
*fareas++ = dy; *fareas++ = dy;
} }
} }
@@ -722,14 +722,14 @@ fill_cart_geometry_2d(struct UnstructuredGrid *G,
/* Faces with y-normal */ /* Faces with y-normal */
for (j=0; j<ny+1; ++j) { for (j=0; j<ny+1; ++j) {
for (i=0; i<nx; ++i) { for (i=0; i<nx; ++i) {
dx = x[i + 1] - x[i];
*fnormals++ = 0; *fnormals++ = 0;
*fnormals++ = 1; *fnormals++ = dx;
*fcentroids++ = (x[i] + x[i + 1]) / 2.0; *fcentroids++ = (x[i] + x[i + 1]) / 2.0;
*fcentroids++ = y[j]; *fcentroids++ = y[j];
dx = x[i + 1] - x[i];
*fareas++ = dx; *fareas++ = dx;
} }
} }