예제 #1
0
def test_data_at_opposite():
    sheet = Sheet("emin", *three_faces_sheet())
    geom.update_all(sheet)
    sheet.get_opposite()
    opp = utils.data_at_opposite(sheet,
                                 sheet.edge_df["length"],
                                 free_value=None)

    assert opp.shape == (sheet.Ne, )
    assert opp.loc[0] == 1.0
    assert ~np.isfinite(opp.loc[1])
    opp = utils.data_at_opposite(sheet, sheet.edge_df["length"], free_value=-1)
    assert opp.loc[1] == -1.0
예제 #2
0
def test_data_at_opposite_array():
    sheet = Sheet("emin", *three_faces_sheet())
    geom.update_all(sheet)
    sheet.get_opposite()
    opp = utils.data_at_opposite(sheet,
                                 sheet.edge_df[["dx", "dy"]].to_numpy(),
                                 free_value=None)

    assert opp.shape == (sheet.Ne, 2)
    assert_array_equal(opp.index, sheet.edge_df.index)
예제 #3
0
def test_data_at_opposite_df():
    sheet = Sheet("emin", *three_faces_sheet())
    geom.update_all(sheet)
    sheet.get_opposite()
    opp = utils.data_at_opposite(sheet,
                                 sheet.edge_df[["dx", "dy"]],
                                 free_value=None)

    assert opp.shape == (sheet.Ne, 2)
    assert list(opp.columns) == ["dx", "dy"]