示例#1
0
def test_get_foundation_locations_quanfound(mocker):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.foundloc = None
    
    lineangs = [0., 2 * math.pi / 3, 4 *  math.pi / 3]
    
    test = Loads(variables)
    
    with pytest.raises(AssertionError):
        test._get_foundation_locations(lineangs, 4)
示例#2
0
def test_get_foundation_locations_foundloc(mocker):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.foundloc = np.array([[0.0, 13.333, 0],
                                   [7.5, -6.667, 0],
                                   [-7.5, -6.667, 0]])
    
    lineangs = [math.pi / 3., math.pi / 3, math.pi / 3]
    
    test = Loads(variables)
    result = test._get_foundation_locations(lineangs)
    
    assert np.isclose(result, variables.foundloc).all()
示例#3
0
def test_get_foundation_locations_prefootrad(mocker):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.foundloc = None
    variables.prefootrad = 10.
    
    lineangs = [0., 2 * math.pi / 3, 4 *  math.pi / 3]
    
    test = Loads(variables)
    result = test._get_foundation_locations(lineangs)
    
    expected = np.array([[0., 10., 0.],
                         [5 * math.sqrt(3), -5., 0.],
                         [-5 * math.sqrt(3), -5., 0.]])
    
    assert np.isclose(result, expected).all()
示例#4
0
def test_get_foundation_locations_meandepth(mocker, bathygrid):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.foundloc = None
    variables.prefootrad = None
    variables.bathygrid = bathygrid
    
    lineangs = [0., 2 * math.pi / 3, 4 *  math.pi / 3]
    
    test = Loads(variables)
    result = test._get_foundation_locations(lineangs)
    
    expected = np.array([[0., 240., 0.],
                         [120 * math.sqrt(3), -120., 0.],
                         [-120 * math.sqrt(3), -120., 0.]])
        
    assert np.isclose(result, expected).all()