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

Function get_total_volume

python/binary_partition_utils.py:120–142  ·  view source on GitHub ↗

Computes the total pixel volume in a subtree from associated chunk volumes. NOTE: If multiple chunks are owned by the same process, this function may over-count the volume, since all provided grid volumes associated with a given process are counted. Args: partition: a BinaryP

(
    partition: mp.BinaryPartition,
    chunk_volumes: Tuple[mp.grid_volume],
    chunk_owners: onp.ndarray,
)

Source from the content-addressed store, hash-verified

118
119
120def get_total_volume(
121 partition: mp.BinaryPartition,
122 chunk_volumes: Tuple[mp.grid_volume],
123 chunk_owners: onp.ndarray,
124) -> float:
125 """Computes the total pixel volume in a subtree from associated chunk volumes.
126
127 NOTE: If multiple chunks are owned by the same process, this function may
128 over-count the volume, since all provided grid volumes associated with a
129 given process are counted.
130
131 Args:
132 partition: a BinaryPartition subtree to compute the associated volumes for
133 chunk_volumes: associated grid volumes from a simulation, obtained by
134 calling sim.structure.get_chunk_volumes()
135 chunk_owners: list of processes associated with each grid volume, obtained
136 by calling sim.structure.get_chunk_owners()
137
138 Returns:
139 The total pixel volume occupied by all chunks owned by the partition.
140 """
141 my_grid_volumes = get_grid_volumes_in_tree(partition, chunk_volumes, chunk_owners)
142 return sum(pixel_volume(vol) for vol in my_grid_volumes)
143
144
145def get_left_right_total_volumes(

Callers 1

Calls 2

get_grid_volumes_in_treeFunction · 0.85
pixel_volumeFunction · 0.85

Tested by

no test coverage detected