[petsc-users] maintaining application compatibility with 3.1 and 3.2

Alexei Matveev alexei.matveev+petsc at gmail.com
Thu Apr 18 07:08:26 CDT 2013


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

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?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130418/0448229b/attachment.html>


More information about the petsc-users mailing list