def gen_alara_main_input(mesh, alara_geom, config, alara_snippet=None): """Create ALARA input file Parameters ---------- mesh : ScdMesh or iMesh.Mesh() Mesh object tagged with material/volume information to be written. alara_geom : string Filename/path for ALARA input file. config : ConfigParser.ConfigParser object Config parser to find optional material dict in. alara_snippet : string Filename/path for snippet file containing non-geom/material input. """ print "Writing alara problem file `{0}'".format(alara_geom) mdict = get_material_dict(config) write_alara_geom(alara_geom, mesh, mdict) if alara_snippet: print "Appending alara snippet file `{0}' to problem file".format(alara_snippet) with open(alara_geom, "a") as f: with open(alara_snippet, "r") as snip: f.write(snip.read())
print "Will use {0} rays per mesh row".format(mmgrid_rays) grid = mmgrid.mmGrid( smesh ) grid.generate( mmgrid_rays, False ) grid.createTags() print "Saving fluxes and materials to `{0}'".format(datafile) smesh.imesh.save(datafile) if visfile != None: print "Producing visualization file `{0}' with mbconvert".format(visfile) os.system('mbconvert {0} {1}'.format(datafile,visfile)) print "Writing alara problem file `{0}'".format(alara_geom) mdict = get_material_dict() write_alara_geom( alara_geom, smesh, mdict ) if alara_snippet: print "Appending alara snippet file `{0}' to problem file".format(alara_snippet) with open(alara_geom,'a') as f: with open(alara_snippet,'r') as snip: f.write(snip.read()) print "Writing alara fluxin file `{0}'".format(fluxin) write_alara_fluxin( fluxin, smesh, backwards=True ) print "It should now be possible to run `alara {0}'".format(alara_geom) print "and proceed to step 2 of the workflow."