MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / main

Function main

Source/driver/set_variables.py:239–267  ·  view source on GitHub ↗

the main driver

()

Source from the content-addressed store, hash-verified

237
238
239def main():
240 """the main driver"""
241
242 # note: you need to put a space at the start of the string
243 # that gives defines so that the '-' is not interpreted as
244 # an option itself
245 # https://stackoverflow.com/questions/16174992/cant-get-argparse-to-read-quoted-string-with-dashes-in-it
246
247 parser = argparse.ArgumentParser()
248 parser.add_argument("--odir", type=str, default="",
249 help="output directory")
250 parser.add_argument("--defines", type=str, default="",
251 help="preprocessor defines to interpret")
252 parser.add_argument("--nadv", type=int, default=0,
253 help="the number of pure advected quantities")
254 parser.add_argument("variables_file", type=str, nargs=1,
255 help="input variable definition file")
256
257 args = parser.parse_args()
258
259 if args.odir != "" and not os.path.isdir(args.odir):
260 try:
261 os.makedirs(args.odir)
262 except FileExistsError:
263 # this exception is needed in case of a race condition
264 # to create the directory by another make target
265 pass
266
267 doit(args.variables_file[0], args.odir, args.defines, args.nadv)
268
269
270if __name__ == "__main__":

Callers 1

set_variables.pyFile · 0.70

Calls 1

doitFunction · 0.70

Tested by

no test coverage detected