midas-civil 1.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. midas_civil/_BoundaryChangeAssignment.py +278 -0
  2. midas_civil/__init__.py +51 -0
  3. midas_civil/_analysiscontrol.py +585 -0
  4. midas_civil/_boundary.py +888 -0
  5. midas_civil/_construction.py +1004 -0
  6. midas_civil/_element.py +1346 -0
  7. midas_civil/_group.py +337 -0
  8. midas_civil/_load.py +967 -0
  9. midas_civil/_loadcomb.py +159 -0
  10. midas_civil/_mapi.py +249 -0
  11. midas_civil/_material.py +1692 -0
  12. midas_civil/_model.py +522 -0
  13. midas_civil/_movingload.py +1479 -0
  14. midas_civil/_node.py +532 -0
  15. midas_civil/_result_table.py +929 -0
  16. midas_civil/_result_test.py +5455 -0
  17. midas_civil/_section/_TapdbSecSS.py +175 -0
  18. midas_civil/_section/__init__.py +413 -0
  19. midas_civil/_section/_compositeSS.py +283 -0
  20. midas_civil/_section/_dbSecSS.py +164 -0
  21. midas_civil/_section/_offsetSS.py +53 -0
  22. midas_civil/_section/_pscSS copy.py +455 -0
  23. midas_civil/_section/_pscSS.py +822 -0
  24. midas_civil/_section/_tapPSC12CellSS.py +565 -0
  25. midas_civil/_section/_unSupp.py +58 -0
  26. midas_civil/_settlement.py +161 -0
  27. midas_civil/_temperature.py +677 -0
  28. midas_civil/_tendon.py +1016 -0
  29. midas_civil/_thickness.py +147 -0
  30. midas_civil/_utils.py +529 -0
  31. midas_civil/_utilsFunc/__init__.py +0 -0
  32. midas_civil/_utilsFunc/_line2plate.py +636 -0
  33. midas_civil/_view.py +891 -0
  34. midas_civil/_view_trial.py +430 -0
  35. midas_civil/_visualise.py +347 -0
  36. midas_civil-1.4.1.dist-info/METADATA +74 -0
  37. midas_civil-1.4.1.dist-info/RECORD +40 -0
  38. midas_civil-1.4.1.dist-info/WHEEL +5 -0
  39. midas_civil-1.4.1.dist-info/licenses/LICENSE +21 -0
  40. midas_civil-1.4.1.dist-info/top_level.txt +1 -0
midas_civil/_group.py ADDED
@@ -0,0 +1,337 @@
1
+
2
+ from ._mapi import MidasAPI
3
+ from ._utils import _convItem2List
4
+ # ----------- HELPER FUNCTION -----------
5
+ # -------- RETRIEVE NODE / ELEMENT FROM STRUCTURE GROUP -------
6
+
7
+
8
+ class _BGrup:
9
+ def __init__(self,id,name):
10
+ self.ID = id
11
+ self.NAME = name
12
+
13
+
14
+ # -------- ADD ELEMENT TO STRUCTURE GROUP -------
15
+
16
+ def _add_elem_2_stGroup(elemID,groupName):
17
+ if groupName in Group.Structure._names:
18
+ for i in Group.Structure.Groups:
19
+ if i.NAME == groupName:
20
+ i.ELIST = list(i.ELIST + [elemID])
21
+ else:
22
+ Group.Structure(groupName)
23
+ _add_elem_2_stGroup(elemID,groupName)
24
+
25
+
26
+
27
+ def _add_node_2_stGroup(nodeID,groupName):
28
+ if groupName in Group.Structure._names:
29
+ for i in Group.Structure.Groups:
30
+ if i.NAME == groupName:
31
+ # if nodeID not in i.NLIST:
32
+ # i.NLIST = list(i.NLIST + [nodeID])
33
+ i.NLIST = i.NLIST + _convItem2List(nodeID)
34
+ else:
35
+ Group.Structure(groupName)
36
+ _add_node_2_stGroup(nodeID,groupName)
37
+
38
+
39
+ #---------------------------------------------------------------------------------------------------------------
40
+ class Group:
41
+
42
+ @classmethod
43
+ def create(cls):
44
+ if cls.Structure.Groups!=[]: cls.Structure.create()
45
+ if cls.Boundary.Groups!=[]:cls.Boundary.create()
46
+ if cls.Load.Groups!=[]:cls.Load.create()
47
+ if cls.Tendon.Groups!=[]:cls.Tendon.create()
48
+
49
+ @classmethod
50
+ def sync(cls):
51
+ cls.Structure.sync()
52
+ cls.Boundary.sync()
53
+ cls.Load.sync()
54
+ cls.Tendon.sync()
55
+
56
+ @classmethod
57
+ def delete(cls):
58
+ cls.Structure.delete()
59
+ cls.Boundary.delete()
60
+ cls.Load.delete()
61
+ cls.Tendon.delete()
62
+
63
+ @classmethod
64
+ def clear(cls):
65
+ cls.Structure.clear()
66
+ cls.Boundary.clear()
67
+ cls.Load.clear()
68
+ cls.Tendon.clear()
69
+
70
+
71
+
72
+
73
+ #--------------------------------- STRUCTURE ---------------------------------------
74
+
75
+
76
+ class Structure:
77
+
78
+ Groups = []
79
+ ids=[]
80
+ _names = []
81
+ url= "/db/GRUP"
82
+
83
+ def __init__(self, name:str, nlist:list=[],elist:list=[]):
84
+ """"""
85
+ self.NAME = name
86
+ if Group.Structure.Groups == []: self.ID=1
87
+ else: self.ID= max(Group.Structure.ids)+1
88
+ self.ELIST = elist
89
+ self.NLIST = nlist
90
+ Group.Structure.ids.append(self.ID)
91
+ Group.Structure.Groups.append(self)
92
+ Group.Structure._names.append(self.NAME)
93
+
94
+ @classmethod
95
+ def update(cls, name,operation = "r", nlist = [],elist = [] ):
96
+ """Group name, element list, node list, operation ("add" or "replace").\n
97
+ Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
98
+ up = 0
99
+ for i in cls.Groups:
100
+ if name == i.NAME:
101
+ up = 1
102
+ if operation == "r":
103
+ i.ELIST = elist
104
+ i.NLIST = nlist
105
+ if operation == "a":
106
+ i.ELIST = i.ELIST + elist
107
+ i.NLIST = i.NLIST + nlist
108
+ if up == 0: print(f"⚠️ Structure group {name} is not defined!")
109
+
110
+ @classmethod
111
+ def json(cls) -> dict:
112
+ """Generates the json file for all defined structure groups."""
113
+ json = {"Assign":{}}
114
+ for i in cls.Groups:
115
+ json["Assign"][i.ID] = {
116
+ "NAME": i.NAME,
117
+ "P_TYPE": 0,
118
+ "N_LIST": i.NLIST,
119
+ "E_LIST": i.ELIST
120
+ }
121
+ return json
122
+
123
+ @classmethod
124
+ def create(cls):
125
+ MidasAPI("PUT",cls.url,cls.json())
126
+
127
+ @classmethod
128
+ def get(cls) -> dict:
129
+ return MidasAPI("GET",cls.url)
130
+
131
+
132
+ @classmethod
133
+ def sync(cls):
134
+ a = cls.get()
135
+ if a != {'message': ''}:
136
+ if list(a['GRUP'].keys()) != []:
137
+ cls.Groups = []
138
+ cls.ids=[]
139
+ cls._names = []
140
+ for j in a['GRUP'].keys():
141
+ nlist=[]
142
+ elist=[]
143
+ try: nlist = a['GRUP'][j]["N_LIST"]
144
+ except: pass
145
+ try:
146
+ elist = a['GRUP'][j]["E_LIST"]
147
+ except:
148
+ pass
149
+
150
+ Group.Structure(a['GRUP'][j]["NAME"],nlist,elist)
151
+
152
+ @classmethod
153
+ def delete(cls):
154
+ cls.clear()
155
+ MidasAPI("DELETE",cls.url)
156
+
157
+ @classmethod
158
+ def clear(cls):
159
+ cls.Groups=[]
160
+ cls.ids=[]
161
+ cls._names = []
162
+
163
+
164
+
165
+ #--------------------------------- BOUNDARY ---------------------------------------
166
+ @staticmethod
167
+ def _BoundaryADD(name):
168
+ if Group.Boundary.ids == []: id = 1
169
+ else: id = max(Group.Boundary.ids)+1
170
+ if isinstance(name,str):
171
+ Group.Boundary.ids.append(id)
172
+ Group.Boundary.Groups.append(_BGrup(id,name))
173
+ elif isinstance(name,list):
174
+ for nam in name:
175
+ Group._BoundaryADD(nam)
176
+
177
+
178
+ class Boundary:
179
+
180
+ Groups:list[_BGrup] = []
181
+ ids=[]
182
+ url= "/db/BNGR"
183
+
184
+ def __init__(self, name:str):
185
+ self.NAME = name
186
+ Group._BoundaryADD(name)
187
+
188
+ @classmethod
189
+ def json(cls) -> dict:
190
+ "Generates the json file for all defined structure groups."
191
+ json = {"Assign":{}}
192
+ for grp in cls.Groups:
193
+ json["Assign"][grp.ID] = {
194
+ "NAME": grp.NAME,
195
+ "AUTOTYPE": 0,
196
+ }
197
+ return json
198
+
199
+ @classmethod
200
+ def create(cls):
201
+ MidasAPI("PUT",cls.url,cls.json())
202
+
203
+ @classmethod
204
+ def get(cls) -> dict:
205
+ return MidasAPI("GET",cls.url)
206
+
207
+
208
+ @classmethod
209
+ def sync(cls):
210
+ a = cls.get()
211
+ if a != {'message': ''}:
212
+ if list(a['BNGR'].keys()) != []:
213
+ cls.Groups = []
214
+ cls.ids=[]
215
+ for j in a['BNGR'].keys():
216
+ Group.Boundary(a['BNGR'][j]["NAME"])
217
+
218
+ @classmethod
219
+ def delete(cls):
220
+ cls.clear()
221
+ MidasAPI("DELETE",cls.url)
222
+
223
+ @classmethod
224
+ def clear(cls):
225
+ cls.Groups=[]
226
+ cls.ids=[]
227
+
228
+
229
+ # -------------------------------- LOAD -------------------------------
230
+
231
+ class Load:
232
+
233
+ Groups = []
234
+ ids=[]
235
+ url= "/db/LDGR"
236
+
237
+ def __init__(self, name:str):
238
+ """"""
239
+ self.NAME = name
240
+ if Group.Load.Groups == []: self.ID=1
241
+ else: self.ID= max(Group.Load.ids)+1
242
+ Group.Load.ids.append(self.ID)
243
+ Group.Load.Groups.append(self)
244
+
245
+
246
+ @classmethod
247
+ def json(cls) -> dict:
248
+ "Generates the json file for all defined structure groups."
249
+ json = {"Assign":{}}
250
+ for i in cls.Groups:
251
+ json["Assign"][i.ID] = {
252
+ "NAME": i.NAME
253
+ }
254
+ return json
255
+
256
+ @classmethod
257
+ def create(cls):
258
+ MidasAPI("PUT",cls.url,cls.json())
259
+
260
+ @classmethod
261
+ def get(cls) -> dict:
262
+ return MidasAPI("GET",cls.url)
263
+
264
+ @classmethod
265
+ def sync(cls):
266
+ a = cls.get()
267
+ if a != {'message': ''}:
268
+ if list(a['LDGR'].keys()) != []:
269
+ cls.Groups = []
270
+ cls.ids=[]
271
+ for j in a['LDGR'].keys():
272
+ Group.Load(a['LDGR'][j]["NAME"])
273
+
274
+ @classmethod
275
+ def delete(cls):
276
+ cls.clear()
277
+ MidasAPI("DELETE",cls.url)
278
+
279
+ @classmethod
280
+ def clear(cls):
281
+ cls.Groups=[]
282
+ cls.ids=[]
283
+
284
+ # ------------------------ TENDON ----------
285
+
286
+ class Tendon:
287
+
288
+ Groups = []
289
+ ids=[]
290
+ url= "/db/TDGR"
291
+
292
+ def __init__(self, name:str):
293
+ """"""
294
+ self.NAME = name
295
+ if Group.Tendon.Groups == []: self.ID=1
296
+ else: self.ID= max(Group.Tendon.ids)+1
297
+ Group.Tendon.ids.append(self.ID)
298
+ Group.Tendon.Groups.append(self)
299
+
300
+
301
+ @classmethod
302
+ def json(cls) -> dict:
303
+ "Generates the json file for all defined structure groups."
304
+ json = {"Assign":{}}
305
+ for i in cls.Groups:
306
+ json["Assign"][i.ID] = {
307
+ "NAME": i.NAME
308
+ }
309
+ return json
310
+
311
+ @classmethod
312
+ def create(cls):
313
+ MidasAPI("PUT",cls.url,cls.json())
314
+
315
+ @classmethod
316
+ def get(cls) -> dict:
317
+ return MidasAPI("GET",cls.url)
318
+
319
+ @classmethod
320
+ def sync(cls):
321
+ a = cls.get()
322
+ if a != {'message': ''}:
323
+ if list(a['TDGR'].keys()) != []:
324
+ cls.Groups = []
325
+ cls.ids=[]
326
+ for j in a['TDGR'].keys():
327
+ Group.Tendon(a['TDGR'][j]["NAME"])
328
+
329
+ @classmethod
330
+ def delete(cls):
331
+ cls.clear()
332
+ MidasAPI("DELETE",cls.url)
333
+
334
+ @classmethod
335
+ def clear(cls):
336
+ cls.Groups=[]
337
+ cls.ids=[]