Exemplo n.º 1
0
    def test_sum(self):
        M2 = discretize.TensorMesh([np.ones(10), np.ones(20)], "CC")
        block = maps.ParametricEllipsoid(M2) * maps.Projection(
            7, np.r_[1, 2, 3, 4, 5, 6])
        background = (maps.ExpMap(M2) * maps.SurjectFull(M2) *
                      maps.Projection(7, np.r_[0]))

        summap0 = maps.SumMap([block, background])
        summap1 = block + background

        m0 = np.hstack([
            np.random.rand(3),
            np.r_[M2.x0[0], 2 * M2.hx.min()],
            np.r_[M2.x0[1], 4 * M2.hy.min()],
        ])

        self.assertTrue(np.all(summap0 * m0 == summap1 * m0))

        self.assertTrue(summap0.test(m0))
        self.assertTrue(summap1.test(m0))
Exemplo n.º 2
0
# mesh
csx, ncx, npadx = 25.0, 16, 10
csz, ncz, npadz = 25.0, 8, 10
pf = 1.5

# primary mesh
hx = [(csx, ncx), (csx, npadx, pf)]
hz = [(csz, npadz, -pf), (csz, ncz), (csz, npadz, pf)]
meshp = discretize.CylMesh([hx, 1.0, hz], x0="0CC")

# secondary mesh
h = [(csz, npadz - 4, -pf), (csz, ncz), (csz, npadz - 4, pf)]
meshs = discretize.TensorMesh(3 * [h], x0="CCC")

# mappings
primaryMapping = (maps.ExpMap(meshp) * maps.SurjectFull(meshp) *
                  maps.Projection(nP=8, index=[0]))

mapping = (
    maps.ExpMap(meshs) * maps.ParametricBlockInLayer(meshs) *
    maps.Projection(nP=8, index=np.hstack([np.r_[0], np.arange(0, 8)])))

primaryMap2Meshs = (maps.ExpMap(meshs) * maps.SurjectFull(meshs) *
                    maps.Projection(nP=8, index=[0]))


class PrimSecFDEMTest(object):

    # --------------------- Run some tests! --------------------- #
    def DataTest(self):
        print("\nTesting Data")