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);
1206 static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(int geoType)
1208 med_geometry_type geoType2((med_geometry_type) geoType);
1209 return MEDFileMesh::ConvertFromMEDFileGeoType(geoType2);
1215 double tmp0=self->getTime(tmp1,tmp2);
1216 PyObject *res = PyList_New(3);
1217 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1218 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1219 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1223 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1226 bool ret0=self->isEqual(other,eps,what);
1227 PyObject *res=PyList_New(2);
1228 PyObject *ret0Py=ret0?Py_True:Py_False;
1230 PyList_SetItem(res,0,ret0Py);
1231 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1235 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1237 std::vector<const DataArrayIdType *> grps;
1238 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1239 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1242 PyObject *areFamsEqual(const MEDFileMesh *other) const
1245 bool ret0=self->areFamsEqual(other,what);
1246 PyObject *res=PyList_New(2);
1247 PyObject *ret0Py=ret0?Py_True:Py_False;
1249 PyList_SetItem(res,0,ret0Py);
1250 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1254 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1257 bool ret0=self->areGrpsEqual(other,what);
1258 PyObject *res=PyList_New(2);
1259 PyObject *ret0Py=ret0?Py_True:Py_False;
1261 PyList_SetItem(res,0,ret0Py);
1262 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1266 PyObject *getAllGeoTypes() const
1268 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1269 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1270 PyObject *res=PyList_New(result.size());
1271 for(int i=0;iL!=result.end(); i++, iL++)
1272 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1276 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1278 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1279 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1280 PyObject *res=PyList_New(result.size());
1281 for(int i=0;iL!=result.end(); i++, iL++)
1282 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1286 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1288 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1291 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1294 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1296 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1299 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1302 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1304 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1307 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1310 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1312 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1315 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1318 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1320 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1323 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1326 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1329 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1330 PyObject *ret=PyTuple_New(2);
1331 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1332 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1336 PyObject *unPolyze()
1338 DataArrayIdType *ret3=0;
1339 std::vector<mcIdType> ret1,ret2;
1340 bool ret0=self->unPolyze(ret1,ret2,ret3);
1341 PyObject *ret=PyTuple_New(4);
1342 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1344 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1345 for(int j=0;j<(int)ret1.size()/3;j++)
1347 PyObject *retLev2=PyList_New(3);
1348 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1349 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1350 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1351 PyList_SetItem(retLev1_0,j,retLev2);
1353 PyTuple_SetItem(ret,1,retLev1_0);
1355 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1356 for(int j=0;j<(int)ret2.size()/3;j++)
1358 PyObject *retLev2=PyList_New(3);
1359 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1360 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1361 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1362 PyList_SetItem(retLev1_1,j,retLev2);
1364 PyTuple_SetItem(ret,2,retLev1_1);
1366 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1370 MEDFileEquivalences *getEquivalences()
1372 MEDFileEquivalences *ret(self->getEquivalences());
1373 if(ret) ret->incrRef();
1377 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1379 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1385 class MEDFileUMesh : public MEDFileMesh
1388 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1389 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1390 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1391 static MEDFileUMesh *New(DataArrayByte *db);
1392 static MEDFileUMesh *New();
1393 static const char *GetSpeStr4ExtMesh();
1395 int getSpaceDimension() const;
1396 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1397 void checkConsistency() const;
1398 void checkSMESHConsistency() const;
1399 void clearNodeAndCellNumbers();
1401 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1402 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1403 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1404 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1405 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1406 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1407 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1408 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1409 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1410 void forceComputationOfParts() const;
1412 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1413 void setCoords(DataArrayDouble *coords);
1414 void setCoordsForced(DataArrayDouble *coords);
1415 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1416 void removeMeshAtLevel(int meshDimRelToMax);
1417 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1418 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1419 void optimizeFamilies();
1420 DataArrayIdType *computeFetchedNodeIds() const;
1421 DataArrayIdType *zipCoords();
1422 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1423 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1424 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1425 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1426 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1427 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1430 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1432 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1435 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1437 return MEDFileUMesh::New(fileName,mrs);
1440 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1442 return MEDFileUMesh::New(mem);
1445 MEDFileUMesh(DataArrayByte *db)
1447 return MEDFileUMesh::New(db);
1452 return MEDFileUMesh::New();
1455 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)
1457 std::vector<int> typesCpp1;
1458 convertPyToNewIntArr3(types,typesCpp1);
1459 std::size_t sz(typesCpp1.size());
1460 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1461 for(std::size_t ii=0;ii<sz;ii++)
1462 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1463 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1466 static PyObject *LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector<std::string>& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId)
1468 MCAuto<DataArrayDouble> coords;
1469 MCAuto<PartDefinition> partCoords;
1470 MCAuto<DataArrayIdType> famCoords,numCoords;
1471 MCAuto<DataArrayAsciiChar> nameCoord;
1472 MEDFileUMesh::LoadPartCoords(fileName,mName,dt,it,infosOnComp,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoord);
1473 PyObject *ret(PyTuple_New(5));
1474 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1475 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1476 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1477 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1478 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1482 PyObject *__getstate__()
1484 std::vector<double> a0;
1485 std::vector<mcIdType> a1;
1486 std::vector<std::string> a2;
1487 std::vector< MCAuto<DataArrayIdType> > a3;
1488 MCAuto<DataArrayDouble> a4;
1489 self->serialize(a0,a1,a2,a3,a4);
1490 PyObject *ret(PyTuple_New(5));
1491 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1492 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1493 std::size_t sz(a2.size());
1494 PyObject *ret2(PyList_New(sz));
1495 for(std::size_t i=0;i<sz;i++)
1496 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1497 PyTuple_SetItem(ret,2,ret2);
1499 PyObject *ret3(PyList_New(sz));
1500 for(std::size_t i=0;i<sz;i++)
1502 DataArrayIdType *elt(a3[i]);
1505 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1507 PyTuple_SetItem(ret,3,ret3);
1508 DataArrayDouble *ret4(a4);
1511 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1515 void __setstate__(PyObject *inp)
1517 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1518 if(!PyTuple_Check(inp))
1519 throw INTERP_KERNEL::Exception(MSG);
1520 std::size_t sz(PyTuple_Size(inp));
1522 throw INTERP_KERNEL::Exception(MSG);
1523 std::vector<double> a0;
1524 std::vector<mcIdType> a1;
1525 std::vector<std::string> a2;
1526 std::vector< MCAuto<DataArrayIdType> > a3;
1527 MCAuto<DataArrayDouble> a4;
1529 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1531 fillArrayWithPyListDbl3(a0py,tmp,a0);
1532 convertPyToNewIntArr3(a1py,a1);
1533 fillStringVector(a2py,a2);
1535 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1537 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1538 if(!SWIG_IsOK(status))
1539 throw INTERP_KERNEL::Exception(MSG);
1540 a4=reinterpret_cast<DataArrayDouble *>(argp);
1541 if((DataArrayDouble *)a4)
1544 std::vector< DataArrayIdType * > a3Tmp;
1545 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1546 std::size_t sz(a3Tmp.size());
1548 for(std::size_t i=0;i<sz;i++)
1552 a3Tmp[i]->incrRef();
1554 self->unserialize(a0,a1,a2,a3,a4);
1558 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1561 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1562 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1565 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1568 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1571 self->setMeshAtLevel(meshDimRelToMax,m1);
1574 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1577 void __delitem__(int meshDimRelToMax)
1579 self->removeMeshAtLevel(meshDimRelToMax);
1582 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1584 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1586 DataArrayDouble *a,*a2;
1587 DataArrayDoubleTuple *aa,*aa2;
1588 std::vector<double> bb,bb2;
1590 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1591 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1592 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1596 static MEDFileUMesh *Aggregate(PyObject *meshes)
1598 std::vector<const MEDFileUMesh *> meshesCpp;
1599 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1600 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1604 PyObject *getAllDistributionOfTypes() const
1606 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1607 return convertVecPairIntToPy(ret);
1610 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1612 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1613 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1614 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1617 MEDFileUMesh *extractPart(PyObject *extractDef) const
1619 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1620 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1621 return self->extractPart(extractDefCpp);
1624 void setMeshes(PyObject *li, bool renum=false)
1626 std::vector<const MEDCouplingUMesh *> ms;
1627 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1628 self->setMeshes(ms,renum);
1631 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1633 std::vector<const MEDCouplingUMesh *> ms;
1634 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1635 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1638 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1640 std::vector<const MEDCouplingUMesh *> ms;
1641 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1642 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1645 DataArrayDouble *getCoords() const
1647 DataArrayDouble *ret=self->getCoords();
1653 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1655 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1658 return const_cast<PartDefinition *>(ret);
1661 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1663 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1664 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1665 PyObject *ret=PyTuple_New(3);
1666 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1667 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1668 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1672 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1674 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1680 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1682 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1683 std::size_t sz(tmp.size());
1684 PyObject *ret=PyList_New(sz);
1685 for(std::size_t i=0;i<sz;i++)
1689 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1696 class MEDFileStructuredMesh : public MEDFileMesh
1701 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1703 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1711 class MEDFileCMesh : public MEDFileStructuredMesh
1714 static MEDFileCMesh *New();
1715 static MEDFileCMesh *New(DataArrayByte *db);
1716 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1717 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1718 void setMesh(MEDCouplingCMesh *m);
1719 int getSpaceDimension() const;
1724 return MEDFileCMesh::New();
1727 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1729 return MEDFileCMesh::New(fileName,mrs);
1732 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1734 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1737 MEDFileCMesh(DataArrayByte *db)
1739 return MEDFileCMesh::New(db);
1742 PyObject *getMesh() const
1744 const MEDCouplingCMesh *tmp=self->getMesh();
1747 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1752 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1755 static MEDFileCurveLinearMesh *New();
1756 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1757 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1758 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1759 void setMesh(MEDCouplingCurveLinearMesh *m);
1762 MEDFileCurveLinearMesh()
1764 return MEDFileCurveLinearMesh::New();
1767 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1769 return MEDFileCurveLinearMesh::New(fileName,mrs);
1772 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1774 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1777 MEDFileCurveLinearMesh(DataArrayByte *db)
1779 return MEDFileCurveLinearMesh::New(db);
1782 PyObject *getMesh() const
1784 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1787 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1792 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1795 static MEDFileMeshMultiTS *New();
1796 static MEDFileMeshMultiTS *New(const std::string& fileName);
1797 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1798 MEDFileMeshMultiTS *deepCopy() const;
1799 std::string getName() const;
1800 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1801 void cartesianizeMe();
1804 MEDFileMeshMultiTS()
1806 return MEDFileMeshMultiTS::New();
1809 MEDFileMeshMultiTS(const std::string& fileName)
1811 return MEDFileMeshMultiTS::New(fileName);
1814 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1816 return MEDFileMeshMultiTS::New(fileName,mName);
1819 MEDFileMesh *getOneTimeStep() const
1821 MEDFileMesh *ret=self->getOneTimeStep();
1829 class MEDFileMeshesIterator
1836 MEDFileMesh *ret=self->nextt();
1840 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1844 PyErr_SetString(PyExc_StopIteration,"No more data.");
1851 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1854 static MEDFileMeshes *New();
1855 static MEDFileMeshes *New(DataArrayByte *db);
1856 MEDFileMeshes *deepCopy() const;
1857 int getNumberOfMeshes() const;
1858 std::vector<std::string> getMeshesNames() const;
1860 void resize(int newSize);
1861 void pushMesh(MEDFileMesh *mesh);
1862 void setMeshAtPos(int i, MEDFileMesh *mesh);
1863 void destroyMeshAtPos(int i);
1864 void cartesianizeMe();
1865 bool presenceOfStructureElements() const;
1866 void killStructureElements();
1871 return MEDFileMeshes::New();
1874 MEDFileMeshes(const std::string& fileName)
1876 return MEDFileMeshes::New(fileName);
1879 MEDFileMeshes(DataArrayByte *db)
1881 return MEDFileMeshes::New(db);
1884 std::string __str__() const
1886 return self->simpleRepr();
1889 MEDFileMesh *__getitem__(PyObject *obj)
1891 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1892 if(PyInt_Check(obj))
1894 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1899 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1905 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1907 self->setMeshAtPos(obj,mesh);
1911 MEDFileMeshesIterator *__iter__()
1913 return self->iterator();
1918 return self->getNumberOfMeshes();
1921 MEDFileMesh *getMeshAtPos(int i) const
1923 MEDFileMesh *ret=self->getMeshAtPos(i);
1928 MEDFileMesh *getMeshWithName(const std::string& mname) const
1930 MEDFileMesh *ret=self->getMeshWithName(mname);
1938 class MEDFileFieldLoc : public RefCountObject
1941 std::string getName() const;
1942 int getDimension() const;
1943 int getNumberOfGaussPoints() const;
1944 int getNumberOfPointsInCells() const;
1945 const std::vector<double>& getRefCoords() const;
1946 const std::vector<double>& getGaussCoords() const;
1947 const std::vector<double>& getGaussWeights() const;
1948 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1951 std::string __str__() const
1953 return self->repr();
1958 class MEDFileFieldGlobsReal
1961 void resetContent();
1962 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1963 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1964 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1965 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1966 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1967 void checkGlobsCoherency() const;
1968 void checkGlobsPflsPartCoherency() const;
1969 void checkGlobsLocsPartCoherency() const;
1970 std::vector<std::string> getPfls() const;
1971 std::vector<std::string> getLocs() const;
1972 bool existsPfl(const std::string& pflName) const;
1973 bool existsLoc(const std::string& locName) const;
1974 std::string createNewNameOfPfl() const;
1975 std::string createNewNameOfLoc() const;
1976 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1977 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1978 virtual std::vector<std::string> getPflsReallyUsed() const;
1979 virtual std::vector<std::string> getLocsReallyUsed() const;
1980 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1981 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1982 void killProfileIds(const std::vector<int>& pflIds);
1983 void killLocalizationIds(const std::vector<int>& locIds);
1984 void changePflName(const std::string& oldName, const std::string& newName);
1985 void changeLocName(const std::string& oldName, const std::string& newName);
1986 int getNbOfGaussPtPerCell(int locId) const;
1987 int getLocalizationId(const std::string& loc) const;
1988 int getProfileId(const std::string& pfl) const;
1989 void killStructureElementsInGlobs();
1992 PyObject *getProfile(const std::string& pflName) const
1994 const DataArrayIdType *ret=self->getProfile(pflName);
1997 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2000 PyObject *getProfileFromId(int pflId) const
2002 const DataArrayIdType *ret=self->getProfileFromId(pflId);
2005 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2008 PyObject *getLocalizationFromId(int locId) const
2010 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2013 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2016 PyObject *getLocalization(const std::string& locName) const
2018 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2021 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2024 PyObject *zipPflsNames()
2026 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2027 return convertVecPairVecStToPy(ret);
2030 PyObject *zipLocsNames(double eps)
2032 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2033 return convertVecPairVecStToPy(ret);
2036 void changePflsNames(PyObject *li)
2038 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2039 self->changePflsNames(v);
2042 void changePflsRefsNamesGen(PyObject *li)
2044 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2045 self->changePflsRefsNamesGen(v);
2048 void changePflsNamesInStruct(PyObject *li)
2050 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2051 self->changePflsNamesInStruct(v);
2054 void changeLocsNames(PyObject *li)
2056 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2057 self->changeLocsNames(v);
2060 void changeLocsRefsNamesGen(PyObject *li)
2062 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2063 self->changeLocsRefsNamesGen(v);
2066 void changeLocsNamesInStruct(PyObject *li)
2068 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2069 self->changeLocsNamesInStruct(v);
2072 std::string simpleReprGlobs() const
2074 std::ostringstream oss;
2075 self->simpleReprGlobs(oss);
2081 class MEDFileEntities
2086 static MEDFileEntities *BuildFrom(PyObject *entities)
2088 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2089 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2091 std::size_t sz(inp0.size());
2093 for(std::size_t i=0;i<sz;i++)
2094 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2096 return MEDFileEntities::BuildFrom(&inp);
2103 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2106 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2107 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2108 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2109 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2111 void loadArraysIfNecessary();
2112 void unloadArrays();
2113 void unloadArraysWithoutDataLoss();
2114 int getDimension() const;
2115 int getIteration() const;
2116 int getOrder() const;
2117 std::string getName();
2118 void setName(const std::string& name);
2119 std::string getMeshName();
2120 void setMeshName(const std::string& newMeshName);
2121 int getMeshIteration() const;
2122 int getMeshOrder() const;
2123 int getNumberOfComponents() const;
2124 bool isDealingTS(int iteration, int order) const;
2125 void setInfo(const std::vector<std::string>& infos);
2126 const std::vector<std::string>& getInfo() const;
2127 bool presenceOfMultiDiscPerGeoType() const;
2128 void setTime(int iteration, int order, double val);
2129 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2130 MEDFileAnyTypeField1TS *deepCopy() const;
2131 std::string getDtUnit() const;
2132 void setDtUnit(const std::string& dtUnit);
2138 double tmp0=self->getTime(tmp1,tmp2);
2139 PyObject *res = PyList_New(3);
2140 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2141 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2142 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2146 PyObject *getDtIt() const
2148 std::pair<int,int> res=self->getDtIt();
2149 PyObject *elt=PyTuple_New(2);
2150 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2151 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2155 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2157 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2160 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2162 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2165 bool changeMeshNames(PyObject *li)
2167 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2168 return self->changeMeshNames(modifTab);
2171 PyObject *getTypesOfFieldAvailable() const
2173 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2174 PyObject *ret2=PyList_New(ret.size());
2175 for(int i=0;i<(int)ret.size();i++)
2176 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2180 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2182 std::vector<int> ret1;
2183 int ret0=self->getNonEmptyLevels(mname,ret1);
2184 PyObject *elt=PyTuple_New(2);
2185 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2186 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2190 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2192 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2193 std::vector< std::vector<TypeOfField> > typesF;
2194 std::vector< std::vector<std::string> > pfls;
2195 std::vector< std::vector<std::string> > locs;
2196 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2197 std::size_t sz=ret.size();
2198 PyObject *ret2=PyList_New(sz);
2199 for(std::size_t i=0;i<sz;i++)
2201 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2202 const std::vector<TypeOfField>& typesFI=typesF[i];
2203 const std::vector<std::string>& pflsI=pfls[i];
2204 const std::vector<std::string>& locsI=locs[i];
2205 PyObject *elt=PyTuple_New(2);
2206 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2207 std::size_t sz2=ret[i].size();
2208 PyObject *elt2=PyList_New(sz2);
2209 for(std::size_t j=0;j<sz2;j++)
2211 PyObject *elt3=PyTuple_New(4);
2212 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2213 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2214 PyTuple_SetItem(elt3,1,elt4);
2215 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2216 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2217 PyList_SetItem(elt2,j,elt3);
2219 PyTuple_SetItem(elt,1,elt2);
2220 PyList_SetItem(ret2,i,elt);
2225 PyObject *splitComponents() const
2227 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2228 std::size_t sz=ret.size();
2229 PyObject *retPy=PyList_New(sz);
2230 for(std::size_t i=0;i<sz;i++)
2231 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2235 PyObject *splitDiscretizations() const
2237 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2238 std::size_t sz=ret.size();
2239 PyObject *retPy=PyList_New(sz);
2240 for(std::size_t i=0;i<sz;i++)
2241 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2245 PyObject *splitMultiDiscrPerGeoTypes() const
2247 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2248 std::size_t sz=ret.size();
2249 PyObject *retPy=PyList_New(sz);
2250 for(std::size_t i=0;i<sz;i++)
2251 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2255 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2257 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2258 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2259 return self->extractPart(extractDefCpp,mm);
2264 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2267 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2268 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2269 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2270 static MEDFileField1TS *New(DataArrayByte *db);
2271 static MEDFileField1TS *New();
2272 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2273 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2274 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2275 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2276 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2277 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2278 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2279 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2281 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2282 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2283 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2284 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2285 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2288 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2290 return MEDFileField1TS::New(fileName,loadAll);
2293 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2295 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2298 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2300 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2303 MEDFileField1TS(DataArrayByte *db)
2305 return MEDFileField1TS::New(db);
2310 return MEDFileField1TS::New();
2313 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2315 const DataArrayDouble *arr=0;
2317 arr=field->getArray();
2318 self->copyTinyInfoFrom(field,arr);
2321 std::string __str__() const
2323 return self->simpleRepr();
2326 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2328 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2331 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2333 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2334 std::vector< std::vector<TypeOfField> > typesF;
2335 std::vector< std::vector<std::string> > pfls;
2336 std::vector< std::vector<std::string> > locs;
2337 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2338 std::size_t sz=ret.size();
2339 PyObject *ret2=PyList_New(sz);
2340 for(std::size_t i=0;i<sz;i++)
2342 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2343 const std::vector<TypeOfField>& typesFI=typesF[i];
2344 const std::vector<std::string>& pflsI=pfls[i];
2345 const std::vector<std::string>& locsI=locs[i];
2346 PyObject *elt=PyTuple_New(2);
2347 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2348 std::size_t sz2=ret[i].size();
2349 PyObject *elt2=PyList_New(sz2);
2350 for(std::size_t j=0;j<sz2;j++)
2352 PyObject *elt3=PyTuple_New(4);
2353 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2354 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2355 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2356 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2357 PyList_SetItem(elt2,j,elt3);
2359 PyTuple_SetItem(elt,1,elt2);
2360 PyList_SetItem(ret2,i,elt);
2365 DataArrayDouble *getUndergroundDataArray() const
2367 DataArrayDouble *ret=self->getUndergroundDataArray();
2373 PyObject *getUndergroundDataArrayExt() const
2375 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2380 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2383 static MEDFileIntField1TS *New();
2384 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2385 static MEDFileIntField1TS *New(DataArrayByte *db);
2386 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2387 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2388 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2390 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2391 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2392 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2393 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2394 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2395 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2396 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2397 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2398 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2399 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2402 MEDFileIntField1TS()
2404 return MEDFileIntField1TS::New();
2407 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2409 return MEDFileIntField1TS::New(fileName,loadAll);
2412 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2414 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2417 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2419 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2422 MEDFileIntField1TS(DataArrayByte *db)
2424 return MEDFileIntField1TS::New(db);
2427 std::string __str__() const
2429 return self->simpleRepr();
2432 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2434 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2437 DataArrayInt32 *getUndergroundDataArray() const
2439 DataArrayInt32 *ret=self->getUndergroundDataArray();
2445 PyObject *getUndergroundDataArrayExt() const
2447 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2452 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2455 static MEDFileFloatField1TS *New();
2456 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2457 static MEDFileFloatField1TS *New(DataArrayByte *db);
2458 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2459 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2460 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2462 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2463 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2464 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2465 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2466 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2467 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2468 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2469 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2470 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2471 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2474 MEDFileFloatField1TS()
2476 return MEDFileFloatField1TS::New();
2479 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2481 return MEDFileFloatField1TS::New(fileName,loadAll);
2484 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2486 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2489 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2491 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2494 MEDFileFloatField1TS(DataArrayByte *db)
2496 return MEDFileFloatField1TS::New(db);
2499 std::string __str__() const
2501 return self->simpleRepr();
2504 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2506 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2509 DataArrayFloat *getUndergroundDataArray() const
2511 DataArrayFloat *ret=self->getUndergroundDataArray();
2517 PyObject *getUndergroundDataArrayExt() const
2519 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2524 class MEDFileAnyTypeFieldMultiTSIterator
2531 MEDFileAnyTypeField1TS *ret=self->nextt();
2533 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2536 PyErr_SetString(PyExc_StopIteration,"No more data.");
2543 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2546 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2547 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2548 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2549 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2550 std::string getName() const;
2551 void setName(const std::string& name);
2552 std::string getDtUnit() const;
2553 void setDtUnit(const std::string& dtUnit);
2554 std::string getMeshName() const;
2555 void setMeshName(const std::string& newMeshName);
2556 const std::vector<std::string>& getInfo() const;
2557 bool presenceOfMultiDiscPerGeoType() const;
2558 int getNumberOfComponents() const;
2559 int getNumberOfTS() const;
2560 void eraseEmptyTS();
2561 int getPosOfTimeStep(int iteration, int order) const;
2562 int getPosGivenTime(double time, double eps=1e-8) const;
2564 void loadArraysIfNecessary();
2565 void unloadArrays();
2566 void unloadArraysWithoutDataLoss();
2568 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2569 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2570 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2571 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2572 void synchronizeNameScope();
2573 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2578 return self->getNumberOfTS();
2581 int getTimeId(PyObject *elt0) const
2583 if(elt0 && PyInt_Check(elt0))
2585 int pos=(int)PyInt_AS_LONG(elt0);
2588 else if(elt0 && PyTuple_Check(elt0))
2590 if(PyTuple_Size(elt0)==2)
2592 PyObject *o0=PyTuple_GetItem(elt0,0);
2593 PyObject *o1=PyTuple_GetItem(elt0,1);
2594 if(PyInt_Check(o0) && PyInt_Check(o1))
2596 int iter=(int)PyInt_AS_LONG(o0);
2597 int order=(int)PyInt_AS_LONG(o1);
2598 return self->getPosOfTimeStep(iter,order);
2601 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 !");
2604 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 !");
2606 else if(elt0 && PyFloat_Check(elt0))
2608 double val=PyFloat_AS_DOUBLE(elt0);
2609 return self->getPosGivenTime(val);
2612 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2615 PyObject *getIterations() const
2617 std::vector< std::pair<int,int> > res(self->getIterations());
2618 return convertVecPairIntToPy(res);
2621 PyObject *getTimeSteps() const
2623 std::vector<double> ret1;
2624 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2625 std::size_t sz=ret.size();
2626 PyObject *ret2=PyList_New(sz);
2627 for(std::size_t i=0;i<sz;i++)
2629 PyObject *elt=PyTuple_New(3);
2630 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2631 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2632 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2633 PyList_SetItem(ret2,i,elt);
2638 PyObject *getTypesOfFieldAvailable() const
2640 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2641 PyObject *ret2=PyList_New(ret.size());
2642 for(int i=0;i<(int)ret.size();i++)
2644 const std::vector<TypeOfField>& rett=ret[i];
2645 PyObject *ret3=PyList_New(rett.size());
2646 for(int j=0;j<(int)rett.size();j++)
2647 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2648 PyList_SetItem(ret2,i,ret3);
2653 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2655 std::vector<int> ret1;
2656 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2657 PyObject *elt=PyTuple_New(2);
2658 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2659 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2663 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2665 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2666 std::vector< std::vector<TypeOfField> > typesF;
2667 std::vector< std::vector<std::string> > pfls;
2668 std::vector< std::vector<std::string> > locs;
2669 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2670 std::size_t sz=ret.size();
2671 PyObject *ret2=PyList_New(sz);
2672 for(std::size_t i=0;i<sz;i++)
2674 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2675 const std::vector<TypeOfField>& typesFI=typesF[i];
2676 const std::vector<std::string>& pflsI=pfls[i];
2677 const std::vector<std::string>& locsI=locs[i];
2678 PyObject *elt=PyTuple_New(2);
2679 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2680 std::size_t sz2=ret[i].size();
2681 PyObject *elt2=PyList_New(sz2);
2682 for(std::size_t j=0;j<sz2;j++)
2684 PyObject *elt3=PyTuple_New(4);
2685 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2686 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2687 PyTuple_SetItem(elt3,1,elt4);
2688 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2689 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2690 PyList_SetItem(elt2,j,elt3);
2692 PyTuple_SetItem(elt,1,elt2);
2693 PyList_SetItem(ret2,i,elt);
2698 std::vector<int> getTimeIds(PyObject *elts) const
2700 if(PyList_Check(elts))
2702 std::size_t sz=PyList_Size(elts);
2703 std::vector<int> ret(sz);
2704 for(std::size_t i=0;i<sz;i++)
2706 PyObject *elt=PyList_GetItem(elts,i);
2707 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2713 std::vector<int> ret(1);
2714 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2719 void __delitem__(PyObject *elts)
2721 if(PySlice_Check(elts))
2723 Py_ssize_t strt=2,stp=2,step=2;
2724 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2725 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2729 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2730 if(!idsToRemove.empty())
2731 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2735 void eraseTimeStepIds(PyObject *li)
2739 std::vector<int> pos2;
2740 DataArrayInt32 *pos3=0;
2741 DataArrayIntTuple *pos4=0;
2742 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2747 self->eraseTimeStepIds(&pos1,&pos1+1);
2754 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2759 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2763 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2767 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2769 return self->iterator();
2772 PyObject *__getitem__(PyObject *elt0) const
2774 if(elt0 && PyList_Check(elt0))
2776 std::size_t sz=PyList_Size(elt0);
2777 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2778 int *pt=da->getPointer();
2779 for(std::size_t i=0;i<sz;i++,pt++)
2781 PyObject *elt1=PyList_GetItem(elt0,i);
2782 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2784 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2786 else if(elt0 && PySlice_Check(elt0))
2788 Py_ssize_t strt=2,stp=2,step=2;
2789 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2790 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2793 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2796 bool changeMeshNames(PyObject *li)
2798 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2799 return self->changeMeshNames(modifTab);
2802 PyObject *splitComponents() const
2804 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2805 std::size_t sz=ret.size();
2806 PyObject *retPy=PyList_New(sz);
2807 for(std::size_t i=0;i<sz;i++)
2808 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2812 PyObject *splitDiscretizations() const
2814 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2815 std::size_t sz=ret.size();
2816 PyObject *retPy=PyList_New(sz);
2817 for(std::size_t i=0;i<sz;i++)
2818 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2822 PyObject *splitMultiDiscrPerGeoTypes() const
2824 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2825 std::size_t sz=ret.size();
2826 PyObject *retPy=PyList_New(sz);
2827 for(std::size_t i=0;i<sz;i++)
2828 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2832 void pushBackTimeSteps(PyObject *li)
2835 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2836 if(SWIG_IsOK(status))
2838 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2842 std::vector<MEDFileAnyTypeField1TS *> tmp;
2843 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2844 self->pushBackTimeSteps(tmp);
2848 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2850 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2851 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2852 return self->extractPart(extractDefCpp,mm);
2855 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2857 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2858 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2859 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2860 std::size_t sz=ret.size();
2861 PyObject *retPy=PyList_New(sz);
2862 for(std::size_t i=0;i<sz;i++)
2864 std::size_t sz2=ret[i].size();
2865 PyObject *ret1Py=PyList_New(sz2);
2866 for(std::size_t j=0;j<sz2;j++)
2868 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2871 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2873 PyList_SetItem(retPy,i,ret1Py);
2878 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2880 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2881 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2882 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2883 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2884 if(ret2.size()!=ret.size())
2886 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2887 throw INTERP_KERNEL::Exception(oss.str().c_str());
2889 std::size_t sz=ret.size();
2890 PyObject *retPy=PyList_New(sz);
2891 for(std::size_t i=0;i<sz;i++)
2893 std::size_t sz2=ret[i].size();
2894 PyObject *ret0Py=PyTuple_New(2);
2895 PyObject *ret1Py=PyList_New(sz2);
2896 for(std::size_t j=0;j<sz2;j++)
2898 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2901 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2903 PyTuple_SetItem(ret0Py,0,ret1Py);
2904 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2905 PyList_SetItem(retPy,i,ret0Py);
2912 class MEDFileIntFieldMultiTS;
2914 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2917 static MEDFileFieldMultiTS *New();
2918 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2919 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2920 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2922 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2923 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2924 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2925 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2926 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2927 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2929 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2930 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2931 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2934 MEDFileFieldMultiTS()
2936 return MEDFileFieldMultiTS::New();
2939 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2941 return MEDFileFieldMultiTS::New(fileName,loadAll);
2944 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2946 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2949 MEDFileFieldMultiTS(DataArrayByte *db)
2951 return MEDFileFieldMultiTS::New(db);
2954 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2956 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2957 std::size_t sz(tmp.size());
2958 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2959 for(std::size_t i=0;i<sz;i++)
2961 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2962 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2964 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2967 std::string __str__() const
2969 return self->simpleRepr();
2972 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2974 DataArrayIdType *ret1=0;
2975 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2976 PyObject *ret=PyTuple_New(2);
2977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2982 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2984 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2985 std::vector< std::vector<TypeOfField> > typesF;
2986 std::vector< std::vector<std::string> > pfls;
2987 std::vector< std::vector<std::string> > locs;
2988 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2989 std::size_t sz=ret.size();
2990 PyObject *ret2=PyList_New(sz);
2991 for(std::size_t i=0;i<sz;i++)
2993 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2994 const std::vector<TypeOfField>& typesFI=typesF[i];
2995 const std::vector<std::string>& pflsI=pfls[i];
2996 const std::vector<std::string>& locsI=locs[i];
2997 PyObject *elt=PyTuple_New(2);
2998 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2999 std::size_t sz2=ret[i].size();
3000 PyObject *elt2=PyList_New(sz2);
3001 for(std::size_t j=0;j<sz2;j++)
3003 PyObject *elt3=PyTuple_New(4);
3004 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
3005 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3006 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3007 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3008 PyList_SetItem(elt2,j,elt3);
3010 PyTuple_SetItem(elt,1,elt2);
3011 PyList_SetItem(ret2,i,elt);
3015 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3017 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3023 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3025 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3026 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3029 PyObject *ret=PyTuple_New(2);
3030 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3031 std::size_t sz=elt1Cpp.size();
3032 PyObject *elt=PyList_New(sz);
3033 for(std::size_t i=0;i<sz;i++)
3035 PyObject *elt1=PyTuple_New(2);
3036 PyObject *elt2=PyTuple_New(2);
3037 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3038 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3039 PyObject *elt3=PyTuple_New(2);
3040 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3041 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3042 PyTuple_SetItem(elt1,0,elt2);
3043 PyTuple_SetItem(elt1,1,elt3);
3044 PyList_SetItem(elt,i,elt1);
3046 PyTuple_SetItem(ret,1,elt);
3052 class MEDFileFieldsIterator
3059 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3061 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3064 PyErr_SetString(PyExc_StopIteration,"No more data.");
3071 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3074 static MEDFileIntFieldMultiTS *New();
3075 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3076 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3077 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3079 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3080 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3081 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3082 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3083 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3084 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3085 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3086 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3087 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3090 MEDFileIntFieldMultiTS()
3092 return MEDFileIntFieldMultiTS::New();
3095 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3097 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3100 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3102 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3105 MEDFileIntFieldMultiTS(DataArrayByte *db)
3107 return MEDFileIntFieldMultiTS::New(db);
3110 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3112 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3113 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3114 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3117 std::string __str__() const
3119 return self->simpleRepr();
3122 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3124 DataArrayIdType *ret1=0;
3125 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3126 PyObject *ret=PyTuple_New(2);
3127 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
3128 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3132 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3134 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3142 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3145 static MEDFileFloatFieldMultiTS *New();
3146 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3147 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3148 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3150 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3151 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3152 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3153 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3154 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3155 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3156 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3157 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3158 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3161 MEDFileFloatFieldMultiTS()
3163 return MEDFileFloatFieldMultiTS::New();
3166 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3168 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3171 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3173 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3176 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3178 return MEDFileFloatFieldMultiTS::New(db);
3181 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3183 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3184 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3185 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3188 std::string __str__() const
3190 return self->simpleRepr();
3193 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3195 DataArrayIdType *ret1=0;
3196 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3197 PyObject *ret=PyTuple_New(2);
3198 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3199 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3203 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3205 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3213 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3216 static MEDFileMeshSupports *New(const std::string& fileName);
3217 std::vector<std::string> getSupMeshNames() const;
3220 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3222 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3223 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3231 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3234 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3236 MEDFileStructureElements();
3239 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3242 static MEDFileFields *New();
3243 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3244 static MEDFileFields *New(DataArrayByte *db);
3245 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3246 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3247 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3248 MEDFileFields *deepCopy() const;
3249 MEDFileFields *shallowCpy() const;
3251 void loadArraysIfNecessary();
3252 void unloadArrays();
3253 void unloadArraysWithoutDataLoss();
3254 int getNumberOfFields() const;
3255 std::vector<std::string> getFieldsNames() const;
3256 std::vector<std::string> getMeshesNames() const;
3258 void resize(int newSize);
3259 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3260 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3261 int getPosFromFieldName(const std::string& fieldName) const;
3262 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3263 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3264 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3265 bool presenceOfStructureElements() const;
3266 void aggregate(const MEDFileFields& other);
3267 void killStructureElements();
3268 void keepOnlyStructureElements();
3269 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3270 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3271 void destroyFieldAtPos(int i);
3272 bool removeFieldsWithoutAnyTimeStep();
3277 return MEDFileFields::New();
3280 MEDFileFields(const std::string& fileName, bool loadAll=true)
3282 return MEDFileFields::New(fileName,loadAll);
3285 MEDFileFields(DataArrayByte *db)
3287 return MEDFileFields::New(db);
3290 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3292 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3295 std::string __str__() const
3297 return self->simpleRepr();
3300 MEDFileFields *partOfThisOnStructureElements() const
3302 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3306 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3308 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3312 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3314 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3315 std::size_t sz(tmp.size());
3316 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3317 for(std::size_t i=0;i<sz;i++)
3319 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3320 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3322 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3325 PyObject *getMeshSENames() const
3327 std::vector< std::pair<std::string,std::string> > ps;
3328 self->getMeshSENames(ps);
3329 return convertVectPairStToPy(ps);
3332 PyObject *getCommonIterations() const
3335 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3336 PyObject *ret=PyTuple_New(2);
3337 PyObject *ret_0=PyList_New(ret0.size());
3339 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3341 PyObject *elt=PyTuple_New(2);
3342 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3343 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3344 PyList_SetItem(ret_0,rk,elt);
3346 PyTuple_SetItem(ret,0,ret_0);
3347 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3348 PyTuple_SetItem(ret,1,ret_1);
3352 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3354 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3355 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3358 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3360 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3361 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3364 PyObject *__getitem__(PyObject *obj)
3366 if(obj && PyList_Check(obj))
3368 std::size_t sz=PyList_Size(obj);
3369 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3370 int *pt=da->getPointer();
3371 for(std::size_t i=0;i<sz;i++,pt++)
3373 PyObject *elt1=PyList_GetItem(obj,i);
3374 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3376 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3379 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3382 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3384 self->setFieldAtPos(obj,field);
3390 return self->getNumberOfFields();
3393 MEDFileFieldsIterator *__iter__()
3395 return self->iterator();
3398 bool changeMeshNames(PyObject *li)
3400 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3401 return self->changeMeshNames(modifTab);
3404 int getPosOfField(PyObject *elt0) const
3406 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3408 throw INTERP_KERNEL::Exception(msg);
3409 if(PyInt_Check(elt0))
3411 return (int)PyInt_AS_LONG(elt0);
3413 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3416 std::vector<int> getPosOfFields(PyObject *elts) const
3418 if(PyList_Check(elts))
3420 std::size_t sz=PyList_Size(elts);
3421 std::vector<int> ret(sz);
3422 for(std::size_t i=0;i<sz;i++)
3424 PyObject *elt=PyList_GetItem(elts,i);
3425 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3431 std::vector<int> ret(1);
3432 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3437 void pushFields(PyObject *fields)
3439 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3440 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3441 self->pushFields(tmp);
3444 void __delitem__(PyObject *elts)
3446 if(elts && PySlice_Check(elts))
3448 Py_ssize_t strt=2,stp=2,step=2;
3449 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3450 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3454 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3455 if(!idsToRemove.empty())
3456 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3460 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3462 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3463 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3464 return self->extractPart(extractDefCpp,mm);
3467 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3469 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3475 class MEDFileParameter1TS : public RefCountObject
3478 void setIteration(int it);
3479 int getIteration() const;
3480 void setOrder(int order);
3481 int getOrder() const;
3482 void setTimeValue(double time);
3483 void setTime(int dt, int it, double time);
3484 double getTime(int& dt, int& it);
3485 double getTimeValue() const;
3488 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3491 void setValue(double val);
3492 double getValue() const;
3493 std::string simpleRepr() const;
3496 std::string __str__() const
3498 return self->simpleRepr();
3503 class MEDFileParameterTinyInfo : public MEDFileWritable
3506 void setDescription(const std::string& name);
3507 std::string getDescription() const;
3508 void setTimeUnit(const std::string& unit);
3509 std::string getTimeUnit() const;
3512 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3515 static MEDFileParameterDouble1TS *New();
3516 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3517 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3518 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3519 virtual MEDFileParameter1TS *deepCopy() const;
3520 virtual std::string simpleRepr() const;
3521 void setName(const std::string& name);
3522 std::string getName() const;
3523 void write(const std::string& fileName, int mode) const;
3526 MEDFileParameterDouble1TS()
3528 return MEDFileParameterDouble1TS::New();
3531 MEDFileParameterDouble1TS(const std::string& fileName)
3533 return MEDFileParameterDouble1TS::New(fileName);
3536 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3538 return MEDFileParameterDouble1TS::New(fileName,paramName);
3541 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3543 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3546 std::string __str__() const
3548 return self->simpleRepr();
3551 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3554 bool ret0=self->isEqual(other,eps,what);
3555 PyObject *res=PyList_New(2);
3556 PyObject *ret0Py=ret0?Py_True:Py_False;
3558 PyList_SetItem(res,0,ret0Py);
3559 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3565 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3568 static MEDFileParameterMultiTS *New();
3569 static MEDFileParameterMultiTS *New(const std::string& fileName);
3570 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3571 std::string getName() const;
3572 void setName(const std::string& name);
3573 MEDFileParameterMultiTS *deepCopy() const;
3574 void write(const std::string& fileName, int mode) const;
3575 std::string simpleRepr() const;
3576 void appendValue(int dt, int it, double time, double val);
3577 double getDoubleValue(int iteration, int order) const;
3578 int getPosOfTimeStep(int iteration, int order) const;
3579 int getPosGivenTime(double time, double eps=1e-8) const;
3580 int getNumberOfTS() const;
3583 MEDFileParameterMultiTS()
3585 return MEDFileParameterMultiTS::New();
3588 MEDFileParameterMultiTS(const std::string& fileName)
3590 return MEDFileParameterMultiTS::New(fileName);
3593 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3595 return MEDFileParameterMultiTS::New(fileName,paramName);
3598 std::string __str__() const
3600 return self->simpleRepr();
3603 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3606 bool ret0=self->isEqual(other,eps,what);
3607 PyObject *res=PyList_New(2);
3608 PyObject *ret0Py=ret0?Py_True:Py_False;
3610 PyList_SetItem(res,0,ret0Py);
3611 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3615 void eraseTimeStepIds(PyObject *ids)
3619 std::vector<int> pos2;
3620 DataArrayInt *pos3=0;
3621 DataArrayIntTuple *pos4=0;
3622 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3627 self->eraseTimeStepIds(&pos1,&pos1+1);
3634 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3639 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3643 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3647 int getTimeStepId(PyObject *elt0) const
3649 if(elt0 && PyInt_Check(elt0))
3651 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3654 else if(elt0 && PyTuple_Check(elt0))
3656 if(PyTuple_Size(elt0)==2)
3658 PyObject *o0=PyTuple_GetItem(elt0,0);
3659 PyObject *o1=PyTuple_GetItem(elt0,1);
3660 if(PyInt_Check(o0) && PyInt_Check(o1))
3662 int iter=(int)PyInt_AS_LONG(o0);
3663 int order=(int)PyInt_AS_LONG(o1);
3664 return self->getPosOfTimeStep(iter,order);
3667 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 !");
3670 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 !");
3672 else if(elt0 && PyFloat_Check(elt0))
3674 double val=PyFloat_AS_DOUBLE(elt0);
3675 return self->getPosGivenTime(val);
3678 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3681 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3683 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3689 std::vector<int> getTimeStepIds(PyObject *elts) const
3691 if(PyList_Check(elts))
3693 std::size_t sz=PyList_Size(elts);
3694 std::vector<int> ret(sz);
3695 for(std::size_t i=0;i<sz;i++)
3697 PyObject *elt=PyList_GetItem(elts,i);
3698 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3704 std::vector<int> ret(1);
3705 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3710 void __delitem__(PyObject *elts)
3712 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3713 if(!idsToRemove.empty())
3714 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3717 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3719 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3725 PyObject *getIterations() const
3727 std::vector< std::pair<int,int> > res=self->getIterations();
3728 PyObject *ret=PyList_New(res.size());
3730 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3732 PyObject *elt=PyTuple_New(2);
3733 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3734 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3735 PyList_SetItem(ret,rk,elt);
3740 PyObject *getTimeSteps() const
3742 std::vector<double> res2;
3743 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3744 PyObject *ret=PyList_New(res.size());
3746 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3748 PyObject *elt=PyTuple_New(3);
3749 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3750 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3751 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3752 PyList_SetItem(ret,rk,elt);
3759 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3762 static MEDFileParameters *New();
3763 static MEDFileParameters *New(const std::string& fileName);
3764 static MEDFileParameters *New(DataArrayByte *db);
3765 MEDFileParameters *deepCopy() const;
3766 std::vector<std::string> getParamsNames() const;
3767 std::string simpleRepr() const;
3768 void resize(int newSize);
3769 void pushParam(MEDFileParameterMultiTS *param);
3770 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3771 void destroyParamAtPos(int i);
3772 int getPosFromParamName(const std::string& paramName) const;
3773 int getNumberOfParams() const;
3778 return MEDFileParameters::New();
3781 MEDFileParameters(const std::string& fileName)
3783 return MEDFileParameters::New(fileName);
3786 MEDFileParameters(DataArrayByte *db)
3788 return MEDFileParameters::New(db);
3791 std::string __str__() const
3793 return self->simpleRepr();
3796 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3798 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3799 if(PyInt_Check(obj))
3801 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3806 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3814 return self->getNumberOfParams();
3817 MEDFileParameterMultiTS *getParamAtPos(int i) const
3819 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3825 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3827 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3833 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3836 bool ret0=self->isEqual(other,eps,what);
3837 PyObject *res=PyList_New(2);
3838 PyObject *ret0Py=ret0?Py_True:Py_False;
3840 PyList_SetItem(res,0,ret0Py);
3841 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3847 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3850 static MEDFileData *New(DataArrayByte *db);
3851 static MEDFileData *New(const std::string& fileName);
3852 static MEDFileData *New();
3853 MEDFileData *deepCopy() const;
3854 void setFields(MEDFileFields *fields);
3855 void setMeshes(MEDFileMeshes *meshes);
3856 void setParams(MEDFileParameters *params);
3857 int getNumberOfFields() const;
3858 int getNumberOfMeshes() const;
3859 int getNumberOfParams() const;
3861 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3862 bool unPolyzeMeshes();
3863 void dealWithStructureElements();
3864 std::string getHeader() const;
3865 void setHeader(const std::string& header);
3869 MEDFileData(const std::string& fileName)
3871 return MEDFileData::New(fileName);
3874 MEDFileData(DataArrayByte *db)
3876 return MEDFileData::New(db);
3881 return MEDFileData::New();
3884 std::string __str__() const
3886 return self->simpleRepr();
3889 MEDFileMeshes *getMeshes() const
3891 MEDFileMeshes *ret=self->getMeshes();
3897 MEDFileParameters *getParams() const
3899 MEDFileParameters *ret=self->getParams();
3905 MEDFileFields *getFields() const
3907 MEDFileFields *ret=self->getFields();
3913 bool changeMeshNames(PyObject *li)
3915 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3916 return self->changeMeshNames(modifTab);
3919 static MEDFileData *Aggregate(PyObject *mfds)
3921 std::vector<const MEDFileData *> mfdsCpp;
3922 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3923 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3929 class SauvReader : public RefCountObject
3932 static SauvReader* New(const std::string& fileName);
3933 MEDFileData * loadInMEDFileDS();
3936 SauvReader(const std::string& fileName)
3938 return SauvReader::New(fileName);
3943 class SauvWriter : public RefCountObject
3946 static SauvWriter * New();
3947 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3948 void write(const std::string& fileName);
3949 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3950 bool getCpyGrpIfOnASingleFamilyStatus() const;
3955 return SauvWriter::New();
3962 class MEDFileMeshStruct;
3964 class MEDFileField1TSStructItem
3967 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3970 class MEDFileMeshStruct : public RefCountObject
3973 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3975 ~MEDFileMeshStruct();
3978 class MEDMeshMultiLev : public RefCountObject
3981 virtual MEDMeshMultiLev *prepare() const;
3982 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3983 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
3989 PyObject *retrieveFamilyIdsOnCells() const
3991 DataArrayIdType *famIds(0);
3992 bool isWithoutCopy(false);
3993 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3994 PyObject *ret=PyTuple_New(2);
3995 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3997 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3998 PyTuple_SetItem(ret,1,ret1Py);
4002 PyObject *retrieveNumberIdsOnCells() const
4004 DataArrayIdType *numIds(0);
4005 bool isWithoutCopy(false);
4006 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4007 PyObject *ret=PyTuple_New(2);
4008 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4010 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4011 PyTuple_SetItem(ret,1,ret1Py);
4015 PyObject *retrieveFamilyIdsOnNodes() const
4017 DataArrayIdType *famIds(0);
4018 bool isWithoutCopy(false);
4019 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4020 PyObject *ret=PyTuple_New(2);
4021 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4023 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4024 PyTuple_SetItem(ret,1,ret1Py);
4028 PyObject *retrieveNumberIdsOnNodes() const
4030 DataArrayIdType *numIds(0);
4031 bool isWithoutCopy(false);
4032 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4033 PyObject *ret=PyTuple_New(2);
4034 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4036 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4037 PyTuple_SetItem(ret,1,ret1Py);
4041 PyObject *getGeoTypes() const
4043 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4044 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4045 PyObject *res(PyList_New(result.size()));
4046 for(int i=0;iL!=result.end(); i++, iL++)
4047 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4053 class MEDUMeshMultiLev : public MEDMeshMultiLev
4056 ~MEDUMeshMultiLev();
4060 PyObject *buildVTUArrays() const
4062 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4063 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4064 PyObject *ret0Py=ncc?Py_True:Py_False;
4066 PyObject *ret=PyTuple_New(7);
4067 PyTuple_SetItem(ret,0,ret0Py);
4068 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4069 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4070 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4071 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4072 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4073 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4079 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4082 ~MEDStructuredMeshMultiLev();
4085 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4088 ~MEDCMeshMultiLev();
4092 PyObject *buildVTUArrays() const
4095 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4096 std::size_t sz(objs.size());
4097 PyObject *ret(PyTuple_New(2));
4098 PyObject *ret0=PyList_New(sz);
4099 for(std::size_t i=0;i<sz;i++)
4100 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4101 PyTuple_SetItem(ret,0,ret0);
4102 PyObject *ret1Py(isInternal?Py_True:Py_False);
4104 PyTuple_SetItem(ret,1,ret1Py);
4110 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4113 ~MEDCurveLinearMeshMultiLev();
4117 PyObject *buildVTUArrays() const
4119 DataArrayDouble *ret0(0);
4120 std::vector<mcIdType> ret1;
4122 self->buildVTUArrays(ret0,ret1,ret2);
4123 std::size_t sz(ret1.size());
4124 PyObject *ret=PyTuple_New(3);
4125 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4126 PyObject *ret1Py=PyList_New(sz);
4127 for(std::size_t i=0;i<sz;i++)
4128 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4129 PyTuple_SetItem(ret,1,ret1Py);
4130 PyObject *ret2Py(ret2?Py_True:Py_False);
4132 PyTuple_SetItem(ret,2,ret2Py);
4138 class MEDFileFastCellSupportComparator : public RefCountObject
4141 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4142 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4143 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4144 int getNumberOfTS() const;
4146 ~MEDFileFastCellSupportComparator();
4150 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4152 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4153 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4154 PyObject *res(PyList_New(result.size()));
4155 for(int i=0;iL!=result.end(); i++, iL++)
4156 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4167 def exit1TS(self, exctype, exc, tb):
4170 MEDFileAnyTypeField1TS.__enter__=enter1TS
4171 MEDFileAnyTypeField1TS.__exit__=exit1TS