From 3a1d198f261e5c93c3bf3fafaa6e79832bd092fc Mon Sep 17 00:00:00 2001 From: Stefano Borini Date: Tue, 13 Dec 2016 13:29:22 +0000 Subject: [PATCH 1/2] Updates against the recent metadata. Fixes a few problems with yapf and setup.py --- dev_requirements.txt | 1 + setup.cfg | 3 ++- setup.py | 7 +++++++ simphony/core/keywords.py | 8 +------- .../cuds/meta/base_centered_monoclinic_lattice.py | 10 ++++++++-- .../meta/base_centered_orthorhombic_lattice.py | 10 ++++++++-- simphony/cuds/meta/body_centered_cubic_lattice.py | 10 ++++++++-- .../meta/body_centered_orthorhombic_lattice.py | 10 ++++++++-- .../cuds/meta/body_centered_tetragonal_lattice.py | 10 ++++++++-- simphony/cuds/meta/box.py | 6 +++--- simphony/cuds/meta/bravais_lattice.py | 9 ++++++++- simphony/cuds/meta/computational_method.py | 6 +++--- simphony/cuds/meta/cubic_lattice.py | 8 +++++++- simphony/cuds/meta/dem.py | 3 ++- simphony/cuds/meta/face_centered_cubic_lattice.py | 10 ++++++++-- .../meta/face_centered_orthorhombic_lattice.py | 10 ++++++++-- simphony/cuds/meta/fem.py | 3 ++- simphony/cuds/meta/fvm.py | 3 ++- simphony/cuds/meta/hexagonal_lattice.py | 10 ++++++++-- simphony/cuds/meta/integration_step.py | 14 ++++---------- simphony/cuds/meta/integration_time.py | 14 ++++---------- simphony/cuds/meta/lattice.py | 12 +++++++++--- simphony/cuds/meta/mesh.py | 12 +++++++++--- simphony/cuds/meta/monoclinic_lattice.py | 10 ++++++++-- simphony/cuds/meta/orthorhombic_lattice.py | 10 ++++++++-- simphony/cuds/meta/particles.py | 12 +++++++++--- simphony/cuds/meta/rhombohedral_lattice.py | 10 ++++++++-- simphony/cuds/meta/sph.py | 3 ++- simphony/cuds/meta/tetragonal_lattice.py | 10 ++++++++-- simphony/cuds/meta/triclinic_lattice.py | 10 ++++++++-- simphony/cuds/meta/verlet.py | 3 ++- 31 files changed, 181 insertions(+), 76 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index c3552a82..d10955dd 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -10,3 +10,4 @@ coverage flake8<3 numpy >= 1.4.1 hypothesis +yapf diff --git a/setup.cfg b/setup.cfg index fd21720d..2f0be436 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,4 +3,5 @@ exclude = doc/* [build_meta] -repotag=89797b0d85096c0119cab8ee6dfdf1ed66e6c930 +repotag=555be66fc307899a5a9bcd8fe91760f58c487115 + diff --git a/setup.py b/setup.py index 1045959e..f1019434 100644 --- a/setup.py +++ b/setup.py @@ -63,6 +63,13 @@ def run(self): print("Failed to run git stash.") raise + try: + print("Fetching") + check_call(["git", "fetch"]) + except CalledProcessError: + print("Failed to fetch") + raise + try: print("Checking out {}".format(self.repotag)) check_call(["git", "checkout", self.repotag]) diff --git a/simphony/core/keywords.py b/simphony/core/keywords.py index 039a2f69..e7f5ada5 100644 --- a/simphony/core/keywords.py +++ b/simphony/core/keywords.py @@ -233,12 +233,6 @@ key='EXTERNAL_FORCING', shape=[1], dtype=bool), - 'FACE': Keyword( - name='Face', - definition='A face of a three dimensional object defined by the nodes', # noqa - key='FACE', - shape=[1], - dtype=numpy.float64), 'FINAL': Keyword( name='Final', definition='final value of a parameter', # noqa @@ -787,7 +781,7 @@ dtype=None), 'BOX': Keyword( name='Box', - definition='A simple hexahedron (with six faces) simulation box defined by the three vectors and three directions. The condition should be specified for each direction (two faces at a time).', # noqa + definition='A simple hexahedron simulation box defining six boundary faces that are defined by three box vectors. The same boundary condition should be specified for each direction (two faces at a time).', # noqa key='BOX', shape=[1], dtype=None), diff --git a/simphony/cuds/meta/base_centered_monoclinic_lattice.py b/simphony/cuds/meta/base_centered_monoclinic_lattice.py index 8be825da..85c4d194 100644 --- a/simphony/cuds/meta/base_centered_monoclinic_lattice.py +++ b/simphony/cuds/meta/base_centered_monoclinic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A base centered monoclinic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/base_centered_orthorhombic_lattice.py b/simphony/cuds/meta/base_centered_orthorhombic_lattice.py index 7af3a83a..f4e3d07a 100644 --- a/simphony/cuds/meta/base_centered_orthorhombic_lattice.py +++ b/simphony/cuds/meta/base_centered_orthorhombic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A base centered orthorhombic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/body_centered_cubic_lattice.py b/simphony/cuds/meta/body_centered_cubic_lattice.py index 12f0fc2d..942b7164 100644 --- a/simphony/cuds/meta/body_centered_cubic_lattice.py +++ b/simphony/cuds/meta/body_centered_cubic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A body centred cubic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/body_centered_orthorhombic_lattice.py b/simphony/cuds/meta/body_centered_orthorhombic_lattice.py index 53ec0f3b..1885b5ba 100644 --- a/simphony/cuds/meta/body_centered_orthorhombic_lattice.py +++ b/simphony/cuds/meta/body_centered_orthorhombic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A body centered orthorhombic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/body_centered_tetragonal_lattice.py b/simphony/cuds/meta/body_centered_tetragonal_lattice.py index 6bd82780..a9ea3ddc 100644 --- a/simphony/cuds/meta/body_centered_tetragonal_lattice.py +++ b/simphony/cuds/meta/body_centered_tetragonal_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A body centered tetragonal lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/box.py b/simphony/cuds/meta/box.py index e75de3ab..bf69318e 100644 --- a/simphony/cuds/meta/box.py +++ b/simphony/cuds/meta/box.py @@ -6,7 +6,7 @@ class Box(Boundary): - '''A simple hexahedron (with six faces) simulation box defined by the three vectors and three directions. The condition should be specified for each direction (two faces at a time). # noqa + '''A simple hexahedron simulation box defining six boundary faces that are defined by three box vectors. The same boundary condition should be specified for each direction (two faces at a time). # noqa ''' cuba_key = CUBA.BOX @@ -16,12 +16,12 @@ def __init__(self, description="", name="", condition=None, vector=None): self._data = DataContainer() if vector is None: - self.vector = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] + self.vector = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] self.condition = condition self.name = name self.description = description # This is a system-managed, read-only attribute - self._definition = 'A simple hexahedron (with six faces) simulation box defined by the three vectors and three directions. The condition should be specified for each direction (two faces at a time).' # noqa + self._definition = 'A simple hexahedron simulation box defining six boundary faces that are defined by three box vectors. The same boundary condition should be specified for each direction (two faces at a time).' # noqa @property def vector(self): diff --git a/simphony/cuds/meta/bravais_lattice.py b/simphony/cuds/meta/bravais_lattice.py index 0d7a76fb..feacfb57 100644 --- a/simphony/cuds/meta/bravais_lattice.py +++ b/simphony/cuds/meta/bravais_lattice.py @@ -31,6 +31,8 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A Bravais lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def origin(self): @@ -88,6 +90,10 @@ def lattice_parameter(self, value): def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -109,4 +115,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.LATTICE, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.LATTICE, CUBA.DATA_SET, CUBA.CUDS_COMPONENT, + CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/computational_method.py b/simphony/cuds/meta/computational_method.py index 10f59baa..1e95e547 100644 --- a/simphony/cuds/meta/computational_method.py +++ b/simphony/cuds/meta/computational_method.py @@ -1,10 +1,10 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .cuds_component import CUDSComponent +from .solver_parameter import SolverParameter -class ComputationalMethod(CUDSComponent): +class ComputationalMethod(SolverParameter): '''A computational method according to the RoMM # noqa ''' @@ -49,4 +49,4 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.SOLVER_PARAMETER, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/cubic_lattice.py b/simphony/cuds/meta/cubic_lattice.py index 94e04607..f4cca1f0 100644 --- a/simphony/cuds/meta/cubic_lattice.py +++ b/simphony/cuds/meta/cubic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A cubic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -57,4 +63,4 @@ def supported_parameters(cls): @classmethod def parents(cls): return (CUBA.TETRAGONAL_LATTICE, CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, - CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + CUBA.DATA_SET, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/dem.py b/simphony/cuds/meta/dem.py index f90a033d..cb9398d5 100644 --- a/simphony/cuds/meta/dem.py +++ b/simphony/cuds/meta/dem.py @@ -49,4 +49,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.COMPUTATIONAL_METHOD, CUBA.SOLVER_PARAMETER, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/face_centered_cubic_lattice.py b/simphony/cuds/meta/face_centered_cubic_lattice.py index 9f7fd871..8e1960ef 100644 --- a/simphony/cuds/meta/face_centered_cubic_lattice.py +++ b/simphony/cuds/meta/face_centered_cubic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A face centred cubic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/face_centered_orthorhombic_lattice.py b/simphony/cuds/meta/face_centered_orthorhombic_lattice.py index 8f379ad1..83a1b1bf 100644 --- a/simphony/cuds/meta/face_centered_orthorhombic_lattice.py +++ b/simphony/cuds/meta/face_centered_orthorhombic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A face centered orthorhombic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/fem.py b/simphony/cuds/meta/fem.py index 79ae4d04..27d88936 100644 --- a/simphony/cuds/meta/fem.py +++ b/simphony/cuds/meta/fem.py @@ -49,4 +49,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.COMPUTATIONAL_METHOD, CUBA.SOLVER_PARAMETER, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/fvm.py b/simphony/cuds/meta/fvm.py index 72fd658b..7ba09a37 100644 --- a/simphony/cuds/meta/fvm.py +++ b/simphony/cuds/meta/fvm.py @@ -49,4 +49,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.COMPUTATIONAL_METHOD, CUBA.SOLVER_PARAMETER, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/hexagonal_lattice.py b/simphony/cuds/meta/hexagonal_lattice.py index b779bb96..daa6dbf0 100644 --- a/simphony/cuds/meta/hexagonal_lattice.py +++ b/simphony/cuds/meta/hexagonal_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A hexagonal lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/integration_step.py b/simphony/cuds/meta/integration_step.py index bccc979c..9d920b12 100644 --- a/simphony/cuds/meta/integration_step.py +++ b/simphony/cuds/meta/integration_step.py @@ -1,11 +1,11 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .computational_method import ComputationalMethod +from .solver_parameter import SolverParameter from . import validation -class IntegrationStep(ComputationalMethod): +class IntegrationStep(SolverParameter): '''the current step, integration step, and final number of steps for a simulation stored on each cuds (a specific state). # noqa ''' @@ -22,8 +22,6 @@ def __init__(self, size, final, description="", name="", current=0): self.description = description # This is a system-managed, read-only attribute self._definition = 'the current step, integration step, and final number of steps for a simulation stored on each cuds (a specific state).' # noqa - # This is a system-managed, read-only attribute - self._physics_equation = [] @property def final(self): @@ -67,10 +65,6 @@ def current(self, value): def definition(self): return self._definition - @property - def physics_equation(self): - return self._physics_equation - @property def data(self): return DataContainer(self._data) @@ -88,8 +82,8 @@ def uid(self): @classmethod def supported_parameters(cls): return (CUBA.CURRENT, CUBA.DESCRIPTION, CUBA.FINAL, CUBA.NAME, - CUBA.PHYSICS_EQUATION, CUBA.SIZE, CUBA.UUID) + CUBA.SIZE, CUBA.UUID) @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.SOLVER_PARAMETER, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/integration_time.py b/simphony/cuds/meta/integration_time.py index 105ece23..041fe22c 100644 --- a/simphony/cuds/meta/integration_time.py +++ b/simphony/cuds/meta/integration_time.py @@ -1,11 +1,11 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .computational_method import ComputationalMethod +from .solver_parameter import SolverParameter from . import validation -class IntegrationTime(ComputationalMethod): +class IntegrationTime(SolverParameter): '''the current time, time step, and final time for a simulation stored on each cuds (a specific state). # noqa ''' @@ -27,8 +27,6 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'the current time, time step, and final time for a simulation stored on each cuds (a specific state).' # noqa - # This is a system-managed, read-only attribute - self._physics_equation = [] @property def final(self): @@ -70,10 +68,6 @@ def current(self, value): def definition(self): return self._definition - @property - def physics_equation(self): - return self._physics_equation - @property def data(self): return DataContainer(self._data) @@ -91,8 +85,8 @@ def uid(self): @classmethod def supported_parameters(cls): return (CUBA.CURRENT, CUBA.DESCRIPTION, CUBA.FINAL, CUBA.NAME, - CUBA.PHYSICS_EQUATION, CUBA.SIZE, CUBA.UUID) + CUBA.SIZE, CUBA.UUID) @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.SOLVER_PARAMETER, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/lattice.py b/simphony/cuds/meta/lattice.py index 55424a31..f2d833a9 100644 --- a/simphony/cuds/meta/lattice.py +++ b/simphony/cuds/meta/lattice.py @@ -1,10 +1,10 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .cuds_component import CUDSComponent +from .data_set import DataSet -class Lattice(CUDSComponent): +class Lattice(DataSet): '''A lattice # noqa ''' @@ -18,11 +18,17 @@ def __init__(self, description="", name=""): self.description = description # This is a system-managed, read-only attribute self._definition = 'A lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -43,4 +49,4 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.DATA_SET, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/mesh.py b/simphony/cuds/meta/mesh.py index c08727ec..a03c67aa 100644 --- a/simphony/cuds/meta/mesh.py +++ b/simphony/cuds/meta/mesh.py @@ -1,11 +1,11 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .cuds_component import CUDSComponent +from .data_set import DataSet from . import validation -class Mesh(CUDSComponent): +class Mesh(DataSet): '''A mesh # noqa ''' @@ -23,6 +23,8 @@ def __init__(self, point, face, cell, edge, description="", name=""): self.description = description # This is a system-managed, read-only attribute self._definition = 'A mesh' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def edge(self): @@ -88,6 +90,10 @@ def point(self, value): def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -109,4 +115,4 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.DATA_SET, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/monoclinic_lattice.py b/simphony/cuds/meta/monoclinic_lattice.py index f62fcc9d..1f96d1c2 100644 --- a/simphony/cuds/meta/monoclinic_lattice.py +++ b/simphony/cuds/meta/monoclinic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A monoclinic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/orthorhombic_lattice.py b/simphony/cuds/meta/orthorhombic_lattice.py index 82fd1a9d..76b5ffb7 100644 --- a/simphony/cuds/meta/orthorhombic_lattice.py +++ b/simphony/cuds/meta/orthorhombic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'An orthorhombic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/particles.py b/simphony/cuds/meta/particles.py index 625d97f1..48357597 100644 --- a/simphony/cuds/meta/particles.py +++ b/simphony/cuds/meta/particles.py @@ -1,11 +1,11 @@ import uuid from simphony.core.data_container import DataContainer from simphony.core.cuba import CUBA -from .cuds_component import CUDSComponent +from .data_set import DataSet from . import validation -class Particles(CUDSComponent): +class Particles(DataSet): '''A collection of particles # noqa ''' @@ -21,6 +21,8 @@ def __init__(self, particle, bond, description="", name=""): self.description = description # This is a system-managed, read-only attribute self._definition = 'A collection of particles' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def bond(self): @@ -56,6 +58,10 @@ def particle(self, value): def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -77,4 +83,4 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.DATA_SET, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/rhombohedral_lattice.py b/simphony/cuds/meta/rhombohedral_lattice.py index 6de94cdd..09f6b8e8 100644 --- a/simphony/cuds/meta/rhombohedral_lattice.py +++ b/simphony/cuds/meta/rhombohedral_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A rhombohedral lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/sph.py b/simphony/cuds/meta/sph.py index d5496b54..7dac654c 100644 --- a/simphony/cuds/meta/sph.py +++ b/simphony/cuds/meta/sph.py @@ -49,4 +49,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.COMPUTATIONAL_METHOD, CUBA.SOLVER_PARAMETER, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/tetragonal_lattice.py b/simphony/cuds/meta/tetragonal_lattice.py index 6aa217ad..05b07258 100644 --- a/simphony/cuds/meta/tetragonal_lattice.py +++ b/simphony/cuds/meta/tetragonal_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A tetragonal lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/triclinic_lattice.py b/simphony/cuds/meta/triclinic_lattice.py index 90edd5c4..5875d19c 100644 --- a/simphony/cuds/meta/triclinic_lattice.py +++ b/simphony/cuds/meta/triclinic_lattice.py @@ -30,11 +30,17 @@ def __init__(self, self.description = description # This is a system-managed, read-only attribute self._definition = 'A triclinic lattice' # noqa + # This is a system-managed, read-only attribute + self._models = [] @property def definition(self): return self._definition + @property + def models(self): + return self._models + @property def data(self): return DataContainer(self._data) @@ -56,5 +62,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.CUDS_COMPONENT, - CUBA.CUDS_ITEM) + return (CUBA.BRAVAIS_LATTICE, CUBA.LATTICE, CUBA.DATA_SET, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) diff --git a/simphony/cuds/meta/verlet.py b/simphony/cuds/meta/verlet.py index f5f212f5..600d3fa2 100644 --- a/simphony/cuds/meta/verlet.py +++ b/simphony/cuds/meta/verlet.py @@ -49,4 +49,5 @@ def supported_parameters(cls): @classmethod def parents(cls): - return (CUBA.COMPUTATIONAL_METHOD, CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) + return (CUBA.COMPUTATIONAL_METHOD, CUBA.SOLVER_PARAMETER, + CUBA.CUDS_COMPONENT, CUBA.CUDS_ITEM) From 091246988b1a494bc9e0c572f2ffc6e6a2a06aa4 Mon Sep 17 00:00:00 2001 From: Stefano Borini Date: Tue, 13 Dec 2016 14:44:38 +0000 Subject: [PATCH 2/2] Changed defaults for the Box --- scripts/tests/test_meta_class.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests/test_meta_class.py b/scripts/tests/test_meta_class.py index f9069c46..df7145c5 100644 --- a/scripts/tests/test_meta_class.py +++ b/scripts/tests/test_meta_class.py @@ -324,7 +324,7 @@ def test_Origin(self): def test_Box(self): box = meta_class.Box() - arr = box.vector == numpy.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) + arr = box.vector == numpy.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) self.assertTrue(arr.all()) def test_Berendsen(self): @@ -355,5 +355,5 @@ def test_NoseHooverBoundary(self): def test_not_sharing_mutable(self): box1 = meta_class.Box() box2 = meta_class.Box() - box1.vector[0][0] = 1. + box1.vector[0][0] = 3. self.assertNotEqual(box1.vector[0][0], box2.vector[0][0])