#!/usr/bin/env python
"""
The command line interface for ``mesh_part_prep`` allows you to run preperatory
steps needed to transform the output files generated by the `Triangle
<https://www.cs.cmu.edu/~quake/triangle.html>`_ program into `METIS
<http://glaros.dtc.umn.edu/gkhome/metis/metis/overview>`_ compatible input
files.
After installation, you can use::
mesh_part_prep --help
usage: mesh_part_prep [-h] [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] mesh_dir
positional arguments:
mesh_dir Path to the unpartioned mesh directory
optional arguments:
-h, --help show this help message and exit
-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Set the logging level
The only required argument is the path to the mesh::
mesh_part_prep /some/path/goes/here
In this case, the level information is prepended to the ``aux3d.out`` file.
"""
import argparse
import logging
import sys
import mesh_part_prep # PG: Relative import??
[docs]def parse_args():
"""
Parsers command line arguments
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"mesh_dir", help="Path to the unpartioned mesh directory", default=None
)
parser.add_argument(
"-l",
"--log",
dest="logLevel",
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
help="Set the logging level",
)
return parser.parse_args()
[docs]def main():
args = parse_args()
logger = logging.getLogger("mesh_part_prep")
if args.logLevel:
logger.setLevel(level=getattr(logging, args.logLevel))
logger.debug(args)
rm = mesh_part_prep.RawMesh(path=args.mesh_dir)
rm.process()
sys.exit(0)
if __name__ == "__main__":
main()