added support for multiple entries per line

This commit is contained in:
Martin Diehl 2014-10-13 13:58:26 +00:00
parent d4d7db9ef0
commit 5e16cdd14f
1 changed files with 11 additions and 8 deletions

View File

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os, sys, math, re, threading, time, string, damask import os, sys, math, re, threading, time, string
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP from optparse import OptionParser
import damask
scriptID = '$Id$' scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1] scriptName = scriptID.split()[1][:-3]
#------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------
def outMentat(cmd,locals): def outMentat(cmd,locals):
@ -196,7 +197,8 @@ def parse_geomFile(content,homog):
microstructures = [] microstructures = []
for line in content[skip:]: for line in content[skip:]:
microstructures.append(int(line.split()[0])) for word in line.split():
microstructures.append(int(word))
return (grid,size,homog,microstructures) return (grid,size,homog,microstructures)
@ -228,14 +230,15 @@ def parse_spectralFile(content,homog):
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
parser = OptionParser(usage='%prog [options] spectral.datafile', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Generate FE hexahedral mesh from spectral description file. Generate FE hexahedral mesh from spectral description file.
Acceptable formats are Acceptable formats are
geom: header plus list of grain numbers or geom: header plus list of grain numbers or
spectral: phi1,Phi,phi2,x,y,z,id,phase. spectral: phi1,Phi,phi2,x,y,z,id,phase.
""" + string.replace(scriptID,'\n','\\n') """, version = scriptID)
)
parser.add_option("-p", "--port", type="int",\ parser.add_option("-p", "--port", type="int",\
dest="port",\ dest="port",\
help="Mentat connection port") help="Mentat connection port")