# Path: discretize/tests.py
# def setup_mesh(mesh_type, nC, nDim):
#         def function(cell):
#     def setupMesh(self, nC):
#     def getError(self):
#     def orderTest(self):
# def rosenbrock(x, return_g=True, return_H=True):
# def check_derivative(
#     fctn,
#     x0,
#     num=7,
#     plotIt=True,
#     dx=None,
#     expectedOrder=2,
#     tolerance=0.85,
#     eps=1e-10,
#     ax=None,
# ):
#     def l2norm(x):
#     def plot_it(ax):
# def get_quadratic(A, b, c=0):
#     def Quadratic(x, return_g=True, return_H=True):
#             X, Y = example_curvilinear_grid([nC, nC], kwrd)
#             X, Y, Z = example_curvilinear_grid([nC, nC, nC], kwrd)
#     H = sp.csr_matrix(
#         np.array(
#             [[-400 * x[1] + 1200 * x[0] ** 2 + 2, -400 * x[0]], [-400 * x[0], 200]]
#         )
#     )
#     E0 = np.ones(h.shape)
#     E1 = np.ones(h.shape)
#             H = A
# class OrderTest(unittest.TestCase):


import discretize
import numpy as np
import sympy
import unittest
import scipy.sparse as sp
from discretize import tests
from sympy.abc import r, t, z
class TestCylFaceInnerProducts_Order(tests.OrderTest):

    meshTypes = ["uniformCylMesh"]
    meshDimension = 2

    def getError(self):
        fct = FaceInnerProductFctsIsotropic()
        sig, jv = fct.vectors(self.M)
        Msig = self.M.getFaceInnerProduct(sig)
        return float(fct.sol()) - jv.T.dot(Msig.dot(jv))

    def test_order(self):
        self.orderTest()


class TestCylEdgeInnerProducts_Order(tests.OrderTest):

    meshTypes = ["uniformCylMesh"]
    meshDimension = 2

    def getError(self):
        fct = EdgeInnerProductFctsIsotropic()
        sig, ht = fct.vectors(self.M)
        Msig = self.M.getEdgeInnerProduct(sig)
        return float(fct.sol()) - ht.T.dot(Msig.dot(ht))

    def test_order(self):
        self.orderTest()



# Path: discretize/tests.py
# def setup_mesh(mesh_type, nC, nDim):
#         def function(cell):
#     def setupMesh(self, nC):
#     def getError(self):
#     def orderTest(self):
# def rosenbrock(x, return_g=True, return_H=True):
# def check_derivative(
#     fctn,
#     x0,
#     num=7,
#     plotIt=True,
#     dx=None,
#     expectedOrder=2,
#     tolerance=0.85,
#     eps=1e-10,
#     ax=None,
# ):
#     def l2norm(x):
#     def plot_it(ax):
# def get_quadratic(A, b, c=0):
#     def Quadratic(x, return_g=True, return_H=True):
#             X, Y = example_curvilinear_grid([nC, nC], kwrd)
#             X, Y, Z = example_curvilinear_grid([nC, nC, nC], kwrd)
#     H = sp.csr_matrix(
#         np.array(
#             [[-400 * x[1] + 1200 * x[0] ** 2 + 2, -400 * x[0]], [-400 * x[0], 200]]
#         )
#     )
#     E0 = np.ones(h.shape)
#     E1 = np.ones(h.shape)
#             H = A
# class OrderTest(unittest.TestCase):


# Path: tests/cyl/test_cyl_innerproducts.py
import discretize
import numpy as np
import sympy
import unittest
import scipy.sparse as sp
from discretize import tests
from sympy.abc import r, t, z

class TestCylFaceInnerProducts_Order(tests.OrderTest):

    meshTypes = ["uniformCylMesh"]
    meshDimension = 2

    def getError(self):
        fct = FaceInnerProductFctsIsotropic()
        sig, jv = fct.vectors(self.M)
        Msig = self.M.getFaceInnerProduct(sig)
        return float(fct.sol()) - jv.T.dot(Msig.dot(jv))

    def test_order(self):
        self.orderTest()


class TestCylEdgeInnerProducts_Order(tests.OrderTest):

    meshTypes = ["uniformCylMesh"]
    meshDimension = 2

    def getError(self):
        fct = EdgeInnerProductFctsIsotropic()
        sig, ht = fct.vectors(self.M)
        Msig = self.M.getEdgeInnerProduct(sig)
        return float(fct.sol()) - ht.T.dot(Msig.dot(ht))

    def test_order(self):
        self.orderTest()



class TestCylFaceInnerProductsDiagAnisotropic_Order(tests.OrderTest):