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

luis at geodynamics.org luis at geodynamics.org
Wed Dec 6 00:23:54 PST 2006


Author: luis
Date: 2006-12-06 00:23:54 -0800 (Wed, 06 Dec 2006)
New Revision: 5479

Added:
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_Hdf2Vtk.c
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_Hdf2Vtk.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_HdfDisplay.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_VtkDisplay.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/README
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/__init__.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/plugins/
Removed:
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.c
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_VtkDisplay.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/README
   mc/3D/CitcomS/trunk/visual/Mayavi2/__init__.py
   mc/3D/CitcomS/trunk/visual/Mayavi2/plugins/
Log:
Archive files created during Martin Weier's internship


Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.c
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.c	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.c	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1,1375 +0,0 @@
-/*
- * CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
- * Copyright (C) 2002-2005, California Institute of Technology.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *  
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <math.h>
-#include "hdf5.h"
-
-
-#define true 1
-#define false 0
-#define STRING_BUFFER 256
-
-typedef struct vtk_pixel_t
-{
-int c1;
-int c2;
-int c3;
-int c4;	
-} vtk_pixel_t;
-
-typedef struct hexahedron_t
-{
-int c1;
-int c2;
-int c3;
-int c4;
-int c5;
-int c6;
-int c7;
-int c8;
-} hexahedron_t;
-
-typedef struct coordinates_t
-{
-float x;
-float y;
-float z;	
-} coordinates_t;
-
-
-typedef struct cap_t
-{
-    int id;
-    char name[8];
-    hid_t group;
-} cap_t;
-
-
-typedef struct field_t
-{
-    const char *name;
-    
-    int rank;
-    hsize_t *dims;
-    hsize_t *maxdims;
-
-    hsize_t *offset;
-    hsize_t *count;
-
-    int n;
-    float *data;
-
-} field_t;
-
-
-static cap_t *open_cap(hid_t file_id, int capid);
-static herr_t close_cap(cap_t *cap);
-
-
-static field_t *open_field(cap_t *cap, const char *name);
-static herr_t read_field(cap_t *cap, field_t *field, int timestep);
-static herr_t close_field(field_t *field);
-
-
-static herr_t get_attribute_str(hid_t obj_id, const char *attr_name, char **data);
-static herr_t get_attribute_int(hid_t input, const char *name, int *val);
-static herr_t get_attribute_float(hid_t input, const char *name, float *val);
-static herr_t get_attribute(hid_t obj_id, const char *attr_name, hid_t mem_type_id, void *data);
-static herr_t get_attribute_mem(hid_t obj_id, const char *attr_name, hid_t mem_type_id, void *data);
-static herr_t get_attribute_disk(hid_t loc_id, const char *attr_name, void *attr_out);
-static herr_t get_attribute_info(hid_t obj_id, const char *attr_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size, hid_t *type_id);
-
-static coordinates_t rtf_to_xyz(coordinates_t coord);
-static coordinates_t velocity_to_cart(coordinates_t velocity, coordinates_t coord);
-static float calc_mean(field_t *topo,int nodey,int nodez);
-
-static void write_vtk_shell(coordinates_t coordinates[], hexahedron_t connectivity[], float temperature[], 
-					   float viscosity[], coordinates_t velocity[], int nodex, int nodey, int nodez,
-					   int timestep, float radius_inner,int caps,int ascii);
-
-
-static void write_vtk_surface(coordinates_t coordinates[], vtk_pixel_t connectivity[], 
-						float heatflux[], coordinates_t velocity[],
-						int timestep,int nodex,int nodey,int nodez,int caps, char* filename_prefix);
-void print_help(void);
-
-int main(int argc, char *argv[])
-{
-    char *datafile;
-
-    hid_t h5file;
-    hid_t input;
-    herr_t status;
-
-    int caps;
-    int capid;
-    cap_t *cap;
-
-    int step;
-    int n, i, j, k;
-    int nodex, nodey, nodez;
-	float radius_inner;
-	float radius_outer;
-	
-	
-	int nodex_redu=0;
-	int nodey_redu=0;
-	int nodez_redu=0;
-	int initial=0;
-	int timestep=-1;
-	
-    int current_t=0;
-    int timesteps=0;
-	
-	int cell_counter=0;
-	int cell_counter_surface=0;
-	
-    int *steps;
-    char *endptr;
-
-    field_t *coord;
-    field_t *velocity;
-    field_t *temperature;
-    field_t *viscosity;
-	
-	//Bottom
-	field_t *botm_coord;
-	field_t *botm_hflux;
-	field_t *botm_velo;
-	field_t *botm_topo;
-	
-	//Surface
-	field_t *surf_coord;
-	field_t *surf_hflux;
-	field_t *surf_velo;
-	field_t *surf_topo;
-	
-	///////////////////////////////////////////////
-	int bottom=false;
-	int surface=false;
-	int topo=false;
-	int ascii=false;
-	
-    /************************************************************************
-     * Parse command-line parameters.                                       *
-     ************************************************************************/
-
-    /*
-     * HDF5 file must be specified as first argument.
-     */
-    
-    if (argc < 2)
-    {
-        fprintf(stderr, "Usage: run with -h to get help\n", argv[0]);
-        return EXIT_FAILURE;
-    }
-
-    char c;
-    char *hdf_filepath;
-    char *output_filepath;
-    extern char *optarg;
-    extern int optind, optopt;
-	int errflg=0;
-    while ((c = getopt(argc, argv, ":p:o:i:t:x:y:z:bscah?")) != -1) {
-        switch(c) {
-        		case 'p':
-					hdf_filepath = optarg;
-					break;
-        
-				case 'o':
-            		output_filepath = optarg;
-                	printf("Got output filepath\n");
-            		break;
-								
-        		case 'i':
-					initial = atoi(optarg);
-					printf("Initial: %d\n",initial);
-					break;
-				
-				case 't':
-					timesteps = atoi(optarg);
-					printf("Timesteps: %d\n", timesteps);
-					//Inclusive
-					timesteps++;
-					break;
-				
-				case 'x':
-					nodex_redu=atoi(optarg);
-					break;
-				
-				case 'y':
-					nodey_redu=atoi(optarg);
-					break;
-				
-				case 'z':
-					nodez_redu=atoi(optarg);
-					break;
-				
-				
-				case ':':       /* missing operand */
-                    fprintf(stderr,
-                            "Option -%c requires an operand\n", optopt);
-                    errflg++;
-                	break;
-				////////////////////
-				
-				case 'b':
-					bottom=true;
-					printf("Create Bottom");
-					break;
-				
-				case 's':
-					surface=true;
-					printf("Create Surface");
-					break;
-				
-				case 'c':
-					topo=true;
-					printf("Create Topography");	
-					break;
-				
-				case 'a':
-					ascii=true;
-					break;
-				
-				case '?':
-            		errflg++;
-					print_help();
-				break;
-        	}
-    }
-		
-    for ( ; optind < argc; optind++) {
-        if (access(argv[optind], R_OK)) {
- 			printf("Geht\n");
-			}
-	}
-
-	
-	printf("Opening HDF file...\n");
-	
-    h5file = H5Fopen(hdf_filepath, H5F_ACC_RDONLY, H5P_DEFAULT);
-    if (h5file < 0)
-    {
-        fprintf(stderr, "Could not open HDF5 file \"%s\"\n", argv[1]);
-        return EXIT_FAILURE;
-    }
-
-    
-
-
-    /************************************************************************
-     * Get mesh parameters.                                                 *
-     ************************************************************************/
-
-    /* Read input group */
-    input = H5Gopen(h5file, "input");
-    if (input < 0)
-    {
-        fprintf(stderr, "Could not open /input group in \"%s\"\n", argv[1]);
-        status = H5Fclose(h5file);
-        return EXIT_FAILURE;
-    }
-	
-	
-    status = get_attribute_str(input, "datafile", &datafile);
-    status = get_attribute_int(input, "nproc_surf", &caps);
-    status = get_attribute_int(input, "nodex", &nodex);
-    status = get_attribute_int(input, "nodey", &nodey);
-    status = get_attribute_int(input, "nodez", &nodez);
-	status = get_attribute_float(input,"radius_inner",&radius_inner);
-	status = get_attribute_float(input,"radius_outer",&radius_outer);
-	
-	//Bound input params against hdf
-	if(nodex_redu<nodex & nodex_redu>0)
-	{
-	nodex = nodex_redu;
-	}
-	if(nodey_redu<nodey & nodey_redu>0)
-	{
-	nodey = nodey_redu;
-	}
-	if(nodez_redu<nodez & nodez_redu>0)
-	{
-	nodez = nodez_redu;
-	}
-	
-	
-	printf("Nodex: %d\n",nodex);
-	printf("Nodey: %d\n",nodey);
-	printf("Nodez: %d\n",nodez);
-	printf("Caps: %d\n",caps);
-    /* Release input group */
-    status = H5Gclose(input);
-	
-
-    /************************************************************************
-     * Create fields using cap00 datasets as a template.                    *
-     ************************************************************************/
-
-    cap         = open_cap(h5file, 0);
-    coord       = open_field(cap, "coord");
-    velocity    = open_field(cap, "velocity");
-    temperature = open_field(cap, "temperature");
-    viscosity   = open_field(cap, "viscosity");
-    
-	
-	/*Create fields bottom and surface*/
-	botm_coord = open_field(cap,"botm/coord");
-	botm_hflux = open_field(cap,"botm/heatflux");
-	botm_velo = open_field(cap,"botm/velocity");
-	botm_topo = open_field(cap,"botm/topography");
-	
-	surf_coord = open_field(cap,"surf/coord");
-	surf_hflux = open_field(cap,"surf/heatflux");
-	surf_velo = open_field(cap,"surf/velocity");
-	surf_topo = open_field(cap,"surf/topography");
-	
-	status      = close_cap(cap);
-
-	
-    /************************************************************************
-     * Output requested data.                                               *
-     ************************************************************************/
-	int iterations=0;
-    /* Iterate over timesteps */
-    for(current_t = initial; current_t < timesteps; current_t++)
-    {
-		
-		printf("\nProcessing timestep: %d\n",current_t);
-      
-		
-		coordinates_t ordered_coordinates[((nodex*nodey*nodez)*caps)];
-		coordinates_t ordered_velocity[((nodex*nodey*nodez)*caps)*3];		
-		float ordered_temperature[(nodex*nodey*nodez)*caps];
-		float ordered_viscosity[(nodex*nodey*nodez)*caps];
-		hexahedron_t connectivity[((nodex-1)*(nodey-1)*(nodez-1))*caps];
-		
-		
-		coordinates_t ordered_botm_coords[(nodex*nodey*caps)];
-		float ordered_botm_hflux[(nodex*nodey*caps)];
-		coordinates_t ordered_botm_velocity[(nodex*nodey*caps)];
-		
-		
-		coordinates_t ordered_surf_coords[(nodex*nodey*caps)];
-		float ordered_surf_hflux[(nodex*nodey*caps)];
-		coordinates_t ordered_surf_velocity[(nodex*nodey*caps)];
-		
-		vtk_pixel_t connectivity_surface[(nodex*nodey*caps)];
-		
-		//Holds single coordinate		
-		coordinates_t coordinate;
-		
-		//Holds single vector
-		coordinates_t velocity_vector;
-				
-        /* Iterate over caps */
-		
-		for(capid = 0; capid < caps; capid++)
-        {
-            cap = open_cap(h5file, capid);
-			printf("Processing cap %d of %d\n",capid+1,caps);
-            //snprintf(filename, (size_t)99, "%s.cap%02d.%d", datafile, capid, step);
-            //fprintf(stderr, "Writing %s\n", filename);
-
-            //file = fopen(filename, "w");
-            //fprintf(file, "%d x %d x %d\n", nodex, nodey, nodez);
-
-            /* Read data from HDF5 file. */
-            read_field(cap, coord, 0);
-            read_field(cap, velocity, current_t);
-            read_field(cap, temperature, current_t);
-            read_field(cap, viscosity, current_t);
-			
-			
-			
-    		/*Counts iterations*/
-    		n = 0;
-			
-			//Number of nodes per cap
-			int nodes=nodex*nodey*nodez;
-			
-	        /* Traverse data in Citcom order */
-            for(j = 0; j < nodey; j++)
-            {	
-                for(i = 0; i < nodex; i++)
-                {
-			       for(k = 0; k < nodez; k++)
-                    {       
-								//Coordinates						
-								coordinate.x = coord->data[3*n+0];
-                                coordinate.y = coord->data[3*n+1];
-                                coordinate.z = coord->data[3*n+2];
-								coordinate = rtf_to_xyz(coordinate);
-								ordered_coordinates[n+(capid*nodes)].x = coordinate.x;
-								ordered_coordinates[n+(capid*nodes)].y = coordinate.y;
-								ordered_coordinates[n+(capid*nodes)].z = coordinate.z;
-								
-								//Velocity
-                        	    velocity_vector.x = velocity->data[3*n+0];
-                                velocity_vector.y = velocity->data[3*n+1];
-                                velocity_vector.z = velocity->data[3*n+2];
-						
-								velocity_vector = velocity_to_cart(velocity_vector,coordinate);
-								
-								ordered_velocity[n+(capid*nodes)].x = velocity_vector.x;
-								ordered_velocity[n+(capid*nodes)].y = velocity_vector.y;
-								ordered_velocity[n+(capid*nodes)].z = velocity_vector.z;
-						
-								//Temperature
-                                ordered_temperature[n+(capid*nodes)] = temperature->data[n];
-						
-								//Viscosity
-                                ordered_viscosity[n+(capid*nodes)] = viscosity->data[n];
-								
-								n++;
-                    }
-                }
-            }
-
-			//Create connectivity
-			if(iterations==0)
-			{
-				//For 3d Data 
-            	int i=1;    //Counts X Direction
-            	int j=1;    //Counts Y Direction
-            	int k=1;    //Counts Z Direction
-    		
-            	for(n=0; n<((nodex*nodey*nodez)-(nodex*nodez));n++)
-					{
-						
-                		if ((i%nodez)==0)   //X-Values
-							{
-                    		j++;                 //Count Y-Values
-        					}
-                		if ((j%nodex)==0)
-							{
-                    		k++;                 //Count Z-Values
-                  			}
-							
-                		if (((i%nodez) != 0) && ((j%nodex) != 0))            //Check if Box can be created
-							{
-							//Create Connectivity
-                    		connectivity[cell_counter].c1 = n+(capid*(nodes));
-							connectivity[cell_counter].c2 = connectivity[cell_counter].c1+nodez;
-                    		connectivity[cell_counter].c3 = connectivity[cell_counter].c2+nodez*nodex;
-                    		connectivity[cell_counter].c4 = connectivity[cell_counter].c1+nodez*nodex;
-                    		connectivity[cell_counter].c5 = connectivity[cell_counter].c1+1;
-                    		connectivity[cell_counter].c6 = connectivity[cell_counter].c5+nodez;
-                    		connectivity[cell_counter].c7 = connectivity[cell_counter].c6+nodez*nodex;
-                    		connectivity[cell_counter].c8 = connectivity[cell_counter].c5+nodez*nodex;
-							cell_counter++;
-							}                   	
-                i++;
-				
-      			}
-			}
-			
-
-			
-			
-			//Bottom and Surface
-			
-			if(bottom==true){
-				
-				/*Read Bottom data from HDF5 file.*/
-				read_field(cap,botm_coord,0);
-				read_field(cap,botm_hflux,current_t);
-				read_field(cap,botm_velo,current_t);
-				read_field(cap,botm_topo,current_t);
-				float botm_mean=0.0;	
-				if(topo=true)
-					{
-					botm_mean = calc_mean(botm_topo,nodex,nodey);
-					}					
-				for(n=0;n<nodex*nodey;n++)
-				{
-				//Coordinates						
-				coordinate.x = botm_coord->data[2*n+0];
-    			coordinate.y = botm_coord->data[2*n+1];
-    				if(topo==true)
-					{
-					coordinate.z = radius_inner+(botm_topo->data[n]-botm_mean)*
-						(pow(10.0,21.0)/(pow(6371000,2)/pow(10,-6))/3300*10)/1000;
-					//printf("Z: %f\n",coordinate.z);
-					}
-					else
-					{
-					coordinate.z = radius_inner;
-					}
-					
-				coordinate = rtf_to_xyz(coordinate);
-				ordered_botm_coords[n+(capid*nodex*nodey)].x = coordinate.x;
-				ordered_botm_coords[n+(capid*nodex*nodey)].y = coordinate.y;
-				ordered_botm_coords[n+(capid*nodex*nodey)].z = coordinate.z;
-								
-				ordered_botm_hflux[n+((capid)*nodex*nodey)] = botm_hflux->data[n];
-					
-				velocity_vector.x = botm_velo->data[3*n+0];
-				velocity_vector.y = botm_velo->data[3*n+1];
-				velocity_vector.z = botm_velo->data[3*n+2];
-					
-				velocity_vector = velocity_to_cart(velocity_vector,coordinate);
-					
-				ordered_botm_velocity[n+(capid*nodex*nodey)].x = velocity_vector.x;
-				ordered_botm_velocity[n+(capid*nodex*nodey)].y = velocity_vector.y;
-				ordered_botm_velocity[n+(capid*nodex*nodey)].z = velocity_vector.z;
-								
-				}		
-	
-	
-			}
-			
-			if(surface==true)
-			{
-		
-				/*Read Surface data from HDF5 file.*/
-				read_field(cap,surf_coord,0);
-				read_field(cap,surf_hflux,current_t);
-				read_field(cap,surf_velo,current_t);
-				read_field(cap,surf_topo,current_t);
-				float surf_mean=0.0;
-				if(topo=true)
-					{
-						
-					surf_mean = calc_mean(surf_topo,nodex,nodey);
-					}					
-				for(n=0;n<nodex*nodey;n++)
-				{
-				//Coordinates						
-				coordinate.x = surf_coord->data[2*n+0];
-    			coordinate.y = surf_coord->data[2*n+1];
-    				if(topo==true)
-					{
-					coordinate.z = radius_outer+(surf_topo->data[n]-surf_mean)*
-						(pow(10.0,21.0)/(pow(6371000,2)/pow(10,-6))/3300*10)/1000;
-					//printf("Z: %f\n",coordinate.z);
-					}
-					else
-					{
-					coordinate.z = radius_outer;
-					}
-					
-				coordinate = rtf_to_xyz(coordinate);
-				ordered_surf_coords[n+(capid*nodex*nodey)].x = coordinate.x;
-				ordered_surf_coords[n+(capid*nodex*nodey)].y = coordinate.y;
-				ordered_surf_coords[n+(capid*nodex*nodey)].z = coordinate.z;
-								
-				ordered_surf_hflux[n+((capid)*nodex*nodey)] = botm_hflux->data[n];
-					
-				velocity_vector.x = botm_velo->data[3*n+0];
-				velocity_vector.y = botm_velo->data[3*n+1];
-				velocity_vector.z = botm_velo->data[3*n+2];
-					
-				velocity_vector = velocity_to_cart(velocity_vector,coordinate);
-					
-				ordered_surf_velocity[n+(capid*nodex*nodey)].x = velocity_vector.x;
-				ordered_surf_velocity[n+(capid*nodex*nodey)].y = velocity_vector.y;
-				ordered_surf_velocity[n+(capid*nodex*nodey)].z = velocity_vector.z;
-								
-				}		
-				
-			}
-
-			
-			//Create connectivity information 2d
-			
-			
-			if(iterations==0){
-				if(surface==true | bottom==true)
-					{
-					
-            		for(n=0;n<(nodex*nodey)-nodey;n++)
-						{
-                    	if ((n+1)%nodey!=0){
-							connectivity_surface[cell_counter_surface].c1 = n+(capid*((nodex)*(nodey)));
-                        	connectivity_surface[cell_counter_surface].c2 = connectivity_surface[cell_counter_surface].c1+1;
-							connectivity_surface[cell_counter_surface].c3 = connectivity_surface[cell_counter_surface].c1+nodey;
-							connectivity_surface[cell_counter_surface].c4 = connectivity_surface[cell_counter_surface].c3+1;          
-							cell_counter_surface++;
-							}
-						}
-					}
-				}
-			
-			close_cap(cap);
-        }
-		
-    iterations++;
-		
-	//Write data to file
-	write_vtk_shell(ordered_coordinates, connectivity, ordered_temperature, 
-					   ordered_viscosity, ordered_velocity, nodex, nodey, nodez,
-					   current_t, radius_inner,caps,ascii);
-	
-	if(bottom==true){
-		write_vtk_surface(ordered_botm_coords,connectivity_surface,ordered_botm_hflux,
-						  ordered_botm_velocity,current_t,nodex,nodey,nodez,caps,"bottom");
-	}
-	
-	
-	if(surface==true){
-		write_vtk_surface(ordered_surf_coords,connectivity_surface,ordered_surf_hflux,
-						  ordered_surf_velocity,current_t,nodex,nodey,nodez,caps,"surface");
-	}
-		
-	}//end timesteps loop
-
-    /* Release resources. */
-
-    status = close_field(coord);
-    status = close_field(velocity);
-    status = close_field(temperature);
-    status = close_field(viscosity);
-    status = H5Fclose(h5file);
-
-    return EXIT_SUCCESS;
-}
-
-
-static cap_t *open_cap(hid_t file_id, int capid)
-{
-    cap_t *cap;
-    cap = (cap_t *)malloc(sizeof(cap_t));
-    cap->id = capid;
-    snprintf(cap->name, (size_t)7, "cap%02d", capid);
-    cap->group = H5Gopen(file_id, cap->name);
-    if (cap->group < 0)
-    {
-        free(cap);
-        return NULL;
-    }
-    return cap;
-}
-
-
-static herr_t close_cap(cap_t *cap)
-{
-    herr_t status;
-    if (cap != NULL)
-    {
-        cap->id = -1;
-        cap->name[0] = '\0';
-        status = H5Gclose(cap->group);
-        free(cap);
-    }
-    return 0;
-}
-
-
-static field_t *open_field(cap_t *cap, const char *name)
-{
-    hid_t dataset;
-    hid_t dataspace;
-    herr_t status;
-
-    int d;
-    int rank;
-
-    field_t *field;
-
-    if (cap == NULL)
-        return NULL;
-
-
-    /* Allocate field and initialize. */
-
-    field = (field_t *)malloc(sizeof(field_t));
-
-    field->name = name;
-    field->rank = 0;
-    field->dims = NULL;
-    field->maxdims = NULL;
-    field->n = 0;
-
-    dataset = H5Dopen(cap->group, name);
-    if(dataset < 0)
-    {
-        free(field);
-        return NULL;
-    }
-
-    dataspace = H5Dget_space(dataset);
-    if (dataspace < 0)
-    {
-        free(field);
-        return NULL;
-    }
-
-
-    /* Calculate shape of field. */
-
-    rank = H5Sget_simple_extent_ndims(dataspace);
-
-    field->rank = rank;
-    field->dims = (hsize_t *)malloc(rank * sizeof(hsize_t));
-    field->maxdims = (hsize_t *)malloc(rank * sizeof(hsize_t));
-
-    status = H5Sget_simple_extent_dims(dataspace, field->dims, field->maxdims);
-
-    /* DEBUG
-    printf("Field %s shape (", name);
-    for(d = 0; d < rank; d++)
-        printf("%d,", (int)(field->dims[d]));
-    printf(")\n");
-    // */
-
-
-    /* Allocate memory for hyperslab selection parameters. */
-
-    field->offset = (hsize_t *)malloc(rank * sizeof(hsize_t));
-    field->count  = (hsize_t *)malloc(rank * sizeof(hsize_t));
-
-
-    /* Allocate enough memory for a single time-slice buffer. */
-
-    field->n = 1;
-    if (field->maxdims[0] == H5S_UNLIMITED)
-        for(d = 1; d < rank; d++)
-            field->n *= field->dims[d];
-    else
-        for(d = 0; d < rank; d++)
-            field->n *= field->dims[d];
-
-    field->data = (float *)malloc(field->n * sizeof(float));
-
-
-    /* Release resources. */
-
-    status = H5Sclose(dataspace);
-    status = H5Dclose(dataset);
-
-    return field;
-}
-
-
-static herr_t read_field(cap_t *cap, field_t *field, int timestep)
-{
-    hid_t dataset;
-    hid_t filespace;
-    hid_t memspace;
-    herr_t status;
-
-    int d;
-
-    if (cap == NULL || field == NULL)
-        return -1;
-
-    dataset = H5Dopen(cap->group, field->name);
-
-    if (dataset < 0)
-        return -1;
-
-    for(d = 0; d < field->rank; d++)
-    {
-        field->offset[d] = 0;
-        field->count[d]  = field->dims[d];
-    }
-
-    if (field->maxdims[0] == H5S_UNLIMITED)
-    {
-        field->offset[0] = timestep;
-        field->count[0]  = 1;
-    }
-
-    /* DEBUG
-    printf("Reading step %d on field %s with offset (", timestep, field->name);
-    for(d = 0; d < field->rank; d++) printf("%d,", (int)(field->offset[d]));
-    printf(") and count (");
-    for(d = 0; d < field->rank; d++) printf("%d,", (int)(field->count[d]));
-    printf(")\n");
-    // */
-
-
-    filespace = H5Dget_space(dataset);
-
-    status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
-                                 field->offset, NULL, field->count, NULL);
-
-    memspace = H5Screate_simple(field->rank, field->count, NULL);
-
-    status = H5Dread(dataset, H5T_NATIVE_FLOAT, memspace,
-                     filespace, H5P_DEFAULT, field->data);
-    
-    status = H5Sclose(filespace);
-    status = H5Sclose(memspace);
-    status = H5Dclose(dataset);
-
-    return 0;
-}
-
-
-static herr_t close_field(field_t *field)
-{
-    if (field != NULL)
-    {
-        free(field->dims);
-        free(field->maxdims);
-        free(field->offset);
-        free(field->count);
-        free(field->data);
-        free(field);
-    }
-    return 0;
-}
-
-
-static herr_t get_attribute_str(hid_t obj_id,
-                                const char *attr_name,
-                                char **data)
-{
-    hid_t attr_id;
-    hid_t attr_type;
-    size_t type_size;
-    herr_t status;
-
-    *data = NULL;
-
-    attr_id = H5Aopen_name(obj_id, attr_name);
-    if (attr_id < 0)
-        return -1;
-
-    attr_type = H5Aget_type(attr_id);
-    if (attr_type < 0)
-        goto out;
-
-    /* Get the size */
-    type_size = H5Tget_size(attr_type);
-    if (type_size < 0)
-        goto out;
-
-    /* malloc enough space for the string, plus 1 for trailing '\0' */
-    *data = (char *)malloc(type_size + 1);
-
-    status = H5Aread(attr_id, attr_type, *data);
-    if (status < 0)
-        goto out;
-
-    /* Set the last character to '\0' in case we are dealing with
-     * null padded or space padded strings
-     */
-    (*data)[type_size] = '\0';
-
-    status = H5Tclose(attr_type);
-    if (status < 0)
-        goto out;
-
-    status = H5Aclose(attr_id);
-    if (status < 0)
-        return -1;
-
-    return 0;
-
-out:
-    H5Tclose(attr_type);
-    H5Aclose(attr_id);
-    if (*data)
-        free(*data);
-    return -1;
-}
-
-
-static herr_t get_attribute_int(hid_t input, const char *name, int *val)
-{
-    hid_t attr_id;
-    hid_t type_id;
-    H5T_class_t type_class;
-    size_t type_size;
-
-    herr_t status;
-
-    char *strval;
-
-    attr_id = H5Aopen_name(input, name);
-    type_id = H5Aget_type(attr_id);
-    type_class = H5Tget_class(type_id);
-    type_size = H5Tget_size(type_id);
-
-    H5Tclose(type_id);
-    H5Aclose(attr_id);
-
-    switch(type_class)
-    {
-        case H5T_STRING:
-            status = get_attribute_str(input, name, &strval);
-            if (status < 0) return -1;
-            *val = atoi(strval);
-            free(strval);
-            return 0;
-        case H5T_INTEGER:
-            status = get_attribute(input, name, H5T_NATIVE_INT, val);
-            if (status < 0) return -1;
-            return 0;
-    }
-
-    return -1;
-}
-
-static herr_t get_attribute_float(hid_t input, const char *name, float *val)
-{
-    hid_t attr_id;
-    hid_t type_id;
-    H5T_class_t type_class;
-    size_t type_size;
-
-    herr_t status;
-
-    char *strval;
-
-    attr_id = H5Aopen_name(input, name);
-    type_id = H5Aget_type(attr_id);
-    type_class = H5Tget_class(type_id);
-    type_size = H5Tget_size(type_id);
-
-    H5Tclose(type_id);
-    H5Aclose(attr_id);
-
-    switch(type_class)
-    {
-        case H5T_STRING:
-            status = get_attribute_str(input, name, &strval);
-            if (status < 0) return -1;
-                *val = atof(strval);
-            free(strval);
-            return 0;
-        case H5T_FLOAT:
-            status = get_attribute(input, name, H5T_NATIVE_FLOAT, val);
-            if (status < 0) return -1;
-            return 0;
-    }
-    return -1;
-}
-
-
-static herr_t get_attribute(hid_t obj_id,
-                            const char *attr_name,
-                            hid_t mem_type_id,
-                            void *data)
-{
-    herr_t status;
-
-    status = get_attribute_mem(obj_id, attr_name, mem_type_id, data);
-    if (status < 0)
-        return -1;
-
-    return 0;
-}
-
-
-static herr_t get_attribute_mem(hid_t obj_id,
-                                const char *attr_name,
-                                hid_t mem_type_id,
-                                void *data)
-{
-    hid_t attr_id;
-    herr_t status;
-
-    attr_id = H5Aopen_name(obj_id, attr_name);
-    if (attr_id < 0)
-        return -1;
-
-    status = H5Aread(attr_id, mem_type_id, data);
-    if (status < 0)
-    {
-        H5Aclose(attr_id);
-        return -1;
-    }
-
-    status = H5Aclose(attr_id);
-    if (status < 0)
-        return -1;
-
-    return 0;
-}
-
-
-static herr_t get_attribute_disk(hid_t loc_id,
-                                 const char *attr_name,
-                                 void *attr_out)
-{
-    hid_t attr_id;
-    hid_t attr_type;
-    herr_t status;
-
-    attr_id = H5Aopen_name(loc_id, attr_name);
-    if (attr_id < 0)
-        return -1;
-
-    attr_type = H5Aget_type(attr_id);
-    if (attr_type < 0)
-        goto out;
-
-    status = H5Aread(attr_id, attr_type, attr_out);
-    if (status < 0)
-        goto out;
-
-    status = H5Tclose(attr_type);
-    if (status < 0)
-        goto out;
-
-    status = H5Aclose(attr_id);
-    if (status < 0)
-        return -1;
-
-    return 0;
-out:
-    H5Tclose(attr_type);
-    H5Aclose(attr_id);
-    return -1;
-}
-
-
-static herr_t get_attribute_info(hid_t obj_id,
-                                 const char *attr_name,
-                                 hsize_t *dims,
-                                 H5T_class_t *type_class,
-                                 size_t *type_size,
-                                 hid_t *type_id)
-{
-    hid_t attr_id;
-    hid_t space_id;
-    herr_t status;
-    int rank;
-
-    /* Open the attribute. */
-    attr_id = H5Aopen_name(obj_id, attr_name);
-    if (attr_id < 0)
-        return -1;
-
-    /* Get an identifier for the datatype. */
-    *type_id = H5Aget_type(attr_id);
-
-    /* Get the class. */
-    *type_class = H5Tget_class(*type_id);
-
-    /* Get the size. */
-    *type_size = H5Tget_size(*type_id);
-
-    /* Get the dataspace handle */
-    space_id = H5Aget_space(attr_id);
-    if (space_id < 0)
-        goto out;
-
-    /* Get dimensions */
-    rank = H5Sget_simple_extent_dims(space_id, dims, NULL);
-    if (rank < 0)
-        goto out;
-
-    /* Terminate access to the dataspace */
-    status = H5Sclose(space_id);
-    if (status < 0)
-        goto out;
-
-    /* End access to the attribute */
-    status = H5Aclose(attr_id);
-    if (status < 0)
-        goto out;
-
-    return 0;
-out:
-    H5Tclose(*type_id);
-    H5Aclose(attr_id);
-    return -1;
-}
-
-
-
-static coordinates_t rtf_to_xyz(coordinates_t coord)
-{
-	coordinates_t output;
-	output.x = coord.z * sin(coord.x) * cos(coord.y);
-    output.y = coord.z * sin(coord.x) * sin(coord.y);
-    output.z = coord.z * cos(coord.x);
-	return output;
-}
-
-
-static coordinates_t velocity_to_cart(coordinates_t velocity, coordinates_t coord)
-{
-    
-	coordinates_t output;
-	output.x = velocity.z*sin(coord.x)*cos(coord.y)+velocity.x*cos(coord.x)*cos(coord.y)-velocity.y*sin(coord.y);
-    output.y = velocity.z*sin(coord.x)*sin(coord.y)+velocity.x*cos(coord.x)*sin(coord.y)+velocity.y*cos(coord.y);
-    output.z = velocity.z*cos(coord.x)-velocity.x*sin(coord.x);
-    return output;
-}
-
-static void write_vtk_shell(coordinates_t coordinates[], hexahedron_t connectivity[], float temperature[], 
-						float viscosity[], coordinates_t velocity[], int nodex, int nodey, int nodez,
-						int timestep, float radius_inner,int caps,int ascii)
-{
-	FILE *file;
-    char filename[100];
-    char header[STRING_BUFFER];
-	char puffer;
-	int i;
-	snprintf(filename, (size_t)99, "%s.%d.vtk", "datafile", timestep);
-    fprintf(stderr, "Writing %s\n", filename);
-	file = fopen(filename, "w");
-	int nodes = nodex*nodey*nodez;
-	
-	char *type_info;
-	
-	if(ascii==true)
-	{
-	type_info = "Ascii";
-	}
-	else
-	{
-	type_info = "Binary";
-	}
-	//Write Header
-	sprintf(header,"# vtk DataFile Version 2.0\n\
-CitcomS Output Timestep:%d NX:%d NY:%d NZ:%d Radius_Inner:%f\n\
-%s\n\
-DATASET UNSTRUCTURED_GRID\n",timestep,nodex,nodey,nodez,radius_inner,ascii	?  "ASCII" : "BINARY");
-	fprintf(file,header);
-	
-	
-	fprintf(file, "POINTS %d float\n",nodes*caps);
-	//printf("Float: %d\n",sizeof(float));
-	//printf("Field: %d\n",sizeof(coordinates_t));
-	
-	//Write Coordinates
-	if(ascii==true)
-		{
-		for(i=0;i<nodes*caps;i++)
-			{
-			fprintf(file, "%f %f %f\n",coordinates[i].x,coordinates[i].y,coordinates[i].z);
-			}
-		}
-		else
-		{
-		//fwrite(&coordinates,sizeof(coordinates_t),nodes*caps,file);
-			
-		for(i=0;i<nodes*caps;i++){
-			
-			fwrite(&coordinates[i].x,sizeof(float),1,file);
-			fwrite(&coordinates[i].y,sizeof(float),1,file);			
-			fwrite(&coordinates[i].z,sizeof(float),1,file);			
-			}
-		}
-		
-	int cells = ((nodex-1)*(nodey-1)*(nodez-1))*caps;
-	//Write Cells
-	fprintf(file, "CELLS %d %d\n",cells,cells*9);
-	for(i=0;i<cells;i++)
-		{
-		fprintf(file, "8 %d %d %d %d %d %d %d %d\n",
-					connectivity[i].c1,
-					connectivity[i].c2,
-					connectivity[i].c3,
-					connectivity[i].c4,
-					connectivity[i].c5,
-					connectivity[i].c6,
-					connectivity[i].c7,
-					connectivity[i].c8	
-					);
-		}
-		
-	//Write Cell Types Hexahedron
-	
-		fprintf(file,"CELL_TYPES %d\n",cells);
-		int j=0;
-		for(i=0;i<cells;i++)
-		{
-		fprintf(file,"12 ");
-		j++;
-		if(j==8)				//nicer formating
-			{
-			fprintf(file,"\n");
-			j=0;
-			}
-	
-		}
-		
-		
-		
-	//Write Scalar Temperature
-	fprintf(file,"POINT_DATA %d\n",nodes*caps);
-	fprintf(file,"SCALARS Temperature_scalars float 1\n");
-	fprintf(file,"LOOKUP_TABLE default\n");
-	
-	
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file,"%f ", temperature[i]);
-		
-		if((i+1)%nodex==0)
-			{
-			fprintf(file,"\n");
-			
-			}			
-		}
-
-	
-	//Write Scalar Viscosity
-	fprintf(file,"SCALARS Viscosity_scalars float 1\n");
-	fprintf(file,"LOOKUP_TABLE default\n");
-	
-	
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file,"%f ", viscosity[i]);
-		
-		if((i+1)%nodex==0)
-			{
-			fprintf(file,"\n");
-			
-			}			
-		}
-
-	
-	//Write Velocity Vectors
-	fprintf(file,"Vectors Velocity_vectors float\n");
-	
-	
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file,"%f %f %f \n", velocity[i].x, velocity[i].y, velocity[i].z);
-		}
-		
-		
-
-	fclose(file);
-		
-}
-
-static void write_vtk_surface(coordinates_t coordinates[], vtk_pixel_t connectivity[], 
-						float heatflux[], coordinates_t velocity[],
-						int timestep,int nodex,int nodey,int nodez,int caps, char* filename_prefix)
-{
-	FILE *file;
-    char filename[100];
-    
-	
-	snprintf(filename, (size_t)99, "%s.%d.vtk", filename_prefix, timestep);
-    fprintf(stderr, "Writing %s\n", filename);
-	file = fopen(filename, "w");
-    int i;
-	int nodes = nodex*nodey;
-
-	//Write Header	
-	fprintf(file,"# vtk DataFile Version 2.0\n");
-	fprintf(file,"CitcomS Output %s Timestep:%d NX:%d NY:%d NZ:%d\n",
-				filename_prefix,timestep,nodex,nodey,nodez);
-	
-	fprintf(file, "ASCII\n");
-	fprintf(file, "DATASET UNSTRUCTURED_GRID\n");
-	fprintf(file, "POINTS %d float\n",nodes*caps);
-	
-	//Write Coordinates
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file, "%f %f %f\n",coordinates[i].x,coordinates[i].y,coordinates[i].z);
-		}
-
-	//Write Cells
-	int cells = ((nodex-1)*(nodey-1))*caps;
-	fprintf(file, "CELLS %d %d\n",cells,cells*5);
-	for(i=0;i<(((nodex-1)*(nodey-1))*caps);i++)
-		{
-		fprintf(file, "4 %d %d %d %d\n",
-					connectivity[i].c1,
-					connectivity[i].c2,
-					connectivity[i].c3,
-					connectivity[i].c4
-					);
-		}
-	
-	//Write Cell Types Pixel
-	
-		fprintf(file,"CELL_TYPES %d\n",cells);
-		int j=0;
-		for(i=0;i<cells;i++)
-		{
-		fprintf(file,"8 ");
-		j++;
-		if(j==8)				//nicer formating
-			{
-			fprintf(file,"\n");
-			j=0;
-			}
-	
-		}
-	
-		
-		
-	//Write Scalar Temperature
-	fprintf(file,"POINT_DATA %d\n",nodes*caps);
-	fprintf(file,"SCALARS Temperature_scalars float 1\n");
-	fprintf(file,"LOOKUP_TABLE default\n");
-	
-	
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file,"%f ", heatflux[i]);
-		
-		if((i+1)%nodex==0)
-			{
-			fprintf(file,"\n");
-			}			
-		}
-
-	//Write Velocity Vectors
-	fprintf(file,"Vectors Velocity_vectors float\n");
-	
-	
-	for(i=0;i<nodes*caps;i++)
-		{
-		fprintf(file,"%f %f %f \n", velocity[i].x, velocity[i].y, velocity[i].z);
-		}
-
-	fclose(file);
-}
-
-static float calc_mean(field_t *topo,int nodex,int nodey)
-{
-int i;
-int nodes = (nodex*nodey);
-double f;
-for(i=0;i<nodes;i++)
-	{
-	f = f+topo->data[i];
-	}
-return (float) f/nodes;
-}
-
-
-void print_help(void){
-printf("Converts CitcomS HDF5 file to VTK\n");
-printf("-p, --path [path to hdf] \n\t Specify input file.\n");
-printf("-o, --output [output filename] \n\t Specify the path to the folder for output files.\n");
-printf("-i, --initial [initial timestep] \n\t Specify initial timestep to export. If not \n \
-	\t specified script starts exporting from timestep 0.\n");
-printf("-t, --timestep [max timestep] \n\t Specify to which timestep you want to export. If not\n \
-    \t specified export all all timestep starting from intial timestep.\n");
-printf("-x, --nx_reduce [nx] \n\t Set new nx to reduce output grid.\n");
-printf("-y, --ny_reduce [ny] \n\t Set new ny to reduce output grid.\n");
-printf("-z, --nz_reduce [nz] \n\t Set new nz to reduce output grid.\n");
-printf("-b, --bottom \n\t Set to export Bottom information to Vtk file.\n");
-printf("-s, --surface \n\t Set to export Surface information to Vtk file.\n");
-printf("-c, --createtopo \n\t Set to create topography information in bottom and surface Vtk file.\n");
-printf("-a, --ascii \n\t Create Vtk ASCII encoded files instead if binary.\n");
-printf("-h, --help, -? \n\t Print this help.\n");
-}

Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1,632 +0,0 @@
-#!/usr/bin/env python
-
-#    Script to generate TVTK files from CitcomS hdf files
-#    author: Martin Weier
-#    Copyright (C) 2006 California Institue of Technology 
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-
-
-#import scipy
-import sys
-from datetime import datetime
-from getopt import getopt, GetoptError
-from pprint import *
-from math import *
-import tables        #For HDF support
-import numpy
-import pyvtk
-import sys
-# defaults
-
-path = "./example0.h5"
-vtk_path = "./vtk_output"
-vtkfile  = "%s.%d.vtk"
-
-initial = 0
-timesteps= None
-create_topo = False
-create_bottom = False
-create_surface = False
-create_ascii = False
-nx = None
-ny = None
-nz = None
-nx_redu=None
-ny_redu=None
-nz_redu=None
-el_nx_redu = None
-el_ny_redu = None
-el_nz_redu = None
-radius_inner = None
-radius_outer = None
-nproc_surf = None
-#Filehandler to the HDF file
-f = None
-
-#####################
-polygons3d = []  # arrays containing connectivity information
-polygons2d = []
-counter=0  #Counts iterations of citcom2vtk  
-
-def print_help():
-    print "Program to convert CitcomS HDF to Vtk files.\n"
-    print "-p, --path [path to hdf] \n\t Specify input file."
-    print "-o, --output [output filename] \n\t Specify the path to the folder for output files."
-    print ("-i, --initial [initial timestep] \n\t Specify initial timestep to export. If not \n \
-    \t specified script starts exporting from timestep 0.")
-    print "-t, --timestep [max timestep] \n\t Specify to which timestep you want to export. If not\n \
-    \t specified export all all timestep starting from intial timestep."
-    print "-x, --nx_reduce [nx] \n\t Set new nx to reduce output grid."
-    print "-y, --ny_reduce [ny] \n\t Set new ny to reduce output grid."
-    print "-z, --nz_reduce [nz] \n\t Set new nz to reduce output grid."
-    print "-b, --bottom \n\t Set to export Bottom information to Vtk file."
-    print "-s, --surface \n\t Set to export Surface information to Vtk file."
-    print "-c, --createtopo \n\t Set to create topography information in bottom and surface Vtk file."
-    print "-a, --ascii \n\t Create Vtk ASCII encoded files instead if binary."
-    print "-h, --help, -? \n\t Print this help."
-    
-
-#Iterator for CitcomDataRepresentation(yxz) to VTK(xyz)
-def vtk_iter(nx,ny,nz):
-        for i in xrange(nx):
-            for j in xrange(ny):
-                for k in xrange(nz):
-                    yield k + i * nz + j * nz * nx
-
-#Reduces the CitcomS grid
-def reduce_iter(n,nredu):
-    i=0
-    n_f=float(n)
-    nredu_f=float(nredu)
-    fl=(n_f-1)/nredu_f
-    redu = 0
-    for i in xrange(nredu+1):
-        yield int(round(redu))
-        redu = redu + fl
-
-#Transform Vectors in Spherical to Cartesian Coordinates 2d                         
-#def velocity2cart2d(vel_colat, vel_lon,x , y):
-#    x1 = vel_colat*cos(x)*cos(y)-vel_lon*sin(y)
-#    y1 = vel_colat*cos(x)*sin(y)+vel_lon*cos(y)
-#    z1 = -vel_colat*sin(x)  
-#    return x1,y1,z1
-
-#Converts Spherical to Carthesian Coordinates 2d
-#def RTF2XYZ2d(vel_colat, vel_lon):
-#    x1 = sin(vel_colat)*cos(vel_lon)
-#    y1 = sin(vel_colat)*sin(vel_lon)
-#    z1 = cos(vel_colat)
-#    return x1,y1,z1          
-
-#Transform Vectors in Spherical to Cartesian Coordinates                
-def velocity2cart(vel_colat,vel_long,r, x, y, z):
-    x1 = r*sin(x)*cos(y)+vel_colat*cos(x)*cos(y)-vel_long*sin(y)
-    y1 = r*sin(x)*sin(y)+vel_colat*cos(x)*sin(y)+vel_long*cos(y)
-    z1 = r*cos(x)-vel_colat*sin(x)
-    return x1, y1, z1
-
-
-#Converts Spherical to Cartesian Coordinates
-def RTF2XYZ(thet, phi, r):
-    x = r * sin(thet) * cos(phi)
-    y = r * sin(thet) * sin(phi)
-    z = r * cos(thet)
-    return x, y, z
-
-
-
-#Reads Citcom Files and creates a VTK File
-def citcom2vtk(t):
-    print "Timestep:",t
-   
-    benchmarkstr = ""
-    #Assign create_bottom and create_surface to bottom and surface 
-    #to make them valid in methods namespace
-    bottom = create_bottom
-    surface = create_surface
-    
-    ordered_points = [] #reset Sequences for points   
-    ordered_temperature = []
-    ordered_velocity = []
-    ordered_visc = []
-    
-    #Surface and Bottom Points
-    #Initialize empty sequences
-    surf_vec = []
-    botm_vec = []        
-    surf_topo = []
-    surf_hflux = []
-    botm_topo = []
-    botm_hflux = []
-   
-    surf_points = []
-    botm_points = []
-    
-    for capnr in xrange(nproc_surf):
-        ###Benchmark Point 1 Start##
-        #start = datetime.now()
-        ############################
-        print "Processing cap",capnr+1,"of",nproc_surf
-        cap = f.root._f_getChild("cap%02d" % capnr)
-    
-        #Information from hdf
-        #This information needs to be read only once
-        
-        hdf_coords = cap.coord[:]
-        hdf_velocity = cap.velocity[t]
-        hdf_temperature = cap.temperature[t]
-        hdf_viscosity = cap.viscosity[t]
-        
-        ###Benchmark Point 1 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-        
-        ###Benchmark Point 2 Start##
-        #start = datetime.now()
-        ############################
-        
-        #Create Iterator to change data representation
-        nx_redu_iter = reduce_iter(nx,nx_redu)
-        ny_redu_iter = reduce_iter(ny,ny_redu)
-        nz_redu_iter = reduce_iter(nz,nz_redu)
-        #vtk_i = vtk_iter(el_nx_redu,el_ny_redu,el_nz_redu)
-        
-        # read citcom data - zxy (z fastest)
-        for j in xrange(el_ny_redu):
-            j_redu = ny_redu_iter.next()
-            nx_redu_iter = reduce_iter(nx,nx_redu)
-            for i in xrange(el_nx_redu):
-                i_redu = nx_redu_iter.next()
-                nz_redu_iter = reduce_iter(nz,nz_redu)
-                for k in xrange(el_nz_redu):
-                    k_redu = nz_redu_iter.next()
-                
-                    colat, lon, r = map(float,hdf_coords[i_redu,j_redu,k_redu])
-                    x_coord, y_coord, z_coord = RTF2XYZ(colat,lon,r)
-                    ordered_points.append((x_coord,y_coord,z_coord))
-      
-                    ordered_temperature.append(float(hdf_temperature[i_redu,j_redu,k_redu]))
-                    ordered_visc.append(float(hdf_viscosity[i_redu,j_redu,k_redu]))
-                
-                    
-                    vel_colat, vel_lon , vel_r = map(float,hdf_velocity[i_redu,j_redu,k_redu])
-                    x_velo, y_velo, z_velo = velocity2cart(vel_colat,vel_lon,vel_r, colat,lon , r)
-                    
-                    ordered_velocity.append((x_velo,y_velo,z_velo))                        
-        
-        
-        ##Delete Objects for GC
-        del hdf_coords
-        del hdf_velocity
-        del hdf_temperature
-        del hdf_viscosity
-        
-        ###Benchmark Point 2 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-    
-        ###Benchmark Point 3 Start##
-        #start = datetime.now()
-        ############################
-
-        #Bottom Information from hdf
-        if bottom == True:
-            try:
-                hdf_bottom_coord = cap.botm.coord[:]
-                hdf_bottom_heatflux = cap.botm.heatflux[t]
-                hdf_bottom_topography = cap.botm.topography[t]
-                hdf_bottom_velocity = cap.botm.velocity[t]
-            except:
-                print "\tCould not find bottom information in file.\n \
-                       Set create bottom to false"
-                bottom = False
-        #Surface Information from hdf
-        if surface==True:
-            try:
-                hdf_surface_coord = cap.surf.coord[:]
-                hdf_surface_heatflux = cap.surf.heatflux[t]
-                hdf_surface_topography = cap.surf.topography[t]
-                hdf_surface_velocity = cap.surf.velocity[t]
-            except:
-                print "\tCould not find surface information in file.\n \
-                       Set create surface to false"
-                surface = False
-        
-        ###Benchmark Point 3 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-        
-        
-        ###Benchmark Point 4 Start##
-        #start = datetime.now()
-        ############################
-         
-        #Compute surface/bottom topography mean
-        if create_topo:
-            surf_mean=0.0
-            botm_mean=0.0
-    
-            if surface:
-                for i in xrange(nx):
-                    surf_mean += numpy.mean(hdf_surface_topography[i])
-                surf_mean = surf_mean/ny
-
-            if bottom:
-                for i in xrange(nx):
-                    botm_mean += numpy.mean(hdf_bottom_topography[i])
-                botm_mean = botm_mean/nx
-        
-        
-        
-        ###Benchmark Point 4 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-    
-        ###Benchmark Point 5 Start##
-        #start = datetime.now()
-        ############################
-        
-        #Read Surface and Bottom Data   
-        if bottom==True or surface == True:
-            for i in xrange(nx):
-                for j in xrange(ny):
-                    
-                    
-                    if bottom==True:
-                        #Bottom Coordinates
-                        if create_topo==True:
-                            colat, lon = hdf_bottom_coord[i,j]
-                            x,y,z = RTF2XYZ(colat,lon,radius_inner+float( (hdf_bottom_topography[i,j]-botm_mean)*(10**21)/(6371000**2/10**(-6))/(3300*10)/1000 ))
-                            botm_points.append((x,y,z))
-                        else:
-                            colat, lon = hdf_bottom_coord[i,j]
-                            x,y,z = RTF2XYZ(colat, lon,radius_inner) 
-                            botm_points.append((x,y,z))
-            
-                        #Bottom Heatflux
-                        botm_hflux.append(float(hdf_bottom_heatflux[i,j]))
-            
-                        #Bottom Velocity
-                        vel_colat, vel_lon = map(float,hdf_bottom_velocity[i,j])
-                        x,y,z = velocity2cart(vel_colat,vel_lon, radius_inner, colat, lon, radius_inner)
-                        botm_vec.append((x,y,z))
-            
-                    if surface==True:
-                        #Surface Information
-                        if create_topo==True:
-                            colat,lon = hdf_surface_coord[i,j]
-                            #637100 = Earth radius, 33000 = ?
-                            x,y,z = RTF2XYZ(colat,lon,radius_outer+float( (hdf_surface_topography[i,j]-surf_mean)*(10**21)/(6371000**2/10**(-6))/(3300*10)/1000 ))
-                            surf_points.append((x,y,z))
-                        else:
-                            colat, lon = hdf_surface_coord[i,j]
-                            x,y,z = RTF2XYZ(colat, lon,radius_outer) 
-                            surf_points.append((x,y,z))
-            
-                        #Surface Heatflux
-                        surf_hflux.append(float(hdf_surface_heatflux[i,j]))
-            
-                        #Surface Velocity
-                        vel_colat, vel_lon = map(float,hdf_surface_velocity[i,j])
-                        x,y,z = velocity2cart(vel_colat,vel_lon, radius_outer, colat, lon, radius_outer)
-                        surf_vec.append((x,y,z))
-     
-         #del variables for GC
-        if bottom==True:
-            del hdf_bottom_coord
-            del hdf_bottom_heatflux
-            del hdf_bottom_velocity
-        if surface==True:
-            del hdf_surface_coord
-            del hdf_surface_heatflux
-            del hdf_surface_velocity   
-     
-        ###Benchmark Point 5 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-    
-        ###Benchmark Point 6 Start##
-        #start = datetime.now()
-        ############################
-        
-        
-##################################################################    
-        #Create Connectivity info    
-        if counter==0:
-            #For 3d Data 
-            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_nx_redu)):
-                if (i%el_nz_redu)==0:            #X-Values!!!
-                    j+=1                 #Count Y-Values
-        
-                if (j%el_nx_redu)==0:
-                    k+=1                #Count Z-Values
-                  
-                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
-                    polygons3d.append([n0,n1,n2,n3,n4,n5,n6,n7]) #Hexahedron VTK Representation
-             
-                i+=1
-        
-        
-            if bottom==True or surface==True:
-                #Connectivity for 2d-Data      
-                i=1
-                for n in xrange((nx)*(ny) - ny):
-                    if i%ny!=0 :
-                        n0 = n+(capnr*((nx)*(ny)))
-                        n1 = n0+1
-                        n2 = n0+ny
-                        n3 = n2+1          
-                        polygons2d.append([n0,n1,n2,n3])
-                    i+=1
-        
-        ###Benchmark Point 6 Stop##
-        #delta = datetime.now() - start
-        #benchmarkstr += "%.5lf\n" % (delta.seconds + float(delta.microseconds)/1e6)
-    #print benchmarkstr
-
-#################################################################
-#Write Data to VTK  
-    
-    #benchmarkstr = "\n\nIO:\n"
-    ###Benchmark Point 7 Start##
-    #start = datetime.now()
-    ############################
-        
-    print 'Writing data to vtk...'
-    #Surface Points
-    if surface==True:
-        struct_coords = pyvtk.UnstructuredGrid(surf_points, pixel=polygons2d)                          
-        #topo_scal = pyvtk.Scalars(surf_topo,'Surface Topography', lookup_table='default')
-        hflux_scal = pyvtk.Scalars(surf_hflux,'Surface Heatflux',lookup_table='default')
-        vel_vec = pyvtk.Vectors(surf_vec,'Surface Velocity Vectors')
-        ##
-        tempdata = pyvtk.PointData(hflux_scal,vel_vec)
-        data = pyvtk.VtkData(struct_coords, tempdata,'CitcomS Output %s Timestep %s' % ('surface info',t))
-        if create_ascii:
-            data.tofile(vtk_path + (vtkfile % ('surface',t)),) 
-        else:
-            data.tofile(vtk_path + (vtkfile % ('surface',t)),'binary') 
-        print "Written Surface information to file"
-        
-    ###Benchmark Point 7 Stop##
-    #delta = datetime.now() - start
-    #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-    
-    ###Benchmark Point 8 Start##
-    #start = datetime.now()
-    ############################
-    
-    if bottom==True:
-        #Bottom Points
-        struct_coords = pyvtk.UnstructuredGrid(botm_points, pixel=polygons2d)                          
-        #topo_scal = pyvtk.Scalars(botm_topo,'Bottom Topography','default')
-        hflux_scal = pyvtk.Scalars(botm_hflux,'Bottom Heatflux','default')
-        vel_vec = pyvtk.Vectors(botm_vec,'Bottom Velocity Vectors')
-        ##
-        tempdata = pyvtk.PointData(hflux_scal,vel_vec)
-        data = pyvtk.VtkData(struct_coords, tempdata, 'CitcomS Output %s Timestep %s' % ('Bottom info',t))
-        if create_ascii:
-            data.tofile(vtk_path + (vtkfile % ('bottom',t)))   
-        else:
-            data.tofile(vtk_path + (vtkfile % ('bottom',t)),'binary')
-        print "Written Bottom information to file"
-
-          
-    ###Benchmark Point 8 Stop##
-    #delta = datetime.now() - start
-    #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6)
-    
- 
-    
-    ###Benchmark Point 9 Start##
-    #start = datetime.now()
-    
-    #General Data
-    struct_coords = pyvtk.UnstructuredGrid(ordered_points,hexahedron=polygons3d)
-    vel_vec = pyvtk.Vectors(ordered_velocity, 'Velocity Vectors')
-    temp_scal = pyvtk.Scalars(ordered_temperature,'Temperature Scalars','default')
-    visc_scal = pyvtk.Scalars(ordered_visc,'Viscosity Scalars','default')
-    ##
-    tempdata = pyvtk.PointData(temp_scal,visc_scal,vel_vec)
-    data = pyvtk.VtkData(struct_coords, tempdata, 'CitcomS Output %s Timestep:%d NX:%d NY:%d NZ:%d Radius_Inner:%f' % (path,t,el_nx_redu,el_ny_redu,el_nz_redu,radius_inner))
-    ############################
-    if create_ascii:
-        data.tofile(vtk_path + (vtkfile % ('general',t)))
-    else:
-        data.tofile(vtk_path + (vtkfile % ('general',t)),'binary')  
-    print "Written general data to file"
-
-    ###Benchmark Point 9 Stop##
-    #delta = datetime.now() - start
-    #benchmarkstr += "%.5lf\n" % (delta.seconds + float(delta.microseconds)/1e6)
-
-    
-    #print benchmarkstr
-    #print "\n"
-
-
-
-# parse command line parameters
-def initialize():
-    global path
-    global vtk_path
-    global initial
-    global timesteps
-    global create_topo 
-    global create_bottom 
-    global create_surface 
-    global create_ascii 
-    global nx 
-    global ny 
-    global nz 
-    global nx_redu
-    global ny_redu
-    global nz_redu
-    global el_nx_redu
-    global el_ny_redu
-    global el_nz_redu
-    global radius_inner
-    global radius_outer
-    global nproc_surf
-    global f
-    
-    try:
-        opts, args = getopt(sys.argv[1:], "p:o:i:t:x:y:z:bscah?", ['path=','output=','timestep=','x=','y=','z=','bottom','surface','createtopo','ascii', 'help','?'])
-    except GetoptError, msg:
-        print "Error: %s" % msg
-        sys.exit(1)
-    
-    if len(opts)<=1:
-        print_help()
-        sys.exit(0)
-
-    for opt,arg in opts:
-        if opt in ('-p','--path'):
-            path = arg
-    
-        if opt in ('-o','--output'):
-            vtk_path = arg
-    
-        if opt in ('-i','--initial'):
-            try:
-                initial = int(arg)
-            except ValueError:
-                print "Initial is not a number."
-                sys.exit(1)
-        if opt in ('-t','--timestep'):
-            try:
-                timesteps = int(arg)
-            except ValueError:
-                print "Timestep is not a number."
-                sys.exit(1)
-        if opt in ('-x','--nx_reduce'):
-            try:
-                nx_redu = int(arg)
-            except ValueError:
-                print "NX is not a number."
-    
-        if opt in ('-y','--ny_reduce'):
-            try:
-                ny_redu = int(arg)
-            except ValueError:
-                print "NY is not a number."
-    
-        if opt in ('-z','--nz_reduce'):
-            try:
-                nz_redu = int(arg)
-            except ValueError:
-                print "NZ is not a number."
-    
-        if opt in ('-b','--bottom'):
-            create_bottom = True
-            
-        if opt in ('-s','--surface'):
-            create_surface = True    
-        
-        if opt in ('-c','--createtopo'):
-            create_topo = True
-        
-        if opt in ('-a','--ascii'):
-            create_ascii = True
-        
-        if opt in ('-h','--help'):
-            print_help()
-            sys.exit(0)
-        if opt == '-?':
-            print_help()
-            sys.exit(0)
-        
-
-    f = tables.openFile(path,'r')
-
-    nx = int(f.root.input._v_attrs.nodex)
-    ny = int(f.root.input._v_attrs.nodey)
-    nz = int(f.root.input._v_attrs.nodez)
-
-    #If not defined as argument read from hdf
-    hdf_timesteps = int(f.root.time.nrows)
-
-    if timesteps==None or timesteps>hdf_timesteps:
-        timesteps = hdf_timesteps 
-    
-
-    if nx_redu==None:
-        nx_redu = nx-1 
-    if ny_redu==None:
-        ny_redu = ny-1
-    if nz_redu==None:
-        nz_redu = nz-1
-    
-    if nx_redu>=nx:
-        nx_redu=nx-1
-    if ny_redu>=ny:
-        ny_redu=ny-1
-    if nz_redu>=nz:
-        nz_redu=nz-1
-    
-    el_nx_redu = nx_redu+1
-    el_ny_redu = ny_redu+1
-    el_nz_redu = nz_redu+1
-
-    radius_inner = float(f.root.input._v_attrs.radius_inner) 
-    radius_outer = float(f.root.input._v_attrs.radius_outer)
-    nproc_surf = int(f.root.input._v_attrs.nproc_surf)
-
-
-###############################################################################
-def citcoms_hdf2vtk():
-    global counter
-    #Call initialize to get and set input params
-    initialize()
-    
-    d1 = datetime.now()
-    print "Converting Hdf to Vtk"
-    print "Initial:",initial, "Timesteps:",timesteps 
-    print "NX:",el_nx_redu, "NY:",el_ny_redu, "NZ:", el_nz_redu
-    print "Create Bottom: ",create_bottom, " Create Surface: ", create_surface
-    print "Create Topography: ", create_topo
-
-    for t in xrange(initial,timesteps):
-        start = datetime.now()
-        citcom2vtk(t)
-        counter+=1
-        delta = datetime.now() - start
-        print "\t%.3lf sec" % (delta.seconds + float(delta.microseconds)/1e6)
-
-    d2 = datetime.now()
-    f.close()
-    print "Total: %d seconds" % (d2 - d1).seconds
-###############################################################################
-
-
-
-if __name__ == '__main__':
-    citcoms_hdf2vtk()

Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1,147 +0,0 @@
-#! /usr/bin/env python
-try:
-    import wxversion
-    wxversion.ensureMinimal('2.6')
-except ImportError:
-    pass
-
-from enthought.mayavi.app import Mayavi
-import sys
-from os.path import isfile
-from getopt import getopt, GetoptError
-
-class HdfDisplay(Mayavi):
-    
-    filename = None
-    timestep = 0
-    nx_redu = 0
-    ny_redu = 0
-    nz_redu = 0
-    
-    def run(self):
-
-        from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
-        #import modules here
-        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 re
-        
-        
-        script = self.script
-         
-        #DEFINES
-        orange = (1.0,0.5,0)
-        reduce_factor = 2
-        
-        
-        #Read Hdf file
-        src_hdf = CitcomSHDFUgrid()
-        hexgrid = src_hdf.initialize(self.filename,self.timestep,self.nx_redu,self.ny_redu,self.nz_redu)
-        radius_inner = src_hdf._radius_inner
-        data = VTKDataSource()
-        data.data = hexgrid
-        
-        
-        ###########Display Data############
-        #Create new scene
-        script.new_scene()     
-        script.add_source(data)
-             
-        scap = CitcomSshowCaps()
-        script.add_filter(scap)
-        
-        
-        #Show ScalarCutPlane
-        scp = scalar_cut_plane.ScalarCutPlane()
-        script.add_module(scp)
-        
-        #Add filter for a reduce grid
-        redu = CitcomSreduce()
-        #redu.setvalues(nx,ny,nz)
-        script.add_filter(redu)
-       
-        gly = glyph.Glyph()
-        gly.glyph.glyph_source.scale = 0.082
-        gly.glyph.scale_mode = 'scale_by_scalar'
-        gly.glyph.color_mode = 'color_by_scalar'
-        script.add_module(gly)
-        mm = gly.module_manager
-        mm.scalar_lut_manager.use_default_range = False
-        mm.scalar_lut_manager.data_range = 0.0, 1.0
-        ################### Create CORE ################################
-        #Load VTK Data Sets
-        sphere = tvtk.SphereSource()
-        sphere.radius = radius_inner 
-        sphere.theta_resolution = 24 
-        sphere.phi_resolution = 24
-          
-        # Create a mesh from the data created above.
-        src = VTKDataSource()
-        src.data = sphere.output
-        script.add_source(src)
-        
-        #Show Surface
-        surf_module = surface.Surface()
-        surf_module.actor.property.color = orange
-        script.add_module(surf_module)
-        
-        
-         # to create the rendering scene
-         ## your stuff here
-
-if __name__ == '__main__':
-    mc = HdfDisplay()
-    if len(sys.argv)>=3:
-        mc.filename = sys.argv[1]
-        try:
-            mc.timestep = int(sys.argv[2])
-        except ValueError:
-            print "Timestep is not a number."
-            sys.exit(1)
-        if not isfile(mc.filename):
-            print "File not found."
-            sys.exit(1)
-            
-    else:
-        print "[filename] [timestep] -x [Reduce Grid Size X] -y [Reduce Grid Size X] -z [Reduce Grid Size Z]"
-        sys.exit(0)
-   ##parse for reduction factors 
-    try:
-        opts, args = getopt(sys.argv[3:], "x:y:z:", ['x=','y=','z='])
-    except GetoptError, msg:
-        print "Error: %s" % msg
-        sys.exit(1)
-    
-    for opt,arg in opts:
-        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)
-                
-        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)
-        
-        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)
-        
-    mc.main()

Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_VtkDisplay.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_VtkDisplay.py	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_VtkDisplay.py	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1,129 +0,0 @@
-#! /usr/bin/env python
-try:
-    import wxversion
-    wxversion.ensureMinimal('2.6')
-except ImportError:
-    pass
-
-from enthought.mayavi.app import Mayavi
-import sys
-from os.path import isfile
-
-class VtkDisplay(Mayavi):
- 
-    filename = None
-        
-    def run(self):
-
-        from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
-        #import modules here
-        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
-        from plugins.filter.CitcomSshowCaps import CitcomSshowCaps
-        from plugins.filter.CitcomSreduce import CitcomSreduce
-        import re
-        
-        
-        script = self.script
-        
-        #DEFINES
-        orange = (1.0,0.5,0)
-                
-        ################
-        #Read Meta information
-        meta = ""
-        try:
-            vtk = open(self.filename, "r")
-            vtk.readline()
-            meta = vtk.readline()
-        except IOError:
-            print 'cannot open file'
-        try:
-            print "Reading meta-information"
-            m = re.search('(?<=NX:)\d+', meta)
-            nx = int(m.group(0))
-            print "NX: ", nx
-            m = re.search('(?<=NY:)\d+', meta)
-            ny = int(m.group(0))
-            print "NY: ", ny
-            m = re.search('(?<=NZ:)\d+', meta)
-            nz = int(m.group(0))
-            print "NZ: ", nz
-            m = re.search('(?<=Radius_Inner:)(\d+|.)+', meta)
-            print m.group(0)
-            radius_inner = float(m.group(0))
-            print "Radius Inner: ", radius_inner
-            
-        except ValueError:
-            print "Non-valid meta information in file..."
-    
-        vtk.close()
-        
-        
-        ################
-        
-        #Read Vtk file
-        src_vtkf = VTKFileReader()
-        src_vtkf.initialize(self.filename)
-        
-        ###########Display Data############
-        #Create new scene
-        script.new_scene()     
-        
-        
-        script.add_source(src_vtkf)
-        
-        
-        scap = CitcomSshowCaps()
-        script.add_filter(scap)
-        
-        #Show ScalarCutPlane
-        scp = scalar_cut_plane.ScalarCutPlane()
-        script.add_module(scp)
-        
-        #Add filter for a reduce grid
-        redu = CitcomSreduce()
-        script.add_filter(redu)
-       
-        #Shows Glyph on reduce grid
-        gly = glyph.Glyph()
-        gly.glyph.glyph_source.scale = 0.082
-        gly.glyph.scale_mode = 'scale_by_scalar'
-        gly.glyph.color_mode = 'color_by_scalar'
-        script.add_module(gly)
-        mm = gly.module_manager
-        mm.scalar_lut_manager.use_default_range = False
-        mm.scalar_lut_manager.data_range = 0.0, 1.0
-        ################### Create CORE ################################
-        #Load VTK Data Sets
-        sphere = tvtk.SphereSource()
-        sphere.radius = radius_inner 
-        sphere.theta_resolution = 24 
-        sphere.phi_resolution = 24
-          
-        # Create a mesh from the data created above.
-        src = VTKDataSource()
-        src.data = sphere.output
-        script.add_source(src)
-        
-        #Show Surface
-        surf_module = surface.Surface()
-        surf_module.actor.property.color = orange
-        script.add_module(surf_module)
-        
-        
-         
-         # to create the rendering scene
-         ## your stuff here
-
-if __name__ == '__main__':
-    mc = VtkDisplay()
-    #mc.filename = "/home/maweier/vtk_output_temp/general.0.vtk"
-    mc.filename = sys.argv[1]
-    if isfile(mc.filename):
-        mc.main()
-    else:
-        print "Type filename of Vtkfile to display"
-        sys.exit(1)
\ No newline at end of file

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_Hdf2Vtk.c (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.c)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_Hdf2Vtk.py (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_Hdf2Vtk.py)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_HdfDisplay.py (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_HdfDisplay.py)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/Citcoms_VtkDisplay.py (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/Citcoms_VtkDisplay.py)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/README (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/README)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/__init__.py (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/__init__.py)

Copied: mc/3D/CitcomS/trunk/visual/Mayavi2/Martin/plugins (from rev 5478, mc/3D/CitcomS/trunk/visual/Mayavi2/plugins)

Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/README
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/README	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/README	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1,42 +0,0 @@
-Citcoms_Hdf2Vtk.py is a program to convert CitcomS Hdf files
-to Vtk files. To run it please make sure that you have
-- pyvtk 0.4.66 or above
-- pytables 1.3.1 or a above
-installed.
-
-see Citcoms_Hdf2Vtk.py --help for help.
-It is recommended but not necessary to reduce the grid size by
-specifying a new grid with the options -x|-y|-z [resolution].
-
-################################################################
-To run the Mayavi2 extensions please install the latest version.
-It is recommended to copy this folder to the Mayavi2 root directory.
-Warning these scripts won't work standalone. Always run them out
-of this folder.
-
-To start Mayavi2 with a predefined visualization please
-use:
-
-For Vtk files:
-Citcoms_VtkDisplay.py [path to vtk file]
-
-For Hdf files:
-Citcoms_HdfDisplay.py [path to hdf file] [timestep] 
-It is recommended but not necessary to reduce the grid size by
-specifying a new grid with the options -x|-y|-z [resolution].
-
-################################################################
-To make the new filters and the CitcomS File reader available 
-in the Mayavi2 menu please copy the content of this folder to 
-the Mayavi2 root directory and edit mayavi_ui_plugin_definition.py.
-To see an example have a look at
-plugins/plugin_defs/mayavi_ui_plugin_definition.py.
-Warning: Do not overwrite your file with this one. There is no 
-guarantee that Mayavi will work after this. Please edit the
-files carefully and have in mind that you are editing python code. 
-Always make a backup from the original files.
- 
-
-
-
-

Deleted: mc/3D/CitcomS/trunk/visual/Mayavi2/__init__.py
===================================================================
--- mc/3D/CitcomS/trunk/visual/Mayavi2/__init__.py	2006-12-06 08:16:37 UTC (rev 5478)
+++ mc/3D/CitcomS/trunk/visual/Mayavi2/__init__.py	2006-12-06 08:23:54 UTC (rev 5479)
@@ -1 +0,0 @@
-# Author: Martin Weier



More information about the cig-commits mailing list