Justin Chang
2015-11-02 20:30:27 UTC
Hi all,
In my DMPlex program, I have these lines:
Mat A,J;
...
ierr = DMSetMatType(dm, MATAIJ); CHKERRQ(ierr);
ierr = DMCreateMatrix(dm, &J); CHKERRQ(ierr);
A = J;
ierr = DMSNESSetFunctionLocal(dm, ...); CHKERRQ(ierr);
ierr = DMSNESSetJacobianLocal(dm, ...); CHKERRQ(ierr);
ierr = SNESSetJacobian(snes, A, J, NULL, NULL); CHKERRQ(ierr);
ierr = SNESSetFromOptions(snes); CHKERRQ(ierr);
...
ierr = SNESSolve(snes, NULL, x); CHKERRQ(ierr);
...
ierr = MatDestroy(&J); CHKERRQ(ierr);
For the line "A = J;", what exactly is the difference, if any, between that
and "ierr = MatDuplicate(...)" or "ierr = MatCopy(...)"? Do these different
options somehow affect memory usage/performance? Say I am solving a
standard poisson equation using either GAMG and/or HYPRE.
Thanks,
Justin
In my DMPlex program, I have these lines:
Mat A,J;
...
ierr = DMSetMatType(dm, MATAIJ); CHKERRQ(ierr);
ierr = DMCreateMatrix(dm, &J); CHKERRQ(ierr);
A = J;
ierr = DMSNESSetFunctionLocal(dm, ...); CHKERRQ(ierr);
ierr = DMSNESSetJacobianLocal(dm, ...); CHKERRQ(ierr);
ierr = SNESSetJacobian(snes, A, J, NULL, NULL); CHKERRQ(ierr);
ierr = SNESSetFromOptions(snes); CHKERRQ(ierr);
...
ierr = SNESSolve(snes, NULL, x); CHKERRQ(ierr);
...
ierr = MatDestroy(&J); CHKERRQ(ierr);
For the line "A = J;", what exactly is the difference, if any, between that
and "ierr = MatDuplicate(...)" or "ierr = MatCopy(...)"? Do these different
options somehow affect memory usage/performance? Say I am solving a
standard poisson equation using either GAMG and/or HYPRE.
Thanks,
Justin