report box geometry in subgrid relative to main grid

这个提交包含在:
jasminium
2021-01-04 18:21:05 +01:00
父节点 ee6f362b68
当前提交 afa971e4d6
共有 2 个文件被更改,包括 18 次插入4 次删除

查看文件

@@ -91,9 +91,12 @@ class Box(UserObjectGeometry):
# if they havent specfied - go with the grid default
averagebox = grid.averagevolumeobjects
p1, p2 = uip.check_box_points(p1, p2, self.__str__())
xs, ys, zs = p1
xf, yf, zf = p2
p3, p4 = uip.check_box_points(p1, p2, self.__str__())
# find nearest point on grid without translation
p5 = uip.round_to_grid_static_point(p1)
p6 = uip.round_to_grid_static_point(p2)
xs, ys, zs = p3
xf, yf, zf = p4
# Look up requested materials in existing list of material instances
materials = [y for x in materialsrequested for y in grid.materials if y.ID == x]
@@ -134,4 +137,5 @@ class Box(UserObjectGeometry):
build_box(xs, xf, ys, yf, zs, zf, numID, numIDx, numIDy, numIDz, averaging, grid.solid, grid.rigidE, grid.rigidH, grid.ID)
dielectricsmoothing = 'on' if averaging else 'off'
logger.info(self.grid_name(grid) + f"Box from {xs * grid.dx:g}m, {ys * grid.dy:g}m, {zs * grid.dz:g}m, to {xf * grid.dx:g}m, {yf * grid.dy:g}m, {zf * grid.dz:g}m of material(s) {', '.join(materialsrequested)} created, dielectric smoothing is {dielectricsmoothing}.")
logger.info(self.grid_name(grid) + f"Box from {p5[0]:g}m, {p5[1]:g}m, {p5[2]:g}m, to {p6[0]:g}m, {p6[1]:g}m, {p6[2]:g}m of material(s) {', '.join(materialsrequested)} created, dielectric smoothing is {dielectricsmoothing}.")

查看文件

@@ -126,6 +126,11 @@ class MainGridUserInput(UserInput):
"""Function to get the index of a continuous point regardless of the point of origin of the grid."""
return super().discretise_point(p)
def round_to_grid_static_point(self, p):
"""Function to get the index of a continuous point regardless of the point of origin of the grid."""
return super().discretise_point(p) * self.grid.dl
class SubgridUserInput(MainGridUserInput):
"""Class to handle (x, y, z) points supplied by the user in the sub grid.
This class autotranslates points from main grid to subgrid equivalent
@@ -182,4 +187,9 @@ class SubgridUserInput(MainGridUserInput):
def discretise_static_point(self, p):
"""Function to get the index of a continuous point regardless of the point of origin of the grid."""
return super().discretise_point(p)
def round_to_grid_static_point(self, p):
"""Function to get the index of a continuous point regardless of the point of origin of the grid."""
return super().discretise_point(p) * self.grid.dl