This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #407 from simphony/update-metadata-8c3ab406d73a804…
…c35fc47cdb4a514495e0143d3 Update to support metadata PDE conditions (PR simphony-metadata#121/#122)
- Loading branch information
Showing
24 changed files
with
795 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from simphony.core import Default # noqa | ||
from simphony.cuds import meta_validation | ||
from simphony.core.cuba import CUBA | ||
from .dirichlet import Dirichlet | ||
|
||
|
||
class ConstantPressureCondition(Dirichlet): | ||
""" | ||
Constant pressure condition | ||
""" | ||
cuba_key = CUBA.CONSTANT_PRESSURE_CONDITION | ||
|
||
def __init__(self, pressure, material, description=Default, name=Default): | ||
super(ConstantPressureCondition, self).__init__( | ||
material=material, description=description, name=name) | ||
self._init_models() | ||
self._init_pressure(pressure) | ||
|
||
@classmethod | ||
def supported_parameters(cls): | ||
try: | ||
base_params = super(ConstantPressureCondition, | ||
cls).supported_parameters() | ||
except AttributeError: | ||
base_params = () | ||
return tuple(set((CUBA.PRESSURE, ) + base_params)) | ||
|
||
def _init_models(self): | ||
self._models = self._default_models() # noqa | ||
|
||
@property | ||
def models(self): | ||
return self._models | ||
|
||
def _default_models(self): | ||
return ['CUBA.CONTINUUM'] # noqa | ||
|
||
def _default_definition(self): | ||
return "Constant pressure condition" # noqa | ||
|
||
def _init_pressure(self, value): | ||
if value is Default: | ||
value = self._default_pressure() | ||
|
||
self.pressure = value | ||
|
||
@property | ||
def pressure(self): | ||
return self.data[CUBA.PRESSURE] | ||
|
||
@pressure.setter | ||
def pressure(self, value): | ||
value = self._validate_pressure(value) | ||
self.data[CUBA.PRESSURE] = value | ||
|
||
def _validate_pressure(self, value): | ||
value = meta_validation.cast_data_type(value, 'PRESSURE') | ||
meta_validation.check_valid_shape(value, [1], 'PRESSURE') | ||
meta_validation.validate_cuba_keyword(value, 'PRESSURE') | ||
return value | ||
|
||
def _default_pressure(self): | ||
raise TypeError("No default for pressure") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from simphony.core import Default # noqa | ||
from simphony.cuds import meta_validation | ||
from simphony.core.cuba import CUBA | ||
from .dirichlet import Dirichlet | ||
|
||
|
||
class ConstantVelocityCondition(Dirichlet): | ||
""" | ||
Constant velocity condition | ||
""" | ||
cuba_key = CUBA.CONSTANT_VELOCITY_CONDITION | ||
|
||
def __init__(self, velocity, material, description=Default, name=Default): | ||
super(ConstantVelocityCondition, self).__init__( | ||
material=material, description=description, name=name) | ||
self._init_models() | ||
self._init_velocity(velocity) | ||
|
||
@classmethod | ||
def supported_parameters(cls): | ||
try: | ||
base_params = super(ConstantVelocityCondition, | ||
cls).supported_parameters() | ||
except AttributeError: | ||
base_params = () | ||
return tuple(set((CUBA.VELOCITY, ) + base_params)) | ||
|
||
def _init_models(self): | ||
self._models = self._default_models() # noqa | ||
|
||
@property | ||
def models(self): | ||
return self._models | ||
|
||
def _default_models(self): | ||
return ['CUBA.CONTINUUM'] # noqa | ||
|
||
def _default_definition(self): | ||
return "Constant velocity condition" # noqa | ||
|
||
def _init_velocity(self, value): | ||
if value is Default: | ||
value = self._default_velocity() | ||
|
||
self.velocity = value | ||
|
||
@property | ||
def velocity(self): | ||
return self.data[CUBA.VELOCITY] | ||
|
||
@velocity.setter | ||
def velocity(self, value): | ||
value = self._validate_velocity(value) | ||
self.data[CUBA.VELOCITY] = value | ||
|
||
def _validate_velocity(self, value): | ||
value = meta_validation.cast_data_type(value, 'VELOCITY') | ||
meta_validation.check_valid_shape(value, [1], 'VELOCITY') | ||
meta_validation.validate_cuba_keyword(value, 'VELOCITY') | ||
return value | ||
|
||
def _default_velocity(self): | ||
raise TypeError("No default for velocity") |
Oops, something went wrong.