예제 #1
0
def test_evaluate_gradient():
    grid = StructuredGrid()
    grid.update_property('Y', grid.nodes[:, 1])
    vector = np.mean(grid.evaluate_gradient(grid.barycentre(), 'Y'), axis=0)
    # vector/=np.linalg.norm(vector)
    assert np.sum(vector - np.array([0, grid.step_vector[1], 0])) == 0
예제 #2
0
def test_evaluate_value():
    grid = StructuredGrid()
    grid.update_property('X', grid.nodes[:, 0])
    assert np.sum(grid.barycentre()[:, 0] -
                  grid.evaluate_value(grid.barycentre(), 'X')) == 0