Skip to content

Commit

Permalink
Restore block size in DHM reader
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed Apr 14, 2011
1 parent 587562e commit f090228
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/fs/impls/cont/contviewdhm.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,13 @@ dErr dFSLoadIntoFS_Cont_DHM(PetscViewer viewer,const char name[],dFS fs)
err = dFSRegisterBoundarySet(fs,sets[i],bstat,NULL,NULL);dCHK(err); /* @todo How to recover the user's constraint function and context? */
}
err = dFree(sets);dCHK(err);

err = dFSSetBlockSize(fs,(dInt)fs5.fields.len);dCHK(err);
for (dInt i=0; i<fs->bs; i++) {
const dht_Field *field5 = fs5.fields.p;
err = dFSSetFieldName(fs,i,field5[i].name);dCHK(err);
}

err = dMeshGetTag(mesh,fs5.degree,&tag);dCHK(err);
err = dFSGetJacobi(fs,&jac);dCHK(err);
err = dFSSetDegree(fs,jac,tag);dCHK(err);
Expand Down
14 changes: 11 additions & 3 deletions src/viewer/dhm.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,15 @@ static herr_t field_traverse_func(hid_t base,const char *name,const H5L_info_t d
}
}
}
new_field->bs = 1;

{
hid_t vecspace;
hsize_t gdims[2];
vecspace = H5Dget_space(field);if (vecspace < 0) {ret = -6; goto out;}
herr = H5Sget_simple_extent_dims(vecspace,gdims,NULL);if (herr < 0) {ret = -7; goto out;}
herr = H5Sclose(vecspace);if (herr < 0) {ret = -8; goto out;}
new_field->bs = (dInt)gdims[1];
}

/* cons with list */
new_field->next = ctx->field_head;
Expand Down Expand Up @@ -590,8 +598,8 @@ static herr_t field_traverse_func(hid_t base,const char *name,const H5L_info_t d
}
H5Dclose(fs);
}
if (PetscStrallocpy(new_field->fsname,&new_fs.name)) {ret = -7; goto out;}
if (dMallocA(1,&p)) {(void)dFree(new_fs.name); ret = -8; goto out;}
if (PetscStrallocpy(new_field->fsname,&new_fs.name)) {ret = -9; goto out;}
if (dMallocA(1,&p)) {(void)dFree(new_fs.name); ret = -10; goto out;}
dMemcpy(p,&new_fs,sizeof(new_fs));
p->next = ctx->fs_head;
ctx->fs_head = p;
Expand Down

0 comments on commit f090228

Please sign in to comment.