Commits

Lisandro Dalcin committed 3777460

Add error checking macro IGACheckUserOp()

  • Participants
  • Parent commits 9c4683e

Comments (0)

Files changed (2)

File include/petiga.h

 #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)

File src/petigaksp.c

   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);