Skip to content

Commit

Permalink
Move viewing consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed Apr 20, 2011
1 parent 1e00b0d commit 19f1f88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/fs/tests/elast.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ int main(int argc,char *argv[])
Mat J,Jp;
Vec r,x,soln;
SNES snes;
dBool nojshell = dFALSE,nocheck = dFALSE,view_soln = dFALSE;
dBool nojshell = dFALSE,nocheck = dFALSE,viewdhm = dFALSE;
dErr err;

err = dInitialize(&argc,&argv,NULL,help);dCHK(err);
Expand All @@ -590,7 +590,7 @@ int main(int argc,char *argv[])
err = PetscOptionsBegin(elt->comm,NULL,"Elasticity solver options",__FILE__);dCHK(err); {
err = PetscOptionsBool("-nojshell","Do not use shell Jacobian","",nojshell,&nojshell,NULL);dCHK(err);
err = PetscOptionsBool("-nocheck_error","Do not compute errors","",nocheck,&nocheck,NULL);dCHK(err);
err = PetscOptionsBool("-view_soln","View the solution","",view_soln,&view_soln,NULL);dCHK(err);
err = PetscOptionsBool("-viewdhm","View the solution","",viewdhm,&viewdhm,NULL);dCHK(err);
} err = PetscOptionsEnd();dCHK(err);
if (nojshell) {
/* Use the preconditioning matrix in place of the Jacobin. This will NOT converge unless the elements are actually
Expand Down Expand Up @@ -635,16 +635,16 @@ int main(int argc,char *argv[])
err = dPrintf(comm,"Pointwise solution error |x|_1 %8.2e |x|_2 %8.2e |x|_inf %8.2e\n",enorm[0],enorm[1],enorm[2]);dCHK(err);
err = dPrintf(comm,"Pointwise gradient error |x|_1 %8.2e |x|_2 %8.2e |x|_inf %8.2e\n",gnorm[0],gnorm[1],gnorm[2]);dCHK(err);
}
if (view_soln) {
dViewer viewdhm;
err = PetscViewerCreate(comm,&viewdhm);dCHK(err);
err = PetscViewerSetType(viewdhm,PETSCVIEWERDHM);dCHK(err);
err = PetscViewerFileSetName(viewdhm,"elast.dhm");dCHK(err);
err = PetscViewerFileSetMode(viewdhm,FILE_MODE_WRITE);dCHK(err);
err = dViewerDHMSetTimeUnits(viewdhm,"hour",PETSC_PI*1e7/3600);dCHK(err);
err = dViewerDHMSetTime(viewdhm,0.1);dCHK(err);
err = VecView(x,viewdhm);dCHK(err);
err = PetscViewerDestroy(viewdhm);dCHK(err);
if (viewdhm) {
dViewer view;
err = PetscViewerCreate(comm,&view);dCHK(err);
err = PetscViewerSetType(view,PETSCVIEWERDHM);dCHK(err);
err = PetscViewerFileSetName(view,"elast.dhm");dCHK(err);
err = PetscViewerFileSetMode(view,FILE_MODE_WRITE);dCHK(err);
err = dViewerDHMSetTimeUnits(view,"hour",PETSC_PI*1e7/3600);dCHK(err);
err = dViewerDHMSetTime(view,0.1);dCHK(err);
err = VecView(x,view);dCHK(err);
err = PetscViewerDestroy(view);dCHK(err);
}

err = VecDestroy(r);dCHK(err);
Expand Down
3 changes: 3 additions & 0 deletions src/fs/tests/ex1.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ int main(int argc,char *argv[])
nset = 3;
err = PetscOptionsRealArray("-require_grad","<L^1,L^2,L^infty> Error if pointwise gradient norms exceed given values, negative to disable",NULL,gopt.normRequireGrad,&nset,&flg);dCHK(err);
if (flg && nset != 3) dERROR(PETSC_COMM_SELF,1,"You must set 3 values for -require_grad");
err = PetscOptionsBool("-viewdhm","View to a file using DHM","",gopt.viewdhm,&gopt.viewdhm,NULL);dCHK(err);
} err = PetscOptionsEnd();dCHK(err);
err = dMeshCreate(comm,&mesh);dCHK(err);
err = dMeshSetFromOptions(mesh);dCHK(err);
Expand All @@ -740,6 +741,8 @@ int main(int argc,char *argv[])
err = dFSSetMesh(fs,mesh,domain);dCHK(err);
err = dFSSetDegree(fs,jac,dtag);dCHK(err);
err = dFSSetFromOptions(fs);dCHK(err);
err = PetscObjectSetName((PetscObject)fs,"dFS_0");dCHK(err);
err = PetscObjectSetName((PetscObject)mesh,"dMesh_0");dCHK(err);

err = useFS(fs);dCHK(err);

Expand Down

0 comments on commit 19f1f88

Please sign in to comment.