[cig-commits] r8547 - seismo/2D/SPECFEM2D/trunk

walter at geodynamics.org walter at geodynamics.org
Fri Dec 7 15:55:25 PST 2007


Author: walter
Date: 2007-12-07 15:55:24 -0800 (Fri, 07 Dec 2007)
New Revision: 8547

Modified:
   seismo/2D/SPECFEM2D/trunk/meshfem2D.F90
Log:
dual graph for partitioning is no longer constructed if nproc==1.

Modified: seismo/2D/SPECFEM2D/trunk/meshfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/meshfem2D.F90	2007-07-03 16:35:27 UTC (rev 8546)
+++ seismo/2D/SPECFEM2D/trunk/meshfem2D.F90	2007-12-07 23:55:24 UTC (rev 8547)
@@ -892,22 +892,27 @@
         elmnts_bis(i*esize:i*esize+esize-1) = elmnts(i*ngnod:i*ngnod+esize-1)
      end do
         
+     if ( nproc > 1 ) then
      call mesh2dual_ncommonnodes(nelmnts, (nxread+1)*(nzread+1), elmnts_bis, xadj, adjncy, nnodes_elmnts, nodes_elmnts,1)
+     end if
      
   else
+     if ( nproc > 1 ) then
      call mesh2dual_ncommonnodes(nelmnts, nnodes, elmnts, xadj, adjncy, nnodes_elmnts, nodes_elmnts,1)
+     end if
      
   end if
      
-  nb_edges = xadj(nelmnts)
- 
-! giving weight to edges and vertices. Currently not used.
-  call read_weights(nelmnts, vwgt, nb_edges, adjwgt)
      
   if ( nproc == 1 ) then
       part(:) = 0
   else
 
+  nb_edges = xadj(nelmnts)
+ 
+! giving weight to edges and vertices. Currently not used.
+  call read_weights(nelmnts, vwgt, nb_edges, adjwgt)
+
 ! partitioning
      select case (partitionning_method)
      case(1)
@@ -951,8 +956,10 @@
   call Construct_glob2loc_elmnts(nelmnts, part, nproc, glob2loc_elmnts)
   
   if ( ngnod == 9 ) then
+     if ( nproc > 1 ) then
      deallocate(nnodes_elmnts)
      deallocate(nodes_elmnts)
+     end if 
      allocate(nnodes_elmnts(0:nnodes-1))
      allocate(nodes_elmnts(0:nsize*nnodes-1))
      nnodes_elmnts(:) = 0
@@ -962,8 +969,23 @@
         nnodes_elmnts(elmnts(i)) = nnodes_elmnts(elmnts(i)) + 1
         
      end do
+  else
+     if ( nproc < 2 ) then
+     allocate(nnodes_elmnts(0:nnodes-1))
+     allocate(nodes_elmnts(0:nsize*nnodes-1))
+     nnodes_elmnts(:) = 0
+     nodes_elmnts(:) = 0
+     do i = 0, ngnod*nelmnts-1
+        nodes_elmnts(elmnts(i)*nsize+nnodes_elmnts(elmnts(i))) = i/ngnod
+        nnodes_elmnts(elmnts(i)) = nnodes_elmnts(elmnts(i)) + 1
+        
+     end do
+
+     end if 
+
   end if
   
+  
 ! local number of each node for each partition
   call Construct_glob2loc_nodes(nelmnts, nnodes, nnodes_elmnts, nodes_elmnts, part, nproc, &
        glob2loc_nodes_nparts, glob2loc_nodes_parts, glob2loc_nodes)



More information about the cig-commits mailing list