def state(n: np.ndarray, intensive: dict, extensive: dict, cell_id, cell_origin, position_in_cell, particles) -> TestableState: assert StateFactory.check_args(n, intensive, extensive) sd_num = len(n) attributes, keys = StateFactory.init_attributes_and_keys(particles, intensive, extensive, sd_num) state = TestableState(n, attributes, keys, cell_id, cell_origin, position_in_cell, particles) state.recalculate_cell_id() return state
def state(n: np.ndarray, intensive: dict, extensive: dict, cell_id, cell_origin, position_in_cell, particles) -> TestableState: assert StateFactory.check_args(n, intensive, extensive) sd_num = len(n) attributes, keys, intensive_start = StateFactory.init_attributes_and_keys(particles, intensive, extensive, sd_num) if particles.mesh is not None: cell_start = np.empty(particles.mesh.n_cell + 1, dtype=int) else: cell_start = np.empty(0) state = TestableState(n, attributes, keys, intensive_start, cell_id, cell_start, cell_origin, position_in_cell, particles) state.recalculate_cell_id() return state