Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #336 from simphony/revert-331-remove-material-id
Browse files Browse the repository at this point in the history
Revert "Problem: MATERIAL_ID is removed but simphony depends on it"
  • Loading branch information
stefanoborini committed Oct 26, 2016
2 parents 5eee250 + 1113179 commit 7cce9da
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
1 change: 1 addition & 0 deletions simphony/core/cuba.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ class CUBA(IntEnum):
SURFACE_TENSION = 186
RELAXATION_TIME = 187
MULTIPHASE_MODEL = 188
MATERIAL_ID = 189
8 changes: 7 additions & 1 deletion simphony/core/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,5 +1141,11 @@
definition='Multiphase model', # noqa
key='MULTIPHASE_MODEL',
shape=[1],
dtype=None)
dtype=None),
'MATERIAL_ID': Keyword(
name='MaterialId',
definition='Material identification number', # noqa
key='MATERIAL_ID',
shape=[1],
dtype=numpy.int32),
}
15 changes: 8 additions & 7 deletions simphony/io/tests/test_data_container_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

class CustomData(tables.IsDescription):

name = tables.StringCol(pos=0, itemsize=20)
direction = tables.Float64Col(pos=1, shape=3)
status = tables.Int32Col(pos=2)
label = tables.Int32Col(pos=3)
chemical_specie = tables.StringCol(pos=5, itemsize=20)
rolling_friction = tables.Float64Col(pos=6)
volume_fraction = tables.Float64Col(pos=7)
name = tables.StringCol(pos=0, itemsize=20)
direction = tables.Float64Col(pos=1, shape=3)
status = tables.Int32Col(pos=2)
label = tables.Int32Col(pos=3)
material_id = tables.Int32Col(pos=4)
chemical_specie = tables.StringCol(pos=5, itemsize=20)
rolling_friction = tables.Float64Col(pos=6)
volume_fraction = tables.Float64Col(pos=7)


class CustomRecord(tables.IsDescription):
Expand Down
7 changes: 3 additions & 4 deletions simphony/io/tests/test_h5_cuds.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,13 @@ def test_add_get_dataset_with_cuba_keys_argument(self):

# Add some CUBA data
for node in reference.iter_nodes():
node.data = DataContainer({CUBA.NAME: 'test_container'})
node.data = DataContainer({CUBA.MATERIAL_ID: 1})
expected.update_nodes([node])
node.data = DataContainer({CUBA.NAME: 'test_container',
CUBA.DENSITY: 2})
node.data = DataContainer({CUBA.MATERIAL_ID: 1, CUBA.DENSITY: 2})
reference.update_nodes([node])

# Store reference dataset along with its data
engine.add_dataset(reference, {CUDSItem.NODE: [CUBA.NAME]})
engine.add_dataset(reference, {CUDSItem.NODE: [CUBA.MATERIAL_ID]})

# Closing and reopening the file
engine.close()
Expand Down
6 changes: 4 additions & 2 deletions simphony/io/tests/test_h5_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@


class CustomRecord(tables.IsDescription):

class data(tables.IsDescription):

material_id = tables.Int32Col(pos=0)
velocity = tables.Float64Col(pos=1, shape=3)
density = tables.Float64Col(pos=2)

Expand Down Expand Up @@ -128,7 +130,7 @@ def container_factory(self, name, primitive_cell, size, origin):
origin, record=CustomRecord)

def supported_cuba(self):
return [CUBA.VELOCITY, CUBA.DENSITY]
return [CUBA.VELOCITY, CUBA.MATERIAL_ID, CUBA.DENSITY]


class TestH5LatticeCustomNodeOperations(
Expand All @@ -152,7 +154,7 @@ def container_factory(self, name, primitive_cell, size, origin):
origin, record=CustomRecord)

def supported_cuba(self):
return [CUBA.VELOCITY, CUBA.DENSITY]
return [CUBA.VELOCITY, CUBA.MATERIAL_ID, CUBA.DENSITY]


class TestH5LatticeVersions(unittest.TestCase):
Expand Down
1 change: 1 addition & 0 deletions simphony/io/tests/test_indexed_data_container_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CustomData(tables.IsDescription):
direction = tables.Float64Col(pos=1, shape=3)
status = tables.Int32Col(pos=2)
label = tables.Int32Col(pos=3)
material_id = tables.Int32Col(pos=4)
chemical_specie = tables.StringCol(pos=5, itemsize=20)
rolling_friction = tables.Float64Col(pos=6)
volume_fraction = tables.Float64Col(pos=7)
Expand Down

0 comments on commit 7cce9da

Please sign in to comment.