Commits

Lisandro Dalcin  committed 4772a1b

Rename IGAFormXXX -> IGAComputeXXX, add previous IGAFormXXX

  • Participants
  • Parent commits 6427e42

Comments (0)

Files changed (16)

File demo/AdvectionDiffusion.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,&user);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr);
 
   KSP ksp;

File demo/ClassicalShell.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,&user);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   //MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);
   //PetscBool symm=1;
   //ierr = MatIsSymmetric(A,1e-2,&symm);CHKERRQ(ierr);

File demo/Elasticity3D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,&user);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   
   // Solve
   KSP ksp;

File demo/L2Proj1D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,&user);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/L2Proj2D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,&user);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
 
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/L2Projection.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,PETSC_NULL);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
 
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/Laplace.c

   }else{
     ierr = IGASetUserSystem(iga,SystemLaplace,PETSC_NULL);CHKERRQ(ierr);
   }
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr);
 
   // Solve

File demo/Poisson.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,PETSC_NULL);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
 
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/Poisson1D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,PETSC_NULL);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/Poisson2D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,PETSC_NULL);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File demo/Poisson3D.c

   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
   ierr = IGASetUserSystem(iga,System,PETSC_NULL);CHKERRQ(ierr);
-  ierr = IGAFormSystem(iga,A,b);CHKERRQ(ierr);
+  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
   
   KSP ksp;
   ierr = IGACreateKSP(iga,&ksp);CHKERRQ(ierr);

File include/petiga.h

 #define PCEBE "ebe"
 #define PCBBB "bbb"
 PETSC_EXTERN PetscErrorCode IGACreateKSP(IGA iga,KSP *ksp);
-PETSC_EXTERN PetscErrorCode IGAFormSystem(IGA iga,Mat A,Vec B);
+PETSC_EXTERN PetscErrorCode IGAComputeSystem(IGA iga,Mat A,Vec B);
+PETSC_EXTERN PetscErrorCode IGAFormSystem(IGA iga,Mat A,Vec B,
+                                          IGAUserSystem,void *);
 
 PETSC_EXTERN PetscErrorCode IGACreateSNES(IGA iga,SNES *snes);
-PETSC_EXTERN PetscErrorCode IGAFormFunction(IGA iga,Vec U,Vec F);
-PETSC_EXTERN PetscErrorCode IGAFormJacobian(IGA iga,Vec U,Mat J);
+PETSC_EXTERN PetscErrorCode IGAComputeFunction(IGA iga,Vec U,Vec F);
+PETSC_EXTERN PetscErrorCode IGAFormFunction(IGA iga,Vec U,Vec F,
+                                            IGAUserFunction,void *);
+PETSC_EXTERN PetscErrorCode IGAComputeJacobian(IGA iga,Vec U,Mat J);
+PETSC_EXTERN PetscErrorCode IGAFormJacobian(IGA iga,Vec U,Mat J,
+                                            IGAUserJacobian,void *);
 
 PETSC_EXTERN PetscErrorCode IGACreateTS(IGA iga,TS *ts);
+PETSC_EXTERN PetscErrorCode IGAComputeIFunction(IGA iga,PetscReal dt,
+                                                PetscReal a,Vec V,
+                                                PetscReal t,Vec U,
+                                                Vec F);
 PETSC_EXTERN PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,
                                              PetscReal a,Vec V,
                                              PetscReal t,Vec U,
-                                             Vec F);
+                                             Vec F,
+                                             IGAUserIFunction,void *);
+PETSC_EXTERN PetscErrorCode IGAComputeIJacobian(IGA iga,PetscReal dt,
+                                                PetscReal a,Vec V,
+                                                PetscReal t,Vec U,
+                                                Mat J);
 PETSC_EXTERN PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,
                                              PetscReal a,Vec V,
                                              PetscReal t,Vec U,
-                                             Mat J);
+                                             Mat J,
+                                             IGAUserIJacobian,void *);
+PETSC_EXTERN PetscErrorCode IGAComputeIEFunction(IGA iga,PetscReal dt,
+                                                 PetscReal a,Vec V,
+                                                 PetscReal t,Vec U,
+                                                 PetscReal t0,Vec U0,
+                                                 Vec F);
 PETSC_EXTERN PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,
                                               PetscReal a,Vec V,
                                               PetscReal t,Vec U,
                                               PetscReal t0,Vec U0,
-                                              Vec F);
+                                              Vec F,
+                                              IGAUserIEFunction,void *);
+PETSC_EXTERN PetscErrorCode IGAComputeIEJacobian(IGA iga,PetscReal dt,
+                                                 PetscReal a,Vec V,
+                                                 PetscReal t,Vec U,
+                                                 PetscReal t0,Vec U0,
+                                                 Mat J);
 PETSC_EXTERN PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,
                                               PetscReal a,Vec V,
                                               PetscReal t,Vec U,
                                               PetscReal t0,Vec U0,
-                                              Mat J);
+                                              Mat J,
+                                              IGAUserIEJacobian,void *);
 
 /* ---------------------------------------------------------------- */
 

File src/makefile

 
 ALL: lib
 
-#CFLAGS = -g3 -pedantic -Wall -Wextra -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wno-long-long
-#FFLAGS = -g3 -pedantic -Wall -Wextra -fcheck=all
+#CFLAGS_STD_C89 = -std=c89 -Dinline=__inline -Wno-long-long
+#CFLAGS_STD_C99 = -std=c99
+#CFLAGS_STD_C11 = -std=c11
+#CFLAGS_STD = ${CFLAGS_STD_C89}
+#CFLAGS = ${CFLAGS_STD} -pedantic -Wall -Wextra -Wno-unused-parameter -Wconversion -Wno-sign-conversion
+
+#FFLAGS_STD_F03 = -std=f2003
+#FFLAGS_STD_F08 = -std=f2008
+#FFLAGS_STD = ${FFLAGS_STD_F03}
+#FFLAGS = ${FFLAGS_STD} -pedantic -Wall -Wextra -fcheck=all
 
 SOURCEH  = ../include/petiga.h petigapc.h petigagrid.h petigapart.h
 SOURCEC  = petiga.c petigareg.c petigaaxis.c petigarule.c petigabasis.c petigabound.c petigaelem.c petigapoint.c petigavec.c petigamat.c petigascl.c petigapcb.c petigapce.c petigaksp.c petigasnes.c petigats.c petigaio.c petigagrid.c petigapart.c

File src/petigaksp.c

 extern PetscLogEvent IGA_FormSystem;
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAFormSystem"
+#define __FUNCT__ "IGAComputeSystem"
 /*@
    IGAFormSystem - Form the matrix and vector which represents the
    discretized a(w,u) = L(w).
 
 .keywords: IGA, setup linear system, matrix assembly, vector assembly
 @*/
-PetscErrorCode IGAFormSystem(IGA iga,Mat matA,Vec vecB)
+PetscErrorCode IGAComputeSystem(IGA iga,Mat matA,Vec vecB)
 {
-  IGAElement     element;
-  IGAPoint       point;
   IGAUserSystem  System;
   void           *SysCtx;
   PetscErrorCode ierr;
   PetscValidHeaderSpecific(vecB,VEC_CLASSID,3);
   IGACheckSetUp(iga,1);
   IGACheckUserOp(iga,1,System);
-
   System = iga->userops->System;
   SysCtx = iga->userops->SysCtx;
+  ierr = IGAFormSystem(iga,matA,vecB,System,SysCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAFormSystem"
+PetscErrorCode IGAFormSystem(IGA iga,Mat matA,Vec vecB,
+                             IGAUserSystem System,void *ctx)
+{
+  IGAElement     element;
+  IGAPoint       point;
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(matA,MAT_CLASSID,2);
+  PetscValidHeaderSpecific(vecB,VEC_CLASSID,3);
+  IGACheckSetUp(iga,1);
 
   ierr = MatZeroEntries(matA);CHKERRQ(ierr);
   ierr = VecZeroEntries(vecB);CHKERRQ(ierr);
       PetscScalar *K, *F;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
       ierr = IGAPointGetWorkVec(point,&F);CHKERRQ(ierr);
-      ierr = System(point,K,F,SysCtx);CHKERRQ(ierr);
+      ierr = System(point,K,F,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddMat(point,K,A);CHKERRQ(ierr);
       ierr = IGAPointAddVec(point,F,B);CHKERRQ(ierr);
     }

File src/petigasnes.c

 extern PetscLogEvent IGA_FormJacobian;
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAFormFunction"
-PetscErrorCode IGAFormFunction(IGA iga,Vec vecU,Vec vecF)
+#define __FUNCT__ "IGAComputeFunction"
+PetscErrorCode IGAComputeFunction(IGA iga,Vec vecU,Vec vecF)
 {
-  Vec               localU;
-  const PetscScalar *arrayU;
-  IGAElement        element;
-  IGAPoint          point;
   IGAUserFunction   Function;
   void              *FunCtx;
   PetscErrorCode    ierr;
   PetscValidHeaderSpecific(vecF,VEC_CLASSID,3);
   IGACheckSetUp(iga,1);
   IGACheckUserOp(iga,1,Function);
-  
   Function = iga->userops->Function;
   FunCtx   = iga->userops->FunCtx;
+  ierr = IGAFormFunction(iga,vecU,vecF,Function,FunCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAFormFunction"
+PetscErrorCode IGAFormFunction(IGA iga,Vec vecU,Vec vecF,
+                               IGAUserFunction Function,void *ctx)
+{
+  Vec               localU;
+  const PetscScalar *arrayU;
+  IGAElement        element;
+  IGAPoint          point;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,2);
+  PetscValidHeaderSpecific(vecF,VEC_CLASSID,3);
+  IGACheckSetUp(iga,1);
 
   /* Clear global vector F*/
   ierr = VecZeroEntries(vecF);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *R;
       ierr = IGAPointGetWorkVec(point,&R);CHKERRQ(ierr);
-      ierr = Function(point,U,R,FunCtx);CHKERRQ(ierr);
+      ierr = Function(point,U,R,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddVec(point,R,F);CHKERRQ(ierr);
     }
     /* */
   PetscFunctionReturn(0);
 }
 
-
 #undef  __FUNCT__
-#define __FUNCT__ "IGAFormJacobian"
-PetscErrorCode IGAFormJacobian(IGA iga,Vec vecU,Mat matJ)
+#define __FUNCT__ "IGAComputeJacobian"
+PetscErrorCode IGAComputeJacobian(IGA iga,Vec vecU,Mat matJ)
 {
-  Vec               localU;
-  const PetscScalar *arrayU;
-  IGAElement        element;
-  IGAPoint          point;
   IGAUserJacobian   Jacobian;
   void              *JacCtx;
   PetscErrorCode    ierr;
   PetscValidHeaderSpecific(matJ,MAT_CLASSID,3);
   IGACheckSetUp(iga,1);
   IGACheckUserOp(iga,1,Jacobian);
-
   Jacobian = iga->userops->Jacobian;
   JacCtx   = iga->userops->JacCtx;
+  ierr = IGAFormJacobian(iga,vecU,matJ,Jacobian,JacCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAFormJacobian"
+PetscErrorCode IGAFormJacobian(IGA iga,Vec vecU,Mat matJ,
+                               IGAUserJacobian Jacobian,void *ctx)
+{
+  Vec               localU;
+  const PetscScalar *arrayU;
+  IGAElement        element;
+  IGAPoint          point;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,2);
+  PetscValidHeaderSpecific(matJ,MAT_CLASSID,3);
+  IGACheckSetUp(iga,1);
 
   /* Clear global matrix J */
   ierr = MatZeroEntries(matJ);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *K;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
-      ierr = Jacobian(point,U,K,JacCtx);CHKERRQ(ierr);
+      ierr = Jacobian(point,U,K,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddMat(point,K,J);CHKERRQ(ierr);
     }
     /* */
   PetscValidHeaderSpecific(U,VEC_CLASSID,2);
   PetscValidHeaderSpecific(F,VEC_CLASSID,3);
   PetscValidHeaderSpecific(iga,IGA_CLASSID,4);
-  ierr = IGAFormFunction(iga,U,F);CHKERRQ(ierr);
+  ierr = IGAComputeFunction(iga,U,F);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
   PetscValidHeaderSpecific(*P,MAT_CLASSID,4);
   PetscValidPointer(m,5);
   PetscValidHeaderSpecific(iga,IGA_CLASSID,6);
-  ierr = IGAFormJacobian(iga,U,*P);CHKERRQ(ierr);
+  ierr = IGAComputeJacobian(iga,U,*P);CHKERRQ(ierr);
   if (*J != * P) {
     ierr = MatAssemblyBegin(*J,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
     ierr = MatAssemblyEnd(*J,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);

File src/petigats.c

 extern PetscLogEvent IGA_FormJacobian;
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAFormIFunction"
-PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,
-                                PetscReal a,Vec vecV,
-                                PetscReal t,Vec vecU,
-                                Vec vecF)
+#define __FUNCT__ "IGAComputeIFunction"
+PetscErrorCode IGAComputeIFunction(IGA iga,PetscReal dt,
+                                   PetscReal a,Vec vecV,
+                                   PetscReal t,Vec vecU,
+                                   Vec vecF)
 {
-  Vec               localV;
-  Vec               localU;
-  const PetscScalar *arrayV;
-  const PetscScalar *arrayU;
-  IGAElement        element;
-  IGAPoint          point;
   IGAUserIFunction  IFunction;
   void              *IFunCtx;
   PetscErrorCode    ierr;
   PetscValidHeaderSpecific(vecF,VEC_CLASSID,7);
   IGACheckSetUp(iga,1);
   IGACheckUserOp(iga,1,IFunction);
-
   IFunction = iga->userops->IFunction;
   IFunCtx   = iga->userops->IFunCtx;
+  ierr = IGAFormIFunction(iga,dt,a,vecV,t,vecU,vecF,IFunction,IFunCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAFormIFunction"
+PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,
+                                PetscReal a,Vec vecV,
+                                PetscReal t,Vec vecU,
+                                Vec vecF,
+                                IGAUserIFunction IFunction, void *ctx)
+{
+  Vec               localV;
+  Vec               localU;
+  const PetscScalar *arrayV;
+  const PetscScalar *arrayU;
+  IGAElement        element;
+  IGAPoint          point;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecV,VEC_CLASSID,4);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,6);
+  PetscValidHeaderSpecific(vecF,VEC_CLASSID,7);
+  IGACheckSetUp(iga,1);
 
   /* Clear global vector F */
   ierr = VecZeroEntries(vecF);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *R;
       ierr = IGAPointGetWorkVec(point,&R);CHKERRQ(ierr);
-      ierr = IFunction(point,dt,a,V,t,U,R,IFunCtx);CHKERRQ(ierr);
+      ierr = IFunction(point,dt,a,V,t,U,R,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddVec(point,R,F);CHKERRQ(ierr);
     }
     /* */
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAFormIJacobian"
-PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,
-                                PetscReal a,Vec vecV,
-                                PetscReal t,Vec vecU,
-                                Mat matJ)
+#define __FUNCT__ "IGAComputeIJacobian"
+PetscErrorCode IGAComputeIJacobian(IGA iga,PetscReal dt,
+                                   PetscReal a,Vec vecV,
+                                   PetscReal t,Vec vecU,
+                                   Mat matJ)
 {
-  Vec               localV;
-  Vec               localU;
-  const PetscScalar *arrayV;
-  const PetscScalar *arrayU;
-  IGAElement        element;
-  IGAPoint          point;
   IGAUserIJacobian  IJacobian;
   void              *IJacCtx;
   PetscErrorCode    ierr;
   PetscValidHeaderSpecific(matJ,MAT_CLASSID,7);
   IGACheckSetUp(iga,1);
   IGACheckUserOp(iga,1,IJacobian);
-
   IJacobian = iga->userops->IJacobian;
   IJacCtx   = iga->userops->IJacCtx;
+  ierr = IGAFormIJacobian(iga,dt,a,vecV,t,vecU,matJ,IJacobian,IJacCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAFormIJacobian"
+PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,
+                                PetscReal a,Vec vecV,
+                                PetscReal t,Vec vecU,
+                                Mat matJ,
+                                IGAUserIJacobian IJacobian,void *ctx)
+{
+  Vec               localV;
+  Vec               localU;
+  const PetscScalar *arrayV;
+  const PetscScalar *arrayU;
+  IGAElement        element;
+  IGAPoint          point;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecV,VEC_CLASSID,5);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,6);
+  PetscValidHeaderSpecific(matJ,MAT_CLASSID,7);
+  IGACheckSetUp(iga,1);
 
   /* Clear global matrix J*/
   ierr = MatZeroEntries(matJ);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *K;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
-      ierr = IJacobian(point,dt,a,V,t,U,K,IJacCtx);CHKERRQ(ierr);
+      ierr = IJacobian(point,dt,a,V,t,U,K,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddMat(point,K,J);CHKERRQ(ierr);
     }
     /* */
 }
 
 #undef  __FUNCT__
+#define __FUNCT__ "IGAComputeIEFunction"
+PetscErrorCode IGAComputeIEFunction(IGA iga,PetscReal dt,
+                                    PetscReal a,Vec vecV,
+                                    PetscReal t,Vec vecU,
+                                    PetscReal t0,Vec vecU0,
+                                    Vec vecF)
+{
+  IGAUserIEFunction IEFunction;
+  void              *IEFunCtx;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecV,VEC_CLASSID,4);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,6);
+  PetscValidHeaderSpecific(vecU0,VEC_CLASSID,8);
+  PetscValidHeaderSpecific(vecF,VEC_CLASSID,9);
+  IGACheckSetUp(iga,1);
+  IGACheckUserOp(iga,1,IEFunction);
+  IEFunction = iga->userops->IEFunction;
+  IEFunCtx   = iga->userops->IEFunCtx;
+  ierr = IGAFormIEFunction(iga,dt,a,vecV,t,vecU,t0,vecU0,vecF,IEFunction,IEFunCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
 #define __FUNCT__ "IGAFormIEFunction"
 PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,
                                  PetscReal a,Vec vecV,
                                  PetscReal t,Vec vecU,
                                  PetscReal t0,Vec vecU0,
-                                 Vec vecF)
+                                 Vec vecF,
+                                 IGAUserIEFunction IEFunction,void *ctx)
 {
   Vec               localV;
   Vec               localU;
   const PetscScalar *arrayU0;
   IGAElement        element;
   IGAPoint          point;
-  IGAUserIEFunction IEFunction;
-  void              *IEFunCtx;
   PetscErrorCode    ierr;
   PetscFunctionBegin;
   PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
-  PetscValidHeaderSpecific(vecV,VEC_CLASSID,5);
+  PetscValidHeaderSpecific(vecV,VEC_CLASSID,4);
   PetscValidHeaderSpecific(vecU,VEC_CLASSID,6);
-  PetscValidHeaderSpecific(vecU0,VEC_CLASSID,7);
-  PetscValidHeaderSpecific(vecF,VEC_CLASSID,8);
+  PetscValidHeaderSpecific(vecU0,VEC_CLASSID,8);
+  PetscValidHeaderSpecific(vecF,VEC_CLASSID,9);
   IGACheckSetUp(iga,1);
-  IGACheckUserOp(iga,1,IEFunction);
-
-  IEFunction = iga->userops->IEFunction;
-  IEFunCtx   = iga->userops->IEFunCtx;
 
   /* Clear global vector F */
   ierr = VecZeroEntries(vecF);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *R;
       ierr = IGAPointGetWorkVec(point,&R);CHKERRQ(ierr);
-      ierr = IEFunction(point,dt,a,V,t,U,t0,U0,R,IEFunCtx);CHKERRQ(ierr);
+      ierr = IEFunction(point,dt,a,V,t,U,t0,U0,R,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddVec(point,R,F);CHKERRQ(ierr);
     }
     /* */
 }
 
 #undef  __FUNCT__
+#define __FUNCT__ "IGAComputeIEJacobian"
+PetscErrorCode IGAComputeIEJacobian(IGA iga,PetscReal dt,
+                                    PetscReal a,Vec vecV,
+                                    PetscReal t,Vec vecU,
+                                    PetscReal t0,Vec vecU0,
+                                    Mat matJ)
+{
+  IGAUserIEJacobian  IEJacobian;
+  void              *IEJacCtx;
+  PetscErrorCode    ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(vecV,VEC_CLASSID,5);
+  PetscValidHeaderSpecific(vecU,VEC_CLASSID,6);
+  PetscValidHeaderSpecific(matJ,MAT_CLASSID,7);
+  IGACheckSetUp(iga,1);
+  IGACheckUserOp(iga,1,IEJacobian);
+  IEJacobian = iga->userops->IEJacobian;
+  IEJacCtx   = iga->userops->IEJacCtx;
+  ierr = IGAFormIEJacobian(iga,dt,a,vecV,t,vecU,t0,vecU0,matJ,IEJacobian,IEJacCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
 #define __FUNCT__ "IGAFormIEJacobian"
 PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,
                                  PetscReal a,Vec vecV,
                                  PetscReal t,Vec vecU,
                                  PetscReal t0,Vec vecU0,
-                                 Mat matJ)
+                                 Mat matJ,
+                                 IGAUserIEJacobian IEJacobian,void *ctx)
 {
   Vec               localV;
   Vec               localU;
   const PetscScalar *arrayU0;
   IGAElement        element;
   IGAPoint          point;
-  IGAUserIEJacobian IEJacobian;
-  void              *IEJacCtx;
   PetscErrorCode    ierr;
   PetscFunctionBegin;
   PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
   PetscValidHeaderSpecific(vecU0,VEC_CLASSID,7);
   PetscValidHeaderSpecific(matJ,MAT_CLASSID,0);
   IGACheckSetUp(iga,1);
-  IGACheckUserOp(iga,1,IEJacobian);
-
-  IEJacobian = iga->userops->IEJacobian;
-  IEJacCtx   = iga->userops->IEJacCtx;
 
   /* Clear global matrix J*/
   ierr = MatZeroEntries(matJ);CHKERRQ(ierr);
     while (IGAPointNext(point)) {
       PetscScalar *K;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
-      ierr = IEJacobian(point,dt,a,V,t,U,t0,U0,K,IEJacCtx);CHKERRQ(ierr);
+      ierr = IEJacobian(point,dt,a,V,t,U,t0,U0,K,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddMat(point,K,J);CHKERRQ(ierr);
     }
     /* */
     Vec       U0;
     ierr = TSGetTime(ts,&t0);CHKERRQ(ierr);
     ierr = TSGetSolution(ts,&U0);CHKERRQ(ierr);
-    ierr = IGAFormIEFunction(iga,dt,a,V,t,U,t0,U0,F);CHKERRQ(ierr);
+    ierr = IGAComputeIEFunction(iga,dt,a,V,t,U,t0,U0,F);CHKERRQ(ierr);
   } else {
-    ierr = IGAFormIFunction(iga,dt,a,V,t,U,F);CHKERRQ(ierr);
+    ierr = IGAComputeIFunction(iga,dt,a,V,t,U,F);CHKERRQ(ierr);
   }
   PetscFunctionReturn(0);
 }
     Vec       U0;
     ierr = TSGetTime(ts,&t0);CHKERRQ(ierr);
     ierr = TSGetSolution(ts,&U0);CHKERRQ(ierr);
-    ierr = IGAFormIEJacobian(iga,dt,a,V,t,U,t0,U0,*P);CHKERRQ(ierr);
+    ierr = IGAComputeIEJacobian(iga,dt,a,V,t,U,t0,U0,*P);CHKERRQ(ierr);
   } else {
-    ierr = IGAFormIJacobian(iga,dt,a,V,t,U,*P);CHKERRQ(ierr);
+    ierr = IGAComputeIJacobian(iga,dt,a,V,t,U,*P);CHKERRQ(ierr);
   }
   if (*J != * P) {
     ierr = MatAssemblyBegin(*J,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);