MCPcopy Create free account
hub / github.com/NanoComp/meep / _is_outer_boundary

Method _is_outer_boundary

python/simulation.py:2133–2157  ·  view source on GitHub ↗
(self, vol: Volume, direction: int, side: int)

Source from the content-addressed store, hash-verified

2131 )
2132
2133 def _is_outer_boundary(self, vol: Volume, direction: int, side: int):
2134
2135 if direction == mp.X:
2136 cell_size_in_dir = self.cell_size.x
2137 elif direction == mp.Y:
2138 cell_size_in_dir = self.cell_size.y
2139 else:
2140 cell_size_in_dir = self.cell_size.z
2141
2142 half_cell_size = cell_size_in_dir / 2
2143 # TODO: Support shifted origins
2144
2145 def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
2146 return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
2147
2148 if side == mp.Low and isclose(
2149 vol.get_min_corner().in_direction(direction), -half_cell_size
2150 ):
2151 return True
2152 if side == mp.High and isclose(
2153 vol.get_max_corner().in_direction(direction), half_cell_size
2154 ):
2155 return True
2156
2157 return False
2158
2159 def _get_chunk_communication_area(self, vol: Volume):
2160

Callers 1

get_num_pixelsMethod · 0.95

Calls 3

get_min_cornerMethod · 0.80
get_max_cornerMethod · 0.80
in_directionMethod · 0.45

Tested by

no test coverage detected