1. Rio Yokota
  2. PetIGA-FMM

Commits

Rio Yokota  committed ba44a18

Changed fmm->x to fmm->u, fmm->b -> fmm->f

  • Participants
  • Parent commits fc1ea34
  • Branches default

Comments (0)

Files changed (3)

File fmm/fmm.c

View file
   ierr = PetscMalloc3(fmm->nb,PetscReal,&(fmm->rhs),
                       fmm->nb,PetscReal,&(fmm->un),
                       fmm->ni,PetscReal,&(fmm->ui));CHKERRQ(ierr);
-  ierr = VecCreateMPI(PETSC_COMM_WORLD,fmm->nb,PETSC_DETERMINE,&(fmm->x));CHKERRQ(ierr);
-  ierr = VecDuplicate(fmm->x,&(fmm->b));CHKERRQ(ierr);
+  ierr = VecCreateMPI(PETSC_COMM_WORLD,fmm->nb,PETSC_DETERMINE,&(fmm->u));CHKERRQ(ierr);
+  ierr = VecDuplicate(fmm->u,&(fmm->f));CHKERRQ(ierr);
   ierr = MatCreateDense(PETSC_COMM_WORLD,fmm->nb,fmm->nb,PETSC_DECIDE,PETSC_DECIDE,PETSC_NULL,&(fmm->G));CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
   DMDALocalInfo info;
   ierr = DMDAGetLocalInfo(da,&info);CHKERRQ(ierr);
 
-  Vec xx = fmm->x;
-  Vec bb = fmm->b;
+  Vec u = fmm->u;
+  Vec f = fmm->f;
   Mat G = fmm->G;
   PetscInt ni = fmm->ni;
   PetscInt nb = fmm->nb;
   nbodyGn(nb,xm,ym,rhs,nb,xm,ym,um,dxe,dye,re,eps);
 
   for (i=0; i<nb; i++) {
-    VecSetValue(bb,i,rhs[i],INSERT_VALUES);
+    VecSetValue(f,i,rhs[i],INSERT_VALUES);
     for (j=0; j<i; j++) {
       PetscReal dx = xm[i] - xm[j];
       PetscReal dy = ym[i] - ym[j];
     PetscReal value = 1-log(re[i]/2);
     MatSetValue(G,i,i,value,INSERT_VALUES);
   }
-  ierr = VecAssemblyBegin(bb);CHKERRQ(ierr);
-  ierr = VecAssemblyEnd(bb);CHKERRQ(ierr);
+  ierr = VecAssemblyBegin(f);CHKERRQ(ierr);
+  ierr = VecAssemblyEnd(f);CHKERRQ(ierr);
   ierr = MatAssemblyBegin(G,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
   ierr = MatAssemblyEnd(G,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
 
   KSP ksp;
   ierr = KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
   ierr = KSPSetOperators(ksp,G,G,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
-  ierr = KSPSolve(ksp,bb,xx);CHKERRQ(ierr);
-  ierr = VecGetArray(xx,&un);
+  ierr = KSPSolve(ksp,f,u);CHKERRQ(ierr);
+  ierr = VecGetArray(u,&un);
 
   for (i=0; i<nb; i++) {
     un[i] = -un[i];
   PetscErrorCode ierr;
   PetscFunctionBegin;
   ierr = DMDestroy(&(fmm->da));CHKERRQ(ierr);
-  ierr = VecDestroy(&(fmm->x));CHKERRQ(ierr);
-  ierr = VecDestroy(&(fmm->b));CHKERRQ(ierr);
+  ierr = VecDestroy(&(fmm->u));CHKERRQ(ierr);
+  ierr = VecDestroy(&(fmm->f));CHKERRQ(ierr);
   ierr = MatDestroy(&(fmm->G));CHKERRQ(ierr);
   ierr = PetscFree(fmm->ip1);CHKERRQ(ierr);
   ierr = PetscFree3(fmm->xi,fmm->yi,fmm->ri);CHKERRQ(ierr);

File fmm/fmm.h

View file
 typedef struct {
   DM  da;
   IGA iga;
-  Vec x,b;
+  Vec u,f;
   Mat G;
   PetscInt ni,nb,*ip1;
   PetscReal *xi,*yi,*ri,*xb,*yb,*ub,*xm,*ym,*um,*dxe,*dye,*re,*rhs,*un,*ui;

File fmm/makefile

View file
 Poisson2D: Poisson2D.o fmm.o chkopts
 	${CLINKER} -o $@ $< ${PETIGA_LIB} fmm.o
 	${RM} -f $<
-	./Poisson2D -ksp_monitor -draw_pause -1
+	./Poisson2D -ksp_monitor -draw_pause 1
 clean::
 	-@${RM} ${TARGETS}