added --float option to translate real-valued grid data

This commit is contained in:
Philip Eisenlohr 2016-11-29 23:59:13 -05:00
parent 814b05e2f6
commit 40de6910b8
2 changed files with 19 additions and 3 deletions

View File

@ -1,13 +1,20 @@
#!/usr/bin/env bash
if [[ "$1" == "-f" || "$1" == "--float" ]]; then
shift
arg='--float'
else
arg=''
fi
for geom in "$@"
do
geom_toTable \
geom_toTable $arg \
< $geom \
| \
vtk_rectilinearGrid > ${geom%.*}.vtk
geom_toTable \
geom_toTable $arg \
< $geom \
| \
vtk_addRectilinearGridData \

View File

@ -19,8 +19,17 @@ Translate geom description into ASCIItable containing position and microstructur
""", version = scriptID)
parser.add_option('--float',
dest = 'real',
action = 'store_true',
help = 'use float input')
parser.set_defaults(real = False,
)
(options, filenames) = parser.parse_args()
datatype = 'f' if options.real else 'i'
# --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
@ -56,7 +65,7 @@ for name in filenames:
# --- read data ------------------------------------------------------------------------------------
microstructure = table.microstructure_read(info['grid'])
microstructure = table.microstructure_read(info['grid'],datatype)
# ------------------------------------------ assemble header ---------------------------------------