Snapshots are now stored in a created directory with the name of the input file appended with '_snaps'

这个提交包含在:
craig-warren
2016-04-14 17:36:36 +02:00
父节点 1f5947c315
当前提交 32ecceb0a1
共有 4 个文件被更改,包括 11 次插入5 次删除

查看文件

@@ -257,6 +257,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
# Initialise an instance of the FDTDGrid class
G = FDTDGrid()
G.inputfilename = os.path.split(inputfile)[1]
G.inputdirectory = usernamespace['inputdirectory']
# Create built-in materials

查看文件

@@ -27,6 +27,7 @@ class FDTDGrid:
"""Holds attributes associated with the entire grid. A convenient way for accessing regularly used parameters."""
def __init__(self):
self.inputfilename = ''
self.inputdirectory = ''
self.title = ''
self.messages = True

查看文件

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
import sys
import os, sys
import numpy as np
from struct import pack
@@ -77,11 +77,15 @@ class Snapshot:
self.vtk_ny = self.yf - self.ys
self.vtk_nz = self.zf - self.zs
# Construct filename from user-supplied name and model run number
# Create directory and construct filename from user-supplied name and model run number
if numbermodelruns == 1:
self.filename = G.inputdirectory + self.filename + '.vti'
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps')
else:
self.filename = G.inputdirectory + self.filename + '_' + str(modelrun) + '.vti'
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps' + str(modelrun))
if not os.path.exists(snapshotdir):
os.mkdir(snapshotdir)
self.filename = os.path.join(snapshotdir, self.filename + '.vti')
# Calculate number of cells according to requested sampling
self.vtk_xscells = round_value(self.xs / self.dx)