1 // Copyright (C) 2017-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #define MEDCOUPLING_EXPORT
22 #define MEDLOADER_EXPORT
24 #ifdef WITH_DOCSTRINGS
25 %include "MEDLoader_doc.i"
28 %include "MEDCouplingCommon.i"
31 #include "MEDLoader.hxx"
32 #include "MEDFileJoint.hxx"
33 #include "MEDFileMesh.hxx"
34 #include "MEDFileField.hxx"
35 #include "MEDFileParameter.hxx"
36 #include "MEDFileData.hxx"
37 #include "MEDFileEquivalence.hxx"
38 #include "MEDFileEntities.hxx"
39 #include "MEDFileMeshReadSelector.hxx"
40 #include "MEDFileFieldOverView.hxx"
41 #include "MEDCouplingTypemaps.i"
42 #include "MEDLoaderTypemaps.i"
43 #include "SauvReader.hxx"
44 #include "SauvWriter.hxx"
46 using namespace MEDCoupling;
49 #if SWIG_VERSION >= 0x010329
50 %template() std::vector<std::string>;
53 %typemap(out) MEDCoupling::MEDFileMesh*
55 $result=convertMEDFileMesh($1,$owner);
58 %typemap(out) MEDCoupling::MEDFileParameter1TS*
60 $result=convertMEDFileParameter1TS($1,$owner);
63 %typemap(out) MEDCoupling::MEDFileAnyTypeFieldMultiTS*
65 $result=convertMEDFileFieldMultiTS($1,$owner);
68 %typemap(out) MEDCoupling::MEDFileAnyTypeField1TS*
70 $result=convertMEDFileField1TS($1,$owner);
73 %typemap(out) MEDCoupling::MEDMeshMultiLev*
75 $result=convertMEDMeshMultiLev($1,$owner);
78 %newobject ReadUMeshFromFamiliesSwig;
79 %newobject ReadUMeshFromGroupsSwig;
80 %newobject ReadFieldSwig;
81 %newobject MEDCoupling::ReadUMeshFromFile;
82 %newobject MEDCoupling::ReadMeshFromFile;
83 %newobject MEDCoupling::ReadFieldCell;
84 %newobject MEDCoupling::ReadFieldNode;
85 %newobject MEDCoupling::ReadFieldGauss;
86 %newobject MEDCoupling::ReadFieldGaussNE;
87 %newobject MEDCoupling::MEDFileMesh::New;
88 %newobject MEDCoupling::MEDFileMesh::createNewEmpty;
89 %newobject MEDCoupling::MEDFileMesh::deepCopy;
90 %newobject MEDCoupling::MEDFileMesh::shallowCpy;
91 %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel;
92 %newobject MEDCoupling::MEDFileMesh::__getitem__;
93 %newobject MEDCoupling::MEDFileMesh::getGroupArr;
94 %newobject MEDCoupling::MEDFileMesh::getGroupsArr;
95 %newobject MEDCoupling::MEDFileMesh::getFamilyArr;
96 %newobject MEDCoupling::MEDFileMesh::getFamiliesArr;
97 %newobject MEDCoupling::MEDFileMesh::getNodeGroupArr;
98 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
99 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
100 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
101 %newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
102 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
103 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
104 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
105 %newobject MEDCoupling::MEDFileMesh::cartesianize;
106 %newobject MEDCoupling::MEDFileData::getJoints;
107 %newobject MEDCoupling::MEDFileStructuredMesh::getImplicitFaceMesh;
108 %newobject MEDCoupling::MEDFileUMesh::New;
109 %newobject MEDCoupling::MEDFileUMesh::LoadPartOf;
110 %newobject MEDCoupling::MEDFileUMesh::getCoords;
111 %newobject MEDCoupling::MEDFileUMesh::getPartDefAtLevel;
112 %newobject MEDCoupling::MEDFileUMesh::getGroup;
113 %newobject MEDCoupling::MEDFileUMesh::getGroups;
114 %newobject MEDCoupling::MEDFileUMesh::getFamily;
115 %newobject MEDCoupling::MEDFileUMesh::getFamilies;
116 %newobject MEDCoupling::MEDFileUMesh::getLevel0Mesh;
117 %newobject MEDCoupling::MEDFileUMesh::getLevelM1Mesh;
118 %newobject MEDCoupling::MEDFileUMesh::getLevelM2Mesh;
119 %newobject MEDCoupling::MEDFileUMesh::getLevelM3Mesh;
120 %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
121 %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType;
122 %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType;
123 %newobject MEDCoupling::MEDFileUMesh::computeFetchedNodeIds;
124 %newobject MEDCoupling::MEDFileUMesh::zipCoords;
125 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
126 %newobject MEDCoupling::MEDFileUMesh::extractPart;
127 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
128 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
129 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
130 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
131 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
132 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
133 %newobject MEDCoupling::MEDFileCMesh::New;
134 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
135 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
136 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
137 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
138 %newobject MEDCoupling::MEDFileMeshes::New;
139 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
140 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
141 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
142 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
143 %newobject MEDCoupling::MEDFileMeshes::__iter__;
145 %newobject MEDCoupling::MEDFileMeshSupports::New;
146 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
148 %newobject MEDCoupling::MEDFileStructureElements::New;
150 %newobject MEDCoupling::MEDFileFields::New;
151 %newobject MEDCoupling::MEDFileFields::NewAdv;
152 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
153 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
154 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
155 %newobject MEDCoupling::MEDFileFields::deepCopy;
156 %newobject MEDCoupling::MEDFileFields::shallowCpy;
157 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
158 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
159 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
160 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
161 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
162 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
163 %newobject MEDCoupling::MEDFileFields::__iter__;
164 %newobject MEDCoupling::MEDFileFields::extractPart;
165 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
167 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
168 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
169 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
175 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
176 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
177 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
178 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
184 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
185 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
187 %newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
188 %newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
189 %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
190 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray;
191 %newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble;
192 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel;
193 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel;
194 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
195 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
197 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
198 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
199 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
200 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
201 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
202 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
203 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
204 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
205 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
207 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
208 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
209 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
210 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
211 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
212 %newobject MEDCoupling::MEDFileField1TS::New;
213 %newobject MEDCoupling::MEDFileField1TS::field;
214 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
215 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
216 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
217 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
218 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
219 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
221 %newobject MEDCoupling::MEDFileIntField1TS::New;
222 %newobject MEDCoupling::MEDFileIntField1TS::field;
223 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevel;
224 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtTopLevel;
225 %newobject MEDCoupling::MEDFileIntField1TS::getFieldOnMeshAtLevel;
226 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevelOld;
227 %newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
228 %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
230 %newobject MEDCoupling::MEDFileFloatField1TS::New;
231 %newobject MEDCoupling::MEDFileFloatField1TS::field;
232 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
233 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
234 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
235 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
236 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
237 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
239 %newobject MEDCoupling::MEDFileData::New;
240 %newobject MEDCoupling::MEDFileData::deepCopy;
241 %newobject MEDCoupling::MEDFileData::getMeshes;
242 %newobject MEDCoupling::MEDFileData::getFields;
243 %newobject MEDCoupling::MEDFileData::getParams;
244 %newobject MEDCoupling::MEDFileData::Aggregate;
246 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
248 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
249 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
250 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
251 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
252 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
253 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
254 %newobject MEDCoupling::MEDFileParameters::New;
255 %newobject MEDCoupling::MEDFileParameters::deepCopy;
256 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
257 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
258 %newobject MEDCoupling::MEDFileParameters::__getitem__;
260 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
261 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
262 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
263 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
264 %newobject MEDCoupling::MEDFileJointOneStep::New;
265 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
266 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
267 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
268 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
269 %newobject MEDCoupling::MEDFileJoint::New;
270 %newobject MEDCoupling::MEDFileJoint::deepCopy;
271 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
272 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
273 %newobject MEDCoupling::MEDFileJoint::__getitem__;
274 %newobject MEDCoupling::MEDFileJoints::New;
275 %newobject MEDCoupling::MEDFileJoints::deepCopy;
276 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
277 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
278 %newobject MEDCoupling::MEDFileJoints::__getitem__;
279 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
280 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
281 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
282 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
283 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
284 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
285 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
286 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
287 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
289 %newobject MEDCoupling::SauvWriter::New;
290 %newobject MEDCoupling::SauvReader::New;
291 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
293 %newobject MEDCoupling::MEDFileMeshStruct::New;
294 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
295 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
296 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
297 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
298 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
300 %feature("unref") MEDFileMesh "$this->decrRef();"
301 %feature("unref") MEDFileUMesh "$this->decrRef();"
302 %feature("unref") MEDFileCMesh "$this->decrRef();"
303 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
304 %feature("unref") MEDFileMeshes "$this->decrRef();"
305 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
306 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
307 %feature("unref") MEDFileField1TS "$this->decrRef();"
308 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
309 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
310 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
311 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
312 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
313 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
314 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
315 %feature("unref") MEDFileStructureElements "$this->decrRef();"
316 %feature("unref") MEDFileFields "$this->decrRef();"
317 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
318 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
319 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
320 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
321 %feature("unref") MEDFileParameters "$this->decrRef();"
322 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
323 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
324 %feature("unref") MEDFileJoint "$this->decrRef();"
325 %feature("unref") MEDFileJoints "$this->decrRef();"
326 %feature("unref") MEDFileEquivalences "$this->decrRef();"
327 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
328 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
329 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
330 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
331 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
332 %feature("unref") MEDFileData "$this->decrRef();"
333 %feature("unref") SauvReader "$this->decrRef();"
334 %feature("unref") SauvWriter "$this->decrRef();"
335 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
336 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
337 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
338 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
339 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
340 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
342 namespace MEDCoupling
345 std::string MEDFileVersionStr();
346 std::string MEDFileVersionOfFileStr(const std::string& fileName);
347 void SetEpsilonForNodeComp(double val);
348 void SetCompPolicyForCell(int val);
349 void SetTooLongStrPolicy(int val);
350 void CheckFileForRead(const std::string& fileName);
351 std::vector<std::string> GetMeshNames(const std::string& fileName);
352 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
353 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
354 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
355 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
356 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
357 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
358 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
359 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
360 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
361 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
362 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
363 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
364 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
365 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
366 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
367 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
368 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
369 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
370 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
371 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
372 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
373 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
374 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
375 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
376 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
377 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
378 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
381 %rename (MEDFileVersion) MEDFileVersionSwig;
382 %rename (GetFieldIterations) GetFieldIterationsSwig;
383 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
384 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
385 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
386 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
387 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
388 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
389 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
390 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
391 %rename (WriteUMeshes) WriteUMeshesSwig;
392 %rename (GetTypesOfField) GetTypesOfFieldSwig;
393 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
394 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
395 %rename (ReadField) ReadFieldSwig;
396 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
400 PyObject *MEDFileVersionSwig()
402 int major,minor,release;
403 MEDCoupling::MEDFileVersion(major,minor,release);
404 PyObject *ret(PyTuple_New(3));
405 PyTuple_SetItem(ret,0,SWIG_From_int(major));
406 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
407 PyTuple_SetItem(ret,2,SWIG_From_int(release));
411 int MEDFileSizeOfMedInt()
413 return 8*sizeof(med_int);
416 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
418 std::map<std::string,mcIdType> families;
419 std::map<std::string,std::vector<std::string>> groupsOnFam;
420 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
421 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
422 AutoPyPtr ret(PyTuple_New(2));
423 PyTuple_SetItem(ret,0,a.retn());
424 PyTuple_SetItem(ret,1,b.retn());
428 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
430 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
434 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
436 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
440 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
442 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
446 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
448 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
452 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
454 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
455 PyObject *ret=PyList_New(res.size());
457 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
459 PyObject *elt=PyTuple_New(2);
460 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
461 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
462 PyList_SetItem(ret,rk,elt);
467 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
469 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
470 PyObject *ret=PyList_New(res.size());
472 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
474 PyObject *elt=PyTuple_New(3);
475 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
476 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
477 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
478 PyList_SetItem(ret,rk,elt);
483 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
485 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
486 PyObject *ret=PyList_New(res.size());
488 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
490 PyObject *elt=PyTuple_New(2);
491 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
492 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
493 PyList_SetItem(ret,rk,elt);
498 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
500 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
501 PyObject *ret=PyList_New(res.size());
503 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
505 PyObject *elt=PyTuple_New(2);
506 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
507 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
508 PyList_SetItem(ret,rk,elt);
513 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
515 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
516 PyObject *ret=PyList_New(res.size());
518 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
520 PyObject *elt=PyTuple_New(2);
521 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
522 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
523 PyList_SetItem(ret,rk,elt);
528 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
530 int meshDim,spaceDim;
531 mcIdType numberOfNodes;
532 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
533 PyObject *ret=PyTuple_New(4);
534 PyObject *elt0=PyList_New(res.size());
536 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
538 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
540 PyObject *elt1=PyList_New(obj2.size());
541 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
543 PyObject *elt2=PyTuple_New(2);
544 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
545 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
546 PyList_SetItem(elt1,j,elt2);
548 PyList_SetItem(elt0,i,elt1);
550 PyTuple_SetItem(ret,0,elt0);
551 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
552 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
553 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
557 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
558 const std::string& fieldName, PyObject *liIts)
560 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
561 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
562 return convertFieldDoubleVecToPy(res);
565 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
567 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
568 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
569 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
572 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
574 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
575 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
576 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
579 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
581 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
582 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
583 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
586 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
588 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
589 std::size_t size=v.size();
590 PyObject *ret=PyList_New(size);
591 for(std::size_t i=0;i<size;i++)
592 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
596 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
598 std::vector<std::string> grps;
599 converPyListToVecString(li,grps);
600 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
603 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
605 std::vector<std::string> fams;
606 converPyListToVecString(li,fams);
607 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
611 namespace MEDCoupling
613 class MEDFileWritable
616 void copyOptionsFrom(const MEDFileWritable& other) const;
617 int getTooLongStrPolicy() const;
618 void setTooLongStrPolicy(int newVal);
619 int getZipConnPolicy();
620 void setZipConnPolicy(int newVal);
623 class MEDFileWritableStandAlone : public MEDFileWritable
626 void write(const std::string& fileName, int mode) const;
627 void write33(const std::string& fileName, int mode) const;
628 void write30(const std::string& fileName, int mode) const;
631 DataArrayByte *serialize() const
633 MCAuto<DataArrayByte> ret(self->serialize());
637 PyObject *__getstate__()
639 PyObject *ret(PyList_New(0));
643 void __setstate__(PyObject *inp)
649 class MEDFileMeshReadSelector
652 MEDFileMeshReadSelector();
653 MEDFileMeshReadSelector(unsigned int code);
654 unsigned int getCode() const;
655 void setCode(unsigned int newCode);
656 bool isCellFamilyFieldReading() const;
657 bool isNodeFamilyFieldReading() const;
658 bool isCellNameFieldReading() const;
659 bool isNodeNameFieldReading() const;
660 bool isCellNumFieldReading() const;
661 bool isNodeNumFieldReading() const;
662 bool isGlobalNodeNumFieldReading() const;
663 void setCellFamilyFieldReading(bool b);
664 void setNodeFamilyFieldReading(bool b);
665 void setCellNameFieldReading(bool b);
666 void setNodeNameFieldReading(bool b);
667 void setCellNumFieldReading(bool b);
668 void setNodeNumFieldReading(bool b);
669 void setGlobalNodeNumFieldReading(bool b);
672 std::string __str__() const
674 std::ostringstream oss;
679 std::string __repr__() const
681 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
687 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
690 static MEDFileJointCorrespondence *New();
691 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
693 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
694 INTERP_KERNEL::NormalizedCellType loc_geo_type,
695 INTERP_KERNEL::NormalizedCellType rem_geo_type)
697 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
698 MEDFileJointCorrespondence *deepCopy() const;
699 MEDFileJointCorrespondence *shallowCpy() const;
700 void setIsNodal(bool isNodal);
701 bool getIsNodal() const;
702 bool isEqual(const MEDFileJointCorrespondence *other) const;
703 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
704 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
705 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
706 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
707 void setCorrespondence(DataArrayIdType *corr);
708 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
709 std::string simpleRepr() const;
712 MEDFileJointCorrespondence()
714 return MEDFileJointCorrespondence::New();
716 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
718 return MEDFileJointCorrespondence::New(correspondence);
720 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
721 INTERP_KERNEL::NormalizedCellType loc_geo_type,
722 INTERP_KERNEL::NormalizedCellType rem_geo_type)
724 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
727 std::string __str__() const
729 return self->simpleRepr();
732 DataArrayIdType *getCorrespondence() const
734 const DataArrayIdType *ret(self->getCorrespondence());
737 return const_cast<DataArrayIdType *>(ret);
742 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
745 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
746 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
747 MEDFileJointOneStep *deepCopy() const;
748 MEDFileJointOneStep *shallowCpy() const;
749 bool isEqual(const MEDFileJointOneStep *other) const;
750 void setOrder(int order);
751 int getOrder() const;
752 void setIteration(int it);
753 int getIteration() const;
754 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
755 int getNumberOfCorrespondences() const;
756 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
757 std::string simpleRepr() const;
760 MEDFileJointOneStep()
762 return MEDFileJointOneStep::New();
765 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
767 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
770 std::string __str__() const
772 return self->simpleRepr();
775 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
777 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
783 MEDFileJointCorrespondence *__getitem__(int i) const
785 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
790 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
793 static MEDFileJoint *New();
794 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
795 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
796 MEDFileJoint *deepCopy() const;
797 MEDFileJoint *shallowCpy() const;
798 bool isEqual(const MEDFileJoint *other) const;
799 void setLocalMeshName(const std::string& name);
800 std::string getLocalMeshName() const;
801 void setRemoteMeshName(const std::string& name);
802 std::string getRemoteMeshName() const;
803 void setDescription(const std::string& name);
804 std::string getDescription() const;
805 void setJointName(const std::string& name);
806 std::string getJointName() const;
807 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
808 void setDomainNumber(const int& number);
809 int getDomainNumber() const;
810 void pushStep(MEDFileJointOneStep* step);
811 int getNumberOfSteps() const;
812 std::string simpleRepr() const;
817 return MEDFileJoint::New();
820 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
822 return MEDFileJoint::New(fileName,mName,num);
825 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
827 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
830 std::string __str__() const
832 return self->simpleRepr();
835 MEDFileJointOneStep *getStepAtPos(int i) const
837 MEDFileJointOneStep *ret(self->getStepAtPos(i));
843 MEDFileJointOneStep *__getitem__(int i)
845 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
850 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
853 static MEDFileJoints *New();
854 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
855 MEDFileJoints *deepCopy() const;
856 std::string simpleRepr() const;
857 std::string getMeshName() const;
858 int getNumberOfJoints() const;
859 std::vector<std::string> getJointsNames() const;
860 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
861 void resize(int newSize);
862 void pushJoint(MEDFileJoint *joint);
863 void setJointAtPos(int i, MEDFileJoint *joint);
864 void destroyJointAtPos(int i);
869 return MEDFileJoints::New();
872 MEDFileJoints(const std::string& fileName, const std::string& meshName)
874 return MEDFileJoints::New(fileName,meshName);
877 std::string __str__() const
879 return self->simpleRepr();
882 MEDFileJoint *__getitem__(PyObject *obj)
884 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
887 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
892 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
900 return self->getNumberOfJoints();
903 MEDFileJoint *getJointAtPos(int i) const
905 MEDFileJoint *ret=self->getJointAtPos(i);
911 MEDFileJoint *getJointWithName(const std::string& paramName) const
913 MEDFileJoint *ret=self->getJointWithName(paramName);
921 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
924 MEDFileEquivalenceBase();
927 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
930 MEDFileEquivalenceData();
932 void setArray(DataArrayInt32 *data);
935 DataArrayInt32 *getArray()
937 DataArrayInt32 *ret(self->getArray());
938 if(ret) ret->incrRef();
944 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
947 MEDFileEquivalenceNode();
950 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
953 MEDFileEquivalenceCell();
956 std::size_t size() const;
957 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
958 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
961 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
963 DataArrayInt32 *ret(self->getArray(type));
964 if(ret) ret->incrRef();
968 PyObject *getTypes() const
970 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
971 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
972 PyObject *res=PyList_New(result.size());
973 for(int i=0;iL!=result.end(); i++, iL++)
974 PyList_SetItem(res,i,PyInt_FromLong(*iL));
980 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
983 MEDFileEquivalencePair();
985 std::string getName() const;
986 void setName(const std::string& name);
987 std::string getDescription() const;
988 void setDescription(const std::string& descr);
989 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
992 MEDFileEquivalenceCell *initCell()
994 MEDFileEquivalenceCell *ret(self->initCell());
995 if(ret) ret->incrRef();
999 MEDFileEquivalenceNode *initNode()
1001 MEDFileEquivalenceNode *ret(self->initNode());
1002 if(ret) ret->incrRef();
1006 MEDFileEquivalenceCell *getCell()
1008 MEDFileEquivalenceCell *ret(self->getCell());
1009 if(ret) ret->incrRef();
1013 MEDFileEquivalenceNode *getNode()
1015 MEDFileEquivalenceNode *ret(self->getNode());
1016 if(ret) ret->incrRef();
1022 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1025 MEDFileEquivalences();
1028 std::vector<std::string> getEquivalenceNames() const;
1029 void killEquivalenceWithName(const std::string& name);
1030 void killEquivalenceAt(int i);
1034 MEDFileEquivalencePair *getEquivalence(int i)
1036 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1037 if(ret) ret->incrRef();
1040 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1042 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1043 if(ret) ret->incrRef();
1047 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1049 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1050 if(ret) ret->incrRef();
1056 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1059 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1060 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1061 static MEDFileMesh *New(DataArrayByte *db);
1062 virtual MEDFileMesh *createNewEmpty() const;
1063 virtual MEDFileMesh *deepCopy() const;
1064 virtual MEDFileMesh *shallowCpy() const;
1065 virtual void clearNonDiscrAttributes() const;
1066 void setName(const std::string& name);
1067 std::string getName();
1068 std::string getUnivName() const;
1069 bool getUnivNameWrStatus() const;
1070 void setUnivNameWrStatus(bool newStatus);
1071 void setDescription(const std::string& name);
1072 std::string getDescription() const;
1073 void setOrder(int order);
1074 int getOrder() const;
1075 void setIteration(int it);
1077 void setTimeValue(double time);
1078 void setTime(int dt, int it, double time);
1079 double getTimeValue() const;
1080 void setTimeUnit(const std::string& unit);
1081 std::string getTimeUnit() const;
1082 void setAxisType(MEDCouplingAxisType at);
1083 MEDCouplingAxisType getAxisType() const;
1084 virtual int getNumberOfNodes() const;
1085 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1086 virtual bool hasImplicitPart() const;
1087 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1088 virtual void releaseImplicitPartIfAny() const;
1089 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1090 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1091 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1092 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1093 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1094 virtual MEDFileMesh *cartesianize() const;
1095 std::vector<int> getNonEmptyLevels() const;
1096 std::vector<int> getNonEmptyLevelsExt() const;
1097 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1099 bool existsGroup(const std::string& groupName) const;
1100 bool existsFamily(int famId) const;
1101 bool existsFamily(const std::string& familyName) const;
1102 void setFamilyId(const std::string& familyName, int id);
1103 void setFamilyIdUnique(const std::string& familyName, int id);
1104 void addFamily(const std::string& familyName, int id);
1105 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1106 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1107 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1108 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1111 void clearFamGrpMaps();
1112 const std::map<std::string,int>& getFamilyInfo() const;
1113 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1114 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1115 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1116 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1117 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1118 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1119 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1120 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1121 std::vector<std::string> getGroupsNames() const;
1122 std::vector<std::string> getFamiliesNames() const;
1123 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1124 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1125 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1126 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1127 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1128 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1129 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1130 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1131 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1132 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1133 static std::string GetMagicFamilyStr();
1134 void assignFamilyNameWithGroupName();
1135 std::vector<std::string> removeEmptyGroups();
1136 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1137 void removeGroup(const std::string& name);
1138 void removeFamily(const std::string& name);
1139 std::vector<std::string> removeOrphanGroups();
1140 std::vector<std::string> removeOrphanFamilies();
1141 void removeFamiliesReferedByNoGroups();
1142 void rearrangeFamilies();
1144 void checkOrphanFamilyZero() const;
1145 void changeGroupName(const std::string& oldName, const std::string& newName);
1146 void changeFamilyName(const std::string& oldName, const std::string& newName);
1147 void changeFamilyId(int oldId, int newId);
1148 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1149 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1150 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1151 int getFamilyId(const std::string& name) const;
1152 int getMaxAbsFamilyId() const;
1153 int getMaxFamilyId() const;
1154 int getMinFamilyId() const;
1155 int getTheMaxAbsFamilyId() const;
1156 int getTheMaxFamilyId() const;
1157 int getTheMinFamilyId() const;
1158 virtual int getMaxAbsFamilyIdInArrays() const;
1159 virtual int getMaxFamilyIdInArrays() const;
1160 virtual int getMinFamilyIdInArrays() const;
1161 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1162 DataArrayIdType *computeAllFamilyIdsInUse() const;
1163 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1164 std::string getFamilyNameGivenId(int id) const;
1165 bool ensureDifferentFamIdsPerLevel();
1166 void normalizeFamIdsTrio();
1167 void normalizeFamIdsMEDFile();
1168 virtual int getMeshDimension() const;
1169 virtual std::string simpleRepr() const;
1170 virtual std::string advancedRepr() const;
1172 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1173 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1174 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1175 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1176 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1177 virtual void addNodeGroup(const DataArrayIdType *ids);
1178 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1179 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1180 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1181 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1182 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1183 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1184 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1185 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1186 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1187 int getNumberOfJoints();
1188 MEDFileJoints *getJoints();
1189 void setJoints( MEDFileJoints* joints );
1190 void initializeEquivalences();
1191 void killEquivalences();
1192 bool presenceOfStructureElements() const;
1193 void killStructureElements();
1196 std::string __str__() const
1198 return self->simpleRepr();
1201 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1203 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1209 double tmp0=self->getTime(tmp1,tmp2);
1210 PyObject *res = PyList_New(3);
1211 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1212 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1213 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1217 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1220 bool ret0=self->isEqual(other,eps,what);
1221 PyObject *res=PyList_New(2);
1222 PyObject *ret0Py=ret0?Py_True:Py_False;
1224 PyList_SetItem(res,0,ret0Py);
1225 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1229 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1231 std::vector<const DataArrayIdType *> grps;
1232 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1233 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1236 PyObject *areFamsEqual(const MEDFileMesh *other) const
1239 bool ret0=self->areFamsEqual(other,what);
1240 PyObject *res=PyList_New(2);
1241 PyObject *ret0Py=ret0?Py_True:Py_False;
1243 PyList_SetItem(res,0,ret0Py);
1244 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1248 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1251 bool ret0=self->areGrpsEqual(other,what);
1252 PyObject *res=PyList_New(2);
1253 PyObject *ret0Py=ret0?Py_True:Py_False;
1255 PyList_SetItem(res,0,ret0Py);
1256 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1260 PyObject *getAllGeoTypes() const
1262 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1263 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1264 PyObject *res=PyList_New(result.size());
1265 for(int i=0;iL!=result.end(); i++, iL++)
1266 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1270 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1272 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1273 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1274 PyObject *res=PyList_New(result.size());
1275 for(int i=0;iL!=result.end(); i++, iL++)
1276 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1280 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1282 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1285 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1288 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1290 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1293 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1296 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1298 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1301 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1304 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1306 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1309 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1312 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1314 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1317 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1320 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1323 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1324 PyObject *ret=PyTuple_New(2);
1325 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1326 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1330 PyObject *unPolyze()
1332 DataArrayIdType *ret3=0;
1333 std::vector<mcIdType> ret1,ret2;
1334 bool ret0=self->unPolyze(ret1,ret2,ret3);
1335 PyObject *ret=PyTuple_New(4);
1336 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1338 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1339 for(int j=0;j<(int)ret1.size()/3;j++)
1341 PyObject *retLev2=PyList_New(3);
1342 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1343 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1344 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1345 PyList_SetItem(retLev1_0,j,retLev2);
1347 PyTuple_SetItem(ret,1,retLev1_0);
1349 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1350 for(int j=0;j<(int)ret2.size()/3;j++)
1352 PyObject *retLev2=PyList_New(3);
1353 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1354 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1355 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1356 PyList_SetItem(retLev1_1,j,retLev2);
1358 PyTuple_SetItem(ret,2,retLev1_1);
1360 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1364 MEDFileEquivalences *getEquivalences()
1366 MEDFileEquivalences *ret(self->getEquivalences());
1367 if(ret) ret->incrRef();
1371 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1373 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1379 class MEDFileUMesh : public MEDFileMesh
1382 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1383 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1384 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1385 static MEDFileUMesh *New(DataArrayByte *db);
1386 static MEDFileUMesh *New();
1387 static const char *GetSpeStr4ExtMesh();
1389 int getSpaceDimension() const;
1390 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1391 void checkConsistency() const;
1392 void checkSMESHConsistency() const;
1393 void clearNodeAndCellNumbers();
1395 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1396 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1397 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1398 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1399 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1400 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1401 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1402 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1403 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1404 void forceComputationOfParts() const;
1406 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1407 void setCoords(DataArrayDouble *coords);
1408 void setCoordsForced(DataArrayDouble *coords);
1409 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1410 void removeMeshAtLevel(int meshDimRelToMax);
1411 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1412 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1413 void optimizeFamilies();
1414 DataArrayIdType *computeFetchedNodeIds() const;
1415 DataArrayIdType *zipCoords();
1416 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1417 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1418 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1419 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1420 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1421 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1424 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1426 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1429 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1431 return MEDFileUMesh::New(fileName,mrs);
1434 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1436 return MEDFileUMesh::New(mem);
1439 MEDFileUMesh(DataArrayByte *db)
1441 return MEDFileUMesh::New(db);
1446 return MEDFileUMesh::New();
1449 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)
1451 std::vector<int> typesCpp1;
1452 convertPyToNewIntArr3(types,typesCpp1);
1453 std::size_t sz(typesCpp1.size());
1454 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1455 for(std::size_t ii=0;ii<sz;ii++)
1456 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1457 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1460 static PyObject *LoadPartCoords(const std::string& fileName, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax)
1462 MCAuto<DataArrayDouble> coords;
1463 MCAuto<PartDefinition> partCoords;
1464 MCAuto<DataArrayIdType> famCoords,numCoords;
1465 MCAuto<DataArrayAsciiChar> nameCoord;
1466 MEDFileUMesh::LoadPartCoords(fileName,infosOnComp,mName,dt,it,nMin,nMax,coords,partCoords,famCoords,numCoords,nameCoord);
1467 PyObject *ret(PyTuple_New(5));
1468 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1469 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1470 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1471 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1472 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1476 PyObject *__getstate__()
1478 std::vector<double> a0;
1479 std::vector<mcIdType> a1;
1480 std::vector<std::string> a2;
1481 std::vector< MCAuto<DataArrayIdType> > a3;
1482 MCAuto<DataArrayDouble> a4;
1483 self->serialize(a0,a1,a2,a3,a4);
1484 PyObject *ret(PyTuple_New(5));
1485 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1486 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1487 std::size_t sz(a2.size());
1488 PyObject *ret2(PyList_New(sz));
1489 for(std::size_t i=0;i<sz;i++)
1490 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1491 PyTuple_SetItem(ret,2,ret2);
1493 PyObject *ret3(PyList_New(sz));
1494 for(std::size_t i=0;i<sz;i++)
1496 DataArrayIdType *elt(a3[i]);
1499 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1501 PyTuple_SetItem(ret,3,ret3);
1502 DataArrayDouble *ret4(a4);
1505 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1509 void __setstate__(PyObject *inp)
1511 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1512 if(!PyTuple_Check(inp))
1513 throw INTERP_KERNEL::Exception(MSG);
1514 std::size_t sz(PyTuple_Size(inp));
1516 throw INTERP_KERNEL::Exception(MSG);
1517 std::vector<double> a0;
1518 std::vector<mcIdType> a1;
1519 std::vector<std::string> a2;
1520 std::vector< MCAuto<DataArrayIdType> > a3;
1521 MCAuto<DataArrayDouble> a4;
1523 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1525 fillArrayWithPyListDbl3(a0py,tmp,a0);
1526 convertPyToNewIntArr3(a1py,a1);
1527 fillStringVector(a2py,a2);
1529 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1531 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1532 if(!SWIG_IsOK(status))
1533 throw INTERP_KERNEL::Exception(MSG);
1534 a4=reinterpret_cast<DataArrayDouble *>(argp);
1535 if((DataArrayDouble *)a4)
1538 std::vector< DataArrayIdType * > a3Tmp;
1539 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1540 std::size_t sz(a3Tmp.size());
1542 for(std::size_t i=0;i<sz;i++)
1546 a3Tmp[i]->incrRef();
1548 self->unserialize(a0,a1,a2,a3,a4);
1552 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1555 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1556 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1559 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1562 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1565 self->setMeshAtLevel(meshDimRelToMax,m1);
1568 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1571 void __delitem__(int meshDimRelToMax)
1573 self->removeMeshAtLevel(meshDimRelToMax);
1576 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1578 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1580 DataArrayDouble *a,*a2;
1581 DataArrayDoubleTuple *aa,*aa2;
1582 std::vector<double> bb,bb2;
1584 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1585 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1586 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1590 static MEDFileUMesh *Aggregate(PyObject *meshes)
1592 std::vector<const MEDFileUMesh *> meshesCpp;
1593 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1594 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1598 PyObject *getAllDistributionOfTypes() const
1600 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1601 return convertVecPairIntToPy(ret);
1604 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1606 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1607 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1608 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1611 MEDFileUMesh *extractPart(PyObject *extractDef) const
1613 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1614 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1615 return self->extractPart(extractDefCpp);
1618 void setMeshes(PyObject *li, bool renum=false)
1620 std::vector<const MEDCouplingUMesh *> ms;
1621 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1622 self->setMeshes(ms,renum);
1625 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1627 std::vector<const MEDCouplingUMesh *> ms;
1628 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1629 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1632 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1634 std::vector<const MEDCouplingUMesh *> ms;
1635 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1636 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1639 DataArrayDouble *getCoords() const
1641 DataArrayDouble *ret=self->getCoords();
1647 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1649 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1652 return const_cast<PartDefinition *>(ret);
1655 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1657 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1658 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1659 PyObject *ret=PyTuple_New(3);
1660 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1661 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1662 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1666 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1668 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1674 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1676 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1677 std::size_t sz(tmp.size());
1678 PyObject *ret=PyList_New(sz);
1679 for(std::size_t i=0;i<sz;i++)
1683 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1690 class MEDFileStructuredMesh : public MEDFileMesh
1695 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1697 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1705 class MEDFileCMesh : public MEDFileStructuredMesh
1708 static MEDFileCMesh *New();
1709 static MEDFileCMesh *New(DataArrayByte *db);
1710 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1711 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1712 void setMesh(MEDCouplingCMesh *m);
1713 int getSpaceDimension() const;
1718 return MEDFileCMesh::New();
1721 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1723 return MEDFileCMesh::New(fileName,mrs);
1726 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1728 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1731 MEDFileCMesh(DataArrayByte *db)
1733 return MEDFileCMesh::New(db);
1736 PyObject *getMesh() const
1738 const MEDCouplingCMesh *tmp=self->getMesh();
1741 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1746 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1749 static MEDFileCurveLinearMesh *New();
1750 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1751 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1752 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1753 void setMesh(MEDCouplingCurveLinearMesh *m);
1756 MEDFileCurveLinearMesh()
1758 return MEDFileCurveLinearMesh::New();
1761 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1763 return MEDFileCurveLinearMesh::New(fileName,mrs);
1766 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1768 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1771 MEDFileCurveLinearMesh(DataArrayByte *db)
1773 return MEDFileCurveLinearMesh::New(db);
1776 PyObject *getMesh() const
1778 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1781 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1786 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1789 static MEDFileMeshMultiTS *New();
1790 static MEDFileMeshMultiTS *New(const std::string& fileName);
1791 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1792 MEDFileMeshMultiTS *deepCopy() const;
1793 std::string getName() const;
1794 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1795 void cartesianizeMe();
1798 MEDFileMeshMultiTS()
1800 return MEDFileMeshMultiTS::New();
1803 MEDFileMeshMultiTS(const std::string& fileName)
1805 return MEDFileMeshMultiTS::New(fileName);
1808 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1810 return MEDFileMeshMultiTS::New(fileName,mName);
1813 MEDFileMesh *getOneTimeStep() const
1815 MEDFileMesh *ret=self->getOneTimeStep();
1823 class MEDFileMeshesIterator
1830 MEDFileMesh *ret=self->nextt();
1834 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1838 PyErr_SetString(PyExc_StopIteration,"No more data.");
1845 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1848 static MEDFileMeshes *New();
1849 static MEDFileMeshes *New(DataArrayByte *db);
1850 MEDFileMeshes *deepCopy() const;
1851 int getNumberOfMeshes() const;
1852 std::vector<std::string> getMeshesNames() const;
1854 void resize(int newSize);
1855 void pushMesh(MEDFileMesh *mesh);
1856 void setMeshAtPos(int i, MEDFileMesh *mesh);
1857 void destroyMeshAtPos(int i);
1858 void cartesianizeMe();
1859 bool presenceOfStructureElements() const;
1860 void killStructureElements();
1865 return MEDFileMeshes::New();
1868 MEDFileMeshes(const std::string& fileName)
1870 return MEDFileMeshes::New(fileName);
1873 MEDFileMeshes(DataArrayByte *db)
1875 return MEDFileMeshes::New(db);
1878 std::string __str__() const
1880 return self->simpleRepr();
1883 MEDFileMesh *__getitem__(PyObject *obj)
1885 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1886 if(PyInt_Check(obj))
1888 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1893 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1899 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1901 self->setMeshAtPos(obj,mesh);
1905 MEDFileMeshesIterator *__iter__()
1907 return self->iterator();
1912 return self->getNumberOfMeshes();
1915 MEDFileMesh *getMeshAtPos(int i) const
1917 MEDFileMesh *ret=self->getMeshAtPos(i);
1922 MEDFileMesh *getMeshWithName(const std::string& mname) const
1924 MEDFileMesh *ret=self->getMeshWithName(mname);
1932 class MEDFileFieldLoc : public RefCountObject
1935 std::string getName() const;
1936 int getDimension() const;
1937 int getNumberOfGaussPoints() const;
1938 int getNumberOfPointsInCells() const;
1939 const std::vector<double>& getRefCoords() const;
1940 const std::vector<double>& getGaussCoords() const;
1941 const std::vector<double>& getGaussWeights() const;
1942 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1945 std::string __str__() const
1947 return self->repr();
1952 class MEDFileFieldGlobsReal
1955 void resetContent();
1956 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1957 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1958 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1959 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1960 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1961 void checkGlobsCoherency() const;
1962 void checkGlobsPflsPartCoherency() const;
1963 void checkGlobsLocsPartCoherency() const;
1964 std::vector<std::string> getPfls() const;
1965 std::vector<std::string> getLocs() const;
1966 bool existsPfl(const std::string& pflName) const;
1967 bool existsLoc(const std::string& locName) const;
1968 std::string createNewNameOfPfl() const;
1969 std::string createNewNameOfLoc() const;
1970 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1971 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1972 virtual std::vector<std::string> getPflsReallyUsed() const;
1973 virtual std::vector<std::string> getLocsReallyUsed() const;
1974 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1975 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1976 void killProfileIds(const std::vector<int>& pflIds);
1977 void killLocalizationIds(const std::vector<int>& locIds);
1978 void changePflName(const std::string& oldName, const std::string& newName);
1979 void changeLocName(const std::string& oldName, const std::string& newName);
1980 int getNbOfGaussPtPerCell(int locId) const;
1981 int getLocalizationId(const std::string& loc) const;
1982 int getProfileId(const std::string& pfl) const;
1983 void killStructureElementsInGlobs();
1986 PyObject *getProfile(const std::string& pflName) const
1988 const DataArrayIdType *ret=self->getProfile(pflName);
1991 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1994 PyObject *getProfileFromId(int pflId) const
1996 const DataArrayIdType *ret=self->getProfileFromId(pflId);
1999 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2002 PyObject *getLocalizationFromId(int locId) const
2004 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2007 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2010 PyObject *getLocalization(const std::string& locName) const
2012 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2015 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2018 PyObject *zipPflsNames()
2020 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2021 return convertVecPairVecStToPy(ret);
2024 PyObject *zipLocsNames(double eps)
2026 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2027 return convertVecPairVecStToPy(ret);
2030 void changePflsNames(PyObject *li)
2032 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2033 self->changePflsNames(v);
2036 void changePflsRefsNamesGen(PyObject *li)
2038 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2039 self->changePflsRefsNamesGen(v);
2042 void changePflsNamesInStruct(PyObject *li)
2044 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2045 self->changePflsNamesInStruct(v);
2048 void changeLocsNames(PyObject *li)
2050 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2051 self->changeLocsNames(v);
2054 void changeLocsRefsNamesGen(PyObject *li)
2056 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2057 self->changeLocsRefsNamesGen(v);
2060 void changeLocsNamesInStruct(PyObject *li)
2062 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2063 self->changeLocsNamesInStruct(v);
2066 std::string simpleReprGlobs() const
2068 std::ostringstream oss;
2069 self->simpleReprGlobs(oss);
2075 class MEDFileEntities
2080 static MEDFileEntities *BuildFrom(PyObject *entities)
2082 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2083 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2085 std::size_t sz(inp0.size());
2087 for(std::size_t i=0;i<sz;i++)
2088 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2090 return MEDFileEntities::BuildFrom(&inp);
2097 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2100 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2101 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2102 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2103 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2105 void loadArraysIfNecessary();
2106 void unloadArrays();
2107 void unloadArraysWithoutDataLoss();
2108 int getDimension() const;
2109 int getIteration() const;
2110 int getOrder() const;
2111 std::string getName();
2112 void setName(const std::string& name);
2113 std::string getMeshName();
2114 void setMeshName(const std::string& newMeshName);
2115 int getMeshIteration() const;
2116 int getMeshOrder() const;
2117 int getNumberOfComponents() const;
2118 bool isDealingTS(int iteration, int order) const;
2119 void setInfo(const std::vector<std::string>& infos);
2120 const std::vector<std::string>& getInfo() const;
2121 bool presenceOfMultiDiscPerGeoType() const;
2122 void setTime(int iteration, int order, double val);
2123 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2124 MEDFileAnyTypeField1TS *deepCopy() const;
2125 std::string getDtUnit() const;
2126 void setDtUnit(const std::string& dtUnit);
2132 double tmp0=self->getTime(tmp1,tmp2);
2133 PyObject *res = PyList_New(3);
2134 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2135 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2136 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2140 PyObject *getDtIt() const
2142 std::pair<int,int> res=self->getDtIt();
2143 PyObject *elt=PyTuple_New(2);
2144 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2145 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2149 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2151 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2154 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2156 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2159 bool changeMeshNames(PyObject *li)
2161 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2162 return self->changeMeshNames(modifTab);
2165 PyObject *getTypesOfFieldAvailable() const
2167 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2168 PyObject *ret2=PyList_New(ret.size());
2169 for(int i=0;i<(int)ret.size();i++)
2170 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2174 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2176 std::vector<int> ret1;
2177 int ret0=self->getNonEmptyLevels(mname,ret1);
2178 PyObject *elt=PyTuple_New(2);
2179 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2180 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2184 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2186 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2187 std::vector< std::vector<TypeOfField> > typesF;
2188 std::vector< std::vector<std::string> > pfls;
2189 std::vector< std::vector<std::string> > locs;
2190 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2191 std::size_t sz=ret.size();
2192 PyObject *ret2=PyList_New(sz);
2193 for(std::size_t i=0;i<sz;i++)
2195 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2196 const std::vector<TypeOfField>& typesFI=typesF[i];
2197 const std::vector<std::string>& pflsI=pfls[i];
2198 const std::vector<std::string>& locsI=locs[i];
2199 PyObject *elt=PyTuple_New(2);
2200 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2201 std::size_t sz2=ret[i].size();
2202 PyObject *elt2=PyList_New(sz2);
2203 for(std::size_t j=0;j<sz2;j++)
2205 PyObject *elt3=PyTuple_New(4);
2206 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2207 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2208 PyTuple_SetItem(elt3,1,elt4);
2209 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2210 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2211 PyList_SetItem(elt2,j,elt3);
2213 PyTuple_SetItem(elt,1,elt2);
2214 PyList_SetItem(ret2,i,elt);
2219 PyObject *splitComponents() const
2221 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2222 std::size_t sz=ret.size();
2223 PyObject *retPy=PyList_New(sz);
2224 for(std::size_t i=0;i<sz;i++)
2225 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2229 PyObject *splitDiscretizations() const
2231 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2232 std::size_t sz=ret.size();
2233 PyObject *retPy=PyList_New(sz);
2234 for(std::size_t i=0;i<sz;i++)
2235 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2239 PyObject *splitMultiDiscrPerGeoTypes() const
2241 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2242 std::size_t sz=ret.size();
2243 PyObject *retPy=PyList_New(sz);
2244 for(std::size_t i=0;i<sz;i++)
2245 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2249 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2251 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2252 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2253 return self->extractPart(extractDefCpp,mm);
2258 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2261 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2262 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2263 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2264 static MEDFileField1TS *New(DataArrayByte *db);
2265 static MEDFileField1TS *New();
2266 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2267 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2268 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2269 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2270 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2271 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2272 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2273 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2275 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2276 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2277 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2278 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2279 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2282 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2284 return MEDFileField1TS::New(fileName,loadAll);
2287 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2289 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2292 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2294 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2297 MEDFileField1TS(DataArrayByte *db)
2299 return MEDFileField1TS::New(db);
2304 return MEDFileField1TS::New();
2307 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2309 const DataArrayDouble *arr=0;
2311 arr=field->getArray();
2312 self->copyTinyInfoFrom(field,arr);
2315 std::string __str__() const
2317 return self->simpleRepr();
2320 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2322 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2325 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2327 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2328 std::vector< std::vector<TypeOfField> > typesF;
2329 std::vector< std::vector<std::string> > pfls;
2330 std::vector< std::vector<std::string> > locs;
2331 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2332 std::size_t sz=ret.size();
2333 PyObject *ret2=PyList_New(sz);
2334 for(std::size_t i=0;i<sz;i++)
2336 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2337 const std::vector<TypeOfField>& typesFI=typesF[i];
2338 const std::vector<std::string>& pflsI=pfls[i];
2339 const std::vector<std::string>& locsI=locs[i];
2340 PyObject *elt=PyTuple_New(2);
2341 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2342 std::size_t sz2=ret[i].size();
2343 PyObject *elt2=PyList_New(sz2);
2344 for(std::size_t j=0;j<sz2;j++)
2346 PyObject *elt3=PyTuple_New(4);
2347 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2348 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2349 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2350 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2351 PyList_SetItem(elt2,j,elt3);
2353 PyTuple_SetItem(elt,1,elt2);
2354 PyList_SetItem(ret2,i,elt);
2359 DataArrayDouble *getUndergroundDataArray() const
2361 DataArrayDouble *ret=self->getUndergroundDataArray();
2367 PyObject *getUndergroundDataArrayExt() const
2369 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2374 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2377 static MEDFileIntField1TS *New();
2378 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2379 static MEDFileIntField1TS *New(DataArrayByte *db);
2380 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2381 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2382 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2384 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2385 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2386 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2387 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2388 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2389 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2390 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2391 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2392 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2393 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2396 MEDFileIntField1TS()
2398 return MEDFileIntField1TS::New();
2401 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2403 return MEDFileIntField1TS::New(fileName,loadAll);
2406 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2408 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2411 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2413 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2416 MEDFileIntField1TS(DataArrayByte *db)
2418 return MEDFileIntField1TS::New(db);
2421 std::string __str__() const
2423 return self->simpleRepr();
2426 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2428 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2431 DataArrayInt32 *getUndergroundDataArray() const
2433 DataArrayInt32 *ret=self->getUndergroundDataArray();
2439 PyObject *getUndergroundDataArrayExt() const
2441 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2446 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2449 static MEDFileFloatField1TS *New();
2450 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2451 static MEDFileFloatField1TS *New(DataArrayByte *db);
2452 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2453 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2454 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2456 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2457 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2458 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2459 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2460 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2461 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2462 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2463 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2464 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2465 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2468 MEDFileFloatField1TS()
2470 return MEDFileFloatField1TS::New();
2473 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2475 return MEDFileFloatField1TS::New(fileName,loadAll);
2478 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2480 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2483 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2485 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2488 MEDFileFloatField1TS(DataArrayByte *db)
2490 return MEDFileFloatField1TS::New(db);
2493 std::string __str__() const
2495 return self->simpleRepr();
2498 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2500 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2503 DataArrayFloat *getUndergroundDataArray() const
2505 DataArrayFloat *ret=self->getUndergroundDataArray();
2511 PyObject *getUndergroundDataArrayExt() const
2513 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2518 class MEDFileAnyTypeFieldMultiTSIterator
2525 MEDFileAnyTypeField1TS *ret=self->nextt();
2527 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2530 PyErr_SetString(PyExc_StopIteration,"No more data.");
2537 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2540 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2541 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2542 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2543 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2544 std::string getName() const;
2545 void setName(const std::string& name);
2546 std::string getDtUnit() const;
2547 void setDtUnit(const std::string& dtUnit);
2548 std::string getMeshName() const;
2549 void setMeshName(const std::string& newMeshName);
2550 const std::vector<std::string>& getInfo() const;
2551 bool presenceOfMultiDiscPerGeoType() const;
2552 int getNumberOfComponents() const;
2553 int getNumberOfTS() const;
2554 void eraseEmptyTS();
2555 int getPosOfTimeStep(int iteration, int order) const;
2556 int getPosGivenTime(double time, double eps=1e-8) const;
2558 void loadArraysIfNecessary();
2559 void unloadArrays();
2560 void unloadArraysWithoutDataLoss();
2562 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2563 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2564 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2565 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2566 void synchronizeNameScope();
2567 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2572 return self->getNumberOfTS();
2575 int getTimeId(PyObject *elt0) const
2577 if(elt0 && PyInt_Check(elt0))
2579 int pos=(int)PyInt_AS_LONG(elt0);
2582 else if(elt0 && PyTuple_Check(elt0))
2584 if(PyTuple_Size(elt0)==2)
2586 PyObject *o0=PyTuple_GetItem(elt0,0);
2587 PyObject *o1=PyTuple_GetItem(elt0,1);
2588 if(PyInt_Check(o0) && PyInt_Check(o1))
2590 int iter=(int)PyInt_AS_LONG(o0);
2591 int order=(int)PyInt_AS_LONG(o1);
2592 return self->getPosOfTimeStep(iter,order);
2595 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 !");
2598 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 !");
2600 else if(elt0 && PyFloat_Check(elt0))
2602 double val=PyFloat_AS_DOUBLE(elt0);
2603 return self->getPosGivenTime(val);
2606 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2609 PyObject *getIterations() const
2611 std::vector< std::pair<int,int> > res(self->getIterations());
2612 return convertVecPairIntToPy(res);
2615 PyObject *getTimeSteps() const
2617 std::vector<double> ret1;
2618 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2619 std::size_t sz=ret.size();
2620 PyObject *ret2=PyList_New(sz);
2621 for(std::size_t i=0;i<sz;i++)
2623 PyObject *elt=PyTuple_New(3);
2624 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2625 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2626 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2627 PyList_SetItem(ret2,i,elt);
2632 PyObject *getTypesOfFieldAvailable() const
2634 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2635 PyObject *ret2=PyList_New(ret.size());
2636 for(int i=0;i<(int)ret.size();i++)
2638 const std::vector<TypeOfField>& rett=ret[i];
2639 PyObject *ret3=PyList_New(rett.size());
2640 for(int j=0;j<(int)rett.size();j++)
2641 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2642 PyList_SetItem(ret2,i,ret3);
2647 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2649 std::vector<int> ret1;
2650 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2651 PyObject *elt=PyTuple_New(2);
2652 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2653 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2657 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2659 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2660 std::vector< std::vector<TypeOfField> > typesF;
2661 std::vector< std::vector<std::string> > pfls;
2662 std::vector< std::vector<std::string> > locs;
2663 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2664 std::size_t sz=ret.size();
2665 PyObject *ret2=PyList_New(sz);
2666 for(std::size_t i=0;i<sz;i++)
2668 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2669 const std::vector<TypeOfField>& typesFI=typesF[i];
2670 const std::vector<std::string>& pflsI=pfls[i];
2671 const std::vector<std::string>& locsI=locs[i];
2672 PyObject *elt=PyTuple_New(2);
2673 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2674 std::size_t sz2=ret[i].size();
2675 PyObject *elt2=PyList_New(sz2);
2676 for(std::size_t j=0;j<sz2;j++)
2678 PyObject *elt3=PyTuple_New(4);
2679 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2680 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2681 PyTuple_SetItem(elt3,1,elt4);
2682 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2683 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2684 PyList_SetItem(elt2,j,elt3);
2686 PyTuple_SetItem(elt,1,elt2);
2687 PyList_SetItem(ret2,i,elt);
2692 std::vector<int> getTimeIds(PyObject *elts) const
2694 if(PyList_Check(elts))
2696 std::size_t sz=PyList_Size(elts);
2697 std::vector<int> ret(sz);
2698 for(std::size_t i=0;i<sz;i++)
2700 PyObject *elt=PyList_GetItem(elts,i);
2701 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2707 std::vector<int> ret(1);
2708 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2713 void __delitem__(PyObject *elts)
2715 if(PySlice_Check(elts))
2717 Py_ssize_t strt=2,stp=2,step=2;
2718 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2719 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2723 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2724 if(!idsToRemove.empty())
2725 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2729 void eraseTimeStepIds(PyObject *li)
2733 std::vector<int> pos2;
2734 DataArrayInt32 *pos3=0;
2735 DataArrayIntTuple *pos4=0;
2736 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2741 self->eraseTimeStepIds(&pos1,&pos1+1);
2748 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2753 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2757 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2761 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2763 return self->iterator();
2766 PyObject *__getitem__(PyObject *elt0) const
2768 if(elt0 && PyList_Check(elt0))
2770 std::size_t sz=PyList_Size(elt0);
2771 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2772 int *pt=da->getPointer();
2773 for(std::size_t i=0;i<sz;i++,pt++)
2775 PyObject *elt1=PyList_GetItem(elt0,i);
2776 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2778 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2780 else if(elt0 && PySlice_Check(elt0))
2782 Py_ssize_t strt=2,stp=2,step=2;
2783 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2784 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2787 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2790 bool changeMeshNames(PyObject *li)
2792 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2793 return self->changeMeshNames(modifTab);
2796 PyObject *splitComponents() const
2798 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2799 std::size_t sz=ret.size();
2800 PyObject *retPy=PyList_New(sz);
2801 for(std::size_t i=0;i<sz;i++)
2802 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2806 PyObject *splitDiscretizations() const
2808 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2809 std::size_t sz=ret.size();
2810 PyObject *retPy=PyList_New(sz);
2811 for(std::size_t i=0;i<sz;i++)
2812 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2816 PyObject *splitMultiDiscrPerGeoTypes() const
2818 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2819 std::size_t sz=ret.size();
2820 PyObject *retPy=PyList_New(sz);
2821 for(std::size_t i=0;i<sz;i++)
2822 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2826 void pushBackTimeSteps(PyObject *li)
2829 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2830 if(SWIG_IsOK(status))
2832 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2836 std::vector<MEDFileAnyTypeField1TS *> tmp;
2837 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2838 self->pushBackTimeSteps(tmp);
2842 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2844 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2845 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2846 return self->extractPart(extractDefCpp,mm);
2849 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2851 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2852 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2853 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2854 std::size_t sz=ret.size();
2855 PyObject *retPy=PyList_New(sz);
2856 for(std::size_t i=0;i<sz;i++)
2858 std::size_t sz2=ret[i].size();
2859 PyObject *ret1Py=PyList_New(sz2);
2860 for(std::size_t j=0;j<sz2;j++)
2862 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2865 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2867 PyList_SetItem(retPy,i,ret1Py);
2872 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2874 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2875 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2876 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2877 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2878 if(ret2.size()!=ret.size())
2880 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2881 throw INTERP_KERNEL::Exception(oss.str().c_str());
2883 std::size_t sz=ret.size();
2884 PyObject *retPy=PyList_New(sz);
2885 for(std::size_t i=0;i<sz;i++)
2887 std::size_t sz2=ret[i].size();
2888 PyObject *ret0Py=PyTuple_New(2);
2889 PyObject *ret1Py=PyList_New(sz2);
2890 for(std::size_t j=0;j<sz2;j++)
2892 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2895 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2897 PyTuple_SetItem(ret0Py,0,ret1Py);
2898 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2899 PyList_SetItem(retPy,i,ret0Py);
2906 class MEDFileIntFieldMultiTS;
2908 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2911 static MEDFileFieldMultiTS *New();
2912 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2913 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2914 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2916 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2917 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2918 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2919 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2920 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2921 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2923 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2924 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2925 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2928 MEDFileFieldMultiTS()
2930 return MEDFileFieldMultiTS::New();
2933 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2935 return MEDFileFieldMultiTS::New(fileName,loadAll);
2938 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2940 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2943 MEDFileFieldMultiTS(DataArrayByte *db)
2945 return MEDFileFieldMultiTS::New(db);
2948 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2950 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2951 std::size_t sz(tmp.size());
2952 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2953 for(std::size_t i=0;i<sz;i++)
2955 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2956 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2958 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2961 std::string __str__() const
2963 return self->simpleRepr();
2966 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2968 DataArrayIdType *ret1=0;
2969 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2970 PyObject *ret=PyTuple_New(2);
2971 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2972 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2976 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2978 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2979 std::vector< std::vector<TypeOfField> > typesF;
2980 std::vector< std::vector<std::string> > pfls;
2981 std::vector< std::vector<std::string> > locs;
2982 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2983 std::size_t sz=ret.size();
2984 PyObject *ret2=PyList_New(sz);
2985 for(std::size_t i=0;i<sz;i++)
2987 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2988 const std::vector<TypeOfField>& typesFI=typesF[i];
2989 const std::vector<std::string>& pflsI=pfls[i];
2990 const std::vector<std::string>& locsI=locs[i];
2991 PyObject *elt=PyTuple_New(2);
2992 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2993 std::size_t sz2=ret[i].size();
2994 PyObject *elt2=PyList_New(sz2);
2995 for(std::size_t j=0;j<sz2;j++)
2997 PyObject *elt3=PyTuple_New(4);
2998 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2999 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3000 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3001 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3002 PyList_SetItem(elt2,j,elt3);
3004 PyTuple_SetItem(elt,1,elt2);
3005 PyList_SetItem(ret2,i,elt);
3009 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3011 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3017 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3019 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3020 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3023 PyObject *ret=PyTuple_New(2);
3024 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3025 std::size_t sz=elt1Cpp.size();
3026 PyObject *elt=PyList_New(sz);
3027 for(std::size_t i=0;i<sz;i++)
3029 PyObject *elt1=PyTuple_New(2);
3030 PyObject *elt2=PyTuple_New(2);
3031 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3032 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3033 PyObject *elt3=PyTuple_New(2);
3034 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3035 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3036 PyTuple_SetItem(elt1,0,elt2);
3037 PyTuple_SetItem(elt1,1,elt3);
3038 PyList_SetItem(elt,i,elt1);
3040 PyTuple_SetItem(ret,1,elt);
3046 class MEDFileFieldsIterator
3053 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3055 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3058 PyErr_SetString(PyExc_StopIteration,"No more data.");
3065 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3068 static MEDFileIntFieldMultiTS *New();
3069 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3070 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3071 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3073 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3074 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3075 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3076 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3077 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3078 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3079 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3080 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3081 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3084 MEDFileIntFieldMultiTS()
3086 return MEDFileIntFieldMultiTS::New();
3089 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3091 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3094 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3096 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3099 MEDFileIntFieldMultiTS(DataArrayByte *db)
3101 return MEDFileIntFieldMultiTS::New(db);
3104 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3106 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3107 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3108 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3111 std::string __str__() const
3113 return self->simpleRepr();
3116 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3118 DataArrayIdType *ret1=0;
3119 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3120 PyObject *ret=PyTuple_New(2);
3121 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
3122 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3126 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3128 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3136 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3139 static MEDFileFloatFieldMultiTS *New();
3140 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3141 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3142 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3144 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3145 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3146 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3147 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3148 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3149 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3150 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3151 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3152 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3155 MEDFileFloatFieldMultiTS()
3157 return MEDFileFloatFieldMultiTS::New();
3160 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3162 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3165 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3167 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3170 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3172 return MEDFileFloatFieldMultiTS::New(db);
3175 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3177 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3178 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3179 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3182 std::string __str__() const
3184 return self->simpleRepr();
3187 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3189 DataArrayIdType *ret1=0;
3190 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3191 PyObject *ret=PyTuple_New(2);
3192 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3193 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3197 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3199 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3207 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3210 static MEDFileMeshSupports *New(const std::string& fileName);
3211 std::vector<std::string> getSupMeshNames() const;
3214 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3216 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3217 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3225 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3228 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3230 MEDFileStructureElements();
3233 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3236 static MEDFileFields *New();
3237 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3238 static MEDFileFields *New(DataArrayByte *db);
3239 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3240 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3241 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3242 MEDFileFields *deepCopy() const;
3243 MEDFileFields *shallowCpy() const;
3245 void loadArraysIfNecessary();
3246 void unloadArrays();
3247 void unloadArraysWithoutDataLoss();
3248 int getNumberOfFields() const;
3249 std::vector<std::string> getFieldsNames() const;
3250 std::vector<std::string> getMeshesNames() const;
3252 void resize(int newSize);
3253 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3254 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3255 int getPosFromFieldName(const std::string& fieldName) const;
3256 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3257 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3258 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3259 bool presenceOfStructureElements() const;
3260 void aggregate(const MEDFileFields& other);
3261 void killStructureElements();
3262 void keepOnlyStructureElements();
3263 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3264 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3265 void destroyFieldAtPos(int i);
3266 bool removeFieldsWithoutAnyTimeStep();
3271 return MEDFileFields::New();
3274 MEDFileFields(const std::string& fileName, bool loadAll=true)
3276 return MEDFileFields::New(fileName,loadAll);
3279 MEDFileFields(DataArrayByte *db)
3281 return MEDFileFields::New(db);
3284 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3286 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3289 std::string __str__() const
3291 return self->simpleRepr();
3294 MEDFileFields *partOfThisOnStructureElements() const
3296 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3300 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3302 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3306 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3308 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3309 std::size_t sz(tmp.size());
3310 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3311 for(std::size_t i=0;i<sz;i++)
3313 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3314 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3316 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3319 PyObject *getMeshSENames() const
3321 std::vector< std::pair<std::string,std::string> > ps;
3322 self->getMeshSENames(ps);
3323 return convertVectPairStToPy(ps);
3326 PyObject *getCommonIterations() const
3329 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3330 PyObject *ret=PyTuple_New(2);
3331 PyObject *ret_0=PyList_New(ret0.size());
3333 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3335 PyObject *elt=PyTuple_New(2);
3336 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3337 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3338 PyList_SetItem(ret_0,rk,elt);
3340 PyTuple_SetItem(ret,0,ret_0);
3341 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3342 PyTuple_SetItem(ret,1,ret_1);
3346 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3348 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3349 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3352 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3354 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3355 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3358 PyObject *__getitem__(PyObject *obj)
3360 if(obj && PyList_Check(obj))
3362 std::size_t sz=PyList_Size(obj);
3363 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3364 int *pt=da->getPointer();
3365 for(std::size_t i=0;i<sz;i++,pt++)
3367 PyObject *elt1=PyList_GetItem(obj,i);
3368 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3370 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3373 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3376 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3378 self->setFieldAtPos(obj,field);
3384 return self->getNumberOfFields();
3387 MEDFileFieldsIterator *__iter__()
3389 return self->iterator();
3392 bool changeMeshNames(PyObject *li)
3394 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3395 return self->changeMeshNames(modifTab);
3398 int getPosOfField(PyObject *elt0) const
3400 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3402 throw INTERP_KERNEL::Exception(msg);
3403 if(PyInt_Check(elt0))
3405 return (int)PyInt_AS_LONG(elt0);
3407 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3410 std::vector<int> getPosOfFields(PyObject *elts) const
3412 if(PyList_Check(elts))
3414 std::size_t sz=PyList_Size(elts);
3415 std::vector<int> ret(sz);
3416 for(std::size_t i=0;i<sz;i++)
3418 PyObject *elt=PyList_GetItem(elts,i);
3419 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3425 std::vector<int> ret(1);
3426 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3431 void pushFields(PyObject *fields)
3433 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3434 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3435 self->pushFields(tmp);
3438 void __delitem__(PyObject *elts)
3440 if(elts && PySlice_Check(elts))
3442 Py_ssize_t strt=2,stp=2,step=2;
3443 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3444 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3448 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3449 if(!idsToRemove.empty())
3450 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3454 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3456 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3457 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3458 return self->extractPart(extractDefCpp,mm);
3461 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3463 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3469 class MEDFileParameter1TS : public RefCountObject
3472 void setIteration(int it);
3473 int getIteration() const;
3474 void setOrder(int order);
3475 int getOrder() const;
3476 void setTimeValue(double time);
3477 void setTime(int dt, int it, double time);
3478 double getTime(int& dt, int& it);
3479 double getTimeValue() const;
3482 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3485 void setValue(double val);
3486 double getValue() const;
3487 std::string simpleRepr() const;
3490 std::string __str__() const
3492 return self->simpleRepr();
3497 class MEDFileParameterTinyInfo : public MEDFileWritable
3500 void setDescription(const std::string& name);
3501 std::string getDescription() const;
3502 void setTimeUnit(const std::string& unit);
3503 std::string getTimeUnit() const;
3506 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3509 static MEDFileParameterDouble1TS *New();
3510 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3511 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3512 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3513 virtual MEDFileParameter1TS *deepCopy() const;
3514 virtual std::string simpleRepr() const;
3515 void setName(const std::string& name);
3516 std::string getName() const;
3517 void write(const std::string& fileName, int mode) const;
3520 MEDFileParameterDouble1TS()
3522 return MEDFileParameterDouble1TS::New();
3525 MEDFileParameterDouble1TS(const std::string& fileName)
3527 return MEDFileParameterDouble1TS::New(fileName);
3530 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3532 return MEDFileParameterDouble1TS::New(fileName,paramName);
3535 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3537 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3540 std::string __str__() const
3542 return self->simpleRepr();
3545 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3548 bool ret0=self->isEqual(other,eps,what);
3549 PyObject *res=PyList_New(2);
3550 PyObject *ret0Py=ret0?Py_True:Py_False;
3552 PyList_SetItem(res,0,ret0Py);
3553 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3559 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3562 static MEDFileParameterMultiTS *New();
3563 static MEDFileParameterMultiTS *New(const std::string& fileName);
3564 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3565 std::string getName() const;
3566 void setName(const std::string& name);
3567 MEDFileParameterMultiTS *deepCopy() const;
3568 void write(const std::string& fileName, int mode) const;
3569 std::string simpleRepr() const;
3570 void appendValue(int dt, int it, double time, double val);
3571 double getDoubleValue(int iteration, int order) const;
3572 int getPosOfTimeStep(int iteration, int order) const;
3573 int getPosGivenTime(double time, double eps=1e-8) const;
3574 int getNumberOfTS() const;
3577 MEDFileParameterMultiTS()
3579 return MEDFileParameterMultiTS::New();
3582 MEDFileParameterMultiTS(const std::string& fileName)
3584 return MEDFileParameterMultiTS::New(fileName);
3587 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3589 return MEDFileParameterMultiTS::New(fileName,paramName);
3592 std::string __str__() const
3594 return self->simpleRepr();
3597 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3600 bool ret0=self->isEqual(other,eps,what);
3601 PyObject *res=PyList_New(2);
3602 PyObject *ret0Py=ret0?Py_True:Py_False;
3604 PyList_SetItem(res,0,ret0Py);
3605 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3609 void eraseTimeStepIds(PyObject *ids)
3613 std::vector<int> pos2;
3614 DataArrayInt *pos3=0;
3615 DataArrayIntTuple *pos4=0;
3616 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3621 self->eraseTimeStepIds(&pos1,&pos1+1);
3628 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3633 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3637 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3641 int getTimeStepId(PyObject *elt0) const
3643 if(elt0 && PyInt_Check(elt0))
3645 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3648 else if(elt0 && PyTuple_Check(elt0))
3650 if(PyTuple_Size(elt0)==2)
3652 PyObject *o0=PyTuple_GetItem(elt0,0);
3653 PyObject *o1=PyTuple_GetItem(elt0,1);
3654 if(PyInt_Check(o0) && PyInt_Check(o1))
3656 int iter=(int)PyInt_AS_LONG(o0);
3657 int order=(int)PyInt_AS_LONG(o1);
3658 return self->getPosOfTimeStep(iter,order);
3661 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 !");
3664 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 !");
3666 else if(elt0 && PyFloat_Check(elt0))
3668 double val=PyFloat_AS_DOUBLE(elt0);
3669 return self->getPosGivenTime(val);
3672 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3675 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3677 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3683 std::vector<int> getTimeStepIds(PyObject *elts) const
3685 if(PyList_Check(elts))
3687 std::size_t sz=PyList_Size(elts);
3688 std::vector<int> ret(sz);
3689 for(std::size_t i=0;i<sz;i++)
3691 PyObject *elt=PyList_GetItem(elts,i);
3692 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3698 std::vector<int> ret(1);
3699 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3704 void __delitem__(PyObject *elts)
3706 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3707 if(!idsToRemove.empty())
3708 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3711 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3713 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3719 PyObject *getIterations() const
3721 std::vector< std::pair<int,int> > res=self->getIterations();
3722 PyObject *ret=PyList_New(res.size());
3724 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3726 PyObject *elt=PyTuple_New(2);
3727 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3728 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3729 PyList_SetItem(ret,rk,elt);
3734 PyObject *getTimeSteps() const
3736 std::vector<double> res2;
3737 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3738 PyObject *ret=PyList_New(res.size());
3740 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3742 PyObject *elt=PyTuple_New(3);
3743 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3744 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3745 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3746 PyList_SetItem(ret,rk,elt);
3753 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3756 static MEDFileParameters *New();
3757 static MEDFileParameters *New(const std::string& fileName);
3758 static MEDFileParameters *New(DataArrayByte *db);
3759 MEDFileParameters *deepCopy() const;
3760 std::vector<std::string> getParamsNames() const;
3761 std::string simpleRepr() const;
3762 void resize(int newSize);
3763 void pushParam(MEDFileParameterMultiTS *param);
3764 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3765 void destroyParamAtPos(int i);
3766 int getPosFromParamName(const std::string& paramName) const;
3767 int getNumberOfParams() const;
3772 return MEDFileParameters::New();
3775 MEDFileParameters(const std::string& fileName)
3777 return MEDFileParameters::New(fileName);
3780 MEDFileParameters(DataArrayByte *db)
3782 return MEDFileParameters::New(db);
3785 std::string __str__() const
3787 return self->simpleRepr();
3790 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3792 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3793 if(PyInt_Check(obj))
3795 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3800 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3808 return self->getNumberOfParams();
3811 MEDFileParameterMultiTS *getParamAtPos(int i) const
3813 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3819 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3821 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3827 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3830 bool ret0=self->isEqual(other,eps,what);
3831 PyObject *res=PyList_New(2);
3832 PyObject *ret0Py=ret0?Py_True:Py_False;
3834 PyList_SetItem(res,0,ret0Py);
3835 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3841 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3844 static MEDFileData *New(DataArrayByte *db);
3845 static MEDFileData *New(const std::string& fileName);
3846 static MEDFileData *New();
3847 MEDFileData *deepCopy() const;
3848 void setFields(MEDFileFields *fields);
3849 void setMeshes(MEDFileMeshes *meshes);
3850 void setParams(MEDFileParameters *params);
3851 int getNumberOfFields() const;
3852 int getNumberOfMeshes() const;
3853 int getNumberOfParams() const;
3855 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3856 bool unPolyzeMeshes();
3857 void dealWithStructureElements();
3858 std::string getHeader() const;
3859 void setHeader(const std::string& header);
3863 MEDFileData(const std::string& fileName)
3865 return MEDFileData::New(fileName);
3868 MEDFileData(DataArrayByte *db)
3870 return MEDFileData::New(db);
3875 return MEDFileData::New();
3878 std::string __str__() const
3880 return self->simpleRepr();
3883 MEDFileMeshes *getMeshes() const
3885 MEDFileMeshes *ret=self->getMeshes();
3891 MEDFileParameters *getParams() const
3893 MEDFileParameters *ret=self->getParams();
3899 MEDFileFields *getFields() const
3901 MEDFileFields *ret=self->getFields();
3907 bool changeMeshNames(PyObject *li)
3909 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3910 return self->changeMeshNames(modifTab);
3913 static MEDFileData *Aggregate(PyObject *mfds)
3915 std::vector<const MEDFileData *> mfdsCpp;
3916 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3917 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3923 class SauvReader : public RefCountObject
3926 static SauvReader* New(const std::string& fileName);
3927 MEDFileData * loadInMEDFileDS();
3930 SauvReader(const std::string& fileName)
3932 return SauvReader::New(fileName);
3937 class SauvWriter : public RefCountObject
3940 static SauvWriter * New();
3941 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3942 void write(const std::string& fileName);
3943 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3944 bool getCpyGrpIfOnASingleFamilyStatus() const;
3949 return SauvWriter::New();
3956 class MEDFileMeshStruct;
3958 class MEDFileField1TSStructItem
3961 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3964 class MEDFileMeshStruct : public RefCountObject
3967 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3969 ~MEDFileMeshStruct();
3972 class MEDMeshMultiLev : public RefCountObject
3975 virtual MEDMeshMultiLev *prepare() const;
3976 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3977 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
3983 PyObject *retrieveFamilyIdsOnCells() const
3985 DataArrayIdType *famIds(0);
3986 bool isWithoutCopy(false);
3987 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3988 PyObject *ret=PyTuple_New(2);
3989 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3991 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3992 PyTuple_SetItem(ret,1,ret1Py);
3996 PyObject *retrieveNumberIdsOnCells() const
3998 DataArrayIdType *numIds(0);
3999 bool isWithoutCopy(false);
4000 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4001 PyObject *ret=PyTuple_New(2);
4002 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4004 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4005 PyTuple_SetItem(ret,1,ret1Py);
4009 PyObject *retrieveFamilyIdsOnNodes() const
4011 DataArrayIdType *famIds(0);
4012 bool isWithoutCopy(false);
4013 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4014 PyObject *ret=PyTuple_New(2);
4015 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4017 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4018 PyTuple_SetItem(ret,1,ret1Py);
4022 PyObject *retrieveNumberIdsOnNodes() const
4024 DataArrayIdType *numIds(0);
4025 bool isWithoutCopy(false);
4026 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4027 PyObject *ret=PyTuple_New(2);
4028 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4030 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4031 PyTuple_SetItem(ret,1,ret1Py);
4035 PyObject *getGeoTypes() const
4037 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4038 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4039 PyObject *res(PyList_New(result.size()));
4040 for(int i=0;iL!=result.end(); i++, iL++)
4041 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4047 class MEDUMeshMultiLev : public MEDMeshMultiLev
4050 ~MEDUMeshMultiLev();
4054 PyObject *buildVTUArrays() const
4056 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4057 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4058 PyObject *ret0Py=ncc?Py_True:Py_False;
4060 PyObject *ret=PyTuple_New(7);
4061 PyTuple_SetItem(ret,0,ret0Py);
4062 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4063 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4064 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4065 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4066 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4067 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4073 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4076 ~MEDStructuredMeshMultiLev();
4079 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4082 ~MEDCMeshMultiLev();
4086 PyObject *buildVTUArrays() const
4089 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4090 std::size_t sz(objs.size());
4091 PyObject *ret(PyTuple_New(2));
4092 PyObject *ret0=PyList_New(sz);
4093 for(std::size_t i=0;i<sz;i++)
4094 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4095 PyTuple_SetItem(ret,0,ret0);
4096 PyObject *ret1Py(isInternal?Py_True:Py_False);
4098 PyTuple_SetItem(ret,1,ret1Py);
4104 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4107 ~MEDCurveLinearMeshMultiLev();
4111 PyObject *buildVTUArrays() const
4113 DataArrayDouble *ret0(0);
4114 std::vector<mcIdType> ret1;
4116 self->buildVTUArrays(ret0,ret1,ret2);
4117 std::size_t sz(ret1.size());
4118 PyObject *ret=PyTuple_New(3);
4119 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4120 PyObject *ret1Py=PyList_New(sz);
4121 for(std::size_t i=0;i<sz;i++)
4122 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4123 PyTuple_SetItem(ret,1,ret1Py);
4124 PyObject *ret2Py(ret2?Py_True:Py_False);
4126 PyTuple_SetItem(ret,2,ret2Py);
4132 class MEDFileFastCellSupportComparator : public RefCountObject
4135 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4136 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4137 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4138 int getNumberOfTS() const;
4140 ~MEDFileFastCellSupportComparator();
4144 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4146 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4147 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4148 PyObject *res(PyList_New(result.size()));
4149 for(int i=0;iL!=result.end(); i++, iL++)
4150 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4161 def exit1TS(self, exctype, exc, tb):
4164 MEDFileAnyTypeField1TS.__enter__=enter1TS
4165 MEDFileAnyTypeField1TS.__exit__=exit1TS