[cig-commits] commit: Make it work for Petsc 3.1
Mercurial
hg at geodynamics.org
Fri Feb 25 14:10:03 PST 2011
changeset: 2:9150df9a06ef
user: Walter Landry <wlandry at caltech.edu>
date: Sat Jan 01 17:02:18 2011 -0800
files: source/SAMRAI/solv/PETScAbstractVectorReal.C source/SAMRAI/solv/PETScAbstractVectorReal.h source/SAMRAI/solv/SNES_SAMRAIContext.C source/SAMRAI/solv/SNES_SAMRAIContext.h
description:
Make it work for Petsc 3.1
diff -r 21b9e62909a7 -r 9150df9a06ef source/SAMRAI/solv/PETScAbstractVectorReal.C
--- a/source/SAMRAI/solv/PETScAbstractVectorReal.C Sat Jan 01 16:57:27 2011 -0800
+++ b/source/SAMRAI/solv/PETScAbstractVectorReal.C Sat Jan 01 17:02:18 2011 -0800
@@ -51,12 +51,11 @@ PETScAbstractVectorReal<TYPE>::PETScAbst
PETSC_SAMRAI_ERROR(ierr);
// Set PETSc vector data to this abstract vector object
- d_petsc_vector->precision = PETSC_SCALAR;
d_petsc_vector->data = this;
d_petsc_vector->petscnative = PETSC_FALSE;
- d_petsc_vector->map.n = 0;
- d_petsc_vector->map.N = 0;
- d_petsc_vector->map.bs = 1;
+ d_petsc_vector->map->n = 0;
+ d_petsc_vector->map->N = 0;
+ d_petsc_vector->map->bs = 1;
// Assign vector operations to PETSc vector object.
d_petsc_vector->ops->duplicate = PETScAbstractVectorReal<TYPE>::vecDuplicate;
@@ -141,21 +140,16 @@ PETScAbstractVectorReal<TYPE>::PETScAbst
PETScAbstractVectorReal<TYPE>::vecPointwiseMin;
d_petsc_vector->ops->getvalues = PETScAbstractVectorReal<TYPE>::vecGetValues;
- ierr = PetscMapInitialize(d_comm, &d_petsc_vector->map);
+ ierr = PetscLayoutCreate(d_comm, &d_petsc_vector->map);
PETSC_SAMRAI_ERROR(ierr);
- ierr = PetscMapSetBlockSize(&d_petsc_vector->map, 1);
+ ierr = PetscLayoutSetBlockSize(d_petsc_vector->map, 1);
PETSC_SAMRAI_ERROR(ierr);
- ierr = PetscMapSetSize(&d_petsc_vector->map, 0);
+ ierr = PetscLayoutSetSize(d_petsc_vector->map, 0);
PETSC_SAMRAI_ERROR(ierr);
- ierr = PetscMapSetLocalSize(&d_petsc_vector->map, 0);
+ ierr = PetscLayoutSetLocalSize(d_petsc_vector->map, 0);
PETSC_SAMRAI_ERROR(ierr);
const std::string my_name = "PETScAbstractVectorReal";
-
- if (d_petsc_vector->type_name) {
- ierr = PetscFree(d_petsc_vector->type_name);
- PETSC_SAMRAI_ERROR(ierr);
- }
ierr =
PetscObjectChangeTypeName(reinterpret_cast<PetscObject>(d_petsc_vector),
@@ -888,13 +882,15 @@ PetscErrorCode
PetscErrorCode
PETScAbstractVectorReal<TYPE>::vecSetOption(
Vec x,
- VecOption op)
+ VecOption op,
+ PetscTruth result)
{
NULL_USE(x);
NULL_USE(op);
TBOX_ERROR(
"PETScAbstractVectorReal<TYPE>::vecSetOption() unimplemented"
<< std::endl);
+ result=PETSC_TRUE;
PetscFunctionReturn(0);
}
@@ -1046,7 +1042,7 @@ PetscErrorCode
PetscErrorCode
PETScAbstractVectorReal<TYPE>::vecLoad(
PetscViewer viewer,
- VecType outtype,
+ const VecType outtype,
Vec* newvec)
{
NULL_USE(viewer);
diff -r 21b9e62909a7 -r 9150df9a06ef source/SAMRAI/solv/PETScAbstractVectorReal.h
--- a/source/SAMRAI/solv/PETScAbstractVectorReal.h Sat Jan 01 16:57:27 2011 -0800
+++ b/source/SAMRAI/solv/PETScAbstractVectorReal.h Sat Jan 01 17:02:18 2011 -0800
@@ -690,7 +690,8 @@ private:
static PetscErrorCode
vecSetOption(
Vec x,
- VecOption op);
+ VecOption op,
+ PetscTruth result);
static PetscErrorCode
vecSetValuesBlocked(
@@ -747,7 +748,7 @@ private:
static PetscErrorCode
vecLoad(
PetscViewer viewer,
- VecType outtype,
+ const VecType outtype,
Vec* newvec);
static PetscErrorCode
diff -r 21b9e62909a7 -r 9150df9a06ef source/SAMRAI/solv/SNES_SAMRAIContext.C
--- a/source/SAMRAI/solv/SNES_SAMRAIContext.C Sat Jan 01 16:57:27 2011 -0800
+++ b/source/SAMRAI/solv/SNES_SAMRAIContext.C Sat Jan 01 17:02:18 2011 -0800
@@ -86,10 +86,12 @@ int SNES_SAMRAIContext::SNESJacobianTime
}
int SNES_SAMRAIContext::SNESsetupPreconditioner(
- void* ctx)
+ PC pc)
{
int ierr = 0;
Vec current_solution;
+ void *ctx;
+ PCShellGetContext(pc,&ctx);
ierr = SNESGetSolution(((SNES_SAMRAIContext *)ctx)->getSNESSolver(),
¤t_solution);
PETSC_SAMRAI_ERROR(ierr);
@@ -98,10 +100,12 @@ int SNES_SAMRAIContext::SNESsetupPrecond
}
int SNES_SAMRAIContext::SNESapplyPreconditioner(
- void* ctx,
+ PC pc,
Vec r,
Vec z)
{
+ void *ctx;
+ PCShellGetContext(pc,&ctx);
return ((SNES_SAMRAIContext *)ctx)->
getSNESFunctions()->applyPreconditioner(r, z);
}
diff -r 21b9e62909a7 -r 9150df9a06ef source/SAMRAI/solv/SNES_SAMRAIContext.h
--- a/source/SAMRAI/solv/SNES_SAMRAIContext.h Sat Jan 01 16:57:27 2011 -0800
+++ b/source/SAMRAI/solv/SNES_SAMRAIContext.h Sat Jan 01 17:02:18 2011 -0800
@@ -648,11 +648,11 @@ private:
static int
SNESsetupPreconditioner(
- void* ctx); // input vector
+ PC pc); // input vector
static int
SNESapplyPreconditioner(
- void* ctx, // user-defined context
+ PC pc, // user-defined context
Vec xin, // input vector
Vec xout); // output vector
More information about the CIG-COMMITS
mailing list