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;
511 mcIdType numberOfNodes;
512 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
513 PyObject *ret=PyTuple_New(4);
514 PyObject *elt0=PyList_New(res.size());
516 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
518 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
520 PyObject *elt1=PyList_New(obj2.size());
521 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
523 PyObject *elt2=PyTuple_New(2);
524 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
525 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
526 PyList_SetItem(elt1,j,elt2);
528 PyList_SetItem(elt0,i,elt1);
530 PyTuple_SetItem(ret,0,elt0);
531 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
532 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
533 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
537 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
538 const std::string& fieldName, PyObject *liIts)
540 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
541 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
542 return convertFieldDoubleVecToPy(res);
545 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
547 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
548 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
549 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
552 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
554 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
555 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
556 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
559 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
561 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
562 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
563 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
566 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
568 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
569 std::size_t size=v.size();
570 PyObject *ret=PyList_New(size);
571 for(std::size_t i=0;i<size;i++)
572 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
576 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
578 std::vector<std::string> grps;
579 converPyListToVecString(li,grps);
580 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
583 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
585 std::vector<std::string> fams;
586 converPyListToVecString(li,fams);
587 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
591 namespace MEDCoupling
593 class MEDFileWritable
596 void copyOptionsFrom(const MEDFileWritable& other) const;
597 int getTooLongStrPolicy() const;
598 void setTooLongStrPolicy(int newVal);
599 int getZipConnPolicy();
600 void setZipConnPolicy(int newVal);
603 class MEDFileWritableStandAlone : public MEDFileWritable
606 void write(const std::string& fileName, int mode) const;
607 void write33(const std::string& fileName, int mode) const;
610 DataArrayByte *serialize() const
612 MCAuto<DataArrayByte> ret(self->serialize());
616 PyObject *__getstate__()
618 PyObject *ret(PyList_New(0));
622 void __setstate__(PyObject *inp)
628 class MEDFileMeshReadSelector
631 MEDFileMeshReadSelector();
632 MEDFileMeshReadSelector(unsigned int code);
633 unsigned int getCode() const;
634 void setCode(unsigned int newCode);
635 bool isCellFamilyFieldReading() const;
636 bool isNodeFamilyFieldReading() const;
637 bool isCellNameFieldReading() const;
638 bool isNodeNameFieldReading() const;
639 bool isCellNumFieldReading() const;
640 bool isNodeNumFieldReading() const;
641 bool isGlobalNodeNumFieldReading() const;
642 void setCellFamilyFieldReading(bool b);
643 void setNodeFamilyFieldReading(bool b);
644 void setCellNameFieldReading(bool b);
645 void setNodeNameFieldReading(bool b);
646 void setCellNumFieldReading(bool b);
647 void setNodeNumFieldReading(bool b);
648 void setGlobalNodeNumFieldReading(bool b);
651 std::string __str__() const
653 std::ostringstream oss;
658 std::string __repr__() const
660 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
666 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
669 static MEDFileJointCorrespondence *New();
670 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
672 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
673 INTERP_KERNEL::NormalizedCellType loc_geo_type,
674 INTERP_KERNEL::NormalizedCellType rem_geo_type)
676 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
677 MEDFileJointCorrespondence *deepCopy() const;
678 MEDFileJointCorrespondence *shallowCpy() const;
679 void setIsNodal(bool isNodal);
680 bool getIsNodal() const;
681 bool isEqual(const MEDFileJointCorrespondence *other) const;
682 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
683 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
684 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
685 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
686 void setCorrespondence(DataArrayIdType *corr);
687 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
688 std::string simpleRepr() const;
691 MEDFileJointCorrespondence()
693 return MEDFileJointCorrespondence::New();
695 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
697 return MEDFileJointCorrespondence::New(correspondence);
699 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
700 INTERP_KERNEL::NormalizedCellType loc_geo_type,
701 INTERP_KERNEL::NormalizedCellType rem_geo_type)
703 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
706 std::string __str__() const
708 return self->simpleRepr();
711 DataArrayIdType *getCorrespondence() const
713 const DataArrayIdType *ret(self->getCorrespondence());
716 return const_cast<DataArrayIdType *>(ret);
721 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
724 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
725 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
726 MEDFileJointOneStep *deepCopy() const;
727 MEDFileJointOneStep *shallowCpy() const;
728 bool isEqual(const MEDFileJointOneStep *other) const;
729 void setOrder(int order);
730 int getOrder() const;
731 void setIteration(int it);
732 int getIteration() const;
733 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
734 int getNumberOfCorrespondences() const;
735 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
736 std::string simpleRepr() const;
739 MEDFileJointOneStep()
741 return MEDFileJointOneStep::New();
744 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
746 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
749 std::string __str__() const
751 return self->simpleRepr();
754 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
756 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
762 MEDFileJointCorrespondence *__getitem__(int i) const
764 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
769 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
772 static MEDFileJoint *New();
773 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
774 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
775 MEDFileJoint *deepCopy() const;
776 MEDFileJoint *shallowCpy() const;
777 bool isEqual(const MEDFileJoint *other) const;
778 void setLocalMeshName(const std::string& name);
779 std::string getLocalMeshName() const;
780 void setRemoteMeshName(const std::string& name);
781 std::string getRemoteMeshName() const;
782 void setDescription(const std::string& name);
783 std::string getDescription() const;
784 void setJointName(const std::string& name);
785 std::string getJointName() const;
786 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
787 void setDomainNumber(const int& number);
788 int getDomainNumber() const;
789 void pushStep(MEDFileJointOneStep* step);
790 int getNumberOfSteps() const;
791 std::string simpleRepr() const;
796 return MEDFileJoint::New();
799 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
801 return MEDFileJoint::New(fileName,mName,num);
804 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
806 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
809 std::string __str__() const
811 return self->simpleRepr();
814 MEDFileJointOneStep *getStepAtPos(int i) const
816 MEDFileJointOneStep *ret(self->getStepAtPos(i));
822 MEDFileJointOneStep *__getitem__(int i)
824 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
829 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
832 static MEDFileJoints *New();
833 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
834 MEDFileJoints *deepCopy() const;
835 std::string simpleRepr() const;
836 std::string getMeshName() const;
837 int getNumberOfJoints() const;
838 std::vector<std::string> getJointsNames() const;
839 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
840 void resize(int newSize);
841 void pushJoint(MEDFileJoint *joint);
842 void setJointAtPos(int i, MEDFileJoint *joint);
843 void destroyJointAtPos(int i);
848 return MEDFileJoints::New();
851 MEDFileJoints(const std::string& fileName, const std::string& meshName)
853 return MEDFileJoints::New(fileName,meshName);
856 std::string __str__() const
858 return self->simpleRepr();
861 MEDFileJoint *__getitem__(PyObject *obj)
863 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
866 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
871 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
879 return self->getNumberOfJoints();
882 MEDFileJoint *getJointAtPos(int i) const
884 MEDFileJoint *ret=self->getJointAtPos(i);
890 MEDFileJoint *getJointWithName(const std::string& paramName) const
892 MEDFileJoint *ret=self->getJointWithName(paramName);
900 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
903 MEDFileEquivalenceBase();
906 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
909 MEDFileEquivalenceData();
911 void setArray(DataArrayInt32 *data);
914 DataArrayInt32 *getArray()
916 DataArrayInt32 *ret(self->getArray());
917 if(ret) ret->incrRef();
923 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
926 MEDFileEquivalenceNode();
929 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
932 MEDFileEquivalenceCell();
935 std::size_t size() const;
936 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
937 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
940 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
942 DataArrayInt32 *ret(self->getArray(type));
943 if(ret) ret->incrRef();
947 PyObject *getTypes() const
949 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
950 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
951 PyObject *res=PyList_New(result.size());
952 for(int i=0;iL!=result.end(); i++, iL++)
953 PyList_SetItem(res,i,PyInt_FromLong(*iL));
959 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
962 MEDFileEquivalencePair();
964 std::string getName() const;
965 void setName(const std::string& name);
966 std::string getDescription() const;
967 void setDescription(const std::string& descr);
968 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
971 MEDFileEquivalenceCell *initCell()
973 MEDFileEquivalenceCell *ret(self->initCell());
974 if(ret) ret->incrRef();
978 MEDFileEquivalenceNode *initNode()
980 MEDFileEquivalenceNode *ret(self->initNode());
981 if(ret) ret->incrRef();
985 MEDFileEquivalenceCell *getCell()
987 MEDFileEquivalenceCell *ret(self->getCell());
988 if(ret) ret->incrRef();
992 MEDFileEquivalenceNode *getNode()
994 MEDFileEquivalenceNode *ret(self->getNode());
995 if(ret) ret->incrRef();
1001 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1004 MEDFileEquivalences();
1007 std::vector<std::string> getEquivalenceNames() const;
1008 void killEquivalenceWithName(const std::string& name);
1009 void killEquivalenceAt(int i);
1013 MEDFileEquivalencePair *getEquivalence(int i)
1015 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1016 if(ret) ret->incrRef();
1019 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1021 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1022 if(ret) ret->incrRef();
1026 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1028 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1029 if(ret) ret->incrRef();
1035 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1038 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1039 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1040 static MEDFileMesh *New(DataArrayByte *db);
1041 virtual MEDFileMesh *createNewEmpty() const;
1042 virtual MEDFileMesh *deepCopy() const;
1043 virtual MEDFileMesh *shallowCpy() const;
1044 virtual void clearNonDiscrAttributes() const;
1045 void setName(const std::string& name);
1046 std::string getName();
1047 std::string getUnivName() const;
1048 bool getUnivNameWrStatus() const;
1049 void setUnivNameWrStatus(bool newStatus);
1050 void setDescription(const std::string& name);
1051 std::string getDescription() const;
1052 void setOrder(int order);
1053 int getOrder() const;
1054 void setIteration(int it);
1056 void setTimeValue(double time);
1057 void setTime(int dt, int it, double time);
1058 double getTimeValue() const;
1059 void setTimeUnit(const std::string& unit);
1060 std::string getTimeUnit() const;
1061 void setAxisType(MEDCouplingAxisType at);
1062 MEDCouplingAxisType getAxisType() const;
1063 virtual int getNumberOfNodes() const;
1064 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1065 virtual bool hasImplicitPart() const;
1066 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1067 virtual void releaseImplicitPartIfAny() const;
1068 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1069 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1070 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1071 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1072 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1073 virtual MEDFileMesh *cartesianize() const;
1074 std::vector<int> getNonEmptyLevels() const;
1075 std::vector<int> getNonEmptyLevelsExt() const;
1076 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1078 bool existsGroup(const std::string& groupName) const;
1079 bool existsFamily(int famId) const;
1080 bool existsFamily(const std::string& familyName) const;
1081 void setFamilyId(const std::string& familyName, int id);
1082 void setFamilyIdUnique(const std::string& familyName, int id);
1083 void addFamily(const std::string& familyName, int id);
1084 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1085 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1086 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1087 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1090 void clearFamGrpMaps();
1091 const std::map<std::string,int>& getFamilyInfo() const;
1092 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1093 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1094 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1095 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1096 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1097 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1098 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1099 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1100 std::vector<std::string> getGroupsNames() const;
1101 std::vector<std::string> getFamiliesNames() const;
1102 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1103 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1104 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1105 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1106 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1107 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1108 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1109 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1110 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1111 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1112 static std::string GetMagicFamilyStr();
1113 void assignFamilyNameWithGroupName();
1114 std::vector<std::string> removeEmptyGroups();
1115 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1116 void removeGroup(const std::string& name);
1117 void removeFamily(const std::string& name);
1118 std::vector<std::string> removeOrphanGroups();
1119 std::vector<std::string> removeOrphanFamilies();
1120 void removeFamiliesReferedByNoGroups();
1121 void rearrangeFamilies();
1123 void checkOrphanFamilyZero() const;
1124 void changeGroupName(const std::string& oldName, const std::string& newName);
1125 void changeFamilyName(const std::string& oldName, const std::string& newName);
1126 void changeFamilyId(int oldId, int newId);
1127 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1128 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1129 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1130 int getFamilyId(const std::string& name) const;
1131 int getMaxAbsFamilyId() const;
1132 int getMaxFamilyId() const;
1133 int getMinFamilyId() const;
1134 int getTheMaxAbsFamilyId() const;
1135 int getTheMaxFamilyId() const;
1136 int getTheMinFamilyId() const;
1137 virtual int getMaxAbsFamilyIdInArrays() const;
1138 virtual int getMaxFamilyIdInArrays() const;
1139 virtual int getMinFamilyIdInArrays() const;
1140 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1141 DataArrayIdType *computeAllFamilyIdsInUse() const;
1142 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1143 std::string getFamilyNameGivenId(int id) const;
1144 bool ensureDifferentFamIdsPerLevel();
1145 void normalizeFamIdsTrio();
1146 void normalizeFamIdsMEDFile();
1147 virtual int getMeshDimension() const;
1148 virtual std::string simpleRepr() const;
1149 virtual std::string advancedRepr() const;
1151 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1152 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1153 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1154 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1155 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1156 virtual void addNodeGroup(const DataArrayIdType *ids);
1157 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1158 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1159 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1160 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1161 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1162 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1163 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1164 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1165 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1166 int getNumberOfJoints();
1167 MEDFileJoints *getJoints();
1168 void setJoints( MEDFileJoints* joints );
1169 void initializeEquivalences();
1170 void killEquivalences();
1171 bool presenceOfStructureElements() const;
1172 void killStructureElements();
1175 std::string __str__() const
1177 return self->simpleRepr();
1180 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1182 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1188 double tmp0=self->getTime(tmp1,tmp2);
1189 PyObject *res = PyList_New(3);
1190 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1191 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1192 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1196 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1199 bool ret0=self->isEqual(other,eps,what);
1200 PyObject *res=PyList_New(2);
1201 PyObject *ret0Py=ret0?Py_True:Py_False;
1203 PyList_SetItem(res,0,ret0Py);
1204 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1208 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1210 std::vector<const DataArrayIdType *> grps;
1211 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1212 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1215 PyObject *areFamsEqual(const MEDFileMesh *other) const
1218 bool ret0=self->areFamsEqual(other,what);
1219 PyObject *res=PyList_New(2);
1220 PyObject *ret0Py=ret0?Py_True:Py_False;
1222 PyList_SetItem(res,0,ret0Py);
1223 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1227 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1230 bool ret0=self->areGrpsEqual(other,what);
1231 PyObject *res=PyList_New(2);
1232 PyObject *ret0Py=ret0?Py_True:Py_False;
1234 PyList_SetItem(res,0,ret0Py);
1235 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1239 PyObject *getAllGeoTypes() const
1241 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1242 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1243 PyObject *res=PyList_New(result.size());
1244 for(int i=0;iL!=result.end(); i++, iL++)
1245 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1249 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1251 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1252 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1253 PyObject *res=PyList_New(result.size());
1254 for(int i=0;iL!=result.end(); i++, iL++)
1255 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1259 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1261 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1264 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1267 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1269 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1272 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1275 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1277 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1280 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1283 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1285 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1288 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1291 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1293 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1296 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1299 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1302 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1303 PyObject *ret=PyTuple_New(2);
1304 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1305 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1309 PyObject *unPolyze()
1311 DataArrayIdType *ret3=0;
1312 std::vector<mcIdType> ret1,ret2;
1313 bool ret0=self->unPolyze(ret1,ret2,ret3);
1314 PyObject *ret=PyTuple_New(4);
1315 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1317 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1318 for(int j=0;j<(int)ret1.size()/3;j++)
1320 PyObject *retLev2=PyList_New(3);
1321 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1322 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1323 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1324 PyList_SetItem(retLev1_0,j,retLev2);
1326 PyTuple_SetItem(ret,1,retLev1_0);
1328 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1329 for(int j=0;j<(int)ret2.size()/3;j++)
1331 PyObject *retLev2=PyList_New(3);
1332 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1333 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1334 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1335 PyList_SetItem(retLev1_1,j,retLev2);
1337 PyTuple_SetItem(ret,2,retLev1_1);
1339 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1343 MEDFileEquivalences *getEquivalences()
1345 MEDFileEquivalences *ret(self->getEquivalences());
1346 if(ret) ret->incrRef();
1350 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1352 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1358 class MEDFileUMesh : public MEDFileMesh
1361 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1362 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1363 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1364 static MEDFileUMesh *New(DataArrayByte *db);
1365 static MEDFileUMesh *New();
1366 static const char *GetSpeStr4ExtMesh();
1368 int getSpaceDimension() const;
1369 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1370 void checkConsistency() const;
1371 void checkSMESHConsistency() const;
1372 void clearNodeAndCellNumbers();
1374 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1375 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1376 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1377 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1378 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1379 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1380 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1381 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1382 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1383 void forceComputationOfParts() const;
1385 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1386 void setCoords(DataArrayDouble *coords);
1387 void setCoordsForced(DataArrayDouble *coords);
1388 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1389 void removeMeshAtLevel(int meshDimRelToMax);
1390 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1391 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1392 void optimizeFamilies();
1393 DataArrayIdType *zipCoords();
1394 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1395 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1396 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1397 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1398 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1399 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1402 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1404 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1407 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1409 return MEDFileUMesh::New(fileName,mrs);
1412 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1414 return MEDFileUMesh::New(mem);
1417 MEDFileUMesh(DataArrayByte *db)
1419 return MEDFileUMesh::New(db);
1424 return MEDFileUMesh::New();
1427 static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1429 std::vector<int> typesCpp1;
1430 convertPyToNewIntArr3(types,typesCpp1);
1431 std::size_t sz(typesCpp1.size());
1432 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1433 for(std::size_t ii=0;ii<sz;ii++)
1434 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1435 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1438 PyObject *__getstate__()
1440 std::vector<double> a0;
1441 std::vector<mcIdType> a1;
1442 std::vector<std::string> a2;
1443 std::vector< MCAuto<DataArrayIdType> > a3;
1444 MCAuto<DataArrayDouble> a4;
1445 self->serialize(a0,a1,a2,a3,a4);
1446 PyObject *ret(PyTuple_New(5));
1447 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1448 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1449 std::size_t sz(a2.size());
1450 PyObject *ret2(PyList_New(sz));
1451 for(std::size_t i=0;i<sz;i++)
1452 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1453 PyTuple_SetItem(ret,2,ret2);
1455 PyObject *ret3(PyList_New(sz));
1456 for(std::size_t i=0;i<sz;i++)
1458 DataArrayIdType *elt(a3[i]);
1461 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1463 PyTuple_SetItem(ret,3,ret3);
1464 DataArrayDouble *ret4(a4);
1467 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1471 void __setstate__(PyObject *inp)
1473 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1474 if(!PyTuple_Check(inp))
1475 throw INTERP_KERNEL::Exception(MSG);
1476 std::size_t sz(PyTuple_Size(inp));
1478 throw INTERP_KERNEL::Exception(MSG);
1479 std::vector<double> a0;
1480 std::vector<mcIdType> a1;
1481 std::vector<std::string> a2;
1482 std::vector< MCAuto<DataArrayIdType> > a3;
1483 MCAuto<DataArrayDouble> a4;
1485 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1487 fillArrayWithPyListDbl3(a0py,tmp,a0);
1488 convertPyToNewIntArr3(a1py,a1);
1489 fillStringVector(a2py,a2);
1491 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1493 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1494 if(!SWIG_IsOK(status))
1495 throw INTERP_KERNEL::Exception(MSG);
1496 a4=reinterpret_cast<DataArrayDouble *>(argp);
1497 if((DataArrayDouble *)a4)
1500 std::vector< DataArrayIdType * > a3Tmp;
1501 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1502 std::size_t sz(a3Tmp.size());
1504 for(std::size_t i=0;i<sz;i++)
1508 a3Tmp[i]->incrRef();
1510 self->unserialize(a0,a1,a2,a3,a4);
1514 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1517 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1518 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1521 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1524 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1527 self->setMeshAtLevel(meshDimRelToMax,m1);
1530 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1533 void __delitem__(int meshDimRelToMax)
1535 self->removeMeshAtLevel(meshDimRelToMax);
1538 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1540 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1542 DataArrayDouble *a,*a2;
1543 DataArrayDoubleTuple *aa,*aa2;
1544 std::vector<double> bb,bb2;
1546 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1547 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1548 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1552 static MEDFileUMesh *Aggregate(PyObject *meshes)
1554 std::vector<const MEDFileUMesh *> meshesCpp;
1555 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1556 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1560 PyObject *getAllDistributionOfTypes() const
1562 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1563 return convertVecPairIntToPy(ret);
1566 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1568 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1569 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1570 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1573 MEDFileUMesh *extractPart(PyObject *extractDef) const
1575 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1576 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1577 return self->extractPart(extractDefCpp);
1580 void setMeshes(PyObject *li, bool renum=false)
1582 std::vector<const MEDCouplingUMesh *> ms;
1583 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1584 self->setMeshes(ms,renum);
1587 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1589 std::vector<const MEDCouplingUMesh *> ms;
1590 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1591 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1594 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1596 std::vector<const MEDCouplingUMesh *> ms;
1597 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1598 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1601 DataArrayDouble *getCoords() const
1603 DataArrayDouble *ret=self->getCoords();
1609 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1611 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1614 return const_cast<PartDefinition *>(ret);
1617 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1619 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1620 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1621 PyObject *ret=PyTuple_New(3);
1622 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1623 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1624 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1628 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1630 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1636 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1638 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1639 std::size_t sz(tmp.size());
1640 PyObject *ret=PyList_New(sz);
1641 for(std::size_t i=0;i<sz;i++)
1645 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1652 class MEDFileStructuredMesh : public MEDFileMesh
1657 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1659 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1667 class MEDFileCMesh : public MEDFileStructuredMesh
1670 static MEDFileCMesh *New();
1671 static MEDFileCMesh *New(DataArrayByte *db);
1672 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1673 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1674 void setMesh(MEDCouplingCMesh *m);
1675 int getSpaceDimension() const;
1680 return MEDFileCMesh::New();
1683 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1685 return MEDFileCMesh::New(fileName,mrs);
1688 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1690 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1693 MEDFileCMesh(DataArrayByte *db)
1695 return MEDFileCMesh::New(db);
1698 PyObject *getMesh() const
1700 const MEDCouplingCMesh *tmp=self->getMesh();
1703 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1708 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1711 static MEDFileCurveLinearMesh *New();
1712 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1713 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1714 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1715 void setMesh(MEDCouplingCurveLinearMesh *m);
1718 MEDFileCurveLinearMesh()
1720 return MEDFileCurveLinearMesh::New();
1723 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1725 return MEDFileCurveLinearMesh::New(fileName,mrs);
1728 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1730 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1733 MEDFileCurveLinearMesh(DataArrayByte *db)
1735 return MEDFileCurveLinearMesh::New(db);
1738 PyObject *getMesh() const
1740 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1743 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1748 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1751 static MEDFileMeshMultiTS *New();
1752 static MEDFileMeshMultiTS *New(const std::string& fileName);
1753 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1754 MEDFileMeshMultiTS *deepCopy() const;
1755 std::string getName() const;
1756 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1757 void cartesianizeMe();
1760 MEDFileMeshMultiTS()
1762 return MEDFileMeshMultiTS::New();
1765 MEDFileMeshMultiTS(const std::string& fileName)
1767 return MEDFileMeshMultiTS::New(fileName);
1770 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1772 return MEDFileMeshMultiTS::New(fileName,mName);
1775 MEDFileMesh *getOneTimeStep() const
1777 MEDFileMesh *ret=self->getOneTimeStep();
1785 class MEDFileMeshesIterator
1792 MEDFileMesh *ret=self->nextt();
1796 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1800 PyErr_SetString(PyExc_StopIteration,"No more data.");
1807 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1810 static MEDFileMeshes *New();
1811 static MEDFileMeshes *New(DataArrayByte *db);
1812 MEDFileMeshes *deepCopy() const;
1813 int getNumberOfMeshes() const;
1814 std::vector<std::string> getMeshesNames() const;
1816 void resize(int newSize);
1817 void pushMesh(MEDFileMesh *mesh);
1818 void setMeshAtPos(int i, MEDFileMesh *mesh);
1819 void destroyMeshAtPos(int i);
1820 void cartesianizeMe();
1821 bool presenceOfStructureElements() const;
1822 void killStructureElements();
1827 return MEDFileMeshes::New();
1830 MEDFileMeshes(const std::string& fileName)
1832 return MEDFileMeshes::New(fileName);
1835 MEDFileMeshes(DataArrayByte *db)
1837 return MEDFileMeshes::New(db);
1840 std::string __str__() const
1842 return self->simpleRepr();
1845 MEDFileMesh *__getitem__(PyObject *obj)
1847 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1848 if(PyInt_Check(obj))
1850 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1855 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1861 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1863 self->setMeshAtPos(obj,mesh);
1867 MEDFileMeshesIterator *__iter__()
1869 return self->iterator();
1874 return self->getNumberOfMeshes();
1877 MEDFileMesh *getMeshAtPos(int i) const
1879 MEDFileMesh *ret=self->getMeshAtPos(i);
1884 MEDFileMesh *getMeshWithName(const std::string& mname) const
1886 MEDFileMesh *ret=self->getMeshWithName(mname);
1894 class MEDFileFieldLoc : public RefCountObject
1897 std::string getName() const;
1898 int getDimension() const;
1899 int getNumberOfGaussPoints() const;
1900 int getNumberOfPointsInCells() const;
1901 const std::vector<double>& getRefCoords() const;
1902 const std::vector<double>& getGaussCoords() const;
1903 const std::vector<double>& getGaussWeights() const;
1904 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1907 std::string __str__() const
1909 return self->repr();
1914 class MEDFileFieldGlobsReal
1917 void resetContent();
1918 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1919 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1920 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1921 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1922 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1923 void checkGlobsCoherency() const;
1924 void checkGlobsPflsPartCoherency() const;
1925 void checkGlobsLocsPartCoherency() const;
1926 std::vector<std::string> getPfls() const;
1927 std::vector<std::string> getLocs() const;
1928 bool existsPfl(const std::string& pflName) const;
1929 bool existsLoc(const std::string& locName) const;
1930 std::string createNewNameOfPfl() const;
1931 std::string createNewNameOfLoc() const;
1932 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1933 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1934 virtual std::vector<std::string> getPflsReallyUsed() const;
1935 virtual std::vector<std::string> getLocsReallyUsed() const;
1936 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1937 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1938 void killProfileIds(const std::vector<int>& pflIds);
1939 void killLocalizationIds(const std::vector<int>& locIds);
1940 void changePflName(const std::string& oldName, const std::string& newName);
1941 void changeLocName(const std::string& oldName, const std::string& newName);
1942 int getNbOfGaussPtPerCell(int locId) const;
1943 int getLocalizationId(const std::string& loc) const;
1944 int getProfileId(const std::string& pfl) const;
1945 void killStructureElementsInGlobs();
1948 PyObject *getProfile(const std::string& pflName) const
1950 const DataArrayIdType *ret=self->getProfile(pflName);
1953 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1956 PyObject *getProfileFromId(int pflId) const
1958 const DataArrayIdType *ret=self->getProfileFromId(pflId);
1961 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1964 PyObject *getLocalizationFromId(int locId) const
1966 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1969 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1972 PyObject *getLocalization(const std::string& locName) const
1974 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1977 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1980 PyObject *zipPflsNames()
1982 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1983 return convertVecPairVecStToPy(ret);
1986 PyObject *zipLocsNames(double eps)
1988 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1989 return convertVecPairVecStToPy(ret);
1992 void changePflsNames(PyObject *li)
1994 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1995 self->changePflsNames(v);
1998 void changePflsRefsNamesGen(PyObject *li)
2000 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2001 self->changePflsRefsNamesGen(v);
2004 void changePflsNamesInStruct(PyObject *li)
2006 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2007 self->changePflsNamesInStruct(v);
2010 void changeLocsNames(PyObject *li)
2012 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2013 self->changeLocsNames(v);
2016 void changeLocsRefsNamesGen(PyObject *li)
2018 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2019 self->changeLocsRefsNamesGen(v);
2022 void changeLocsNamesInStruct(PyObject *li)
2024 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2025 self->changeLocsNamesInStruct(v);
2028 std::string simpleReprGlobs() const
2030 std::ostringstream oss;
2031 self->simpleReprGlobs(oss);
2037 class MEDFileEntities
2042 static MEDFileEntities *BuildFrom(PyObject *entities)
2044 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2045 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2047 std::size_t sz(inp0.size());
2049 for(std::size_t i=0;i<sz;i++)
2050 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2052 return MEDFileEntities::BuildFrom(&inp);
2059 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2062 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2063 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2064 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2065 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2067 void loadArraysIfNecessary();
2068 void unloadArrays();
2069 void unloadArraysWithoutDataLoss();
2070 int getDimension() const;
2071 int getIteration() const;
2072 int getOrder() const;
2073 std::string getName();
2074 void setName(const std::string& name);
2075 std::string getMeshName();
2076 void setMeshName(const std::string& newMeshName);
2077 int getMeshIteration() const;
2078 int getMeshOrder() const;
2079 int getNumberOfComponents() const;
2080 bool isDealingTS(int iteration, int order) const;
2081 void setInfo(const std::vector<std::string>& infos);
2082 const std::vector<std::string>& getInfo() const;
2083 bool presenceOfMultiDiscPerGeoType() const;
2084 void setTime(int iteration, int order, double val);
2085 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2086 MEDFileAnyTypeField1TS *deepCopy() const;
2087 std::string getDtUnit() const;
2088 void setDtUnit(const std::string& dtUnit);
2094 double tmp0=self->getTime(tmp1,tmp2);
2095 PyObject *res = PyList_New(3);
2096 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2097 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2098 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2102 PyObject *getDtIt() const
2104 std::pair<int,int> res=self->getDtIt();
2105 PyObject *elt=PyTuple_New(2);
2106 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2107 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2111 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2113 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2116 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2118 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2121 bool changeMeshNames(PyObject *li)
2123 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2124 return self->changeMeshNames(modifTab);
2127 PyObject *getTypesOfFieldAvailable() const
2129 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2130 PyObject *ret2=PyList_New(ret.size());
2131 for(int i=0;i<(int)ret.size();i++)
2132 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2136 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2138 std::vector<int> ret1;
2139 int ret0=self->getNonEmptyLevels(mname,ret1);
2140 PyObject *elt=PyTuple_New(2);
2141 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2142 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2146 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2148 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2149 std::vector< std::vector<TypeOfField> > typesF;
2150 std::vector< std::vector<std::string> > pfls;
2151 std::vector< std::vector<std::string> > locs;
2152 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2153 std::size_t sz=ret.size();
2154 PyObject *ret2=PyList_New(sz);
2155 for(std::size_t i=0;i<sz;i++)
2157 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2158 const std::vector<TypeOfField>& typesFI=typesF[i];
2159 const std::vector<std::string>& pflsI=pfls[i];
2160 const std::vector<std::string>& locsI=locs[i];
2161 PyObject *elt=PyTuple_New(2);
2162 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2163 std::size_t sz2=ret[i].size();
2164 PyObject *elt2=PyList_New(sz2);
2165 for(std::size_t j=0;j<sz2;j++)
2167 PyObject *elt3=PyTuple_New(4);
2168 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2169 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2170 PyTuple_SetItem(elt3,1,elt4);
2171 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2172 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2173 PyList_SetItem(elt2,j,elt3);
2175 PyTuple_SetItem(elt,1,elt2);
2176 PyList_SetItem(ret2,i,elt);
2181 PyObject *splitComponents() const
2183 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2184 std::size_t sz=ret.size();
2185 PyObject *retPy=PyList_New(sz);
2186 for(std::size_t i=0;i<sz;i++)
2187 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2191 PyObject *splitDiscretizations() const
2193 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2194 std::size_t sz=ret.size();
2195 PyObject *retPy=PyList_New(sz);
2196 for(std::size_t i=0;i<sz;i++)
2197 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2201 PyObject *splitMultiDiscrPerGeoTypes() const
2203 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2204 std::size_t sz=ret.size();
2205 PyObject *retPy=PyList_New(sz);
2206 for(std::size_t i=0;i<sz;i++)
2207 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2211 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2213 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2214 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2215 return self->extractPart(extractDefCpp,mm);
2220 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2223 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2224 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2225 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2226 static MEDFileField1TS *New(DataArrayByte *db);
2227 static MEDFileField1TS *New();
2228 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2229 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2230 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2231 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2232 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2233 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2234 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2235 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2237 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2238 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2239 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2240 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2241 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2244 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2246 return MEDFileField1TS::New(fileName,loadAll);
2249 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2251 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2254 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2256 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2259 MEDFileField1TS(DataArrayByte *db)
2261 return MEDFileField1TS::New(db);
2266 return MEDFileField1TS::New();
2269 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2271 const DataArrayDouble *arr=0;
2273 arr=field->getArray();
2274 self->copyTinyInfoFrom(field,arr);
2277 std::string __str__() const
2279 return self->simpleRepr();
2282 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2284 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2287 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2289 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2290 std::vector< std::vector<TypeOfField> > typesF;
2291 std::vector< std::vector<std::string> > pfls;
2292 std::vector< std::vector<std::string> > locs;
2293 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2294 std::size_t sz=ret.size();
2295 PyObject *ret2=PyList_New(sz);
2296 for(std::size_t i=0;i<sz;i++)
2298 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2299 const std::vector<TypeOfField>& typesFI=typesF[i];
2300 const std::vector<std::string>& pflsI=pfls[i];
2301 const std::vector<std::string>& locsI=locs[i];
2302 PyObject *elt=PyTuple_New(2);
2303 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2304 std::size_t sz2=ret[i].size();
2305 PyObject *elt2=PyList_New(sz2);
2306 for(std::size_t j=0;j<sz2;j++)
2308 PyObject *elt3=PyTuple_New(4);
2309 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2310 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2311 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2312 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2313 PyList_SetItem(elt2,j,elt3);
2315 PyTuple_SetItem(elt,1,elt2);
2316 PyList_SetItem(ret2,i,elt);
2321 DataArrayDouble *getUndergroundDataArray() const
2323 DataArrayDouble *ret=self->getUndergroundDataArray();
2329 PyObject *getUndergroundDataArrayExt() const
2331 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2336 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2339 static MEDFileIntField1TS *New();
2340 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2341 static MEDFileIntField1TS *New(DataArrayByte *db);
2342 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2343 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2344 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2346 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2347 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2348 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2349 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2350 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2351 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2352 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2353 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2354 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2355 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2358 MEDFileIntField1TS()
2360 return MEDFileIntField1TS::New();
2363 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2365 return MEDFileIntField1TS::New(fileName,loadAll);
2368 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2370 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2373 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2375 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2378 MEDFileIntField1TS(DataArrayByte *db)
2380 return MEDFileIntField1TS::New(db);
2383 std::string __str__() const
2385 return self->simpleRepr();
2388 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2390 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2393 DataArrayInt32 *getUndergroundDataArray() const
2395 DataArrayInt32 *ret=self->getUndergroundDataArray();
2401 PyObject *getUndergroundDataArrayExt() const
2403 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2408 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2411 static MEDFileFloatField1TS *New();
2412 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2413 static MEDFileFloatField1TS *New(DataArrayByte *db);
2414 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2415 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2416 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2418 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2419 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2420 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2421 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2422 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2423 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2424 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2425 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2426 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2427 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2430 MEDFileFloatField1TS()
2432 return MEDFileFloatField1TS::New();
2435 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2437 return MEDFileFloatField1TS::New(fileName,loadAll);
2440 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2442 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2445 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2447 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2450 MEDFileFloatField1TS(DataArrayByte *db)
2452 return MEDFileFloatField1TS::New(db);
2455 std::string __str__() const
2457 return self->simpleRepr();
2460 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2462 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2465 DataArrayFloat *getUndergroundDataArray() const
2467 DataArrayFloat *ret=self->getUndergroundDataArray();
2473 PyObject *getUndergroundDataArrayExt() const
2475 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2480 class MEDFileAnyTypeFieldMultiTSIterator
2487 MEDFileAnyTypeField1TS *ret=self->nextt();
2489 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2492 PyErr_SetString(PyExc_StopIteration,"No more data.");
2499 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2502 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2503 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2504 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2505 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2506 std::string getName() const;
2507 void setName(const std::string& name);
2508 std::string getDtUnit() const;
2509 void setDtUnit(const std::string& dtUnit);
2510 std::string getMeshName() const;
2511 void setMeshName(const std::string& newMeshName);
2512 const std::vector<std::string>& getInfo() const;
2513 bool presenceOfMultiDiscPerGeoType() const;
2514 int getNumberOfComponents() const;
2515 int getNumberOfTS() const;
2516 void eraseEmptyTS();
2517 int getPosOfTimeStep(int iteration, int order) const;
2518 int getPosGivenTime(double time, double eps=1e-8) const;
2520 void loadArraysIfNecessary();
2521 void unloadArrays();
2522 void unloadArraysWithoutDataLoss();
2524 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2525 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2526 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2527 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2528 void synchronizeNameScope();
2529 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2534 return self->getNumberOfTS();
2537 int getTimeId(PyObject *elt0) const
2539 if(elt0 && PyInt_Check(elt0))
2541 int pos=(int)PyInt_AS_LONG(elt0);
2544 else if(elt0 && PyTuple_Check(elt0))
2546 if(PyTuple_Size(elt0)==2)
2548 PyObject *o0=PyTuple_GetItem(elt0,0);
2549 PyObject *o1=PyTuple_GetItem(elt0,1);
2550 if(PyInt_Check(o0) && PyInt_Check(o1))
2552 int iter=(int)PyInt_AS_LONG(o0);
2553 int order=(int)PyInt_AS_LONG(o1);
2554 return self->getPosOfTimeStep(iter,order);
2557 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 !");
2560 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 !");
2562 else if(elt0 && PyFloat_Check(elt0))
2564 double val=PyFloat_AS_DOUBLE(elt0);
2565 return self->getPosGivenTime(val);
2568 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2571 PyObject *getIterations() const
2573 std::vector< std::pair<int,int> > res(self->getIterations());
2574 return convertVecPairIntToPy(res);
2577 PyObject *getTimeSteps() const
2579 std::vector<double> ret1;
2580 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2581 std::size_t sz=ret.size();
2582 PyObject *ret2=PyList_New(sz);
2583 for(std::size_t i=0;i<sz;i++)
2585 PyObject *elt=PyTuple_New(3);
2586 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2587 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2588 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2589 PyList_SetItem(ret2,i,elt);
2594 PyObject *getTypesOfFieldAvailable() const
2596 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2597 PyObject *ret2=PyList_New(ret.size());
2598 for(int i=0;i<(int)ret.size();i++)
2600 const std::vector<TypeOfField>& rett=ret[i];
2601 PyObject *ret3=PyList_New(rett.size());
2602 for(int j=0;j<(int)rett.size();j++)
2603 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2604 PyList_SetItem(ret2,i,ret3);
2609 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2611 std::vector<int> ret1;
2612 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2613 PyObject *elt=PyTuple_New(2);
2614 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2615 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2619 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2621 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2622 std::vector< std::vector<TypeOfField> > typesF;
2623 std::vector< std::vector<std::string> > pfls;
2624 std::vector< std::vector<std::string> > locs;
2625 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2626 std::size_t sz=ret.size();
2627 PyObject *ret2=PyList_New(sz);
2628 for(std::size_t i=0;i<sz;i++)
2630 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2631 const std::vector<TypeOfField>& typesFI=typesF[i];
2632 const std::vector<std::string>& pflsI=pfls[i];
2633 const std::vector<std::string>& locsI=locs[i];
2634 PyObject *elt=PyTuple_New(2);
2635 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2636 std::size_t sz2=ret[i].size();
2637 PyObject *elt2=PyList_New(sz2);
2638 for(std::size_t j=0;j<sz2;j++)
2640 PyObject *elt3=PyTuple_New(4);
2641 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2642 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2643 PyTuple_SetItem(elt3,1,elt4);
2644 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2645 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2646 PyList_SetItem(elt2,j,elt3);
2648 PyTuple_SetItem(elt,1,elt2);
2649 PyList_SetItem(ret2,i,elt);
2654 std::vector<int> getTimeIds(PyObject *elts) const
2656 if(PyList_Check(elts))
2658 std::size_t sz=PyList_Size(elts);
2659 std::vector<int> ret(sz);
2660 for(std::size_t i=0;i<sz;i++)
2662 PyObject *elt=PyList_GetItem(elts,i);
2663 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2669 std::vector<int> ret(1);
2670 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2675 void __delitem__(PyObject *elts)
2677 if(PySlice_Check(elts))
2679 Py_ssize_t strt=2,stp=2,step=2;
2680 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2681 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2685 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2686 if(!idsToRemove.empty())
2687 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2691 void eraseTimeStepIds(PyObject *li)
2695 std::vector<int> pos2;
2696 DataArrayInt32 *pos3=0;
2697 DataArrayIntTuple *pos4=0;
2698 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2703 self->eraseTimeStepIds(&pos1,&pos1+1);
2710 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2715 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2719 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2723 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2725 return self->iterator();
2728 PyObject *__getitem__(PyObject *elt0) const
2730 if(elt0 && PyList_Check(elt0))
2732 std::size_t sz=PyList_Size(elt0);
2733 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2734 int *pt=da->getPointer();
2735 for(std::size_t i=0;i<sz;i++,pt++)
2737 PyObject *elt1=PyList_GetItem(elt0,i);
2738 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2740 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2742 else if(elt0 && PySlice_Check(elt0))
2744 Py_ssize_t strt=2,stp=2,step=2;
2745 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2746 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2749 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2752 bool changeMeshNames(PyObject *li)
2754 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2755 return self->changeMeshNames(modifTab);
2758 PyObject *splitComponents() const
2760 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2761 std::size_t sz=ret.size();
2762 PyObject *retPy=PyList_New(sz);
2763 for(std::size_t i=0;i<sz;i++)
2764 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2768 PyObject *splitDiscretizations() const
2770 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2771 std::size_t sz=ret.size();
2772 PyObject *retPy=PyList_New(sz);
2773 for(std::size_t i=0;i<sz;i++)
2774 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2778 PyObject *splitMultiDiscrPerGeoTypes() const
2780 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2781 std::size_t sz=ret.size();
2782 PyObject *retPy=PyList_New(sz);
2783 for(std::size_t i=0;i<sz;i++)
2784 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2788 void pushBackTimeSteps(PyObject *li)
2791 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2792 if(SWIG_IsOK(status))
2794 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2798 std::vector<MEDFileAnyTypeField1TS *> tmp;
2799 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2800 self->pushBackTimeSteps(tmp);
2804 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2806 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2807 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2808 return self->extractPart(extractDefCpp,mm);
2811 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2813 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2814 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2815 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2816 std::size_t sz=ret.size();
2817 PyObject *retPy=PyList_New(sz);
2818 for(std::size_t i=0;i<sz;i++)
2820 std::size_t sz2=ret[i].size();
2821 PyObject *ret1Py=PyList_New(sz2);
2822 for(std::size_t j=0;j<sz2;j++)
2824 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2827 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2829 PyList_SetItem(retPy,i,ret1Py);
2834 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2836 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2837 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2838 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2839 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2840 if(ret2.size()!=ret.size())
2842 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2843 throw INTERP_KERNEL::Exception(oss.str().c_str());
2845 std::size_t sz=ret.size();
2846 PyObject *retPy=PyList_New(sz);
2847 for(std::size_t i=0;i<sz;i++)
2849 std::size_t sz2=ret[i].size();
2850 PyObject *ret0Py=PyTuple_New(2);
2851 PyObject *ret1Py=PyList_New(sz2);
2852 for(std::size_t j=0;j<sz2;j++)
2854 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2857 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2859 PyTuple_SetItem(ret0Py,0,ret1Py);
2860 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2861 PyList_SetItem(retPy,i,ret0Py);
2868 class MEDFileIntFieldMultiTS;
2870 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2873 static MEDFileFieldMultiTS *New();
2874 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2875 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2876 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2878 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2879 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2880 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2881 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2882 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2883 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2885 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2886 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2887 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2890 MEDFileFieldMultiTS()
2892 return MEDFileFieldMultiTS::New();
2895 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2897 return MEDFileFieldMultiTS::New(fileName,loadAll);
2900 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2902 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2905 MEDFileFieldMultiTS(DataArrayByte *db)
2907 return MEDFileFieldMultiTS::New(db);
2910 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2912 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2913 std::size_t sz(tmp.size());
2914 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2915 for(std::size_t i=0;i<sz;i++)
2917 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2918 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2920 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2923 std::string __str__() const
2925 return self->simpleRepr();
2928 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2930 DataArrayIdType *ret1=0;
2931 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2932 PyObject *ret=PyTuple_New(2);
2933 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2934 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2938 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2940 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2941 std::vector< std::vector<TypeOfField> > typesF;
2942 std::vector< std::vector<std::string> > pfls;
2943 std::vector< std::vector<std::string> > locs;
2944 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2945 std::size_t sz=ret.size();
2946 PyObject *ret2=PyList_New(sz);
2947 for(std::size_t i=0;i<sz;i++)
2949 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2950 const std::vector<TypeOfField>& typesFI=typesF[i];
2951 const std::vector<std::string>& pflsI=pfls[i];
2952 const std::vector<std::string>& locsI=locs[i];
2953 PyObject *elt=PyTuple_New(2);
2954 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2955 std::size_t sz2=ret[i].size();
2956 PyObject *elt2=PyList_New(sz2);
2957 for(std::size_t j=0;j<sz2;j++)
2959 PyObject *elt3=PyTuple_New(4);
2960 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2961 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2962 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2963 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2964 PyList_SetItem(elt2,j,elt3);
2966 PyTuple_SetItem(elt,1,elt2);
2967 PyList_SetItem(ret2,i,elt);
2971 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
2973 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2979 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
2981 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
2982 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
2985 PyObject *ret=PyTuple_New(2);
2986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2987 std::size_t sz=elt1Cpp.size();
2988 PyObject *elt=PyList_New(sz);
2989 for(std::size_t i=0;i<sz;i++)
2991 PyObject *elt1=PyTuple_New(2);
2992 PyObject *elt2=PyTuple_New(2);
2993 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
2994 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
2995 PyObject *elt3=PyTuple_New(2);
2996 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
2997 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
2998 PyTuple_SetItem(elt1,0,elt2);
2999 PyTuple_SetItem(elt1,1,elt3);
3000 PyList_SetItem(elt,i,elt1);
3002 PyTuple_SetItem(ret,1,elt);
3008 class MEDFileFieldsIterator
3015 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3017 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3020 PyErr_SetString(PyExc_StopIteration,"No more data.");
3027 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3030 static MEDFileIntFieldMultiTS *New();
3031 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3032 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3033 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3035 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3036 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3037 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3038 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3039 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3040 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3041 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3042 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3043 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3046 MEDFileIntFieldMultiTS()
3048 return MEDFileIntFieldMultiTS::New();
3051 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3053 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3056 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3058 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3061 MEDFileIntFieldMultiTS(DataArrayByte *db)
3063 return MEDFileIntFieldMultiTS::New(db);
3066 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3068 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3069 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3070 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3073 std::string __str__() const
3075 return self->simpleRepr();
3078 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3080 DataArrayIdType *ret1=0;
3081 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3082 PyObject *ret=PyTuple_New(2);
3083 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
3084 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3088 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3090 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3098 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3101 static MEDFileFloatFieldMultiTS *New();
3102 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3103 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3104 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3106 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3107 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3108 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3109 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3110 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3111 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3112 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3113 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3114 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3117 MEDFileFloatFieldMultiTS()
3119 return MEDFileFloatFieldMultiTS::New();
3122 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3124 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3127 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3129 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3132 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3134 return MEDFileFloatFieldMultiTS::New(db);
3137 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3139 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3140 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3141 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3144 std::string __str__() const
3146 return self->simpleRepr();
3149 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3151 DataArrayIdType *ret1=0;
3152 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3153 PyObject *ret=PyTuple_New(2);
3154 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3155 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3159 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3161 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3169 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3172 static MEDFileMeshSupports *New(const std::string& fileName);
3173 std::vector<std::string> getSupMeshNames() const;
3176 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3178 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3179 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3187 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3190 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3192 MEDFileStructureElements();
3195 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3198 static MEDFileFields *New();
3199 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3200 static MEDFileFields *New(DataArrayByte *db);
3201 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3202 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3203 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3204 MEDFileFields *deepCopy() const;
3205 MEDFileFields *shallowCpy() const;
3207 void loadArraysIfNecessary();
3208 void unloadArrays();
3209 void unloadArraysWithoutDataLoss();
3210 int getNumberOfFields() const;
3211 std::vector<std::string> getFieldsNames() const;
3212 std::vector<std::string> getMeshesNames() const;
3214 void resize(int newSize);
3215 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3216 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3217 int getPosFromFieldName(const std::string& fieldName) const;
3218 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3219 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3220 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3221 bool presenceOfStructureElements() const;
3222 void aggregate(const MEDFileFields& other);
3223 void killStructureElements();
3224 void keepOnlyStructureElements();
3225 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3226 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3227 void destroyFieldAtPos(int i);
3228 bool removeFieldsWithoutAnyTimeStep();
3233 return MEDFileFields::New();
3236 MEDFileFields(const std::string& fileName, bool loadAll=true)
3238 return MEDFileFields::New(fileName,loadAll);
3241 MEDFileFields(DataArrayByte *db)
3243 return MEDFileFields::New(db);
3246 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3248 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3251 std::string __str__() const
3253 return self->simpleRepr();
3256 MEDFileFields *partOfThisOnStructureElements() const
3258 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3262 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3264 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3268 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3270 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3271 std::size_t sz(tmp.size());
3272 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3273 for(std::size_t i=0;i<sz;i++)
3275 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3276 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3278 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3281 PyObject *getMeshSENames() const
3283 std::vector< std::pair<std::string,std::string> > ps;
3284 self->getMeshSENames(ps);
3285 return convertVectPairStToPy(ps);
3288 PyObject *getCommonIterations() const
3291 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3292 PyObject *ret=PyTuple_New(2);
3293 PyObject *ret_0=PyList_New(ret0.size());
3295 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3297 PyObject *elt=PyTuple_New(2);
3298 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3299 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3300 PyList_SetItem(ret_0,rk,elt);
3302 PyTuple_SetItem(ret,0,ret_0);
3303 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3304 PyTuple_SetItem(ret,1,ret_1);
3308 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3310 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3311 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3314 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3316 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3317 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3320 PyObject *__getitem__(PyObject *obj)
3322 if(obj && PyList_Check(obj))
3324 std::size_t sz=PyList_Size(obj);
3325 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3326 int *pt=da->getPointer();
3327 for(std::size_t i=0;i<sz;i++,pt++)
3329 PyObject *elt1=PyList_GetItem(obj,i);
3330 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3332 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3335 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3338 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3340 self->setFieldAtPos(obj,field);
3346 return self->getNumberOfFields();
3349 MEDFileFieldsIterator *__iter__()
3351 return self->iterator();
3354 bool changeMeshNames(PyObject *li)
3356 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3357 return self->changeMeshNames(modifTab);
3360 int getPosOfField(PyObject *elt0) const
3362 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3364 throw INTERP_KERNEL::Exception(msg);
3365 if(PyInt_Check(elt0))
3367 return (int)PyInt_AS_LONG(elt0);
3369 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3372 std::vector<int> getPosOfFields(PyObject *elts) const
3374 if(PyList_Check(elts))
3376 std::size_t sz=PyList_Size(elts);
3377 std::vector<int> ret(sz);
3378 for(std::size_t i=0;i<sz;i++)
3380 PyObject *elt=PyList_GetItem(elts,i);
3381 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3387 std::vector<int> ret(1);
3388 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3393 void pushFields(PyObject *fields)
3395 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3396 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3397 self->pushFields(tmp);
3400 void __delitem__(PyObject *elts)
3402 if(elts && PySlice_Check(elts))
3404 Py_ssize_t strt=2,stp=2,step=2;
3405 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3406 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3410 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3411 if(!idsToRemove.empty())
3412 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3416 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3418 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3419 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3420 return self->extractPart(extractDefCpp,mm);
3423 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3425 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3431 class MEDFileParameter1TS : public RefCountObject
3434 void setIteration(int it);
3435 int getIteration() const;
3436 void setOrder(int order);
3437 int getOrder() const;
3438 void setTimeValue(double time);
3439 void setTime(int dt, int it, double time);
3440 double getTime(int& dt, int& it);
3441 double getTimeValue() const;
3444 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3447 void setValue(double val);
3448 double getValue() const;
3449 std::string simpleRepr() const;
3452 std::string __str__() const
3454 return self->simpleRepr();
3459 class MEDFileParameterTinyInfo : public MEDFileWritable
3462 void setDescription(const std::string& name);
3463 std::string getDescription() const;
3464 void setTimeUnit(const std::string& unit);
3465 std::string getTimeUnit() const;
3468 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3471 static MEDFileParameterDouble1TS *New();
3472 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3473 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3474 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3475 virtual MEDFileParameter1TS *deepCopy() const;
3476 virtual std::string simpleRepr() const;
3477 void setName(const std::string& name);
3478 std::string getName() const;
3479 void write(const std::string& fileName, int mode) const;
3482 MEDFileParameterDouble1TS()
3484 return MEDFileParameterDouble1TS::New();
3487 MEDFileParameterDouble1TS(const std::string& fileName)
3489 return MEDFileParameterDouble1TS::New(fileName);
3492 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3494 return MEDFileParameterDouble1TS::New(fileName,paramName);
3497 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3499 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3502 std::string __str__() const
3504 return self->simpleRepr();
3507 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3510 bool ret0=self->isEqual(other,eps,what);
3511 PyObject *res=PyList_New(2);
3512 PyObject *ret0Py=ret0?Py_True:Py_False;
3514 PyList_SetItem(res,0,ret0Py);
3515 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3521 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3524 static MEDFileParameterMultiTS *New();
3525 static MEDFileParameterMultiTS *New(const std::string& fileName);
3526 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3527 std::string getName() const;
3528 void setName(const std::string& name);
3529 MEDFileParameterMultiTS *deepCopy() const;
3530 void write(const std::string& fileName, int mode) const;
3531 std::string simpleRepr() const;
3532 void appendValue(int dt, int it, double time, double val);
3533 double getDoubleValue(int iteration, int order) const;
3534 int getPosOfTimeStep(int iteration, int order) const;
3535 int getPosGivenTime(double time, double eps=1e-8) const;
3536 int getNumberOfTS() const;
3539 MEDFileParameterMultiTS()
3541 return MEDFileParameterMultiTS::New();
3544 MEDFileParameterMultiTS(const std::string& fileName)
3546 return MEDFileParameterMultiTS::New(fileName);
3549 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3551 return MEDFileParameterMultiTS::New(fileName,paramName);
3554 std::string __str__() const
3556 return self->simpleRepr();
3559 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3562 bool ret0=self->isEqual(other,eps,what);
3563 PyObject *res=PyList_New(2);
3564 PyObject *ret0Py=ret0?Py_True:Py_False;
3566 PyList_SetItem(res,0,ret0Py);
3567 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3571 void eraseTimeStepIds(PyObject *ids)
3575 std::vector<int> pos2;
3576 DataArrayInt *pos3=0;
3577 DataArrayIntTuple *pos4=0;
3578 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3583 self->eraseTimeStepIds(&pos1,&pos1+1);
3590 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3595 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3599 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3603 int getTimeStepId(PyObject *elt0) const
3605 if(elt0 && PyInt_Check(elt0))
3607 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3610 else if(elt0 && PyTuple_Check(elt0))
3612 if(PyTuple_Size(elt0)==2)
3614 PyObject *o0=PyTuple_GetItem(elt0,0);
3615 PyObject *o1=PyTuple_GetItem(elt0,1);
3616 if(PyInt_Check(o0) && PyInt_Check(o1))
3618 int iter=(int)PyInt_AS_LONG(o0);
3619 int order=(int)PyInt_AS_LONG(o1);
3620 return self->getPosOfTimeStep(iter,order);
3623 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 !");
3626 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 !");
3628 else if(elt0 && PyFloat_Check(elt0))
3630 double val=PyFloat_AS_DOUBLE(elt0);
3631 return self->getPosGivenTime(val);
3634 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3637 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3639 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3645 std::vector<int> getTimeStepIds(PyObject *elts) const
3647 if(PyList_Check(elts))
3649 std::size_t sz=PyList_Size(elts);
3650 std::vector<int> ret(sz);
3651 for(std::size_t i=0;i<sz;i++)
3653 PyObject *elt=PyList_GetItem(elts,i);
3654 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3660 std::vector<int> ret(1);
3661 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3666 void __delitem__(PyObject *elts)
3668 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3669 if(!idsToRemove.empty())
3670 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3673 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3675 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3681 PyObject *getIterations() const
3683 std::vector< std::pair<int,int> > res=self->getIterations();
3684 PyObject *ret=PyList_New(res.size());
3686 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3688 PyObject *elt=PyTuple_New(2);
3689 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3690 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3691 PyList_SetItem(ret,rk,elt);
3696 PyObject *getTimeSteps() const
3698 std::vector<double> res2;
3699 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3700 PyObject *ret=PyList_New(res.size());
3702 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3704 PyObject *elt=PyTuple_New(3);
3705 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3706 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3707 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3708 PyList_SetItem(ret,rk,elt);
3715 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3718 static MEDFileParameters *New();
3719 static MEDFileParameters *New(const std::string& fileName);
3720 static MEDFileParameters *New(DataArrayByte *db);
3721 MEDFileParameters *deepCopy() const;
3722 std::vector<std::string> getParamsNames() const;
3723 std::string simpleRepr() const;
3724 void resize(int newSize);
3725 void pushParam(MEDFileParameterMultiTS *param);
3726 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3727 void destroyParamAtPos(int i);
3728 int getPosFromParamName(const std::string& paramName) const;
3729 int getNumberOfParams() const;
3734 return MEDFileParameters::New();
3737 MEDFileParameters(const std::string& fileName)
3739 return MEDFileParameters::New(fileName);
3742 MEDFileParameters(DataArrayByte *db)
3744 return MEDFileParameters::New(db);
3747 std::string __str__() const
3749 return self->simpleRepr();
3752 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3754 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3755 if(PyInt_Check(obj))
3757 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3762 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3770 return self->getNumberOfParams();
3773 MEDFileParameterMultiTS *getParamAtPos(int i) const
3775 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3781 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3783 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3789 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3792 bool ret0=self->isEqual(other,eps,what);
3793 PyObject *res=PyList_New(2);
3794 PyObject *ret0Py=ret0?Py_True:Py_False;
3796 PyList_SetItem(res,0,ret0Py);
3797 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3803 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3806 static MEDFileData *New(DataArrayByte *db);
3807 static MEDFileData *New(const std::string& fileName);
3808 static MEDFileData *New();
3809 MEDFileData *deepCopy() const;
3810 void setFields(MEDFileFields *fields);
3811 void setMeshes(MEDFileMeshes *meshes);
3812 void setParams(MEDFileParameters *params);
3813 int getNumberOfFields() const;
3814 int getNumberOfMeshes() const;
3815 int getNumberOfParams() const;
3817 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3818 bool unPolyzeMeshes();
3819 void dealWithStructureElements();
3820 std::string getHeader() const;
3821 void setHeader(const std::string& header);
3825 MEDFileData(const std::string& fileName)
3827 return MEDFileData::New(fileName);
3830 MEDFileData(DataArrayByte *db)
3832 return MEDFileData::New(db);
3837 return MEDFileData::New();
3840 std::string __str__() const
3842 return self->simpleRepr();
3845 MEDFileMeshes *getMeshes() const
3847 MEDFileMeshes *ret=self->getMeshes();
3853 MEDFileParameters *getParams() const
3855 MEDFileParameters *ret=self->getParams();
3861 MEDFileFields *getFields() const
3863 MEDFileFields *ret=self->getFields();
3869 bool changeMeshNames(PyObject *li)
3871 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3872 return self->changeMeshNames(modifTab);
3875 static MEDFileData *Aggregate(PyObject *mfds)
3877 std::vector<const MEDFileData *> mfdsCpp;
3878 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3879 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3885 class SauvReader : public RefCountObject
3888 static SauvReader* New(const std::string& fileName);
3889 MEDFileData * loadInMEDFileDS();
3892 SauvReader(const std::string& fileName)
3894 return SauvReader::New(fileName);
3899 class SauvWriter : public RefCountObject
3902 static SauvWriter * New();
3903 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3904 void write(const std::string& fileName);
3905 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3906 bool getCpyGrpIfOnASingleFamilyStatus() const;
3911 return SauvWriter::New();
3918 class MEDFileMeshStruct;
3920 class MEDFileField1TSStructItem
3923 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3926 class MEDFileMeshStruct : public RefCountObject
3929 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3931 ~MEDFileMeshStruct();
3934 class MEDMeshMultiLev : public RefCountObject
3937 virtual MEDMeshMultiLev *prepare() const;
3938 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3939 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
3945 PyObject *retrieveFamilyIdsOnCells() const
3947 DataArrayIdType *famIds(0);
3948 bool isWithoutCopy(false);
3949 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3950 PyObject *ret=PyTuple_New(2);
3951 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3953 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3954 PyTuple_SetItem(ret,1,ret1Py);
3958 PyObject *retrieveNumberIdsOnCells() const
3960 DataArrayIdType *numIds(0);
3961 bool isWithoutCopy(false);
3962 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3963 PyObject *ret=PyTuple_New(2);
3964 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3966 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3967 PyTuple_SetItem(ret,1,ret1Py);
3971 PyObject *retrieveFamilyIdsOnNodes() const
3973 DataArrayIdType *famIds(0);
3974 bool isWithoutCopy(false);
3975 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3976 PyObject *ret=PyTuple_New(2);
3977 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3979 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3980 PyTuple_SetItem(ret,1,ret1Py);
3984 PyObject *retrieveNumberIdsOnNodes() const
3986 DataArrayIdType *numIds(0);
3987 bool isWithoutCopy(false);
3988 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
3989 PyObject *ret=PyTuple_New(2);
3990 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3992 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3993 PyTuple_SetItem(ret,1,ret1Py);
3997 PyObject *getGeoTypes() const
3999 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4000 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4001 PyObject *res(PyList_New(result.size()));
4002 for(int i=0;iL!=result.end(); i++, iL++)
4003 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4009 class MEDUMeshMultiLev : public MEDMeshMultiLev
4012 ~MEDUMeshMultiLev();
4016 PyObject *buildVTUArrays() const
4018 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4019 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4020 PyObject *ret0Py=ncc?Py_True:Py_False;
4022 PyObject *ret=PyTuple_New(7);
4023 PyTuple_SetItem(ret,0,ret0Py);
4024 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4025 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4026 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4027 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4028 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4029 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4035 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4038 ~MEDStructuredMeshMultiLev();
4041 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4044 ~MEDCMeshMultiLev();
4048 PyObject *buildVTUArrays() const
4051 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4052 std::size_t sz(objs.size());
4053 PyObject *ret(PyTuple_New(2));
4054 PyObject *ret0=PyList_New(sz);
4055 for(std::size_t i=0;i<sz;i++)
4056 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4057 PyTuple_SetItem(ret,0,ret0);
4058 PyObject *ret1Py(isInternal?Py_True:Py_False);
4060 PyTuple_SetItem(ret,1,ret1Py);
4066 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4069 ~MEDCurveLinearMeshMultiLev();
4073 PyObject *buildVTUArrays() const
4075 DataArrayDouble *ret0(0);
4076 std::vector<mcIdType> ret1;
4078 self->buildVTUArrays(ret0,ret1,ret2);
4079 std::size_t sz(ret1.size());
4080 PyObject *ret=PyTuple_New(3);
4081 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4082 PyObject *ret1Py=PyList_New(sz);
4083 for(std::size_t i=0;i<sz;i++)
4084 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4085 PyTuple_SetItem(ret,1,ret1Py);
4086 PyObject *ret2Py(ret2?Py_True:Py_False);
4088 PyTuple_SetItem(ret,2,ret2Py);
4094 class MEDFileFastCellSupportComparator : public RefCountObject
4097 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4098 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4099 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4100 int getNumberOfTS() const;
4102 ~MEDFileFastCellSupportComparator();
4106 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4108 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4109 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4110 PyObject *res(PyList_New(result.size()));
4111 for(int i=0;iL!=result.end(); i++, iL++)
4112 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4123 def exit1TS(self, exctype, exc, tb):
4126 MEDFileAnyTypeField1TS.__enter__=enter1TS
4127 MEDFileAnyTypeField1TS.__exit__=exit1TS