Ejemplo n.º 1
0
    def test_sub_operator__simple(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1 - l2 == l1 - (-l2)

        # Anyway, axial sub is commutative.
        assert l1 - l2 == l2 - l1
Ejemplo n.º 2
0
    def test_add_operator__simple(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1 + l2 == l1 + (-l2)

        # Anyway, axial add is commutative.
        assert l1 + l2 == l2 + l1
Ejemplo n.º 3
0
    def test_sub_operator__simple(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1 - l2 == l1 - (-l2)

        # Anyway, axial sub is commutative.
        assert l1 - l2 == l2 - l1
Ejemplo n.º 4
0
    def test_add_operator__simple(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1 + l2 == l1 + (-l2)

        # Anyway, axial add is commutative.
        assert l1 + l2 == l2 + l1
Ejemplo n.º 5
0
 def test_pair_equal(self):
     n, lin = Lin.rand(), Lin.rand()
     fol = n**lin
     p = Pair.from_pair(fol, lin)
     assert p == Pair.from_pair(fol, lin)
     assert p == Pair.from_pair(fol, -lin)
     assert p == Pair.from_pair(-fol, lin)
     assert p == Pair.from_pair(-fol, -lin)
Ejemplo n.º 6
0
def test_pair_equal():
    n, lin = Lin.rand(), Lin.rand()
    fol = n ** lin
    p = Pair.from_pair(fol, lin)
    assert p == Pair.from_pair(fol, lin)
    assert p == Pair.from_pair(fol, -lin)
    assert p == Pair.from_pair(-fol, lin)
    assert p == Pair.from_pair(-fol, -lin)
Ejemplo n.º 7
0
    def test_mutual_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.transform(l1.H(l2)) == l2
Ejemplo n.º 8
0
    def test_lineation_product_operator(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.cross(l2) == l1**l2
Ejemplo n.º 9
0
    def test_lineation_product(self):
        l1, l2 = Lin.rand(), Lin.rand()
        p = l1.cross(l2)

        assert np.allclose([p.angle(l1), p.angle(l2)], [90, 90])
Ejemplo n.º 10
0
    def test_cross_product(self):
        l1, l2 = Lin.rand(), Lin.rand()
        p = l1**l2

        assert np.allclose([p.angle(l1), p.angle(l2)], [90, 90])
Ejemplo n.º 11
0
 def test_scalar_product(self):
     lin = Lin.rand()
     assert np.allclose(lin * lin, 1)
Ejemplo n.º 12
0
 def test_equality_for_oposite_dir(self):
     lin = Lin.rand()
     assert lin == -lin
Ejemplo n.º 13
0
    def test_angle_under_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()
        D = DefGrad.from_axis(Lin(45, 45), 60)

        assert np.allclose(l1.angle(l2), l1.transform(D).angle(l2.transform(D)))
Ejemplo n.º 14
0
 def test_scalar_product(self):
     lin = Lin.rand()
     assert np.allclose(lin * lin, 1)
Ejemplo n.º 15
0
    def test_cross_product(self):
        l1, l2 = Lin.rand(), Lin.rand()
        p = l1**l2

        assert np.allclose([p.angle(l1), p.angle(l2)], [90, 90])
Ejemplo n.º 16
0
def test_orthogonality_rotation_matrix():
    lin = Lin.rand()
    a = np.random.randint(180)
    R = DefGrad.from_axis(lin, a)
    assert np.allclose(R * R.T, np.eye(3))
Ejemplo n.º 17
0
    def test_lineation_product(self):
        l1, l2 = Lin.rand(), Lin.rand()
        p = l1.cross(l2)

        assert np.allclose([p.angle(l1), p.angle(l2)], [90, 90])
Ejemplo n.º 18
0
    def test_lineation_product_operator(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.cross(l2) == l1 ** l2
Ejemplo n.º 19
0
    def test_angle_under_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()
        D = DefGrad.from_axis(Lin(45, 45), 60)

        assert np.allclose(l1.angle(l2),
                           l1.transform(D).angle(l2.transform(D)))
Ejemplo n.º 20
0
def test_stress_invariants_under_rotation():
    S = Stress.from_comp(xx=4, yy=6, zz=8, xy=1, xz=2)
    lin = Lin.rand()
    a = np.random.randint(180)
    Sr = S.rotate(lin, a)
    assert np.allclose([S.I1, S.I2, S.I3], [Sr.I1, Sr.I2, Sr.I3])
Ejemplo n.º 21
0
def test_stress_invariants_under_rotation():
    S = Stress.from_comp(xx=4, yy=6, zz=8, xy=1, xz=2)
    lin = Lin.rand()
    a = np.random.randint(180)
    Sr = S.rotate(lin, a)
    assert np.allclose([S.I1, S.I2, S.I3], [Sr.I1, Sr.I2, Sr.I3])
Ejemplo n.º 22
0
    def test_mutual_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.transform(l1.H(l2)) == l2
Ejemplo n.º 23
0
def test_orthogonality_rotation_matrix():
    lin = Lin.rand()
    a = np.random.randint(180)
    R = DefGrad.from_axis(lin, a)
    assert np.allclose(R * R.T, np.eye(3))
Ejemplo n.º 24
0
 def test_equality_for_oposite_dir(self):
     lin = Lin.rand()
     assert lin == -lin