예제 #1
0
def test_add_ones():
    fields = ModelDataFields()
    fields.new_field_location('node', 12)
    fields.new_field_location('cell', 2)

    fields.add_ones('z', at='node')
    assert_array_equal(np.ones(12), fields['node']['z'])
    assert_array_equal(np.ones(12), fields.field_values('node', 'z'))

    fields.add_ones('z', at='cell')
    assert_array_equal(np.ones(2), fields['cell']['z'])
    assert_array_equal(np.ones(2), fields.field_values('cell', 'z'))
예제 #2
0
def test_add_ones():
    fields = ModelDataFields()
    fields.new_field_location("node", 12)
    fields.new_field_location("cell", 2)

    fields.add_ones("z", at="node")
    assert_array_equal(np.ones(12), fields["node"]["z"])
    assert_array_equal(np.ones(12), fields.field_values("node", "z"))

    fields.add_ones("z", at="cell")
    assert_array_equal(np.ones(2), fields["cell"]["z"])
    assert_array_equal(np.ones(2), fields.field_values("cell", "z"))
예제 #3
0
def test_add_ones():
    fields = ModelDataFields()
    fields.new_field_location("node", 12)
    fields.new_field_location("cell", 2)

    fields.add_ones("z", at="node")
    assert_array_equal(np.ones(12), fields["node"]["z"])
    assert_array_equal(np.ones(12), fields.field_values("node", "z"))

    fields.add_ones("z", at="cell")
    assert_array_equal(np.ones(2), fields["cell"]["z"])
    assert_array_equal(np.ones(2), fields.field_values("cell", "z"))
예제 #4
0
def test_add_ones():
    fields = ModelDataFields()
    fields.new_field_location('node', 12)
    fields.new_field_location('cell', 2)

    fields.add_ones('z', at='node')
    assert_array_equal(np.ones(12), fields['node']['z'])
    assert_array_equal(np.ones(12), fields.field_values('node', 'z'))

    fields.add_ones('z', at='cell')
    assert_array_equal(np.ones(2), fields['cell']['z'])
    assert_array_equal(np.ones(2), fields.field_values('cell', 'z'))
예제 #5
0
def test_add_ones_return_value():
    fields = ModelDataFields()
    fields.new_field_location("node", 12)
    fields.new_field_location("cell", 2)

    rtn_value = fields.add_ones("z", at="node")
    assert_array_equal(rtn_value, np.ones(12))
    assert rtn_value is fields["node"]["z"]
    assert rtn_value is fields.field_values("node", "z")

    rtn_value = fields.add_ones("z", at="cell")
    assert_array_equal(rtn_value, np.ones(2))
    assert rtn_value is fields["cell"]["z"]
    assert rtn_value is fields.field_values("cell", "z")
예제 #6
0
def test_add_ones_return_value():
    fields = ModelDataFields()
    fields.new_field_location('node', 12)
    fields.new_field_location('cell', 2)

    rtn_value = fields.add_ones('z', at='node')
    assert_array_equal(rtn_value, np.ones(12))
    assert_is(rtn_value, fields['node']['z'])
    assert_is(rtn_value, fields.field_values('node', 'z'))

    rtn_value = fields.add_ones('z', at='cell')
    assert_array_equal(rtn_value, np.ones(2))
    assert_is(rtn_value, fields['cell']['z'])
    assert_is(rtn_value, fields.field_values('cell', 'z'))
예제 #7
0
def test_add_ones_return_value():
    fields = ModelDataFields()
    fields.new_field_location("node", 12)
    fields.new_field_location("cell", 2)

    rtn_value = fields.add_ones("z", at="node")
    assert_array_equal(rtn_value, np.ones(12))
    assert rtn_value is fields["node"]["z"]
    assert rtn_value is fields.field_values("node", "z")

    rtn_value = fields.add_ones("z", at="cell")
    assert_array_equal(rtn_value, np.ones(2))
    assert rtn_value is fields["cell"]["z"]
    assert rtn_value is fields.field_values("cell", "z")
예제 #8
0
def test_add_ones_return_value():
    fields = ModelDataFields()
    fields.new_field_location('node', 12)
    fields.new_field_location('cell', 2)

    rtn_value = fields.add_ones('z', at='node')
    assert_array_equal(rtn_value, np.ones(12))
    assert rtn_value is fields['node']['z']
    assert rtn_value is fields.field_values('node', 'z')

    rtn_value = fields.add_ones('z', at='cell')
    assert_array_equal(rtn_value, np.ones(2))
    assert rtn_value is fields['cell']['z']
    assert rtn_value is fields.field_values('cell', 'z')