mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Model, BC: Add SQL export for boundary condition.
This commit is contained in:
1 parent
4978f20e29
commit
36f792d432
5 files changed
+202
-16
No files matched your search
@@ -3,15 +3,21 @@
|
||||
from copy import copy
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.DB import SQLSubModel
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
from Model.BoundaryCondition.BoundaryCondition import BoundaryCondition
|
||||
from Model.BoundaryCondition.BoundaryConditionTypes import (
|
||||
NotDefined,
|
||||
PonctualContribution,
|
||||
TimeOverZ, TimeOverDischarge, ZOverDischarge
|
||||
)
|
||||
|
||||
class BoundaryConditionList(object):
|
||||
class BoundaryConditionList(SQLSubModel):
|
||||
_sub_classes = [
|
||||
BoundaryCondition,
|
||||
]
|
||||
|
||||
def __init__(self, status = None):
|
||||
super(BoundaryConditionList, self).__init__()
|
||||
|
||||
@@ -23,6 +29,40 @@ class BoundaryConditionList(object):
|
||||
"suspenssion" : []
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data = None):
|
||||
new = cls(status = data['status'])
|
||||
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
for tab in new._tabs:
|
||||
data["tab"] = tab
|
||||
new._tabs[tab] = BoundaryCondition._sql_load(
|
||||
execute, data
|
||||
)
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data = None):
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
for tab in self._tabs:
|
||||
data["tab"] = tab
|
||||
for bc in self._tabs[tab]:
|
||||
bc._sql_save(execute, data = data)
|
||||
|
||||
return True
|
||||
|
||||
def len(self, lst):
|
||||
return len(self._tabs[lst])
|
||||
|
||||
|
||||
Reference in new issue
Block a user