Cleanup initialisation of coefficient arrays.

这个提交包含在:
Craig Warren
2016-03-01 15:37:34 +00:00
父节点 c51062d3f3
当前提交 8e1d99dda3
共有 2 个文件被更改,包括 9 次插入17 次删除

查看文件

@@ -290,11 +290,11 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
voltagesource.create_material(G)
# Initialise arrays of update coefficients to pass to update functions
G.initialise_std_updatecoeff_arrays(len(G.materials))
G.initialise_std_updatecoeff_arrays()
# Initialise arrays of update coefficients and temporary values if there are any dispersive materials
if Material.maxpoles != 0:
G.initialise_dispersive_arrays(len(G.materials))
G.initialise_dispersive_arrays()
# Calculate update coefficients, store in arrays, and list materials in model
if G.messages:

查看文件

@@ -78,25 +78,17 @@ class FDTDGrid:
self.Hy = np.zeros((self.nx, self.ny + 1, self.nz), dtype=floattype)
self.Hz = np.zeros((self.nx, self.ny, self.nz + 1), dtype=floattype)
def initialise_std_updatecoeff_arrays(self, nummaterials):
"""Initialise arrays for storing update coefficients.
def initialise_std_updatecoeff_arrays(self):
"""Initialise arrays for storing update coefficients."""
self.updatecoeffsE = np.zeros((len(self.materials), 5), dtype=floattype)
self.updatecoeffsH = np.zeros((len(self.materials), 5), dtype=floattype)
Args:
nummaterials (int): Number of materials present in the model.
"""
self.updatecoeffsE = np.zeros((nummaterials, 5), dtype=floattype)
self.updatecoeffsH = np.zeros((nummaterials, 5), dtype=floattype)
def initialise_dispersive_arrays(self, nummaterials):
"""Initialise arrays for storing coefficients when there are dispersive materials present.
Args:
nummaterials (int): Number of materials present in the model.
"""
def initialise_dispersive_arrays(self):
"""Initialise arrays for storing coefficients when there are dispersive materials present."""
self.Tx = np.zeros((Material.maxpoles, self.nx, self.ny + 1, self.nz + 1), dtype=complextype)
self.Ty = np.zeros((Material.maxpoles, self.nx + 1, self.ny, self.nz + 1), dtype=complextype)
self.Tz = np.zeros((Material.maxpoles, self.nx + 1, self.ny + 1, self.nz), dtype=complextype)
self.updatecoeffsdispersive = np.zeros((nummaterials, 3 * Material.maxpoles), dtype=complextype)
self.updatecoeffsdispersive = np.zeros((len(self.materials), 3 * Material.maxpoles), dtype=complextype)
def dispersion_check(waveforms, materials, dx, dy, dz):