/usr/bin/dolfin-convert is in dolfin-bin 2016.2.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | #! /usr/bin/python
#
# Copyright (C) 2006 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DOLFIN 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#
# Modified by Garth N. Wells (gmsh function)
# Modified by Alexander H. Jarosch (gmsh fix)
# Modified by Angelo Simone (Gmsh and Medit fix)
# Modified by Andy R. Terrel (gmsh fix and triangle function)
# Modified by Magnus Vikstrom (metis and scotch function)
# Modified by Bartosz Sawicki (diffpack function)
# Modified by Gideon Simpson (Exodus II function)
# Modified by Arve Knudsen (move logic into module meshconvert)
# Modified by Kent-Andre Mardal (Star-CD function)
#
# Script for converting between various data formats
import getopt
import sys
import os
from dolfin_utils.commands import getoutput
import re
import warnings
import os.path
from dolfin_utils.meshconvert import meshconvert
def main(argv):
"Main function"
# Get command-line arguments
try:
opts, args = getopt.getopt(argv, "hi:o:", ["help", "input=", "output="])
except getopt.GetoptError:
usage()
sys.exit(2)
# Get options
iformat = None
oformat = None
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-i", "--input"):
iformat = arg
elif opt in ("-o", "--output"):
oformat = arg
# Check that we got two filenames
if not len(args) == 2:
usage()
sys.exit(2)
# Get filenames
ifilename = args[0]
ofilename = args[1]
# Can only convert to XML
if oformat and oformat != "xml":
error("Unable to convert to format %s." % (oformat,))
# Convert to XML
meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
# Order mesh
#os.system("dolfin-order %s" % ofilename)
def usage():
"Display usage"
print """\
Usage: dolfin-convert [OPTIONS] ... input.x output.y
Options:
-h display this help text and exit
-i format specify input format
-o format specify output format
Alternatively, the following long options may be used:
--help same as -h
--input same as -i
--output same as -o
Supported formats:
xml - DOLFIN XML mesh format (current)
xml-old - DOLFIN XML mesh format (DOLFIN 0.6.2 and earlier)
mesh - Medit, generated by tetgen with option -g
Triangle - Triangle file format (input prefix of .ele and .node files)
gmsh - Gmsh, version 2.0 file format
metis - Metis graph file format
scotch - Scotch graph file format
diffpack - Diffpack tetrahedral grid format
abaqus - Abaqus tetrahedral grid format
ExodusII - Sandia Format (requires ncdump utility from NetCDF)
Star-CD - Star-CD tetrahedral grid format
If --input or --output are not specified, the format will
be deduced from the suffix:
.xml - xml
.mesh - mesh
.gmsh - gmsh
.msh - gmsh
.gra - metis
.grf - scotch
.grid - diffpack
.inp - abaqus
.e - Exodus II
.exo - Exodus II
.ncdf - ncdump'ed Exodus II
.vrt and .cell - starcd
"""
if __name__ == "__main__":
main(sys.argv[1:])
|