Fix orientation of faces on faults.
Fix problem with indexMap.
This commit is contained in:
parent
5186b5795a
commit
89e23f883f
@ -142,7 +142,7 @@ static int *computeFaceTopology(int *a1,
|
||||
}
|
||||
int k;
|
||||
int *f = faces;
|
||||
for (k=0; k<8; ++k){
|
||||
for (k=7; k>=0; --k){
|
||||
if(mask[k] != -1){
|
||||
*f++ = mask[k];
|
||||
}
|
||||
|
25
preprocess.c
25
preprocess.c
@ -493,30 +493,15 @@ void process_grdecl(const struct grdecl *in,
|
||||
}
|
||||
|
||||
/* Invert global-to-local map */
|
||||
ptr = out->local_cell_index;
|
||||
int *global_cell_index = malloc(out->number_of_cells *
|
||||
sizeof (*global_cell_index));
|
||||
for (i=0; i<nx*ny*nz; ++i){
|
||||
if(out->local_cell_index[i]!=-1){
|
||||
*ptr++ = i;
|
||||
global_cell_index[out->local_cell_index[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Shrink memory allocated for cell_index */
|
||||
if (ptr != out->local_cell_index){ /* always !*/
|
||||
void *p = realloc(out->local_cell_index,
|
||||
(ptr-out->local_cell_index)*sizeof(*out->local_cell_index));
|
||||
if (p){
|
||||
out->local_cell_index = p;
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "Could not reallocate space for index map\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
free(out->local_cell_index);
|
||||
out->local_cell_index = global_cell_index;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
|
@ -66,7 +66,7 @@ void fill_grid(mxArray **out, struct processed_grid *grid)
|
||||
mxSetField(G, 0, "faces", faces);
|
||||
|
||||
|
||||
const char *n4[] = {"num", "numFaces", "map"};
|
||||
const char *n4[] = {"num", "numFaces", "indexMap"};
|
||||
mxArray *cells = mxCreateStructMatrix(1,1,3,n4);
|
||||
|
||||
mxSetField(cells, 0, "num", mxCreateDoubleScalar(grid->number_of_cells));
|
||||
@ -75,7 +75,7 @@ void fill_grid(mxArray **out, struct processed_grid *grid)
|
||||
for(i=0; i<grid->number_of_cells; ++i){
|
||||
ptr[i] = grid->local_cell_index[i]+1;
|
||||
}
|
||||
mxSetField(cells, 0, "map", map);
|
||||
mxSetField(cells, 0, "indexMap", map);
|
||||
|
||||
|
||||
mxArray *numfaces = mxCreateDoubleMatrix(grid->number_of_cells, 1, mxREAL);
|
||||
|
Loading…
Reference in New Issue
Block a user