Commits

Lisandro Dalcin committed eb75ba9

Get rid of the block local to global mapping in the IGA structure

Comments (0)

Files changed (6)

   DM        node_dm;
 
   AO          ao;
-  LGMap       lgmap,lgmapb;
+  LGMap       lgmap;
   PetscLayout map;
   VecScatter  g2l,l2g,l2l;
   PetscInt    nwork;
   /* node */
   ierr = AODestroy(&iga->ao);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmap);CHKERRQ(ierr);
-  ierr = ISLocalToGlobalMappingDestroy(&iga->lgmapb);CHKERRQ(ierr);
   ierr = PetscLayoutDestroy(&iga->map);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&iga->g2l);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&iga->l2g);CHKERRQ(ierr);
 
   ierr = AODestroy(&iga->ao);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&iga->lgmap);CHKERRQ(ierr);
-  ierr = ISLocalToGlobalMappingDestroy(&iga->lgmapb);CHKERRQ(ierr);
   ierr = PetscLayoutDestroy(&iga->map);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&iga->g2l);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&iga->l2g);CHKERRQ(ierr);
                          iga->dim,iga->dof,iga->node_sizes,
                          iga->node_lstart,iga->node_lwidth,
                          iga->node_gstart,iga->node_gwidth);CHKERRQ(ierr);
-    /* build the scalar and block application orderings */
+    /* build the application ordering */
     ierr = IGA_Grid_GetAO(grid,&iga->ao);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)iga->ao);CHKERRQ(ierr);
-    /* build the scalar and block local to global mappings */
+    /* build the local to global mapping */
     ierr = IGA_Grid_GetLGMap(grid,&iga->lgmap);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)iga->lgmap);CHKERRQ(ierr);
-    ierr = IGA_Grid_GetLGMapBlock(grid,&iga->lgmapb);CHKERRQ(ierr);
-    ierr = PetscObjectReference((PetscObject)iga->lgmapb);CHKERRQ(ierr);
     /* build the layout */
     ierr = IGA_Grid_GetLayout(grid,&iga->map);CHKERRQ(ierr);
     ierr = PetscLayoutReference(iga->map,&iga->map);CHKERRQ(ierr);
   ierr = ISLocalToGlobalMappingDestroy(&dm->ltogmap);CHKERRQ(ierr);
   dm->ltogmap = iga->lgmap;
 #if PETSC_VERSION_LT(3,5,0)
-  ierr = PetscObjectReference((PetscObject)iga->lgmapb);CHKERRQ(ierr);
-  ierr = ISLocalToGlobalMappingDestroy(&dm->ltogmapb);CHKERRQ(ierr);
-  dm->ltogmapb = iga->lgmapb;
+  if (iga->dof == 1) {
+    ierr = PetscObjectReference((PetscObject)iga->lgmap);CHKERRQ(ierr);
+    ierr = ISLocalToGlobalMappingDestroy(&dm->ltogmapb);CHKERRQ(ierr);
+    dm->ltogmapb = iga->lgmap;
+  } else {
+    ISLocalToGlobalMapping lgmapb;
+    ierr = PetscObjectQuery((PetscObject)iga->lgmap,"__IGA_lgmapb",(PetscObject*)&lgmapb);CHKERRQ(ierr);
+    PetscValidHeaderSpecific(lgmapb,IS_LTOGM_CLASSID,1);
+    ierr = PetscObjectReference((PetscObject)lgmapb);CHKERRQ(ierr);
+    ierr = ISLocalToGlobalMappingDestroy(&dm->ltogmapb);CHKERRQ(ierr);
+    dm->ltogmapb = lgmapb;
+  }
 #endif
   PetscFunctionReturn(0);
 }
   if (!g->lgmap) {
 #if PETSC_VERSION_LT(3,5,0)
     ierr = ISLocalToGlobalMappingUnBlock(g->lgmapb,g->dof,&g->lgmap);CHKERRQ(ierr);
+    if (g->lgmapb != g->lgmap)
+      {ierr = PetscObjectCompose((PetscObject)g->lgmap,"__IGA_lgmapb",(PetscObject)g->lgmapb);CHKERRQ(ierr);}
 #else
     ierr = PetscObjectReference((PetscObject)g->lgmapb);CHKERRQ(ierr);
     g->lgmap = g->lgmapb;
       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_SetAO(grid,iga->ao);CHKERRQ(ierr);
-      ierr = IGA_Grid_GetLGMapBlock(grid,&ltog);CHKERRQ(ierr);
+      ierr = IGA_Grid_GetLGMap(grid,&ltog);CHKERRQ(ierr);
       ierr = PetscObjectReference((PetscObject)ltog);CHKERRQ(ierr);
       ierr = IGA_Grid_Destroy(&grid);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_SetAO(grid,iga->ao);CHKERRQ(ierr);
-    ierr = IGA_Grid_GetLGMapBlock(grid,&bbb->lgmap);CHKERRQ(ierr);
+    ierr = IGA_Grid_GetLGMap(grid,&bbb->lgmap);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject)bbb->lgmap);CHKERRQ(ierr);
     ierr = IGA_Grid_Destroy(&grid);CHKERRQ(ierr);
   }