Commits

Lisandro Dalcin committed f801d4b

Remove the unblocked AO mapping

  • Participants
  • Parent commits 1fa97c8

Comments (0)

Files changed (6)

   PetscInt  node_gwidth[3];
   DM        node_dm;
 
-  AO          ao,aob;
+  AO          ao;
   LGMap       lgmap,lgmapb;
   PetscLayout map;
   VecScatter  g2l,l2g,l2l;
   ierr = DMDestroy(&iga->geom_dm);CHKERRQ(ierr);
   /* node */
   ierr = AODestroy(&iga->ao);CHKERRQ(ierr);
-  ierr = AODestroy(&iga->aob);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmap);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmapb);CHKERRQ(ierr);
   ierr = PetscLayoutDestroy(&iga->map);CHKERRQ(ierr);
   }
 
   ierr = AODestroy(&iga->ao);CHKERRQ(ierr);
-  ierr = AODestroy(&iga->aob);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmap);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmapb);CHKERRQ(ierr);
   ierr = PetscLayoutDestroy(&iga->map);CHKERRQ(ierr);
     /* build the scalar and block application orderings */
     ierr = IGA_Grid_GetAO(grid,&iga->ao);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)iga->ao);CHKERRQ(ierr);
-    ierr = IGA_Grid_GetAOBlock(grid,&iga->aob);CHKERRQ(ierr);
-    ierr = PetscObjectReference((PetscObject)iga->aob);CHKERRQ(ierr);
     /* build the scalar and block local to global mappings */
     ierr = IGA_Grid_GetLGMap(grid,&iga->lgmap);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)iga->lgmap);CHKERRQ(ierr);
     g->ghost_width[i] = 1;
   }
   ierr = AODestroy(&g->ao);CHKERRQ(ierr);
-  ierr = AODestroy(&g->aob);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&g->lgmap);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&g->lgmapb);CHKERRQ(ierr);
   ierr = VecDestroy(&g->lvec);CHKERRQ(ierr);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGA_Grid_SetAOBlock"
-PetscErrorCode IGA_Grid_SetAOBlock(IGA_Grid g,AO aob)
+#define __FUNCT__ "IGA_Grid_SetAO"
+PetscErrorCode IGA_Grid_SetAO(IGA_Grid g,AO ao)
 {
   PetscErrorCode ierr;
   PetscFunctionBegin;
   PetscValidPointer(g,1);
-  PetscValidHeaderSpecific(aob,AO_CLASSID,2);
-  ierr = PetscObjectReference((PetscObject)aob);CHKERRQ(ierr);
-  ierr = AODestroy(&g->aob);CHKERRQ(ierr);
-  g->aob = aob;
-  if (g->dof == 1 && !g->ao) {
-    ierr = PetscObjectReference((PetscObject)g->aob);CHKERRQ(ierr);
-    g->ao = g->aob;
-  }
-  PetscFunctionReturn(0);
-}
-
-#undef  __FUNCT__
-#define __FUNCT__ "IGA_Grid_GetAOBlock"
-PetscErrorCode IGA_Grid_GetAOBlock(IGA_Grid g,AO *aob)
-{
-  PetscErrorCode ierr;
-  PetscFunctionBegin;
-  PetscValidPointer(g,1);
-  PetscValidPointer(aob,2);
-  if (!g->aob) {
-    PetscInt napp,*iapp;
-    ierr = IGA_Grid_LocalIndices(g,1,&napp,&iapp);CHKERRQ(ierr);
-    ierr = AOCreateMemoryScalable(g->comm,napp,iapp,NULL,&g->aob);CHKERRQ(ierr);
-    ierr = PetscFree(iapp);CHKERRQ(ierr);
-  }
-  *aob = g->aob;
-  if (g->dof == 1 && !g->ao) {
-    ierr = PetscObjectReference((PetscObject)g->aob);CHKERRQ(ierr);
-    g->ao = g->aob;
-  }
+  PetscValidHeaderSpecific(ao,AO_CLASSID,2);
+  ierr = PetscObjectReference((PetscObject)ao);CHKERRQ(ierr);
+  ierr = AODestroy(&g->ao);CHKERRQ(ierr);
+  g->ao = ao;
   PetscFunctionReturn(0);
 }
 
   PetscValidPointer(ao,2);
   if (!g->ao) {
     PetscInt napp,*iapp;
-    ierr = IGA_Grid_LocalIndices(g,g->dof,&napp,&iapp);CHKERRQ(ierr);
+    ierr = IGA_Grid_LocalIndices(g,1,&napp,&iapp);CHKERRQ(ierr);
     ierr = AOCreateMemoryScalable(g->comm,napp,iapp,NULL,&g->ao);CHKERRQ(ierr);
     ierr = PetscFree(iapp);CHKERRQ(ierr);
   }
   *ao = g->ao;
-  if (g->dof == 1 && !g->aob) {
-    ierr = PetscObjectReference((PetscObject)g->ao);CHKERRQ(ierr);
-    g->aob = g->ao;
-  }
   PetscFunctionReturn(0);
 }
 
   PetscValidPointer(g,1);
   PetscValidPointer(lgmapb,2);
   if (!g->lgmapb) {
-    AO aob;
     PetscInt nghost,*ighost;
     ierr = IGA_Grid_GhostIndices(g,1,&nghost,&ighost);CHKERRQ(ierr);
-    ierr = IGA_Grid_GetAOBlock(g,&aob);CHKERRQ(ierr);
-    ierr = AOApplicationToPetsc(aob,nghost,ighost);CHKERRQ(ierr);
+    ierr = IGA_Grid_GetAO(g,&g->ao);CHKERRQ(ierr);
+    ierr = AOApplicationToPetsc(g->ao,nghost,ighost);CHKERRQ(ierr);
 #if PETSC_VERSION_LT(3,5,0)
     ierr = ISLocalToGlobalMappingCreate(g->comm,nghost,ighost,PETSC_OWN_POINTER,&g->lgmapb);CHKERRQ(ierr);
 #else
     ierr = ISLocalToGlobalMappingCreate(g->comm,g->dof,nghost,ighost,PETSC_OWN_POINTER,&g->lgmapb);CHKERRQ(ierr);
+    ierr = PetscObjectReference((PetscObject)g->lgmapb);CHKERRQ(ierr);
+    g->lgmap = g->lgmapb;
 #endif
   }
   *lgmapb = g->lgmapb;
   PetscInt    local_width[3];
   PetscInt    ghost_start[3];
   PetscInt    ghost_width[3];
-  AO          ao,aob;
+  AO          ao;
   LGMap       lgmap,lgmapb;
   PetscLayout map;
   Vec         lvec,gvec,nvec;
 PETSC_EXTERN PetscErrorCode IGA_Grid_Destroy(IGA_Grid*);
 PETSC_EXTERN PetscErrorCode IGA_Grid_LocalIndices(IGA_Grid,PetscInt,PetscInt*,PetscInt*[]);
 PETSC_EXTERN PetscErrorCode IGA_Grid_GhostIndices(IGA_Grid,PetscInt,PetscInt*,PetscInt*[]);
-PETSC_EXTERN PetscErrorCode IGA_Grid_SetAOBlock(IGA_Grid,AO);
-PETSC_EXTERN PetscErrorCode IGA_Grid_GetAOBlock(IGA_Grid,AO*);
+PETSC_EXTERN PetscErrorCode IGA_Grid_SetAO(IGA_Grid,AO);
 PETSC_EXTERN PetscErrorCode IGA_Grid_GetAO(IGA_Grid,AO*);
 PETSC_EXTERN PetscErrorCode IGA_Grid_SetLGMapBlock(IGA_Grid,LGMap);
 PETSC_EXTERN PetscErrorCode IGA_Grid_GetLGMapBlock(IGA_Grid,LGMap*);
   ierr = IGAGetDof(iga,&bs);CHKERRQ(ierr);
   ierr = MatGetOwnershipRange(A,&rstart,&rend);CHKERRQ(ierr);
   ierr = ISCreateStride(comm,(rend-rstart)/bs,rstart/bs,1,&is);CHKERRQ(ierr);
-  ierr = AOApplicationToPetscIS(iga->aob,is);CHKERRQ(ierr);
+  ierr = AOApplicationToPetscIS(iga->ao,is);CHKERRQ(ierr);
   if (bs > 1) {
     IS isb;
     PetscInt n;
   ierr = IGAGetDof(iga,&bs);CHKERRQ(ierr);
   ierr = MatGetOwnershipRange(A,&rstart,&rend);CHKERRQ(ierr);
   ierr = ISCreateStride(comm,(rend-rstart)/bs,rstart/bs,1,&is);CHKERRQ(ierr);
-  ierr = AOPetscToApplicationIS(iga->aob,is);CHKERRQ(ierr);
+  ierr = AOPetscToApplicationIS(iga->ao,is);CHKERRQ(ierr);
   if (bs > 1) {
     IS isb;
     PetscInt n;
       PetscInt *sizes = iga->node_sizes;
       ierr = IGA_Grid_Create(comm,&grid);CHKERRQ(ierr);
       ierr = IGA_Grid_Init(grid,iga->dim,1,sizes,lstart,lwidth,gstart,gwidth);CHKERRQ(ierr);
-      ierr = IGA_Grid_SetAOBlock(grid,iga->aob);CHKERRQ(ierr);
+      ierr = IGA_Grid_SetAO(grid,iga->ao);CHKERRQ(ierr);
       ierr = IGA_Grid_GetLGMapBlock(grid,&ltog);CHKERRQ(ierr);
       ierr = PetscObjectReference((PetscObject)ltog);CHKERRQ(ierr);
       ierr = IGA_Grid_Destroy(&grid);CHKERRQ(ierr);
     ierr = IGAGetComm(iga,&comm);CHKERRQ(ierr);
     ierr = IGA_Grid_Create(comm,&grid);CHKERRQ(ierr);
     ierr = IGA_Grid_Init(grid,iga->dim,1,sizes,lstart,lwidth,gstart,gwidth);CHKERRQ(ierr);
-    ierr = IGA_Grid_SetAOBlock(grid,iga->aob);CHKERRQ(ierr);
+    ierr = IGA_Grid_SetAO(grid,iga->ao);CHKERRQ(ierr);
     ierr = IGA_Grid_GetLGMapBlock(grid,&bbb->lgmap);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)bbb->lgmap);CHKERRQ(ierr);
     ierr = IGA_Grid_Destroy(&grid);CHKERRQ(ierr);