diff --git a/arraycontext/impl/__init__.py b/arraycontext/impl/__init__.py index 093caeee3247d5d8e93fe1df3854de869718865e..828e834db19623dc9833d99a2aaa824ea6427f55 100644 --- a/arraycontext/impl/__init__.py +++ b/arraycontext/impl/__init__.py @@ -25,40 +25,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - -from typing import Any - - -def _is_meshmode_dofarray(x: Any) -> bool: - try: - from meshmode.dof_array import DOFArray - except ImportError: - return False - else: - return isinstance(x, DOFArray) - - -def _is_pyopencl_array(x: Any) -> bool: - try: - import pyopencl.array as cla - except ImportError: - return False - else: - return isinstance(x, cla.Array) - - -def _flatten_cl_array(ary): - import pyopencl.array as cl - assert isinstance(ary, cl.Array) - - if ary.size == 0: - # Work around https://github.com/inducer/pyopencl/pull/402 - return ary._new_with_changes( - data=None, offset=0, shape=(0,), strides=(ary.dtype.itemsize,)) - if ary.flags.f_contiguous: - return ary.reshape(-1, order="F") - elif ary.flags.c_contiguous: - return ary.reshape(-1, order="C") - else: - raise ValueError("cannot flatten array " - f"with strides {ary.strides} of {ary.dtype}")