1 // Copyright (C) 2017-2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #define MEDCOUPLING_EXPORT
22 #define MEDLOADER_EXPORT
24 #ifdef WITH_DOCSTRINGS
25 %include "MEDLoader_doc.i"
28 %include "MEDCouplingCommon.i"
31 #include "MEDLoader.hxx"
32 #include "MEDFileJoint.hxx"
33 #include "MEDFileMesh.hxx"
34 #include "MEDFileField.hxx"
35 #include "MEDFileParameter.hxx"
36 #include "MEDFileData.hxx"
37 #include "MEDFileEquivalence.hxx"
38 #include "MEDFileEntities.hxx"
39 #include "MEDFileMeshReadSelector.hxx"
40 #include "MEDFileFieldOverView.hxx"
41 #include "MEDCouplingTypemaps.i"
42 #include "MEDLoaderTypemaps.i"
43 #include "SauvReader.hxx"
44 #include "SauvWriter.hxx"
45 #include "MeshFormatReader.hxx"
46 #include "MeshFormatWriter.hxx"
48 using namespace MEDCoupling;
51 #if SWIG_VERSION >= 0x010329
52 %template() std::vector<std::string>;
55 %typemap(out) MEDCoupling::MEDFileMesh*
57 $result=convertMEDFileMesh($1,$owner);
60 %typemap(out) MEDCoupling::MEDFileParameter1TS*
62 $result=convertMEDFileParameter1TS($1,$owner);
65 %typemap(out) MEDCoupling::MEDFileAnyTypeFieldMultiTS*
67 $result=convertMEDFileFieldMultiTS($1,$owner);
70 %typemap(out) MEDCoupling::MEDFileAnyTypeField1TS*
72 $result=convertMEDFileField1TS($1,$owner);
75 %typemap(out) MEDCoupling::MEDMeshMultiLev*
77 $result=convertMEDMeshMultiLev($1,$owner);
80 %newobject ReadUMeshFromFamiliesSwig;
81 %newobject ReadUMeshFromGroupsSwig;
82 %newobject ReadFieldSwig;
83 %newobject MEDCoupling::ReadUMeshFromFile;
84 %newobject MEDCoupling::ReadMeshFromFile;
85 %newobject MEDCoupling::ReadFieldCell;
86 %newobject MEDCoupling::ReadFieldNode;
87 %newobject MEDCoupling::ReadFieldGauss;
88 %newobject MEDCoupling::ReadFieldGaussNE;
89 %newobject MEDCoupling::MEDFileMesh::New;
90 %newobject MEDCoupling::MEDFileMesh::createNewEmpty;
91 %newobject MEDCoupling::MEDFileMesh::deepCopy;
92 %newobject MEDCoupling::MEDFileMesh::shallowCpy;
93 %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel;
94 %newobject MEDCoupling::MEDFileMesh::__getitem__;
95 %newobject MEDCoupling::MEDFileMesh::getGroupArr;
96 %newobject MEDCoupling::MEDFileMesh::getGroupsArr;
97 %newobject MEDCoupling::MEDFileMesh::getFamilyArr;
98 %newobject MEDCoupling::MEDFileMesh::getFamiliesArr;
99 %newobject MEDCoupling::MEDFileMesh::getNodeGroupArr;
100 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
101 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
102 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
103 %newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
104 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
105 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
106 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
107 %newobject MEDCoupling::MEDFileMesh::cartesianize;
108 %newobject MEDCoupling::MEDFileData::getJoints;
109 %newobject MEDCoupling::MEDFileStructuredMesh::getImplicitFaceMesh;
110 %newobject MEDCoupling::MEDFileUMesh::New;
111 %newobject MEDCoupling::MEDFileUMesh::LoadPartOf;
112 %newobject MEDCoupling::MEDFileUMesh::getCoords;
113 %newobject MEDCoupling::MEDFileUMesh::getPartDefAtLevel;
114 %newobject MEDCoupling::MEDFileUMesh::getGroup;
115 %newobject MEDCoupling::MEDFileUMesh::getGroups;
116 %newobject MEDCoupling::MEDFileUMesh::getFamily;
117 %newobject MEDCoupling::MEDFileUMesh::getFamilies;
118 %newobject MEDCoupling::MEDFileUMesh::getLevel0Mesh;
119 %newobject MEDCoupling::MEDFileUMesh::getLevelM1Mesh;
120 %newobject MEDCoupling::MEDFileUMesh::getLevelM2Mesh;
121 %newobject MEDCoupling::MEDFileUMesh::getLevelM3Mesh;
122 %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
123 %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType;
124 %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType;
125 %newobject MEDCoupling::MEDFileUMesh::computeFetchedNodeIds;
126 %newobject MEDCoupling::MEDFileUMesh::zipCoords;
127 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
128 %newobject MEDCoupling::MEDFileUMesh::extractPart;
129 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
130 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
131 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
132 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
133 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
134 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
135 %newobject MEDCoupling::MEDFileCMesh::New;
136 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
137 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
138 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
139 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
140 %newobject MEDCoupling::MEDFileMeshes::New;
141 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
142 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
143 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
144 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
145 %newobject MEDCoupling::MEDFileMeshes::__iter__;
147 %newobject MEDCoupling::MEDFileMeshSupports::New;
148 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
150 %newobject MEDCoupling::MEDFileStructureElements::New;
152 %newobject MEDCoupling::MEDFileFields::New;
153 %newobject MEDCoupling::MEDFileFields::NewAdv;
154 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
155 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
156 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
157 %newobject MEDCoupling::MEDFileFields::deepCopy;
158 %newobject MEDCoupling::MEDFileFields::shallowCpy;
159 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
160 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
161 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
162 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
163 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
164 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
165 %newobject MEDCoupling::MEDFileFields::__iter__;
166 %newobject MEDCoupling::MEDFileFields::extractPart;
167 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
169 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
175 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
176 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
177 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
178 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
184 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
185 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
186 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
187 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
188 %newobject MEDCoupling::MEDFileFieldMultiTS::Aggregate;
190 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::New;
191 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::field;
192 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::LoadSpecificEntities;
193 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getUndergroundDataArray;
194 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::convertToDouble;
195 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevel;
196 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtTopLevel;
197 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldOnMeshAtLevel;
198 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevelOld;
200 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::New;
201 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::field;
202 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::LoadSpecificEntities;
203 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getUndergroundDataArray;
204 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::convertToDouble;
205 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevel;
206 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtTopLevel;
207 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldOnMeshAtLevel;
208 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevelOld;
210 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
211 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
212 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
213 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
214 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
215 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
216 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
217 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
218 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
220 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
221 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
222 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
223 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
224 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
225 %newobject MEDCoupling::MEDFileField1TS::New;
226 %newobject MEDCoupling::MEDFileField1TS::field;
227 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
228 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
229 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
230 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
231 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
232 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
234 %newobject MEDCoupling::MEDFileInt32Field1TS::New;
235 %newobject MEDCoupling::MEDFileInt32Field1TS::field;
236 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevel;
237 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtTopLevel;
238 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldOnMeshAtLevel;
239 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevelOld;
240 %newobject MEDCoupling::MEDFileInt32Field1TS::getUndergroundDataArray;
241 %newobject MEDCoupling::MEDFileInt32Field1TS::convertToDouble;
243 %newobject MEDCoupling::MEDFileInt64Field1TS::New;
244 %newobject MEDCoupling::MEDFileInt64Field1TS::field;
245 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevel;
246 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtTopLevel;
247 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldOnMeshAtLevel;
248 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevelOld;
249 %newobject MEDCoupling::MEDFileInt64Field1TS::getUndergroundDataArray;
250 %newobject MEDCoupling::MEDFileInt64Field1TS::convertToDouble;
252 %newobject MEDCoupling::MEDFileFloatField1TS::New;
253 %newobject MEDCoupling::MEDFileFloatField1TS::field;
254 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
255 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
256 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
257 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
258 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
259 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
261 %newobject MEDCoupling::MEDFileData::New;
262 %newobject MEDCoupling::MEDFileData::deepCopy;
263 %newobject MEDCoupling::MEDFileData::getMeshes;
264 %newobject MEDCoupling::MEDFileData::getFields;
265 %newobject MEDCoupling::MEDFileData::getParams;
266 %newobject MEDCoupling::MEDFileData::Aggregate;
268 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
270 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
271 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
272 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
273 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
274 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
275 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
276 %newobject MEDCoupling::MEDFileParameters::New;
277 %newobject MEDCoupling::MEDFileParameters::deepCopy;
278 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
279 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
280 %newobject MEDCoupling::MEDFileParameters::__getitem__;
282 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
283 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
284 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
285 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
286 %newobject MEDCoupling::MEDFileJointOneStep::New;
287 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
288 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
289 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
290 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
291 %newobject MEDCoupling::MEDFileJoint::New;
292 %newobject MEDCoupling::MEDFileJoint::deepCopy;
293 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
294 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
295 %newobject MEDCoupling::MEDFileJoint::__getitem__;
296 %newobject MEDCoupling::MEDFileJoints::New;
297 %newobject MEDCoupling::MEDFileJoints::deepCopy;
298 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
299 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
300 %newobject MEDCoupling::MEDFileJoints::__getitem__;
301 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
302 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
303 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
304 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
305 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
306 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
307 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
308 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
309 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
311 %newobject MEDCoupling::SauvWriter::New;
312 %newobject MEDCoupling::SauvReader::New;
313 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
316 %newobject MEDCoupling::MEDFileMeshStruct::New;
317 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
318 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
319 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
320 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
321 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
323 %newobject MEDCoupling::MeshFormatReader::loadInMEDFileDS;
324 %newobject MEDCoupling::MeshFormatReader::MeshFormatReader;
325 %newobject MEDCoupling::MeshFormatWriter::MeshFormatWriter;
327 %feature("unref") MEDFileMesh "$this->decrRef();"
328 %feature("unref") MEDFileUMesh "$this->decrRef();"
329 %feature("unref") MEDFileCMesh "$this->decrRef();"
330 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
331 %feature("unref") MEDFileMeshes "$this->decrRef();"
332 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
333 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
334 %feature("unref") MEDFileField1TS "$this->decrRef();"
335 %feature("unref") MEDFileInt32Field1TS "$this->decrRef();"
336 %feature("unref") MEDFileInt64Field1TS "$this->decrRef();"
337 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
338 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
339 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
340 %feature("unref") MEDFileInt32FieldMultiTS "$this->decrRef();"
341 %feature("unref") MEDFileInt64FieldMultiTS "$this->decrRef();"
342 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
343 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
344 %feature("unref") MEDFileStructureElements "$this->decrRef();"
345 %feature("unref") MEDFileFields "$this->decrRef();"
346 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
347 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
348 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
349 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
350 %feature("unref") MEDFileParameters "$this->decrRef();"
351 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
352 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
353 %feature("unref") MEDFileJoint "$this->decrRef();"
354 %feature("unref") MEDFileJoints "$this->decrRef();"
355 %feature("unref") MEDFileEquivalences "$this->decrRef();"
356 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
357 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
358 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
359 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
360 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
361 %feature("unref") MEDFileData "$this->decrRef();"
362 %feature("unref") SauvReader "$this->decrRef();"
363 %feature("unref") SauvWriter "$this->decrRef();"
364 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
365 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
366 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
367 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
368 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
369 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
371 namespace MEDCoupling
374 std::string MEDFileVersionStr();
375 std::string MEDFileVersionOfFileStr(const std::string& fileName);
376 void SetEpsilonForNodeComp(double val);
377 void SetCompPolicyForCell(int val);
378 void SetTooLongStrPolicy(int val);
379 void CheckFileForRead(const std::string& fileName);
380 std::vector<std::string> GetMeshNames(const std::string& fileName);
381 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
382 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
383 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
384 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
385 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
386 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
387 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
388 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
389 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
390 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
391 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
392 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
393 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
394 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
395 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
396 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
397 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
398 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
399 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
400 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
401 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
402 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
403 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
404 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
405 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
406 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
407 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
410 %rename (MEDFileVersion) MEDFileVersionSwig;
411 %rename (GetFieldIterations) GetFieldIterationsSwig;
412 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
413 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
414 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
415 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
416 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
417 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
418 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
419 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
420 %rename (WriteUMeshes) WriteUMeshesSwig;
421 %rename (GetTypesOfField) GetTypesOfFieldSwig;
422 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
423 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
424 %rename (ReadField) ReadFieldSwig;
425 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
429 PyObject *MEDFileVersionSwig()
431 int major,minor,release;
432 MEDCoupling::MEDFileVersion(major,minor,release);
433 PyObject *ret(PyTuple_New(3));
434 PyTuple_SetItem(ret,0,SWIG_From_int(major));
435 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
436 PyTuple_SetItem(ret,2,SWIG_From_int(release));
440 int MEDFileSizeOfMedInt()
442 return 8*sizeof(med_int);
445 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
447 std::map<std::string,mcIdType> families;
448 std::map<std::string,std::vector<std::string>> groupsOnFam;
449 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
450 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
451 AutoPyPtr ret(PyTuple_New(2));
452 PyTuple_SetItem(ret,0,a.retn());
453 PyTuple_SetItem(ret,1,b.retn());
457 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
459 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
463 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
465 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
469 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
471 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
475 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
477 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
481 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
483 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
484 PyObject *ret=PyList_New(res.size());
486 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
488 PyObject *elt=PyTuple_New(2);
489 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
490 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
491 PyList_SetItem(ret,rk,elt);
496 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
498 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
499 PyObject *ret=PyList_New(res.size());
501 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
503 PyObject *elt=PyTuple_New(3);
504 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
505 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
506 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
507 PyList_SetItem(ret,rk,elt);
512 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
514 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
515 PyObject *ret=PyList_New(res.size());
517 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
519 PyObject *elt=PyTuple_New(2);
520 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
521 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
522 PyList_SetItem(ret,rk,elt);
527 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
529 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
530 PyObject *ret=PyList_New(res.size());
532 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
534 PyObject *elt=PyTuple_New(2);
535 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
536 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
537 PyList_SetItem(ret,rk,elt);
542 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
544 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
545 PyObject *ret=PyList_New(res.size());
547 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
549 PyObject *elt=PyTuple_New(2);
550 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
551 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
552 PyList_SetItem(ret,rk,elt);
557 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
559 int meshDim,spaceDim;
560 mcIdType numberOfNodes;
561 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
562 PyObject *ret=PyTuple_New(4);
563 PyObject *elt0=PyList_New(res.size());
565 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
567 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
569 PyObject *elt1=PyList_New(obj2.size());
570 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
572 PyObject *elt2=PyTuple_New(2);
573 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
574 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
575 PyList_SetItem(elt1,j,elt2);
577 PyList_SetItem(elt0,i,elt1);
579 PyTuple_SetItem(ret,0,elt0);
580 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
581 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
582 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
586 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
587 const std::string& fieldName, PyObject *liIts)
589 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
590 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
591 return convertFieldDoubleVecToPy(res);
594 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
596 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
597 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
598 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
601 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
603 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
604 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
605 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
608 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
610 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
611 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
612 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
615 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
617 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
618 std::size_t size=v.size();
619 PyObject *ret=PyList_New(size);
620 for(std::size_t i=0;i<size;i++)
621 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
625 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
627 std::vector<std::string> grps;
628 converPyListToVecString(li,grps);
629 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
632 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
634 std::vector<std::string> fams;
635 converPyListToVecString(li,fams);
636 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
640 namespace MEDCoupling
642 class MEDFileWritable
645 void copyOptionsFrom(const MEDFileWritable& other) const;
646 int getTooLongStrPolicy() const;
647 void setTooLongStrPolicy(int newVal);
648 int getZipConnPolicy();
649 void setZipConnPolicy(int newVal);
652 class MEDFileWritableStandAlone : public MEDFileWritable
655 void write(const std::string& fileName, int mode) const;
656 void write33(const std::string& fileName, int mode) const;
657 void write30(const std::string& fileName, int mode) const;
660 DataArrayByte *serialize() const
662 MCAuto<DataArrayByte> ret(self->serialize());
666 PyObject *__getstate__()
668 PyObject *ret(PyList_New(0));
672 void __setstate__(PyObject *inp)
678 class MEDFileMeshReadSelector
681 MEDFileMeshReadSelector();
682 MEDFileMeshReadSelector(unsigned int code);
683 mcIdType getNumberOfCoordsLoadSessions();
684 void setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions);
685 unsigned int getCode() const;
686 void setCode(unsigned int newCode);
687 bool isCellFamilyFieldReading() const;
688 bool isNodeFamilyFieldReading() const;
689 bool isCellNameFieldReading() const;
690 bool isNodeNameFieldReading() const;
691 bool isCellNumFieldReading() const;
692 bool isNodeNumFieldReading() const;
693 bool isGlobalNodeNumFieldReading() const;
694 void setCellFamilyFieldReading(bool b);
695 void setNodeFamilyFieldReading(bool b);
696 void setCellNameFieldReading(bool b);
697 void setNodeNameFieldReading(bool b);
698 void setCellNumFieldReading(bool b);
699 void setNodeNumFieldReading(bool b);
700 void setGlobalNodeNumFieldReading(bool b);
703 std::string __str__() const
705 std::ostringstream oss;
710 std::string __repr__() const
712 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
718 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
721 static MEDFileJointCorrespondence *New();
722 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
724 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
725 INTERP_KERNEL::NormalizedCellType loc_geo_type,
726 INTERP_KERNEL::NormalizedCellType rem_geo_type)
728 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
729 MEDFileJointCorrespondence *deepCopy() const;
730 MEDFileJointCorrespondence *shallowCpy() const;
731 void setIsNodal(bool isNodal);
732 bool getIsNodal() const;
733 bool isEqual(const MEDFileJointCorrespondence *other) const;
734 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
735 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
736 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
737 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
738 void setCorrespondence(DataArrayIdType *corr);
739 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
740 std::string simpleRepr() const;
743 MEDFileJointCorrespondence()
745 return MEDFileJointCorrespondence::New();
747 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
749 return MEDFileJointCorrespondence::New(correspondence);
751 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
752 INTERP_KERNEL::NormalizedCellType loc_geo_type,
753 INTERP_KERNEL::NormalizedCellType rem_geo_type)
755 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
758 std::string __str__() const
760 return self->simpleRepr();
763 DataArrayIdType *getCorrespondence() const
765 const DataArrayIdType *ret(self->getCorrespondence());
768 return const_cast<DataArrayIdType *>(ret);
773 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
776 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
777 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
778 MEDFileJointOneStep *deepCopy() const;
779 MEDFileJointOneStep *shallowCpy() const;
780 bool isEqual(const MEDFileJointOneStep *other) const;
781 void setOrder(int order);
782 int getOrder() const;
783 void setIteration(int it);
784 int getIteration() const;
785 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
786 int getNumberOfCorrespondences() const;
787 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
788 std::string simpleRepr() const;
791 MEDFileJointOneStep()
793 return MEDFileJointOneStep::New();
796 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
798 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
801 std::string __str__() const
803 return self->simpleRepr();
806 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
808 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
814 MEDFileJointCorrespondence *__getitem__(int i) const
816 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
821 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
824 static MEDFileJoint *New();
825 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
826 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
827 MEDFileJoint *deepCopy() const;
828 MEDFileJoint *shallowCpy() const;
829 bool isEqual(const MEDFileJoint *other) const;
830 void setLocalMeshName(const std::string& name);
831 std::string getLocalMeshName() const;
832 void setRemoteMeshName(const std::string& name);
833 std::string getRemoteMeshName() const;
834 void setDescription(const std::string& name);
835 std::string getDescription() const;
836 void setJointName(const std::string& name);
837 std::string getJointName() const;
838 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
839 void setDomainNumber(const int& number);
840 int getDomainNumber() const;
841 void pushStep(MEDFileJointOneStep* step);
842 int getNumberOfSteps() const;
843 std::string simpleRepr() const;
848 return MEDFileJoint::New();
851 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
853 return MEDFileJoint::New(fileName,mName,num);
856 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
858 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
861 std::string __str__() const
863 return self->simpleRepr();
866 MEDFileJointOneStep *getStepAtPos(int i) const
868 MEDFileJointOneStep *ret(self->getStepAtPos(i));
874 MEDFileJointOneStep *__getitem__(int i)
876 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
881 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
884 static MEDFileJoints *New();
885 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
886 MEDFileJoints *deepCopy() const;
887 std::string simpleRepr() const;
888 std::string getMeshName() const;
889 int getNumberOfJoints() const;
890 std::vector<std::string> getJointsNames() const;
891 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
892 void resize(int newSize);
893 void pushJoint(MEDFileJoint *joint);
894 void setJointAtPos(int i, MEDFileJoint *joint);
895 void destroyJointAtPos(int i);
900 return MEDFileJoints::New();
903 MEDFileJoints(const std::string& fileName, const std::string& meshName)
905 return MEDFileJoints::New(fileName,meshName);
908 std::string __str__() const
910 return self->simpleRepr();
913 MEDFileJoint *__getitem__(PyObject *obj)
915 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
918 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
923 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
931 return self->getNumberOfJoints();
934 MEDFileJoint *getJointAtPos(int i) const
936 MEDFileJoint *ret=self->getJointAtPos(i);
942 MEDFileJoint *getJointWithName(const std::string& paramName) const
944 MEDFileJoint *ret=self->getJointWithName(paramName);
952 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
955 MEDFileEquivalenceBase();
958 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
961 MEDFileEquivalenceData();
963 void setArray(DataArrayInt32 *data);
966 DataArrayInt32 *getArray()
968 DataArrayInt32 *ret(self->getArray());
969 if(ret) ret->incrRef();
975 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
978 MEDFileEquivalenceNode();
981 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
984 MEDFileEquivalenceCell();
987 std::size_t size() const;
988 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
989 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
992 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
994 DataArrayInt32 *ret(self->getArray(type));
995 if(ret) ret->incrRef();
999 PyObject *getTypes() const
1001 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
1002 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1003 PyObject *res=PyList_New(result.size());
1004 for(int i=0;iL!=result.end(); i++, iL++)
1005 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1011 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
1014 MEDFileEquivalencePair();
1016 std::string getName() const;
1017 void setName(const std::string& name);
1018 std::string getDescription() const;
1019 void setDescription(const std::string& descr);
1020 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
1023 MEDFileEquivalenceCell *initCell()
1025 MEDFileEquivalenceCell *ret(self->initCell());
1026 if(ret) ret->incrRef();
1030 MEDFileEquivalenceNode *initNode()
1032 MEDFileEquivalenceNode *ret(self->initNode());
1033 if(ret) ret->incrRef();
1037 MEDFileEquivalenceCell *getCell()
1039 MEDFileEquivalenceCell *ret(self->getCell());
1040 if(ret) ret->incrRef();
1044 MEDFileEquivalenceNode *getNode()
1046 MEDFileEquivalenceNode *ret(self->getNode());
1047 if(ret) ret->incrRef();
1053 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1056 MEDFileEquivalences();
1059 std::vector<std::string> getEquivalenceNames() const;
1060 void killEquivalenceWithName(const std::string& name);
1061 void killEquivalenceAt(int i);
1065 MEDFileEquivalencePair *getEquivalence(int i)
1067 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1068 if(ret) ret->incrRef();
1071 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1073 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1074 if(ret) ret->incrRef();
1078 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1080 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1081 if(ret) ret->incrRef();
1087 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1090 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1091 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1092 static MEDFileMesh *New(DataArrayByte *db);
1093 virtual MEDFileMesh *createNewEmpty() const;
1094 virtual MEDFileMesh *deepCopy() const;
1095 virtual MEDFileMesh *shallowCpy() const;
1096 virtual void clearNonDiscrAttributes() const;
1097 void setName(const std::string& name);
1098 std::string getName();
1099 std::string getUnivName() const;
1100 bool getUnivNameWrStatus() const;
1101 void setUnivNameWrStatus(bool newStatus);
1102 void setDescription(const std::string& name);
1103 std::string getDescription() const;
1104 void setOrder(int order);
1105 int getOrder() const;
1106 void setIteration(int it);
1108 void setTimeValue(double time);
1109 void setTime(int dt, int it, double time);
1110 double getTimeValue() const;
1111 void setTimeUnit(const std::string& unit);
1112 std::string getTimeUnit() const;
1113 void setAxisType(MEDCouplingAxisType at);
1114 MEDCouplingAxisType getAxisType() const;
1115 virtual int getNumberOfNodes() const;
1116 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1117 virtual bool hasImplicitPart() const;
1118 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1119 virtual void releaseImplicitPartIfAny() const;
1120 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1121 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1122 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1123 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1124 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1125 virtual MEDFileMesh *cartesianize() const;
1126 std::vector<int> getNonEmptyLevels() const;
1127 std::vector<int> getNonEmptyLevelsExt() const;
1128 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1130 bool existsGroup(const std::string& groupName) const;
1131 bool existsFamily(int famId) const;
1132 bool existsFamily(const std::string& familyName) const;
1133 void setFamilyId(const std::string& familyName, int id);
1134 void setFamilyIdUnique(const std::string& familyName, int id);
1135 void addFamily(const std::string& familyName, int id);
1136 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1137 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1138 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1139 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1142 void clearFamGrpMaps();
1143 const std::map<std::string,int>& getFamilyInfo() const;
1144 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1145 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1146 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1147 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1148 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1149 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1150 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1151 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1152 std::vector<std::string> getGroupsNames() const;
1153 std::vector<std::string> getFamiliesNames() const;
1154 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1155 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1156 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1157 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1158 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1159 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1160 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1161 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1162 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1163 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1164 static std::string GetMagicFamilyStr();
1165 void assignFamilyNameWithGroupName();
1166 std::vector<std::string> removeEmptyGroups();
1167 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1168 void removeGroup(const std::string& name);
1169 void removeFamily(const std::string& name);
1170 std::vector<std::string> removeOrphanGroups();
1171 std::vector<std::string> removeOrphanFamilies();
1172 void removeFamiliesReferedByNoGroups();
1173 void rearrangeFamilies();
1175 void checkOrphanFamilyZero() const;
1176 void changeGroupName(const std::string& oldName, const std::string& newName);
1177 void changeFamilyName(const std::string& oldName, const std::string& newName);
1178 void changeFamilyId(int oldId, int newId);
1179 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1180 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1181 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1182 int getFamilyId(const std::string& name) const;
1183 int getMaxAbsFamilyId() const;
1184 int getMaxFamilyId() const;
1185 int getMinFamilyId() const;
1186 int getTheMaxAbsFamilyId() const;
1187 int getTheMaxFamilyId() const;
1188 int getTheMinFamilyId() const;
1189 virtual int getMaxAbsFamilyIdInArrays() const;
1190 virtual int getMaxFamilyIdInArrays() const;
1191 virtual int getMinFamilyIdInArrays() const;
1192 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1193 DataArrayIdType *computeAllFamilyIdsInUse() const;
1194 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1195 std::string getFamilyNameGivenId(int id) const;
1196 bool ensureDifferentFamIdsPerLevel();
1197 void normalizeFamIdsTrio();
1198 void normalizeFamIdsMEDFile();
1199 virtual int getMeshDimension() const;
1200 virtual std::string simpleRepr() const;
1201 virtual std::string advancedRepr() const;
1203 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1204 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1205 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1206 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1207 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1208 virtual void addNodeGroup(const DataArrayIdType *ids);
1209 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1210 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1211 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1212 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1213 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1214 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1215 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1216 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1217 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1218 int getNumberOfJoints();
1219 MEDFileJoints *getJoints();
1220 void setJoints( MEDFileJoints* joints );
1221 void initializeEquivalences();
1222 void killEquivalences();
1223 bool presenceOfStructureElements() const;
1224 void killStructureElements();
1227 std::string __str__() const
1229 return self->simpleRepr();
1232 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1234 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1237 static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(int geoType)
1239 med_geometry_type geoType2((med_geometry_type) geoType);
1240 return MEDFileMesh::ConvertFromMEDFileGeoType(geoType2);
1246 double tmp0=self->getTime(tmp1,tmp2);
1247 PyObject *res = PyList_New(3);
1248 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1249 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1250 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1254 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1257 bool ret0=self->isEqual(other,eps,what);
1258 PyObject *res=PyList_New(2);
1259 PyObject *ret0Py=ret0?Py_True:Py_False;
1261 PyList_SetItem(res,0,ret0Py);
1262 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1266 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1268 std::vector<const DataArrayIdType *> grps;
1269 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1270 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1273 PyObject *areFamsEqual(const MEDFileMesh *other) const
1276 bool ret0=self->areFamsEqual(other,what);
1277 PyObject *res=PyList_New(2);
1278 PyObject *ret0Py=ret0?Py_True:Py_False;
1280 PyList_SetItem(res,0,ret0Py);
1281 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1285 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1288 bool ret0=self->areGrpsEqual(other,what);
1289 PyObject *res=PyList_New(2);
1290 PyObject *ret0Py=ret0?Py_True:Py_False;
1292 PyList_SetItem(res,0,ret0Py);
1293 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1297 PyObject *getAllGeoTypes() const
1299 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1300 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1301 PyObject *res=PyList_New(result.size());
1302 for(int i=0;iL!=result.end(); i++, iL++)
1303 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1307 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1309 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1310 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1311 PyObject *res=PyList_New(result.size());
1312 for(int i=0;iL!=result.end(); i++, iL++)
1313 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1317 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1319 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1322 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1325 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1327 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1330 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1333 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1335 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1338 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1341 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1343 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1346 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1349 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1351 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1354 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1357 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1360 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1361 PyObject *ret=PyTuple_New(2);
1362 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1363 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1367 PyObject *unPolyze()
1369 DataArrayIdType *ret3=0;
1370 std::vector<mcIdType> ret1,ret2;
1371 bool ret0=self->unPolyze(ret1,ret2,ret3);
1372 PyObject *ret=PyTuple_New(4);
1373 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1375 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1376 for(int j=0;j<(int)ret1.size()/3;j++)
1378 PyObject *retLev2=PyList_New(3);
1379 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1380 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1381 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1382 PyList_SetItem(retLev1_0,j,retLev2);
1384 PyTuple_SetItem(ret,1,retLev1_0);
1386 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1387 for(int j=0;j<(int)ret2.size()/3;j++)
1389 PyObject *retLev2=PyList_New(3);
1390 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1391 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1392 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1393 PyList_SetItem(retLev1_1,j,retLev2);
1395 PyTuple_SetItem(ret,2,retLev1_1);
1397 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1401 MEDFileEquivalences *getEquivalences()
1403 MEDFileEquivalences *ret(self->getEquivalences());
1404 if(ret) ret->incrRef();
1408 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1410 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1416 class MEDFileUMesh : public MEDFileMesh
1419 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1420 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1421 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1422 static MEDFileUMesh *New(DataArrayByte *db);
1423 static MEDFileUMesh *New();
1424 static const char *GetSpeStr4ExtMesh();
1426 int getSpaceDimension() const;
1427 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1428 void checkConsistency() const;
1429 void checkSMESHConsistency() const;
1430 void clearNodeAndCellNumbers();
1432 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1433 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1434 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1435 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1436 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1437 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1438 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1439 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1440 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1441 void forceComputationOfParts() const;
1442 void computeRevNum() const;
1444 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1445 void setCoords(DataArrayDouble *coords);
1446 void setCoordsForced(DataArrayDouble *coords);
1447 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1448 void removeMeshAtLevel(int meshDimRelToMax);
1449 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1450 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1451 void optimizeFamilies();
1452 DataArrayIdType *computeFetchedNodeIds() const;
1453 DataArrayIdType *zipCoords();
1454 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1455 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1456 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1457 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1458 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1459 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1462 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1464 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1467 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1469 return MEDFileUMesh::New(fileName,mrs);
1472 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1474 return MEDFileUMesh::New(mem);
1477 MEDFileUMesh(DataArrayByte *db)
1479 return MEDFileUMesh::New(db);
1484 return MEDFileUMesh::New();
1487 static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1489 std::vector<int> typesCpp1;
1490 convertPyToNewIntArr3(types,typesCpp1);
1491 std::size_t sz(typesCpp1.size());
1492 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1493 for(std::size_t ii=0;ii<sz;ii++)
1494 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1495 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1498 static PyObject *LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector<std::string>& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId)
1500 MCAuto<DataArrayDouble> coords;
1501 MCAuto<PartDefinition> partCoords;
1502 MCAuto<DataArrayIdType> famCoords,numCoords;
1503 MCAuto<DataArrayAsciiChar> nameCoord;
1504 MEDFileUMesh::LoadPartCoords(fileName,mName,dt,it,infosOnComp,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoord);
1505 PyObject *ret(PyTuple_New(5));
1506 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1507 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1508 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1509 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1510 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1514 PyObject *__getstate__()
1516 std::vector<double> a0;
1517 std::vector<mcIdType> a1;
1518 std::vector<std::string> a2;
1519 std::vector< MCAuto<DataArrayIdType> > a3;
1520 MCAuto<DataArrayDouble> a4;
1521 self->serialize(a0,a1,a2,a3,a4);
1522 PyObject *ret(PyTuple_New(5));
1523 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1524 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1525 std::size_t sz(a2.size());
1526 PyObject *ret2(PyList_New(sz));
1527 for(std::size_t i=0;i<sz;i++)
1528 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1529 PyTuple_SetItem(ret,2,ret2);
1531 PyObject *ret3(PyList_New(sz));
1532 for(std::size_t i=0;i<sz;i++)
1534 DataArrayIdType *elt(a3[i]);
1537 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1539 PyTuple_SetItem(ret,3,ret3);
1540 DataArrayDouble *ret4(a4);
1543 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1547 void __setstate__(PyObject *inp)
1549 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1550 if(!PyTuple_Check(inp))
1551 throw INTERP_KERNEL::Exception(MSG);
1552 std::size_t sz(PyTuple_Size(inp));
1554 throw INTERP_KERNEL::Exception(MSG);
1555 std::vector<double> a0;
1556 std::vector<mcIdType> a1;
1557 std::vector<std::string> a2;
1558 std::vector< MCAuto<DataArrayIdType> > a3;
1559 MCAuto<DataArrayDouble> a4;
1561 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1563 fillArrayWithPyListDbl3(a0py,tmp,a0);
1564 convertPyToNewIntArr3(a1py,a1);
1565 fillStringVector(a2py,a2);
1567 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1569 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1570 if(!SWIG_IsOK(status))
1571 throw INTERP_KERNEL::Exception(MSG);
1572 a4=reinterpret_cast<DataArrayDouble *>(argp);
1573 if((DataArrayDouble *)a4)
1576 std::vector< DataArrayIdType * > a3Tmp;
1577 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1578 std::size_t sz(a3Tmp.size());
1580 for(std::size_t i=0;i<sz;i++)
1584 a3Tmp[i]->incrRef();
1586 self->unserialize(a0,a1,a2,a3,a4);
1590 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1593 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1594 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1597 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1600 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1603 self->setMeshAtLevel(meshDimRelToMax,m1);
1606 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1609 void __delitem__(int meshDimRelToMax)
1611 self->removeMeshAtLevel(meshDimRelToMax);
1614 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1616 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1618 DataArrayDouble *a,*a2;
1619 DataArrayDoubleTuple *aa,*aa2;
1620 std::vector<double> bb,bb2;
1622 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1623 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1624 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1628 static MEDFileUMesh *Aggregate(PyObject *meshes)
1630 std::vector<const MEDFileUMesh *> meshesCpp;
1631 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1632 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1636 PyObject *getAllDistributionOfTypes() const
1638 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1639 return convertVecPairIntToPy(ret);
1642 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1644 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1645 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1646 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1649 MEDFileUMesh *extractPart(PyObject *extractDef) const
1651 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1652 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1653 return self->extractPart(extractDefCpp);
1656 void setMeshes(PyObject *li, bool renum=false)
1658 std::vector<const MEDCouplingUMesh *> ms;
1659 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1660 self->setMeshes(ms,renum);
1663 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1665 std::vector<const MEDCouplingUMesh *> ms;
1666 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1667 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1670 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1672 std::vector<const MEDCouplingUMesh *> ms;
1673 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1674 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1677 DataArrayDouble *getCoords() const
1679 DataArrayDouble *ret=self->getCoords();
1685 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1687 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1690 return const_cast<PartDefinition *>(ret);
1693 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1695 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1696 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1697 PyObject *ret=PyTuple_New(3);
1698 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1699 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1700 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1704 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1706 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1712 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1714 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1715 std::size_t sz(tmp.size());
1716 PyObject *ret=PyList_New(sz);
1717 for(std::size_t i=0;i<sz;i++)
1721 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1728 class MEDFileStructuredMesh : public MEDFileMesh
1733 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1735 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1743 class MEDFileCMesh : public MEDFileStructuredMesh
1746 static MEDFileCMesh *New();
1747 static MEDFileCMesh *New(DataArrayByte *db);
1748 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1749 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1750 void setMesh(MEDCouplingCMesh *m);
1751 int getSpaceDimension() const;
1756 return MEDFileCMesh::New();
1759 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1761 return MEDFileCMesh::New(fileName,mrs);
1764 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1766 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1769 MEDFileCMesh(DataArrayByte *db)
1771 return MEDFileCMesh::New(db);
1774 PyObject *getMesh() const
1776 const MEDCouplingCMesh *tmp=self->getMesh();
1779 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1784 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1787 static MEDFileCurveLinearMesh *New();
1788 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1789 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1790 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1791 void setMesh(MEDCouplingCurveLinearMesh *m);
1792 int getSpaceDimension() const;
1793 int getMeshDimension() const;
1796 MEDFileCurveLinearMesh()
1798 return MEDFileCurveLinearMesh::New();
1801 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1803 return MEDFileCurveLinearMesh::New(fileName,mrs);
1806 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1808 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1811 MEDFileCurveLinearMesh(DataArrayByte *db)
1813 return MEDFileCurveLinearMesh::New(db);
1816 PyObject *getMesh() const
1818 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1821 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1826 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1829 static MEDFileMeshMultiTS *New();
1830 static MEDFileMeshMultiTS *New(const std::string& fileName);
1831 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1832 MEDFileMeshMultiTS *deepCopy() const;
1833 std::string getName() const;
1834 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1835 void cartesianizeMe();
1838 MEDFileMeshMultiTS()
1840 return MEDFileMeshMultiTS::New();
1843 MEDFileMeshMultiTS(const std::string& fileName)
1845 return MEDFileMeshMultiTS::New(fileName);
1848 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1850 return MEDFileMeshMultiTS::New(fileName,mName);
1853 MEDFileMesh *getOneTimeStep() const
1855 MEDFileMesh *ret=self->getOneTimeStep();
1863 class MEDFileMeshesIterator
1870 MEDFileMesh *ret=self->nextt();
1874 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1878 PyErr_SetString(PyExc_StopIteration,"No more data.");
1885 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1888 static MEDFileMeshes *New();
1889 static MEDFileMeshes *New(DataArrayByte *db);
1890 MEDFileMeshes *deepCopy() const;
1891 int getNumberOfMeshes() const;
1892 std::vector<std::string> getMeshesNames() const;
1894 void resize(int newSize);
1895 void pushMesh(MEDFileMesh *mesh);
1896 void setMeshAtPos(int i, MEDFileMesh *mesh);
1897 void destroyMeshAtPos(int i);
1898 void cartesianizeMe();
1899 bool presenceOfStructureElements() const;
1900 void killStructureElements();
1905 return MEDFileMeshes::New();
1908 MEDFileMeshes(const std::string& fileName)
1910 return MEDFileMeshes::New(fileName);
1913 MEDFileMeshes(DataArrayByte *db)
1915 return MEDFileMeshes::New(db);
1918 std::string __str__() const
1920 return self->simpleRepr();
1923 MEDFileMesh *__getitem__(PyObject *obj)
1925 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1926 if(PyInt_Check(obj))
1928 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1933 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1939 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1941 self->setMeshAtPos(obj,mesh);
1945 MEDFileMeshesIterator *__iter__()
1947 return self->iterator();
1952 return self->getNumberOfMeshes();
1955 MEDFileMesh *getMeshAtPos(int i) const
1957 MEDFileMesh *ret=self->getMeshAtPos(i);
1962 MEDFileMesh *getMeshWithName(const std::string& mname) const
1964 MEDFileMesh *ret=self->getMeshWithName(mname);
1972 class MEDFileFieldLoc : public RefCountObject
1975 std::string getName() const;
1976 int getDimension() const;
1977 int getNumberOfGaussPoints() const;
1978 int getNumberOfPointsInCells() const;
1979 const std::vector<double>& getRefCoords() const;
1980 const std::vector<double>& getGaussCoords() const;
1981 const std::vector<double>& getGaussWeights() const;
1982 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1985 std::string __str__() const
1987 return self->repr();
1992 class MEDFileFieldGlobsReal
1995 void resetContent();
1996 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1997 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1998 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1999 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
2000 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
2001 void checkGlobsCoherency() const;
2002 void checkGlobsPflsPartCoherency() const;
2003 void checkGlobsLocsPartCoherency() const;
2004 std::vector<std::string> getPfls() const;
2005 std::vector<std::string> getLocs() const;
2006 bool existsPfl(const std::string& pflName) const;
2007 bool existsLoc(const std::string& locName) const;
2008 std::string createNewNameOfPfl() const;
2009 std::string createNewNameOfLoc() const;
2010 std::vector< std::vector<int> > whichAreEqualProfiles() const;
2011 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
2012 virtual std::vector<std::string> getPflsReallyUsed() const;
2013 virtual std::vector<std::string> getLocsReallyUsed() const;
2014 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
2015 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
2016 void killProfileIds(const std::vector<int>& pflIds);
2017 void killLocalizationIds(const std::vector<int>& locIds);
2018 void changePflName(const std::string& oldName, const std::string& newName);
2019 void changeLocName(const std::string& oldName, const std::string& newName);
2020 int getNbOfGaussPtPerCell(int locId) const;
2021 int getLocalizationId(const std::string& loc) const;
2022 int getProfileId(const std::string& pfl) const;
2023 void killStructureElementsInGlobs();
2026 PyObject *getProfile(const std::string& pflName) const
2028 const DataArrayIdType *ret=self->getProfile(pflName);
2031 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2034 PyObject *getProfileFromId(int pflId) const
2036 const DataArrayIdType *ret=self->getProfileFromId(pflId);
2039 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2042 PyObject *getLocalizationFromId(int locId) const
2044 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2047 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2050 PyObject *getLocalization(const std::string& locName) const
2052 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2055 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2058 PyObject *zipPflsNames()
2060 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2061 return convertVecPairVecStToPy(ret);
2064 PyObject *zipLocsNames(double eps)
2066 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2067 return convertVecPairVecStToPy(ret);
2070 void changePflsNames(PyObject *li)
2072 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2073 self->changePflsNames(v);
2076 void changePflsRefsNamesGen(PyObject *li)
2078 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2079 self->changePflsRefsNamesGen(v);
2082 void changePflsNamesInStruct(PyObject *li)
2084 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2085 self->changePflsNamesInStruct(v);
2088 void changeLocsNames(PyObject *li)
2090 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2091 self->changeLocsNames(v);
2094 void changeLocsRefsNamesGen(PyObject *li)
2096 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2097 self->changeLocsRefsNamesGen(v);
2100 void changeLocsNamesInStruct(PyObject *li)
2102 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2103 self->changeLocsNamesInStruct(v);
2106 std::string simpleReprGlobs() const
2108 std::ostringstream oss;
2109 self->simpleReprGlobs(oss);
2115 class MEDFileEntities
2120 static MEDFileEntities *BuildFrom(PyObject *entities)
2122 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2123 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2125 std::size_t sz(inp0.size());
2127 for(std::size_t i=0;i<sz;i++)
2128 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2130 return MEDFileEntities::BuildFrom(&inp);
2137 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2140 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2141 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2142 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2143 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2145 void loadArraysIfNecessary();
2146 void unloadArrays();
2147 void unloadArraysWithoutDataLoss();
2148 int getDimension() const;
2149 int getIteration() const;
2150 int getOrder() const;
2151 std::string getName();
2152 void setName(const std::string& name);
2153 std::string getMeshName();
2154 void setMeshName(const std::string& newMeshName);
2155 int getMeshIteration() const;
2156 int getMeshOrder() const;
2157 int getNumberOfComponents() const;
2158 bool isDealingTS(int iteration, int order) const;
2159 void setInfo(const std::vector<std::string>& infos);
2160 const std::vector<std::string>& getInfo() const;
2161 bool presenceOfMultiDiscPerGeoType() const;
2162 void setTime(int iteration, int order, double val);
2163 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2164 MEDFileAnyTypeField1TS *deepCopy() const;
2165 std::string getDtUnit() const;
2166 void setDtUnit(const std::string& dtUnit);
2172 double tmp0=self->getTime(tmp1,tmp2);
2173 PyObject *res = PyList_New(3);
2174 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2175 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2176 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2180 PyObject *getDtIt() const
2182 std::pair<int,int> res=self->getDtIt();
2183 PyObject *elt=PyTuple_New(2);
2184 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2185 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2189 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2191 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2194 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2196 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2199 bool changeMeshNames(PyObject *li)
2201 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2202 return self->changeMeshNames(modifTab);
2205 PyObject *getTypesOfFieldAvailable() const
2207 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2208 PyObject *ret2=PyList_New(ret.size());
2209 for(int i=0;i<(int)ret.size();i++)
2210 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2214 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2216 std::vector<int> ret1;
2217 int ret0=self->getNonEmptyLevels(mname,ret1);
2218 PyObject *elt=PyTuple_New(2);
2219 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2220 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2224 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2226 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2227 std::vector< std::vector<TypeOfField> > typesF;
2228 std::vector< std::vector<std::string> > pfls;
2229 std::vector< std::vector<std::string> > locs;
2230 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2231 std::size_t sz=ret.size();
2232 PyObject *ret2=PyList_New(sz);
2233 for(std::size_t i=0;i<sz;i++)
2235 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2236 const std::vector<TypeOfField>& typesFI=typesF[i];
2237 const std::vector<std::string>& pflsI=pfls[i];
2238 const std::vector<std::string>& locsI=locs[i];
2239 PyObject *elt=PyTuple_New(2);
2240 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2241 std::size_t sz2=ret[i].size();
2242 PyObject *elt2=PyList_New(sz2);
2243 for(std::size_t j=0;j<sz2;j++)
2245 PyObject *elt3=PyTuple_New(4);
2246 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2247 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2248 PyTuple_SetItem(elt3,1,elt4);
2249 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2250 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2251 PyList_SetItem(elt2,j,elt3);
2253 PyTuple_SetItem(elt,1,elt2);
2254 PyList_SetItem(ret2,i,elt);
2259 PyObject *splitComponents() const
2261 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2262 std::size_t sz=ret.size();
2263 PyObject *retPy=PyList_New(sz);
2264 for(std::size_t i=0;i<sz;i++)
2265 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2269 PyObject *splitDiscretizations() const
2271 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2272 std::size_t sz=ret.size();
2273 PyObject *retPy=PyList_New(sz);
2274 for(std::size_t i=0;i<sz;i++)
2275 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2279 PyObject *splitMultiDiscrPerGeoTypes() const
2281 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2282 std::size_t sz=ret.size();
2283 PyObject *retPy=PyList_New(sz);
2284 for(std::size_t i=0;i<sz;i++)
2285 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2289 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2291 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2292 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2293 return self->extractPart(extractDefCpp,mm);
2298 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2301 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2302 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2303 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2304 static MEDFileField1TS *New(DataArrayByte *db);
2305 static MEDFileField1TS *New();
2306 MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2307 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2308 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2309 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2310 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2311 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2312 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2313 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2315 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2316 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2317 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2318 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2319 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2322 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2324 return MEDFileField1TS::New(fileName,loadAll);
2327 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2329 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2332 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2334 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2337 MEDFileField1TS(DataArrayByte *db)
2339 return MEDFileField1TS::New(db);
2344 return MEDFileField1TS::New();
2347 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2349 const DataArrayDouble *arr=0;
2351 arr=field->getArray();
2352 self->copyTinyInfoFrom(field,arr);
2355 std::string __str__() const
2357 return self->simpleRepr();
2360 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2362 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2365 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2367 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2368 std::vector< std::vector<TypeOfField> > typesF;
2369 std::vector< std::vector<std::string> > pfls;
2370 std::vector< std::vector<std::string> > locs;
2371 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2372 std::size_t sz=ret.size();
2373 PyObject *ret2=PyList_New(sz);
2374 for(std::size_t i=0;i<sz;i++)
2376 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2377 const std::vector<TypeOfField>& typesFI=typesF[i];
2378 const std::vector<std::string>& pflsI=pfls[i];
2379 const std::vector<std::string>& locsI=locs[i];
2380 PyObject *elt=PyTuple_New(2);
2381 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2382 std::size_t sz2=ret[i].size();
2383 PyObject *elt2=PyList_New(sz2);
2384 for(std::size_t j=0;j<sz2;j++)
2386 PyObject *elt3=PyTuple_New(4);
2387 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2388 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2389 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2390 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2391 PyList_SetItem(elt2,j,elt3);
2393 PyTuple_SetItem(elt,1,elt2);
2394 PyList_SetItem(ret2,i,elt);
2399 DataArrayDouble *getUndergroundDataArray() const
2401 DataArrayDouble *ret=self->getUndergroundDataArray();
2407 PyObject *getUndergroundDataArrayExt() const
2409 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2414 class MEDFileInt32Field1TS : public MEDFileAnyTypeField1TS
2417 static MEDFileInt32Field1TS *New();
2418 static MEDFileInt32Field1TS *New(const std::string& fileName, bool loadAll=true);
2419 static MEDFileInt32Field1TS *New(DataArrayByte *db);
2420 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2421 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2422 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2424 void setFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
2425 void setFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2426 void setFieldProfileFlatly(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2427 void copyTimeInfoFrom(MEDCouplingFieldInt32 *mcf);
2428 MEDCouplingFieldInt32 *field(const MEDFileMesh *mesh) const;
2429 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2430 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2431 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2432 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2433 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2436 MEDFileInt32Field1TS()
2438 return MEDFileInt32Field1TS::New();
2441 MEDFileInt32Field1TS(const std::string& fileName, bool loadAll=true)
2443 return MEDFileInt32Field1TS::New(fileName,loadAll);
2446 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2448 return MEDFileInt32Field1TS::New(fileName,fieldName,loadAll);
2451 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2453 return MEDFileInt32Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2456 MEDFileInt32Field1TS(DataArrayByte *db)
2458 return MEDFileInt32Field1TS::New(db);
2461 std::string __str__() const
2463 return self->simpleRepr();
2466 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2468 return MEDFileField1TS_getFieldWithProfile<Int32>(self,type,meshDimRelToMax,mesh);
2471 DataArrayInt32 *getUndergroundDataArray() const
2473 DataArrayInt32 *ret=self->getUndergroundDataArray();
2479 PyObject *getUndergroundDataArrayExt() const
2481 return MEDFileField1TS_getUndergroundDataArrayExt<Int32>(self);
2486 class MEDFileInt64Field1TS : public MEDFileAnyTypeField1TS
2489 static MEDFileInt64Field1TS *New();
2490 static MEDFileInt64Field1TS *New(const std::string& fileName, bool loadAll=true);
2491 static MEDFileInt64Field1TS *New(DataArrayByte *db);
2492 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2493 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2494 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2496 void setFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
2497 void setFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2498 void setFieldProfileFlatly(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2499 void copyTimeInfoFrom(MEDCouplingFieldInt64 *mcf);
2500 MEDCouplingFieldInt64 *field(const MEDFileMesh *mesh) const;
2501 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2502 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2503 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2504 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2505 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2508 MEDFileInt64Field1TS()
2510 return MEDFileInt64Field1TS::New();
2513 MEDFileInt64Field1TS(const std::string& fileName, bool loadAll=true)
2515 return MEDFileInt64Field1TS::New(fileName,loadAll);
2518 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2520 return MEDFileInt64Field1TS::New(fileName,fieldName,loadAll);
2523 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2525 return MEDFileInt64Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2528 MEDFileInt64Field1TS(DataArrayByte *db)
2530 return MEDFileInt64Field1TS::New(db);
2533 std::string __str__() const
2535 return self->simpleRepr();
2538 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2540 return MEDFileField1TS_getFieldWithProfile<Int64>(self,type,meshDimRelToMax,mesh);
2543 DataArrayInt64 *getUndergroundDataArray() const
2545 DataArrayInt64 *ret=self->getUndergroundDataArray();
2551 PyObject *getUndergroundDataArrayExt() const
2553 return MEDFileField1TS_getUndergroundDataArrayExt<Int64>(self);
2558 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2561 static MEDFileFloatField1TS *New();
2562 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2563 static MEDFileFloatField1TS *New(DataArrayByte *db);
2564 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2565 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2566 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2568 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2569 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2570 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2571 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2572 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2573 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2574 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2575 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2576 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2577 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2580 MEDFileFloatField1TS()
2582 return MEDFileFloatField1TS::New();
2585 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2587 return MEDFileFloatField1TS::New(fileName,loadAll);
2590 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2592 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2595 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2597 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2600 MEDFileFloatField1TS(DataArrayByte *db)
2602 return MEDFileFloatField1TS::New(db);
2605 std::string __str__() const
2607 return self->simpleRepr();
2610 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2612 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2615 DataArrayFloat *getUndergroundDataArray() const
2617 DataArrayFloat *ret=self->getUndergroundDataArray();
2623 PyObject *getUndergroundDataArrayExt() const
2625 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2630 class MEDFileAnyTypeFieldMultiTSIterator
2637 MEDFileAnyTypeField1TS *ret=self->nextt();
2639 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2642 PyErr_SetString(PyExc_StopIteration,"No more data.");
2649 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2652 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2653 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2654 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2655 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2656 std::string getName() const;
2657 void setName(const std::string& name);
2658 std::string getDtUnit() const;
2659 void setDtUnit(const std::string& dtUnit);
2660 std::string getMeshName() const;
2661 void setMeshName(const std::string& newMeshName);
2662 const std::vector<std::string>& getInfo() const;
2663 bool presenceOfMultiDiscPerGeoType() const;
2664 int getNumberOfComponents() const;
2665 int getNumberOfTS() const;
2666 void eraseEmptyTS();
2667 int getPosOfTimeStep(int iteration, int order) const;
2668 int getPosGivenTime(double time, double eps=1e-8) const;
2670 void loadArraysIfNecessary();
2671 void unloadArrays();
2672 void unloadArraysWithoutDataLoss();
2674 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2675 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2676 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2677 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2678 void synchronizeNameScope();
2679 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2684 return self->getNumberOfTS();
2687 int getTimeId(PyObject *elt0) const
2689 if(elt0 && PyInt_Check(elt0))
2691 int pos=(int)PyInt_AS_LONG(elt0);
2694 else if(elt0 && PyTuple_Check(elt0))
2696 if(PyTuple_Size(elt0)==2)
2698 PyObject *o0=PyTuple_GetItem(elt0,0);
2699 PyObject *o1=PyTuple_GetItem(elt0,1);
2700 if(PyInt_Check(o0) && PyInt_Check(o1))
2702 int iter=(int)PyInt_AS_LONG(o0);
2703 int order=(int)PyInt_AS_LONG(o1);
2704 return self->getPosOfTimeStep(iter,order);
2707 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
2710 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
2712 else if(elt0 && PyFloat_Check(elt0))
2714 double val=PyFloat_AS_DOUBLE(elt0);
2715 return self->getPosGivenTime(val);
2718 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2721 PyObject *getIterations() const
2723 std::vector< std::pair<int,int> > res(self->getIterations());
2724 return convertVecPairIntToPy(res);
2727 PyObject *getTimeSteps() const
2729 std::vector<double> ret1;
2730 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2731 std::size_t sz=ret.size();
2732 PyObject *ret2=PyList_New(sz);
2733 for(std::size_t i=0;i<sz;i++)
2735 PyObject *elt=PyTuple_New(3);
2736 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2737 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2738 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2739 PyList_SetItem(ret2,i,elt);
2744 PyObject *getTypesOfFieldAvailable() const
2746 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2747 PyObject *ret2=PyList_New(ret.size());
2748 for(int i=0;i<(int)ret.size();i++)
2750 const std::vector<TypeOfField>& rett=ret[i];
2751 PyObject *ret3=PyList_New(rett.size());
2752 for(int j=0;j<(int)rett.size();j++)
2753 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2754 PyList_SetItem(ret2,i,ret3);
2759 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2761 std::vector<int> ret1;
2762 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2763 PyObject *elt=PyTuple_New(2);
2764 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2765 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2769 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2771 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2772 std::vector< std::vector<TypeOfField> > typesF;
2773 std::vector< std::vector<std::string> > pfls;
2774 std::vector< std::vector<std::string> > locs;
2775 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2776 std::size_t sz=ret.size();
2777 PyObject *ret2=PyList_New(sz);
2778 for(std::size_t i=0;i<sz;i++)
2780 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2781 const std::vector<TypeOfField>& typesFI=typesF[i];
2782 const std::vector<std::string>& pflsI=pfls[i];
2783 const std::vector<std::string>& locsI=locs[i];
2784 PyObject *elt=PyTuple_New(2);
2785 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2786 std::size_t sz2=ret[i].size();
2787 PyObject *elt2=PyList_New(sz2);
2788 for(std::size_t j=0;j<sz2;j++)
2790 PyObject *elt3=PyTuple_New(4);
2791 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2792 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2793 PyTuple_SetItem(elt3,1,elt4);
2794 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2795 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2796 PyList_SetItem(elt2,j,elt3);
2798 PyTuple_SetItem(elt,1,elt2);
2799 PyList_SetItem(ret2,i,elt);
2804 std::vector<int> getTimeIds(PyObject *elts) const
2806 if(PyList_Check(elts))
2808 std::size_t sz=PyList_Size(elts);
2809 std::vector<int> ret(sz);
2810 for(std::size_t i=0;i<sz;i++)
2812 PyObject *elt=PyList_GetItem(elts,i);
2813 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2819 std::vector<int> ret(1);
2820 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2825 void __delitem__(PyObject *elts)
2827 if(PySlice_Check(elts))
2829 Py_ssize_t strt=2,stp=2,step=2;
2830 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2831 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2835 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2836 if(!idsToRemove.empty())
2837 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2841 void eraseTimeStepIds(PyObject *li)
2845 std::vector<int> pos2;
2846 DataArrayInt32 *pos3=0;
2847 DataArrayIntTuple *pos4=0;
2848 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2853 self->eraseTimeStepIds(&pos1,&pos1+1);
2860 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2865 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2869 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2873 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2875 return self->iterator();
2878 PyObject *__getitem__(PyObject *elt0) const
2880 if(elt0 && PyList_Check(elt0))
2882 std::size_t sz=PyList_Size(elt0);
2883 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2884 int *pt=da->getPointer();
2885 for(std::size_t i=0;i<sz;i++,pt++)
2887 PyObject *elt1=PyList_GetItem(elt0,i);
2888 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2890 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2892 else if(elt0 && PySlice_Check(elt0))
2894 Py_ssize_t strt=2,stp=2,step=2;
2895 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2896 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2899 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2902 bool changeMeshNames(PyObject *li)
2904 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2905 return self->changeMeshNames(modifTab);
2908 PyObject *splitComponents() const
2910 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2911 std::size_t sz=ret.size();
2912 PyObject *retPy=PyList_New(sz);
2913 for(std::size_t i=0;i<sz;i++)
2914 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2918 PyObject *splitDiscretizations() const
2920 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2921 std::size_t sz=ret.size();
2922 PyObject *retPy=PyList_New(sz);
2923 for(std::size_t i=0;i<sz;i++)
2924 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2928 PyObject *splitMultiDiscrPerGeoTypes() const
2930 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2931 std::size_t sz=ret.size();
2932 PyObject *retPy=PyList_New(sz);
2933 for(std::size_t i=0;i<sz;i++)
2934 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2938 void pushBackTimeSteps(PyObject *li)
2941 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2942 if(SWIG_IsOK(status))
2944 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2948 std::vector<MEDFileAnyTypeField1TS *> tmp;
2949 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2950 self->pushBackTimeSteps(tmp);
2954 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2956 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2957 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2958 return self->extractPart(extractDefCpp,mm);
2961 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2963 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2964 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2965 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2966 std::size_t sz=ret.size();
2967 PyObject *retPy=PyList_New(sz);
2968 for(std::size_t i=0;i<sz;i++)
2970 std::size_t sz2=ret[i].size();
2971 PyObject *ret1Py=PyList_New(sz2);
2972 for(std::size_t j=0;j<sz2;j++)
2974 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2977 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2979 PyList_SetItem(retPy,i,ret1Py);
2984 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2986 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2987 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2988 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2989 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2990 if(ret2.size()!=ret.size())
2992 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2993 throw INTERP_KERNEL::Exception(oss.str().c_str());
2995 std::size_t sz=ret.size();
2996 PyObject *retPy=PyList_New(sz);
2997 for(std::size_t i=0;i<sz;i++)
2999 std::size_t sz2=ret[i].size();
3000 PyObject *ret0Py=PyTuple_New(2);
3001 PyObject *ret1Py=PyList_New(sz2);
3002 for(std::size_t j=0;j<sz2;j++)
3004 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
3007 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
3009 PyTuple_SetItem(ret0Py,0,ret1Py);
3010 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
3011 PyList_SetItem(retPy,i,ret0Py);
3018 class MEDFileInt32FieldMultiTS;
3019 class MEDFileInt64FieldMultiTS;
3021 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3024 static MEDFileFieldMultiTS *New();
3025 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3026 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3027 static MEDFileFieldMultiTS *New(DataArrayByte *db);
3029 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
3030 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3031 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3032 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3033 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3034 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3036 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
3037 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3038 MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
3041 static MEDFileAnyTypeFieldMultiTS *Aggregate(PyObject *fmtssPy, PyObject *dtsPy)
3043 std::vector<const MEDFileAnyTypeFieldMultiTS *> fmtss;
3044 convertFromPyObjVectorOfObj<const MEDFileAnyTypeFieldMultiTS *>(fmtssPy,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",fmtss);
3045 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > dts2;
3046 convertPyToVectorVectorPairInt(dtsPy,dts2);
3047 std::vector< std::vector< std::pair<int,mcIdType> > > dts(MEDVectorVectorMIIterator(0,dts2),MEDVectorVectorMIIterator(dts2.size(),dts2));
3048 MCAuto<MEDFileAnyTypeFieldMultiTS> ret = MEDFileFieldMultiTS::Aggregate(fmtss,dts);
3052 MEDFileFieldMultiTS()
3054 return MEDFileFieldMultiTS::New();
3057 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
3059 return MEDFileFieldMultiTS::New(fileName,loadAll);
3062 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3064 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
3067 MEDFileFieldMultiTS(DataArrayByte *db)
3069 return MEDFileFieldMultiTS::New(db);
3072 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3074 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3075 std::size_t sz(tmp.size());
3076 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3077 for(std::size_t i=0;i<sz;i++)
3079 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3080 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3082 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3085 std::string __str__() const
3087 return self->simpleRepr();
3090 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3092 DataArrayIdType *ret1=0;
3093 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3094 PyObject *ret=PyTuple_New(2);
3095 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3096 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3100 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
3102 std::vector<INTERP_KERNEL::NormalizedCellType> types;
3103 std::vector< std::vector<TypeOfField> > typesF;
3104 std::vector< std::vector<std::string> > pfls;
3105 std::vector< std::vector<std::string> > locs;
3106 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
3107 std::size_t sz=ret.size();
3108 PyObject *ret2=PyList_New(sz);
3109 for(std::size_t i=0;i<sz;i++)
3111 const std::vector<DataArrayDouble *>& dadsI=ret[i];
3112 const std::vector<TypeOfField>& typesFI=typesF[i];
3113 const std::vector<std::string>& pflsI=pfls[i];
3114 const std::vector<std::string>& locsI=locs[i];
3115 PyObject *elt=PyTuple_New(2);
3116 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
3117 std::size_t sz2=ret[i].size();
3118 PyObject *elt2=PyList_New(sz2);
3119 for(std::size_t j=0;j<sz2;j++)
3121 PyObject *elt3=PyTuple_New(4);
3122 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
3123 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3124 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3125 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3126 PyList_SetItem(elt2,j,elt3);
3128 PyTuple_SetItem(elt,1,elt2);
3129 PyList_SetItem(ret2,i,elt);
3133 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3135 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3141 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3143 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3144 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3147 PyObject *ret=PyTuple_New(2);
3148 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3149 std::size_t sz=elt1Cpp.size();
3150 PyObject *elt=PyList_New(sz);
3151 for(std::size_t i=0;i<sz;i++)
3153 PyObject *elt1=PyTuple_New(2);
3154 PyObject *elt2=PyTuple_New(2);
3155 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3156 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3157 PyObject *elt3=PyTuple_New(2);
3158 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3159 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3160 PyTuple_SetItem(elt1,0,elt2);
3161 PyTuple_SetItem(elt1,1,elt3);
3162 PyList_SetItem(elt,i,elt1);
3164 PyTuple_SetItem(ret,1,elt);
3170 class MEDFileFieldsIterator
3177 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3179 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3182 PyErr_SetString(PyExc_StopIteration,"No more data.");
3189 class MEDFileInt32FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3192 static MEDFileInt32FieldMultiTS *New();
3193 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3194 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3195 static MEDFileInt32FieldMultiTS *New(DataArrayByte *db);
3197 void appendFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
3198 void appendFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3199 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3200 MEDCouplingFieldInt32 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3201 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3202 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3203 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3204 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3205 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3208 MEDFileInt32FieldMultiTS()
3210 return MEDFileInt32FieldMultiTS::New();
3213 MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true)
3215 return MEDFileInt32FieldMultiTS::New(fileName,loadAll);
3218 MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3220 return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll);
3223 MEDFileInt32FieldMultiTS(DataArrayByte *db)
3225 return MEDFileInt32FieldMultiTS::New(db);
3228 static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3230 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3231 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3232 return MEDFileInt32FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3235 std::string __str__() const
3237 return self->simpleRepr();
3240 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3242 DataArrayIdType *ret1=0;
3243 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3244 PyObject *ret=PyTuple_New(2);
3245 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int32>::TI, SWIG_POINTER_OWN | 0 ));
3246 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3250 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3252 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3260 class MEDFileInt64FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3263 static MEDFileInt64FieldMultiTS *New();
3264 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3265 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3266 static MEDFileInt64FieldMultiTS *New(DataArrayByte *db);
3268 void appendFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
3269 void appendFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3270 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3271 MEDCouplingFieldInt64 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3272 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3273 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3274 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3275 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3276 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3279 MEDFileInt64FieldMultiTS()
3281 return MEDFileInt64FieldMultiTS::New();
3284 MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true)
3286 return MEDFileInt64FieldMultiTS::New(fileName,loadAll);
3289 MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3291 return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll);
3294 MEDFileInt64FieldMultiTS(DataArrayByte *db)
3296 return MEDFileInt64FieldMultiTS::New(db);
3299 static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3301 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3302 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3303 return MEDFileInt64FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3306 std::string __str__() const
3308 return self->simpleRepr();
3311 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3313 DataArrayIdType *ret1=0;
3314 DataArrayInt64 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3315 PyObject *ret=PyTuple_New(2);
3316 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int64>::TI, SWIG_POINTER_OWN | 0 ));
3317 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3321 DataArrayInt64 *getUndergroundDataArray(int iteration, int order) const
3323 DataArrayInt64 *ret=self->getUndergroundDataArray(iteration,order);
3331 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3334 static MEDFileFloatFieldMultiTS *New();
3335 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3336 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3337 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3339 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3340 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3341 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3342 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3343 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3344 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3345 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3346 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3347 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3350 MEDFileFloatFieldMultiTS()
3352 return MEDFileFloatFieldMultiTS::New();
3355 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3357 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3360 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3362 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3365 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3367 return MEDFileFloatFieldMultiTS::New(db);
3370 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3372 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3373 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3374 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3377 std::string __str__() const
3379 return self->simpleRepr();
3382 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3384 DataArrayIdType *ret1=0;
3385 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3386 PyObject *ret=PyTuple_New(2);
3387 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3388 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3392 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3394 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3402 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3405 static MEDFileMeshSupports *New(const std::string& fileName);
3406 std::vector<std::string> getSupMeshNames() const;
3409 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3411 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3412 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3420 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3423 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3425 MEDFileStructureElements();
3428 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3431 static MEDFileFields *New();
3432 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3433 static MEDFileFields *New(DataArrayByte *db);
3434 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3435 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3436 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3437 MEDFileFields *deepCopy() const;
3438 MEDFileFields *shallowCpy() const;
3440 void loadArraysIfNecessary();
3441 void unloadArrays();
3442 void unloadArraysWithoutDataLoss();
3443 int getNumberOfFields() const;
3444 std::vector<std::string> getFieldsNames() const;
3445 std::vector<std::string> getMeshesNames() const;
3447 void resize(int newSize);
3448 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3449 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3450 int getPosFromFieldName(const std::string& fieldName) const;
3451 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3452 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3453 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3454 bool presenceOfStructureElements() const;
3455 void aggregate(const MEDFileFields& other);
3456 void killStructureElements();
3457 void keepOnlyStructureElements();
3458 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3459 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3460 void destroyFieldAtPos(int i);
3461 bool removeFieldsWithoutAnyTimeStep();
3466 return MEDFileFields::New();
3469 MEDFileFields(const std::string& fileName, bool loadAll=true)
3471 return MEDFileFields::New(fileName,loadAll);
3474 MEDFileFields(DataArrayByte *db)
3476 return MEDFileFields::New(db);
3479 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3481 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3484 std::string __str__() const
3486 return self->simpleRepr();
3489 MEDFileFields *partOfThisOnStructureElements() const
3491 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3495 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3497 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3501 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3503 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3504 std::size_t sz(tmp.size());
3505 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3506 for(std::size_t i=0;i<sz;i++)
3508 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3509 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3511 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3514 PyObject *getMeshSENames() const
3516 std::vector< std::pair<std::string,std::string> > ps;
3517 self->getMeshSENames(ps);
3518 return convertVectPairStToPy(ps);
3521 PyObject *getCommonIterations() const
3524 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3525 PyObject *ret=PyTuple_New(2);
3526 PyObject *ret_0=PyList_New(ret0.size());
3528 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3530 PyObject *elt=PyTuple_New(2);
3531 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3532 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3533 PyList_SetItem(ret_0,rk,elt);
3535 PyTuple_SetItem(ret,0,ret_0);
3536 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3537 PyTuple_SetItem(ret,1,ret_1);
3541 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3543 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3544 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3547 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3549 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3550 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3553 PyObject *__getitem__(PyObject *obj)
3555 if(obj && PyList_Check(obj))
3557 std::size_t sz=PyList_Size(obj);
3558 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3559 int *pt=da->getPointer();
3560 for(std::size_t i=0;i<sz;i++,pt++)
3562 PyObject *elt1=PyList_GetItem(obj,i);
3563 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3565 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3568 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3571 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3573 self->setFieldAtPos(obj,field);
3579 return self->getNumberOfFields();
3582 MEDFileFieldsIterator *__iter__()
3584 return self->iterator();
3587 bool changeMeshNames(PyObject *li)
3589 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3590 return self->changeMeshNames(modifTab);
3593 int getPosOfField(PyObject *elt0) const
3595 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3597 throw INTERP_KERNEL::Exception(msg);
3598 if(PyInt_Check(elt0))
3600 return (int)PyInt_AS_LONG(elt0);
3602 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3605 std::vector<int> getPosOfFields(PyObject *elts) const
3607 if(PyList_Check(elts))
3609 std::size_t sz=PyList_Size(elts);
3610 std::vector<int> ret(sz);
3611 for(std::size_t i=0;i<sz;i++)
3613 PyObject *elt=PyList_GetItem(elts,i);
3614 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3620 std::vector<int> ret(1);
3621 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3626 void pushFields(PyObject *fields)
3628 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3629 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3630 self->pushFields(tmp);
3633 void __delitem__(PyObject *elts)
3635 if(elts && PySlice_Check(elts))
3637 Py_ssize_t strt=2,stp=2,step=2;
3638 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3639 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3643 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3644 if(!idsToRemove.empty())
3645 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3649 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3651 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3652 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3653 return self->extractPart(extractDefCpp,mm);
3656 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3658 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3664 class MEDFileParameter1TS : public RefCountObject
3667 void setIteration(int it);
3668 int getIteration() const;
3669 void setOrder(int order);
3670 int getOrder() const;
3671 void setTimeValue(double time);
3672 void setTime(int dt, int it, double time);
3673 double getTime(int& dt, int& it);
3674 double getTimeValue() const;
3677 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3680 void setValue(double val);
3681 double getValue() const;
3682 std::string simpleRepr() const;
3685 std::string __str__() const
3687 return self->simpleRepr();
3692 class MEDFileParameterTinyInfo : public MEDFileWritable
3695 void setDescription(const std::string& name);
3696 std::string getDescription() const;
3697 void setTimeUnit(const std::string& unit);
3698 std::string getTimeUnit() const;
3701 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3704 static MEDFileParameterDouble1TS *New();
3705 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3706 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3707 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3708 virtual MEDFileParameter1TS *deepCopy() const;
3709 virtual std::string simpleRepr() const;
3710 void setName(const std::string& name);
3711 std::string getName() const;
3712 void write(const std::string& fileName, int mode) const;
3715 MEDFileParameterDouble1TS()
3717 return MEDFileParameterDouble1TS::New();
3720 MEDFileParameterDouble1TS(const std::string& fileName)
3722 return MEDFileParameterDouble1TS::New(fileName);
3725 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3727 return MEDFileParameterDouble1TS::New(fileName,paramName);
3730 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3732 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3735 std::string __str__() const
3737 return self->simpleRepr();
3740 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3743 bool ret0=self->isEqual(other,eps,what);
3744 PyObject *res=PyList_New(2);
3745 PyObject *ret0Py=ret0?Py_True:Py_False;
3747 PyList_SetItem(res,0,ret0Py);
3748 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3754 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3757 static MEDFileParameterMultiTS *New();
3758 static MEDFileParameterMultiTS *New(const std::string& fileName);
3759 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3760 std::string getName() const;
3761 void setName(const std::string& name);
3762 MEDFileParameterMultiTS *deepCopy() const;
3763 void write(const std::string& fileName, int mode) const;
3764 std::string simpleRepr() const;
3765 void appendValue(int dt, int it, double time, double val);
3766 double getDoubleValue(int iteration, int order) const;
3767 int getPosOfTimeStep(int iteration, int order) const;
3768 int getPosGivenTime(double time, double eps=1e-8) const;
3769 int getNumberOfTS() const;
3772 MEDFileParameterMultiTS()
3774 return MEDFileParameterMultiTS::New();
3777 MEDFileParameterMultiTS(const std::string& fileName)
3779 return MEDFileParameterMultiTS::New(fileName);
3782 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3784 return MEDFileParameterMultiTS::New(fileName,paramName);
3787 std::string __str__() const
3789 return self->simpleRepr();
3792 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3795 bool ret0=self->isEqual(other,eps,what);
3796 PyObject *res=PyList_New(2);
3797 PyObject *ret0Py=ret0?Py_True:Py_False;
3799 PyList_SetItem(res,0,ret0Py);
3800 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3804 void eraseTimeStepIds(PyObject *ids)
3808 std::vector<int> pos2;
3809 DataArrayInt *pos3=0;
3810 DataArrayIntTuple *pos4=0;
3811 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3816 self->eraseTimeStepIds(&pos1,&pos1+1);
3823 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3828 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3832 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3836 int getTimeStepId(PyObject *elt0) const
3838 if(elt0 && PyInt_Check(elt0))
3840 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3843 else if(elt0 && PyTuple_Check(elt0))
3845 if(PyTuple_Size(elt0)==2)
3847 PyObject *o0=PyTuple_GetItem(elt0,0);
3848 PyObject *o1=PyTuple_GetItem(elt0,1);
3849 if(PyInt_Check(o0) && PyInt_Check(o1))
3851 int iter=(int)PyInt_AS_LONG(o0);
3852 int order=(int)PyInt_AS_LONG(o1);
3853 return self->getPosOfTimeStep(iter,order);
3856 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
3859 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
3861 else if(elt0 && PyFloat_Check(elt0))
3863 double val=PyFloat_AS_DOUBLE(elt0);
3864 return self->getPosGivenTime(val);
3867 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3870 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3872 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3878 std::vector<int> getTimeStepIds(PyObject *elts) const
3880 if(PyList_Check(elts))
3882 std::size_t sz=PyList_Size(elts);
3883 std::vector<int> ret(sz);
3884 for(std::size_t i=0;i<sz;i++)
3886 PyObject *elt=PyList_GetItem(elts,i);
3887 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3893 std::vector<int> ret(1);
3894 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3899 void __delitem__(PyObject *elts)
3901 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3902 if(!idsToRemove.empty())
3903 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3906 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3908 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3914 PyObject *getIterations() const
3916 std::vector< std::pair<int,int> > res=self->getIterations();
3917 PyObject *ret=PyList_New(res.size());
3919 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3921 PyObject *elt=PyTuple_New(2);
3922 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3923 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3924 PyList_SetItem(ret,rk,elt);
3929 PyObject *getTimeSteps() const
3931 std::vector<double> res2;
3932 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3933 PyObject *ret=PyList_New(res.size());
3935 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3937 PyObject *elt=PyTuple_New(3);
3938 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3939 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3940 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3941 PyList_SetItem(ret,rk,elt);
3948 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3951 static MEDFileParameters *New();
3952 static MEDFileParameters *New(const std::string& fileName);
3953 static MEDFileParameters *New(DataArrayByte *db);
3954 MEDFileParameters *deepCopy() const;
3955 std::vector<std::string> getParamsNames() const;
3956 std::string simpleRepr() const;
3957 void resize(int newSize);
3958 void pushParam(MEDFileParameterMultiTS *param);
3959 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3960 void destroyParamAtPos(int i);
3961 int getPosFromParamName(const std::string& paramName) const;
3962 int getNumberOfParams() const;
3967 return MEDFileParameters::New();
3970 MEDFileParameters(const std::string& fileName)
3972 return MEDFileParameters::New(fileName);
3975 MEDFileParameters(DataArrayByte *db)
3977 return MEDFileParameters::New(db);
3980 std::string __str__() const
3982 return self->simpleRepr();
3985 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3987 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3988 if(PyInt_Check(obj))
3990 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3995 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
4003 return self->getNumberOfParams();
4006 MEDFileParameterMultiTS *getParamAtPos(int i) const
4008 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
4014 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
4016 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
4022 PyObject *isEqual(const MEDFileParameters *other, double eps) const
4025 bool ret0=self->isEqual(other,eps,what);
4026 PyObject *res=PyList_New(2);
4027 PyObject *ret0Py=ret0?Py_True:Py_False;
4029 PyList_SetItem(res,0,ret0Py);
4030 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
4036 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
4039 static MEDFileData *New(DataArrayByte *db);
4040 static MEDFileData *New(const std::string& fileName);
4041 static MEDFileData *New();
4042 MEDFileData *deepCopy() const;
4043 void setFields(MEDFileFields *fields);
4044 void setMeshes(MEDFileMeshes *meshes);
4045 void setParams(MEDFileParameters *params);
4046 int getNumberOfFields() const;
4047 int getNumberOfMeshes() const;
4048 int getNumberOfParams() const;
4050 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
4051 bool unPolyzeMeshes();
4052 void dealWithStructureElements();
4053 std::string getHeader() const;
4054 void setHeader(const std::string& header);
4058 MEDFileData(const std::string& fileName)
4060 return MEDFileData::New(fileName);
4063 MEDFileData(DataArrayByte *db)
4065 return MEDFileData::New(db);
4070 return MEDFileData::New();
4073 std::string __str__() const
4075 return self->simpleRepr();
4078 MEDFileMeshes *getMeshes() const
4080 MEDFileMeshes *ret=self->getMeshes();
4086 MEDFileParameters *getParams() const
4088 MEDFileParameters *ret=self->getParams();
4094 MEDFileFields *getFields() const
4096 MEDFileFields *ret=self->getFields();
4102 bool changeMeshNames(PyObject *li)
4104 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
4105 return self->changeMeshNames(modifTab);
4108 static MEDFileData *Aggregate(PyObject *mfds)
4110 std::vector<const MEDFileData *> mfdsCpp;
4111 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
4112 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
4118 class SauvReader : public RefCountObject
4121 static SauvReader* New(const std::string& fileName);
4122 MEDFileData * loadInMEDFileDS();
4125 SauvReader(const std::string& fileName)
4127 return SauvReader::New(fileName);
4132 class SauvWriter : public RefCountObject
4135 static SauvWriter * New();
4136 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
4137 void write(const std::string& fileName);
4138 void setCpyGrpIfOnASingleFamilyStatus(bool status);
4139 bool getCpyGrpIfOnASingleFamilyStatus() const;
4144 return SauvWriter::New();
4151 class MEDFileMeshStruct;
4153 class MEDFileField1TSStructItem
4156 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
4159 class MEDFileMeshStruct : public RefCountObject
4162 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
4164 ~MEDFileMeshStruct();
4167 class MEDMeshMultiLev : public RefCountObject
4170 virtual MEDMeshMultiLev *prepare() const;
4171 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
4172 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
4178 PyObject *retrieveFamilyIdsOnCells() const
4180 DataArrayIdType *famIds(0);
4181 bool isWithoutCopy(false);
4182 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
4183 PyObject *ret=PyTuple_New(2);
4184 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4186 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4187 PyTuple_SetItem(ret,1,ret1Py);
4191 PyObject *retrieveNumberIdsOnCells() const
4193 DataArrayIdType *numIds(0);
4194 bool isWithoutCopy(false);
4195 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4196 PyObject *ret=PyTuple_New(2);
4197 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4199 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4200 PyTuple_SetItem(ret,1,ret1Py);
4204 PyObject *retrieveFamilyIdsOnNodes() const
4206 DataArrayIdType *famIds(0);
4207 bool isWithoutCopy(false);
4208 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4209 PyObject *ret=PyTuple_New(2);
4210 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4212 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4213 PyTuple_SetItem(ret,1,ret1Py);
4217 PyObject *retrieveNumberIdsOnNodes() const
4219 DataArrayIdType *numIds(0);
4220 bool isWithoutCopy(false);
4221 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4222 PyObject *ret=PyTuple_New(2);
4223 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4225 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4226 PyTuple_SetItem(ret,1,ret1Py);
4230 PyObject *getGeoTypes() const
4232 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4233 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4234 PyObject *res(PyList_New(result.size()));
4235 for(int i=0;iL!=result.end(); i++, iL++)
4236 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4242 class MEDUMeshMultiLev : public MEDMeshMultiLev
4245 ~MEDUMeshMultiLev();
4249 PyObject *buildVTUArrays() const
4251 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4252 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4253 PyObject *ret0Py=ncc?Py_True:Py_False;
4255 PyObject *ret=PyTuple_New(7);
4256 PyTuple_SetItem(ret,0,ret0Py);
4257 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4258 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4259 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4260 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4261 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4262 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4268 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4271 ~MEDStructuredMeshMultiLev();
4274 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4277 ~MEDCMeshMultiLev();
4281 PyObject *buildVTUArrays() const
4284 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4285 std::size_t sz(objs.size());
4286 PyObject *ret(PyTuple_New(2));
4287 PyObject *ret0=PyList_New(sz);
4288 for(std::size_t i=0;i<sz;i++)
4289 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4290 PyTuple_SetItem(ret,0,ret0);
4291 PyObject *ret1Py(isInternal?Py_True:Py_False);
4293 PyTuple_SetItem(ret,1,ret1Py);
4299 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4302 ~MEDCurveLinearMeshMultiLev();
4306 PyObject *buildVTUArrays() const
4308 DataArrayDouble *ret0(0);
4309 std::vector<mcIdType> ret1;
4311 self->buildVTUArrays(ret0,ret1,ret2);
4312 std::size_t sz(ret1.size());
4313 PyObject *ret=PyTuple_New(3);
4314 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4315 PyObject *ret1Py=PyList_New(sz);
4316 for(std::size_t i=0;i<sz;i++)
4317 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4318 PyTuple_SetItem(ret,1,ret1Py);
4319 PyObject *ret2Py(ret2?Py_True:Py_False);
4321 PyTuple_SetItem(ret,2,ret2Py);
4327 class MEDFileFastCellSupportComparator : public RefCountObject
4330 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4331 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4332 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4333 int getNumberOfTS() const;
4335 ~MEDFileFastCellSupportComparator();
4339 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4341 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4342 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4343 PyObject *res(PyList_New(result.size()));
4344 for(int i=0;iL!=result.end(); i++, iL++)
4345 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4351 class MeshFormatReader
4354 MeshFormatReader(const std::string& meshFileName, const std::vector<std::string>& fieldFileName);
4356 MEDFileData* loadInMedFileDS();
4357 void setMeshName(const std::string& theMeshName);
4358 std::string getMeshName() const;
4359 void setFile(const std::string& theFileName);
4360 void setFieldFileNames(const std::vector<std::string>& theFieldFileNames);
4361 std::vector<std::string> getFieldFileNames() const;
4363 class MeshFormatWriter
4366 MeshFormatWriter(const std::string& meshFileName, const std::vector<std::string>& fieldFileNames);
4368 void setMeshFileName(const std::string& meshFileName);
4369 std::string getMeshFileName() const;
4370 void setFieldFileNames(const std::vector<std::string>& fieldFileNames);
4371 std::vector<std::string> getFieldFileNames() const;
4372 void setMEDFileDS(MEDCoupling::MEDFileData* mfd);
4382 def exit1TS(self, exctype, exc, tb):
4385 MEDFileAnyTypeField1TS.__enter__=enter1TS
4386 MEDFileAnyTypeField1TS.__exit__=exit1TS
4387 MEDFileIntField1TS = MEDFileInt32Field1TS
4388 MEDFileIntFieldMultiTS = MEDFileInt32FieldMultiTS
4389 if MEDCouplingUse64BitIDs():
4390 MEDFileIDField1TS = MEDFileInt64Field1TS
4391 MEDFileIDFieldMultiTS = MEDFileInt64FieldMultiTS
4393 MEDFileIDField1TS = MEDFileInt32Field1TS
4394 MEDFileIDFieldMultiTS = MEDFileInt32FieldMultiTS