Пример #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
Пример #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
Пример #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
Пример #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
Пример #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)
Пример #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)
Пример #7
0
    def test_mutual_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.transform(l1.H(l2)) == l2
Пример #8
0
    def test_lineation_product_operator(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.cross(l2) == l1**l2
Пример #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])
Пример #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])
Пример #11
0
 def test_scalar_product(self):
     lin = Lin.rand()
     assert np.allclose(lin * lin, 1)
Пример #12
0
 def test_equality_for_oposite_dir(self):
     lin = Lin.rand()
     assert lin == -lin
Пример #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)))
Пример #14
0
 def test_scalar_product(self):
     lin = Lin.rand()
     assert np.allclose(lin * lin, 1)
Пример #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])
Пример #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))
Пример #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])
Пример #18
0
    def test_lineation_product_operator(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.cross(l2) == l1 ** l2
Пример #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)))
Пример #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])
Пример #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])
Пример #22
0
    def test_mutual_rotation(self):
        l1, l2 = Lin.rand(), Lin.rand()

        assert l1.transform(l1.H(l2)) == l2
Пример #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))
Пример #24
0
 def test_equality_for_oposite_dir(self):
     lin = Lin.rand()
     assert lin == -lin