[cig-commits] r4491 - in mc/3D/CitcomS/trunk/visual/Mayavi2: . plugins

maweier at geodynamics.org maweier at geodynamics.org
Thu Sep 7 14:07:39 PDT 2006


Author: maweier
Date: 2006-09-07 14:07:38 -0700 (Thu, 07 Sep 2006)
New Revision: 4491

Modified:
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/plugins/CitcomSHDFUgrid.py
Log:
Fixed connectivity issues. 
Fixed HdfDisplays wrong status output.


Modified: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py	2006-09-07 19:27:15 UTC (rev 4490)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py	2006-09-07 21:07:38 UTC (rev 4491)
@@ -260,14 +260,14 @@
             botm_mean=0.0
     
             if surface:
-                for i in xrange(ny):
+                for i in xrange(nx):
                     surf_mean += numpy.mean(hdf_surface_topography[i])
                 surf_mean = surf_mean/ny
 
             if bottom:
-                for i in xrange(ny):
+                for i in xrange(nx):
                     botm_mean += numpy.mean(hdf_bottom_topography[i])
-                botm_mean = botm_mean/ny
+                botm_mean = botm_mean/nx
         
         
         
@@ -281,8 +281,8 @@
         
         #Read Surface and Bottom Data   
         if bottom==True or surface == True:
-            for i in xrange(ny):
-                for j in xrange(nx):
+            for i in xrange(nx):
+                for j in xrange(ny):
                     
                     
                     if bottom==True:
@@ -351,23 +351,23 @@
             j=1    #Counts Y Direction
             k=1    #Counts Z Direction
     
-            for n in xrange(((el_nx_redu*el_ny_redu*el_nz_redu)-(el_nz_redu*el_ny_redu))):
+            for n in xrange((el_nx_redu*el_ny_redu*el_nz_redu)-(el_nz_redu*el_nx_redu)):
                 if (i%el_nz_redu)==0:            #X-Values!!!
                     j+=1                 #Count Y-Values
         
-                if (j%el_ny_redu)==0:
+                if (j%el_nx_redu)==0:
                     k+=1                #Count Z-Values
                   
-                if i%el_nz_redu!=0 and j%el_ny_redu!=0:            #Check if Box can be created
+                if i%el_nz_redu!=0 and j%el_nx_redu!=0:            #Check if Box can be created
                     #Get Vertnumbers
                     n0 = n+(capnr*(el_nx_redu*el_ny_redu*el_nz_redu))
-                    n1 = n0+1
-                    n2 = n1+el_nz_redu
-                    n3 = n0+el_nz_redu
-                    n4 = n0+(el_ny_redu*el_nz_redu)
-                    n5 = n4+1
-                    n6 = n4+el_nz_redu+1
-                    n7 = n4+el_nz_redu
+                    n1 = n0+el_nz_redu
+                    n2 = n1+el_nz_redu*el_nx_redu
+                    n3 = n0+el_nz_redu*el_nx_redu
+                    n4 = n0+1
+                    n5 = n4+el_nz_redu
+                    n6 = n5+el_nz_redu*el_nx_redu
+                    n7 = n4+el_nz_redu*el_nx_redu
 
                     #Created Polygon Box
                     polygons3d.append([n0,n1,n2,n3,n4,n5,n6,n7]) #Hexahedron VTK Representation
@@ -378,8 +378,8 @@
             if bottom==True or surface==True:
                 #Connectivity for 2d-Data      
                 i=1
-                for n in xrange((nx)*(ny) - nx):
-                    if i%nx!=0 :
+                for n in xrange((nx)*(ny) - ny):
+                    if i%ny!=0 :
                         n0 = n+(capnr*((nx)*(ny)))
                         n1 = n0+1
                         n2 = n0+ny

Modified: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py	2006-09-07 19:27:15 UTC (rev 4490)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py	2006-09-07 21:07:38 UTC (rev 4491)
@@ -1,5 +1,4 @@
 #! /usr/bin/env python
-
 try:
     import wxversion
     wxversion.ensureMinimal('2.6')
@@ -26,10 +25,11 @@
         from enthought.mayavi.modules import surface, glyph , axes, outline, orientation_axes, scalar_cut_plane  
         from enthought.mayavi.sources.vtk_data_source import VTKDataSource 
         from enthought.tvtk.api import tvtk
+        #citcomS Filter and Modules
         from plugins.CitcomSHDFUgrid import CitcomSHDFUgrid
         from plugins.filter.CitcomSshowCaps import CitcomSshowCaps
         from plugins.filter.CitcomSreduce import CitcomSreduce
-        #import filter.CitcomSSphere
+        
         import re
         
         
@@ -123,6 +123,7 @@
         if opt in ('-x','--nx_redu'):
             try:
                 mc.nx_redu = int(arg)
+                print "Reducing Grid Size to x:",mc.nx_redu
             except ValueError:
                 print "x is not a number..."
                 sys.exit(1)
@@ -130,6 +131,7 @@
         if opt in ('-y','--ny_redu'):
             try:
                 mc.ny_redu = int(arg)
+                print "Reducing Grid Size to y:",mc.ny_redu
             except ValueError:
                 print "y is not a number..."
                 sys.exit(1)
@@ -137,9 +139,10 @@
         if opt in ('-z','--nz_redu'):
             try:
                 mc.nz_redu = int(arg)
+                print "Reducing Grid Size to z:",mc.nz_redu
+        
             except ValueError:
                 print "z is not a number..."
                 sys.exit(1)
         
-    print "Reducing Grid Size to x:",mc.nx_redu,"y:",mc.ny_redu,"z:",mc.nz_redu
-    mc.main()
\ No newline at end of file
+    mc.main()

Modified: mc/3D/CitcomS/trunk/visual/Mayavi2/plugins/CitcomSHDFUgrid.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/plugins/CitcomSHDFUgrid.py	2006-09-07 19:27:15 UTC (rev 4490)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/plugins/CitcomSHDFUgrid.py	2006-09-07 21:07:38 UTC (rev 4491)
@@ -167,33 +167,31 @@
            
             #Create Connectivity info    
             if counter==0:
-                #For 3d Data 
-                i=1    #Counts X Direction
-                j=1    #Counts Y Direction
-                k=1    #Counts Z Direction
+                 i=1    #Counts X Direction
+                 j=1    #Counts Y Direction
+                 k=1    #Counts Z Direction
     
-                for n in xrange(((el_nx_redu*el_ny_redu*el_nz_redu)-(el_nz_redu*el_ny_redu))):
-                    if (i%el_nz_redu)==0:            #X-Values!!!
-                        j+=1                 #Count Y-Values
+                 for n in xrange((el_nx_redu*el_ny_redu*el_nz_redu)-(el_nz_redu*el_nx_redu)):
+                     if (i%el_nz_redu)==0:            #X-Values!!!
+                         j+=1                 #Count Y-Values
         
-                    if (j%el_ny_redu)==0:
-                        k+=1                #Count Z-Values
+                     if (j%el_nx_redu)==0:
+                         k+=1                #Count Z-Values
                   
-                    if i%el_nz_redu!=0 and j%el_ny_redu!=0:            #Check if Box can be created
-                        #Get Vertnumbers
-                        n0 = n+(capnr*(el_nx_redu*el_ny_redu*el_nz_redu))
-                        n1 = n0+1
-                        n2 = n1+el_nz_redu
-                        n3 = n0+el_nz_redu
-                        n4 = n0+(el_ny_redu*el_nz_redu)
-                        n5 = n4+1
-                        n6 = n4+el_nz_redu+1
-                        n7 = n4+el_nz_redu
-
-                        #Created Polygon Box
-                        hexagrid.insert_next_cell(12,[n0,n1,n2,n3,n4,n5,n6,n7])
+                     if i%el_nz_redu!=0 and j%el_nx_redu!=0:            #Check if Box can be created
+                         #Get Vertnumbers
+                         n0 = n+(capnr*(el_nx_redu*el_ny_redu*el_nz_redu))
+                         n1 = n0+el_nz_redu
+                         n2 = n1+el_nz_redu*el_nx_redu
+                         n3 = n0+el_nz_redu*el_nx_redu
+                         n4 = n0+1
+                         n5 = n4+el_nz_redu
+                         n6 = n5+el_nz_redu*el_nx_redu
+                         n7 = n4+el_nz_redu*el_nx_redu
+                         #Created Polygon Box
+                         hexagrid.insert_next_cell(12,[n0,n1,n2,n3,n4,n5,n6,n7])
              
-                    i+=1
+                     i+=1
         
         
         #Store Arrays in Vtk conform Datastructures



More information about the cig-commits mailing list