Commits

Lisandro Dalcin committed 1dac882

Change callback calling interface for TS problems

  • Participants
  • Parent commits e12e4f7

Comments (0)

Files changed (5)

File demo/CahnHilliard2D.c

 
 #undef  __FUNCT__
 #define __FUNCT__ "Residual"
-PetscErrorCode Residual(IGAPoint p,PetscReal dt,PetscReal shift,
-                        PetscReal t,const PetscScalar *V,const PetscScalar *U,
+PetscErrorCode Residual(IGAPoint p,PetscReal dt,
+                        PetscReal shift,const PetscScalar *V,
+                        PetscReal t,const PetscScalar *U,
                         PetscScalar *R,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;
 
 #undef  __FUNCT__
 #define __FUNCT__ "Tangent"
-PetscErrorCode Tangent(IGAPoint p,PetscReal dt,PetscReal shift,
-                       PetscReal t,const PetscScalar *V,const PetscScalar *U,
+PetscErrorCode Tangent(IGAPoint p,PetscReal dt,
+                       PetscReal shift,const PetscScalar *V,
+                       PetscReal t,const PetscScalar *U,
                        PetscScalar *K,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;

File demo/NavierStokesVMS.c

 
 #undef  __FUNCT__
 #define __FUNCT__ "Residual"
-PetscErrorCode Residual(IGAPoint pnt,PetscReal dt,PetscReal shift,
-                        PetscReal t,const PetscScalar *V,const PetscScalar *U,
+PetscErrorCode Residual(IGAPoint pnt,PetscReal dt,
+                        PetscReal shift,const PetscScalar *V,
+                        PetscReal t,const PetscScalar *U,
                         PetscScalar *Re,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;
 
 #undef  __FUNCT__
 #define __FUNCT__ "Tangent"
-PetscErrorCode Tangent(IGAPoint pnt,PetscReal dt,PetscReal shift,
-                       PetscReal t,const PetscScalar *V,const PetscScalar *U,
+PetscErrorCode Tangent(IGAPoint pnt,PetscReal dt,
+                       PetscReal shift,const PetscScalar *V,
+                       PetscReal t,const PetscScalar *U,
                        PetscScalar *Ke,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;

File demo/PatternFormation.c

 
 #undef  __FUNCT__
 #define __FUNCT__ "Function"
-PetscErrorCode Function(IGAPoint point,PetscReal dt,PetscReal shift,
-                        PetscReal t,PetscReal t0,const PetscScalar *V,const PetscScalar *U1,const PetscScalar *U0,
+PetscErrorCode Function(IGAPoint point,PetscReal dt,
+                        PetscReal shift,const PetscScalar *V,
+                        PetscReal t,const PetscScalar *U1,
+                        PetscReal t0,const PetscScalar *U0,
                         PetscScalar *Re,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;
 
 #undef  __FUNCT__
 #define __FUNCT__ "Jacobian"
-PetscErrorCode Jacobian(IGAPoint point,PetscReal dt,PetscReal shift,
-                        PetscReal t,PetscReal t0,const PetscScalar *V,const PetscScalar *U1, const PetscScalar *U0,
+PetscErrorCode Jacobian(IGAPoint point,PetscReal dt,
+                        PetscReal shift,const PetscScalar *V,
+                        PetscReal t,const PetscScalar *U1,
+                        PetscReal t0,const PetscScalar *U0,
                         PetscScalar *Ke,void *ctx)
 {
   AppCtx *user = (AppCtx *)ctx;

File include/petiga.h

 typedef PetscErrorCode (*IGAUserSystem)    (IGAPoint point,PetscScalar *K,PetscScalar *F,void *ctx);
 typedef PetscErrorCode (*IGAUserFunction)  (IGAPoint point,const PetscScalar *U,PetscScalar *F,void *ctx);
 typedef PetscErrorCode (*IGAUserJacobian)  (IGAPoint point,const PetscScalar *U,PetscScalar *J,void *ctx);
-typedef PetscErrorCode (*IGAUserIFunction) (IGAPoint point,PetscReal dt,PetscReal a,
-                                            PetscReal t,const PetscScalar *V,const PetscScalar *U,
+typedef PetscErrorCode (*IGAUserIFunction) (IGAPoint point,PetscReal dt,
+                                            PetscReal t,const PetscScalar *U,
+                                            PetscReal a,const PetscScalar *V,
                                             PetscScalar *F,void *ctx);
-typedef PetscErrorCode (*IGAUserIJacobian) (IGAPoint point,PetscReal dt,PetscReal a,
-                                            PetscReal t,const PetscScalar *V,const PetscScalar *U,
+typedef PetscErrorCode (*IGAUserIJacobian) (IGAPoint point,PetscReal dt,
+                                            PetscReal t,const PetscScalar *U,
+                                            PetscReal a,const PetscScalar *V,
                                             PetscScalar *J,void *ctx);
-typedef PetscErrorCode (*IGAUserIEFunction)(IGAPoint point,PetscReal dt,PetscReal a,
-                                            PetscReal t,PetscReal t0,const PetscScalar *V,const PetscScalar *U,const PetscScalar *U0,
+typedef PetscErrorCode (*IGAUserIEFunction)(IGAPoint point,PetscReal dt,
+                                            PetscReal t,const PetscScalar *U,
+                                            PetscReal t0,const PetscScalar *U0,
+                                            PetscReal a,const PetscScalar *V,
                                             PetscScalar *F,void *ctx);
-typedef PetscErrorCode (*IGAUserIEJacobian)(IGAPoint point,PetscReal dt,PetscReal a,
-                                            PetscReal t,PetscReal t0,const PetscScalar *V,const PetscScalar *U,const PetscScalar *U0,
+typedef PetscErrorCode (*IGAUserIEJacobian)(IGAPoint point,PetscReal dt,
+                                            PetscReal t,const PetscScalar *U,
+                                            PetscReal t0,const PetscScalar *U0,
+                                            PetscReal a,const PetscScalar *V,
                                             PetscScalar *J,void *ctx);
 
 typedef struct _IGAUserOps *IGAUserOps;
                                       IGAUserJacobian Jacobian,void *ctx);
 
 extern PetscErrorCode IGACreateTS(IGA iga,TS *ts);
-extern PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,PetscReal a,
-                                       PetscReal t,Vec V,Vec U,Vec F,
-                                       IGAUserIFunction IFunction,void *ctx);
-extern PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,PetscReal a,
-                                       PetscReal t,Vec V,Vec U,Mat J,
-                                       IGAUserIJacobian IJacobian,void *ctx);
-extern PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,PetscReal a,
-                                        PetscReal t,PetscReal t0,Vec V,Vec U,Vec U0,Vec F,
-                                        IGAUserIEFunction IEFunction,void *ctx);
-extern PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,PetscReal a,
-                                        PetscReal t,PetscReal t0,Vec V,Vec U,Vec U0,Mat J,
-                                        IGAUserIEJacobian IEJacobian,void *ctx);
+extern PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,
+                                       PetscReal t,Vec U,
+                                       PetscReal a,Vec V,
+                                       Vec F,IGAUserIFunction IFunction,void *ctx);
+extern PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,
+                                       PetscReal t,Vec U,
+                                       PetscReal a,Vec V,
+                                       Mat J,IGAUserIJacobian IJacobian,void *ctx);
+extern PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,
+                                        PetscReal t,Vec U,
+                                        PetscReal t0,Vec U0,
+                                        PetscReal a,Vec V,
+                                        Vec F,IGAUserIEFunction IEFunction,void *ctx);
+extern PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,
+                                        PetscReal t,Vec U,
+                                        PetscReal t0,Vec U0,
+                                        PetscReal a,Vec V,
+                                        Mat J,IGAUserIEJacobian IEJacobian,void *ctx);
 
 /* ---------------------------------------------------------------- */
 

File src/petigats.c

 
 #undef  __FUNCT__
 #define __FUNCT__ "IGAFormIFunction"
-PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,PetscReal shift,
-                                PetscReal t,Vec vecV,Vec vecU,
-                                Vec vecF,
-                                IGAUserIFunction IFunction, void *ctx)
+PetscErrorCode IGAFormIFunction(IGA iga,PetscReal dt,
+                                PetscReal a,Vec vecV,
+                                PetscReal t,Vec vecU,
+                                Vec vecF,IGAUserIFunction IFunction, void *ctx)
 {
   Vec               localV;
   Vec               localU;
     while (IGAPointNext(point)) {
       PetscScalar *R;
       ierr = IGAPointGetWorkVec(point,&R);CHKERRQ(ierr);
-      ierr = IFunction(point,dt,shift,t,V,U,R,ctx);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 shift,
-                                PetscReal t,Vec vecV,Vec vecU,
-                                Mat matJ,
-                                IGAUserIJacobian IJacobian,void *ctx)
+PetscErrorCode IGAFormIJacobian(IGA iga,PetscReal dt,
+                                PetscReal a,Vec vecV,
+                                PetscReal t,Vec vecU,
+                                Mat matJ,IGAUserIJacobian IJacobian,void *ctx)
 {
   Vec               localV;
   Vec               localU;
     while (IGAPointNext(point)) {
       PetscScalar *K;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
-      ierr = IJacobian(point,dt,shift,t,V,U,K,ctx);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__ "IGAFormIEFunction"
-PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,PetscReal shift,
-                                 PetscReal t,PetscReal t0,Vec vecV,Vec vecU,Vec vecU0,
-                                 Vec vecF,
-                                 IGAUserIEFunction IEFunction, void *ctx)
+PetscErrorCode IGAFormIEFunction(IGA iga,PetscReal dt,
+                                 PetscReal a,Vec vecV,
+                                 PetscReal t,Vec vecU,
+                                 PetscReal t0,Vec vecU0,
+                                 Vec vecF,IGAUserIEFunction IEFunction, void *ctx)
 {
   Vec               localV;
   Vec               localU;
     while (IGAPointNext(point)) {
       PetscScalar *R;
       ierr = IGAPointGetWorkVec(point,&R);CHKERRQ(ierr);
-      ierr = IEFunction(point,dt,shift,t,t0,V,U,U0,R,ctx);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__ "IGAFormIEJacobian"
-PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,PetscReal shift,
-                                 PetscReal t,PetscReal t0,Vec vecV,Vec vecU,Vec vecU0,
-                                 Mat matJ,
-                                 IGAUserIEJacobian IEJacobian,void *ctx)
+PetscErrorCode IGAFormIEJacobian(IGA iga,PetscReal dt,
+                                 PetscReal a,Vec vecV,
+                                 PetscReal t,Vec vecU,
+                                 PetscReal t0,Vec vecU0,
+                                 Mat matJ,IGAUserIEJacobian IEJacobian,void *ctx)
 {
   Vec               localV;
   Vec               localU;
     while (IGAPointNext(point)) {
       PetscScalar *K;
       ierr = IGAPointGetWorkMat(point,&K);CHKERRQ(ierr);
-      ierr = IEJacobian(point,dt,shift,t,t0,V,U,U0,K,ctx);CHKERRQ(ierr);
+      ierr = IEJacobian(point,dt,a,V,t,U,t0,U0,K,ctx);CHKERRQ(ierr);
       ierr = IGAPointAddMat(point,K,J);CHKERRQ(ierr);
     }
     /* */
 PetscErrorCode IGATSFormIFunction(TS ts,PetscReal t,Vec U,Vec V,Vec F,void *ctx)
 {
   IGA            iga = (IGA)ctx;
-  PetscReal      dt,shift=0;
+  PetscReal      dt,a=0;
   PetscErrorCode ierr;
   PetscFunctionBegin;
   PetscValidHeaderSpecific(ts,TS_CLASSID,1);
     Vec       U0;
     ierr = TSGetTime(ts,&t0);CHKERRQ(ierr);
     ierr = TSGetSolution(ts,&U0);CHKERRQ(ierr);
-    ierr = IGAFormIEFunction(iga,dt,shift,t,t0,V,U,U0,F,
+    ierr = IGAFormIEFunction(iga,dt,a,V,t,U,t0,U0,F,
                              iga->userops->IEFunction,
                              iga->userops->IEFunCtx);CHKERRQ(ierr);
   } else {
-    ierr = IGAFormIFunction(iga,dt,shift,t,V,U,F,
+    ierr = IGAFormIFunction(iga,dt,a,V,t,U,F,
                             iga->userops->IFunction,
                             iga->userops->IFunCtx);CHKERRQ(ierr);
   }
 PetscErrorCode IGATSFormIJacobian(TS ts,PetscReal t,Vec U,Vec V,PetscReal shift,Mat *J,Mat *P,MatStructure *m,void *ctx)
 {
   IGA            iga = (IGA)ctx;
-  PetscReal      dt;
+  PetscReal      dt,a=shift;
   PetscErrorCode ierr;
   PetscFunctionBegin;
   PetscValidHeaderSpecific(ts,TS_CLASSID,1);
     Vec       U0;
     ierr = TSGetTime(ts,&t0);CHKERRQ(ierr);
     ierr = TSGetSolution(ts,&U0);CHKERRQ(ierr);
-    ierr = IGAFormIEJacobian(iga,dt,shift,t,t0,V,U,U0,*P,
+    ierr = IGAFormIEJacobian(iga,dt,a,V,t,U,t0,U0,*P,
                              iga->userops->IEJacobian,
                              iga->userops->IEJacCtx);CHKERRQ(ierr);
   } else {
-    ierr = IGAFormIJacobian(iga,dt,shift,t,V,U,*P,
+    ierr = IGAFormIJacobian(iga,dt,a,V,t,U,*P,
                             iga->userops->IJacobian,
                             iga->userops->IJacCtx);CHKERRQ(ierr);
   }