[exodus] 03/03: Initial python support
Alastair McKinstry
mckinstry at moszumanska.debian.org
Fri Aug 28 10:16:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/experimental/6.09
in repository exodus.
commit d7d56358ba2d40f036d120e1ce267b80ceb7b8d2
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Mon May 4 13:19:58 2015 +0100
Initial python support
---
debian/control | 25 ++++
debian/patches/python3.patch | 303 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 328 insertions(+)
diff --git a/debian/control b/debian/control
index 5eaf04d..f6d3585 100644
--- a/debian/control
+++ b/debian/control
@@ -40,3 +40,28 @@ Description: exodusII datamodel for finite element analysis
finite element analyses. It is used for preprocessing, postprocessing,
as well as code to code data transfer. ExodusII is based on netcdf.
It includes the nemesis parallel extension.
+
+Package: python-exodusii
+Section: python
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}
+Provides: ${python:Provides}
+Description: python wrapper for the ExodusII datamodel
+ EXODUS II is a model developed to store and retrieve transient data for
+ finite element analyses. It is used for preprocessing, postprocessing,
+ as well as code to code data transfer. ExodusII is based on netcdf.
+ .
+ This package provides a Python wrapper to ExodusII.
+
+Package: python3-exodusii
+Section: python
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}
+Provides: ${python:Provides}
+Description: python3 wrapper for the ExodusII datamodel
+ EXODUS II is a model developed to store and retrieve transient data for
+ finite element analyses. It is used for preprocessing, postprocessing,
+ as well as code to code data transfer. ExodusII is based on netcdf.
+ .
+ This package provides a Python3 wrapper to ExodusII.
+
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..c97a8d2
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,303 @@
+Index: exodusii-6.09.dfsg.1/exodus/exodus.py.in
+===================================================================
+--- exodusii-6.09.dfsg.1.orig/exodus/exodus.py.in
++++ exodusii-6.09.dfsg.1/exodus/exodus.py.in
+@@ -33,6 +33,8 @@ Authors: Timothy Shelton (trshelt at sand
+ Greg Sjaardema (gdsjaar at sandia.gov)
+ """
+
++from __future__ import print_function
++
+ import sys
+ sys.dont_write_bytecode = True
+
+@@ -42,6 +44,12 @@ oneline = "Gather from or export to Exod
+ from ctypes import *
+ import os
+
++# For python2-3 compatability
++try:
++ xrange
++except NameError:
++ xrange = range
++
+ def basename(file):
+ """
+ Extract base name from file.
+@@ -237,7 +245,7 @@ class exodus:
+ def __init__(self,file,mode=None,array_type='ctype',title=None,numDims=None,
+ numNodes=None,numElems=None,numBlocks=None,
+ numNodeSets=None,numSideSets=None,io_size=0):
+- print EXODUS_PY_COPYRIGHT
++ print (EXODUS_PY_COPYRIGHT)
+ if mode == None:
+ mode = 'r'
+ if array_type == 'numpy':
+@@ -375,8 +383,8 @@ class exodus:
+ """
+ for rec in info:
+ if len(str(rec)) > MAX_LINE_LENGTH:
+- print "WARNING: max line length reached for one or more info records;"
+- print " info stored to exodus file is incomplete for these records"
++ print ("WARNING: max line length reached for one or more info records;")
++ print (" info stored to exodus file is incomplete for these records")
+ break
+ if self.__ex_put_info_recs(info):
+ return True
+@@ -403,8 +411,8 @@ class exodus:
+ if begin: # inside Sierra block
+ sierra_inp.append(rec)
+ if len(rec) > MAX_LINE_LENGTH:
+- print "WARNING: max line length reached for one or more input lines;"
+- print " input data might be incomplete for these lines"
++ print ("WARNING: max line length reached for one or more input lines;")
++ print (" input data might be incomplete for these lines")
+ break
+ if len(vals) >= 2 and vals[0].lower() == "end" and vals[1].lower() == "sierra":
+ break # end of Sierra block
+@@ -599,7 +607,7 @@ class exodus:
+ ndType = ex_entity_type("EX_NODAL")
+ NDvarNames = self.get_node_variable_names()
+ if name in NDvarNames:
+- print "WARNING:node variable \"", name, "\" already exists."
++ print ("WARNING:node variable \"", name, "\" already exists.")
+ if index > len(NDvarNames):
+ raise Exception, ("ERROR: variable index out of range.")
+ self.__ex_put_variable_name(ndType,index,name)
+@@ -979,9 +987,9 @@ class exodus:
+ ebType = ex_entity_type("EX_ELEM_BLOCK")
+ EBvarNames = self.get_element_variable_names()
+ if name in EBvarNames:
+- print "WARNING:element variable \"", name, "\" already exists."
++ print ("WARNING:element variable \"", name, "\" already exists.")
+ if index > len(EBvarNames):
+- print "index", index, "len", len(EBvarNames)
++ print ("index", index, "len", len(EBvarNames)))
+ raise Exception, ("ERROR: variable index out of range.")
+ self.__ex_put_variable_name(ebType,index,name)
+ return True
+@@ -1236,7 +1244,7 @@ class exodus:
+ nsType = ex_entity_type("EX_NODE_SET")
+ NSvarNames = self.get_node_set_variable_names()
+ if name in NSvarNames:
+- print "WARNING: Node set variable \"", name, "\" already exists."
++ print ("WARNING: Node set variable \"", name, "\" already exists.")
+ if index > len(NSvarNames):
+ raise Exception, ("ERROR: variable index out of range.")
+ self.__ex_put_variable_name(nsType,index,name)
+@@ -1419,7 +1427,7 @@ class exodus:
+ """
+ ssids = self.get_side_set_ids()
+ if ( id not in ssids ):
+- print "WARNING: queried side set ID does not exist in database"
++ print ("WARNING: queried side set ID does not exist in database")
+ return 0
+ (num_side_in_set,num_dist_fact_in_set) = self.__ex_get_side_set_param(id)
+ return num_side_in_set
+@@ -1597,7 +1605,7 @@ class exodus:
+ ssType = ex_entity_type("EX_SIDE_SET")
+ SSvarNames = self.get_side_set_variable_names()
+ if name in SSvarNames:
+- print "WARNING:Side set variable \"", name, "\" already exists."
++ print ("WARNING:Side set variable \"", name, "\" already exists.")
+ if index > len(SSvarNames):
+ raise Exception, ("ERROR: variable index out of range.")
+ self.__ex_put_variable_name(ssType,index,name)
+@@ -1708,9 +1716,9 @@ class exodus:
+ gbType = ex_entity_type("EX_GLOBAL")
+ GlobVarNames = self.get_global_variable_names()
+ if name in GlobVarNames:
+- print "WARNING: global variable \"", name, "\" already exists."
++ print ("WARNING: global variable \"", name, "\" already exists.")
+ if index > len(GlobVarNames):
+- print "index", index, "len", len(GlobVarNames)
++ print ("index", index, "len", len(GlobVarNames))
+ raise Exception, ("ERROR: variable index out of range.")
+ self.__ex_put_variable_name(gbType,index,name)
+ return True
+@@ -1811,7 +1819,7 @@ class exodus:
+ """
+ e.close() -> close the exodus file.
+ """
+- print "Closing exodus file: " + self.fileName
++ print ("Closing exodus file: " + self.fileName)
+ errorInt = EXODUS_LIB.ex_close(self.fileId)
+ if errorInt != 0:
+ raise Exception, ("ERROR: Closing file " + self.fileName + " had problems.")
+@@ -1823,7 +1831,7 @@ class exodus:
+ # --------------------------------------------------------------------
+
+ def __open(self, io_size=0):
+- print "Opening exodus file: " + self.fileName
++ print ("Opening exodus file: " + self.fileName)
+ self.mode = EX_READ
+ if self.modeChar.lower() == "a": self.mode = EX_WRITE
+ if self.modeChar.lower() in ["a","r"] and not os.path.isfile(self.fileName):
+@@ -1986,8 +1994,8 @@ class exodus:
+ info_recs.append(irp.contents.value)
+ for rec in info_recs:
+ if len(rec) > MAX_LINE_LENGTH:
+- print "WARNING: max line length reached for one or more info records;"
+- print " info might be incomplete for these records"
++ print ("WARNING: max line length reached for one or more info records;")
++ print (" info might be incomplete for these records")
+ break
+ return info_recs
+
+@@ -2708,11 +2716,11 @@ class exodus:
+ num_vars = c_int(numVars)
+ current_num = self.__ex_get_variable_param(varType)
+ if current_num.value == num_vars.value:
+- ##print "value already set"
++ ##print ("value already set")
+ return True
+ errorInt = EXODUS_LIB.ex_put_variable_param(self.fileId,var_type,num_vars)
+ if errorInt != 0:
+- print "ERROR code =", errorInt
++ print ("ERROR code =", errorInt)
+ raise Exception, ("ERROR: ex_put_variable_param had problems. This can only be called once per varType.")
+ return True
+
+@@ -2947,20 +2955,20 @@ def copy_mesh(fromFileName, toFileName,
+ numNodes = numNodes, numElems = numElems, numBlocks = numBlks, \
+ numNodeSets = numNodeSets, numSideSets = numSideSets )
+
+- if debugPrint: print "Transfer QA records"
++ if debugPrint: print ("Transfer QA records")
+ qaRecords = exoFrom.get_qa_records()
+ exoTo.put_qa_records( qaRecords )
+
+- if debugPrint: print "Transfer Nodal Coordinates and Names"
++ if debugPrint: print ("Transfer Nodal Coordinates and Names")
+ exoTo.put_coord_names( exoFrom.get_coord_names() )
+ (xCoords,yCoords,zCoords) = exoFrom.get_coords()
+ exoTo.put_coords(xCoords,yCoords,zCoords)
+
+- if debugPrint: print "Transfer Node Id Map"
++ if debugPrint: print ("Transfer Node Id Map")
+ nodeIdMap = exoFrom.get_node_id_map()
+ exoTo.put_node_id_map(nodeIdMap)
+
+- if debugPrint: print "Transfer Element Data"
++ if debugPrint: print ("Transfer Element Data")
+ blkIds = exoFrom.get_elem_blk_ids()
+ for blkId in blkIds:
+ (elemType,numElem,nodesPerElem,numAttr) = exoFrom.elem_blk_info(blkId)
+@@ -2981,11 +2989,11 @@ def copy_mesh(fromFileName, toFileName,
+ blockName = exoFrom.get_elem_blk_name(blkId)
+ exoTo.put_elem_blk_name(blkId,blockName)
+
+- if debugPrint: print "Transfer Element Id Map"
++ if debugPrint: print ("Transfer Element Id Map")
+ elemIdMap = exoFrom.get_elem_id_map()
+ exoTo.put_elem_id_map(elemIdMap)
+
+- if debugPrint: print "Transfer Node Sets"
++ if debugPrint: print ("Transfer Node Sets")
+ if numNodeSets > 0:
+ nodeSetIds = exoFrom.get_node_set_ids()
+ for nsId in nodeSetIds:
+@@ -3006,7 +3014,7 @@ def copy_mesh(fromFileName, toFileName,
+ else:
+ exoTo.put_node_set_property_value(nsId,nodeSetProp,propVal)
+
+- if debugPrint: print "Transfer Side Sets"
++ if debugPrint: print ("Transfer Side Sets")
+ if numSideSets > 0:
+ sideSetIds = exoFrom.get_side_set_ids()
+ for ssId in sideSetIds:
+@@ -3068,18 +3076,18 @@ def transfer_variables(exoFrom, exoTo, a
+ if type(additionalElementVariables) is not list:
+ raise Exception, ("ERROR: additionalElementVariables is not a list.")
+
+- if debugPrint: print "Transfer Info records"
++ if debugPrint: print ("Transfer Info records")
+ numInfoRecs = exoFrom.num_info_records()
+ if numInfoRecs > 0:
+ infoRecs = exoFrom.get_info_records()
+ exoTo.put_info_records( infoRecs )
+- if debugPrint: print "Transfer time values"
++ if debugPrint: print ("Transfer time values")
+ nSteps = exoFrom.num_times()
+ timeVals = exoFrom.get_times()
+ for step in xrange(nSteps):
+ exoTo.put_time( step+1, timeVals[step] )
+
+- if debugPrint: print "Add Global Variables"
++ if debugPrint: print ("Add Global Variables")
+ nNewGlobalVars = len(additionalGlobalVariables)
+ nGlobalVars = exoFrom.get_global_variable_number() + nNewGlobalVars
+ defaultNewVarVals = []
+@@ -3100,7 +3108,7 @@ def transfer_variables(exoFrom, exoTo, a
+ gValues.extend( defaultNewVarVals )
+ exoTo.put_all_global_variable_values(step+1,gValues)
+
+- if debugPrint: print "Add Nodal Variables"
++ if debugPrint: print ("Add Nodal Variables")
+ nNewNodalVars = len(additionalNodalVariables)
+ nOrigNodalVars = exoFrom.get_node_variable_number()
+ nNodalVars = nOrigNodalVars + nNewNodalVars
+@@ -3116,7 +3124,7 @@ def transfer_variables(exoFrom, exoTo, a
+ nValues = exoFrom.get_node_variable_values(nodalVarName,step+1)
+ exoTo.put_node_variable_values(nodalVarName,step+1,nValues)
+
+- if debugPrint: print "Construct Truth Table for additionalElementVariables"
++ if debugPrint: print ("Construct Truth Table for additionalElementVariables")
+ blkIds = exoFrom.get_elem_blk_ids()
+ numBlks = exoFrom.num_blks()
+ newElemVariableNames = []
+@@ -3133,10 +3141,10 @@ def transfer_variables(exoFrom, exoTo, a
+ newElemVariableNames.append( item )
+ newElemVariableBlocks.append( blkIds )
+ else:
+- print "Warning additionalElementVariable item ", item, " is not right type to add."
+- print "should be a string or tuple, skipping"
++ print ("Warning additionalElementVariable item ", item, " is not right type to add.")
++ print ("should be a string or tuple, skipping")
+
+- if debugPrint: print "Add Element Variables"
++ if debugPrint: print ("Add Element Variables")
+ nNewElemVars = len(newElemVariableNames)
+ nOrigElemVars = exoFrom.get_element_variable_number()
+ nElemVars = nOrigElemVars + nNewElemVars
+@@ -3208,7 +3216,7 @@ def add_variables(exo, global_vars = [],
+ if exo.modeChar is 'r':
+ raise Exception, ("ERROR: variables cannot be added to an exodus object in read only mode")
+
+- if debugPrint: print "Add Global Variables"
++ if debugPrint: print ("Add Global Variables")
+ n_new_vars = len(global_vars)
+ n_old_vars = exo.get_global_variable_number()
+ n_vars = n_old_vars + n_new_vars
+@@ -3230,7 +3238,7 @@ def add_variables(exo, global_vars = [],
+ gValues.extend( default_vals )
+ exo.put_all_global_variable_values(step+1, gValues)
+
+- if debugPrint: print "Add Nodal Variables"
++ if debugPrint: print ("Add Nodal Variables")
+ n_new_vars = len(nodal_vars)
+ n_old_vars = exo.get_node_variable_number()
+ n_vars = n_old_vars + n_new_vars
+@@ -3239,7 +3247,7 @@ def add_variables(exo, global_vars = [],
+ for i, var_name in enumerate(nodal_vars):
+ exo.put_node_variable_name(var_name, i + n_old_vars + 1)
+
+- if debugPrint: print "Construct Truth Table for additionalElementVariables"
++ if debugPrint: print ("Construct Truth Table for additionalElementVariables")
+ new_e_var_names = []
+ new_e_var_blks = []
+ blk_ids = exo.get_elem_blk_ids()
+@@ -3255,10 +3263,10 @@ def add_variables(exo, global_vars = [],
+ new_e_var_names.append( item )
+ new_e_var_blks.append( blk_ids )
+ else:
+- print "Warning additionalElementVariable item ", item, " is not right type to add."
+- print "should be a string or tuple, skipping"
++ print ("Warning additionalElementVariable item ", item, " is not right type to add.")
++ print ("should be a string or tuple, skipping")
+
+- if debugPrint: print "Add Element Variables"
++ if debugPrint: print ("Add Element Variables")
+ n_new_vars = len(new_e_var_names)
+ n_old_vars = exo.get_element_variable_number()
+ n_vars = n_old_vars + n_new_vars
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/exodus.git
More information about the debian-science-commits
mailing list