[Getdp] Getdp with Petsc-3

Mark van Doesburg mark.van.doesburg at technolution.nl
Thu May 7 16:28:01 CEST 2009


I've found a small compile problem when using petsc-3.0.0p3 with
getdp. The patch to fix it is appended.

The include <cstring> is required for gcc-4.4.0.

Mark.

--- orig/getdp-2.0.0-cvs-20090507/Legacy/LinAlg_PETSC.cpp	2009-03-18 00:02:33.000000000 +0100
+++ getdp-2.0.0-cvs-20090507/Legacy/LinAlg_PETSC.cpp	2009-05-07 16:23:30.000000000 +0200
@@ -13,6 +13,7 @@
 #include "LinAlg.h"
 #include "MallocUtils.h"
 #include "Message.h"
+#include <cstring>
 
 // Johan, we curse you for a thousand generations!
 #include "ProData.h"
@@ -68,9 +69,15 @@
 
   // get additional petsc options from specified file (useful e.g. on
   // Windows where we don't know where to search for ~/.petsrc)
+#if PETSC_VERSION_MAJOR==3
+  for(int i = 0; i < *argc - 1; i++)
+    if (!strcmp((*argv)[i], "-solver"))
+      PetscOptionsInsertFile(PETSC_COMM_WORLD, (*argv)[i+1], PETSC_FALSE);
+#else
   for(int i = 0; i < *argc - 1; i++)
     if (!strcmp((*argv)[i], "-solver"))
       PetscOptionsInsertFile((*argv)[i+1]);
+#endif
 }
 
 void LinAlg_Finalize()