[cig-commits] [commit] devel: Remove unnecessary allocated array. (ff0d5a3)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu May 1 00:51:00 PDT 2014


Repository : ssh://geoshell/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/cb32c88d6155d7974561a6f72fc17aea596e2c4d...50aa953c1db3f565d76415f5305410a529996b75

>---------------------------------------------------------------

commit ff0d5a3cb828a7fbede828fb8d130e15a2148062
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Mon Apr 28 21:17:04 2014 -0400

    Remove unnecessary allocated array.
    
    These values are only used within the loop, so there's no need for an
    array here.


>---------------------------------------------------------------

ff0d5a3cb828a7fbede828fb8d130e15a2148062
 src/generate_databases/get_MPI.f90 | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/generate_databases/get_MPI.f90 b/src/generate_databases/get_MPI.f90
index 8dfffdc..a516a69 100644
--- a/src/generate_databases/get_MPI.f90
+++ b/src/generate_databases/get_MPI.f90
@@ -65,7 +65,7 @@
   double precision, dimension(:), allocatable :: xp,yp,zp
 
   integer, dimension(:), allocatable :: locval
-  integer, dimension(:), allocatable :: nibool_interfaces_ext_mesh_true
+  integer :: nibool_interfaces_ext_mesh_true
 
   ! for MPI buffers
   integer, dimension(:), allocatable :: reorder_interface_ext_mesh, &
@@ -92,9 +92,6 @@
                             ibool_interfaces_ext_mesh, &
                             nibool_interfaces_ext_mesh,NGNOD )
 
-  allocate(nibool_interfaces_ext_mesh_true(num_interfaces_ext_mesh),stat=ier)
-  if( ier /= 0 ) stop 'error allocating array nibool_interfaces_ext_mesh_true'
-
   ! sorts ibool comm buffers lexicographically for all MPI interfaces
   num_points1 = 0
   num_points2 = 0
@@ -123,16 +120,16 @@
     enddo
 
     ! sorts (lexicographically?) ibool_interfaces_ext_mesh and updates value
-    ! of total number of points nibool_interfaces_ext_mesh_true(iinterface)
+    ! of total number of points nibool_interfaces_ext_mesh_true
     call sort_array_coordinates(nibool_interfaces_ext_mesh(iinterface),xp,yp,zp, &
          ibool_interfaces_ext_mesh(1:nibool_interfaces_ext_mesh(iinterface),iinterface), &
          reorder_interface_ext_mesh,locval,ifseg, &
-         nibool_interfaces_ext_mesh_true(iinterface), &
+         nibool_interfaces_ext_mesh_true, &
          ninseg_ext_mesh,SMALLVAL_TOL)
 
     ! checks that number of MPI points are still the same
     num_points1 = num_points1 + nibool_interfaces_ext_mesh(iinterface)
-    num_points2 = num_points2 + nibool_interfaces_ext_mesh_true(iinterface)
+    num_points2 = num_points2 + nibool_interfaces_ext_mesh_true
     if( num_points1 /= num_points2 ) then
       write(*,*) 'error sorting MPI interface points:',myrank
       write(*,*) '   interface:',iinterface,num_points1,num_points2
@@ -150,9 +147,6 @@
 
   enddo
 
-  ! cleanup
-  deallocate(nibool_interfaces_ext_mesh_true)
-
   ! outputs total number of MPI interface points
   call sum_all_i(num_points2,ilocnum)
   if( myrank == 0 ) then



More information about the CIG-COMMITS mailing list