1 // Copyright (C) 2017-2019 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 "MEDLoaderTypemaps.i"
42 #include "SauvReader.hxx"
43 #include "SauvWriter.hxx"
45 using namespace MEDCoupling;
48 #if SWIG_VERSION >= 0x010329
49 %template() std::vector<std::string>;
52 %typemap(out) MEDCoupling::MEDFileMesh*
54 $result=convertMEDFileMesh($1,$owner);
57 %typemap(out) MEDCoupling::MEDFileParameter1TS*
59 $result=convertMEDFileParameter1TS($1,$owner);
62 %typemap(out) MEDCoupling::MEDFileAnyTypeFieldMultiTS*
64 $result=convertMEDFileFieldMultiTS($1,$owner);
67 %typemap(out) MEDCoupling::MEDFileAnyTypeField1TS*
69 $result=convertMEDFileField1TS($1,$owner);
72 %typemap(out) MEDCoupling::MEDMeshMultiLev*
74 $result=convertMEDMeshMultiLev($1,$owner);
77 %newobject ReadUMeshFromFamiliesSwig;
78 %newobject ReadUMeshFromGroupsSwig;
79 %newobject ReadFieldSwig;
80 %newobject MEDCoupling::ReadUMeshFromFile;
81 %newobject MEDCoupling::ReadMeshFromFile;
82 %newobject MEDCoupling::ReadFieldCell;
83 %newobject MEDCoupling::ReadFieldNode;
84 %newobject MEDCoupling::ReadFieldGauss;
85 %newobject MEDCoupling::ReadFieldGaussNE;
86 %newobject MEDCoupling::MEDFileMesh::New;
87 %newobject MEDCoupling::MEDFileMesh::createNewEmpty;
88 %newobject MEDCoupling::MEDFileMesh::deepCopy;
89 %newobject MEDCoupling::MEDFileMesh::shallowCpy;
90 %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel;
91 %newobject MEDCoupling::MEDFileMesh::__getitem__;
92 %newobject MEDCoupling::MEDFileMesh::getGroupArr;
93 %newobject MEDCoupling::MEDFileMesh::getGroupsArr;
94 %newobject MEDCoupling::MEDFileMesh::getFamilyArr;
95 %newobject MEDCoupling::MEDFileMesh::getFamiliesArr;
96 %newobject MEDCoupling::MEDFileMesh::getNodeGroupArr;
97 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
98 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
99 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
100 %newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
101 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
102 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
103 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
104 %newobject MEDCoupling::MEDFileMesh::cartesianize;
105 %newobject MEDCoupling::MEDFileData::getJoints;
106 %newobject MEDCoupling::MEDFileStructuredMesh::getImplicitFaceMesh;
107 %newobject MEDCoupling::MEDFileUMesh::New;
108 %newobject MEDCoupling::MEDFileUMesh::LoadPartOf;
109 %newobject MEDCoupling::MEDFileUMesh::getCoords;
110 %newobject MEDCoupling::MEDFileUMesh::getPartDefAtLevel;
111 %newobject MEDCoupling::MEDFileUMesh::getGroup;
112 %newobject MEDCoupling::MEDFileUMesh::getGroups;
113 %newobject MEDCoupling::MEDFileUMesh::getFamily;
114 %newobject MEDCoupling::MEDFileUMesh::getFamilies;
115 %newobject MEDCoupling::MEDFileUMesh::getLevel0Mesh;
116 %newobject MEDCoupling::MEDFileUMesh::getLevelM1Mesh;
117 %newobject MEDCoupling::MEDFileUMesh::getLevelM2Mesh;
118 %newobject MEDCoupling::MEDFileUMesh::getLevelM3Mesh;
119 %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
120 %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType;
121 %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType;
122 %newobject MEDCoupling::MEDFileUMesh::zipCoords;
123 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
124 %newobject MEDCoupling::MEDFileUMesh::extractPart;
125 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
126 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
127 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
128 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
129 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
130 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
131 %newobject MEDCoupling::MEDFileCMesh::New;
132 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
133 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
134 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
135 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
136 %newobject MEDCoupling::MEDFileMeshes::New;
137 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
138 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
139 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
140 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
141 %newobject MEDCoupling::MEDFileMeshes::__iter__;
143 %newobject MEDCoupling::MEDFileMeshSupports::New;
144 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
146 %newobject MEDCoupling::MEDFileStructureElements::New;
148 %newobject MEDCoupling::MEDFileFields::New;
149 %newobject MEDCoupling::MEDFileFields::NewAdv;
150 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
151 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
152 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
153 %newobject MEDCoupling::MEDFileFields::deepCopy;
154 %newobject MEDCoupling::MEDFileFields::shallowCpy;
155 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
156 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
157 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
158 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
159 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
160 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
161 %newobject MEDCoupling::MEDFileFields::__iter__;
162 %newobject MEDCoupling::MEDFileFields::extractPart;
163 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
165 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
166 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
167 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
168 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
169 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
175 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
176 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
177 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
178 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
185 %newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
186 %newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
187 %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
188 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray;
189 %newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble;
190 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel;
191 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel;
192 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
193 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
195 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
196 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
197 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
198 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
199 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
200 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
201 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
202 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
203 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
205 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
206 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
207 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
208 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
209 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
210 %newobject MEDCoupling::MEDFileField1TS::New;
211 %newobject MEDCoupling::MEDFileField1TS::field;
212 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
213 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
214 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
215 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
216 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
217 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
219 %newobject MEDCoupling::MEDFileIntField1TS::New;
220 %newobject MEDCoupling::MEDFileIntField1TS::field;
221 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevel;
222 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtTopLevel;
223 %newobject MEDCoupling::MEDFileIntField1TS::getFieldOnMeshAtLevel;
224 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevelOld;
225 %newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
226 %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
228 %newobject MEDCoupling::MEDFileFloatField1TS::New;
229 %newobject MEDCoupling::MEDFileFloatField1TS::field;
230 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
231 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
232 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
233 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
234 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
235 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
237 %newobject MEDCoupling::MEDFileData::New;
238 %newobject MEDCoupling::MEDFileData::deepCopy;
239 %newobject MEDCoupling::MEDFileData::getMeshes;
240 %newobject MEDCoupling::MEDFileData::getFields;
241 %newobject MEDCoupling::MEDFileData::getParams;
242 %newobject MEDCoupling::MEDFileData::Aggregate;
244 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
246 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
247 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
248 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
249 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
250 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
251 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
252 %newobject MEDCoupling::MEDFileParameters::New;
253 %newobject MEDCoupling::MEDFileParameters::deepCopy;
254 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
255 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
256 %newobject MEDCoupling::MEDFileParameters::__getitem__;
258 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
259 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
260 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
261 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
262 %newobject MEDCoupling::MEDFileJointOneStep::New;
263 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
264 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
265 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
266 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
267 %newobject MEDCoupling::MEDFileJoint::New;
268 %newobject MEDCoupling::MEDFileJoint::deepCopy;
269 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
270 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
271 %newobject MEDCoupling::MEDFileJoint::__getitem__;
272 %newobject MEDCoupling::MEDFileJoints::New;
273 %newobject MEDCoupling::MEDFileJoints::deepCopy;
274 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
275 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
276 %newobject MEDCoupling::MEDFileJoints::__getitem__;
277 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
278 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
279 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
280 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
281 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
282 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
283 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
284 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
285 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
287 %newobject MEDCoupling::SauvWriter::New;
288 %newobject MEDCoupling::SauvReader::New;
289 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
291 %newobject MEDCoupling::MEDFileMeshStruct::New;
292 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
293 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
294 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
295 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
296 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
298 %feature("unref") MEDFileMesh "$this->decrRef();"
299 %feature("unref") MEDFileUMesh "$this->decrRef();"
300 %feature("unref") MEDFileCMesh "$this->decrRef();"
301 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
302 %feature("unref") MEDFileMeshes "$this->decrRef();"
303 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
304 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
305 %feature("unref") MEDFileField1TS "$this->decrRef();"
306 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
307 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
308 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
309 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
310 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
311 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
312 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
313 %feature("unref") MEDFileStructureElements "$this->decrRef();"
314 %feature("unref") MEDFileFields "$this->decrRef();"
315 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
316 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
317 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
318 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
319 %feature("unref") MEDFileParameters "$this->decrRef();"
320 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
321 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
322 %feature("unref") MEDFileJoint "$this->decrRef();"
323 %feature("unref") MEDFileJoints "$this->decrRef();"
324 %feature("unref") MEDFileEquivalences "$this->decrRef();"
325 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
326 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
327 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
328 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
329 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
330 %feature("unref") MEDFileData "$this->decrRef();"
331 %feature("unref") SauvReader "$this->decrRef();"
332 %feature("unref") SauvWriter "$this->decrRef();"
333 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
334 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
335 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
336 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
337 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
338 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
340 namespace MEDCoupling
343 std::string MEDFileVersionStr();
344 std::string MEDFileVersionOfFileStr(const std::string& fileName);
345 void SetEpsilonForNodeComp(double val);
346 void SetCompPolicyForCell(int val);
347 void SetTooLongStrPolicy(int val);
348 void CheckFileForRead(const std::string& fileName);
349 std::vector<std::string> GetMeshNames(const std::string& fileName);
350 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
351 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
352 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
353 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
354 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
355 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
356 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
357 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
358 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
359 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
360 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
361 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
362 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
363 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
364 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
365 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
366 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
367 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
368 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
369 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
370 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
371 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
372 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
373 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
374 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
375 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
376 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
379 %rename (MEDFileVersion) MEDFileVersionSwig;
380 %rename (GetFieldIterations) GetFieldIterationsSwig;
381 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
382 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
383 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
384 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
385 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
386 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
387 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
388 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
389 %rename (WriteUMeshes) WriteUMeshesSwig;
390 %rename (GetTypesOfField) GetTypesOfFieldSwig;
391 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
392 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
393 %rename (ReadField) ReadFieldSwig;
397 PyObject *MEDFileVersionSwig()
399 int major,minor,release;
400 MEDCoupling::MEDFileVersion(major,minor,release);
401 PyObject *ret(PyTuple_New(3));
402 PyTuple_SetItem(ret,0,SWIG_From_int(major));
403 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
404 PyTuple_SetItem(ret,2,SWIG_From_int(release));
408 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
410 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
414 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
416 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
420 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
422 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
426 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
428 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
432 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
434 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
435 PyObject *ret=PyList_New(res.size());
437 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
439 PyObject *elt=PyTuple_New(2);
440 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
441 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
442 PyList_SetItem(ret,rk,elt);
447 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
449 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
450 PyObject *ret=PyList_New(res.size());
452 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
454 PyObject *elt=PyTuple_New(3);
455 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
456 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
457 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
458 PyList_SetItem(ret,rk,elt);
463 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
465 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
466 PyObject *ret=PyList_New(res.size());
468 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
470 PyObject *elt=PyTuple_New(2);
471 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
472 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
473 PyList_SetItem(ret,rk,elt);
478 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
480 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
481 PyObject *ret=PyList_New(res.size());
483 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
485 PyObject *elt=PyTuple_New(2);
486 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
487 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
488 PyList_SetItem(ret,rk,elt);
493 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
495 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
496 PyObject *ret=PyList_New(res.size());
498 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
500 PyObject *elt=PyTuple_New(2);
501 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
502 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
503 PyList_SetItem(ret,rk,elt);
508 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
510 int meshDim,spaceDim,numberOfNodes;
511 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
512 PyObject *ret=PyTuple_New(4);
513 PyObject *elt0=PyList_New(res.size());
515 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
517 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
519 PyObject *elt1=PyList_New(obj2.size());
520 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
522 PyObject *elt2=PyTuple_New(2);
523 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
524 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
525 PyList_SetItem(elt1,j,elt2);
527 PyList_SetItem(elt0,i,elt1);
529 PyTuple_SetItem(ret,0,elt0);
530 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
531 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
532 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
536 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
537 const std::string& fieldName, PyObject *liIts)
539 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
540 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
541 return convertFieldDoubleVecToPy(res);
544 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
546 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
547 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
548 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
551 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
553 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
554 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
555 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
558 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
560 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
561 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
562 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
565 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
567 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
569 PyObject *ret=PyList_New(size);
570 for(int i=0;i<size;i++)
571 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
575 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
577 std::vector<std::string> grps;
578 converPyListToVecString(li,grps);
579 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
582 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
584 std::vector<std::string> fams;
585 converPyListToVecString(li,fams);
586 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
590 namespace MEDCoupling
592 class MEDFileWritable
595 void copyOptionsFrom(const MEDFileWritable& other) const;
596 int getTooLongStrPolicy() const;
597 void setTooLongStrPolicy(int newVal);
598 int getZipConnPolicy();
599 void setZipConnPolicy(int newVal);
602 class MEDFileWritableStandAlone : public MEDFileWritable
605 void write(const std::string& fileName, int mode) const;
606 void write33(const std::string& fileName, int mode) const;
609 DataArrayByte *serialize() const
611 MCAuto<DataArrayByte> ret(self->serialize());
615 PyObject *__getstate__()
617 PyObject *ret(PyList_New(0));
621 void __setstate__(PyObject *inp)
627 class MEDFileMeshReadSelector
630 MEDFileMeshReadSelector();
631 MEDFileMeshReadSelector(unsigned int code);
632 unsigned int getCode() const;
633 void setCode(unsigned int newCode);
634 bool isCellFamilyFieldReading() const;
635 bool isNodeFamilyFieldReading() const;
636 bool isCellNameFieldReading() const;
637 bool isNodeNameFieldReading() const;
638 bool isCellNumFieldReading() const;
639 bool isNodeNumFieldReading() const;
640 bool isGlobalNodeNumFieldReading() const;
641 void setCellFamilyFieldReading(bool b);
642 void setNodeFamilyFieldReading(bool b);
643 void setCellNameFieldReading(bool b);
644 void setNodeNameFieldReading(bool b);
645 void setCellNumFieldReading(bool b);
646 void setNodeNumFieldReading(bool b);
647 void setGlobalNodeNumFieldReading(bool b);
650 std::string __str__() const
652 std::ostringstream oss;
657 std::string __repr__() const
659 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
665 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
668 static MEDFileJointCorrespondence *New();
669 static MEDFileJointCorrespondence *New(DataArrayInt* correspondence) // nodes
671 static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
672 INTERP_KERNEL::NormalizedCellType loc_geo_type,
673 INTERP_KERNEL::NormalizedCellType rem_geo_type)
675 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
676 MEDFileJointCorrespondence *deepCopy() const;
677 MEDFileJointCorrespondence *shallowCpy() const;
678 void setIsNodal(bool isNodal);
679 bool getIsNodal() const;
680 bool isEqual(const MEDFileJointCorrespondence *other) const;
681 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
682 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
683 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
684 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
685 void setCorrespondence(DataArrayInt *corr);
686 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
687 std::string simpleRepr() const;
690 MEDFileJointCorrespondence()
692 return MEDFileJointCorrespondence::New();
694 MEDFileJointCorrespondence(DataArrayInt* correspondence)
696 return MEDFileJointCorrespondence::New(correspondence);
698 MEDFileJointCorrespondence(DataArrayInt* correspondence, // cells
699 INTERP_KERNEL::NormalizedCellType loc_geo_type,
700 INTERP_KERNEL::NormalizedCellType rem_geo_type)
702 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
705 std::string __str__() const
707 return self->simpleRepr();
710 DataArrayInt *getCorrespondence() const
712 const DataArrayInt *ret(self->getCorrespondence());
715 return const_cast<DataArrayInt *>(ret);
720 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
723 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
724 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
725 MEDFileJointOneStep *deepCopy() const;
726 MEDFileJointOneStep *shallowCpy() const;
727 bool isEqual(const MEDFileJointOneStep *other) const;
728 void setOrder(int order);
729 int getOrder() const;
730 void setIteration(int it);
731 int getIteration() const;
732 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
733 int getNumberOfCorrespondences() const;
734 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
735 std::string simpleRepr() const;
738 MEDFileJointOneStep()
740 return MEDFileJointOneStep::New();
743 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
745 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
748 std::string __str__() const
750 return self->simpleRepr();
753 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
755 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
761 MEDFileJointCorrespondence *__getitem__(int i) const
763 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
768 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
771 static MEDFileJoint *New();
772 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
773 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
774 MEDFileJoint *deepCopy() const;
775 MEDFileJoint *shallowCpy() const;
776 bool isEqual(const MEDFileJoint *other) const;
777 void setLocalMeshName(const std::string& name);
778 std::string getLocalMeshName() const;
779 void setRemoteMeshName(const std::string& name);
780 std::string getRemoteMeshName() const;
781 void setDescription(const std::string& name);
782 std::string getDescription() const;
783 void setJointName(const std::string& name);
784 std::string getJointName() const;
785 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
786 void setDomainNumber(const int& number);
787 int getDomainNumber() const;
788 void pushStep(MEDFileJointOneStep* step);
789 int getNumberOfSteps() const;
790 std::string simpleRepr() const;
795 return MEDFileJoint::New();
798 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
800 return MEDFileJoint::New(fileName,mName,num);
803 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
805 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
808 std::string __str__() const
810 return self->simpleRepr();
813 MEDFileJointOneStep *getStepAtPos(int i) const
815 MEDFileJointOneStep *ret(self->getStepAtPos(i));
821 MEDFileJointOneStep *__getitem__(int i)
823 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
828 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
831 static MEDFileJoints *New();
832 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
833 MEDFileJoints *deepCopy() const;
834 std::string simpleRepr() const;
835 std::string getMeshName() const;
836 int getNumberOfJoints() const;
837 std::vector<std::string> getJointsNames() const;
838 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
839 void resize(int newSize);
840 void pushJoint(MEDFileJoint *joint);
841 void setJointAtPos(int i, MEDFileJoint *joint);
842 void destroyJointAtPos(int i);
847 return MEDFileJoints::New();
850 MEDFileJoints(const std::string& fileName, const std::string& meshName)
852 return MEDFileJoints::New(fileName,meshName);
855 std::string __str__() const
857 return self->simpleRepr();
860 MEDFileJoint *__getitem__(PyObject *obj)
862 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
865 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
870 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
878 return self->getNumberOfJoints();
881 MEDFileJoint *getJointAtPos(int i) const
883 MEDFileJoint *ret=self->getJointAtPos(i);
889 MEDFileJoint *getJointWithName(const std::string& paramName) const
891 MEDFileJoint *ret=self->getJointWithName(paramName);
899 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
902 MEDFileEquivalenceBase();
905 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
908 MEDFileEquivalenceData();
910 void setArray(DataArrayInt *data);
913 DataArrayInt *getArray()
915 DataArrayInt *ret(self->getArray());
916 if(ret) ret->incrRef();
922 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
925 MEDFileEquivalenceNode();
928 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
931 MEDFileEquivalenceCell();
934 std::size_t size() const;
935 void setArray(int meshDimRelToMax, DataArrayInt *da);
936 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da);
939 DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type)
941 DataArrayInt *ret(self->getArray(type));
942 if(ret) ret->incrRef();
946 PyObject *getTypes() const
948 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
949 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
950 PyObject *res=PyList_New(result.size());
951 for(int i=0;iL!=result.end(); i++, iL++)
952 PyList_SetItem(res,i,PyInt_FromLong(*iL));
958 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
961 MEDFileEquivalencePair();
963 std::string getName() const;
964 void setName(const std::string& name);
965 std::string getDescription() const;
966 void setDescription(const std::string& descr);
967 void setArray(int meshDimRelToMaxExt, DataArrayInt *da);;
970 MEDFileEquivalenceCell *initCell()
972 MEDFileEquivalenceCell *ret(self->initCell());
973 if(ret) ret->incrRef();
977 MEDFileEquivalenceNode *initNode()
979 MEDFileEquivalenceNode *ret(self->initNode());
980 if(ret) ret->incrRef();
984 MEDFileEquivalenceCell *getCell()
986 MEDFileEquivalenceCell *ret(self->getCell());
987 if(ret) ret->incrRef();
991 MEDFileEquivalenceNode *getNode()
993 MEDFileEquivalenceNode *ret(self->getNode());
994 if(ret) ret->incrRef();
1000 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1003 MEDFileEquivalences();
1006 std::vector<std::string> getEquivalenceNames() const;
1007 void killEquivalenceWithName(const std::string& name);
1008 void killEquivalenceAt(int i);
1012 MEDFileEquivalencePair *getEquivalence(int i)
1014 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1015 if(ret) ret->incrRef();
1018 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1020 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1021 if(ret) ret->incrRef();
1025 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1027 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1028 if(ret) ret->incrRef();
1034 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1037 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1038 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1039 static MEDFileMesh *New(DataArrayByte *db);
1040 virtual MEDFileMesh *createNewEmpty() const;
1041 virtual MEDFileMesh *deepCopy() const;
1042 virtual MEDFileMesh *shallowCpy() const;
1043 virtual void clearNonDiscrAttributes() const;
1044 void setName(const std::string& name);
1045 std::string getName();
1046 std::string getUnivName() const;
1047 bool getUnivNameWrStatus() const;
1048 void setUnivNameWrStatus(bool newStatus);
1049 void setDescription(const std::string& name);
1050 std::string getDescription() const;
1051 void setOrder(int order);
1052 int getOrder() const;
1053 void setIteration(int it);
1055 void setTimeValue(double time);
1056 void setTime(int dt, int it, double time);
1057 double getTimeValue() const;
1058 void setTimeUnit(const std::string& unit);
1059 std::string getTimeUnit() const;
1060 void setAxisType(MEDCouplingAxisType at);
1061 MEDCouplingAxisType getAxisType() const;
1062 virtual int getNumberOfNodes() const;
1063 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1064 virtual bool hasImplicitPart() const;
1065 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1066 virtual void releaseImplicitPartIfAny() const;
1067 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1068 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1069 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1070 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1071 virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
1072 virtual MEDFileMesh *cartesianize() const;
1073 std::vector<int> getNonEmptyLevels() const;
1074 std::vector<int> getNonEmptyLevelsExt() const;
1075 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1077 bool existsGroup(const std::string& groupName) const;
1078 bool existsFamily(int famId) const;
1079 bool existsFamily(const std::string& familyName) const;
1080 void setFamilyId(const std::string& familyName, int id);
1081 void setFamilyIdUnique(const std::string& familyName, int id);
1082 void addFamily(const std::string& familyName, int id);
1083 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1084 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1085 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
1086 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1089 void clearFamGrpMaps();
1090 const std::map<std::string,int>& getFamilyInfo() const;
1091 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1092 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1093 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1094 std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
1095 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1096 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
1097 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1098 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1099 std::vector<std::string> getGroupsNames() const;
1100 std::vector<std::string> getFamiliesNames() const;
1101 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1102 std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1103 std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
1104 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1105 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1106 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1107 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1108 std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
1109 std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
1110 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1111 static std::string GetMagicFamilyStr();
1112 void assignFamilyNameWithGroupName();
1113 std::vector<std::string> removeEmptyGroups();
1114 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1115 void removeGroup(const std::string& name);
1116 void removeFamily(const std::string& name);
1117 std::vector<std::string> removeOrphanGroups();
1118 std::vector<std::string> removeOrphanFamilies();
1119 void removeFamiliesReferedByNoGroups();
1120 void rearrangeFamilies();
1122 void checkOrphanFamilyZero() const;
1123 void changeGroupName(const std::string& oldName, const std::string& newName);
1124 void changeFamilyName(const std::string& oldName, const std::string& newName);
1125 void changeFamilyId(int oldId, int newId);
1126 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1127 void setFamilyInfo(const std::map<std::string,int>& info);
1128 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1129 int getFamilyId(const std::string& name) const;
1130 int getMaxAbsFamilyId() const;
1131 int getMaxFamilyId() const;
1132 int getMinFamilyId() const;
1133 int getTheMaxAbsFamilyId() const;
1134 int getTheMaxFamilyId() const;
1135 int getTheMinFamilyId() const;
1136 virtual int getMaxAbsFamilyIdInArrays() const;
1137 virtual int getMaxFamilyIdInArrays() const;
1138 virtual int getMinFamilyIdInArrays() const;
1139 DataArrayInt *getAllFamiliesIdsReferenced() const;
1140 DataArrayInt *computeAllFamilyIdsInUse() const;
1141 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
1142 std::string getFamilyNameGivenId(int id) const;
1143 bool ensureDifferentFamIdsPerLevel();
1144 void normalizeFamIdsTrio();
1145 void normalizeFamIdsMEDFile();
1146 virtual int getMeshDimension() const;
1147 virtual std::string simpleRepr() const;
1148 virtual std::string advancedRepr() const;
1150 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1151 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
1152 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
1153 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1154 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
1155 virtual void addNodeGroup(const DataArrayInt *ids);
1156 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
1157 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1158 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1159 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1160 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1161 virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1162 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1163 virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1164 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1165 int getNumberOfJoints();
1166 MEDFileJoints *getJoints();
1167 void setJoints( MEDFileJoints* joints );
1168 void initializeEquivalences();
1169 void killEquivalences();
1170 bool presenceOfStructureElements() const;
1171 void killStructureElements();
1174 std::string __str__() const
1176 return self->simpleRepr();
1179 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1181 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1187 double tmp0=self->getTime(tmp1,tmp2);
1188 PyObject *res = PyList_New(3);
1189 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1190 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1191 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1195 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1198 bool ret0=self->isEqual(other,eps,what);
1199 PyObject *res=PyList_New(2);
1200 PyObject *ret0Py=ret0?Py_True:Py_False;
1202 PyList_SetItem(res,0,ret0Py);
1203 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1207 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1209 std::vector<const DataArrayInt *> grps;
1210 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",grps);
1211 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1214 PyObject *areFamsEqual(const MEDFileMesh *other) const
1217 bool ret0=self->areFamsEqual(other,what);
1218 PyObject *res=PyList_New(2);
1219 PyObject *ret0Py=ret0?Py_True:Py_False;
1221 PyList_SetItem(res,0,ret0Py);
1222 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1226 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1229 bool ret0=self->areGrpsEqual(other,what);
1230 PyObject *res=PyList_New(2);
1231 PyObject *ret0Py=ret0?Py_True:Py_False;
1233 PyList_SetItem(res,0,ret0Py);
1234 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1238 PyObject *getAllGeoTypes() const
1240 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1241 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1242 PyObject *res=PyList_New(result.size());
1243 for(int i=0;iL!=result.end(); i++, iL++)
1244 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1248 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1250 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1251 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1252 PyObject *res=PyList_New(result.size());
1253 for(int i=0;iL!=result.end(); i++, iL++)
1254 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1258 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1260 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1263 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1266 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1268 const DataArrayInt *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1271 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1274 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1276 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1279 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1282 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1284 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1287 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1290 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1292 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1295 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1298 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1301 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1302 PyObject *ret=PyTuple_New(2);
1303 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1304 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1308 PyObject *unPolyze()
1310 DataArrayInt *ret3=0;
1311 std::vector<int> ret1,ret2;
1312 bool ret0=self->unPolyze(ret1,ret2,ret3);
1313 PyObject *ret=PyTuple_New(4);
1314 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1316 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1317 for(int j=0;j<(int)ret1.size()/3;j++)
1319 PyObject *retLev2=PyList_New(3);
1320 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
1321 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
1322 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
1323 PyList_SetItem(retLev1_0,j,retLev2);
1325 PyTuple_SetItem(ret,1,retLev1_0);
1327 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1328 for(int j=0;j<(int)ret2.size()/3;j++)
1330 PyObject *retLev2=PyList_New(3);
1331 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
1332 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
1333 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
1334 PyList_SetItem(retLev1_1,j,retLev2);
1336 PyTuple_SetItem(ret,2,retLev1_1);
1338 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1342 MEDFileEquivalences *getEquivalences()
1344 MEDFileEquivalences *ret(self->getEquivalences());
1345 if(ret) ret->incrRef();
1349 virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1351 MCAuto<DataArrayInt> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1357 class MEDFileUMesh : public MEDFileMesh
1360 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1361 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1362 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1363 static MEDFileUMesh *New(DataArrayByte *db);
1364 static MEDFileUMesh *New();
1365 static const char *GetSpeStr4ExtMesh();
1367 int getSpaceDimension() const;
1368 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1369 void checkConsistency() const;
1370 void checkSMESHConsistency() const;
1371 void clearNodeAndCellNumbers();
1373 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1374 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1375 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1376 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1377 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1378 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1379 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1380 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1381 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1382 void forceComputationOfParts() const;
1384 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1385 void setCoords(DataArrayDouble *coords);
1386 void setCoordsForced(DataArrayDouble *coords);
1387 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1388 void removeMeshAtLevel(int meshDimRelToMax);
1389 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1390 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1391 void optimizeFamilies();
1392 DataArrayInt *zipCoords();
1393 DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1394 DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1395 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1396 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1397 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1398 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1401 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1403 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1406 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1408 return MEDFileUMesh::New(fileName,mrs);
1411 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1413 return MEDFileUMesh::New(mem);
1416 MEDFileUMesh(DataArrayByte *db)
1418 return MEDFileUMesh::New(db);
1423 return MEDFileUMesh::New();
1426 static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1428 std::vector<int> typesCpp1;
1429 convertPyToNewIntArr3(types,typesCpp1);
1430 std::size_t sz(typesCpp1.size());
1431 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1432 for(std::size_t ii=0;ii<sz;ii++)
1433 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1434 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1437 PyObject *__getstate__()
1439 std::vector<double> a0;
1440 std::vector<int> a1;
1441 std::vector<std::string> a2;
1442 std::vector< MCAuto<DataArrayInt> > a3;
1443 MCAuto<DataArrayDouble> a4;
1444 self->serialize(a0,a1,a2,a3,a4);
1445 PyObject *ret(PyTuple_New(5));
1446 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1447 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1449 PyObject *ret2(PyList_New(sz));
1450 for(int i=0;i<sz;i++)
1451 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1452 PyTuple_SetItem(ret,2,ret2);
1454 PyObject *ret3(PyList_New(sz));
1455 for(int i=0;i<sz;i++)
1457 DataArrayInt *elt(a3[i]);
1460 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1462 PyTuple_SetItem(ret,3,ret3);
1463 DataArrayDouble *ret4(a4);
1466 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1470 void __setstate__(PyObject *inp)
1472 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1473 if(!PyTuple_Check(inp))
1474 throw INTERP_KERNEL::Exception(MSG);
1475 int sz(PyTuple_Size(inp));
1477 throw INTERP_KERNEL::Exception(MSG);
1478 std::vector<double> a0;
1479 std::vector<int> a1;
1480 std::vector<std::string> a2;
1481 std::vector< MCAuto<DataArrayInt> > a3;
1482 MCAuto<DataArrayDouble> a4;
1484 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1486 fillArrayWithPyListDbl3(a0py,tmp,a0);
1487 convertPyToNewIntArr3(a1py,a1);
1488 fillStringVector(a2py,a2);
1490 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1492 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1493 if(!SWIG_IsOK(status))
1494 throw INTERP_KERNEL::Exception(MSG);
1495 a4=reinterpret_cast<DataArrayDouble *>(argp);
1496 if((DataArrayDouble *)a4)
1499 std::vector< DataArrayInt * > a3Tmp;
1500 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayInt *>(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp);
1501 std::size_t sz(a3Tmp.size());
1503 for(std::size_t i=0;i<sz;i++)
1507 a3Tmp[i]->incrRef();
1509 self->unserialize(a0,a1,a2,a3,a4);
1513 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1516 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1517 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1520 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1523 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1526 self->setMeshAtLevel(meshDimRelToMax,m1);
1529 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1532 void __delitem__(int meshDimRelToMax)
1534 self->removeMeshAtLevel(meshDimRelToMax);
1537 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1539 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1541 DataArrayDouble *a,*a2;
1542 DataArrayDoubleTuple *aa,*aa2;
1543 std::vector<double> bb,bb2;
1545 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1546 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1547 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1551 static MEDFileUMesh *Aggregate(PyObject *meshes)
1553 std::vector<const MEDFileUMesh *> meshesCpp;
1554 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1555 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1559 PyObject *getAllDistributionOfTypes() const
1561 std::vector< std::pair<int,int> > ret(self->getAllDistributionOfTypes());
1562 return convertVecPairIntToPy(ret);
1565 DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1567 std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
1568 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1569 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1572 MEDFileUMesh *extractPart(PyObject *extractDef) const
1574 std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
1575 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1576 return self->extractPart(extractDefCpp);
1579 void setMeshes(PyObject *li, bool renum=false)
1581 std::vector<const MEDCouplingUMesh *> ms;
1582 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1583 self->setMeshes(ms,renum);
1586 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1588 std::vector<const MEDCouplingUMesh *> ms;
1589 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1590 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1593 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1595 std::vector<const MEDCouplingUMesh *> ms;
1596 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1597 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1600 DataArrayDouble *getCoords() const
1602 DataArrayDouble *ret=self->getCoords();
1608 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1610 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1613 return const_cast<PartDefinition *>(ret);
1616 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1618 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
1619 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1620 PyObject *ret=PyTuple_New(3);
1621 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1622 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1623 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1627 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1629 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1635 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1637 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1638 std::size_t sz(tmp.size());
1639 PyObject *ret=PyList_New(sz);
1640 for(std::size_t i=0;i<sz;i++)
1644 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1651 class MEDFileStructuredMesh : public MEDFileMesh
1656 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1658 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1666 class MEDFileCMesh : public MEDFileStructuredMesh
1669 static MEDFileCMesh *New();
1670 static MEDFileCMesh *New(DataArrayByte *db);
1671 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1672 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1673 void setMesh(MEDCouplingCMesh *m);
1674 int getSpaceDimension() const;
1679 return MEDFileCMesh::New();
1682 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1684 return MEDFileCMesh::New(fileName,mrs);
1687 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1689 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1692 MEDFileCMesh(DataArrayByte *db)
1694 return MEDFileCMesh::New(db);
1697 PyObject *getMesh() const
1699 const MEDCouplingCMesh *tmp=self->getMesh();
1702 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1707 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1710 static MEDFileCurveLinearMesh *New();
1711 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1712 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1713 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1714 void setMesh(MEDCouplingCurveLinearMesh *m);
1717 MEDFileCurveLinearMesh()
1719 return MEDFileCurveLinearMesh::New();
1722 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1724 return MEDFileCurveLinearMesh::New(fileName,mrs);
1727 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1729 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1732 MEDFileCurveLinearMesh(DataArrayByte *db)
1734 return MEDFileCurveLinearMesh::New(db);
1737 PyObject *getMesh() const
1739 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1747 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1750 static MEDFileMeshMultiTS *New();
1751 static MEDFileMeshMultiTS *New(const std::string& fileName);
1752 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1753 MEDFileMeshMultiTS *deepCopy() const;
1754 std::string getName() const;
1755 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1756 void cartesianizeMe();
1759 MEDFileMeshMultiTS()
1761 return MEDFileMeshMultiTS::New();
1764 MEDFileMeshMultiTS(const std::string& fileName)
1766 return MEDFileMeshMultiTS::New(fileName);
1769 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1771 return MEDFileMeshMultiTS::New(fileName,mName);
1774 MEDFileMesh *getOneTimeStep() const
1776 MEDFileMesh *ret=self->getOneTimeStep();
1784 class MEDFileMeshesIterator
1791 MEDFileMesh *ret=self->nextt();
1795 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1799 PyErr_SetString(PyExc_StopIteration,"No more data.");
1806 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1809 static MEDFileMeshes *New();
1810 static MEDFileMeshes *New(DataArrayByte *db);
1811 MEDFileMeshes *deepCopy() const;
1812 int getNumberOfMeshes() const;
1813 std::vector<std::string> getMeshesNames() const;
1815 void resize(int newSize);
1816 void pushMesh(MEDFileMesh *mesh);
1817 void setMeshAtPos(int i, MEDFileMesh *mesh);
1818 void destroyMeshAtPos(int i);
1819 void cartesianizeMe();
1820 bool presenceOfStructureElements() const;
1821 void killStructureElements();
1826 return MEDFileMeshes::New();
1829 MEDFileMeshes(const std::string& fileName)
1831 return MEDFileMeshes::New(fileName);
1834 MEDFileMeshes(DataArrayByte *db)
1836 return MEDFileMeshes::New(db);
1839 std::string __str__() const
1841 return self->simpleRepr();
1844 MEDFileMesh *__getitem__(PyObject *obj)
1846 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1847 if(PyInt_Check(obj))
1849 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1854 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1860 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1862 self->setMeshAtPos(obj,mesh);
1866 MEDFileMeshesIterator *__iter__()
1868 return self->iterator();
1873 return self->getNumberOfMeshes();
1876 MEDFileMesh *getMeshAtPos(int i) const
1878 MEDFileMesh *ret=self->getMeshAtPos(i);
1883 MEDFileMesh *getMeshWithName(const std::string& mname) const
1885 MEDFileMesh *ret=self->getMeshWithName(mname);
1893 class MEDFileFieldLoc : public RefCountObject
1896 std::string getName() const;
1897 int getDimension() const;
1898 int getNumberOfGaussPoints() const;
1899 int getNumberOfPointsInCells() const;
1900 const std::vector<double>& getRefCoords() const;
1901 const std::vector<double>& getGaussCoords() const;
1902 const std::vector<double>& getGaussWeights() const;
1903 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1906 std::string __str__() const
1908 return self->repr();
1913 class MEDFileFieldGlobsReal
1916 void resetContent();
1917 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1918 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1919 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1920 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1921 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1922 void checkGlobsCoherency() const;
1923 void checkGlobsPflsPartCoherency() const;
1924 void checkGlobsLocsPartCoherency() const;
1925 std::vector<std::string> getPfls() const;
1926 std::vector<std::string> getLocs() const;
1927 bool existsPfl(const std::string& pflName) const;
1928 bool existsLoc(const std::string& locName) const;
1929 std::string createNewNameOfPfl() const;
1930 std::string createNewNameOfLoc() const;
1931 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1932 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1933 virtual std::vector<std::string> getPflsReallyUsed() const;
1934 virtual std::vector<std::string> getLocsReallyUsed() const;
1935 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1936 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1937 void killProfileIds(const std::vector<int>& pflIds);
1938 void killLocalizationIds(const std::vector<int>& locIds);
1939 void changePflName(const std::string& oldName, const std::string& newName);
1940 void changeLocName(const std::string& oldName, const std::string& newName);
1941 int getNbOfGaussPtPerCell(int locId) const;
1942 int getLocalizationId(const std::string& loc) const;
1943 int getProfileId(const std::string& pfl) const;
1944 void killStructureElementsInGlobs();
1947 PyObject *getProfile(const std::string& pflName) const
1949 const DataArrayInt *ret=self->getProfile(pflName);
1952 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1955 PyObject *getProfileFromId(int pflId) const
1957 const DataArrayInt *ret=self->getProfileFromId(pflId);
1960 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1963 PyObject *getLocalizationFromId(int locId) const
1965 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1968 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1971 PyObject *getLocalization(const std::string& locName) const
1973 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1976 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1979 PyObject *zipPflsNames()
1981 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1982 return convertVecPairVecStToPy(ret);
1985 PyObject *zipLocsNames(double eps)
1987 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1988 return convertVecPairVecStToPy(ret);
1991 void changePflsNames(PyObject *li)
1993 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1994 self->changePflsNames(v);
1997 void changePflsRefsNamesGen(PyObject *li)
1999 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2000 self->changePflsRefsNamesGen(v);
2003 void changePflsNamesInStruct(PyObject *li)
2005 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2006 self->changePflsNamesInStruct(v);
2009 void changeLocsNames(PyObject *li)
2011 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2012 self->changeLocsNames(v);
2015 void changeLocsRefsNamesGen(PyObject *li)
2017 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2018 self->changeLocsRefsNamesGen(v);
2021 void changeLocsNamesInStruct(PyObject *li)
2023 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2024 self->changeLocsNamesInStruct(v);
2027 std::string simpleReprGlobs() const
2029 std::ostringstream oss;
2030 self->simpleReprGlobs(oss);
2036 class MEDFileEntities
2041 static MEDFileEntities *BuildFrom(PyObject *entities)
2043 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2044 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2046 std::size_t sz(inp0.size());
2048 for(std::size_t i=0;i<sz;i++)
2049 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2051 return MEDFileEntities::BuildFrom(&inp);
2058 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2061 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2062 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2063 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2064 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2066 void loadArraysIfNecessary();
2067 void unloadArrays();
2068 void unloadArraysWithoutDataLoss();
2069 int getDimension() const;
2070 int getIteration() const;
2071 int getOrder() const;
2072 std::string getName();
2073 void setName(const std::string& name);
2074 std::string getMeshName();
2075 void setMeshName(const std::string& newMeshName);
2076 int getMeshIteration() const;
2077 int getMeshOrder() const;
2078 int getNumberOfComponents() const;
2079 bool isDealingTS(int iteration, int order) const;
2080 void setInfo(const std::vector<std::string>& infos);
2081 const std::vector<std::string>& getInfo() const;
2082 bool presenceOfMultiDiscPerGeoType() const;
2083 void setTime(int iteration, int order, double val);
2084 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2085 MEDFileAnyTypeField1TS *deepCopy() const;
2086 std::string getDtUnit() const;
2087 void setDtUnit(const std::string& dtUnit);
2093 double tmp0=self->getTime(tmp1,tmp2);
2094 PyObject *res = PyList_New(3);
2095 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2096 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2097 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2101 PyObject *getDtIt() const
2103 std::pair<int,int> res=self->getDtIt();
2104 PyObject *elt=PyTuple_New(2);
2105 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2106 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2110 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2112 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2115 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2117 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2120 bool changeMeshNames(PyObject *li)
2122 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2123 return self->changeMeshNames(modifTab);
2126 PyObject *getTypesOfFieldAvailable() const
2128 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2129 PyObject *ret2=PyList_New(ret.size());
2130 for(int i=0;i<(int)ret.size();i++)
2131 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2135 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2137 std::vector<int> ret1;
2138 int ret0=self->getNonEmptyLevels(mname,ret1);
2139 PyObject *elt=PyTuple_New(2);
2140 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2141 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2145 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2147 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2148 std::vector< std::vector<TypeOfField> > typesF;
2149 std::vector< std::vector<std::string> > pfls;
2150 std::vector< std::vector<std::string> > locs;
2151 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2153 PyObject *ret2=PyList_New(sz);
2154 for(int i=0;i<sz;i++)
2156 const std::vector< std::pair<int,int> >& dadsI=ret[i];
2157 const std::vector<TypeOfField>& typesFI=typesF[i];
2158 const std::vector<std::string>& pflsI=pfls[i];
2159 const std::vector<std::string>& locsI=locs[i];
2160 PyObject *elt=PyTuple_New(2);
2161 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2162 int sz2=ret[i].size();
2163 PyObject *elt2=PyList_New(sz2);
2164 for(int j=0;j<sz2;j++)
2166 PyObject *elt3=PyTuple_New(4);
2167 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2168 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
2169 PyTuple_SetItem(elt3,1,elt4);
2170 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2171 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2172 PyList_SetItem(elt2,j,elt3);
2174 PyTuple_SetItem(elt,1,elt2);
2175 PyList_SetItem(ret2,i,elt);
2180 PyObject *splitComponents() const
2182 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2183 std::size_t sz=ret.size();
2184 PyObject *retPy=PyList_New(sz);
2185 for(std::size_t i=0;i<sz;i++)
2186 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2190 PyObject *splitDiscretizations() const
2192 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2193 std::size_t sz=ret.size();
2194 PyObject *retPy=PyList_New(sz);
2195 for(std::size_t i=0;i<sz;i++)
2196 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2200 PyObject *splitMultiDiscrPerGeoTypes() const
2202 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2203 std::size_t sz=ret.size();
2204 PyObject *retPy=PyList_New(sz);
2205 for(std::size_t i=0;i<sz;i++)
2206 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2210 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2212 std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
2213 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2214 return self->extractPart(extractDefCpp,mm);
2219 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2222 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2223 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2224 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2225 static MEDFileField1TS *New(DataArrayByte *db);
2226 static MEDFileField1TS *New();
2227 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2228 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2229 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2230 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2231 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2232 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2233 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2234 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2236 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2237 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2238 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2239 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2240 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2243 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2245 return MEDFileField1TS::New(fileName,loadAll);
2248 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2250 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2253 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2255 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2258 MEDFileField1TS(DataArrayByte *db)
2260 return MEDFileField1TS::New(db);
2265 return MEDFileField1TS::New();
2268 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2270 const DataArrayDouble *arr=0;
2272 arr=field->getArray();
2273 self->copyTinyInfoFrom(field,arr);
2276 std::string __str__() const
2278 return self->simpleRepr();
2281 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2283 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2286 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2288 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2289 std::vector< std::vector<TypeOfField> > typesF;
2290 std::vector< std::vector<std::string> > pfls;
2291 std::vector< std::vector<std::string> > locs;
2292 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2294 PyObject *ret2=PyList_New(sz);
2295 for(int i=0;i<sz;i++)
2297 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2298 const std::vector<TypeOfField>& typesFI=typesF[i];
2299 const std::vector<std::string>& pflsI=pfls[i];
2300 const std::vector<std::string>& locsI=locs[i];
2301 PyObject *elt=PyTuple_New(2);
2302 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2303 int sz2=ret[i].size();
2304 PyObject *elt2=PyList_New(sz2);
2305 for(int j=0;j<sz2;j++)
2307 PyObject *elt3=PyTuple_New(4);
2308 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2309 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2311 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2312 PyList_SetItem(elt2,j,elt3);
2314 PyTuple_SetItem(elt,1,elt2);
2315 PyList_SetItem(ret2,i,elt);
2320 DataArrayDouble *getUndergroundDataArray() const
2322 DataArrayDouble *ret=self->getUndergroundDataArray();
2328 PyObject *getUndergroundDataArrayExt() const
2330 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2335 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2338 static MEDFileIntField1TS *New();
2339 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2340 static MEDFileIntField1TS *New(DataArrayByte *db);
2341 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2342 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2343 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2345 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2346 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2347 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2348 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2349 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2350 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2351 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2352 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2353 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2354 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2357 MEDFileIntField1TS()
2359 return MEDFileIntField1TS::New();
2362 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2364 return MEDFileIntField1TS::New(fileName,loadAll);
2367 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2369 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2372 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2374 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2377 MEDFileIntField1TS(DataArrayByte *db)
2379 return MEDFileIntField1TS::New(db);
2382 std::string __str__() const
2384 return self->simpleRepr();
2387 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2389 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2392 DataArrayInt *getUndergroundDataArray() const
2394 DataArrayInt *ret=self->getUndergroundDataArray();
2400 PyObject *getUndergroundDataArrayExt() const
2402 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2407 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2410 static MEDFileFloatField1TS *New();
2411 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2412 static MEDFileFloatField1TS *New(DataArrayByte *db);
2413 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2414 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2415 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2417 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2418 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2419 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2420 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2421 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2422 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2423 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2424 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2425 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2426 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2429 MEDFileFloatField1TS()
2431 return MEDFileFloatField1TS::New();
2434 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2436 return MEDFileFloatField1TS::New(fileName,loadAll);
2439 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2441 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2444 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2446 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2449 MEDFileFloatField1TS(DataArrayByte *db)
2451 return MEDFileFloatField1TS::New(db);
2454 std::string __str__() const
2456 return self->simpleRepr();
2459 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2461 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2464 DataArrayFloat *getUndergroundDataArray() const
2466 DataArrayFloat *ret=self->getUndergroundDataArray();
2472 PyObject *getUndergroundDataArrayExt() const
2474 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2479 class MEDFileAnyTypeFieldMultiTSIterator
2486 MEDFileAnyTypeField1TS *ret=self->nextt();
2488 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2491 PyErr_SetString(PyExc_StopIteration,"No more data.");
2498 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2501 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2502 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2503 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2504 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2505 std::string getName() const;
2506 void setName(const std::string& name);
2507 std::string getDtUnit() const;
2508 void setDtUnit(const std::string& dtUnit);
2509 std::string getMeshName() const;
2510 void setMeshName(const std::string& newMeshName);
2511 const std::vector<std::string>& getInfo() const;
2512 bool presenceOfMultiDiscPerGeoType() const;
2513 int getNumberOfComponents() const;
2514 int getNumberOfTS() const;
2515 void eraseEmptyTS();
2516 int getPosOfTimeStep(int iteration, int order) const;
2517 int getPosGivenTime(double time, double eps=1e-8) const;
2519 void loadArraysIfNecessary();
2520 void unloadArrays();
2521 void unloadArraysWithoutDataLoss();
2523 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2524 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2525 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2526 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2527 void synchronizeNameScope();
2528 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2533 return self->getNumberOfTS();
2536 int getTimeId(PyObject *elt0) const
2538 if(elt0 && PyInt_Check(elt0))
2540 int pos=PyInt_AS_LONG(elt0);
2543 else if(elt0 && PyTuple_Check(elt0))
2545 if(PyTuple_Size(elt0)==2)
2547 PyObject *o0=PyTuple_GetItem(elt0,0);
2548 PyObject *o1=PyTuple_GetItem(elt0,1);
2549 if(PyInt_Check(o0) && PyInt_Check(o1))
2551 int iter=PyInt_AS_LONG(o0);
2552 int order=PyInt_AS_LONG(o1);
2553 return self->getPosOfTimeStep(iter,order);
2556 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 !");
2559 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 !");
2561 else if(elt0 && PyFloat_Check(elt0))
2563 double val=PyFloat_AS_DOUBLE(elt0);
2564 return self->getPosGivenTime(val);
2567 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2570 PyObject *getIterations() const
2572 std::vector< std::pair<int,int> > res(self->getIterations());
2573 return convertVecPairIntToPy(res);
2576 PyObject *getTimeSteps() const
2578 std::vector<double> ret1;
2579 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2580 std::size_t sz=ret.size();
2581 PyObject *ret2=PyList_New(sz);
2582 for(std::size_t i=0;i<sz;i++)
2584 PyObject *elt=PyTuple_New(3);
2585 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2586 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2587 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2588 PyList_SetItem(ret2,i,elt);
2593 PyObject *getTypesOfFieldAvailable() const
2595 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2596 PyObject *ret2=PyList_New(ret.size());
2597 for(int i=0;i<(int)ret.size();i++)
2599 const std::vector<TypeOfField>& rett=ret[i];
2600 PyObject *ret3=PyList_New(rett.size());
2601 for(int j=0;j<(int)rett.size();j++)
2602 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2603 PyList_SetItem(ret2,i,ret3);
2608 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2610 std::vector<int> ret1;
2611 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2612 PyObject *elt=PyTuple_New(2);
2613 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2614 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2618 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2620 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2621 std::vector< std::vector<TypeOfField> > typesF;
2622 std::vector< std::vector<std::string> > pfls;
2623 std::vector< std::vector<std::string> > locs;
2624 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2626 PyObject *ret2=PyList_New(sz);
2627 for(int i=0;i<sz;i++)
2629 const std::vector< std::pair<int,int> >& dadsI=ret[i];
2630 const std::vector<TypeOfField>& typesFI=typesF[i];
2631 const std::vector<std::string>& pflsI=pfls[i];
2632 const std::vector<std::string>& locsI=locs[i];
2633 PyObject *elt=PyTuple_New(2);
2634 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2635 int sz2=ret[i].size();
2636 PyObject *elt2=PyList_New(sz2);
2637 for(int j=0;j<sz2;j++)
2639 PyObject *elt3=PyTuple_New(4);
2640 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2641 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
2642 PyTuple_SetItem(elt3,1,elt4);
2643 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2644 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2645 PyList_SetItem(elt2,j,elt3);
2647 PyTuple_SetItem(elt,1,elt2);
2648 PyList_SetItem(ret2,i,elt);
2653 std::vector<int> getTimeIds(PyObject *elts) const
2655 if(PyList_Check(elts))
2657 int sz=PyList_Size(elts);
2658 std::vector<int> ret(sz);
2659 for(int i=0;i<sz;i++)
2661 PyObject *elt=PyList_GetItem(elts,i);
2662 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2668 std::vector<int> ret(1);
2669 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2674 void __delitem__(PyObject *elts)
2676 if(PySlice_Check(elts))
2678 Py_ssize_t strt=2,stp=2,step=2;
2679 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2680 self->eraseTimeStepIds2(strt,stp,step);
2684 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2685 if(!idsToRemove.empty())
2686 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2690 void eraseTimeStepIds(PyObject *li)
2694 std::vector<int> pos2;
2695 DataArrayInt *pos3=0;
2696 DataArrayIntTuple *pos4=0;
2697 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2702 self->eraseTimeStepIds(&pos1,&pos1+1);
2709 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2714 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2718 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2722 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2724 return self->iterator();
2727 PyObject *__getitem__(PyObject *elt0) const
2729 if(elt0 && PyList_Check(elt0))
2731 int sz=PyList_Size(elt0);
2732 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2733 int *pt=da->getPointer();
2734 for(int i=0;i<sz;i++,pt++)
2736 PyObject *elt1=PyList_GetItem(elt0,i);
2737 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2739 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2741 else if(elt0 && PySlice_Check(elt0))
2743 Py_ssize_t strt=2,stp=2,step=2;
2744 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2745 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
2748 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2751 bool changeMeshNames(PyObject *li)
2753 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2754 return self->changeMeshNames(modifTab);
2757 PyObject *splitComponents() const
2759 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2760 std::size_t sz=ret.size();
2761 PyObject *retPy=PyList_New(sz);
2762 for(std::size_t i=0;i<sz;i++)
2763 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2767 PyObject *splitDiscretizations() const
2769 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2770 std::size_t sz=ret.size();
2771 PyObject *retPy=PyList_New(sz);
2772 for(std::size_t i=0;i<sz;i++)
2773 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2777 PyObject *splitMultiDiscrPerGeoTypes() const
2779 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2780 std::size_t sz=ret.size();
2781 PyObject *retPy=PyList_New(sz);
2782 for(std::size_t i=0;i<sz;i++)
2783 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2787 void pushBackTimeSteps(PyObject *li)
2790 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2791 if(SWIG_IsOK(status))
2793 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2797 std::vector<MEDFileAnyTypeField1TS *> tmp;
2798 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2799 self->pushBackTimeSteps(tmp);
2803 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2805 std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
2806 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2807 return self->extractPart(extractDefCpp,mm);
2810 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2812 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2813 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2814 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2815 std::size_t sz=ret.size();
2816 PyObject *retPy=PyList_New(sz);
2817 for(std::size_t i=0;i<sz;i++)
2819 std::size_t sz2=ret[i].size();
2820 PyObject *ret1Py=PyList_New(sz2);
2821 for(std::size_t j=0;j<sz2;j++)
2823 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2826 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2828 PyList_SetItem(retPy,i,ret1Py);
2833 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2835 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2836 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2837 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2838 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2839 if(ret2.size()!=ret.size())
2841 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2842 throw INTERP_KERNEL::Exception(oss.str().c_str());
2844 std::size_t sz=ret.size();
2845 PyObject *retPy=PyList_New(sz);
2846 for(std::size_t i=0;i<sz;i++)
2848 std::size_t sz2=ret[i].size();
2849 PyObject *ret0Py=PyTuple_New(2);
2850 PyObject *ret1Py=PyList_New(sz2);
2851 for(std::size_t j=0;j<sz2;j++)
2853 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2856 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2858 PyTuple_SetItem(ret0Py,0,ret1Py);
2859 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2860 PyList_SetItem(retPy,i,ret0Py);
2867 class MEDFileIntFieldMultiTS;
2869 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2872 static MEDFileFieldMultiTS *New();
2873 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2874 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2875 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2877 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2878 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2879 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2880 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2881 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2882 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2884 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2885 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
2886 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2889 MEDFileFieldMultiTS()
2891 return MEDFileFieldMultiTS::New();
2894 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2896 return MEDFileFieldMultiTS::New(fileName,loadAll);
2899 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2901 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2904 MEDFileFieldMultiTS(DataArrayByte *db)
2906 return MEDFileFieldMultiTS::New(db);
2909 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2911 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2912 std::size_t sz(tmp.size());
2913 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2914 for(std::size_t i=0;i<sz;i++)
2916 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2917 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2919 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2922 std::string __str__() const
2924 return self->simpleRepr();
2927 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2929 DataArrayInt *ret1=0;
2930 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2931 PyObject *ret=PyTuple_New(2);
2932 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2933 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2937 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2939 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2940 std::vector< std::vector<TypeOfField> > typesF;
2941 std::vector< std::vector<std::string> > pfls;
2942 std::vector< std::vector<std::string> > locs;
2943 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2945 PyObject *ret2=PyList_New(sz);
2946 for(int i=0;i<sz;i++)
2948 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2949 const std::vector<TypeOfField>& typesFI=typesF[i];
2950 const std::vector<std::string>& pflsI=pfls[i];
2951 const std::vector<std::string>& locsI=locs[i];
2952 PyObject *elt=PyTuple_New(2);
2953 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2954 int sz2=ret[i].size();
2955 PyObject *elt2=PyList_New(sz2);
2956 for(int j=0;j<sz2;j++)
2958 PyObject *elt3=PyTuple_New(4);
2959 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2960 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2961 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2962 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2963 PyList_SetItem(elt2,j,elt3);
2965 PyTuple_SetItem(elt,1,elt2);
2966 PyList_SetItem(ret2,i,elt);
2970 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
2972 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2978 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
2980 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
2981 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
2984 PyObject *ret=PyTuple_New(2);
2985 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2986 std::size_t sz=elt1Cpp.size();
2987 PyObject *elt=PyList_New(sz);
2988 for(std::size_t i=0;i<sz;i++)
2990 PyObject *elt1=PyTuple_New(2);
2991 PyObject *elt2=PyTuple_New(2);
2992 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
2993 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
2994 PyObject *elt3=PyTuple_New(2);
2995 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
2996 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
2997 PyTuple_SetItem(elt1,0,elt2);
2998 PyTuple_SetItem(elt1,1,elt3);
2999 PyList_SetItem(elt,i,elt1);
3001 PyTuple_SetItem(ret,1,elt);
3007 class MEDFileFieldsIterator
3014 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3016 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3019 PyErr_SetString(PyExc_StopIteration,"No more data.");
3026 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3029 static MEDFileIntFieldMultiTS *New();
3030 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3031 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3032 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3034 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3035 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
3036 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3037 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3038 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3039 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3040 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3041 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3042 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3045 MEDFileIntFieldMultiTS()
3047 return MEDFileIntFieldMultiTS::New();
3050 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3052 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3055 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3057 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3060 MEDFileIntFieldMultiTS(DataArrayByte *db)
3062 return MEDFileIntFieldMultiTS::New(db);
3065 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3067 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3068 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3069 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3072 std::string __str__() const
3074 return self->simpleRepr();
3077 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3079 DataArrayInt *ret1=0;
3080 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3081 PyObject *ret=PyTuple_New(2);
3082 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3083 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3087 DataArrayInt *getUndergroundDataArray(int iteration, int order) const
3089 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
3097 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3100 static MEDFileFloatFieldMultiTS *New();
3101 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3102 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3103 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3105 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3106 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
3107 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3108 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3109 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3110 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3111 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3112 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3113 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3116 MEDFileFloatFieldMultiTS()
3118 return MEDFileFloatFieldMultiTS::New();
3121 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3123 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3126 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3128 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3131 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3133 return MEDFileFloatFieldMultiTS::New(db);
3136 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3138 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3139 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3140 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3143 std::string __str__() const
3145 return self->simpleRepr();
3148 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3150 DataArrayInt *ret1=0;
3151 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3152 PyObject *ret=PyTuple_New(2);
3153 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3154 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3158 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3160 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3168 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3171 static MEDFileMeshSupports *New(const std::string& fileName);
3172 std::vector<std::string> getSupMeshNames() const;
3175 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3177 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3178 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3186 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3189 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3191 MEDFileStructureElements();
3194 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3197 static MEDFileFields *New();
3198 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3199 static MEDFileFields *New(DataArrayByte *db);
3200 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3201 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3202 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3203 MEDFileFields *deepCopy() const;
3204 MEDFileFields *shallowCpy() const;
3206 void loadArraysIfNecessary();
3207 void unloadArrays();
3208 void unloadArraysWithoutDataLoss();
3209 int getNumberOfFields() const;
3210 std::vector<std::string> getFieldsNames() const;
3211 std::vector<std::string> getMeshesNames() const;
3213 void resize(int newSize);
3214 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3215 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3216 int getPosFromFieldName(const std::string& fieldName) const;
3217 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3218 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3219 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3220 bool presenceOfStructureElements() const;
3221 void aggregate(const MEDFileFields& other);
3222 void killStructureElements();
3223 void keepOnlyStructureElements();
3224 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3225 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3226 void destroyFieldAtPos(int i);
3227 bool removeFieldsWithoutAnyTimeStep();
3232 return MEDFileFields::New();
3235 MEDFileFields(const std::string& fileName, bool loadAll=true)
3237 return MEDFileFields::New(fileName,loadAll);
3240 MEDFileFields(DataArrayByte *db)
3242 return MEDFileFields::New(db);
3245 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3247 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3250 std::string __str__() const
3252 return self->simpleRepr();
3255 MEDFileFields *partOfThisOnStructureElements() const
3257 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3261 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3263 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3267 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3269 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3270 std::size_t sz(tmp.size());
3271 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3272 for(std::size_t i=0;i<sz;i++)
3274 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3275 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3277 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3280 PyObject *getMeshSENames() const
3282 std::vector< std::pair<std::string,std::string> > ps;
3283 self->getMeshSENames(ps);
3284 return convertVectPairStToPy(ps);
3287 PyObject *getCommonIterations() const
3290 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3291 PyObject *ret=PyTuple_New(2);
3292 PyObject *ret_0=PyList_New(ret0.size());
3294 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3296 PyObject *elt=PyTuple_New(2);
3297 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3298 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3299 PyList_SetItem(ret_0,rk,elt);
3301 PyTuple_SetItem(ret,0,ret_0);
3302 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3303 PyTuple_SetItem(ret,1,ret_1);
3307 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3309 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3310 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3313 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3315 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3316 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3319 PyObject *__getitem__(PyObject *obj)
3321 if(obj && PyList_Check(obj))
3323 int sz=PyList_Size(obj);
3324 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3325 int *pt=da->getPointer();
3326 for(int i=0;i<sz;i++,pt++)
3328 PyObject *elt1=PyList_GetItem(obj,i);
3329 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3331 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3334 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3337 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3339 self->setFieldAtPos(obj,field);
3345 return self->getNumberOfFields();
3348 MEDFileFieldsIterator *__iter__()
3350 return self->iterator();
3353 bool changeMeshNames(PyObject *li)
3355 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3356 return self->changeMeshNames(modifTab);
3359 int getPosOfField(PyObject *elt0) const
3361 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3363 throw INTERP_KERNEL::Exception(msg);
3364 if(PyInt_Check(elt0))
3366 return PyInt_AS_LONG(elt0);
3368 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3371 std::vector<int> getPosOfFields(PyObject *elts) const
3373 if(PyList_Check(elts))
3375 int sz=PyList_Size(elts);
3376 std::vector<int> ret(sz);
3377 for(int i=0;i<sz;i++)
3379 PyObject *elt=PyList_GetItem(elts,i);
3380 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3386 std::vector<int> ret(1);
3387 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3392 void pushFields(PyObject *fields)
3394 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3395 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3396 self->pushFields(tmp);
3399 void __delitem__(PyObject *elts)
3401 if(elts && PySlice_Check(elts))
3403 Py_ssize_t strt=2,stp=2,step=2;
3404 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3405 self->destroyFieldsAtPos2(strt,stp,step);
3409 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3410 if(!idsToRemove.empty())
3411 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3415 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3417 std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
3418 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3419 return self->extractPart(extractDefCpp,mm);
3422 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3424 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3430 class MEDFileParameter1TS : public RefCountObject
3433 void setIteration(int it);
3434 int getIteration() const;
3435 void setOrder(int order);
3436 int getOrder() const;
3437 void setTimeValue(double time);
3438 void setTime(int dt, int it, double time);
3439 double getTime(int& dt, int& it);
3440 double getTimeValue() const;
3443 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3446 void setValue(double val);
3447 double getValue() const;
3448 std::string simpleRepr() const;
3451 std::string __str__() const
3453 return self->simpleRepr();
3458 class MEDFileParameterTinyInfo : public MEDFileWritable
3461 void setDescription(const std::string& name);
3462 std::string getDescription() const;
3463 void setTimeUnit(const std::string& unit);
3464 std::string getTimeUnit() const;
3467 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3470 static MEDFileParameterDouble1TS *New();
3471 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3472 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3473 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3474 virtual MEDFileParameter1TS *deepCopy() const;
3475 virtual std::string simpleRepr() const;
3476 void setName(const std::string& name);
3477 std::string getName() const;
3478 void write(const std::string& fileName, int mode) const;
3481 MEDFileParameterDouble1TS()
3483 return MEDFileParameterDouble1TS::New();
3486 MEDFileParameterDouble1TS(const std::string& fileName)
3488 return MEDFileParameterDouble1TS::New(fileName);
3491 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3493 return MEDFileParameterDouble1TS::New(fileName,paramName);
3496 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3498 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3501 std::string __str__() const
3503 return self->simpleRepr();
3506 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3509 bool ret0=self->isEqual(other,eps,what);
3510 PyObject *res=PyList_New(2);
3511 PyObject *ret0Py=ret0?Py_True:Py_False;
3513 PyList_SetItem(res,0,ret0Py);
3514 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3520 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3523 static MEDFileParameterMultiTS *New();
3524 static MEDFileParameterMultiTS *New(const std::string& fileName);
3525 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3526 std::string getName() const;
3527 void setName(const std::string& name);
3528 MEDFileParameterMultiTS *deepCopy() const;
3529 void write(const std::string& fileName, int mode) const;
3530 std::string simpleRepr() const;
3531 void appendValue(int dt, int it, double time, double val);
3532 double getDoubleValue(int iteration, int order) const;
3533 int getPosOfTimeStep(int iteration, int order) const;
3534 int getPosGivenTime(double time, double eps=1e-8) const;
3535 int getNumberOfTS() const;
3538 MEDFileParameterMultiTS()
3540 return MEDFileParameterMultiTS::New();
3543 MEDFileParameterMultiTS(const std::string& fileName)
3545 return MEDFileParameterMultiTS::New(fileName);
3548 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3550 return MEDFileParameterMultiTS::New(fileName,paramName);
3553 std::string __str__() const
3555 return self->simpleRepr();
3558 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3561 bool ret0=self->isEqual(other,eps,what);
3562 PyObject *res=PyList_New(2);
3563 PyObject *ret0Py=ret0?Py_True:Py_False;
3565 PyList_SetItem(res,0,ret0Py);
3566 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3570 void eraseTimeStepIds(PyObject *ids)
3574 std::vector<int> pos2;
3575 DataArrayInt *pos3=0;
3576 DataArrayIntTuple *pos4=0;
3577 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3582 self->eraseTimeStepIds(&pos1,&pos1+1);
3589 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3594 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3598 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3602 int getTimeStepId(PyObject *elt0) const
3604 if(elt0 && PyInt_Check(elt0))
3606 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3609 else if(elt0 && PyTuple_Check(elt0))
3611 if(PyTuple_Size(elt0)==2)
3613 PyObject *o0=PyTuple_GetItem(elt0,0);
3614 PyObject *o1=PyTuple_GetItem(elt0,1);
3615 if(PyInt_Check(o0) && PyInt_Check(o1))
3617 int iter=PyInt_AS_LONG(o0);
3618 int order=PyInt_AS_LONG(o1);
3619 return self->getPosOfTimeStep(iter,order);
3622 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 !");
3625 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 !");
3627 else if(elt0 && PyFloat_Check(elt0))
3629 double val=PyFloat_AS_DOUBLE(elt0);
3630 return self->getPosGivenTime(val);
3633 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3636 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3638 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3644 std::vector<int> getTimeStepIds(PyObject *elts) const
3646 if(PyList_Check(elts))
3648 int sz=PyList_Size(elts);
3649 std::vector<int> ret(sz);
3650 for(int i=0;i<sz;i++)
3652 PyObject *elt=PyList_GetItem(elts,i);
3653 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3659 std::vector<int> ret(1);
3660 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3665 void __delitem__(PyObject *elts)
3667 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3668 if(!idsToRemove.empty())
3669 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3672 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3674 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3680 PyObject *getIterations() const
3682 std::vector< std::pair<int,int> > res=self->getIterations();
3683 PyObject *ret=PyList_New(res.size());
3685 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3687 PyObject *elt=PyTuple_New(2);
3688 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3689 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3690 PyList_SetItem(ret,rk,elt);
3695 PyObject *getTimeSteps() const
3697 std::vector<double> res2;
3698 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3699 PyObject *ret=PyList_New(res.size());
3701 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3703 PyObject *elt=PyTuple_New(3);
3704 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3705 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3706 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3707 PyList_SetItem(ret,rk,elt);
3714 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3717 static MEDFileParameters *New();
3718 static MEDFileParameters *New(const std::string& fileName);
3719 static MEDFileParameters *New(DataArrayByte *db);
3720 MEDFileParameters *deepCopy() const;
3721 std::vector<std::string> getParamsNames() const;
3722 std::string simpleRepr() const;
3723 void resize(int newSize);
3724 void pushParam(MEDFileParameterMultiTS *param);
3725 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3726 void destroyParamAtPos(int i);
3727 int getPosFromParamName(const std::string& paramName) const;
3728 int getNumberOfParams() const;
3733 return MEDFileParameters::New();
3736 MEDFileParameters(const std::string& fileName)
3738 return MEDFileParameters::New(fileName);
3741 MEDFileParameters(DataArrayByte *db)
3743 return MEDFileParameters::New(db);
3746 std::string __str__() const
3748 return self->simpleRepr();
3751 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3753 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3754 if(PyInt_Check(obj))
3756 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3761 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3769 return self->getNumberOfParams();
3772 MEDFileParameterMultiTS *getParamAtPos(int i) const
3774 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3780 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3782 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3788 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3791 bool ret0=self->isEqual(other,eps,what);
3792 PyObject *res=PyList_New(2);
3793 PyObject *ret0Py=ret0?Py_True:Py_False;
3795 PyList_SetItem(res,0,ret0Py);
3796 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3802 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3805 static MEDFileData *New(DataArrayByte *db);
3806 static MEDFileData *New(const std::string& fileName);
3807 static MEDFileData *New();
3808 MEDFileData *deepCopy() const;
3809 void setFields(MEDFileFields *fields);
3810 void setMeshes(MEDFileMeshes *meshes);
3811 void setParams(MEDFileParameters *params);
3812 int getNumberOfFields() const;
3813 int getNumberOfMeshes() const;
3814 int getNumberOfParams() const;
3816 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3817 bool unPolyzeMeshes();
3818 void dealWithStructureElements();
3819 std::string getHeader() const;
3820 void setHeader(const std::string& header);
3824 MEDFileData(const std::string& fileName)
3826 return MEDFileData::New(fileName);
3829 MEDFileData(DataArrayByte *db)
3831 return MEDFileData::New(db);
3836 return MEDFileData::New();
3839 std::string __str__() const
3841 return self->simpleRepr();
3844 MEDFileMeshes *getMeshes() const
3846 MEDFileMeshes *ret=self->getMeshes();
3852 MEDFileParameters *getParams() const
3854 MEDFileParameters *ret=self->getParams();
3860 MEDFileFields *getFields() const
3862 MEDFileFields *ret=self->getFields();
3868 bool changeMeshNames(PyObject *li)
3870 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3871 return self->changeMeshNames(modifTab);
3874 static MEDFileData *Aggregate(PyObject *mfds)
3876 std::vector<const MEDFileData *> mfdsCpp;
3877 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3878 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3884 class SauvReader : public RefCountObject
3887 static SauvReader* New(const std::string& fileName);
3888 MEDFileData * loadInMEDFileDS();
3891 SauvReader(const std::string& fileName)
3893 return SauvReader::New(fileName);
3898 class SauvWriter : public RefCountObject
3901 static SauvWriter * New();
3902 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3903 void write(const std::string& fileName);
3904 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3905 bool getCpyGrpIfOnASingleFamilyStatus() const;
3910 return SauvWriter::New();
3917 class MEDFileMeshStruct;
3919 class MEDFileField1TSStructItem
3922 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3925 class MEDFileMeshStruct : public RefCountObject
3928 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3930 ~MEDFileMeshStruct();
3933 class MEDMeshMultiLev : public RefCountObject
3936 virtual MEDMeshMultiLev *prepare() const;
3937 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3938 DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
3944 PyObject *retrieveFamilyIdsOnCells() const
3946 DataArrayInt *famIds(0);
3947 bool isWithoutCopy(false);
3948 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3949 PyObject *ret=PyTuple_New(2);
3950 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3952 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3953 PyTuple_SetItem(ret,1,ret1Py);
3957 PyObject *retrieveNumberIdsOnCells() const
3959 DataArrayInt *numIds(0);
3960 bool isWithoutCopy(false);
3961 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3962 PyObject *ret=PyTuple_New(2);
3963 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3965 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3966 PyTuple_SetItem(ret,1,ret1Py);
3970 PyObject *retrieveFamilyIdsOnNodes() const
3972 DataArrayInt *famIds(0);
3973 bool isWithoutCopy(false);
3974 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3975 PyObject *ret=PyTuple_New(2);
3976 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3978 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3979 PyTuple_SetItem(ret,1,ret1Py);
3983 PyObject *retrieveNumberIdsOnNodes() const
3985 DataArrayInt *numIds(0);
3986 bool isWithoutCopy(false);
3987 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
3988 PyObject *ret=PyTuple_New(2);
3989 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3991 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3992 PyTuple_SetItem(ret,1,ret1Py);
3996 PyObject *getGeoTypes() const
3998 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
3999 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4000 PyObject *res(PyList_New(result.size()));
4001 for(int i=0;iL!=result.end(); i++, iL++)
4002 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4008 class MEDUMeshMultiLev : public MEDMeshMultiLev
4011 ~MEDUMeshMultiLev();
4015 PyObject *buildVTUArrays() const
4017 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4018 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4019 PyObject *ret0Py=ncc?Py_True:Py_False;
4021 PyObject *ret=PyTuple_New(7);
4022 PyTuple_SetItem(ret,0,ret0Py);
4023 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4024 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4025 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4026 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4027 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4028 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4034 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4037 ~MEDStructuredMeshMultiLev();
4040 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4043 ~MEDCMeshMultiLev();
4047 PyObject *buildVTUArrays() const
4050 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4051 std::size_t sz(objs.size());
4052 PyObject *ret(PyTuple_New(2));
4053 PyObject *ret0=PyList_New(sz);
4054 for(std::size_t i=0;i<sz;i++)
4055 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4056 PyTuple_SetItem(ret,0,ret0);
4057 PyObject *ret1Py(isInternal?Py_True:Py_False);
4059 PyTuple_SetItem(ret,1,ret1Py);
4065 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4068 ~MEDCurveLinearMeshMultiLev();
4072 PyObject *buildVTUArrays() const
4074 DataArrayDouble *ret0(0);
4075 std::vector<int> ret1;
4077 self->buildVTUArrays(ret0,ret1,ret2);
4078 std::size_t sz(ret1.size());
4079 PyObject *ret=PyTuple_New(3);
4080 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4081 PyObject *ret1Py=PyList_New(sz);
4082 for(std::size_t i=0;i<sz;i++)
4083 PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
4084 PyTuple_SetItem(ret,1,ret1Py);
4085 PyObject *ret2Py(ret2?Py_True:Py_False);
4087 PyTuple_SetItem(ret,2,ret2Py);
4093 class MEDFileFastCellSupportComparator : public RefCountObject
4096 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4097 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4098 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4099 int getNumberOfTS() const;
4101 ~MEDFileFastCellSupportComparator();
4105 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4107 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4108 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4109 PyObject *res(PyList_New(result.size()));
4110 for(int i=0;iL!=result.end(); i++, iL++)
4111 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4122 def exit1TS(self, exctype, exc, tb):
4125 MEDFileAnyTypeField1TS.__enter__=enter1TS
4126 MEDFileAnyTypeField1TS.__exit__=exit1TS