2019-05-30 19:05:45 +05:30
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from io import StringIO
|
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
import damask
|
|
|
|
|
|
|
|
|
|
|
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
|
|
scriptID = ' '.join([scriptName,damask.version])
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# MAIN
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [geomfile(s)]', description = """
|
|
|
|
Writes vtk file for visualization.
|
|
|
|
|
|
|
|
""", version = scriptID)
|
|
|
|
|
|
|
|
(options, filenames) = parser.parse_args()
|
|
|
|
if filenames == []: filenames = [None]
|
|
|
|
|
|
|
|
for name in filenames:
|
2020-03-19 23:13:49 +05:30
|
|
|
damask.util.report(scriptName,name)
|
|
|
|
|
|
|
|
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
2019-05-30 19:05:45 +05:30
|
|
|
|
2020-03-19 23:13:49 +05:30
|
|
|
damask.util.croak(geom)
|
2019-05-30 19:05:45 +05:30
|
|
|
|
2020-03-19 23:13:49 +05:30
|
|
|
if name:
|
|
|
|
geom.to_vtk(os.path.splitext(name)[0])
|
|
|
|
else:
|
|
|
|
sys.stdout.write(geom.to_vtk())
|