# Path: discretize/utils/matrix_utils.py
# def mkvc(x, n_dims=1, **kwargs):
#     """Creates a vector with specified dimensionality.
# 
#     This function converts a :class:`numpy.ndarray` to a vector. In general,
#     the output vector has a dimension of 1. However, the dimensionality
#     can be specified if the user intends to carry out a dot product with
#     a higher order array.
# 
#     Parameters
#     ----------
#     x : array_like
#         An array that will be reorganized and output as a vector. The input array
#         will be flattened on input in Fortran order.
#     n_dims : int
#         The dimension of the output vector. :data:`numpy.newaxis` are appened to the
#         output array until it has this many axes.
# 
#     Returns
#     -------
#     numpy.ndarray
#         The output vector, with at least ``n_dims`` axes.
# 
#     Examples
#     --------
#     Here, we reorganize a simple 2D array as a vector and demonstrate the
#     impact of the *n_dim* argument.
# 
#     >>> from discretize.utils import mkvc
#     >>> import numpy as np
# 
#     >>> a = np.random.rand(3, 2)
#     >>> a
#     array([[0.33534155, 0.25334363],
#            [0.07147884, 0.81080958],
#            [0.85892774, 0.74357806]])
# 
#     >>> v = mkvc(a)
#     >>> v
#     array([0.33534155, 0.07147884, 0.85892774, 0.25334363, 0.81080958,
#            0.74357806])
# 
#     In Higher dimensions:
# 
#     >>> for ii in range(1, 4):
#     ...     v = mkvc(a, ii)
#     ...     print('Shape of output with n_dim =', ii, ': ', v.shape)
#     Shape of output with n_dim = 1 :  (6,)
#     Shape of output with n_dim = 2 :  (6, 1)
#     Shape of output with n_dim = 3 :  (6, 1, 1)
#     """
#     if "numDims" in kwargs:
#         warnings.warn(
#             "The numDims keyword argument has been deprecated, please use n_dims. "
#             "This will be removed in discretize 1.0.0",
#             DeprecationWarning,
#         )
#         n_dims = kwargs["numDims"]
#     if type(x) == np.matrix:
#         x = np.array(x)
# 
#     if hasattr(x, "tovec"):
#         x = x.tovec()
# 
#     if isinstance(x, Zero):
#         return x
# 
#     if not isinstance(x, np.ndarray):
#         raise TypeError("Vector must be a numpy array")
# 
#     if n_dims == 1:
#         return x.flatten(order="F")
#     elif n_dims == 2:
#         return x.flatten(order="F")[:, np.newaxis]
#     elif n_dims == 3:
#         return x.flatten(order="F")[:, np.newaxis, np.newaxis]
# 
# Path: discretize/utils/code_utils.py
# def deprecate_method(new_name, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def new_method(self, *args, **kwargs):
#         class_name = type(self).__name__
#         warnings.warn(
#             f"{class_name}.{old_name} has been deprecated, please use {class_name}.{new_name}."
#             + tag,
#             Warning,
#         )
#         return getattr(self, new_name)(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     new_method.__doc__ = doc
#     return new_method


import os
import numpy as np
import warnings
from discretize.utils import mkvc
from discretize.utils.code_utils import deprecate_method
    from discretize.mixins.vtk_mod import InterfaceTensorread_vtk
        (n_cells) numpy.ndarray
            The model defined on the mesh
        """
        fname = os.path.join(directory, file_name)
        if mesh.dim == 3:
            model = mesh._readModelUBC_3D(fname)
        elif mesh.dim == 2:
            model = mesh._readModelUBC_2D(fname)
        else:
            raise Exception("mesh must be a Tensor Mesh 2D or 3D")
        return model

    def write_model_UBC(mesh, file_name, model, directory=""):
        """Write 2D or 3D tensor model to UBC-GIF formatted file.

        Parameters
        ----------
        file_name : str or file name
            full path for the output mesh file or just its name if directory is specified
        model : (n_cells) numpy.ndarray
        directory : str, optional
            output directory
        """
        fname = os.path.join(directory, file_name)
        if mesh.dim == 3:
            # Reshape model to a matrix
            modelMat = mesh.reshape(model, "CC", "CC", "M")
            # Transpose the axes
            modelMatT = modelMat.transpose((2, 0, 1))
            # Flip z to positive down

# Path: discretize/utils/matrix_utils.py
# def mkvc(x, n_dims=1, **kwargs):
#     """Creates a vector with specified dimensionality.
# 
#     This function converts a :class:`numpy.ndarray` to a vector. In general,
#     the output vector has a dimension of 1. However, the dimensionality
#     can be specified if the user intends to carry out a dot product with
#     a higher order array.
# 
#     Parameters
#     ----------
#     x : array_like
#         An array that will be reorganized and output as a vector. The input array
#         will be flattened on input in Fortran order.
#     n_dims : int
#         The dimension of the output vector. :data:`numpy.newaxis` are appened to the
#         output array until it has this many axes.
# 
#     Returns
#     -------
#     numpy.ndarray
#         The output vector, with at least ``n_dims`` axes.
# 
#     Examples
#     --------
#     Here, we reorganize a simple 2D array as a vector and demonstrate the
#     impact of the *n_dim* argument.
# 
#     >>> from discretize.utils import mkvc
#     >>> import numpy as np
# 
#     >>> a = np.random.rand(3, 2)
#     >>> a
#     array([[0.33534155, 0.25334363],
#            [0.07147884, 0.81080958],
#            [0.85892774, 0.74357806]])
# 
#     >>> v = mkvc(a)
#     >>> v
#     array([0.33534155, 0.07147884, 0.85892774, 0.25334363, 0.81080958,
#            0.74357806])
# 
#     In Higher dimensions:
# 
#     >>> for ii in range(1, 4):
#     ...     v = mkvc(a, ii)
#     ...     print('Shape of output with n_dim =', ii, ': ', v.shape)
#     Shape of output with n_dim = 1 :  (6,)
#     Shape of output with n_dim = 2 :  (6, 1)
#     Shape of output with n_dim = 3 :  (6, 1, 1)
#     """
#     if "numDims" in kwargs:
#         warnings.warn(
#             "The numDims keyword argument has been deprecated, please use n_dims. "
#             "This will be removed in discretize 1.0.0",
#             DeprecationWarning,
#         )
#         n_dims = kwargs["numDims"]
#     if type(x) == np.matrix:
#         x = np.array(x)
# 
#     if hasattr(x, "tovec"):
#         x = x.tovec()
# 
#     if isinstance(x, Zero):
#         return x
# 
#     if not isinstance(x, np.ndarray):
#         raise TypeError("Vector must be a numpy array")
# 
#     if n_dims == 1:
#         return x.flatten(order="F")
#     elif n_dims == 2:
#         return x.flatten(order="F")[:, np.newaxis]
#     elif n_dims == 3:
#         return x.flatten(order="F")[:, np.newaxis, np.newaxis]
# 
# Path: discretize/utils/code_utils.py
# def deprecate_method(new_name, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def new_method(self, *args, **kwargs):
#         class_name = type(self).__name__
#         warnings.warn(
#             f"{class_name}.{old_name} has been deprecated, please use {class_name}.{new_name}."
#             + tag,
#             Warning,
#         )
#         return getattr(self, new_name)(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     new_method.__doc__ = doc
#     return new_method


# Path: discretize/mixins/mesh_io.py
import os
import numpy as np
import warnings
from discretize.utils import mkvc
from discretize.utils.code_utils import deprecate_method
    from discretize.mixins.vtk_mod import InterfaceTensorread_vtk

        (n_cells) numpy.ndarray
            The model defined on the mesh
        """
        fname = os.path.join(directory, file_name)
        if mesh.dim == 3:
            model = mesh._readModelUBC_3D(fname)
        elif mesh.dim == 2:
            model = mesh._readModelUBC_2D(fname)
        else:
            raise Exception("mesh must be a Tensor Mesh 2D or 3D")
        return model

    def write_model_UBC(mesh, file_name, model, directory=""):
        """Write 2D or 3D tensor model to UBC-GIF formatted file.

        Parameters
        ----------
        file_name : str or file name
            full path for the output mesh file or just its name if directory is specified
        model : (n_cells) numpy.ndarray
        directory : str, optional
            output directory
        """
        fname = os.path.join(directory, file_name)
        if mesh.dim == 3:
            # Reshape model to a matrix
            modelMat = mesh.reshape(model, "CC", "CC", "M")
            # Transpose the axes
            modelMatT = modelMat.transpose((2, 0, 1))
            # Flip z to positive down

            modelMatTR = mkvc(modelMatT[::-1, :, :])