mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
BC AdisTS View1
This commit is contained in:
1 parent
6067ba601e
commit
d154ac96c2
16 files changed
+1854
-25
No files matched your search
@@ -36,7 +36,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
_id_cnt = 0
|
||||
|
||||
def __init__(self, id: int = -1,
|
||||
status=None):
|
||||
pollutant: int = -1, status=None):
|
||||
super(BoundaryConditionAdisTS, self).__init__()
|
||||
|
||||
self._status = status
|
||||
@@ -48,7 +48,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
|
||||
self._type = ""
|
||||
self._node = None
|
||||
self._pollutant = None
|
||||
self._pollutant = pollutant
|
||||
self._data = []
|
||||
self._header = []
|
||||
self._types = [self.time_convert, float]
|
||||
@@ -87,37 +87,39 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
pollutant_id = data["pollutant_id"]
|
||||
|
||||
table = execute(
|
||||
"SELECT id, pollutant, type, node " +
|
||||
"FROM boundary_condition_adists " +
|
||||
f"WHERE tab = '{pollutant_id}'"
|
||||
"FROM boundary_condition_adists"
|
||||
)
|
||||
|
||||
for row in table:
|
||||
bc = cls(
|
||||
id=row[0],
|
||||
status=data['status']
|
||||
)
|
||||
if table is not None:
|
||||
for row in table:
|
||||
bc = cls(
|
||||
id=row[0],
|
||||
pollutant=row[1],
|
||||
status=data['status']
|
||||
)
|
||||
|
||||
bc.node = None
|
||||
if row[3] != -1:
|
||||
bc.node = next(filter(lambda n: n.id == row[3], data["nodes"]))
|
||||
bc.type = row[2]
|
||||
|
||||
values = execute(
|
||||
"SELECT data0, data1 FROM boundary_condition_data_adists " +
|
||||
f"WHERE bc = '{bc.id}'"
|
||||
)
|
||||
bc.node = None
|
||||
if row[3] != -1:
|
||||
bc.node = next(filter(lambda n: n.id == row[3], data["nodes"]))
|
||||
|
||||
# Write data
|
||||
for v in values:
|
||||
data0 = bc._types[0](v[1])
|
||||
data1 = bc._types[1](v[2])
|
||||
# Replace data at pos ind
|
||||
bc._data.append((data0, data1))
|
||||
values = execute(
|
||||
"SELECT data0, data1 FROM boundary_condition_data_adists " +
|
||||
f"WHERE bc = '{bc.id}'"
|
||||
)
|
||||
|
||||
new.append(bc)
|
||||
# Write data
|
||||
for v in values:
|
||||
data0 = bc._types[0](v[1])
|
||||
data1 = bc._types[1](v[2])
|
||||
# Replace data at pos ind
|
||||
bc._data.append((data0, data1))
|
||||
|
||||
new.append(bc)
|
||||
|
||||
return new
|
||||
|
||||
@@ -194,6 +196,11 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
@type.setter
|
||||
def type(self, type):
|
||||
self._type = type
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
return self._data.copy()
|
||||
|
||||
Reference in new issue
Block a user