Lisandro Dalcin avatar Lisandro Dalcin committed 3777460

Add error checking macro IGACheckUserOp()

Comments (0)

Files changed (2)

 #define IGACheckSetUp(iga,arg) do {} while (0)
 #endif
 
+#if defined(PETSC_USE_DEBUG)
+#define IGACheckUserOp(iga,arg,UserOp) do {             \
+    if (!iga->userops->UserOp)                          \
+      SETERRQ4(((PetscObject)iga)->comm,PETSC_ERR_USER, \
+               "Must call IGASetUser%s() "              \
+               "on argument %D \"%s\" before %s()",     \
+               #UserOp,(arg),#iga,PETSC_FUNCTION_NAME); \
+    } while (0)
+#else
+#define IGACheckUserOp(iga,arg,UserOp) do {} while (0)
+#endif
+
 /* ---------------------------------------------------------------- */
 
 #if PETSC_VERSION_(3,2,0)
   PetscValidHeaderSpecific(matA,MAT_CLASSID,2);
   PetscValidHeaderSpecific(vecB,VEC_CLASSID,3);
   IGACheckSetUp(iga,1);
+  IGACheckUserOp(iga,1,System);
 
   System = iga->userops->System;
   SysCtx = iga->userops->SysCtx;
-  if (!System) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must call IGASetUserSystem() before");
 
   ierr = MatZeroEntries(matA);CHKERRQ(ierr);
   ierr = VecZeroEntries(vecB);CHKERRQ(ierr);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.