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;
189 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::New;
190 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::field;
191 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::LoadSpecificEntities;
192 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getUndergroundDataArray;
193 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::convertToDouble;
194 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevel;
195 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtTopLevel;
196 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldOnMeshAtLevel;
197 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevelOld;
199 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::New;
200 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::field;
201 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::LoadSpecificEntities;
202 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getUndergroundDataArray;
203 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::convertToDouble;
204 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevel;
205 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtTopLevel;
206 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldOnMeshAtLevel;
207 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevelOld;
209 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
210 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
211 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
212 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
213 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
214 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
215 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
216 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
217 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
219 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
220 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
221 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
222 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
223 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
224 %newobject MEDCoupling::MEDFileField1TS::New;
225 %newobject MEDCoupling::MEDFileField1TS::field;
226 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
227 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
228 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
229 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
230 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
231 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
233 %newobject MEDCoupling::MEDFileInt32Field1TS::New;
234 %newobject MEDCoupling::MEDFileInt32Field1TS::field;
235 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevel;
236 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtTopLevel;
237 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldOnMeshAtLevel;
238 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevelOld;
239 %newobject MEDCoupling::MEDFileInt32Field1TS::getUndergroundDataArray;
240 %newobject MEDCoupling::MEDFileInt32Field1TS::convertToDouble;
242 %newobject MEDCoupling::MEDFileInt64Field1TS::New;
243 %newobject MEDCoupling::MEDFileInt64Field1TS::field;
244 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevel;
245 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtTopLevel;
246 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldOnMeshAtLevel;
247 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevelOld;
248 %newobject MEDCoupling::MEDFileInt64Field1TS::getUndergroundDataArray;
249 %newobject MEDCoupling::MEDFileInt64Field1TS::convertToDouble;
251 %newobject MEDCoupling::MEDFileFloatField1TS::New;
252 %newobject MEDCoupling::MEDFileFloatField1TS::field;
253 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
254 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
255 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
256 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
257 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
258 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
260 %newobject MEDCoupling::MEDFileData::New;
261 %newobject MEDCoupling::MEDFileData::deepCopy;
262 %newobject MEDCoupling::MEDFileData::getMeshes;
263 %newobject MEDCoupling::MEDFileData::getFields;
264 %newobject MEDCoupling::MEDFileData::getParams;
265 %newobject MEDCoupling::MEDFileData::Aggregate;
267 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
269 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
270 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
271 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
272 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
273 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
274 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
275 %newobject MEDCoupling::MEDFileParameters::New;
276 %newobject MEDCoupling::MEDFileParameters::deepCopy;
277 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
278 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
279 %newobject MEDCoupling::MEDFileParameters::__getitem__;
281 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
282 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
283 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
284 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
285 %newobject MEDCoupling::MEDFileJointOneStep::New;
286 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
287 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
288 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
289 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
290 %newobject MEDCoupling::MEDFileJoint::New;
291 %newobject MEDCoupling::MEDFileJoint::deepCopy;
292 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
293 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
294 %newobject MEDCoupling::MEDFileJoint::__getitem__;
295 %newobject MEDCoupling::MEDFileJoints::New;
296 %newobject MEDCoupling::MEDFileJoints::deepCopy;
297 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
298 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
299 %newobject MEDCoupling::MEDFileJoints::__getitem__;
300 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
301 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
302 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
303 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
304 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
305 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
306 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
307 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
308 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
310 %newobject MEDCoupling::SauvWriter::New;
311 %newobject MEDCoupling::SauvReader::New;
312 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
315 %newobject MEDCoupling::MEDFileMeshStruct::New;
316 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
317 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
318 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
319 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
320 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
322 %newobject MEDCoupling::MeshFormatReader::loadInMEDFileDS;
323 %newobject MEDCoupling::MeshFormatReader::MeshFormatReader;
324 %newobject MEDCoupling::MeshFormatWriter::MeshFormatWriter;
326 %feature("unref") MEDFileMesh "$this->decrRef();"
327 %feature("unref") MEDFileUMesh "$this->decrRef();"
328 %feature("unref") MEDFileCMesh "$this->decrRef();"
329 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
330 %feature("unref") MEDFileMeshes "$this->decrRef();"
331 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
332 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
333 %feature("unref") MEDFileField1TS "$this->decrRef();"
334 %feature("unref") MEDFileInt32Field1TS "$this->decrRef();"
335 %feature("unref") MEDFileInt64Field1TS "$this->decrRef();"
336 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
337 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
338 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
339 %feature("unref") MEDFileInt32FieldMultiTS "$this->decrRef();"
340 %feature("unref") MEDFileInt64FieldMultiTS "$this->decrRef();"
341 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
342 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
343 %feature("unref") MEDFileStructureElements "$this->decrRef();"
344 %feature("unref") MEDFileFields "$this->decrRef();"
345 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
346 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
347 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
348 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
349 %feature("unref") MEDFileParameters "$this->decrRef();"
350 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
351 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
352 %feature("unref") MEDFileJoint "$this->decrRef();"
353 %feature("unref") MEDFileJoints "$this->decrRef();"
354 %feature("unref") MEDFileEquivalences "$this->decrRef();"
355 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
356 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
357 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
358 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
359 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
360 %feature("unref") MEDFileData "$this->decrRef();"
361 %feature("unref") SauvReader "$this->decrRef();"
362 %feature("unref") SauvWriter "$this->decrRef();"
363 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
364 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
365 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
366 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
367 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
368 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
370 namespace MEDCoupling
373 std::string MEDFileVersionStr();
374 std::string MEDFileVersionOfFileStr(const std::string& fileName);
375 void SetEpsilonForNodeComp(double val);
376 void SetCompPolicyForCell(int val);
377 void SetTooLongStrPolicy(int val);
378 void CheckFileForRead(const std::string& fileName);
379 std::vector<std::string> GetMeshNames(const std::string& fileName);
380 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
381 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
382 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
383 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
384 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
385 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
386 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
387 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
388 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
389 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
390 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
391 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
392 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
393 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
394 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
395 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
396 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
397 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
398 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
399 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
400 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
401 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
402 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
403 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
404 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
405 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
406 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
409 %rename (MEDFileVersion) MEDFileVersionSwig;
410 %rename (GetFieldIterations) GetFieldIterationsSwig;
411 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
412 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
413 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
414 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
415 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
416 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
417 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
418 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
419 %rename (WriteUMeshes) WriteUMeshesSwig;
420 %rename (GetTypesOfField) GetTypesOfFieldSwig;
421 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
422 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
423 %rename (ReadField) ReadFieldSwig;
424 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
428 PyObject *MEDFileVersionSwig()
430 int major,minor,release;
431 MEDCoupling::MEDFileVersion(major,minor,release);
432 PyObject *ret(PyTuple_New(3));
433 PyTuple_SetItem(ret,0,SWIG_From_int(major));
434 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
435 PyTuple_SetItem(ret,2,SWIG_From_int(release));
439 int MEDFileSizeOfMedInt()
441 return 8*sizeof(med_int);
444 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
446 std::map<std::string,mcIdType> families;
447 std::map<std::string,std::vector<std::string>> groupsOnFam;
448 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
449 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
450 AutoPyPtr ret(PyTuple_New(2));
451 PyTuple_SetItem(ret,0,a.retn());
452 PyTuple_SetItem(ret,1,b.retn());
456 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
458 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
462 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
464 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
468 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
470 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
474 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
476 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
480 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
482 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
483 PyObject *ret=PyList_New(res.size());
485 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
487 PyObject *elt=PyTuple_New(2);
488 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
489 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
490 PyList_SetItem(ret,rk,elt);
495 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
497 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
498 PyObject *ret=PyList_New(res.size());
500 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
502 PyObject *elt=PyTuple_New(3);
503 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
504 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
505 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
506 PyList_SetItem(ret,rk,elt);
511 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
513 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
514 PyObject *ret=PyList_New(res.size());
516 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
518 PyObject *elt=PyTuple_New(2);
519 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
520 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
521 PyList_SetItem(ret,rk,elt);
526 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
528 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
529 PyObject *ret=PyList_New(res.size());
531 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
533 PyObject *elt=PyTuple_New(2);
534 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
535 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
536 PyList_SetItem(ret,rk,elt);
541 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
543 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
544 PyObject *ret=PyList_New(res.size());
546 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
548 PyObject *elt=PyTuple_New(2);
549 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
550 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
551 PyList_SetItem(ret,rk,elt);
556 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
558 int meshDim,spaceDim;
559 mcIdType numberOfNodes;
560 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
561 PyObject *ret=PyTuple_New(4);
562 PyObject *elt0=PyList_New(res.size());
564 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
566 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
568 PyObject *elt1=PyList_New(obj2.size());
569 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
571 PyObject *elt2=PyTuple_New(2);
572 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
573 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
574 PyList_SetItem(elt1,j,elt2);
576 PyList_SetItem(elt0,i,elt1);
578 PyTuple_SetItem(ret,0,elt0);
579 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
580 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
581 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
585 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
586 const std::string& fieldName, PyObject *liIts)
588 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
589 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
590 return convertFieldDoubleVecToPy(res);
593 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
595 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
596 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
597 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
600 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
602 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
603 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
604 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
607 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
609 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
610 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
611 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
614 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
616 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
617 std::size_t size=v.size();
618 PyObject *ret=PyList_New(size);
619 for(std::size_t i=0;i<size;i++)
620 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
624 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
626 std::vector<std::string> grps;
627 converPyListToVecString(li,grps);
628 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
631 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
633 std::vector<std::string> fams;
634 converPyListToVecString(li,fams);
635 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
639 namespace MEDCoupling
641 class MEDFileWritable
644 void copyOptionsFrom(const MEDFileWritable& other) const;
645 int getTooLongStrPolicy() const;
646 void setTooLongStrPolicy(int newVal);
647 int getZipConnPolicy();
648 void setZipConnPolicy(int newVal);
651 class MEDFileWritableStandAlone : public MEDFileWritable
654 void write(const std::string& fileName, int mode) const;
655 void write33(const std::string& fileName, int mode) const;
656 void write30(const std::string& fileName, int mode) const;
659 DataArrayByte *serialize() const
661 MCAuto<DataArrayByte> ret(self->serialize());
665 PyObject *__getstate__()
667 PyObject *ret(PyList_New(0));
671 void __setstate__(PyObject *inp)
677 class MEDFileMeshReadSelector
680 MEDFileMeshReadSelector();
681 MEDFileMeshReadSelector(unsigned int code);
682 mcIdType getNumberOfCoordsLoadSessions();
683 void setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions);
684 unsigned int getCode() const;
685 void setCode(unsigned int newCode);
686 bool isCellFamilyFieldReading() const;
687 bool isNodeFamilyFieldReading() const;
688 bool isCellNameFieldReading() const;
689 bool isNodeNameFieldReading() const;
690 bool isCellNumFieldReading() const;
691 bool isNodeNumFieldReading() const;
692 bool isGlobalNodeNumFieldReading() const;
693 void setCellFamilyFieldReading(bool b);
694 void setNodeFamilyFieldReading(bool b);
695 void setCellNameFieldReading(bool b);
696 void setNodeNameFieldReading(bool b);
697 void setCellNumFieldReading(bool b);
698 void setNodeNumFieldReading(bool b);
699 void setGlobalNodeNumFieldReading(bool b);
702 std::string __str__() const
704 std::ostringstream oss;
709 std::string __repr__() const
711 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
717 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
720 static MEDFileJointCorrespondence *New();
721 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
723 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
724 INTERP_KERNEL::NormalizedCellType loc_geo_type,
725 INTERP_KERNEL::NormalizedCellType rem_geo_type)
727 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
728 MEDFileJointCorrespondence *deepCopy() const;
729 MEDFileJointCorrespondence *shallowCpy() const;
730 void setIsNodal(bool isNodal);
731 bool getIsNodal() const;
732 bool isEqual(const MEDFileJointCorrespondence *other) const;
733 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
734 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
735 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
736 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
737 void setCorrespondence(DataArrayIdType *corr);
738 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
739 std::string simpleRepr() const;
742 MEDFileJointCorrespondence()
744 return MEDFileJointCorrespondence::New();
746 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
748 return MEDFileJointCorrespondence::New(correspondence);
750 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
751 INTERP_KERNEL::NormalizedCellType loc_geo_type,
752 INTERP_KERNEL::NormalizedCellType rem_geo_type)
754 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
757 std::string __str__() const
759 return self->simpleRepr();
762 DataArrayIdType *getCorrespondence() const
764 const DataArrayIdType *ret(self->getCorrespondence());
767 return const_cast<DataArrayIdType *>(ret);
772 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
775 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
776 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
777 MEDFileJointOneStep *deepCopy() const;
778 MEDFileJointOneStep *shallowCpy() const;
779 bool isEqual(const MEDFileJointOneStep *other) const;
780 void setOrder(int order);
781 int getOrder() const;
782 void setIteration(int it);
783 int getIteration() const;
784 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
785 int getNumberOfCorrespondences() const;
786 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
787 std::string simpleRepr() const;
790 MEDFileJointOneStep()
792 return MEDFileJointOneStep::New();
795 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
797 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
800 std::string __str__() const
802 return self->simpleRepr();
805 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
807 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
813 MEDFileJointCorrespondence *__getitem__(int i) const
815 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
820 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
823 static MEDFileJoint *New();
824 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
825 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
826 MEDFileJoint *deepCopy() const;
827 MEDFileJoint *shallowCpy() const;
828 bool isEqual(const MEDFileJoint *other) const;
829 void setLocalMeshName(const std::string& name);
830 std::string getLocalMeshName() const;
831 void setRemoteMeshName(const std::string& name);
832 std::string getRemoteMeshName() const;
833 void setDescription(const std::string& name);
834 std::string getDescription() const;
835 void setJointName(const std::string& name);
836 std::string getJointName() const;
837 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
838 void setDomainNumber(const int& number);
839 int getDomainNumber() const;
840 void pushStep(MEDFileJointOneStep* step);
841 int getNumberOfSteps() const;
842 std::string simpleRepr() const;
847 return MEDFileJoint::New();
850 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
852 return MEDFileJoint::New(fileName,mName,num);
855 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
857 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
860 std::string __str__() const
862 return self->simpleRepr();
865 MEDFileJointOneStep *getStepAtPos(int i) const
867 MEDFileJointOneStep *ret(self->getStepAtPos(i));
873 MEDFileJointOneStep *__getitem__(int i)
875 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
880 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
883 static MEDFileJoints *New();
884 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
885 MEDFileJoints *deepCopy() const;
886 std::string simpleRepr() const;
887 std::string getMeshName() const;
888 int getNumberOfJoints() const;
889 std::vector<std::string> getJointsNames() const;
890 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
891 void resize(int newSize);
892 void pushJoint(MEDFileJoint *joint);
893 void setJointAtPos(int i, MEDFileJoint *joint);
894 void destroyJointAtPos(int i);
899 return MEDFileJoints::New();
902 MEDFileJoints(const std::string& fileName, const std::string& meshName)
904 return MEDFileJoints::New(fileName,meshName);
907 std::string __str__() const
909 return self->simpleRepr();
912 MEDFileJoint *__getitem__(PyObject *obj)
914 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
917 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
922 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
930 return self->getNumberOfJoints();
933 MEDFileJoint *getJointAtPos(int i) const
935 MEDFileJoint *ret=self->getJointAtPos(i);
941 MEDFileJoint *getJointWithName(const std::string& paramName) const
943 MEDFileJoint *ret=self->getJointWithName(paramName);
951 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
954 MEDFileEquivalenceBase();
957 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
960 MEDFileEquivalenceData();
962 void setArray(DataArrayInt32 *data);
965 DataArrayInt32 *getArray()
967 DataArrayInt32 *ret(self->getArray());
968 if(ret) ret->incrRef();
974 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
977 MEDFileEquivalenceNode();
980 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
983 MEDFileEquivalenceCell();
986 std::size_t size() const;
987 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
988 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
991 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
993 DataArrayInt32 *ret(self->getArray(type));
994 if(ret) ret->incrRef();
998 PyObject *getTypes() const
1000 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
1001 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1002 PyObject *res=PyList_New(result.size());
1003 for(int i=0;iL!=result.end(); i++, iL++)
1004 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1010 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
1013 MEDFileEquivalencePair();
1015 std::string getName() const;
1016 void setName(const std::string& name);
1017 std::string getDescription() const;
1018 void setDescription(const std::string& descr);
1019 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
1022 MEDFileEquivalenceCell *initCell()
1024 MEDFileEquivalenceCell *ret(self->initCell());
1025 if(ret) ret->incrRef();
1029 MEDFileEquivalenceNode *initNode()
1031 MEDFileEquivalenceNode *ret(self->initNode());
1032 if(ret) ret->incrRef();
1036 MEDFileEquivalenceCell *getCell()
1038 MEDFileEquivalenceCell *ret(self->getCell());
1039 if(ret) ret->incrRef();
1043 MEDFileEquivalenceNode *getNode()
1045 MEDFileEquivalenceNode *ret(self->getNode());
1046 if(ret) ret->incrRef();
1052 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1055 MEDFileEquivalences();
1058 std::vector<std::string> getEquivalenceNames() const;
1059 void killEquivalenceWithName(const std::string& name);
1060 void killEquivalenceAt(int i);
1064 MEDFileEquivalencePair *getEquivalence(int i)
1066 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1067 if(ret) ret->incrRef();
1070 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1072 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1073 if(ret) ret->incrRef();
1077 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1079 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1080 if(ret) ret->incrRef();
1086 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1089 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1090 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1091 static MEDFileMesh *New(DataArrayByte *db);
1092 virtual MEDFileMesh *createNewEmpty() const;
1093 virtual MEDFileMesh *deepCopy() const;
1094 virtual MEDFileMesh *shallowCpy() const;
1095 virtual void clearNonDiscrAttributes() const;
1096 void setName(const std::string& name);
1097 std::string getName();
1098 std::string getUnivName() const;
1099 bool getUnivNameWrStatus() const;
1100 void setUnivNameWrStatus(bool newStatus);
1101 void setDescription(const std::string& name);
1102 std::string getDescription() const;
1103 void setOrder(int order);
1104 int getOrder() const;
1105 void setIteration(int it);
1107 void setTimeValue(double time);
1108 void setTime(int dt, int it, double time);
1109 double getTimeValue() const;
1110 void setTimeUnit(const std::string& unit);
1111 std::string getTimeUnit() const;
1112 void setAxisType(MEDCouplingAxisType at);
1113 MEDCouplingAxisType getAxisType() const;
1114 virtual int getNumberOfNodes() const;
1115 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1116 virtual bool hasImplicitPart() const;
1117 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1118 virtual void releaseImplicitPartIfAny() const;
1119 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1120 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1121 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1122 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1123 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1124 virtual MEDFileMesh *cartesianize() const;
1125 std::vector<int> getNonEmptyLevels() const;
1126 std::vector<int> getNonEmptyLevelsExt() const;
1127 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1129 bool existsGroup(const std::string& groupName) const;
1130 bool existsFamily(int famId) const;
1131 bool existsFamily(const std::string& familyName) const;
1132 void setFamilyId(const std::string& familyName, int id);
1133 void setFamilyIdUnique(const std::string& familyName, int id);
1134 void addFamily(const std::string& familyName, int id);
1135 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1136 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1137 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1138 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1141 void clearFamGrpMaps();
1142 const std::map<std::string,int>& getFamilyInfo() const;
1143 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1144 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1145 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1146 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1147 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1148 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1149 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1150 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1151 std::vector<std::string> getGroupsNames() const;
1152 std::vector<std::string> getFamiliesNames() const;
1153 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1154 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1155 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1156 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1157 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1158 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1159 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1160 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1161 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1162 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1163 static std::string GetMagicFamilyStr();
1164 void assignFamilyNameWithGroupName();
1165 std::vector<std::string> removeEmptyGroups();
1166 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1167 void removeGroup(const std::string& name);
1168 void removeFamily(const std::string& name);
1169 std::vector<std::string> removeOrphanGroups();
1170 std::vector<std::string> removeOrphanFamilies();
1171 void removeFamiliesReferedByNoGroups();
1172 void rearrangeFamilies();
1174 void checkOrphanFamilyZero() const;
1175 void changeGroupName(const std::string& oldName, const std::string& newName);
1176 void changeFamilyName(const std::string& oldName, const std::string& newName);
1177 void changeFamilyId(int oldId, int newId);
1178 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1179 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1180 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1181 int getFamilyId(const std::string& name) const;
1182 int getMaxAbsFamilyId() const;
1183 int getMaxFamilyId() const;
1184 int getMinFamilyId() const;
1185 int getTheMaxAbsFamilyId() const;
1186 int getTheMaxFamilyId() const;
1187 int getTheMinFamilyId() const;
1188 virtual int getMaxAbsFamilyIdInArrays() const;
1189 virtual int getMaxFamilyIdInArrays() const;
1190 virtual int getMinFamilyIdInArrays() const;
1191 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1192 DataArrayIdType *computeAllFamilyIdsInUse() const;
1193 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1194 std::string getFamilyNameGivenId(int id) const;
1195 bool ensureDifferentFamIdsPerLevel();
1196 void normalizeFamIdsTrio();
1197 void normalizeFamIdsMEDFile();
1198 virtual int getMeshDimension() const;
1199 virtual std::string simpleRepr() const;
1200 virtual std::string advancedRepr() const;
1202 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1203 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1204 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1205 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1206 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1207 virtual void addNodeGroup(const DataArrayIdType *ids);
1208 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1209 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1210 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1211 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1212 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1213 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1214 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1215 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1216 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1217 int getNumberOfJoints();
1218 MEDFileJoints *getJoints();
1219 void setJoints( MEDFileJoints* joints );
1220 void initializeEquivalences();
1221 void killEquivalences();
1222 bool presenceOfStructureElements() const;
1223 void killStructureElements();
1226 std::string __str__() const
1228 return self->simpleRepr();
1231 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1233 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1236 static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(int geoType)
1238 med_geometry_type geoType2((med_geometry_type) geoType);
1239 return MEDFileMesh::ConvertFromMEDFileGeoType(geoType2);
1245 double tmp0=self->getTime(tmp1,tmp2);
1246 PyObject *res = PyList_New(3);
1247 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1248 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1249 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1253 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1256 bool ret0=self->isEqual(other,eps,what);
1257 PyObject *res=PyList_New(2);
1258 PyObject *ret0Py=ret0?Py_True:Py_False;
1260 PyList_SetItem(res,0,ret0Py);
1261 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1265 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1267 std::vector<const DataArrayIdType *> grps;
1268 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1269 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1272 PyObject *areFamsEqual(const MEDFileMesh *other) const
1275 bool ret0=self->areFamsEqual(other,what);
1276 PyObject *res=PyList_New(2);
1277 PyObject *ret0Py=ret0?Py_True:Py_False;
1279 PyList_SetItem(res,0,ret0Py);
1280 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1284 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1287 bool ret0=self->areGrpsEqual(other,what);
1288 PyObject *res=PyList_New(2);
1289 PyObject *ret0Py=ret0?Py_True:Py_False;
1291 PyList_SetItem(res,0,ret0Py);
1292 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1296 PyObject *getAllGeoTypes() const
1298 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1299 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1300 PyObject *res=PyList_New(result.size());
1301 for(int i=0;iL!=result.end(); i++, iL++)
1302 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1306 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1308 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1309 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1310 PyObject *res=PyList_New(result.size());
1311 for(int i=0;iL!=result.end(); i++, iL++)
1312 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1316 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1318 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1321 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1324 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1326 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1329 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1332 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1334 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1337 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1340 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1342 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1345 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1348 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1350 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1353 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1356 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1359 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1360 PyObject *ret=PyTuple_New(2);
1361 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1362 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1366 PyObject *unPolyze()
1368 DataArrayIdType *ret3=0;
1369 std::vector<mcIdType> ret1,ret2;
1370 bool ret0=self->unPolyze(ret1,ret2,ret3);
1371 PyObject *ret=PyTuple_New(4);
1372 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1374 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1375 for(int j=0;j<(int)ret1.size()/3;j++)
1377 PyObject *retLev2=PyList_New(3);
1378 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1379 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1380 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1381 PyList_SetItem(retLev1_0,j,retLev2);
1383 PyTuple_SetItem(ret,1,retLev1_0);
1385 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1386 for(int j=0;j<(int)ret2.size()/3;j++)
1388 PyObject *retLev2=PyList_New(3);
1389 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1390 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1391 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1392 PyList_SetItem(retLev1_1,j,retLev2);
1394 PyTuple_SetItem(ret,2,retLev1_1);
1396 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1400 MEDFileEquivalences *getEquivalences()
1402 MEDFileEquivalences *ret(self->getEquivalences());
1403 if(ret) ret->incrRef();
1407 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1409 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1415 class MEDFileUMesh : public MEDFileMesh
1418 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1419 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1420 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1421 static MEDFileUMesh *New(DataArrayByte *db);
1422 static MEDFileUMesh *New();
1423 static const char *GetSpeStr4ExtMesh();
1425 int getSpaceDimension() const;
1426 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1427 void checkConsistency() const;
1428 void checkSMESHConsistency() const;
1429 void clearNodeAndCellNumbers();
1431 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1432 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1433 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1434 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1435 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1436 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1437 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1438 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1439 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1440 void forceComputationOfParts() const;
1441 void computeRevNum() const;
1443 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1444 void setCoords(DataArrayDouble *coords);
1445 void setCoordsForced(DataArrayDouble *coords);
1446 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1447 void removeMeshAtLevel(int meshDimRelToMax);
1448 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1449 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1450 void optimizeFamilies();
1451 DataArrayIdType *computeFetchedNodeIds() const;
1452 DataArrayIdType *zipCoords();
1453 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1454 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1455 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1456 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1457 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1458 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1461 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1463 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1466 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1468 return MEDFileUMesh::New(fileName,mrs);
1471 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1473 return MEDFileUMesh::New(mem);
1476 MEDFileUMesh(DataArrayByte *db)
1478 return MEDFileUMesh::New(db);
1483 return MEDFileUMesh::New();
1486 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)
1488 std::vector<int> typesCpp1;
1489 convertPyToNewIntArr3(types,typesCpp1);
1490 std::size_t sz(typesCpp1.size());
1491 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1492 for(std::size_t ii=0;ii<sz;ii++)
1493 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1494 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1497 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)
1499 MCAuto<DataArrayDouble> coords;
1500 MCAuto<PartDefinition> partCoords;
1501 MCAuto<DataArrayIdType> famCoords,numCoords;
1502 MCAuto<DataArrayAsciiChar> nameCoord;
1503 MEDFileUMesh::LoadPartCoords(fileName,mName,dt,it,infosOnComp,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoord);
1504 PyObject *ret(PyTuple_New(5));
1505 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1506 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1507 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1508 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1509 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1513 PyObject *__getstate__()
1515 std::vector<double> a0;
1516 std::vector<mcIdType> a1;
1517 std::vector<std::string> a2;
1518 std::vector< MCAuto<DataArrayIdType> > a3;
1519 MCAuto<DataArrayDouble> a4;
1520 self->serialize(a0,a1,a2,a3,a4);
1521 PyObject *ret(PyTuple_New(5));
1522 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1523 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1524 std::size_t sz(a2.size());
1525 PyObject *ret2(PyList_New(sz));
1526 for(std::size_t i=0;i<sz;i++)
1527 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1528 PyTuple_SetItem(ret,2,ret2);
1530 PyObject *ret3(PyList_New(sz));
1531 for(std::size_t i=0;i<sz;i++)
1533 DataArrayIdType *elt(a3[i]);
1536 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1538 PyTuple_SetItem(ret,3,ret3);
1539 DataArrayDouble *ret4(a4);
1542 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1546 void __setstate__(PyObject *inp)
1548 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1549 if(!PyTuple_Check(inp))
1550 throw INTERP_KERNEL::Exception(MSG);
1551 std::size_t sz(PyTuple_Size(inp));
1553 throw INTERP_KERNEL::Exception(MSG);
1554 std::vector<double> a0;
1555 std::vector<mcIdType> a1;
1556 std::vector<std::string> a2;
1557 std::vector< MCAuto<DataArrayIdType> > a3;
1558 MCAuto<DataArrayDouble> a4;
1560 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1562 fillArrayWithPyListDbl3(a0py,tmp,a0);
1563 convertPyToNewIntArr3(a1py,a1);
1564 fillStringVector(a2py,a2);
1566 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1568 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1569 if(!SWIG_IsOK(status))
1570 throw INTERP_KERNEL::Exception(MSG);
1571 a4=reinterpret_cast<DataArrayDouble *>(argp);
1572 if((DataArrayDouble *)a4)
1575 std::vector< DataArrayIdType * > a3Tmp;
1576 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1577 std::size_t sz(a3Tmp.size());
1579 for(std::size_t i=0;i<sz;i++)
1583 a3Tmp[i]->incrRef();
1585 self->unserialize(a0,a1,a2,a3,a4);
1589 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1592 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1593 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1596 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1599 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1602 self->setMeshAtLevel(meshDimRelToMax,m1);
1605 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1608 void __delitem__(int meshDimRelToMax)
1610 self->removeMeshAtLevel(meshDimRelToMax);
1613 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1615 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1617 DataArrayDouble *a,*a2;
1618 DataArrayDoubleTuple *aa,*aa2;
1619 std::vector<double> bb,bb2;
1621 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1622 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1623 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1627 static MEDFileUMesh *Aggregate(PyObject *meshes)
1629 std::vector<const MEDFileUMesh *> meshesCpp;
1630 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1631 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1635 PyObject *getAllDistributionOfTypes() const
1637 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1638 return convertVecPairIntToPy(ret);
1641 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1643 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1644 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1645 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1648 MEDFileUMesh *extractPart(PyObject *extractDef) const
1650 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1651 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1652 return self->extractPart(extractDefCpp);
1655 void setMeshes(PyObject *li, bool renum=false)
1657 std::vector<const MEDCouplingUMesh *> ms;
1658 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1659 self->setMeshes(ms,renum);
1662 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1664 std::vector<const MEDCouplingUMesh *> ms;
1665 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1666 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1669 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1671 std::vector<const MEDCouplingUMesh *> ms;
1672 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1673 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1676 DataArrayDouble *getCoords() const
1678 DataArrayDouble *ret=self->getCoords();
1684 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1686 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1689 return const_cast<PartDefinition *>(ret);
1692 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1694 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1695 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1696 PyObject *ret=PyTuple_New(3);
1697 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1698 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1699 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1703 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1705 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1711 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1713 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1714 std::size_t sz(tmp.size());
1715 PyObject *ret=PyList_New(sz);
1716 for(std::size_t i=0;i<sz;i++)
1720 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1727 class MEDFileStructuredMesh : public MEDFileMesh
1732 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1734 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1742 class MEDFileCMesh : public MEDFileStructuredMesh
1745 static MEDFileCMesh *New();
1746 static MEDFileCMesh *New(DataArrayByte *db);
1747 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1748 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1749 void setMesh(MEDCouplingCMesh *m);
1750 int getSpaceDimension() const;
1755 return MEDFileCMesh::New();
1758 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1760 return MEDFileCMesh::New(fileName,mrs);
1763 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1765 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1768 MEDFileCMesh(DataArrayByte *db)
1770 return MEDFileCMesh::New(db);
1773 PyObject *getMesh() const
1775 const MEDCouplingCMesh *tmp=self->getMesh();
1778 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1783 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1786 static MEDFileCurveLinearMesh *New();
1787 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1788 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1789 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1790 void setMesh(MEDCouplingCurveLinearMesh *m);
1791 int getSpaceDimension() const;
1792 int getMeshDimension() const;
1795 MEDFileCurveLinearMesh()
1797 return MEDFileCurveLinearMesh::New();
1800 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1802 return MEDFileCurveLinearMesh::New(fileName,mrs);
1805 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1807 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1810 MEDFileCurveLinearMesh(DataArrayByte *db)
1812 return MEDFileCurveLinearMesh::New(db);
1815 PyObject *getMesh() const
1817 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1820 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1825 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1828 static MEDFileMeshMultiTS *New();
1829 static MEDFileMeshMultiTS *New(const std::string& fileName);
1830 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1831 MEDFileMeshMultiTS *deepCopy() const;
1832 std::string getName() const;
1833 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1834 void cartesianizeMe();
1837 MEDFileMeshMultiTS()
1839 return MEDFileMeshMultiTS::New();
1842 MEDFileMeshMultiTS(const std::string& fileName)
1844 return MEDFileMeshMultiTS::New(fileName);
1847 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1849 return MEDFileMeshMultiTS::New(fileName,mName);
1852 MEDFileMesh *getOneTimeStep() const
1854 MEDFileMesh *ret=self->getOneTimeStep();
1862 class MEDFileMeshesIterator
1869 MEDFileMesh *ret=self->nextt();
1873 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1877 PyErr_SetString(PyExc_StopIteration,"No more data.");
1884 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1887 static MEDFileMeshes *New();
1888 static MEDFileMeshes *New(DataArrayByte *db);
1889 MEDFileMeshes *deepCopy() const;
1890 int getNumberOfMeshes() const;
1891 std::vector<std::string> getMeshesNames() const;
1893 void resize(int newSize);
1894 void pushMesh(MEDFileMesh *mesh);
1895 void setMeshAtPos(int i, MEDFileMesh *mesh);
1896 void destroyMeshAtPos(int i);
1897 void cartesianizeMe();
1898 bool presenceOfStructureElements() const;
1899 void killStructureElements();
1904 return MEDFileMeshes::New();
1907 MEDFileMeshes(const std::string& fileName)
1909 return MEDFileMeshes::New(fileName);
1912 MEDFileMeshes(DataArrayByte *db)
1914 return MEDFileMeshes::New(db);
1917 std::string __str__() const
1919 return self->simpleRepr();
1922 MEDFileMesh *__getitem__(PyObject *obj)
1924 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1925 if(PyInt_Check(obj))
1927 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1932 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1938 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1940 self->setMeshAtPos(obj,mesh);
1944 MEDFileMeshesIterator *__iter__()
1946 return self->iterator();
1951 return self->getNumberOfMeshes();
1954 MEDFileMesh *getMeshAtPos(int i) const
1956 MEDFileMesh *ret=self->getMeshAtPos(i);
1961 MEDFileMesh *getMeshWithName(const std::string& mname) const
1963 MEDFileMesh *ret=self->getMeshWithName(mname);
1971 class MEDFileFieldLoc : public RefCountObject
1974 std::string getName() const;
1975 int getDimension() const;
1976 int getNumberOfGaussPoints() const;
1977 int getNumberOfPointsInCells() const;
1978 const std::vector<double>& getRefCoords() const;
1979 const std::vector<double>& getGaussCoords() const;
1980 const std::vector<double>& getGaussWeights() const;
1981 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1984 std::string __str__() const
1986 return self->repr();
1991 class MEDFileFieldGlobsReal
1994 void resetContent();
1995 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1996 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1997 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1998 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1999 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
2000 void checkGlobsCoherency() const;
2001 void checkGlobsPflsPartCoherency() const;
2002 void checkGlobsLocsPartCoherency() const;
2003 std::vector<std::string> getPfls() const;
2004 std::vector<std::string> getLocs() const;
2005 bool existsPfl(const std::string& pflName) const;
2006 bool existsLoc(const std::string& locName) const;
2007 std::string createNewNameOfPfl() const;
2008 std::string createNewNameOfLoc() const;
2009 std::vector< std::vector<int> > whichAreEqualProfiles() const;
2010 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
2011 virtual std::vector<std::string> getPflsReallyUsed() const;
2012 virtual std::vector<std::string> getLocsReallyUsed() const;
2013 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
2014 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
2015 void killProfileIds(const std::vector<int>& pflIds);
2016 void killLocalizationIds(const std::vector<int>& locIds);
2017 void changePflName(const std::string& oldName, const std::string& newName);
2018 void changeLocName(const std::string& oldName, const std::string& newName);
2019 int getNbOfGaussPtPerCell(int locId) const;
2020 int getLocalizationId(const std::string& loc) const;
2021 int getProfileId(const std::string& pfl) const;
2022 void killStructureElementsInGlobs();
2025 PyObject *getProfile(const std::string& pflName) const
2027 const DataArrayIdType *ret=self->getProfile(pflName);
2030 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2033 PyObject *getProfileFromId(int pflId) const
2035 const DataArrayIdType *ret=self->getProfileFromId(pflId);
2038 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2041 PyObject *getLocalizationFromId(int locId) const
2043 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2046 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2049 PyObject *getLocalization(const std::string& locName) const
2051 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2054 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2057 PyObject *zipPflsNames()
2059 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2060 return convertVecPairVecStToPy(ret);
2063 PyObject *zipLocsNames(double eps)
2065 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2066 return convertVecPairVecStToPy(ret);
2069 void changePflsNames(PyObject *li)
2071 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2072 self->changePflsNames(v);
2075 void changePflsRefsNamesGen(PyObject *li)
2077 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2078 self->changePflsRefsNamesGen(v);
2081 void changePflsNamesInStruct(PyObject *li)
2083 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2084 self->changePflsNamesInStruct(v);
2087 void changeLocsNames(PyObject *li)
2089 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2090 self->changeLocsNames(v);
2093 void changeLocsRefsNamesGen(PyObject *li)
2095 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2096 self->changeLocsRefsNamesGen(v);
2099 void changeLocsNamesInStruct(PyObject *li)
2101 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2102 self->changeLocsNamesInStruct(v);
2105 std::string simpleReprGlobs() const
2107 std::ostringstream oss;
2108 self->simpleReprGlobs(oss);
2114 class MEDFileEntities
2119 static MEDFileEntities *BuildFrom(PyObject *entities)
2121 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2122 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2124 std::size_t sz(inp0.size());
2126 for(std::size_t i=0;i<sz;i++)
2127 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2129 return MEDFileEntities::BuildFrom(&inp);
2136 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2139 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2140 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2141 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2142 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2144 void loadArraysIfNecessary();
2145 void unloadArrays();
2146 void unloadArraysWithoutDataLoss();
2147 int getDimension() const;
2148 int getIteration() const;
2149 int getOrder() const;
2150 std::string getName();
2151 void setName(const std::string& name);
2152 std::string getMeshName();
2153 void setMeshName(const std::string& newMeshName);
2154 int getMeshIteration() const;
2155 int getMeshOrder() const;
2156 int getNumberOfComponents() const;
2157 bool isDealingTS(int iteration, int order) const;
2158 void setInfo(const std::vector<std::string>& infos);
2159 const std::vector<std::string>& getInfo() const;
2160 bool presenceOfMultiDiscPerGeoType() const;
2161 void setTime(int iteration, int order, double val);
2162 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2163 MEDFileAnyTypeField1TS *deepCopy() const;
2164 std::string getDtUnit() const;
2165 void setDtUnit(const std::string& dtUnit);
2171 double tmp0=self->getTime(tmp1,tmp2);
2172 PyObject *res = PyList_New(3);
2173 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2174 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2175 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2179 PyObject *getDtIt() const
2181 std::pair<int,int> res=self->getDtIt();
2182 PyObject *elt=PyTuple_New(2);
2183 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2184 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2188 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2190 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2193 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2195 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2198 bool changeMeshNames(PyObject *li)
2200 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2201 return self->changeMeshNames(modifTab);
2204 PyObject *getTypesOfFieldAvailable() const
2206 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2207 PyObject *ret2=PyList_New(ret.size());
2208 for(int i=0;i<(int)ret.size();i++)
2209 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2213 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2215 std::vector<int> ret1;
2216 int ret0=self->getNonEmptyLevels(mname,ret1);
2217 PyObject *elt=PyTuple_New(2);
2218 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2219 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2223 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2225 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2226 std::vector< std::vector<TypeOfField> > typesF;
2227 std::vector< std::vector<std::string> > pfls;
2228 std::vector< std::vector<std::string> > locs;
2229 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2230 std::size_t sz=ret.size();
2231 PyObject *ret2=PyList_New(sz);
2232 for(std::size_t i=0;i<sz;i++)
2234 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2235 const std::vector<TypeOfField>& typesFI=typesF[i];
2236 const std::vector<std::string>& pflsI=pfls[i];
2237 const std::vector<std::string>& locsI=locs[i];
2238 PyObject *elt=PyTuple_New(2);
2239 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2240 std::size_t sz2=ret[i].size();
2241 PyObject *elt2=PyList_New(sz2);
2242 for(std::size_t j=0;j<sz2;j++)
2244 PyObject *elt3=PyTuple_New(4);
2245 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2246 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2247 PyTuple_SetItem(elt3,1,elt4);
2248 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2249 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2250 PyList_SetItem(elt2,j,elt3);
2252 PyTuple_SetItem(elt,1,elt2);
2253 PyList_SetItem(ret2,i,elt);
2258 PyObject *splitComponents() const
2260 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2261 std::size_t sz=ret.size();
2262 PyObject *retPy=PyList_New(sz);
2263 for(std::size_t i=0;i<sz;i++)
2264 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2268 PyObject *splitDiscretizations() const
2270 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2271 std::size_t sz=ret.size();
2272 PyObject *retPy=PyList_New(sz);
2273 for(std::size_t i=0;i<sz;i++)
2274 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2278 PyObject *splitMultiDiscrPerGeoTypes() const
2280 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2281 std::size_t sz=ret.size();
2282 PyObject *retPy=PyList_New(sz);
2283 for(std::size_t i=0;i<sz;i++)
2284 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2288 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2290 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2291 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2292 return self->extractPart(extractDefCpp,mm);
2297 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2300 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2301 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2302 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2303 static MEDFileField1TS *New(DataArrayByte *db);
2304 static MEDFileField1TS *New();
2305 MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2306 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2307 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2308 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2309 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2310 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2311 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2312 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2314 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2315 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2316 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2317 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2318 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2321 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2323 return MEDFileField1TS::New(fileName,loadAll);
2326 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2328 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2331 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2333 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2336 MEDFileField1TS(DataArrayByte *db)
2338 return MEDFileField1TS::New(db);
2343 return MEDFileField1TS::New();
2346 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2348 const DataArrayDouble *arr=0;
2350 arr=field->getArray();
2351 self->copyTinyInfoFrom(field,arr);
2354 std::string __str__() const
2356 return self->simpleRepr();
2359 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2361 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2364 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2366 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2367 std::vector< std::vector<TypeOfField> > typesF;
2368 std::vector< std::vector<std::string> > pfls;
2369 std::vector< std::vector<std::string> > locs;
2370 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2371 std::size_t sz=ret.size();
2372 PyObject *ret2=PyList_New(sz);
2373 for(std::size_t i=0;i<sz;i++)
2375 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2376 const std::vector<TypeOfField>& typesFI=typesF[i];
2377 const std::vector<std::string>& pflsI=pfls[i];
2378 const std::vector<std::string>& locsI=locs[i];
2379 PyObject *elt=PyTuple_New(2);
2380 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2381 std::size_t sz2=ret[i].size();
2382 PyObject *elt2=PyList_New(sz2);
2383 for(std::size_t j=0;j<sz2;j++)
2385 PyObject *elt3=PyTuple_New(4);
2386 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2387 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2388 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2389 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2390 PyList_SetItem(elt2,j,elt3);
2392 PyTuple_SetItem(elt,1,elt2);
2393 PyList_SetItem(ret2,i,elt);
2398 DataArrayDouble *getUndergroundDataArray() const
2400 DataArrayDouble *ret=self->getUndergroundDataArray();
2406 PyObject *getUndergroundDataArrayExt() const
2408 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2413 class MEDFileInt32Field1TS : public MEDFileAnyTypeField1TS
2416 static MEDFileInt32Field1TS *New();
2417 static MEDFileInt32Field1TS *New(const std::string& fileName, bool loadAll=true);
2418 static MEDFileInt32Field1TS *New(DataArrayByte *db);
2419 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2420 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2421 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2423 void setFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
2424 void setFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2425 void setFieldProfileFlatly(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2426 void copyTimeInfoFrom(MEDCouplingFieldInt32 *mcf);
2427 MEDCouplingFieldInt32 *field(const MEDFileMesh *mesh) const;
2428 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2429 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2430 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2431 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2432 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2435 MEDFileInt32Field1TS()
2437 return MEDFileInt32Field1TS::New();
2440 MEDFileInt32Field1TS(const std::string& fileName, bool loadAll=true)
2442 return MEDFileInt32Field1TS::New(fileName,loadAll);
2445 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2447 return MEDFileInt32Field1TS::New(fileName,fieldName,loadAll);
2450 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2452 return MEDFileInt32Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2455 MEDFileInt32Field1TS(DataArrayByte *db)
2457 return MEDFileInt32Field1TS::New(db);
2460 std::string __str__() const
2462 return self->simpleRepr();
2465 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2467 return MEDFileField1TS_getFieldWithProfile<Int32>(self,type,meshDimRelToMax,mesh);
2470 DataArrayInt32 *getUndergroundDataArray() const
2472 DataArrayInt32 *ret=self->getUndergroundDataArray();
2478 PyObject *getUndergroundDataArrayExt() const
2480 return MEDFileField1TS_getUndergroundDataArrayExt<Int32>(self);
2485 class MEDFileInt64Field1TS : public MEDFileAnyTypeField1TS
2488 static MEDFileInt64Field1TS *New();
2489 static MEDFileInt64Field1TS *New(const std::string& fileName, bool loadAll=true);
2490 static MEDFileInt64Field1TS *New(DataArrayByte *db);
2491 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2492 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2493 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2495 void setFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
2496 void setFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2497 void setFieldProfileFlatly(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2498 void copyTimeInfoFrom(MEDCouplingFieldInt64 *mcf);
2499 MEDCouplingFieldInt64 *field(const MEDFileMesh *mesh) const;
2500 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2501 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2502 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2503 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2504 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2507 MEDFileInt64Field1TS()
2509 return MEDFileInt64Field1TS::New();
2512 MEDFileInt64Field1TS(const std::string& fileName, bool loadAll=true)
2514 return MEDFileInt64Field1TS::New(fileName,loadAll);
2517 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2519 return MEDFileInt64Field1TS::New(fileName,fieldName,loadAll);
2522 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2524 return MEDFileInt64Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2527 MEDFileInt64Field1TS(DataArrayByte *db)
2529 return MEDFileInt64Field1TS::New(db);
2532 std::string __str__() const
2534 return self->simpleRepr();
2537 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2539 return MEDFileField1TS_getFieldWithProfile<Int64>(self,type,meshDimRelToMax,mesh);
2542 DataArrayInt64 *getUndergroundDataArray() const
2544 DataArrayInt64 *ret=self->getUndergroundDataArray();
2550 PyObject *getUndergroundDataArrayExt() const
2552 return MEDFileField1TS_getUndergroundDataArrayExt<Int64>(self);
2557 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2560 static MEDFileFloatField1TS *New();
2561 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2562 static MEDFileFloatField1TS *New(DataArrayByte *db);
2563 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2564 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2565 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2567 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2568 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2569 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2570 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2571 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2572 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2573 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2574 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2575 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2576 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2579 MEDFileFloatField1TS()
2581 return MEDFileFloatField1TS::New();
2584 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2586 return MEDFileFloatField1TS::New(fileName,loadAll);
2589 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2591 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2594 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2596 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2599 MEDFileFloatField1TS(DataArrayByte *db)
2601 return MEDFileFloatField1TS::New(db);
2604 std::string __str__() const
2606 return self->simpleRepr();
2609 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2611 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2614 DataArrayFloat *getUndergroundDataArray() const
2616 DataArrayFloat *ret=self->getUndergroundDataArray();
2622 PyObject *getUndergroundDataArrayExt() const
2624 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2629 class MEDFileAnyTypeFieldMultiTSIterator
2636 MEDFileAnyTypeField1TS *ret=self->nextt();
2638 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2641 PyErr_SetString(PyExc_StopIteration,"No more data.");
2648 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2651 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2652 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2653 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2654 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2655 std::string getName() const;
2656 void setName(const std::string& name);
2657 std::string getDtUnit() const;
2658 void setDtUnit(const std::string& dtUnit);
2659 std::string getMeshName() const;
2660 void setMeshName(const std::string& newMeshName);
2661 const std::vector<std::string>& getInfo() const;
2662 bool presenceOfMultiDiscPerGeoType() const;
2663 int getNumberOfComponents() const;
2664 int getNumberOfTS() const;
2665 void eraseEmptyTS();
2666 int getPosOfTimeStep(int iteration, int order) const;
2667 int getPosGivenTime(double time, double eps=1e-8) const;
2669 void loadArraysIfNecessary();
2670 void unloadArrays();
2671 void unloadArraysWithoutDataLoss();
2673 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2674 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2675 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2676 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2677 void synchronizeNameScope();
2678 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2683 return self->getNumberOfTS();
2686 int getTimeId(PyObject *elt0) const
2688 if(elt0 && PyInt_Check(elt0))
2690 int pos=(int)PyInt_AS_LONG(elt0);
2693 else if(elt0 && PyTuple_Check(elt0))
2695 if(PyTuple_Size(elt0)==2)
2697 PyObject *o0=PyTuple_GetItem(elt0,0);
2698 PyObject *o1=PyTuple_GetItem(elt0,1);
2699 if(PyInt_Check(o0) && PyInt_Check(o1))
2701 int iter=(int)PyInt_AS_LONG(o0);
2702 int order=(int)PyInt_AS_LONG(o1);
2703 return self->getPosOfTimeStep(iter,order);
2706 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 !");
2709 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 !");
2711 else if(elt0 && PyFloat_Check(elt0))
2713 double val=PyFloat_AS_DOUBLE(elt0);
2714 return self->getPosGivenTime(val);
2717 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2720 PyObject *getIterations() const
2722 std::vector< std::pair<int,int> > res(self->getIterations());
2723 return convertVecPairIntToPy(res);
2726 PyObject *getTimeSteps() const
2728 std::vector<double> ret1;
2729 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2730 std::size_t sz=ret.size();
2731 PyObject *ret2=PyList_New(sz);
2732 for(std::size_t i=0;i<sz;i++)
2734 PyObject *elt=PyTuple_New(3);
2735 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2736 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2737 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2738 PyList_SetItem(ret2,i,elt);
2743 PyObject *getTypesOfFieldAvailable() const
2745 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2746 PyObject *ret2=PyList_New(ret.size());
2747 for(int i=0;i<(int)ret.size();i++)
2749 const std::vector<TypeOfField>& rett=ret[i];
2750 PyObject *ret3=PyList_New(rett.size());
2751 for(int j=0;j<(int)rett.size();j++)
2752 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2753 PyList_SetItem(ret2,i,ret3);
2758 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2760 std::vector<int> ret1;
2761 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2762 PyObject *elt=PyTuple_New(2);
2763 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2764 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2768 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2770 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2771 std::vector< std::vector<TypeOfField> > typesF;
2772 std::vector< std::vector<std::string> > pfls;
2773 std::vector< std::vector<std::string> > locs;
2774 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2775 std::size_t sz=ret.size();
2776 PyObject *ret2=PyList_New(sz);
2777 for(std::size_t i=0;i<sz;i++)
2779 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2780 const std::vector<TypeOfField>& typesFI=typesF[i];
2781 const std::vector<std::string>& pflsI=pfls[i];
2782 const std::vector<std::string>& locsI=locs[i];
2783 PyObject *elt=PyTuple_New(2);
2784 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2785 std::size_t sz2=ret[i].size();
2786 PyObject *elt2=PyList_New(sz2);
2787 for(std::size_t j=0;j<sz2;j++)
2789 PyObject *elt3=PyTuple_New(4);
2790 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2791 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2792 PyTuple_SetItem(elt3,1,elt4);
2793 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2794 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2795 PyList_SetItem(elt2,j,elt3);
2797 PyTuple_SetItem(elt,1,elt2);
2798 PyList_SetItem(ret2,i,elt);
2803 std::vector<int> getTimeIds(PyObject *elts) const
2805 if(PyList_Check(elts))
2807 std::size_t sz=PyList_Size(elts);
2808 std::vector<int> ret(sz);
2809 for(std::size_t i=0;i<sz;i++)
2811 PyObject *elt=PyList_GetItem(elts,i);
2812 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2818 std::vector<int> ret(1);
2819 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2824 void __delitem__(PyObject *elts)
2826 if(PySlice_Check(elts))
2828 Py_ssize_t strt=2,stp=2,step=2;
2829 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2830 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2834 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2835 if(!idsToRemove.empty())
2836 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2840 void eraseTimeStepIds(PyObject *li)
2844 std::vector<int> pos2;
2845 DataArrayInt32 *pos3=0;
2846 DataArrayIntTuple *pos4=0;
2847 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2852 self->eraseTimeStepIds(&pos1,&pos1+1);
2859 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2864 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2868 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2872 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2874 return self->iterator();
2877 PyObject *__getitem__(PyObject *elt0) const
2879 if(elt0 && PyList_Check(elt0))
2881 std::size_t sz=PyList_Size(elt0);
2882 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2883 int *pt=da->getPointer();
2884 for(std::size_t i=0;i<sz;i++,pt++)
2886 PyObject *elt1=PyList_GetItem(elt0,i);
2887 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2889 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2891 else if(elt0 && PySlice_Check(elt0))
2893 Py_ssize_t strt=2,stp=2,step=2;
2894 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2895 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2898 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2901 bool changeMeshNames(PyObject *li)
2903 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2904 return self->changeMeshNames(modifTab);
2907 PyObject *splitComponents() const
2909 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2910 std::size_t sz=ret.size();
2911 PyObject *retPy=PyList_New(sz);
2912 for(std::size_t i=0;i<sz;i++)
2913 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2917 PyObject *splitDiscretizations() const
2919 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2920 std::size_t sz=ret.size();
2921 PyObject *retPy=PyList_New(sz);
2922 for(std::size_t i=0;i<sz;i++)
2923 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2927 PyObject *splitMultiDiscrPerGeoTypes() const
2929 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2930 std::size_t sz=ret.size();
2931 PyObject *retPy=PyList_New(sz);
2932 for(std::size_t i=0;i<sz;i++)
2933 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2937 void pushBackTimeSteps(PyObject *li)
2940 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2941 if(SWIG_IsOK(status))
2943 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2947 std::vector<MEDFileAnyTypeField1TS *> tmp;
2948 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2949 self->pushBackTimeSteps(tmp);
2953 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2955 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2956 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2957 return self->extractPart(extractDefCpp,mm);
2960 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2962 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2963 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2964 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2965 std::size_t sz=ret.size();
2966 PyObject *retPy=PyList_New(sz);
2967 for(std::size_t i=0;i<sz;i++)
2969 std::size_t sz2=ret[i].size();
2970 PyObject *ret1Py=PyList_New(sz2);
2971 for(std::size_t j=0;j<sz2;j++)
2973 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2976 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2978 PyList_SetItem(retPy,i,ret1Py);
2983 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2985 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2986 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2987 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2988 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2989 if(ret2.size()!=ret.size())
2991 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2992 throw INTERP_KERNEL::Exception(oss.str().c_str());
2994 std::size_t sz=ret.size();
2995 PyObject *retPy=PyList_New(sz);
2996 for(std::size_t i=0;i<sz;i++)
2998 std::size_t sz2=ret[i].size();
2999 PyObject *ret0Py=PyTuple_New(2);
3000 PyObject *ret1Py=PyList_New(sz2);
3001 for(std::size_t j=0;j<sz2;j++)
3003 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
3006 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
3008 PyTuple_SetItem(ret0Py,0,ret1Py);
3009 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
3010 PyList_SetItem(retPy,i,ret0Py);
3017 class MEDFileInt32FieldMultiTS;
3018 class MEDFileInt64FieldMultiTS;
3020 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3023 static MEDFileFieldMultiTS *New();
3024 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3025 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3026 static MEDFileFieldMultiTS *New(DataArrayByte *db);
3028 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
3029 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3030 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3031 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3032 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3033 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3035 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
3036 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3037 MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
3040 MEDFileFieldMultiTS()
3042 return MEDFileFieldMultiTS::New();
3045 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
3047 return MEDFileFieldMultiTS::New(fileName,loadAll);
3050 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3052 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
3055 MEDFileFieldMultiTS(DataArrayByte *db)
3057 return MEDFileFieldMultiTS::New(db);
3060 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3062 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3063 std::size_t sz(tmp.size());
3064 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3065 for(std::size_t i=0;i<sz;i++)
3067 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3068 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3070 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3073 std::string __str__() const
3075 return self->simpleRepr();
3078 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3080 DataArrayIdType *ret1=0;
3081 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3082 PyObject *ret=PyTuple_New(2);
3083 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3084 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3088 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
3090 std::vector<INTERP_KERNEL::NormalizedCellType> types;
3091 std::vector< std::vector<TypeOfField> > typesF;
3092 std::vector< std::vector<std::string> > pfls;
3093 std::vector< std::vector<std::string> > locs;
3094 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
3095 std::size_t sz=ret.size();
3096 PyObject *ret2=PyList_New(sz);
3097 for(std::size_t i=0;i<sz;i++)
3099 const std::vector<DataArrayDouble *>& dadsI=ret[i];
3100 const std::vector<TypeOfField>& typesFI=typesF[i];
3101 const std::vector<std::string>& pflsI=pfls[i];
3102 const std::vector<std::string>& locsI=locs[i];
3103 PyObject *elt=PyTuple_New(2);
3104 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
3105 std::size_t sz2=ret[i].size();
3106 PyObject *elt2=PyList_New(sz2);
3107 for(std::size_t j=0;j<sz2;j++)
3109 PyObject *elt3=PyTuple_New(4);
3110 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
3111 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3112 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3113 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3114 PyList_SetItem(elt2,j,elt3);
3116 PyTuple_SetItem(elt,1,elt2);
3117 PyList_SetItem(ret2,i,elt);
3121 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3123 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3129 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3131 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3132 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3135 PyObject *ret=PyTuple_New(2);
3136 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3137 std::size_t sz=elt1Cpp.size();
3138 PyObject *elt=PyList_New(sz);
3139 for(std::size_t i=0;i<sz;i++)
3141 PyObject *elt1=PyTuple_New(2);
3142 PyObject *elt2=PyTuple_New(2);
3143 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3144 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3145 PyObject *elt3=PyTuple_New(2);
3146 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3147 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3148 PyTuple_SetItem(elt1,0,elt2);
3149 PyTuple_SetItem(elt1,1,elt3);
3150 PyList_SetItem(elt,i,elt1);
3152 PyTuple_SetItem(ret,1,elt);
3158 class MEDFileFieldsIterator
3165 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3167 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3170 PyErr_SetString(PyExc_StopIteration,"No more data.");
3177 class MEDFileInt32FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3180 static MEDFileInt32FieldMultiTS *New();
3181 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3182 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3183 static MEDFileInt32FieldMultiTS *New(DataArrayByte *db);
3185 void appendFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
3186 void appendFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3187 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3188 MEDCouplingFieldInt32 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3189 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3190 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3191 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3192 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3193 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3196 MEDFileInt32FieldMultiTS()
3198 return MEDFileInt32FieldMultiTS::New();
3201 MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true)
3203 return MEDFileInt32FieldMultiTS::New(fileName,loadAll);
3206 MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3208 return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll);
3211 MEDFileInt32FieldMultiTS(DataArrayByte *db)
3213 return MEDFileInt32FieldMultiTS::New(db);
3216 static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3218 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3219 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3220 return MEDFileInt32FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3223 std::string __str__() const
3225 return self->simpleRepr();
3228 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3230 DataArrayIdType *ret1=0;
3231 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3232 PyObject *ret=PyTuple_New(2);
3233 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int32>::TI, SWIG_POINTER_OWN | 0 ));
3234 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3238 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3240 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3248 class MEDFileInt64FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3251 static MEDFileInt64FieldMultiTS *New();
3252 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3253 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3254 static MEDFileInt64FieldMultiTS *New(DataArrayByte *db);
3256 void appendFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
3257 void appendFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3258 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3259 MEDCouplingFieldInt64 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3260 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3261 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3262 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3263 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3264 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3267 MEDFileInt64FieldMultiTS()
3269 return MEDFileInt64FieldMultiTS::New();
3272 MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true)
3274 return MEDFileInt64FieldMultiTS::New(fileName,loadAll);
3277 MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3279 return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll);
3282 MEDFileInt64FieldMultiTS(DataArrayByte *db)
3284 return MEDFileInt64FieldMultiTS::New(db);
3287 static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3289 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3290 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3291 return MEDFileInt64FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3294 std::string __str__() const
3296 return self->simpleRepr();
3299 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3301 DataArrayIdType *ret1=0;
3302 DataArrayInt64 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3303 PyObject *ret=PyTuple_New(2);
3304 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int64>::TI, SWIG_POINTER_OWN | 0 ));
3305 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3309 DataArrayInt64 *getUndergroundDataArray(int iteration, int order) const
3311 DataArrayInt64 *ret=self->getUndergroundDataArray(iteration,order);
3319 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3322 static MEDFileFloatFieldMultiTS *New();
3323 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3324 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3325 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3327 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3328 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3329 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3330 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3331 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3332 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3333 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3334 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3335 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3338 MEDFileFloatFieldMultiTS()
3340 return MEDFileFloatFieldMultiTS::New();
3343 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3345 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3348 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3350 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3353 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3355 return MEDFileFloatFieldMultiTS::New(db);
3358 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3360 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3361 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3362 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3365 std::string __str__() const
3367 return self->simpleRepr();
3370 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3372 DataArrayIdType *ret1=0;
3373 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3374 PyObject *ret=PyTuple_New(2);
3375 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3376 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3380 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3382 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3390 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3393 static MEDFileMeshSupports *New(const std::string& fileName);
3394 std::vector<std::string> getSupMeshNames() const;
3397 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3399 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3400 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3408 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3411 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3413 MEDFileStructureElements();
3416 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3419 static MEDFileFields *New();
3420 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3421 static MEDFileFields *New(DataArrayByte *db);
3422 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3423 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3424 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3425 MEDFileFields *deepCopy() const;
3426 MEDFileFields *shallowCpy() const;
3428 void loadArraysIfNecessary();
3429 void unloadArrays();
3430 void unloadArraysWithoutDataLoss();
3431 int getNumberOfFields() const;
3432 std::vector<std::string> getFieldsNames() const;
3433 std::vector<std::string> getMeshesNames() const;
3435 void resize(int newSize);
3436 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3437 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3438 int getPosFromFieldName(const std::string& fieldName) const;
3439 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3440 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3441 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3442 bool presenceOfStructureElements() const;
3443 void aggregate(const MEDFileFields& other);
3444 void killStructureElements();
3445 void keepOnlyStructureElements();
3446 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3447 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3448 void destroyFieldAtPos(int i);
3449 bool removeFieldsWithoutAnyTimeStep();
3454 return MEDFileFields::New();
3457 MEDFileFields(const std::string& fileName, bool loadAll=true)
3459 return MEDFileFields::New(fileName,loadAll);
3462 MEDFileFields(DataArrayByte *db)
3464 return MEDFileFields::New(db);
3467 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3469 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3472 std::string __str__() const
3474 return self->simpleRepr();
3477 MEDFileFields *partOfThisOnStructureElements() const
3479 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3483 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3485 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3489 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3491 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3492 std::size_t sz(tmp.size());
3493 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3494 for(std::size_t i=0;i<sz;i++)
3496 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3497 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3499 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3502 PyObject *getMeshSENames() const
3504 std::vector< std::pair<std::string,std::string> > ps;
3505 self->getMeshSENames(ps);
3506 return convertVectPairStToPy(ps);
3509 PyObject *getCommonIterations() const
3512 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3513 PyObject *ret=PyTuple_New(2);
3514 PyObject *ret_0=PyList_New(ret0.size());
3516 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3518 PyObject *elt=PyTuple_New(2);
3519 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3520 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3521 PyList_SetItem(ret_0,rk,elt);
3523 PyTuple_SetItem(ret,0,ret_0);
3524 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3525 PyTuple_SetItem(ret,1,ret_1);
3529 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3531 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3532 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3535 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3537 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3538 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3541 PyObject *__getitem__(PyObject *obj)
3543 if(obj && PyList_Check(obj))
3545 std::size_t sz=PyList_Size(obj);
3546 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3547 int *pt=da->getPointer();
3548 for(std::size_t i=0;i<sz;i++,pt++)
3550 PyObject *elt1=PyList_GetItem(obj,i);
3551 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3553 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3556 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3559 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3561 self->setFieldAtPos(obj,field);
3567 return self->getNumberOfFields();
3570 MEDFileFieldsIterator *__iter__()
3572 return self->iterator();
3575 bool changeMeshNames(PyObject *li)
3577 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3578 return self->changeMeshNames(modifTab);
3581 int getPosOfField(PyObject *elt0) const
3583 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3585 throw INTERP_KERNEL::Exception(msg);
3586 if(PyInt_Check(elt0))
3588 return (int)PyInt_AS_LONG(elt0);
3590 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3593 std::vector<int> getPosOfFields(PyObject *elts) const
3595 if(PyList_Check(elts))
3597 std::size_t sz=PyList_Size(elts);
3598 std::vector<int> ret(sz);
3599 for(std::size_t i=0;i<sz;i++)
3601 PyObject *elt=PyList_GetItem(elts,i);
3602 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3608 std::vector<int> ret(1);
3609 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3614 void pushFields(PyObject *fields)
3616 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3617 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3618 self->pushFields(tmp);
3621 void __delitem__(PyObject *elts)
3623 if(elts && PySlice_Check(elts))
3625 Py_ssize_t strt=2,stp=2,step=2;
3626 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3627 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3631 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3632 if(!idsToRemove.empty())
3633 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3637 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3639 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3640 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3641 return self->extractPart(extractDefCpp,mm);
3644 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3646 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3652 class MEDFileParameter1TS : public RefCountObject
3655 void setIteration(int it);
3656 int getIteration() const;
3657 void setOrder(int order);
3658 int getOrder() const;
3659 void setTimeValue(double time);
3660 void setTime(int dt, int it, double time);
3661 double getTime(int& dt, int& it);
3662 double getTimeValue() const;
3665 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3668 void setValue(double val);
3669 double getValue() const;
3670 std::string simpleRepr() const;
3673 std::string __str__() const
3675 return self->simpleRepr();
3680 class MEDFileParameterTinyInfo : public MEDFileWritable
3683 void setDescription(const std::string& name);
3684 std::string getDescription() const;
3685 void setTimeUnit(const std::string& unit);
3686 std::string getTimeUnit() const;
3689 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3692 static MEDFileParameterDouble1TS *New();
3693 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3694 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3695 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3696 virtual MEDFileParameter1TS *deepCopy() const;
3697 virtual std::string simpleRepr() const;
3698 void setName(const std::string& name);
3699 std::string getName() const;
3700 void write(const std::string& fileName, int mode) const;
3703 MEDFileParameterDouble1TS()
3705 return MEDFileParameterDouble1TS::New();
3708 MEDFileParameterDouble1TS(const std::string& fileName)
3710 return MEDFileParameterDouble1TS::New(fileName);
3713 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3715 return MEDFileParameterDouble1TS::New(fileName,paramName);
3718 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3720 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3723 std::string __str__() const
3725 return self->simpleRepr();
3728 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3731 bool ret0=self->isEqual(other,eps,what);
3732 PyObject *res=PyList_New(2);
3733 PyObject *ret0Py=ret0?Py_True:Py_False;
3735 PyList_SetItem(res,0,ret0Py);
3736 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3742 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3745 static MEDFileParameterMultiTS *New();
3746 static MEDFileParameterMultiTS *New(const std::string& fileName);
3747 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3748 std::string getName() const;
3749 void setName(const std::string& name);
3750 MEDFileParameterMultiTS *deepCopy() const;
3751 void write(const std::string& fileName, int mode) const;
3752 std::string simpleRepr() const;
3753 void appendValue(int dt, int it, double time, double val);
3754 double getDoubleValue(int iteration, int order) const;
3755 int getPosOfTimeStep(int iteration, int order) const;
3756 int getPosGivenTime(double time, double eps=1e-8) const;
3757 int getNumberOfTS() const;
3760 MEDFileParameterMultiTS()
3762 return MEDFileParameterMultiTS::New();
3765 MEDFileParameterMultiTS(const std::string& fileName)
3767 return MEDFileParameterMultiTS::New(fileName);
3770 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3772 return MEDFileParameterMultiTS::New(fileName,paramName);
3775 std::string __str__() const
3777 return self->simpleRepr();
3780 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3783 bool ret0=self->isEqual(other,eps,what);
3784 PyObject *res=PyList_New(2);
3785 PyObject *ret0Py=ret0?Py_True:Py_False;
3787 PyList_SetItem(res,0,ret0Py);
3788 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3792 void eraseTimeStepIds(PyObject *ids)
3796 std::vector<int> pos2;
3797 DataArrayInt *pos3=0;
3798 DataArrayIntTuple *pos4=0;
3799 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3804 self->eraseTimeStepIds(&pos1,&pos1+1);
3811 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3816 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3820 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3824 int getTimeStepId(PyObject *elt0) const
3826 if(elt0 && PyInt_Check(elt0))
3828 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3831 else if(elt0 && PyTuple_Check(elt0))
3833 if(PyTuple_Size(elt0)==2)
3835 PyObject *o0=PyTuple_GetItem(elt0,0);
3836 PyObject *o1=PyTuple_GetItem(elt0,1);
3837 if(PyInt_Check(o0) && PyInt_Check(o1))
3839 int iter=(int)PyInt_AS_LONG(o0);
3840 int order=(int)PyInt_AS_LONG(o1);
3841 return self->getPosOfTimeStep(iter,order);
3844 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 !");
3847 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 !");
3849 else if(elt0 && PyFloat_Check(elt0))
3851 double val=PyFloat_AS_DOUBLE(elt0);
3852 return self->getPosGivenTime(val);
3855 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3858 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3860 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3866 std::vector<int> getTimeStepIds(PyObject *elts) const
3868 if(PyList_Check(elts))
3870 std::size_t sz=PyList_Size(elts);
3871 std::vector<int> ret(sz);
3872 for(std::size_t i=0;i<sz;i++)
3874 PyObject *elt=PyList_GetItem(elts,i);
3875 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3881 std::vector<int> ret(1);
3882 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3887 void __delitem__(PyObject *elts)
3889 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3890 if(!idsToRemove.empty())
3891 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3894 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3896 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3902 PyObject *getIterations() const
3904 std::vector< std::pair<int,int> > res=self->getIterations();
3905 PyObject *ret=PyList_New(res.size());
3907 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3909 PyObject *elt=PyTuple_New(2);
3910 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3911 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3912 PyList_SetItem(ret,rk,elt);
3917 PyObject *getTimeSteps() const
3919 std::vector<double> res2;
3920 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3921 PyObject *ret=PyList_New(res.size());
3923 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3925 PyObject *elt=PyTuple_New(3);
3926 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3927 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3928 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3929 PyList_SetItem(ret,rk,elt);
3936 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3939 static MEDFileParameters *New();
3940 static MEDFileParameters *New(const std::string& fileName);
3941 static MEDFileParameters *New(DataArrayByte *db);
3942 MEDFileParameters *deepCopy() const;
3943 std::vector<std::string> getParamsNames() const;
3944 std::string simpleRepr() const;
3945 void resize(int newSize);
3946 void pushParam(MEDFileParameterMultiTS *param);
3947 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3948 void destroyParamAtPos(int i);
3949 int getPosFromParamName(const std::string& paramName) const;
3950 int getNumberOfParams() const;
3955 return MEDFileParameters::New();
3958 MEDFileParameters(const std::string& fileName)
3960 return MEDFileParameters::New(fileName);
3963 MEDFileParameters(DataArrayByte *db)
3965 return MEDFileParameters::New(db);
3968 std::string __str__() const
3970 return self->simpleRepr();
3973 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3975 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3976 if(PyInt_Check(obj))
3978 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3983 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3991 return self->getNumberOfParams();
3994 MEDFileParameterMultiTS *getParamAtPos(int i) const
3996 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
4002 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
4004 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
4010 PyObject *isEqual(const MEDFileParameters *other, double eps) const
4013 bool ret0=self->isEqual(other,eps,what);
4014 PyObject *res=PyList_New(2);
4015 PyObject *ret0Py=ret0?Py_True:Py_False;
4017 PyList_SetItem(res,0,ret0Py);
4018 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
4024 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
4027 static MEDFileData *New(DataArrayByte *db);
4028 static MEDFileData *New(const std::string& fileName);
4029 static MEDFileData *New();
4030 MEDFileData *deepCopy() const;
4031 void setFields(MEDFileFields *fields);
4032 void setMeshes(MEDFileMeshes *meshes);
4033 void setParams(MEDFileParameters *params);
4034 int getNumberOfFields() const;
4035 int getNumberOfMeshes() const;
4036 int getNumberOfParams() const;
4038 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
4039 bool unPolyzeMeshes();
4040 void dealWithStructureElements();
4041 std::string getHeader() const;
4042 void setHeader(const std::string& header);
4046 MEDFileData(const std::string& fileName)
4048 return MEDFileData::New(fileName);
4051 MEDFileData(DataArrayByte *db)
4053 return MEDFileData::New(db);
4058 return MEDFileData::New();
4061 std::string __str__() const
4063 return self->simpleRepr();
4066 MEDFileMeshes *getMeshes() const
4068 MEDFileMeshes *ret=self->getMeshes();
4074 MEDFileParameters *getParams() const
4076 MEDFileParameters *ret=self->getParams();
4082 MEDFileFields *getFields() const
4084 MEDFileFields *ret=self->getFields();
4090 bool changeMeshNames(PyObject *li)
4092 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
4093 return self->changeMeshNames(modifTab);
4096 static MEDFileData *Aggregate(PyObject *mfds)
4098 std::vector<const MEDFileData *> mfdsCpp;
4099 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
4100 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
4106 class SauvReader : public RefCountObject
4109 static SauvReader* New(const std::string& fileName);
4110 MEDFileData * loadInMEDFileDS();
4113 SauvReader(const std::string& fileName)
4115 return SauvReader::New(fileName);
4120 class SauvWriter : public RefCountObject
4123 static SauvWriter * New();
4124 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
4125 void write(const std::string& fileName);
4126 void setCpyGrpIfOnASingleFamilyStatus(bool status);
4127 bool getCpyGrpIfOnASingleFamilyStatus() const;
4132 return SauvWriter::New();
4139 class MEDFileMeshStruct;
4141 class MEDFileField1TSStructItem
4144 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
4147 class MEDFileMeshStruct : public RefCountObject
4150 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
4152 ~MEDFileMeshStruct();
4155 class MEDMeshMultiLev : public RefCountObject
4158 virtual MEDMeshMultiLev *prepare() const;
4159 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
4160 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
4166 PyObject *retrieveFamilyIdsOnCells() const
4168 DataArrayIdType *famIds(0);
4169 bool isWithoutCopy(false);
4170 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
4171 PyObject *ret=PyTuple_New(2);
4172 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4174 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4175 PyTuple_SetItem(ret,1,ret1Py);
4179 PyObject *retrieveNumberIdsOnCells() const
4181 DataArrayIdType *numIds(0);
4182 bool isWithoutCopy(false);
4183 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4184 PyObject *ret=PyTuple_New(2);
4185 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4187 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4188 PyTuple_SetItem(ret,1,ret1Py);
4192 PyObject *retrieveFamilyIdsOnNodes() const
4194 DataArrayIdType *famIds(0);
4195 bool isWithoutCopy(false);
4196 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4197 PyObject *ret=PyTuple_New(2);
4198 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4200 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4201 PyTuple_SetItem(ret,1,ret1Py);
4205 PyObject *retrieveNumberIdsOnNodes() const
4207 DataArrayIdType *numIds(0);
4208 bool isWithoutCopy(false);
4209 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4210 PyObject *ret=PyTuple_New(2);
4211 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4214 PyTuple_SetItem(ret,1,ret1Py);
4218 PyObject *getGeoTypes() const
4220 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4221 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4222 PyObject *res(PyList_New(result.size()));
4223 for(int i=0;iL!=result.end(); i++, iL++)
4224 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4230 class MEDUMeshMultiLev : public MEDMeshMultiLev
4233 ~MEDUMeshMultiLev();
4237 PyObject *buildVTUArrays() const
4239 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4240 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4241 PyObject *ret0Py=ncc?Py_True:Py_False;
4243 PyObject *ret=PyTuple_New(7);
4244 PyTuple_SetItem(ret,0,ret0Py);
4245 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4246 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4247 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4248 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4249 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4250 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4256 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4259 ~MEDStructuredMeshMultiLev();
4262 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4265 ~MEDCMeshMultiLev();
4269 PyObject *buildVTUArrays() const
4272 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4273 std::size_t sz(objs.size());
4274 PyObject *ret(PyTuple_New(2));
4275 PyObject *ret0=PyList_New(sz);
4276 for(std::size_t i=0;i<sz;i++)
4277 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4278 PyTuple_SetItem(ret,0,ret0);
4279 PyObject *ret1Py(isInternal?Py_True:Py_False);
4281 PyTuple_SetItem(ret,1,ret1Py);
4287 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4290 ~MEDCurveLinearMeshMultiLev();
4294 PyObject *buildVTUArrays() const
4296 DataArrayDouble *ret0(0);
4297 std::vector<mcIdType> ret1;
4299 self->buildVTUArrays(ret0,ret1,ret2);
4300 std::size_t sz(ret1.size());
4301 PyObject *ret=PyTuple_New(3);
4302 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4303 PyObject *ret1Py=PyList_New(sz);
4304 for(std::size_t i=0;i<sz;i++)
4305 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4306 PyTuple_SetItem(ret,1,ret1Py);
4307 PyObject *ret2Py(ret2?Py_True:Py_False);
4309 PyTuple_SetItem(ret,2,ret2Py);
4315 class MEDFileFastCellSupportComparator : public RefCountObject
4318 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4319 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4320 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4321 int getNumberOfTS() const;
4323 ~MEDFileFastCellSupportComparator();
4327 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4329 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4330 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4331 PyObject *res(PyList_New(result.size()));
4332 for(int i=0;iL!=result.end(); i++, iL++)
4333 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4339 class MeshFormatReader
4342 MeshFormatReader(const std::string& meshFileName, const std::vector<std::string>& fieldFileName);
4344 MEDFileData* loadInMedFileDS();
4345 void setMeshName(const std::string& theMeshName);
4346 std::string getMeshName() const;
4347 void setFile(const std::string& theFileName);
4348 void setFieldFileNames(const std::vector<std::string>& theFieldFileNames);
4349 std::vector<std::string> getFieldFileNames() const;
4351 class MeshFormatWriter
4354 MeshFormatWriter(const std::string& meshFileName, const std::vector<std::string>& fieldFileNames);
4356 void setMeshFileName(const std::string& meshFileName);
4357 std::string getMeshFileName() const;
4358 void setFieldFileNames(const std::vector<std::string>& fieldFileNames);
4359 std::vector<std::string> getFieldFileNames() const;
4360 void setMEDFileDS(MEDCoupling::MEDFileData* mfd);
4370 def exit1TS(self, exctype, exc, tb):
4373 MEDFileAnyTypeField1TS.__enter__=enter1TS
4374 MEDFileAnyTypeField1TS.__exit__=exit1TS
4375 MEDFileIntField1TS = MEDFileInt32Field1TS
4376 MEDFileIntFieldMultiTS = MEDFileInt32FieldMultiTS
4377 if MEDCouplingUse64BitIDs():
4378 MEDFileIDField1TS = MEDFileInt64Field1TS
4379 MEDFileIDFieldMultiTS = MEDFileInt64FieldMultiTS
4381 MEDFileIDField1TS = MEDFileInt32Field1TS
4382 MEDFileIDFieldMultiTS = MEDFileInt32FieldMultiTS