[cig-commits] r19796 - in short/3D/PyLith/trunk/libsrc/pylith: problems utils
brad at geodynamics.org
brad at geodynamics.org
Fri Mar 16 17:34:46 PDT 2012
Author: brad
Date: 2012-03-16 17:34:46 -0700 (Fri, 16 Mar 2012)
New Revision: 19796
Modified:
short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.cc
short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.hh
short/3D/PyLith/trunk/libsrc/pylith/utils/petscfwd.h
Log:
Cleanup of Matt's line search updates. Added forward declaration for PetscLineSearch.
Modified: short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.cc 2012-03-16 21:20:13 UTC (rev 19795)
+++ short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.cc 2012-03-17 00:34:46 UTC (rev 19796)
@@ -189,15 +189,16 @@
#undef __FUNCT__
#define __FUNCT__ "lineSearch"
PetscErrorCode
-pylith::problems::SolverNonlinear::lineSearch(PetscLineSearch linesearch, void *lsctx)
+pylith::problems::SolverNonlinear::lineSearch(PetscLineSearch linesearch,
+ void *lsctx)
{ // lineSearch
// Note that for line search purposes we work with with the related
// minimization problem:
// min z(x): R^n -> R,
// where z(x) = .5 * fnorm*fnorm, and fnorm = || f ||_2.
- SNES snes;
- Vec x, f, g, y, w;
- PetscReal fnorm, xnorm, ynorm, gnorm;
+ PetscSNES snes;
+ PetscVec x, f, g, y, w;
+ PetscReal fnorm, xnorm, ynorm, gnorm;
PetscReal initslope,lambdaprev,gnormprev,a,b,d,t1,t2,rellength;
PetscReal minlambda,lambda,lambdatemp;
Modified: short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.hh 2012-03-16 21:20:13 UTC (rev 19795)
+++ short/3D/PyLith/trunk/libsrc/pylith/problems/SolverNonlinear.hh 2012-03-17 00:34:46 UTC (rev 19796)
@@ -112,23 +112,13 @@
/** Generic C interface for customized PETSc line search.
*
- * @param snes PETSc SNES solver.
+ * @param linesearch PETSc line search.
* @param lsctx Optional context for line search (not used here).
- * @param x Current iterate.
- * @param f Residual evaluated at x.
- * @param y Search direction.
- * @param w Work vector
- * @param f 2-norm of f.
- * @param xnorm Norm of x if known, otherwise 0.
- * @param g Residual evaluated at new iterate y.
- * @param w New iterate.
- * @param gnorm 2-norm of g.
- * @param ynorm 2-norm of search length.
- * @param PETSC_TRUE if line search succeeds; PETSC_FALSE on failure.
* @returns PETSc error code.
*/
static
- PetscErrorCode lineSearch(PetscLineSearch linesearch, void *lsctx);
+ PetscErrorCode lineSearch(PetscLineSearch linesearch,
+ void *lsctx);
/** Generic C interface for customized PETSc initial guess.
*
Modified: short/3D/PyLith/trunk/libsrc/pylith/utils/petscfwd.h
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/utils/petscfwd.h 2012-03-16 21:20:13 UTC (rev 19795)
+++ short/3D/PyLith/trunk/libsrc/pylith/utils/petscfwd.h 2012-03-17 00:34:46 UTC (rev 19796)
@@ -43,6 +43,9 @@
/// forward declaration for PETSc SNES
typedef struct _p_SNES* PetscSNES;
+/// forward declatation for PETSc line search
+typedef struct _p_LineSearch* PetscLineSearch;
+
/// forward declaration for PETSc PC
typedef struct _p_PC* PetscPC;
More information about the CIG-COMMITS
mailing list