Changed names of some file writing methods.

这个提交包含在:
craig-warren
2016-03-13 12:34:44 +00:00
父节点 c912b755ad
当前提交 5c5cab2be0

查看文件

@@ -34,7 +34,7 @@ from gprMax.input_cmds_file import python_code_blocks, write_python_processed, c
from gprMax.input_cmds_multiuse import process_multicmds from gprMax.input_cmds_multiuse import process_multicmds
from gprMax.input_cmds_singleuse import process_singlecmds from gprMax.input_cmds_singleuse import process_singlecmds
from gprMax.materials import Material from gprMax.materials import Material
from gprMax.output import prepare_output_file, write_output from gprMax.writer_hdf5 import prepare_hdf5, write_hdf5
from gprMax.pml import build_pmls, update_electric_pml, update_magnetic_pml from gprMax.pml import build_pmls, update_electric_pml, update_magnetic_pml
from gprMax.utilities import update_progress, logo, human_size from gprMax.utilities import update_progress, logo, human_size
from gprMax.yee_cell_build import build_electric_components, build_magnetic_components from gprMax.yee_cell_build import build_electric_components, build_magnetic_components
@@ -333,14 +333,13 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
if dispersion_check(G.waveforms, G.materials, G.dx, G.dy, G.dz): if dispersion_check(G.waveforms, G.materials, G.dx, G.dy, G.dz):
print('\nWARNING: Potential numerical dispersion in the simulation. Check the spatial discretisation against the smallest wavelength present.') print('\nWARNING: Potential numerical dispersion in the simulation. Check the spatial discretisation against the smallest wavelength present.')
# Write files for any geometry views # Write files for any geometry views
if not G.geometryviews and args.geometry_only: if not G.geometryviews and args.geometry_only:
raise GeneralError('No geometry views found.') raise GeneralError('No geometry views found.')
elif G.geometryviews: elif G.geometryviews:
tgeostart = perf_counter() tgeostart = perf_counter()
for geometryview in G.geometryviews: for geometryview in G.geometryviews:
geometryview.write_file(modelrun, numbermodelruns, G) geometryview.write_vtk(modelrun, numbermodelruns, G)
tgeoend = perf_counter() tgeoend = perf_counter()
print('\nGeometry file(s) written in [HH:MM:SS]: {}'.format(datetime.timedelta(seconds=int(tgeoend - tgeostart)))) print('\nGeometry file(s) written in [HH:MM:SS]: {}'.format(datetime.timedelta(seconds=int(tgeoend - tgeostart))))
@@ -349,7 +348,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
# Prepare any snapshot files # Prepare any snapshot files
for snapshot in G.snapshots: for snapshot in G.snapshots:
snapshot.prepare_file(modelrun, numbermodelruns, G) snapshot.prepare_vtk_imagedata(modelrun, numbermodelruns, G)
# Prepare output file # Prepare output file
inputfileparts = os.path.splitext(inputfile) inputfileparts = os.path.splitext(inputfile)
@@ -359,7 +358,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
outputfile = inputfileparts[0] + str(modelrun) + '.out' outputfile = inputfileparts[0] + str(modelrun) + '.out'
sys.stdout.write('\nOutput to file: {}\n'.format(outputfile)) sys.stdout.write('\nOutput to file: {}\n'.format(outputfile))
sys.stdout.flush() sys.stdout.flush()
f = prepare_output_file(outputfile, G) f = prepare_hdf5(outputfile, G)
# Adjust position of sources and receivers if required # Adjust position of sources and receivers if required
if G.srcstepx > 0 or G.srcstepy > 0 or G.srcstepz > 0: if G.srcstepx > 0 or G.srcstepy > 0 or G.srcstepz > 0:
@@ -385,12 +384,12 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
tstepstart = perf_counter() tstepstart = perf_counter()
# Write field outputs to file # Write field outputs to file
write_output(f, timestep, G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G) write_hdf5(f, timestep, G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G)
# Write any snapshots to file # Write any snapshots to file
for snapshot in G.snapshots: for snapshot in G.snapshots:
if snapshot.time == timestep + 1: if snapshot.time == timestep + 1:
snapshot.write_snapshot(G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G) snapshot.write_vtk_imagedata(G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G)
# Update electric field components # Update electric field components
if Material.maxpoles == 0: # All materials are non-dispersive so do standard update if Material.maxpoles == 0: # All materials are non-dispersive so do standard update