def reset_bvh_cache(state, filter_name=None):
    """
    filter_name: if specified, only get rid of things containing this
    """

    static_tags = {t.Semantics.Room, t.Semantics.Cutter}

    def keep_key(k):
        names, tags = k

        if filter_name is not None:
            obj = state.objs[filter_name].obj
            return obj.name not in names

        for n in names:
            if n not in state.objs:
                return False
            ostate = state.objs[n]
            if not ostate.tags.intersection(static_tags):
                return False

        return True

    prev_keys = list(state.bvh_cache.keys())
    for k in prev_keys:
        res = keep_key(k)
        if res:
            continue
        del state.bvh_cache[k]

    logger.debug(
        f"reset_bvh_cache evicted {len(prev_keys) - len(state.bvh_cache)} out of {len(prev_keys)} orig"
    )

    filter_name: if specified, only get rid of things containing this
    
infinigen/core/constraints/evaluator/eval_memo.py