medcoupling 9.11.0__cp311-cp311-win_amd64.whl → 9.15.0__cp311-cp311-win_amd64.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.
- CaseIO.py +27 -8
- CaseReader.py +491 -275
- CaseWriter.py +344 -172
- MCMailFileReader.py +412 -0
- MEDCouplingCompat.py +235 -0
- MEDCouplingRemapper.py +421 -4
- MEDLoader.py +314 -2
- MEDLoaderFinalize.py +680 -0
- MEDLoaderSplitter.py +141 -100
- MEDRenumber.py +235 -0
- VTKReader.py +314 -151
- _MEDCouplingCompat.pyd +0 -0
- _MEDCouplingRemapper.pyd +0 -0
- _MEDLoader.pyd +0 -0
- _MEDPartitioner.pyd +0 -0
- _MEDRenumber.pyd +0 -0
- _medcoupling.pyd +0 -0
- geom2medcoupling.py +34 -17
- hdf5.dll +0 -0
- interpkernel.dll +0 -0
- libxml2.dll +0 -0
- medC.dll +0 -0
- medcoupling-9.15.0.dist-info/METADATA +40 -0
- medcoupling-9.15.0.dist-info/RECORD +31 -0
- medcoupling-9.15.0.dist-info/WHEEL +4 -0
- medcoupling.dll +0 -0
- medcoupling.py +514 -6
- medcouplingremapper.dll +0 -0
- medicoco.dll +0 -0
- medloader.dll +0 -0
- medpartitionercpp.dll +0 -0
- renumbercpp.dll +0 -0
- vtk2medcoupling.py +273 -17
- medcoupling-9.11.0.dist-info/METADATA +0 -22
- medcoupling-9.11.0.dist-info/RECORD +0 -1
- medcoupling-9.11.0.dist-info/WHEEL +0 -1
MEDLoaderSplitter.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: iso-8859-1 -*-
|
2
|
-
# Copyright (C) 2007-
|
2
|
+
# Copyright (C) 2007-2025 CEA, EDF
|
3
3
|
#
|
4
4
|
# This library is free software; you can redistribute it and/or
|
5
5
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -22,178 +22,219 @@
|
|
22
22
|
from medcoupling import *
|
23
23
|
import os
|
24
24
|
|
25
|
+
|
25
26
|
class MEDLoaderSplitter:
|
26
27
|
@classmethod
|
27
|
-
def New(cls,mfd,idsLst):
|
28
|
-
"""
|
29
|
-
return MEDLoaderSplitter(mfd,idsLst)
|
28
|
+
def New(cls, mfd, idsLst):
|
29
|
+
"""mfd is a MEDFileData instance containing only one mesh. idsLst is a list of DataArrayInt containing each the ids per processor"""
|
30
|
+
return MEDLoaderSplitter(mfd, idsLst)
|
30
31
|
pass
|
31
32
|
|
32
|
-
def __init__(self,mfd,idsLst):
|
33
|
-
"""
|
34
|
-
mfmsh=mfd.getMeshes()
|
35
|
-
mfflds=mfd.getFields()
|
36
|
-
if len(mfmsh)!=1:
|
33
|
+
def __init__(self, mfd, idsLst):
|
34
|
+
"""mfd is a MEDFileData instance containing only one mesh. idsLst is a list of DataArrayInt containing each the ids per processor"""
|
35
|
+
mfmsh = mfd.getMeshes()
|
36
|
+
mfflds = mfd.getFields()
|
37
|
+
if len(mfmsh) != 1:
|
37
38
|
raise InterpKernelException("Works only with one mesh !")
|
38
|
-
mfflds=mfflds.partOfThisLyingOnSpecifiedMeshName(mfmsh[0].getName())
|
39
|
-
retm=self.__splitMesh(mfmsh[0],idsLst)
|
40
|
-
retf=self.__splitFields(mfmsh[0],retm,mfflds,idsLst)
|
41
|
-
self._mfd_splitted=[MEDFileData() for i in range(len(idsLst))]
|
42
|
-
for a,b,c in zip(self._mfd_splitted,retf,retm):
|
43
|
-
a.setFields(b)
|
39
|
+
mfflds = mfflds.partOfThisLyingOnSpecifiedMeshName(mfmsh[0].getName())
|
40
|
+
retm = self.__splitMesh(mfmsh[0], idsLst)
|
41
|
+
retf = self.__splitFields(mfmsh[0], retm, mfflds, idsLst)
|
42
|
+
self._mfd_splitted = [MEDFileData() for i in range(len(idsLst))]
|
43
|
+
for a, b, c in zip(self._mfd_splitted, retf, retm):
|
44
|
+
a.setFields(b)
|
45
|
+
a.setMeshes(c)
|
44
46
|
pass
|
45
47
|
pass
|
46
48
|
|
47
49
|
def getSplittedInstances(self):
|
48
50
|
return self._mfd_splitted
|
49
|
-
|
51
|
+
|
50
52
|
@classmethod
|
51
|
-
def __splitMEDFileField1TSNodePfl(cls,mm,fieldName,pfl,ids,cache,procID):
|
53
|
+
def __splitMEDFileField1TSNodePfl(cls, mm, fieldName, pfl, ids, cache, procID):
|
52
54
|
zeLev = None
|
53
55
|
for lev in reversed(mm.getNonEmptyLevels()):
|
54
|
-
cellIds = mm[lev].getCellIdsLyingOnNodes(pfl,True)
|
55
|
-
if
|
56
|
+
cellIds = mm[lev].getCellIdsLyingOnNodes(pfl, True)
|
57
|
+
if (
|
58
|
+
mm[lev][cellIds]
|
59
|
+
.computeFetchedNodeIds()
|
60
|
+
.isEqualWithoutConsideringStr(pfl)
|
61
|
+
):
|
56
62
|
zeLev = lev
|
57
63
|
break
|
58
|
-
assert
|
59
|
-
cache[(fieldName,procID)]["zeLev"]=zeLev
|
64
|
+
assert zeLev is not None
|
65
|
+
cache[(fieldName, procID)]["zeLev"] = zeLev
|
60
66
|
#
|
61
|
-
m0Part=mm[0][ids]
|
62
|
-
mLev=mm[zeLev]
|
67
|
+
m0Part = mm[0][ids]
|
68
|
+
mLev = mm[zeLev]
|
63
69
|
#
|
64
|
-
trado2n=m0Part.zipCoordsTraducer()
|
65
|
-
trad=trado2n.invertArrayO2N2N2O(
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
trado2n = m0Part.zipCoordsTraducer() # 3D part of nodes o2n
|
71
|
+
trad = trado2n.invertArrayO2N2N2O(
|
72
|
+
m0Part.getNumberOfNodes()
|
73
|
+
) # 3D part of nodes n2o
|
74
|
+
part = mLev.getCellIdsFullyIncludedInNodeIds(trad)
|
75
|
+
mSubPart = mLev[part] # 2D part lying on 3D part
|
76
|
+
mSubPartReducedNode = mSubPart.deepCopy()
|
77
|
+
mSubPartReducedNode.renumberNodesInConn(trado2n)
|
78
|
+
mSubPartReducedNode.setCoords(
|
79
|
+
m0Part.getCoords()
|
80
|
+
) # 2D part lying on 3D part node zipped
|
69
81
|
#
|
70
|
-
if mSubPart.getNumberOfCells()==0:
|
71
|
-
cache[(fieldName,procID)]["res"] = None
|
72
|
-
cache[(fieldName,procID)]["subProfileInProcReducedNode"] = None
|
82
|
+
if mSubPart.getNumberOfCells() == 0:
|
83
|
+
cache[(fieldName, procID)]["res"] = None
|
84
|
+
cache[(fieldName, procID)]["subProfileInProcReducedNode"] = None
|
73
85
|
return
|
74
86
|
cellsInSubPartFetchedByProfile = mSubPart.getCellIdsFullyIncludedInNodeIds(pfl)
|
75
|
-
mSubPartFetchedByPfl=mSubPart[cellsInSubPartFetchedByProfile]
|
76
|
-
subProfileInProc=mSubPartFetchedByPfl.computeFetchedNodeIds()
|
87
|
+
mSubPartFetchedByPfl = mSubPart[cellsInSubPartFetchedByProfile]
|
88
|
+
subProfileInProc = mSubPartFetchedByPfl.computeFetchedNodeIds()
|
77
89
|
mSubPartFetchedByPfl.zipCoords()
|
78
90
|
#
|
79
|
-
res=pfl.findIdForEach(subProfileInProc)
|
80
|
-
subProfileInProcReducedNode=subProfileInProc.deepCopy()
|
91
|
+
res = pfl.findIdForEach(subProfileInProc)
|
92
|
+
subProfileInProcReducedNode = subProfileInProc.deepCopy()
|
93
|
+
subProfileInProcReducedNode.transformWithIndArr(trado2n)
|
81
94
|
subProfileInProcReducedNode.setName(pfl.getName())
|
82
95
|
#
|
83
|
-
cache[(fieldName,procID)]["res"] = res
|
84
|
-
cache[(fieldName,procID)]["subProfileInProcReducedNode"] =
|
96
|
+
cache[(fieldName, procID)]["res"] = res
|
97
|
+
cache[(fieldName, procID)]["subProfileInProcReducedNode"] = (
|
98
|
+
subProfileInProcReducedNode
|
99
|
+
)
|
85
100
|
pass
|
86
101
|
|
87
|
-
|
88
102
|
@classmethod
|
89
|
-
def __splitMEDFileField1TSNode(
|
90
|
-
|
91
|
-
|
103
|
+
def __splitMEDFileField1TSNode(
|
104
|
+
cls, t, mm, mmOut, f1tsIn, f1tsOut, ids, cache, procID
|
105
|
+
):
|
106
|
+
if len(f1tsIn.getPflsReallyUsed()) != 0:
|
107
|
+
arr, pfl = f1tsIn.getFieldWithProfile(ON_NODES, 0, mm)
|
92
108
|
#
|
93
|
-
if (f1tsIn.getName(),procID) not in cache:
|
94
|
-
cls.__splitMEDFileField1TSNodePfl(
|
109
|
+
if (f1tsIn.getName(), procID) not in cache:
|
110
|
+
cls.__splitMEDFileField1TSNodePfl(
|
111
|
+
mm, f1tsIn.getName(), pfl, ids, cache, procID
|
112
|
+
)
|
95
113
|
pass
|
96
|
-
zeLev = cache[(f1tsIn.getName(),procID)]["zeLev"]
|
97
|
-
res = cache[(f1tsIn.getName(),procID)]["res"]
|
98
|
-
subProfileInProcReducedNode = cache[(f1tsIn.getName(),procID)][
|
99
|
-
|
114
|
+
zeLev = cache[(f1tsIn.getName(), procID)]["zeLev"]
|
115
|
+
res = cache[(f1tsIn.getName(), procID)]["res"]
|
116
|
+
subProfileInProcReducedNode = cache[(f1tsIn.getName(), procID)][
|
117
|
+
"subProfileInProcReducedNode"
|
118
|
+
]
|
119
|
+
if (
|
120
|
+
(zeLev is None)
|
121
|
+
or (res is None)
|
122
|
+
or (subProfileInProcReducedNode is None)
|
123
|
+
):
|
100
124
|
return
|
101
|
-
if len(res)>0:
|
102
|
-
fRes=MEDCouplingFieldDouble(ON_NODES)
|
125
|
+
if len(res) > 0:
|
126
|
+
fRes = MEDCouplingFieldDouble(ON_NODES)
|
103
127
|
fRes.setArray(arr[res])
|
104
128
|
fRes.setName(f1tsIn.getName())
|
105
|
-
#fRes.setMesh(mSubPartFetchedByPfl)
|
106
|
-
#fRes.copyAllTinyAttrFrom(f_medcoupling)
|
107
|
-
a,b,c=f1tsIn.getTime()
|
108
|
-
|
129
|
+
# fRes.setMesh(mSubPartFetchedByPfl)
|
130
|
+
# fRes.copyAllTinyAttrFrom(f_medcoupling)
|
131
|
+
a, b, c = f1tsIn.getTime()
|
132
|
+
fRes.setTime(c, a, b)
|
133
|
+
f1tsOut.setFieldProfile(fRes, mmOut, zeLev, subProfileInProcReducedNode)
|
109
134
|
pass
|
110
|
-
#raise RuntimeError("Field \"%s\" contains profiles ! Not supported yet ! This field will be ignored !" % (f1tsIn.getName()))
|
135
|
+
# raise RuntimeError("Field \"%s\" contains profiles ! Not supported yet ! This field will be ignored !" % (f1tsIn.getName()))
|
111
136
|
else:
|
112
|
-
f=f1tsIn.getFieldOnMeshAtLevel(t,0,mm)
|
113
|
-
fRet=f[ids]
|
137
|
+
f = f1tsIn.getFieldOnMeshAtLevel(t, 0, mm)
|
138
|
+
fRet = f[ids]
|
114
139
|
f1tsOut.setFieldNoProfileSBT(fRet)
|
115
140
|
pass
|
116
141
|
pass
|
117
|
-
|
142
|
+
|
118
143
|
@classmethod
|
119
|
-
def __splitMEDFileField1TSCell(
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
144
|
+
def __splitMEDFileField1TSCell(
|
145
|
+
cls, t, mm, mmOut, f1tsIn, f1tsOut, ids, cache, procID
|
146
|
+
):
|
147
|
+
f = f1tsIn.getFieldOnMeshAtLevel(t, 0, mm)
|
148
|
+
fRet = f[ids]
|
149
|
+
m = fRet.getMesh()
|
150
|
+
m.zipCoords()
|
151
|
+
o2n = m.getRenumArrForMEDFileFrmt()
|
152
|
+
fRet.renumberCells(o2n, False)
|
124
153
|
f1tsOut.setFieldNoProfileSBT(fRet)
|
125
154
|
pass
|
126
|
-
|
127
|
-
def __splitMEDFileField1TS(self,mm,mmOutList,f1ts,idsLst,cache):
|
155
|
+
|
156
|
+
def __splitMEDFileField1TS(self, mm, mmOutList, f1ts, idsLst, cache):
|
128
157
|
"""
|
129
|
-
|
158
|
+
Split input f1ts into parts defined by idsLst.
|
130
159
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
160
|
+
:param mm: The underlying mesh of f1ts
|
161
|
+
:param f1ts: The field to be split
|
162
|
+
:param idsLst: For each proc the cell ids at level 0
|
163
|
+
:return: A list of fields.
|
135
164
|
"""
|
136
|
-
ret=[f1ts.__class__() for i in range(len(idsLst))]
|
137
|
-
dico={
|
138
|
-
|
139
|
-
|
140
|
-
|
165
|
+
ret = [f1ts.__class__() for i in range(len(idsLst))]
|
166
|
+
dico = {
|
167
|
+
ON_CELLS: MEDLoaderSplitter.__splitMEDFileField1TSCell,
|
168
|
+
ON_NODES: MEDLoaderSplitter.__splitMEDFileField1TSNode,
|
169
|
+
ON_GAUSS_PT: MEDLoaderSplitter.__splitMEDFileField1TSCell,
|
170
|
+
ON_GAUSS_NE: MEDLoaderSplitter.__splitMEDFileField1TSCell,
|
171
|
+
}
|
141
172
|
for t in f1ts.getTypesOfFieldAvailable():
|
142
|
-
for procID,f0 in enumerate(ret):
|
143
|
-
dico[t](
|
173
|
+
for procID, f0 in enumerate(ret):
|
174
|
+
dico[t](
|
175
|
+
t, mm, mmOutList[procID][0], f1ts, f0, idsLst[procID], cache, procID
|
176
|
+
)
|
144
177
|
pass
|
145
178
|
pass
|
146
179
|
return ret
|
147
|
-
|
148
|
-
def __splitFields(self,mm,mmOutList,mfflds,idsLst):
|
180
|
+
|
181
|
+
def __splitFields(self, mm, mmOutList, mfflds, idsLst):
|
149
182
|
ret0 = [MEDFileFields() for i in range(len(idsLst))]
|
150
183
|
from collections import defaultdict
|
184
|
+
|
151
185
|
cache = defaultdict(dict)
|
152
186
|
for fmts in mfflds:
|
153
|
-
ret1=[fmts.__class__() for i in range(len(idsLst))]
|
187
|
+
ret1 = [fmts.__class__() for i in range(len(idsLst))]
|
154
188
|
for f1ts in fmts:
|
155
|
-
for fmtsPart,f1tsPart in zip(
|
189
|
+
for fmtsPart, f1tsPart in zip(
|
190
|
+
ret1,
|
191
|
+
self.__splitMEDFileField1TS(mm, mmOutList, f1ts, idsLst, cache),
|
192
|
+
):
|
156
193
|
if f1tsPart.getUndergroundDataArray():
|
157
|
-
if len(f1tsPart.getUndergroundDataArray())!=0
|
194
|
+
if len(f1tsPart.getUndergroundDataArray()) != 0:
|
158
195
|
fmtsPart.pushBackTimeStep(f1tsPart)
|
159
196
|
pass
|
160
197
|
pass
|
161
|
-
for fieldsPart,fmtsPart in zip(ret0,ret1):
|
162
|
-
if len(fmtsPart) != 0
|
163
|
-
fieldsPart.pushField(fmtsPart)
|
198
|
+
for fieldsPart, fmtsPart in zip(ret0, ret1):
|
199
|
+
if len(fmtsPart) != 0:
|
200
|
+
fieldsPart.pushField(fmtsPart)
|
164
201
|
pass
|
165
202
|
pass
|
166
203
|
return ret0
|
167
204
|
|
168
|
-
def __splitMesh(self,mfm,idsLst):
|
205
|
+
def __splitMesh(self, mfm, idsLst):
|
169
206
|
ret0 = [MEDFileMeshes() for i in range(len(idsLst))]
|
170
|
-
m=mfm[0]
|
171
|
-
addlevs=list(mfm.getNonEmptyLevels())[1:]
|
172
|
-
dAddlevs={k:mfm[k] for k in addlevs}
|
173
|
-
for ret,ids in zip(ret0,idsLst):
|
174
|
-
mlPart=mfm.createNewEmpty()
|
175
|
-
mPart=m[ids]
|
176
|
-
|
177
|
-
|
207
|
+
m = mfm[0]
|
208
|
+
addlevs = list(mfm.getNonEmptyLevels())[1:]
|
209
|
+
dAddlevs = {k: mfm[k] for k in addlevs}
|
210
|
+
for ret, ids in zip(ret0, idsLst):
|
211
|
+
mlPart = mfm.createNewEmpty()
|
212
|
+
mPart = m[ids]
|
213
|
+
trado2n = mPart.zipCoordsTraducer()
|
214
|
+
trad = trado2n.invertArrayO2N2N2O(mPart.getNumberOfNodes())
|
215
|
+
mlPart[0] = mPart
|
178
216
|
if 0 in mfm.getFamArrNonEmptyLevelsExt():
|
179
|
-
mlPart.setFamilyFieldArr(0,mfm.getFamilyFieldAtLevel(0)[ids])
|
217
|
+
mlPart.setFamilyFieldArr(0, mfm.getFamilyFieldAtLevel(0)[ids])
|
180
218
|
pass
|
181
219
|
if 0 in mfm.getNameArrNonEmptyLevelsExt():
|
182
220
|
mlPart.setNameFieldAtLevel(0, mfm.getNameFieldAtLevel(0)[ids])
|
183
221
|
if 1 in mfm.getFamArrNonEmptyLevelsExt():
|
184
|
-
mlPart.setFamilyFieldArr(1,mfm.getFamilyFieldAtLevel(1)[trad])
|
222
|
+
mlPart.setFamilyFieldArr(1, mfm.getFamilyFieldAtLevel(1)[trad])
|
185
223
|
pass
|
186
224
|
if 1 in mfm.getNameArrNonEmptyLevelsExt():
|
187
225
|
mlPart.setNameFieldAtLevel(1, mfm.getNameFieldAtLevel(1)[trad])
|
188
|
-
for k,v in dAddlevs.items():
|
189
|
-
part=v.getCellIdsFullyIncludedInNodeIds(trad)
|
190
|
-
mSubPart=v[part]
|
191
|
-
|
192
|
-
|
226
|
+
for k, v in dAddlevs.items():
|
227
|
+
part = v.getCellIdsFullyIncludedInNodeIds(trad)
|
228
|
+
mSubPart = v[part]
|
229
|
+
mSubPart.renumberNodesInConn(trado2n)
|
230
|
+
mSubPart.setCoords(mPart.getCoords())
|
231
|
+
mlPart[k] = mSubPart
|
232
|
+
mlPart.setFamilyFieldArr(k, mfm.getFamilyFieldAtLevel(k)[part])
|
193
233
|
if k in mfm.getNameArrNonEmptyLevelsExt():
|
194
234
|
mlPart.setNameFieldAtLevel(k, mfm.getNameFieldAtLevel(k)[part])
|
195
235
|
mlPart.copyFamGrpMapsFrom(mfm)
|
196
236
|
ret.pushMesh(mlPart)
|
197
237
|
pass
|
198
238
|
return ret0
|
239
|
+
|
199
240
|
pass
|