mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
IC: Add Model and View base code.
This commit is contained in:
1 parent
10f1d11ddf
commit
0512947e0e
10 files changed
+800
-4
No files matched your search
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from copy import copy
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.InitialConditions.InitialConditions import InitialConditions
|
||||
|
||||
class InitialConditionsDict(object):
|
||||
def __init__(self, status = None):
|
||||
super(InitialConditionsDict, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
self._reach = {}
|
||||
|
||||
def __len__(self):
|
||||
return len(self._reach)
|
||||
|
||||
def is_defined(self, reach):
|
||||
return reach in self._reach
|
||||
|
||||
def get(self, reach):
|
||||
if reach in self._reach:
|
||||
return self._reach[reach]
|
||||
|
||||
new = self.new(reach)
|
||||
self.set(reach, new)
|
||||
return new
|
||||
|
||||
def set(self, reach, new):
|
||||
self._reach[reach] = new
|
||||
self._status.modified()
|
||||
|
||||
def new(self, reach):
|
||||
new = InitialConditions(reach = reach, status = self._status)
|
||||
self.set(reach, new)
|
||||
Reference in new issue
Block a user