<p><b>duda</b> 2013-04-15 18:03:21 -0600 (Mon, 15 Apr 2013)</p><p>BRANCH COMMIT<br>
<br>
Remove Zoltan-related code from the framework.<br>
<br>
<br>
M    src/framework/mpas_io_input.F<br>
D    src/framework/mpas_zoltan_interface.F<br>
M    src/framework/Makefile<br>
M    src/Makefile.in.CESM_OCN<br>
M    Makefile<br>
</p><hr noshade><pre><font color="gray">Modified: branches/zoltan_cleaning/Makefile
===================================================================
--- branches/zoltan_cleaning/Makefile        2013-04-15 20:36:04 UTC (rev 2753)
+++ branches/zoltan_cleaning/Makefile        2013-04-16 00:03:21 UTC (rev 2754)
@@ -4,15 +4,7 @@
 # This flag must be off for nersc hopper:
 FILE_OFFSET = -DOFFSET64BIT
 
-#########################
-# Section for Zoltan TPL
-#########################
-ifdef ZOLTAN_HOME
-   ZOLTAN_DEFINE = -DHAVE_ZOLTAN
-endif
-#########################
 
-
 dummy:
         ( $(MAKE) error )
 
@@ -32,7 +24,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) $(FILE_OFFSET)&quot; )
  
 ftn:
         ( $(MAKE) all \
@@ -47,7 +39,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 pgi:
         ( $(MAKE) all \
@@ -65,7 +57,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 pgi-nersc:
         ( $(MAKE) all \
@@ -80,7 +72,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 pgi-llnl:
         ( $(MAKE) all \
@@ -95,7 +87,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 ifort:
         ( $(MAKE) all \
@@ -113,7 +105,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE -m64 $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE -m64 $(FILE_OFFSET)&quot; )
 
 gfortran:
         ( $(MAKE) all \
@@ -131,7 +123,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE -m64 $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE -m64 $(FILE_OFFSET)&quot; )
 
 g95:
         ( $(MAKE) all \
@@ -146,7 +138,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 pathscale-nersc:
         ( $(MAKE) all \
@@ -161,7 +153,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 cray-nersc:
         ( $(MAKE) all \
@@ -176,7 +168,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 intel-nersc:
         ( $(MAKE) all \
@@ -191,7 +183,7 @@
         &quot;DEBUG = $(DEBUG)&quot; \
         &quot;SERIAL = $(SERIAL)&quot; \
         &quot;USE_PAPI = $(USE_PAPI)&quot; \
-        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
+        &quot;CPPFLAGS = $(MODEL_FORMULATION) -DUNDERSCORE $(FILE_OFFSET)&quot; )
 
 CPPINCLUDES = 
 FCINCLUDES = 
@@ -217,25 +209,7 @@
 CPP = cpp -C -P -traditional
 RANLIB = ranlib
 
-#########################
-# Section for Zoltan TPL
-#########################
-ifdef ZOLTAN_HOME
-   ifdef ZOLTAN_INC_PATH
-      FCINCLUDES += -I$(ZOLTAN_INC_PATH)
-   else
-      FCINCLUDES += -I$(ZOLTAN_HOME)/include
-   endif
 
-   ifdef ZOLTAN_LIB_PATH
-      LIBS += -L$(ZOLTAN_LIB_PATH) -lzoltan
-   else
-      LIBS += -L$(ZOLTAN_HOME)/lib -lzoltan
-   endif
-endif
-#########################
-
-
 ifdef CORE
 
 ifeq &quot;$(DEBUG)&quot; &quot;true&quot;

Modified: branches/zoltan_cleaning/src/Makefile.in.CESM_OCN
===================================================================
--- branches/zoltan_cleaning/src/Makefile.in.CESM_OCN        2013-04-15 20:36:04 UTC (rev 2753)
+++ branches/zoltan_cleaning/src/Makefile.in.CESM_OCN        2013-04-16 00:03:21 UTC (rev 2754)
@@ -7,7 +7,7 @@
 PNETCDF=$(PNETCDF_PATH)
 PIO=$(EXEROOT)/pio
 FILE_OFFSET = -DOFFSET64BIT
-CPPFLAGS += $(MODEL_FORMULATION) $(FILE_OFFSET) $(ZOLTAN_DEFINE) -DMPAS_CESM -D_MPI# -DUNDERSCORE
+CPPFLAGS += $(MODEL_FORMULATION) $(FILE_OFFSET) -DMPAS_CESM -D_MPI# -DUNDERSCORE
 CPPINCLUDES += -I$(EXEROOT)/ocn/source/inc -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
 FCINCLUDES += -I$(EXEROOT)/ocn/source/inc -I$(EXEROOT)/csm_share -I$(EXEROOT)/gptl -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
 LIBS += -L$(PIO) -L$(PNETCDF)/lib -L$(NETCDF)/lib -lpio -lpnetcdf -lnetcdf

Modified: branches/zoltan_cleaning/src/framework/Makefile
===================================================================
--- branches/zoltan_cleaning/src/framework/Makefile        2013-04-15 20:36:04 UTC (rev 2753)
+++ branches/zoltan_cleaning/src/framework/Makefile        2013-04-16 00:03:21 UTC (rev 2754)
@@ -1,9 +1,5 @@
 .SUFFIXES: .F .o
 
-ifdef ZOLTAN_HOME
-   ZOLTANOBJ = mpas_zoltan_interface.o
-endif
-
 OBJS = mpas_kind_types.o \
        mpas_framework.o \
        mpas_timer.o \
@@ -22,7 +18,6 @@
        mpas_io_streams.o \
        mpas_io_input.o \
        mpas_io_output.o \
-       $(ZOLTANOBJ) \
        streams.o
 
 all: framework
@@ -58,7 +53,7 @@
 
 mpas_io_streams.o: mpas_attlist.o mpas_grid_types.o mpas_timekeeping.o mpas_io.o
 
-mpas_io_input.o: mpas_grid_types.o mpas_dmpar.o mpas_block_decomp.o mpas_block_creator.o mpas_sort.o mpas_configure.o mpas_timekeeping.o mpas_io_streams.o $(ZOLTANOBJ)
+mpas_io_input.o: mpas_grid_types.o mpas_dmpar.o mpas_block_decomp.o mpas_block_creator.o mpas_sort.o mpas_configure.o mpas_timekeeping.o mpas_io_streams.o
 
 mpas_io_output.o: mpas_grid_types.o mpas_dmpar.o mpas_sort.o mpas_configure.o mpas_io_streams.o
 

Modified: branches/zoltan_cleaning/src/framework/mpas_io_input.F
===================================================================
--- branches/zoltan_cleaning/src/framework/mpas_io_input.F        2013-04-15 20:36:04 UTC (rev 2753)
+++ branches/zoltan_cleaning/src/framework/mpas_io_input.F        2013-04-16 00:03:21 UTC (rev 2754)
@@ -10,10 +10,6 @@
    use mpas_io_streams
 
 
-#ifdef HAVE_ZOLTAN
-   use mpas_zoltan_interface
-#endif
-
    integer, parameter :: STREAM_INPUT=1, STREAM_SFC=2, STREAM_RESTART=3
 
    type io_input_object
@@ -355,161 +351,12 @@
       call mpas_deallocate_field(nVerticesSolveField)
       call mpas_deallocate_field(nEdgesSolveField)
 
-#ifdef HAVE_ZOLTAN      
-      call mpas_deallocate_field(xCellField)
-      call mpas_deallocate_field(yCellField)
-      call mpas_deallocate_field(zCellField)
-      call mpas_deallocate_field(xVertexField)
-      call mpas_deallocate_field(yVertexField)
-      call mpas_deallocate_field(zVertexField)
-      call mpas_deallocate_field(xEdgeField)
-      call mpas_deallocate_field(yEdgeField)
-      call mpas_deallocate_field(zEdgeField)
-
-      call mpas_deallocate_field(xCell)
-      call mpas_deallocate_field(yCell)
-      call mpas_deallocate_field(zCell)
-      call mpas_deallocate_field(xVertex)
-      call mpas_deallocate_field(yVertex)
-      call mpas_deallocate_field(zVertex)
-      call mpas_deallocate_field(xEdge)
-      call mpas_deallocate_field(yEdge)
-      call mpas_deallocate_field(zEdge)
-#endif
-
       deallocate(local_cell_list)
       deallocate(block_id)
       deallocate(block_start)
       deallocate(block_count)
       deallocate(readingBlock)
 
-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI 
-!     allocate(xCell(size(local_cell_list)))
-!     allocate(yCell(size(local_cell_list)))
-!     allocate(zCell(size(local_cell_list)))
-!     call mpas_dmpar_alltoall_field(domain % dminfo, xCellField % array, xCell, &amp;
-!                               size(xCellField % array), size(local_cell_list), &amp;
-!                               sendCellList, recvCellList)
-!   
-!     call mpas_dmpar_alltoall_field(domain % dminfo, yCellField % array, yCell, &amp;
-!                               size(yCellField % array), size(local_cell_list), &amp;
-!                               sendCellList, recvCellList)
-!   
-!     call mpas_dmpar_alltoall_field(domain % dminfo, zCellField % array, zCell, &amp;
-!                               size(zCellField % array), size(local_cell_list), &amp;
-!                               sendCellList, recvCellList)
-!#endif
-!#endif

-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI 
-!      !! For now, only use Zoltan with MPI
-!      !! Zoltan initialization
-!      call mpas_zoltan_start()
-!
-!      !! Zoltan hook for cells
-!      call mpas_zoltan_order_loc_hsfc_cells(block_graph_2Halo%nVertices,block_graph_2Halo%VertexID,3,xCell,yCell,zCell)
-!#endif
-!#endif
-!
-!   
-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI 
-!      allocate(xEdge(nlocal_edges))
-!      allocate(yEdge(nlocal_edges))
-!      allocate(zEdge(nlocal_edges))
-!      allocate(xVertex(nlocal_vertices))
-!      allocate(yVertex(nlocal_vertices))
-!      allocate(zVertex(nlocal_vertices))
-!#endif
-!#endif
-!    
-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI 
-!      call mpas_dmpar_alltoall_field(domain % dminfo, xEdgeField % array, xEdge, &amp;
-!                                size(xEdgeField % array), nlocal_edges, &amp;
-!                                sendEdgeList, recvEdgeList)
-!      call mpas_dmpar_alltoall_field(domain % dminfo, yEdgeField % array, yEdge, &amp;
-!                                size(yEdgeField % array), nlocal_edges, &amp;
-!                                sendEdgeList, recvEdgeList)
-!      call mpas_dmpar_alltoall_field(domain % dminfo, zEdgeField % array, zEdge, &amp;
-!                                size(zEdgeField % array), nlocal_edges, &amp;
-!                                sendEdgeList, recvEdgeList)
-!
-!      call mpas_dmpar_alltoall_field(domain % dminfo, xVertexField % array, xVertex, &amp;
-!                                size(xVertexField % array), nlocal_vertices, &amp;
-!                                sendVertexList, recvVertexList)
-!      call mpas_dmpar_alltoall_field(domain % dminfo, yVertexField % array, yVertex, &amp;
-!                                size(yVertexField % array), nlocal_vertices, &amp;
-!                                sendVertexList, recvVertexList)
-!      call mpas_dmpar_alltoall_field(domain % dminfo, zVertexField % array, zVertex, &amp;
-!                                size(zVertexField % array), nlocal_vertices, &amp;
-!                                sendVertexList, recvVertexList)
-!      !!!!!!!!!!!!!!!!!!
-!      !! Reorder edges
-!      !!!!!!!!!!!!!!!!!!
-!      call mpas_zoltan_order_loc_hsfc_edges(nOwnEdges,local_edge_list,3,xEdge,yEdge,zEdge)
-!      !!!!!!!!!!!!!!!!!!
-!
-!      !!!!!!!!!!!!!!!!!!
-!      !! Reorder vertices
-!      !!!!!!!!!!!!!!!!!!
-!      call mpas_zoltan_order_loc_hsfc_verts(nOwnVertices,local_vertex_list,3,xVertex,yVertex,zVertex)
-!      !!!!!!!!!!!!!!!!!!
-!
-!      deallocate(sendEdgeList % list)
-!      deallocate(sendEdgeList)
-!      deallocate(recvEdgeList % list)
-!      deallocate(recvEdgeList)
-!   
-!      deallocate(sendVertexList % list)
-!      deallocate(sendVertexList)
-!      deallocate(recvVertexList % list)
-!      deallocate(recvVertexList)
-!    
-!      !
-!      ! Knowing which edges/vertices are owned by this block and which are actually read
-!      !   from the input or restart file, we can build exchange lists to perform 
-!      !   all-to-all field exchanges from process that reads a field to the processes that
-!      !   need them
-!      !
-!      call mpas_dmpar_get_owner_list(domain % dminfo, &amp;
-!                                size(indexToEdgeIDField % array), nlocal_edges, &amp;
-!                                indexToEdgeIDField % array, local_edge_list, &amp;
-!                                sendEdgeList, recvEdgeList)
-!   
-!      call mpas_dmpar_get_owner_list(domain % dminfo, &amp;
-!                                size(indexToVertexIDField % array), nlocal_vertices, &amp;
-!                                indexToVertexIDField % array, local_vertex_list, &amp;
-!                                sendVertexList, recvVertexList)
-!
-!#endif
-!#endif
-!
-
-
-!      !
-!      ! Deallocate fields, graphs, and other memory
-!      !
-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI 
-!      deallocate(xCellField % ioinfo)
-!      deallocate(xCellField % array)
-!      deallocate(yCellField % ioinfo)
-!      deallocate(yCellField % array)
-!      deallocate(zCellField % ioinfo)
-!      deallocate(zCellField % array)
-!#endif
-!#endif
-
-!#ifdef HAVE_ZOLTAN
-!#ifdef _MPI
-!      deallocate(xCell)
-!      deallocate(yCell)
-!      deallocate(zCell)
-!#endif
-!#endif
    end subroutine mpas_input_state_for_domain!}}}
 
    !CR:TODO: an identical subroutine is found in module_io_output - merge
@@ -688,61 +535,7 @@
      call mpas_dmpar_init_mulithalo_exchange_list(indexToCellID % copyList, nHalos)
      nullify(indexToCellID % next)
    
-#ifdef HAVE_ZOLTAN
-#ifdef _MPI 
-     ! Cell x-coordinates (in 3d Cartesian space)
-     allocate(xCell)
-     allocate(xCell % ioinfo)
-     xCell % ioinfo % fieldName = 'xCell'
-     xCell % ioinfo % start(1) = readCellStart
-     xCell % ioinfo % count(1) = nReadCells
-     allocate(xCell % array(nReadCells))
-     call MPAS_io_inq_var(inputHandle, 'xCell', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'xCell', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'xCell', xCell % array, ierr)
-     xCell % dimSizes(1) = nReadCells
-     xCell % block =&gt; readingBlock
-     xCell % sendList =&gt; indexToCellID % sendList
-     xCell % recvList =&gt; indexToCellID % recvList
-     xCell % copyList =&gt; indexToCellID % copyList
-     nullify(xCell % next)
 
-     ! Cell y-coordinates (in 3d Cartesian space)
-     allocate(yCell)
-     allocate(yCell % ioinfo)
-     yCell % ioinfo % fieldName = 'yCell'
-     yCell % ioinfo % start(1) = readCellStart
-     yCell % ioinfo % count(1) = nReadCells
-     allocate(yCell % array(nReadCells))
-     call MPAS_io_inq_var(inputHandle, 'yCell', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'yCell', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'yCell', yCell % array, ierr)
-     yCell % sendList =&gt; indexToCellID % sendList
-     yCell % recvList =&gt; indexToCellID % recvList
-     yCell % copyList =&gt; indexToCellID % copyList
-     yCell % dimSizes(1) = nReadCells
-     yCell % block =&gt; readingBlock
-     nullify(yCell % next)
-
-     ! Cell z-coordinates (in 3d Cartesian space)
-     allocate(zCell)
-     allocate(zCell % ioinfo)
-     zCell % ioinfo % fieldName = 'zCell'
-     zCell % ioinfo % start(1) = readCellStart
-     zCell % ioinfo % count(1) = nReadCells
-     allocate(zCell % array(nReadCells))
-     call MPAS_io_inq_var(inputHandle, 'zCell', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'zCell', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'zCell', zCell % array, ierr)
-     zCell % dimSizes(1) = nReadCells
-     zCell % block =&gt; readingBlock
-     zCell % sendList =&gt; indexToCellID % sendList
-     zCell % recvList =&gt; indexToCellID % recvList
-     zCell % copyList =&gt; indexToCellID % copyList
-     nullify(zCell % next)
-#endif
-#endif
-
      ! Number of cell/edges/vertices adjacent to each cell
      allocate(nEdgesOnCell)
      allocate(nEdgesOnCell % ioinfo)
@@ -868,61 +661,6 @@
      call mpas_dmpar_init_mulithalo_exchange_list(indexToEdgeID % copyList, nHalos+1)
      nullify(indexToEdgeID % next)
    
-#ifdef HAVE_ZOLTAN
-#ifdef _MPI 
-     ! Edge x-coordinates (in 3d Cartesian space)
-     allocate(xEdge)
-     allocate(xEdge % ioinfo)
-     xEdge % ioinfo % fieldName = 'xEdge'
-     xEdge % ioinfo % start(1) = readEdgeStart
-     xEdge % ioinfo % count(1) = nReadEdges
-     allocate(xEdge % array(nReadEdges))
-     call MPAS_io_inq_var(inputHandle, 'xEdge', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'xEdge', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'xEdge', xEdge % array, ierr)
-     xEdge % dimSizes(1) = nReadEdges
-     xEdge % block =&gt; readingBlock
-     xEdge % sendList =&gt; indexToEdgeID % sendList
-     xEdge % recvList =&gt; indexToEdgeID % recvList
-     xEdge % copyList =&gt; indexToEdgeID % copyList
-     nullify(xEdge % next)
-
-     ! Edge y-coordinates (in 3d Cartesian space)
-     allocate(yEdge)
-     allocate(yEdge % ioinfo)
-     yEdge % ioinfo % fieldName = 'yEdge'
-     yEdge % ioinfo % start(1) = readEdgeStart
-     yEdge % ioinfo % count(1) = nReadEdges
-     allocate(yEdge % array(nReadEdges))
-     call MPAS_io_inq_var(inputHandle, 'yEdge', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'yEdge', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'yEdge', yEdge % array, ierr)
-     yEdge % dimSizes(1) = nReadEdges
-     yEdge % block =&gt; readingBlock
-     yEdge % sendList =&gt; indexToEdgeID % sendList
-     yEdge % recvList =&gt; indexToEdgeID % recvList
-     yEdge % copyList =&gt; indexToEdgeID % copyList
-     nullify(yEdge % next)
-
-     ! Edge z-coordinates (in 3d Cartesian space)
-     allocate(zEdge)
-     allocate(zEdge % ioinfo)
-     zEdge % ioinfo % fieldName = 'zEdge'
-     zEdge % ioinfo % start(1) = readEdgeStart
-     zEdge % ioinfo % count(1) = nReadEdges
-     allocate(zEdge % array(nReadEdges))
-     call MPAS_io_inq_var(inputHandle, 'zEdge', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'zEdge', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'zEdge', zEdge % array, ierr)
-     zEdge % dimSizes(1) = nReadEdges
-     zEdge % block =&gt; readingBlock
-     zEdge % sendList =&gt; indexToEdgeID % sendList
-     zEdge % recvList =&gt; indexToEdgeID % recvList
-     zEdge % copyList =&gt; indexToEdgeID % copyList
-     nullify(zEdge % next)
-#endif
-#endif
-
    
      ! Global indices of cells adjacent to each edge
      !    used for determining which edges are owned by a block, where 
@@ -988,61 +726,6 @@
      call mpas_dmpar_init_mulithalo_exchange_list(indexToVertexID % copyList, nHalos+1)
      nullify(indexToVertexID % next)
    
-#ifdef HAVE_ZOLTAN
-#ifdef _MPI
-     ! Vertex x-coordinates (in 3d Cartesian space)
-     allocate(xVertex)
-     allocate(xVertex % ioinfo)
-     xVertex % ioinfo % fieldName = 'xVertex'
-     xVertex % ioinfo % start(1) = readVertexStart
-     xVertex % ioinfo % count(1) = nReadVertices
-     allocate(xVertex % array(nReadVertices))
-     call MPAS_io_inq_var(inputHandle, 'xVertex', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'xVertex', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'xVertex', xVertex % array, ierr)
-     xVertex % dimSizes(1) = nReadVertices
-     xVertex % block =&gt; readingBlock
-     xVertex % sendList =&gt; indexToVertexID % sendList
-     xVertex % recvList =&gt; indexToVertexID % recvList
-     xVertex % copyList =&gt; indexToVertexID % copyList
-     nullify(xVertex % next)
-
-     ! Vertex y-coordinates (in 3d Cartesian space)
-     allocate(yVertex)
-     allocate(yVertex % ioinfo)
-     yVertex % ioinfo % fieldName = 'yVertex'
-     yVertex % ioinfo % start(1) = readVertexStart
-     yVertex % ioinfo % count(1) = nReadVertices
-     allocate(yVertex % array(nReadVertices))
-     call MPAS_io_inq_var(inputHandle, 'yVertex', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'yVertex', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'yVertex', yVertex % array, ierr)
-     yVertex % dimSizes(1) = nReadVertices
-     yVertex % block =&gt; readingBlock
-     yVertex % sendList =&gt; indexToVertexID % sendList
-     yVertex % recvList =&gt; indexToVertexID % recvList
-     yVertex % copyList =&gt; indexToVertexID % copyList
-     nullify(yVertex % next)
-
-     ! Vertex z-coordinates (in 3d Cartesian space)
-     allocate(zVertex)
-     allocate(zVertex % ioinfo)
-     zVertex % ioinfo % fieldName = 'zVertex'
-     zVertex % ioinfo % start(1) = readVertexStart
-     zVertex % ioinfo % count(1) = nReadVertices
-     allocate(zVertex % array(nReadVertices))
-     call MPAS_io_inq_var(inputHandle, 'zVertex', ierr=ierr)
-     call MPAS_io_set_var_indices(inputHandle, 'zVertex', readIndices, ierr=ierr)
-     call mpas_io_get_var(inputHandle, 'zVertex', zVertex % array, ierr)
-     zVertex % dimSizes(1) = nReadVertices
-     zVertex % block =&gt; readingBlock
-     zVertex % sendList =&gt; indexToVertexID % sendList
-     zVertex % recvList =&gt; indexToVertexID % recvList
-     zVertex % copyList =&gt; indexToVertexID % copyList
-     nullify(zVertex % next)
-#endif
-#endif
-
    
      ! Global indices of cells adjacent to each vertex
      !    used for determining which vertices are owned by a block, where 

Deleted: branches/zoltan_cleaning/src/framework/mpas_zoltan_interface.F
===================================================================
--- branches/zoltan_cleaning/src/framework/mpas_zoltan_interface.F        2013-04-15 20:36:04 UTC (rev 2753)
+++ branches/zoltan_cleaning/src/framework/mpas_zoltan_interface.F        2013-04-16 00:03:21 UTC (rev 2754)
@@ -1,581 +0,0 @@
-module mpas_zoltan_interface
-   use zoltan
-
-   implicit none
-
-   include 'mpif.h'
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Data for reordering cells
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer :: numCells
-   integer, dimension(:), pointer :: cellIDs
-   integer :: geomDim
-   real (kind=RKIND), dimension(:), pointer :: cellCoordX, cellCoordY, cellCoordZ
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Data for reordering edges
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer :: numEdges
-   integer, dimension(:), pointer :: edgeIDs
-   real (kind=RKIND), dimension(:), pointer :: edgeCoordX, edgeCoordY, edgeCoordZ  
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Data for reordering vertices
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer :: numVerts
-   integer, dimension(:), pointer :: vertIDs
-   real (kind=RKIND), dimension(:), pointer :: vertCoordX, vertCoordY, vertCoordZ  
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-   contains
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Perhaps not necessary, but implemented in case it helps
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zoltan_start()  
-
-      integer(Zoltan_INT) :: error
-      real(Zoltan_FLOAT) :: version
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Body of subroutine
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      error = Zoltan_Initialize(version)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      
-   end subroutine
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zoltan_order_loc_hsfc_cells(in_numcells,in_cellIDs,in_geomDim,in_cellX, &amp;
-                                       in_cellY, in_cellZ)
-      implicit none
-
-      integer :: in_numcells
-      integer, dimension(:), pointer :: in_cellIDs
-      integer :: in_geomDim
-      real (kind=RKIND), dimension(:), pointer :: in_cellX, in_cellY, in_cellZ
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! local variables
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      type(Zoltan_Struct), pointer :: zz_obj
-      integer(ZOLTAN_INT) :: ierr
-
-      integer :: numGidEntries, i
-      integer(ZOLTAN_INT), allocatable :: global_ids(:), permIndices(:),permGIDs(:)
-      real(kind=RKIND), allocatable :: permXs(:),permYs(:),permZs(:)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Body of subroutine
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      numCells = in_numcells
-      cellIDs =&gt; in_cellIDs
-      geomDim = in_geomDim
-      cellCoordX =&gt; in_cellX
-      cellCoordY =&gt; in_cellY
-      cellCoordZ =&gt; in_cellZ
-
-      nullify(zz_obj)
-      zz_obj =&gt; Zoltan_Create(MPI_COMM_SELF)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! General Zoltan Parameters
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Param(zz_obj, &quot;ORDER_METHOD&quot;, &quot;LOCAL_HSFC&quot;)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! register query functions
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_OBJ_FN_TYPE,zqfNumCells)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_OBJ_LIST_FN_TYPE,zqfGetCells)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_GEOM_FN_TYPE,zqfGeomDim)
-      ierr =  Zoltan_Set_Fn(zz_obj, ZOLTAN_GEOM_FN_TYPE, zqfGetCellGeom)
-
-      numGidEntries=1
-
-      allocate(global_ids(numCells))
-      allocate(permIndices(numCells))
-      allocate(permGIDs(numCells))
-      allocate(permXs(numCells))
-      allocate(permYs(numCells))
-      allocate(permZs(numCells))
-
-      !! MMW: There might be a way to use cellIDs directly
-      do i=1,numCells
-        global_ids(i) = cellIDs(i)
-      end do
-
-      ierr = Zoltan_Order(zz_obj, numGidEntries, numCells, global_ids, permIndices);
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! This is necessary for now until we fix a small bug in Zoltan_Order
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numCells
-        permGIDs(i) = global_ids(permIndices(i)+1)
-        permXs(i) = cellCoordX(permIndices(i)+1)
-        permYs(i) = cellCoordY(permIndices(i)+1)
-        permZs(i) = cellCoordZ(permIndices(i)+1)
-      end do
-
-      !!do i=1,numCells
-      !!   write(*,*) global_ids(i), permGIDs(i)
-      !!end do
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Actually change the ordering of the cells
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numCells
-        cellIDs(i) = permGIDs(i)
-        cellCoordX(i) = permXs(i)
-        cellCoordY(i) = permYs(i)
-        cellCoordZ(i) = permZs(i)
-      end do
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      deallocate(global_ids)
-      deallocate(permIndices)
-      deallocate(permGIDs)
-      deallocate(permXs)
-      deallocate(permYs)
-      deallocate(permZs)
-
-      call Zoltan_Destroy(zz_obj)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   end subroutine mpas_zoltan_order_loc_hsfc_cells
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function:
-   !!    Returns number of cells
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer function zqfNumCells(data, ierr)
-
-      ! Local declarations
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      zqfNumCells = numCells
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end function zqfNumCells
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function: 
-   !!    Returns lists of Cell IDs
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_cells (data, num_gid_entries, num_lid_entries, global_ids, &amp;
-                           local_ids, wgt_dim, obj_wgts, ierr)
-     integer(ZOLTAN_INT), intent(in) :: data(*)
-     integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-     integer(ZOLTAN_INT), intent(out) :: global_ids(*), local_ids(*)
-     integer(ZOLTAN_INT), intent(in) :: wgt_dim 
-     real(ZOLTAN_FLOAT), intent(out) :: obj_wgts(*)
-     integer(ZOLTAN_INT), intent(out) :: ierr
-
-     ! local declarations
-     integer :: i
-
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-     do i= 1, numCells
-       global_ids(i) = cellIDs(i)
-       local_ids(i) = i
-     end do
-
-     ierr = ZOLTAN_OK
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_cells
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Zoltan Query Function:
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer function zqfGeomDim(data, ierr)
-      !use zoltan
-      implicit none
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      zqfGeomDim = geomDim
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end function zqfGeomDim
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Zoltan Query Function:
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_cell_geom(data, num_gid_entries, num_lid_entries, global_id, &amp;
-                             local_id, geom_vec, ierr)
-      !use zoltan
-      implicit none
-
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-      integer(ZOLTAN_INT), intent(in) :: global_id, local_id
-      real(ZOLTAN_DOUBLE), intent(out) :: geom_vec(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Assuming geom_dim is 3
-      geom_vec(1) = cellCoordX(local_id)
-      geom_vec(2) = cellCoordY(local_id)
-      geom_vec(3) = cellCoordZ(local_id)
-
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_cell_geom
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! The ordering functions should perhaps be refactored so that there
-   !! are not separate functions for cells, edges, and vertices
-   !! Not sure if this is worth it with the additional conditionals that would 
-   !! be required. 
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zoltan_order_loc_hsfc_edges(in_numedges,in_edgeIDs,in_geomDim,in_edgeX, &amp;
-                                       in_edgeY, in_edgeZ)
-      implicit none
-
-      integer :: in_numedges
-      integer, dimension(:), pointer :: in_edgeIDs
-      integer :: in_geomDim
-      real (kind=RKIND), dimension(:), pointer :: in_edgeX, in_edgeY, in_edgeZ
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! local variables
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      type(Zoltan_Struct), pointer :: zz_obj
-      integer(ZOLTAN_INT) :: ierr
-
-      integer :: numGidEntries, i
-      integer(ZOLTAN_INT), allocatable :: global_ids(:), permIndices(:),permGIDs(:)
-      real(kind=RKIND), allocatable :: permXs(:),permYs(:),permZs(:)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Body of subroutine
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      numEdges = in_numedges
-      edgeIDs =&gt; in_edgeIDs
-      geomDim = in_geomDim
-      edgeCoordX =&gt; in_edgeX
-      edgeCoordY =&gt; in_edgeY
-      edgeCoordZ =&gt; in_edgeZ
-
-      nullify(zz_obj)
-      zz_obj =&gt; Zoltan_Create(MPI_COMM_SELF)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! General Zoltan Parameters
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Param(zz_obj, &quot;ORDER_METHOD&quot;, &quot;LOCAL_HSFC&quot;)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! register query functions
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_OBJ_FN_TYPE,zqfNumEdges)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_OBJ_LIST_FN_TYPE,zqfGetEdges)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_GEOM_FN_TYPE,zqfGeomDim)
-      ierr =  Zoltan_Set_Fn(zz_obj, ZOLTAN_GEOM_FN_TYPE, zqfGetEdgeGeom)
-
-      numGidEntries=1
-
-      allocate(global_ids(numEdges))
-      allocate(permIndices(numEdges))
-      allocate(permGIDs(numEdges))
-      allocate(permXs(numEdges))
-      allocate(permYs(numEdges))
-      allocate(permZs(numEdges))
-
-      !! MMW: There might be a way to use edgeIDs directly
-      do i=1,numEdges
-        global_ids(i) = edgeIDs(i)
-      end do
-
-      ierr = Zoltan_Order(zz_obj, numGidEntries, numEdges, global_ids, permIndices);
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! This is necessary for now until we fix a small bug in Zoltan_Order
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numEdges
-        permGIDs(i) = global_ids(permIndices(i)+1)
-        permXs(i) = edgeCoordX(permIndices(i)+1)
-        permYs(i) = edgeCoordY(permIndices(i)+1)
-        permZs(i) = edgeCoordZ(permIndices(i)+1)
-      end do
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Actually change the ordering of the edges
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numEdges
-        edgeIDs(i) = permGIDs(i)
-        edgeCoordX(i) = permXs(i)
-        edgeCoordY(i) = permYs(i)
-        edgeCoordZ(i) = permZs(i)
-      end do
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      deallocate(global_ids)
-      deallocate(permIndices)
-      deallocate(permGIDs)
-      deallocate(permXs)
-      deallocate(permYs)
-      deallocate(permZs)
-
-      call Zoltan_Destroy(zz_obj)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zoltan_order_loc_hsfc_edges
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function:
-   !!    Returns number of edges
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer function zqfNumEdges(data, ierr)
-      ! Local declarations
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      zqfNumEdges = numEdges
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end function zqfNumEdges
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function: 
-   !!    Returns lists of Edge IDs
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_edges (data, num_gid_entries, num_lid_entries, global_ids, &amp;
-                           local_ids, wgt_dim, obj_wgts, ierr)
-     integer(ZOLTAN_INT), intent(in) :: data(*)
-     integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-     integer(ZOLTAN_INT), intent(out) :: global_ids(*), local_ids(*)
-     integer(ZOLTAN_INT), intent(in) :: wgt_dim 
-     real(ZOLTAN_FLOAT), intent(out) :: obj_wgts(*)
-     integer(ZOLTAN_INT), intent(out) :: ierr
-
-     ! local declarations
-     integer :: i
-
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-     do i= 1, numEdges
-       global_ids(i) = edgeIDs(i)
-       local_ids(i) = i
-     end do
-
-     ierr = ZOLTAN_OK
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_edges
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Zoltan Query Function:
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_edge_geom(data, num_gid_entries, num_lid_entries, global_id, &amp;
-                             local_id, geom_vec, ierr)
-      !use zoltan
-      implicit none
-
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-      integer(ZOLTAN_INT), intent(in) :: global_id, local_id
-      real(ZOLTAN_DOUBLE), intent(out) :: geom_vec(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Assuming geom_dim is 3
-      geom_vec(1) = edgeCoordX(local_id)
-      geom_vec(2) = edgeCoordY(local_id)
-      geom_vec(3) = edgeCoordZ(local_id)
-
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_edge_geom
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zoltan_order_loc_hsfc_verts(in_numverts,in_vertIDs,in_geomDim,in_vertX, &amp;
-                                       in_vertY, in_vertZ)
-      implicit none
-
-      integer :: in_numverts
-      integer, dimension(:), pointer :: in_vertIDs
-      integer :: in_geomDim
-      real (kind=RKIND), dimension(:), pointer :: in_vertX, in_vertY, in_vertZ
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! local variables
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      type(Zoltan_Struct), pointer :: zz_obj
-      integer(ZOLTAN_INT) :: ierr
-
-      integer :: numGidEntries, i
-      integer(ZOLTAN_INT), allocatable :: global_ids(:), permIndices(:),permGIDs(:)
-      real(kind=RKIND), allocatable :: permXs(:),permYs(:),permZs(:)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Body of subroutine
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      numVerts = in_numverts
-      vertIDs =&gt; in_vertIDs
-      geomDim = in_geomDim
-      vertCoordX =&gt; in_vertX
-      vertCoordY =&gt; in_vertY
-      vertCoordZ =&gt; in_vertZ
-
-      nullify(zz_obj)
-      zz_obj =&gt; Zoltan_Create(MPI_COMM_SELF)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! General Zoltan Parameters
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Param(zz_obj, &quot;ORDER_METHOD&quot;, &quot;LOCAL_HSFC&quot;)
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! register query functions
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_OBJ_FN_TYPE,zqfNumVerts)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_OBJ_LIST_FN_TYPE,zqfGetVerts)
-      ierr = Zoltan_Set_Fn(zz_obj, ZOLTAN_NUM_GEOM_FN_TYPE,zqfGeomDim)
-      ierr =  Zoltan_Set_Fn(zz_obj, ZOLTAN_GEOM_FN_TYPE, zqfGetVertGeom)
-
-      numGidEntries=1
-
-      allocate(global_ids(numVerts))
-      allocate(permIndices(numVerts))
-      allocate(permGIDs(numVerts))
-      allocate(permXs(numVerts))
-      allocate(permYs(numVerts))
-      allocate(permZs(numVerts))
-
-      !! MMW: There might be a way to use vertIDs directly
-      do i=1,numVerts
-        global_ids(i) = vertIDs(i)
-      end do
-
-      ierr = Zoltan_Order(zz_obj, numGidEntries, numVerts, global_ids, permIndices);
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! This is necessary for now until we fix a small bug in Zoltan_Order
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numVerts
-        permGIDs(i) = global_ids(permIndices(i)+1)
-        permXs(i) = vertCoordX(permIndices(i)+1)
-        permYs(i) = vertCoordY(permIndices(i)+1)
-        permZs(i) = vertCoordZ(permIndices(i)+1)
-      end do
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Actually change the ordering of the verts
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-      do i=1,numVerts
-        vertIDs(i) = permGIDs(i)
-        vertCoordX(i) = permXs(i)
-        vertCoordY(i) = permYs(i)
-        vertCoordZ(i) = permZs(i)
-      end do
-      !!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      deallocate(global_ids)
-      deallocate(permIndices)
-      deallocate(permGIDs)
-      deallocate(permXs)
-      deallocate(permYs)
-      deallocate(permZs)
-
-      call Zoltan_Destroy(zz_obj)
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   end subroutine mpas_zoltan_order_loc_hsfc_verts
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function:
-   !!    Returns number of verts
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   integer function zqfNumVerts(data, ierr)
-
-      ! Local declarations
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      zqfNumVerts = numVerts
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end function zqfNumVerts
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! zoltan query function: 
-   !!    Returns lists of Vert IDs
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_verts (data, num_gid_entries, num_lid_entries, global_ids, &amp;
-                           local_ids, wgt_dim, obj_wgts, ierr)
-
-     integer(ZOLTAN_INT), intent(in) :: data(*)
-     integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-     integer(ZOLTAN_INT), intent(out) :: global_ids(*), local_ids(*)
-     integer(ZOLTAN_INT), intent(in) :: wgt_dim 
-     real(ZOLTAN_FLOAT), intent(out) :: obj_wgts(*)
-     integer(ZOLTAN_INT), intent(out) :: ierr
-
-     ! local declarations
-     integer :: i
-
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-     do i= 1, numVerts
-       global_ids(i) = vertIDs(i)
-       local_ids(i) = i
-     end do
-
-     ierr = ZOLTAN_OK
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_verts
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! Zoltan Query Function:
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   subroutine mpas_zqf_get_vert_geom(data, num_gid_entries, num_lid_entries, global_id, &amp;
-                             local_id, geom_vec, ierr)
-      !use zoltan
-      implicit none
-
-      integer(ZOLTAN_INT), intent(in) :: data(*)
-      integer(ZOLTAN_INT), intent(in) :: num_gid_entries, num_lid_entries
-      integer(ZOLTAN_INT), intent(in) :: global_id, local_id
-      real(ZOLTAN_DOUBLE), intent(out) :: geom_vec(*)
-      integer(ZOLTAN_INT), intent(out) :: ierr
-
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-      !! Assuming geom_dim is 3
-      geom_vec(1) = vertCoordX(local_id)
-      geom_vec(2) = vertCoordY(local_id)
-      geom_vec(3) = vertCoordZ(local_id)
-
-      ierr = ZOLTAN_OK
-      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   end subroutine mpas_zqf_get_vert_geom
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-
-
-end module mpas_zoltan_interface

</font>
</pre>