Commits

Nathan Collier  committed 473c041

added collocation computesystem support

  • Participants
  • Parent commits 886bcb7

Comments (0)

Files changed (3)

File demo/Laplace.c

   ierr = IGACreateMat(iga,&A);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&x);CHKERRQ(ierr);
   ierr = IGACreateVec(iga,&b);CHKERRQ(ierr);
-  if (iga->geometry){
-    ierr = IGASetUserSystem(iga,SystemPoisson,PETSC_NULL);CHKERRQ(ierr);
+  if (Collocation){
+    ierr = IGAColSetUserSystem(iga,SystemCollocation,PETSC_NULL);CHKERRQ(ierr); 
+    ierr = IGAColComputeSystem(iga,A,b);CHKERRQ(ierr);
   }else{
-    ierr = IGASetUserSystem(iga,SystemLaplace,PETSC_NULL);CHKERRQ(ierr);
+    if (iga->geometry){ 
+      ierr = IGASetUserSystem(iga,SystemPoisson,PETSC_NULL);CHKERRQ(ierr); 
+    }else{
+      ierr = IGASetUserSystem(iga,SystemLaplace,PETSC_NULL);CHKERRQ(ierr); 
+    }
+    ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
+    ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr);
   }
-  ierr = IGAComputeSystem(iga,A,b);CHKERRQ(ierr);
-  ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr);
 
   // Solve
 

File include/petiga.h

 PETSC_EXTERN PetscErrorCode IGASetUserIEFunction(IGA iga,IGAUserIEFunction IEFunction,void *FunCtx);
 PETSC_EXTERN PetscErrorCode IGASetUserIEJacobian(IGA iga,IGAUserIEJacobian IEJacobian,void *JacCtx);
 
+PETSC_EXTERN PetscErrorCode IGAColSetUserSystem (IGA iga,IGAColUserSystem System,void *SysCtx);
+
 /* ---------------------------------------------------------------- */
 
 struct _n_IGAElement {
 PETSC_EXTERN PetscErrorCode IGAColPointAssembleVec(IGAColPoint point,const PetscScalar F[],Vec vec);
 PETSC_EXTERN PetscErrorCode IGAColPointAssembleMat(IGAColPoint point,const PetscScalar K[],Mat mat);
 PETSC_EXTERN PetscErrorCode IGAColFormSystem(IGA iga,Mat matA,Vec vecB,IGAColUserSystem System,void *ctx);
+PETSC_EXTERN PetscErrorCode IGAColComputeSystem(IGA iga,Mat A,Vec B);
 
 /* ---------------------------------------------------------------- */
 

File src/petigacol.c

 }
 
 #undef  __FUNCT__
+#define __FUNCT__ "IGAColComputeSystem"
+PetscErrorCode IGAColComputeSystem(IGA iga,Mat matA,Vec vecB)
+{
+  IGAColUserSystem  System;
+  void           *SysCtx;
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidHeaderSpecific(matA,MAT_CLASSID,2);
+  PetscValidHeaderSpecific(vecB,VEC_CLASSID,3);
+  IGACheckSetUp(iga,1);
+  IGACheckUserOp(iga,1,ColSystem);
+  System = iga->userops->ColSystem;
+  SysCtx = iga->userops->ColSysCtx;
+  ierr = IGAColFormSystem(iga,matA,vecB,System,SysCtx);CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
 #define __FUNCT__ "IGAColFormSystem"
 PetscErrorCode IGAColFormSystem(IGA iga,Mat matA,Vec vecB,IGAColUserSystem System,void *ctx)
 {
 
   PetscFunctionReturn(0);
 }
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAColSetUserSystem"
+PetscErrorCode IGAColSetUserSystem(IGA iga,IGAColUserSystem System,void *SysCtx)
+{
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  if (System) iga->userops->ColSystem = System;
+  if (SysCtx) iga->userops->ColSysCtx = SysCtx;
+  PetscFunctionReturn(0);
+}