On Apr 18, 2013, at 7:08 AM, Alexei Matveev <alexei.matveev+petsc at gmail.com> wrote:
> > > Hi, All, > > Thanks for your comments. > > On 17 April 2013 23:35, Barry Smith <bsmith at mcs.anl.gov> wrote: > > It is our intention that PETSc be easy enough for anyone to install > that rather than making your application work with different versions one > simply install the PETSc version one needs. In addition we recommend updating > applications to work with the latest release within a couple of months after > each release. > > I understand that. With rapid development it is unavoidable to break > API occasionally. > > I managed to compile and run the code with the quick hack below and somewhat > more. Thanks, Kirk! Need yet to find out why the tests fail. > > Do I understand it correctly that there is no way currently to load a > distributed > Vec from the file without knowing and setting its dimensions first? > Like I was doing here: > > +# if PETSC_VERSION < 30200 > VecLoad (viewer, VECMPI, &vec); /* creates it */ > +#else > + /* FIXME: how to make it distributed? */ > + VecCreate (PETSC_COMM_WORLD, &vec); > + VecLoad (vec, viewer); > +#endif Use VecCreate(), VecSetType(vec,VECSTANDARD); <-- indicates seq on one process and MPI on several VecLoad(). If that does not work then please send all error output to petsc-maint. > > BTW, I found myself calling (DM)DAGetInfo() on the array descriptor DM/DA > quite often to get the shape of the 3d grid. I noticed that now that the > signature > of the *GetInfo() changed. Is there an official way to get that shape info by > enquiring > the Vec itself? We now have in petsc-dev VecGetDM() that will give you the DM/DA associated with the vector, if it has one, from that you can get the shape info. Barry > > Alexei > > -#include "petscda.h" /* Vec, Mat, DA, ... */ > +#include "petscdmda.h" /* Vec, Mat, DA, ... */ > #include "petscdmmg.h" /* KSP, ... */ > > +#define PETSC_VERSION (PETSC_VERSION_MAJOR * 10000 + PETSC_VERSION_MINOR * > 100) > + > +/* FIXME: PETSC 3.2 */ > +#if PETSC_VERSION >= 30200 > +typedef DM DA; > +typedef PetscBool PetscTruth; > +# define VecDestroy(x) (VecDestroy)(&(x)) > +# define VecScatterDestroy(x) (VecScatterDestroy)(&(x)) > +# define MatDestroy(x) (MatDestroy)(&(x)) > +# define ISDestroy(x) (ISDestroy)(&(x)) > +# define KSPDestroy(x) (KSPDestroy)(&(x)) > +# define SNESDestroy(x) (SNESDestroy)(&(x)) > +# define PetscViewerDestroy(x) (PetscViewerDestroy)(&(x)) > +# define PCDestroy(x) (PCDestroy)(&(x)) > +# define DADestroy(x) (DMDestroy)(&(x)) > +# define DAGetCorners DMDAGetCorners > +# define DACreate3d DMDACreate3d > +# define DACreateGlobalVector DMCreateGlobalVector > +# define DAGetGlobalVector DMGetGlobalVector > +# define DAGetInfo DMDAGetInfo > +# define DAGetMatrix DMGetMatrix > +# define DARestoreGlobalVector DMRestoreGlobalVector > +# define DAVecGetArray DMDAVecGetArray > +# define DAVecRestoreArray DMDAVecRestoreArray > +# define VecLoadIntoVector(viewer, vec) VecLoad (vec, viewer) > +# define DA_STENCIL_STAR DMDA_STENCIL_STAR > +# define DA_XYZPERIODIC DMDA_XYZPERIODIC > +#endif
