Prevent int overflow at large model sizes

这个提交包含在:
Nathan Mannall
2025-05-26 10:26:24 +01:00
父节点 bec5e3277f
当前提交 d9120db856
共有 3 个文件被更改,包括 6 次插入2 次删除

查看文件

@@ -776,7 +776,7 @@ class FDTDGrid:
mem_use = 0
for vol in self.fractalvolumes:
mem_use += vol.nx * vol.ny * vol.nz * vol.dtype.itemsize
mem_use += np.prod(vol.start) * vol.dtype.itemsize
for surface in vol.fractalsurfaces:
surfacedims = surface.get_surface_dims()
mem_use += surfacedims[0] * surfacedims[1] * surface.dtype.itemsize

查看文件

@@ -98,6 +98,10 @@ class Model:
def nz(self, value: int):
self.G.nz = value
@property
def cells(self) -> np.int64:
return np.prod(self.G.size)
@property
def dx(self) -> float:
return self.G.dl[0]

查看文件

@@ -133,7 +133,7 @@ class Domain(ModelUserObject):
logger.info(
f"Domain size: {self.domain_size[0]:g} x {self.domain_size[1]:g} x "
+ f"{self.domain_size[2]:g}m ({model.nx:d} x {model.ny:d} x {model.nz:d} = "
+ f"{(model.nx * model.ny * model.nz):g} cells)"
+ f"{(model.cells):g} cells)"
)
# Set mode and switch off appropriate PMLs for 2D models