<p><b>dwj07@fsu.edu</b> 2013-02-25 11:26:23 -0700 (Mon, 25 Feb 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding counts of interior and exterior blocks.<br>
        Allowing procs = 1 to not create the processor decomp file.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/python_scripts/processor_decompositions/make_partition_files.py
===================================================================
--- branches/tools/python_scripts/processor_decompositions/make_partition_files.py        2013-02-25 18:23:13 UTC (rev 2508)
+++ branches/tools/python_scripts/processor_decompositions/make_partition_files.py        2013-02-25 18:26:23 UTC (rev 2509)
@@ -41,6 +41,11 @@
 else:
         weighted_parts = True
 
+if int(options.num_procs) &gt; 1:
+        proc_decomp = True
+else:
+        proc_decomp = False
+
 dev_null = open(os.devnull, 'w')
 grid = NetCDFFile(options.filename, 'r')
 
@@ -59,6 +64,7 @@
 
 num_blocks = 0
 owning_block = [0] * nCells
+block_owner = [0] * int(options.num_blocks)
 
 nEdges = 0
 for i in np.arange(0, nCells):
@@ -116,49 +122,80 @@
         i = i + 1
 graph.close()
 
-blocksOnBlock = defaultdict(list)
-nEdges = 0
+if proc_decomp:
+        blocksOnBlock = defaultdict(list)
+        nEdges = 0
 
-for i in np.arange(0, nCells):
-        for j in np.arange(0, nEdgesOnCell[i]):
-                iCell = cellsOnCell[i][j]
-                try:
-                        can_add = True
-                        for block in blocksOnBlock[owning_block[i]]:
-                                if block == owning_block[iCell]:
-                                        can_add = False
-                except:
-                        can_add = True
+        for i in np.arange(0, nCells):
+                for j in np.arange(0, nEdgesOnCell[i]):
+                        iCell = cellsOnCell[i][j]
+                        try:
+                                can_add = True
+                                for block in blocksOnBlock[owning_block[i]]:
+                                        if block == owning_block[iCell]:
+                                                can_add = False
+                        except:
+                                can_add = True
 
-                if iCell == -1:
-                        can_add = False
+                        if iCell == -1:
+                                can_add = False
 
-                if owning_block[iCell] == owning_block[i]:
-                        can_add = False
+                        if owning_block[iCell] == owning_block[i]:
+                                can_add = False
 
-                if owning_block[iCell] &lt;= 0:
-                        can_add = False
+                        if owning_block[iCell] &lt;= 0:
+                                can_add = False
 
-                if owning_block[i] &lt;= 0:
-                        can_add = False
+                        if owning_block[i] &lt;= 0:
+                                can_add = False
 
-                if can_add:
-                        nEdges = nEdges + 1
-                        blocksOnBlock[owning_block[i]].append(owning_block[iCell])
+                        if can_add:
+                                nEdges = nEdges + 1
+                                blocksOnBlock[owning_block[i]].append(owning_block[iCell])
 
-del blocksOnBlock[0]
+        del blocksOnBlock[0]
 
-block_graph = open('block.graph.info', 'w+')
-block_graph.write('%s %s</font>
<font color="red">'%(int(num_blocks), int(nEdges/2)))
-for i in np.arange(1, num_blocks+1):
-        for block in blocksOnBlock[i]:
-                block_graph.write('%s '%int(block))
-        block_graph.write('</font>
<font color="blue">')
+        block_graph = open('block.graph.info', 'w+')
+        block_graph.write('%s %s</font>
<font color="blue">'%(int(num_blocks), int(nEdges/2)))
+        for i in np.arange(1, num_blocks+1):
+                for block in blocksOnBlock[i]:
+                        block_graph.write('%s '%int(block))
+                block_graph.write('</font>
<font color="red">')
 
-block_graph.close()
+        block_graph.close()
 
-command = &quot;%s&quot;%(options.metis_path)
-arg1 = &quot;block.graph.info&quot;
-arg2 = &quot;%s&quot;%options.num_procs
-subprocess.call([command, arg1, arg2], stdout=dev_null, stderr=dev_null)
+        command = &quot;%s&quot;%(options.metis_path)
+        arg1 = &quot;block.graph.info&quot;
+        arg2 = &quot;%s&quot;%options.num_procs
+        subprocess.call([command, arg1, arg2], stdout=dev_null, stderr=dev_null)
 
+        block_graph = open('block.graph.info.part.%s'%options.num_procs, 'r')
+        iBlock = 0
+        for block in iter(lambda: block_graph.readline(), &quot;&quot;):
+                block_arr = block.split()
+                block_owner[iBlock] = int(block_arr[0])
+                iBlock = iBlock + 1
+
+        block_graph.close()
+
+        block_location = open('int_ext_blocks.dat', 'w+')
+        interior_blocks = 0
+        exterior_blocks = 0
+        for i in np.arange(1, num_blocks+1):
+                owner = block_owner[i-1]
+                interior = True
+                for block in blocksOnBlock[i-1]:
+                        if block_owner[block-1] != owner:
+                                interior = False
+
+                if interior:
+                        block_location.write('1</font>
<font color="blue">')
+                        interior_blocks = interior_blocks + 1
+                else:
+                        block_location.write('0</font>
<font color="blue">')
+                        exterior_blocks = exterior_blocks + 1
+
+        block_location.close()
+
+        print 'Interior blocks: ', interior_blocks
+        print 'Exterior blocks: ', exterior_blocks

</font>
</pre>