Commits

Rio Yokota committed 986e716

Update to run with petsc-3.4

Comments (0)

Files changed (5)

   PetscErrorCode  ierr;
   ierr = PetscInitialize(&argc,&argv,0,0);CHKERRQ(ierr);
 
-  ierr = PCRegisterDynamic(PCFMM,"./","PCCreate_FMM",PCCreate_FMM);CHKERRQ(ierr);
+  ierr = PCRegister(PCFMM,PCCreate_FMM);CHKERRQ(ierr);
 
   PetscInt N[2] = {16,16}, nN = 2; 
   PetscInt p[2] = { 1, 1}, np = 2;
 #include <petsc-private/pcimpl.h>
 #endif
 
-#define DENSE 1
+#define DENSE 0
 
 #undef  __FUNCT__
 #define __FUNCT__ "PCFMMSetIGA"
   ierr = VecGetArray(y,&yl);CHKERRQ(ierr);
   nbodyG(nb,xm,ym,yl,nb,xm,ym,xl,1e-2);
   for (i=0; i<nb; i++) {
-    yl[i] += (1 - log(re[i] / 2) + log(1e-2)) * xl[i];
+    yl[i] += (1 - log(re[i] / 2)) * xl[i];
   }
   ierr = VecRestoreArray(x,&xl);CHKERRQ(ierr);
   ierr = VecRestoreArray(y,&yl);CHKERRQ(ierr);
 
   PetscInt i, j, ic = 0;
   PetscReal eps = .2 / (1 << int( log2(sqrt(ni+nb) - 1) ));
-  for (i=info.xs+1; i<info.xs+info.xm-1; i++) { // Loop over interior points
-    for (j=info.ys+1; j<info.ys+info.ym-1;j++, ic++) {
-      xi[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
-      yi[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
-      ri[ic] = X[j][i] / 2 / M_PI;
+  for (i=info.xs; i<info.xs+info.xm; i++) { // Loop over interior points
+    for (j=info.ys; j<info.ys+info.ym; j++) {
+      if (i != 0 && i != info.mx-1 && j != 0 && j != info.my-1) {
+        xi[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
+        yi[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
+        ri[ic] = X[j][i] / 2 / M_PI;
+        ic++;
+      }
     }
   }
   assert( ni == ic );
-  
+
   ic = 0;
   j = 0;
   for (i=info.xs; i<info.xs+info.xm-1; i++,ic++) { // Bottom points
     xb[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
     yb[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
-    ub[ic] = 0; //u[j][i];
+    ub[ic] = 0; // u[j][i];
   }
   i = info.xs+info.xm-1;
   for (j=info.ys; j<info.ys+info.ym-1; j++,ic++) { // Right points
     xb[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
     yb[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
-    ub[ic] = 0; //u[j][i];
+    ub[ic] = 0; // u[j][i];
   }
   j = info.ys+info.ym-1;
   for (i=info.xs+info.xm-1; i>info.xs; i--,ic++) { // Top points
     xb[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
     yb[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
-    ub[ic] = 0; //u[j][i];
+    ub[ic] = 0; // u[j][i];
   }
   i = 0;
   for (j=info.ys+info.ym-1; j>info.ys; j--,ic++) { // Left points
     xb[ic] = (PetscReal)i / ( (PetscReal)(info.mx-1) );
     yb[ic] = (PetscReal)j / ( (PetscReal)(info.my-1) );
-    ub[ic] = 0; //u[j][i];
+    ub[ic] = 0; // u[j][i];
   }
   assert( nb == ic );
 
 	${CLINKER} $^ -o $@ ${PETIGA_LIB}
 	${RM} -f $<
 	./Poisson2D -ksp_monitor -ksp_norm_type UNPRECONDITIONED -draw_pause 1
+
 clean::
 	-@${RM} ${TARGETS}
 
   PetscErrorCode ierr;
   PetscFunctionBegin;
   IGARegisterAllCalled = PETSC_TRUE;
-  ierr = PCRegisterAll(path);CHKERRQ(ierr);
-  ierr = PCRegisterDynamic(PCEBE,path,"PCCreate_EBE",PCCreate_EBE);CHKERRQ(ierr);
-  ierr = PCRegisterDynamic(PCBBB,path,"PCCreate_BBB",PCCreate_BBB);CHKERRQ(ierr);
-  ierr = TSRegisterAll(path);CHKERRQ(ierr);
-  ierr = TSRegisterDynamic(TSALPHA2,path,"TSCreate_Alpha2",TSCreate_Alpha2);CHKERRQ(ierr);
+  ierr = PCRegisterAll();CHKERRQ(ierr);
+  ierr = PCRegister("PCCreate_EBE",PCCreate_EBE);CHKERRQ(ierr);
+  ierr = PCRegister("PCCreate_BBB",PCCreate_BBB);CHKERRQ(ierr);
+  ierr = TSRegisterAll();CHKERRQ(ierr);
+  ierr = TSRegister("TSCreate_Alpha2",TSCreate_Alpha2);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
   PetscFunctionBegin;
   ierr = TSReset_Alpha2(ts);CHKERRQ(ierr);
   ierr = PetscFree(ts->data);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetIFunction2_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetIJacobian2_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSComputeIFunction2_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSComputeIJacobian2_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetSolution2_C",   "",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSGetSolution2_C",   "",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSolve2_C",         "",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetIFunction2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetIJacobian2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSComputeIFunction2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSComputeIJacobian2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetSolution2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSGetSolution2_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSolve2_C",PETSC_NULL);CHKERRQ(ierr);
 
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2SetRadius_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2SetParams_C","",PETSC_NULL);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2GetParams_C","",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2SetRadius_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2SetParams_C",PETSC_NULL);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2GetParams_C",PETSC_NULL);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
   ts->ops->view           = TSView_Alpha2;
   ts->ops->setfromoptions = TSSetFromOptions_Alpha2;
 
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetIFunction2_C","TSSetIFunction2_Alpha2",TSSetIFunction2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetIJacobian2_C","TSSetIJacobian2_Alpha2",TSSetIJacobian2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSComputeIFunction2_C","TSComputeIFunction2_Alpha2",TSComputeIFunction2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSComputeIJacobian2_C","TSComputeIJacobian2_Alpha2",TSComputeIJacobian2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSetSolution2_C","TSSetSolution2_Alpha2",TSSetSolution2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSGetSolution2_C","TSGetSolution2_Alpha2",TSGetSolution2_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSSolve2_C","TSSolve2_Alpha2",TSSolve2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetIFunction2_C",TSSetIFunction2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetIJacobian2_C",TSSetIJacobian2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSComputeIFunction2_C",TSComputeIFunction2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSComputeIJacobian2_C",TSComputeIJacobian2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSetSolution2_C",TSSetSolution2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSGetSolution2_C",TSGetSolution2_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSSolve2_C",TSSolve2_Alpha2);CHKERRQ(ierr);
 
   ierr = PetscNewLog(ts,TS_Alpha2,&th);CHKERRQ(ierr);
   ts->data = (void*)th;
   th->Beta    = 0.25;
   th->StageTime = TSUpdateStageTime_Alpha2;
   th->StageVecs = TSUpdateStageVecs_Alpha2;
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2SetRadius_C","TSAlpha2SetRadius_Alpha2",TSAlpha2SetRadius_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2SetParams_C","TSAlpha2SetParams_Alpha2",TSAlpha2SetParams_Alpha2);CHKERRQ(ierr);
-  ierr = PetscObjectComposeFunctionDynamic((PetscObject)ts,"TSAlpha2GetParams_C","TSAlpha2GetParams_Alpha2",TSAlpha2GetParams_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2SetRadius_C",TSAlpha2SetRadius_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2SetParams_C",TSAlpha2SetParams_Alpha2);CHKERRQ(ierr);
+  ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2GetParams_C",TSAlpha2GetParams_Alpha2);CHKERRQ(ierr);
 
-  if (ts->exact_final_time == PETSC_DECIDE) ts->exact_final_time = PETSC_FALSE;
+  if (ts->exact_final_time == PETSC_DECIDE) ts->exact_final_time = TS_EXACTFINALTIME_STEPOVER;
 
   PetscFunctionReturn(0);
 }