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::zipCoords;
124 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
125 %newobject MEDCoupling::MEDFileUMesh::extractPart;
126 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
127 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
128 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
129 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
130 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
131 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
132 %newobject MEDCoupling::MEDFileCMesh::New;
133 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
134 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
135 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
136 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
137 %newobject MEDCoupling::MEDFileMeshes::New;
138 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
139 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
140 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
141 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
142 %newobject MEDCoupling::MEDFileMeshes::__iter__;
144 %newobject MEDCoupling::MEDFileMeshSupports::New;
145 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
147 %newobject MEDCoupling::MEDFileStructureElements::New;
149 %newobject MEDCoupling::MEDFileFields::New;
150 %newobject MEDCoupling::MEDFileFields::NewAdv;
151 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
152 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
153 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
154 %newobject MEDCoupling::MEDFileFields::deepCopy;
155 %newobject MEDCoupling::MEDFileFields::shallowCpy;
156 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
157 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
158 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
159 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
160 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
161 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
162 %newobject MEDCoupling::MEDFileFields::__iter__;
163 %newobject MEDCoupling::MEDFileFields::extractPart;
164 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
166 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
167 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
168 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
169 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
175 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
176 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
177 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
178 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
184 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
186 %newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
187 %newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
188 %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
189 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray;
190 %newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble;
191 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel;
192 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel;
193 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
194 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
196 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
197 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
198 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
199 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
200 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
201 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
202 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
203 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
204 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
206 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
207 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
208 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
209 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
210 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
211 %newobject MEDCoupling::MEDFileField1TS::New;
212 %newobject MEDCoupling::MEDFileField1TS::field;
213 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
214 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
215 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
216 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
217 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
218 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
220 %newobject MEDCoupling::MEDFileIntField1TS::New;
221 %newobject MEDCoupling::MEDFileIntField1TS::field;
222 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevel;
223 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtTopLevel;
224 %newobject MEDCoupling::MEDFileIntField1TS::getFieldOnMeshAtLevel;
225 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevelOld;
226 %newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
227 %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
229 %newobject MEDCoupling::MEDFileFloatField1TS::New;
230 %newobject MEDCoupling::MEDFileFloatField1TS::field;
231 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
232 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
233 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
234 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
235 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
236 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
238 %newobject MEDCoupling::MEDFileData::New;
239 %newobject MEDCoupling::MEDFileData::deepCopy;
240 %newobject MEDCoupling::MEDFileData::getMeshes;
241 %newobject MEDCoupling::MEDFileData::getFields;
242 %newobject MEDCoupling::MEDFileData::getParams;
243 %newobject MEDCoupling::MEDFileData::Aggregate;
245 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
247 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
248 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
249 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
250 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
251 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
252 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
253 %newobject MEDCoupling::MEDFileParameters::New;
254 %newobject MEDCoupling::MEDFileParameters::deepCopy;
255 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
256 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
257 %newobject MEDCoupling::MEDFileParameters::__getitem__;
259 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
260 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
261 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
262 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
263 %newobject MEDCoupling::MEDFileJointOneStep::New;
264 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
265 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
266 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
267 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
268 %newobject MEDCoupling::MEDFileJoint::New;
269 %newobject MEDCoupling::MEDFileJoint::deepCopy;
270 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
271 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
272 %newobject MEDCoupling::MEDFileJoint::__getitem__;
273 %newobject MEDCoupling::MEDFileJoints::New;
274 %newobject MEDCoupling::MEDFileJoints::deepCopy;
275 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
276 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
277 %newobject MEDCoupling::MEDFileJoints::__getitem__;
278 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
279 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
280 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
281 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
282 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
283 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
284 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
285 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
286 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
288 %newobject MEDCoupling::SauvWriter::New;
289 %newobject MEDCoupling::SauvReader::New;
290 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
292 %newobject MEDCoupling::MEDFileMeshStruct::New;
293 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
294 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
295 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
296 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
297 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
299 %feature("unref") MEDFileMesh "$this->decrRef();"
300 %feature("unref") MEDFileUMesh "$this->decrRef();"
301 %feature("unref") MEDFileCMesh "$this->decrRef();"
302 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
303 %feature("unref") MEDFileMeshes "$this->decrRef();"
304 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
305 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
306 %feature("unref") MEDFileField1TS "$this->decrRef();"
307 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
308 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
309 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
310 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
311 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
312 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
313 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
314 %feature("unref") MEDFileStructureElements "$this->decrRef();"
315 %feature("unref") MEDFileFields "$this->decrRef();"
316 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
317 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
318 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
319 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
320 %feature("unref") MEDFileParameters "$this->decrRef();"
321 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
322 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
323 %feature("unref") MEDFileJoint "$this->decrRef();"
324 %feature("unref") MEDFileJoints "$this->decrRef();"
325 %feature("unref") MEDFileEquivalences "$this->decrRef();"
326 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
327 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
328 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
329 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
330 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
331 %feature("unref") MEDFileData "$this->decrRef();"
332 %feature("unref") SauvReader "$this->decrRef();"
333 %feature("unref") SauvWriter "$this->decrRef();"
334 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
335 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
336 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
337 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
338 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
339 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
341 namespace MEDCoupling
344 std::string MEDFileVersionStr();
345 std::string MEDFileVersionOfFileStr(const std::string& fileName);
346 void SetEpsilonForNodeComp(double val);
347 void SetCompPolicyForCell(int val);
348 void SetTooLongStrPolicy(int val);
349 void CheckFileForRead(const std::string& fileName);
350 std::vector<std::string> GetMeshNames(const std::string& fileName);
351 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
352 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
353 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
354 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
355 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
356 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
357 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
358 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
359 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
360 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
361 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
362 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
363 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
364 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
365 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
366 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
367 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
368 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
369 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
370 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
371 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
372 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
373 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
374 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
375 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
376 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
377 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
380 %rename (MEDFileVersion) MEDFileVersionSwig;
381 %rename (GetFieldIterations) GetFieldIterationsSwig;
382 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
383 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
384 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
385 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
386 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
387 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
388 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
389 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
390 %rename (WriteUMeshes) WriteUMeshesSwig;
391 %rename (GetTypesOfField) GetTypesOfFieldSwig;
392 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
393 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
394 %rename (ReadField) ReadFieldSwig;
395 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
399 PyObject *MEDFileVersionSwig()
401 int major,minor,release;
402 MEDCoupling::MEDFileVersion(major,minor,release);
403 PyObject *ret(PyTuple_New(3));
404 PyTuple_SetItem(ret,0,SWIG_From_int(major));
405 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
406 PyTuple_SetItem(ret,2,SWIG_From_int(release));
410 int MEDFileSizeOfMedInt()
412 return 8*sizeof(med_int);
415 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
417 std::map<std::string,mcIdType> families;
418 std::map<std::string,std::vector<std::string>> groupsOnFam;
419 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
420 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
421 AutoPyPtr ret(PyTuple_New(2));
422 PyTuple_SetItem(ret,0,a.retn());
423 PyTuple_SetItem(ret,1,b.retn());
427 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
429 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
433 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
435 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
439 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
441 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
445 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
447 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
451 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
453 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
454 PyObject *ret=PyList_New(res.size());
456 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
458 PyObject *elt=PyTuple_New(2);
459 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
460 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
461 PyList_SetItem(ret,rk,elt);
466 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
468 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
469 PyObject *ret=PyList_New(res.size());
471 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
473 PyObject *elt=PyTuple_New(3);
474 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
475 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
476 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
477 PyList_SetItem(ret,rk,elt);
482 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
484 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
485 PyObject *ret=PyList_New(res.size());
487 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
489 PyObject *elt=PyTuple_New(2);
490 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
491 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
492 PyList_SetItem(ret,rk,elt);
497 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
499 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
500 PyObject *ret=PyList_New(res.size());
502 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
504 PyObject *elt=PyTuple_New(2);
505 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
506 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
507 PyList_SetItem(ret,rk,elt);
512 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
514 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
515 PyObject *ret=PyList_New(res.size());
517 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
519 PyObject *elt=PyTuple_New(2);
520 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
521 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
522 PyList_SetItem(ret,rk,elt);
527 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
529 int meshDim,spaceDim;
530 mcIdType numberOfNodes;
531 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
532 PyObject *ret=PyTuple_New(4);
533 PyObject *elt0=PyList_New(res.size());
535 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
537 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
539 PyObject *elt1=PyList_New(obj2.size());
540 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
542 PyObject *elt2=PyTuple_New(2);
543 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
544 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
545 PyList_SetItem(elt1,j,elt2);
547 PyList_SetItem(elt0,i,elt1);
549 PyTuple_SetItem(ret,0,elt0);
550 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
551 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
552 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
556 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
557 const std::string& fieldName, PyObject *liIts)
559 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
560 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
561 return convertFieldDoubleVecToPy(res);
564 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
566 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
567 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
568 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
571 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
573 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
574 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
575 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
578 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
580 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
581 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
582 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
585 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
587 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
588 std::size_t size=v.size();
589 PyObject *ret=PyList_New(size);
590 for(std::size_t i=0;i<size;i++)
591 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
595 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
597 std::vector<std::string> grps;
598 converPyListToVecString(li,grps);
599 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
602 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
604 std::vector<std::string> fams;
605 converPyListToVecString(li,fams);
606 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
610 namespace MEDCoupling
612 class MEDFileWritable
615 void copyOptionsFrom(const MEDFileWritable& other) const;
616 int getTooLongStrPolicy() const;
617 void setTooLongStrPolicy(int newVal);
618 int getZipConnPolicy();
619 void setZipConnPolicy(int newVal);
622 class MEDFileWritableStandAlone : public MEDFileWritable
625 void write(const std::string& fileName, int mode) const;
626 void write33(const std::string& fileName, int mode) const;
627 void write30(const std::string& fileName, int mode) const;
630 DataArrayByte *serialize() const
632 MCAuto<DataArrayByte> ret(self->serialize());
636 PyObject *__getstate__()
638 PyObject *ret(PyList_New(0));
642 void __setstate__(PyObject *inp)
648 class MEDFileMeshReadSelector
651 MEDFileMeshReadSelector();
652 MEDFileMeshReadSelector(unsigned int code);
653 unsigned int getCode() const;
654 void setCode(unsigned int newCode);
655 bool isCellFamilyFieldReading() const;
656 bool isNodeFamilyFieldReading() const;
657 bool isCellNameFieldReading() const;
658 bool isNodeNameFieldReading() const;
659 bool isCellNumFieldReading() const;
660 bool isNodeNumFieldReading() const;
661 bool isGlobalNodeNumFieldReading() const;
662 void setCellFamilyFieldReading(bool b);
663 void setNodeFamilyFieldReading(bool b);
664 void setCellNameFieldReading(bool b);
665 void setNodeNameFieldReading(bool b);
666 void setCellNumFieldReading(bool b);
667 void setNodeNumFieldReading(bool b);
668 void setGlobalNodeNumFieldReading(bool b);
671 std::string __str__() const
673 std::ostringstream oss;
678 std::string __repr__() const
680 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
686 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
689 static MEDFileJointCorrespondence *New();
690 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
692 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
693 INTERP_KERNEL::NormalizedCellType loc_geo_type,
694 INTERP_KERNEL::NormalizedCellType rem_geo_type)
696 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
697 MEDFileJointCorrespondence *deepCopy() const;
698 MEDFileJointCorrespondence *shallowCpy() const;
699 void setIsNodal(bool isNodal);
700 bool getIsNodal() const;
701 bool isEqual(const MEDFileJointCorrespondence *other) const;
702 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
703 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
704 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
705 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
706 void setCorrespondence(DataArrayIdType *corr);
707 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
708 std::string simpleRepr() const;
711 MEDFileJointCorrespondence()
713 return MEDFileJointCorrespondence::New();
715 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
717 return MEDFileJointCorrespondence::New(correspondence);
719 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
720 INTERP_KERNEL::NormalizedCellType loc_geo_type,
721 INTERP_KERNEL::NormalizedCellType rem_geo_type)
723 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
726 std::string __str__() const
728 return self->simpleRepr();
731 DataArrayIdType *getCorrespondence() const
733 const DataArrayIdType *ret(self->getCorrespondence());
736 return const_cast<DataArrayIdType *>(ret);
741 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
744 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
745 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
746 MEDFileJointOneStep *deepCopy() const;
747 MEDFileJointOneStep *shallowCpy() const;
748 bool isEqual(const MEDFileJointOneStep *other) const;
749 void setOrder(int order);
750 int getOrder() const;
751 void setIteration(int it);
752 int getIteration() const;
753 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
754 int getNumberOfCorrespondences() const;
755 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
756 std::string simpleRepr() const;
759 MEDFileJointOneStep()
761 return MEDFileJointOneStep::New();
764 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
766 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
769 std::string __str__() const
771 return self->simpleRepr();
774 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
776 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
782 MEDFileJointCorrespondence *__getitem__(int i) const
784 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
789 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
792 static MEDFileJoint *New();
793 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
794 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
795 MEDFileJoint *deepCopy() const;
796 MEDFileJoint *shallowCpy() const;
797 bool isEqual(const MEDFileJoint *other) const;
798 void setLocalMeshName(const std::string& name);
799 std::string getLocalMeshName() const;
800 void setRemoteMeshName(const std::string& name);
801 std::string getRemoteMeshName() const;
802 void setDescription(const std::string& name);
803 std::string getDescription() const;
804 void setJointName(const std::string& name);
805 std::string getJointName() const;
806 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
807 void setDomainNumber(const int& number);
808 int getDomainNumber() const;
809 void pushStep(MEDFileJointOneStep* step);
810 int getNumberOfSteps() const;
811 std::string simpleRepr() const;
816 return MEDFileJoint::New();
819 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
821 return MEDFileJoint::New(fileName,mName,num);
824 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
826 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
829 std::string __str__() const
831 return self->simpleRepr();
834 MEDFileJointOneStep *getStepAtPos(int i) const
836 MEDFileJointOneStep *ret(self->getStepAtPos(i));
842 MEDFileJointOneStep *__getitem__(int i)
844 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
849 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
852 static MEDFileJoints *New();
853 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
854 MEDFileJoints *deepCopy() const;
855 std::string simpleRepr() const;
856 std::string getMeshName() const;
857 int getNumberOfJoints() const;
858 std::vector<std::string> getJointsNames() const;
859 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
860 void resize(int newSize);
861 void pushJoint(MEDFileJoint *joint);
862 void setJointAtPos(int i, MEDFileJoint *joint);
863 void destroyJointAtPos(int i);
868 return MEDFileJoints::New();
871 MEDFileJoints(const std::string& fileName, const std::string& meshName)
873 return MEDFileJoints::New(fileName,meshName);
876 std::string __str__() const
878 return self->simpleRepr();
881 MEDFileJoint *__getitem__(PyObject *obj)
883 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
886 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
891 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
899 return self->getNumberOfJoints();
902 MEDFileJoint *getJointAtPos(int i) const
904 MEDFileJoint *ret=self->getJointAtPos(i);
910 MEDFileJoint *getJointWithName(const std::string& paramName) const
912 MEDFileJoint *ret=self->getJointWithName(paramName);
920 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
923 MEDFileEquivalenceBase();
926 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
929 MEDFileEquivalenceData();
931 void setArray(DataArrayInt32 *data);
934 DataArrayInt32 *getArray()
936 DataArrayInt32 *ret(self->getArray());
937 if(ret) ret->incrRef();
943 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
946 MEDFileEquivalenceNode();
949 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
952 MEDFileEquivalenceCell();
955 std::size_t size() const;
956 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
957 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
960 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
962 DataArrayInt32 *ret(self->getArray(type));
963 if(ret) ret->incrRef();
967 PyObject *getTypes() const
969 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
970 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
971 PyObject *res=PyList_New(result.size());
972 for(int i=0;iL!=result.end(); i++, iL++)
973 PyList_SetItem(res,i,PyInt_FromLong(*iL));
979 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
982 MEDFileEquivalencePair();
984 std::string getName() const;
985 void setName(const std::string& name);
986 std::string getDescription() const;
987 void setDescription(const std::string& descr);
988 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
991 MEDFileEquivalenceCell *initCell()
993 MEDFileEquivalenceCell *ret(self->initCell());
994 if(ret) ret->incrRef();
998 MEDFileEquivalenceNode *initNode()
1000 MEDFileEquivalenceNode *ret(self->initNode());
1001 if(ret) ret->incrRef();
1005 MEDFileEquivalenceCell *getCell()
1007 MEDFileEquivalenceCell *ret(self->getCell());
1008 if(ret) ret->incrRef();
1012 MEDFileEquivalenceNode *getNode()
1014 MEDFileEquivalenceNode *ret(self->getNode());
1015 if(ret) ret->incrRef();
1021 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1024 MEDFileEquivalences();
1027 std::vector<std::string> getEquivalenceNames() const;
1028 void killEquivalenceWithName(const std::string& name);
1029 void killEquivalenceAt(int i);
1033 MEDFileEquivalencePair *getEquivalence(int i)
1035 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1036 if(ret) ret->incrRef();
1039 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1041 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1042 if(ret) ret->incrRef();
1046 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1048 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1049 if(ret) ret->incrRef();
1055 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1058 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1059 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1060 static MEDFileMesh *New(DataArrayByte *db);
1061 virtual MEDFileMesh *createNewEmpty() const;
1062 virtual MEDFileMesh *deepCopy() const;
1063 virtual MEDFileMesh *shallowCpy() const;
1064 virtual void clearNonDiscrAttributes() const;
1065 void setName(const std::string& name);
1066 std::string getName();
1067 std::string getUnivName() const;
1068 bool getUnivNameWrStatus() const;
1069 void setUnivNameWrStatus(bool newStatus);
1070 void setDescription(const std::string& name);
1071 std::string getDescription() const;
1072 void setOrder(int order);
1073 int getOrder() const;
1074 void setIteration(int it);
1076 void setTimeValue(double time);
1077 void setTime(int dt, int it, double time);
1078 double getTimeValue() const;
1079 void setTimeUnit(const std::string& unit);
1080 std::string getTimeUnit() const;
1081 void setAxisType(MEDCouplingAxisType at);
1082 MEDCouplingAxisType getAxisType() const;
1083 virtual int getNumberOfNodes() const;
1084 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1085 virtual bool hasImplicitPart() const;
1086 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1087 virtual void releaseImplicitPartIfAny() const;
1088 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1089 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1090 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1091 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1092 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1093 virtual MEDFileMesh *cartesianize() const;
1094 std::vector<int> getNonEmptyLevels() const;
1095 std::vector<int> getNonEmptyLevelsExt() const;
1096 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1098 bool existsGroup(const std::string& groupName) const;
1099 bool existsFamily(int famId) const;
1100 bool existsFamily(const std::string& familyName) const;
1101 void setFamilyId(const std::string& familyName, int id);
1102 void setFamilyIdUnique(const std::string& familyName, int id);
1103 void addFamily(const std::string& familyName, int id);
1104 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1105 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1106 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1107 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1110 void clearFamGrpMaps();
1111 const std::map<std::string,int>& getFamilyInfo() const;
1112 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1113 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1114 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1115 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1116 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1117 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1118 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1119 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1120 std::vector<std::string> getGroupsNames() const;
1121 std::vector<std::string> getFamiliesNames() const;
1122 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1123 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1124 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1125 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1126 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1127 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1128 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1129 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1130 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1131 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1132 static std::string GetMagicFamilyStr();
1133 void assignFamilyNameWithGroupName();
1134 std::vector<std::string> removeEmptyGroups();
1135 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1136 void removeGroup(const std::string& name);
1137 void removeFamily(const std::string& name);
1138 std::vector<std::string> removeOrphanGroups();
1139 std::vector<std::string> removeOrphanFamilies();
1140 void removeFamiliesReferedByNoGroups();
1141 void rearrangeFamilies();
1143 void checkOrphanFamilyZero() const;
1144 void changeGroupName(const std::string& oldName, const std::string& newName);
1145 void changeFamilyName(const std::string& oldName, const std::string& newName);
1146 void changeFamilyId(int oldId, int newId);
1147 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1148 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1149 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1150 int getFamilyId(const std::string& name) const;
1151 int getMaxAbsFamilyId() const;
1152 int getMaxFamilyId() const;
1153 int getMinFamilyId() const;
1154 int getTheMaxAbsFamilyId() const;
1155 int getTheMaxFamilyId() const;
1156 int getTheMinFamilyId() const;
1157 virtual int getMaxAbsFamilyIdInArrays() const;
1158 virtual int getMaxFamilyIdInArrays() const;
1159 virtual int getMinFamilyIdInArrays() const;
1160 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1161 DataArrayIdType *computeAllFamilyIdsInUse() const;
1162 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1163 std::string getFamilyNameGivenId(int id) const;
1164 bool ensureDifferentFamIdsPerLevel();
1165 void normalizeFamIdsTrio();
1166 void normalizeFamIdsMEDFile();
1167 virtual int getMeshDimension() const;
1168 virtual std::string simpleRepr() const;
1169 virtual std::string advancedRepr() const;
1171 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1172 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1173 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1174 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1175 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1176 virtual void addNodeGroup(const DataArrayIdType *ids);
1177 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1178 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1179 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1180 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1181 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1182 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1183 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1184 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1185 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1186 int getNumberOfJoints();
1187 MEDFileJoints *getJoints();
1188 void setJoints( MEDFileJoints* joints );
1189 void initializeEquivalences();
1190 void killEquivalences();
1191 bool presenceOfStructureElements() const;
1192 void killStructureElements();
1195 std::string __str__() const
1197 return self->simpleRepr();
1200 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1202 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1208 double tmp0=self->getTime(tmp1,tmp2);
1209 PyObject *res = PyList_New(3);
1210 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1211 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1212 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1216 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1219 bool ret0=self->isEqual(other,eps,what);
1220 PyObject *res=PyList_New(2);
1221 PyObject *ret0Py=ret0?Py_True:Py_False;
1223 PyList_SetItem(res,0,ret0Py);
1224 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1228 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1230 std::vector<const DataArrayIdType *> grps;
1231 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1232 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1235 PyObject *areFamsEqual(const MEDFileMesh *other) const
1238 bool ret0=self->areFamsEqual(other,what);
1239 PyObject *res=PyList_New(2);
1240 PyObject *ret0Py=ret0?Py_True:Py_False;
1242 PyList_SetItem(res,0,ret0Py);
1243 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1247 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1250 bool ret0=self->areGrpsEqual(other,what);
1251 PyObject *res=PyList_New(2);
1252 PyObject *ret0Py=ret0?Py_True:Py_False;
1254 PyList_SetItem(res,0,ret0Py);
1255 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1259 PyObject *getAllGeoTypes() const
1261 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1262 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1263 PyObject *res=PyList_New(result.size());
1264 for(int i=0;iL!=result.end(); i++, iL++)
1265 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1269 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1271 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1272 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1273 PyObject *res=PyList_New(result.size());
1274 for(int i=0;iL!=result.end(); i++, iL++)
1275 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1279 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1281 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1284 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1287 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1289 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1292 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1295 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1297 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1300 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1303 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1305 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1308 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1311 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1313 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1316 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1319 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1322 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1323 PyObject *ret=PyTuple_New(2);
1324 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1325 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1329 PyObject *unPolyze()
1331 DataArrayIdType *ret3=0;
1332 std::vector<mcIdType> ret1,ret2;
1333 bool ret0=self->unPolyze(ret1,ret2,ret3);
1334 PyObject *ret=PyTuple_New(4);
1335 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1337 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1338 for(int j=0;j<(int)ret1.size()/3;j++)
1340 PyObject *retLev2=PyList_New(3);
1341 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1342 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1343 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1344 PyList_SetItem(retLev1_0,j,retLev2);
1346 PyTuple_SetItem(ret,1,retLev1_0);
1348 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1349 for(int j=0;j<(int)ret2.size()/3;j++)
1351 PyObject *retLev2=PyList_New(3);
1352 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1353 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1354 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1355 PyList_SetItem(retLev1_1,j,retLev2);
1357 PyTuple_SetItem(ret,2,retLev1_1);
1359 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1363 MEDFileEquivalences *getEquivalences()
1365 MEDFileEquivalences *ret(self->getEquivalences());
1366 if(ret) ret->incrRef();
1370 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1372 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1378 class MEDFileUMesh : public MEDFileMesh
1381 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1382 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1383 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1384 static MEDFileUMesh *New(DataArrayByte *db);
1385 static MEDFileUMesh *New();
1386 static const char *GetSpeStr4ExtMesh();
1388 int getSpaceDimension() const;
1389 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1390 void checkConsistency() const;
1391 void checkSMESHConsistency() const;
1392 void clearNodeAndCellNumbers();
1394 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1395 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1396 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1397 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1398 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1399 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1400 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1401 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1402 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1403 void forceComputationOfParts() const;
1405 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1406 void setCoords(DataArrayDouble *coords);
1407 void setCoordsForced(DataArrayDouble *coords);
1408 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1409 void removeMeshAtLevel(int meshDimRelToMax);
1410 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1411 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1412 void optimizeFamilies();
1413 DataArrayIdType *zipCoords();
1414 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1415 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1416 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1417 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1418 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1419 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1422 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1424 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1427 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1429 return MEDFileUMesh::New(fileName,mrs);
1432 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1434 return MEDFileUMesh::New(mem);
1437 MEDFileUMesh(DataArrayByte *db)
1439 return MEDFileUMesh::New(db);
1444 return MEDFileUMesh::New();
1447 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)
1449 std::vector<int> typesCpp1;
1450 convertPyToNewIntArr3(types,typesCpp1);
1451 std::size_t sz(typesCpp1.size());
1452 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1453 for(std::size_t ii=0;ii<sz;ii++)
1454 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1455 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1458 PyObject *__getstate__()
1460 std::vector<double> a0;
1461 std::vector<mcIdType> a1;
1462 std::vector<std::string> a2;
1463 std::vector< MCAuto<DataArrayIdType> > a3;
1464 MCAuto<DataArrayDouble> a4;
1465 self->serialize(a0,a1,a2,a3,a4);
1466 PyObject *ret(PyTuple_New(5));
1467 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1468 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1469 std::size_t sz(a2.size());
1470 PyObject *ret2(PyList_New(sz));
1471 for(std::size_t i=0;i<sz;i++)
1472 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1473 PyTuple_SetItem(ret,2,ret2);
1475 PyObject *ret3(PyList_New(sz));
1476 for(std::size_t i=0;i<sz;i++)
1478 DataArrayIdType *elt(a3[i]);
1481 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1483 PyTuple_SetItem(ret,3,ret3);
1484 DataArrayDouble *ret4(a4);
1487 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1491 void __setstate__(PyObject *inp)
1493 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1494 if(!PyTuple_Check(inp))
1495 throw INTERP_KERNEL::Exception(MSG);
1496 std::size_t sz(PyTuple_Size(inp));
1498 throw INTERP_KERNEL::Exception(MSG);
1499 std::vector<double> a0;
1500 std::vector<mcIdType> a1;
1501 std::vector<std::string> a2;
1502 std::vector< MCAuto<DataArrayIdType> > a3;
1503 MCAuto<DataArrayDouble> a4;
1505 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1507 fillArrayWithPyListDbl3(a0py,tmp,a0);
1508 convertPyToNewIntArr3(a1py,a1);
1509 fillStringVector(a2py,a2);
1511 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1513 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1514 if(!SWIG_IsOK(status))
1515 throw INTERP_KERNEL::Exception(MSG);
1516 a4=reinterpret_cast<DataArrayDouble *>(argp);
1517 if((DataArrayDouble *)a4)
1520 std::vector< DataArrayIdType * > a3Tmp;
1521 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1522 std::size_t sz(a3Tmp.size());
1524 for(std::size_t i=0;i<sz;i++)
1528 a3Tmp[i]->incrRef();
1530 self->unserialize(a0,a1,a2,a3,a4);
1534 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1537 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1538 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1541 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1544 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1547 self->setMeshAtLevel(meshDimRelToMax,m1);
1550 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1553 void __delitem__(int meshDimRelToMax)
1555 self->removeMeshAtLevel(meshDimRelToMax);
1558 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1560 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1562 DataArrayDouble *a,*a2;
1563 DataArrayDoubleTuple *aa,*aa2;
1564 std::vector<double> bb,bb2;
1566 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1567 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1568 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1572 static MEDFileUMesh *Aggregate(PyObject *meshes)
1574 std::vector<const MEDFileUMesh *> meshesCpp;
1575 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1576 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1580 PyObject *getAllDistributionOfTypes() const
1582 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1583 return convertVecPairIntToPy(ret);
1586 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1588 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1589 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1590 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1593 MEDFileUMesh *extractPart(PyObject *extractDef) const
1595 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1596 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1597 return self->extractPart(extractDefCpp);
1600 void setMeshes(PyObject *li, bool renum=false)
1602 std::vector<const MEDCouplingUMesh *> ms;
1603 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1604 self->setMeshes(ms,renum);
1607 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1609 std::vector<const MEDCouplingUMesh *> ms;
1610 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1611 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1614 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1616 std::vector<const MEDCouplingUMesh *> ms;
1617 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1618 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1621 DataArrayDouble *getCoords() const
1623 DataArrayDouble *ret=self->getCoords();
1629 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1631 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1634 return const_cast<PartDefinition *>(ret);
1637 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1639 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1640 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1641 PyObject *ret=PyTuple_New(3);
1642 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1643 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1644 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1648 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1650 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1656 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1658 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1659 std::size_t sz(tmp.size());
1660 PyObject *ret=PyList_New(sz);
1661 for(std::size_t i=0;i<sz;i++)
1665 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1672 class MEDFileStructuredMesh : public MEDFileMesh
1677 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1679 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1687 class MEDFileCMesh : public MEDFileStructuredMesh
1690 static MEDFileCMesh *New();
1691 static MEDFileCMesh *New(DataArrayByte *db);
1692 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1693 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1694 void setMesh(MEDCouplingCMesh *m);
1695 int getSpaceDimension() const;
1700 return MEDFileCMesh::New();
1703 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1705 return MEDFileCMesh::New(fileName,mrs);
1708 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1710 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1713 MEDFileCMesh(DataArrayByte *db)
1715 return MEDFileCMesh::New(db);
1718 PyObject *getMesh() const
1720 const MEDCouplingCMesh *tmp=self->getMesh();
1723 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1728 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1731 static MEDFileCurveLinearMesh *New();
1732 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1733 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1734 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1735 void setMesh(MEDCouplingCurveLinearMesh *m);
1738 MEDFileCurveLinearMesh()
1740 return MEDFileCurveLinearMesh::New();
1743 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1745 return MEDFileCurveLinearMesh::New(fileName,mrs);
1748 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1750 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1753 MEDFileCurveLinearMesh(DataArrayByte *db)
1755 return MEDFileCurveLinearMesh::New(db);
1758 PyObject *getMesh() const
1760 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1763 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1768 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1771 static MEDFileMeshMultiTS *New();
1772 static MEDFileMeshMultiTS *New(const std::string& fileName);
1773 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1774 MEDFileMeshMultiTS *deepCopy() const;
1775 std::string getName() const;
1776 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1777 void cartesianizeMe();
1780 MEDFileMeshMultiTS()
1782 return MEDFileMeshMultiTS::New();
1785 MEDFileMeshMultiTS(const std::string& fileName)
1787 return MEDFileMeshMultiTS::New(fileName);
1790 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1792 return MEDFileMeshMultiTS::New(fileName,mName);
1795 MEDFileMesh *getOneTimeStep() const
1797 MEDFileMesh *ret=self->getOneTimeStep();
1805 class MEDFileMeshesIterator
1812 MEDFileMesh *ret=self->nextt();
1816 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1820 PyErr_SetString(PyExc_StopIteration,"No more data.");
1827 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1830 static MEDFileMeshes *New();
1831 static MEDFileMeshes *New(DataArrayByte *db);
1832 MEDFileMeshes *deepCopy() const;
1833 int getNumberOfMeshes() const;
1834 std::vector<std::string> getMeshesNames() const;
1836 void resize(int newSize);
1837 void pushMesh(MEDFileMesh *mesh);
1838 void setMeshAtPos(int i, MEDFileMesh *mesh);
1839 void destroyMeshAtPos(int i);
1840 void cartesianizeMe();
1841 bool presenceOfStructureElements() const;
1842 void killStructureElements();
1847 return MEDFileMeshes::New();
1850 MEDFileMeshes(const std::string& fileName)
1852 return MEDFileMeshes::New(fileName);
1855 MEDFileMeshes(DataArrayByte *db)
1857 return MEDFileMeshes::New(db);
1860 std::string __str__() const
1862 return self->simpleRepr();
1865 MEDFileMesh *__getitem__(PyObject *obj)
1867 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1868 if(PyInt_Check(obj))
1870 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1875 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1881 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1883 self->setMeshAtPos(obj,mesh);
1887 MEDFileMeshesIterator *__iter__()
1889 return self->iterator();
1894 return self->getNumberOfMeshes();
1897 MEDFileMesh *getMeshAtPos(int i) const
1899 MEDFileMesh *ret=self->getMeshAtPos(i);
1904 MEDFileMesh *getMeshWithName(const std::string& mname) const
1906 MEDFileMesh *ret=self->getMeshWithName(mname);
1914 class MEDFileFieldLoc : public RefCountObject
1917 std::string getName() const;
1918 int getDimension() const;
1919 int getNumberOfGaussPoints() const;
1920 int getNumberOfPointsInCells() const;
1921 const std::vector<double>& getRefCoords() const;
1922 const std::vector<double>& getGaussCoords() const;
1923 const std::vector<double>& getGaussWeights() const;
1924 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1927 std::string __str__() const
1929 return self->repr();
1934 class MEDFileFieldGlobsReal
1937 void resetContent();
1938 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1939 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1940 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1941 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1942 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1943 void checkGlobsCoherency() const;
1944 void checkGlobsPflsPartCoherency() const;
1945 void checkGlobsLocsPartCoherency() const;
1946 std::vector<std::string> getPfls() const;
1947 std::vector<std::string> getLocs() const;
1948 bool existsPfl(const std::string& pflName) const;
1949 bool existsLoc(const std::string& locName) const;
1950 std::string createNewNameOfPfl() const;
1951 std::string createNewNameOfLoc() const;
1952 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1953 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1954 virtual std::vector<std::string> getPflsReallyUsed() const;
1955 virtual std::vector<std::string> getLocsReallyUsed() const;
1956 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1957 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1958 void killProfileIds(const std::vector<int>& pflIds);
1959 void killLocalizationIds(const std::vector<int>& locIds);
1960 void changePflName(const std::string& oldName, const std::string& newName);
1961 void changeLocName(const std::string& oldName, const std::string& newName);
1962 int getNbOfGaussPtPerCell(int locId) const;
1963 int getLocalizationId(const std::string& loc) const;
1964 int getProfileId(const std::string& pfl) const;
1965 void killStructureElementsInGlobs();
1968 PyObject *getProfile(const std::string& pflName) const
1970 const DataArrayIdType *ret=self->getProfile(pflName);
1973 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1976 PyObject *getProfileFromId(int pflId) const
1978 const DataArrayIdType *ret=self->getProfileFromId(pflId);
1981 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1984 PyObject *getLocalizationFromId(int locId) const
1986 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1989 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1992 PyObject *getLocalization(const std::string& locName) const
1994 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1997 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2000 PyObject *zipPflsNames()
2002 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2003 return convertVecPairVecStToPy(ret);
2006 PyObject *zipLocsNames(double eps)
2008 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2009 return convertVecPairVecStToPy(ret);
2012 void changePflsNames(PyObject *li)
2014 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2015 self->changePflsNames(v);
2018 void changePflsRefsNamesGen(PyObject *li)
2020 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2021 self->changePflsRefsNamesGen(v);
2024 void changePflsNamesInStruct(PyObject *li)
2026 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2027 self->changePflsNamesInStruct(v);
2030 void changeLocsNames(PyObject *li)
2032 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2033 self->changeLocsNames(v);
2036 void changeLocsRefsNamesGen(PyObject *li)
2038 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2039 self->changeLocsRefsNamesGen(v);
2042 void changeLocsNamesInStruct(PyObject *li)
2044 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2045 self->changeLocsNamesInStruct(v);
2048 std::string simpleReprGlobs() const
2050 std::ostringstream oss;
2051 self->simpleReprGlobs(oss);
2057 class MEDFileEntities
2062 static MEDFileEntities *BuildFrom(PyObject *entities)
2064 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2065 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2067 std::size_t sz(inp0.size());
2069 for(std::size_t i=0;i<sz;i++)
2070 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2072 return MEDFileEntities::BuildFrom(&inp);
2079 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2082 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2083 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2084 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2085 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2087 void loadArraysIfNecessary();
2088 void unloadArrays();
2089 void unloadArraysWithoutDataLoss();
2090 int getDimension() const;
2091 int getIteration() const;
2092 int getOrder() const;
2093 std::string getName();
2094 void setName(const std::string& name);
2095 std::string getMeshName();
2096 void setMeshName(const std::string& newMeshName);
2097 int getMeshIteration() const;
2098 int getMeshOrder() const;
2099 int getNumberOfComponents() const;
2100 bool isDealingTS(int iteration, int order) const;
2101 void setInfo(const std::vector<std::string>& infos);
2102 const std::vector<std::string>& getInfo() const;
2103 bool presenceOfMultiDiscPerGeoType() const;
2104 void setTime(int iteration, int order, double val);
2105 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2106 MEDFileAnyTypeField1TS *deepCopy() const;
2107 std::string getDtUnit() const;
2108 void setDtUnit(const std::string& dtUnit);
2114 double tmp0=self->getTime(tmp1,tmp2);
2115 PyObject *res = PyList_New(3);
2116 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2117 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2118 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2122 PyObject *getDtIt() const
2124 std::pair<int,int> res=self->getDtIt();
2125 PyObject *elt=PyTuple_New(2);
2126 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2127 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2131 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2133 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2136 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2138 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2141 bool changeMeshNames(PyObject *li)
2143 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2144 return self->changeMeshNames(modifTab);
2147 PyObject *getTypesOfFieldAvailable() const
2149 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2150 PyObject *ret2=PyList_New(ret.size());
2151 for(int i=0;i<(int)ret.size();i++)
2152 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2156 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2158 std::vector<int> ret1;
2159 int ret0=self->getNonEmptyLevels(mname,ret1);
2160 PyObject *elt=PyTuple_New(2);
2161 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2162 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2166 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2168 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2169 std::vector< std::vector<TypeOfField> > typesF;
2170 std::vector< std::vector<std::string> > pfls;
2171 std::vector< std::vector<std::string> > locs;
2172 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2173 std::size_t sz=ret.size();
2174 PyObject *ret2=PyList_New(sz);
2175 for(std::size_t i=0;i<sz;i++)
2177 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2178 const std::vector<TypeOfField>& typesFI=typesF[i];
2179 const std::vector<std::string>& pflsI=pfls[i];
2180 const std::vector<std::string>& locsI=locs[i];
2181 PyObject *elt=PyTuple_New(2);
2182 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2183 std::size_t sz2=ret[i].size();
2184 PyObject *elt2=PyList_New(sz2);
2185 for(std::size_t j=0;j<sz2;j++)
2187 PyObject *elt3=PyTuple_New(4);
2188 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2189 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2190 PyTuple_SetItem(elt3,1,elt4);
2191 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2192 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2193 PyList_SetItem(elt2,j,elt3);
2195 PyTuple_SetItem(elt,1,elt2);
2196 PyList_SetItem(ret2,i,elt);
2201 PyObject *splitComponents() const
2203 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2204 std::size_t sz=ret.size();
2205 PyObject *retPy=PyList_New(sz);
2206 for(std::size_t i=0;i<sz;i++)
2207 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2211 PyObject *splitDiscretizations() const
2213 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2214 std::size_t sz=ret.size();
2215 PyObject *retPy=PyList_New(sz);
2216 for(std::size_t i=0;i<sz;i++)
2217 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2221 PyObject *splitMultiDiscrPerGeoTypes() const
2223 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2224 std::size_t sz=ret.size();
2225 PyObject *retPy=PyList_New(sz);
2226 for(std::size_t i=0;i<sz;i++)
2227 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2231 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2233 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2234 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2235 return self->extractPart(extractDefCpp,mm);
2240 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2243 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2244 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2245 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2246 static MEDFileField1TS *New(DataArrayByte *db);
2247 static MEDFileField1TS *New();
2248 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2249 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2250 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2251 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2252 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2253 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2254 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2255 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2257 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2258 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2259 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2260 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2261 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2264 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2266 return MEDFileField1TS::New(fileName,loadAll);
2269 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2271 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2274 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2276 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2279 MEDFileField1TS(DataArrayByte *db)
2281 return MEDFileField1TS::New(db);
2286 return MEDFileField1TS::New();
2289 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2291 const DataArrayDouble *arr=0;
2293 arr=field->getArray();
2294 self->copyTinyInfoFrom(field,arr);
2297 std::string __str__() const
2299 return self->simpleRepr();
2302 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2304 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2307 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2309 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2310 std::vector< std::vector<TypeOfField> > typesF;
2311 std::vector< std::vector<std::string> > pfls;
2312 std::vector< std::vector<std::string> > locs;
2313 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2314 std::size_t sz=ret.size();
2315 PyObject *ret2=PyList_New(sz);
2316 for(std::size_t i=0;i<sz;i++)
2318 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2319 const std::vector<TypeOfField>& typesFI=typesF[i];
2320 const std::vector<std::string>& pflsI=pfls[i];
2321 const std::vector<std::string>& locsI=locs[i];
2322 PyObject *elt=PyTuple_New(2);
2323 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2324 std::size_t sz2=ret[i].size();
2325 PyObject *elt2=PyList_New(sz2);
2326 for(std::size_t j=0;j<sz2;j++)
2328 PyObject *elt3=PyTuple_New(4);
2329 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2330 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2331 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2332 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2333 PyList_SetItem(elt2,j,elt3);
2335 PyTuple_SetItem(elt,1,elt2);
2336 PyList_SetItem(ret2,i,elt);
2341 DataArrayDouble *getUndergroundDataArray() const
2343 DataArrayDouble *ret=self->getUndergroundDataArray();
2349 PyObject *getUndergroundDataArrayExt() const
2351 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2356 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2359 static MEDFileIntField1TS *New();
2360 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2361 static MEDFileIntField1TS *New(DataArrayByte *db);
2362 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2363 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2364 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2366 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2367 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2368 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2369 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2370 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2371 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2372 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2373 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2374 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2375 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2378 MEDFileIntField1TS()
2380 return MEDFileIntField1TS::New();
2383 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2385 return MEDFileIntField1TS::New(fileName,loadAll);
2388 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2390 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2393 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2395 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2398 MEDFileIntField1TS(DataArrayByte *db)
2400 return MEDFileIntField1TS::New(db);
2403 std::string __str__() const
2405 return self->simpleRepr();
2408 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2410 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2413 DataArrayInt32 *getUndergroundDataArray() const
2415 DataArrayInt32 *ret=self->getUndergroundDataArray();
2421 PyObject *getUndergroundDataArrayExt() const
2423 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2428 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2431 static MEDFileFloatField1TS *New();
2432 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2433 static MEDFileFloatField1TS *New(DataArrayByte *db);
2434 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2435 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2436 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2438 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2439 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2440 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2441 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2442 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2443 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2444 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2445 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2446 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2447 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2450 MEDFileFloatField1TS()
2452 return MEDFileFloatField1TS::New();
2455 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2457 return MEDFileFloatField1TS::New(fileName,loadAll);
2460 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2462 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2465 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2467 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2470 MEDFileFloatField1TS(DataArrayByte *db)
2472 return MEDFileFloatField1TS::New(db);
2475 std::string __str__() const
2477 return self->simpleRepr();
2480 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2482 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2485 DataArrayFloat *getUndergroundDataArray() const
2487 DataArrayFloat *ret=self->getUndergroundDataArray();
2493 PyObject *getUndergroundDataArrayExt() const
2495 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2500 class MEDFileAnyTypeFieldMultiTSIterator
2507 MEDFileAnyTypeField1TS *ret=self->nextt();
2509 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2512 PyErr_SetString(PyExc_StopIteration,"No more data.");
2519 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2522 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2523 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2524 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2525 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2526 std::string getName() const;
2527 void setName(const std::string& name);
2528 std::string getDtUnit() const;
2529 void setDtUnit(const std::string& dtUnit);
2530 std::string getMeshName() const;
2531 void setMeshName(const std::string& newMeshName);
2532 const std::vector<std::string>& getInfo() const;
2533 bool presenceOfMultiDiscPerGeoType() const;
2534 int getNumberOfComponents() const;
2535 int getNumberOfTS() const;
2536 void eraseEmptyTS();
2537 int getPosOfTimeStep(int iteration, int order) const;
2538 int getPosGivenTime(double time, double eps=1e-8) const;
2540 void loadArraysIfNecessary();
2541 void unloadArrays();
2542 void unloadArraysWithoutDataLoss();
2544 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2545 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2546 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2547 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2548 void synchronizeNameScope();
2549 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2554 return self->getNumberOfTS();
2557 int getTimeId(PyObject *elt0) const
2559 if(elt0 && PyInt_Check(elt0))
2561 int pos=(int)PyInt_AS_LONG(elt0);
2564 else if(elt0 && PyTuple_Check(elt0))
2566 if(PyTuple_Size(elt0)==2)
2568 PyObject *o0=PyTuple_GetItem(elt0,0);
2569 PyObject *o1=PyTuple_GetItem(elt0,1);
2570 if(PyInt_Check(o0) && PyInt_Check(o1))
2572 int iter=(int)PyInt_AS_LONG(o0);
2573 int order=(int)PyInt_AS_LONG(o1);
2574 return self->getPosOfTimeStep(iter,order);
2577 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 !");
2580 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 !");
2582 else if(elt0 && PyFloat_Check(elt0))
2584 double val=PyFloat_AS_DOUBLE(elt0);
2585 return self->getPosGivenTime(val);
2588 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2591 PyObject *getIterations() const
2593 std::vector< std::pair<int,int> > res(self->getIterations());
2594 return convertVecPairIntToPy(res);
2597 PyObject *getTimeSteps() const
2599 std::vector<double> ret1;
2600 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2601 std::size_t sz=ret.size();
2602 PyObject *ret2=PyList_New(sz);
2603 for(std::size_t i=0;i<sz;i++)
2605 PyObject *elt=PyTuple_New(3);
2606 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2607 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2608 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2609 PyList_SetItem(ret2,i,elt);
2614 PyObject *getTypesOfFieldAvailable() const
2616 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2617 PyObject *ret2=PyList_New(ret.size());
2618 for(int i=0;i<(int)ret.size();i++)
2620 const std::vector<TypeOfField>& rett=ret[i];
2621 PyObject *ret3=PyList_New(rett.size());
2622 for(int j=0;j<(int)rett.size();j++)
2623 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2624 PyList_SetItem(ret2,i,ret3);
2629 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2631 std::vector<int> ret1;
2632 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2633 PyObject *elt=PyTuple_New(2);
2634 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2635 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2639 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2641 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2642 std::vector< std::vector<TypeOfField> > typesF;
2643 std::vector< std::vector<std::string> > pfls;
2644 std::vector< std::vector<std::string> > locs;
2645 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2646 std::size_t sz=ret.size();
2647 PyObject *ret2=PyList_New(sz);
2648 for(std::size_t i=0;i<sz;i++)
2650 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2651 const std::vector<TypeOfField>& typesFI=typesF[i];
2652 const std::vector<std::string>& pflsI=pfls[i];
2653 const std::vector<std::string>& locsI=locs[i];
2654 PyObject *elt=PyTuple_New(2);
2655 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2656 std::size_t sz2=ret[i].size();
2657 PyObject *elt2=PyList_New(sz2);
2658 for(std::size_t j=0;j<sz2;j++)
2660 PyObject *elt3=PyTuple_New(4);
2661 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2662 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2663 PyTuple_SetItem(elt3,1,elt4);
2664 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2665 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2666 PyList_SetItem(elt2,j,elt3);
2668 PyTuple_SetItem(elt,1,elt2);
2669 PyList_SetItem(ret2,i,elt);
2674 std::vector<int> getTimeIds(PyObject *elts) const
2676 if(PyList_Check(elts))
2678 std::size_t sz=PyList_Size(elts);
2679 std::vector<int> ret(sz);
2680 for(std::size_t i=0;i<sz;i++)
2682 PyObject *elt=PyList_GetItem(elts,i);
2683 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2689 std::vector<int> ret(1);
2690 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2695 void __delitem__(PyObject *elts)
2697 if(PySlice_Check(elts))
2699 Py_ssize_t strt=2,stp=2,step=2;
2700 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2701 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2705 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2706 if(!idsToRemove.empty())
2707 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2711 void eraseTimeStepIds(PyObject *li)
2715 std::vector<int> pos2;
2716 DataArrayInt32 *pos3=0;
2717 DataArrayIntTuple *pos4=0;
2718 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2723 self->eraseTimeStepIds(&pos1,&pos1+1);
2730 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2735 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2739 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2743 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2745 return self->iterator();
2748 PyObject *__getitem__(PyObject *elt0) const
2750 if(elt0 && PyList_Check(elt0))
2752 std::size_t sz=PyList_Size(elt0);
2753 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2754 int *pt=da->getPointer();
2755 for(std::size_t i=0;i<sz;i++,pt++)
2757 PyObject *elt1=PyList_GetItem(elt0,i);
2758 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2760 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2762 else if(elt0 && PySlice_Check(elt0))
2764 Py_ssize_t strt=2,stp=2,step=2;
2765 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2766 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2769 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2772 bool changeMeshNames(PyObject *li)
2774 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2775 return self->changeMeshNames(modifTab);
2778 PyObject *splitComponents() const
2780 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2781 std::size_t sz=ret.size();
2782 PyObject *retPy=PyList_New(sz);
2783 for(std::size_t i=0;i<sz;i++)
2784 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2788 PyObject *splitDiscretizations() const
2790 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2791 std::size_t sz=ret.size();
2792 PyObject *retPy=PyList_New(sz);
2793 for(std::size_t i=0;i<sz;i++)
2794 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2798 PyObject *splitMultiDiscrPerGeoTypes() const
2800 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2801 std::size_t sz=ret.size();
2802 PyObject *retPy=PyList_New(sz);
2803 for(std::size_t i=0;i<sz;i++)
2804 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2808 void pushBackTimeSteps(PyObject *li)
2811 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2812 if(SWIG_IsOK(status))
2814 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2818 std::vector<MEDFileAnyTypeField1TS *> tmp;
2819 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2820 self->pushBackTimeSteps(tmp);
2824 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2826 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2827 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2828 return self->extractPart(extractDefCpp,mm);
2831 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2833 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2834 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2835 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2836 std::size_t sz=ret.size();
2837 PyObject *retPy=PyList_New(sz);
2838 for(std::size_t i=0;i<sz;i++)
2840 std::size_t sz2=ret[i].size();
2841 PyObject *ret1Py=PyList_New(sz2);
2842 for(std::size_t j=0;j<sz2;j++)
2844 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2847 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2849 PyList_SetItem(retPy,i,ret1Py);
2854 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2856 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2857 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2858 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2859 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2860 if(ret2.size()!=ret.size())
2862 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2863 throw INTERP_KERNEL::Exception(oss.str().c_str());
2865 std::size_t sz=ret.size();
2866 PyObject *retPy=PyList_New(sz);
2867 for(std::size_t i=0;i<sz;i++)
2869 std::size_t sz2=ret[i].size();
2870 PyObject *ret0Py=PyTuple_New(2);
2871 PyObject *ret1Py=PyList_New(sz2);
2872 for(std::size_t j=0;j<sz2;j++)
2874 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2877 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2879 PyTuple_SetItem(ret0Py,0,ret1Py);
2880 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2881 PyList_SetItem(retPy,i,ret0Py);
2888 class MEDFileIntFieldMultiTS;
2890 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2893 static MEDFileFieldMultiTS *New();
2894 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2895 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2896 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2898 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2899 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2900 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2901 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2902 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2903 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2905 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2906 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2907 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2910 MEDFileFieldMultiTS()
2912 return MEDFileFieldMultiTS::New();
2915 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2917 return MEDFileFieldMultiTS::New(fileName,loadAll);
2920 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2922 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2925 MEDFileFieldMultiTS(DataArrayByte *db)
2927 return MEDFileFieldMultiTS::New(db);
2930 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2932 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2933 std::size_t sz(tmp.size());
2934 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2935 for(std::size_t i=0;i<sz;i++)
2937 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2938 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2940 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2943 std::string __str__() const
2945 return self->simpleRepr();
2948 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2950 DataArrayIdType *ret1=0;
2951 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2952 PyObject *ret=PyTuple_New(2);
2953 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2954 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2958 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2960 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2961 std::vector< std::vector<TypeOfField> > typesF;
2962 std::vector< std::vector<std::string> > pfls;
2963 std::vector< std::vector<std::string> > locs;
2964 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2965 std::size_t sz=ret.size();
2966 PyObject *ret2=PyList_New(sz);
2967 for(std::size_t i=0;i<sz;i++)
2969 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2970 const std::vector<TypeOfField>& typesFI=typesF[i];
2971 const std::vector<std::string>& pflsI=pfls[i];
2972 const std::vector<std::string>& locsI=locs[i];
2973 PyObject *elt=PyTuple_New(2);
2974 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2975 std::size_t sz2=ret[i].size();
2976 PyObject *elt2=PyList_New(sz2);
2977 for(std::size_t j=0;j<sz2;j++)
2979 PyObject *elt3=PyTuple_New(4);
2980 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2981 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2982 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2983 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2984 PyList_SetItem(elt2,j,elt3);
2986 PyTuple_SetItem(elt,1,elt2);
2987 PyList_SetItem(ret2,i,elt);
2991 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
2993 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2999 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3001 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3002 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3005 PyObject *ret=PyTuple_New(2);
3006 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3007 std::size_t sz=elt1Cpp.size();
3008 PyObject *elt=PyList_New(sz);
3009 for(std::size_t i=0;i<sz;i++)
3011 PyObject *elt1=PyTuple_New(2);
3012 PyObject *elt2=PyTuple_New(2);
3013 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3014 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3015 PyObject *elt3=PyTuple_New(2);
3016 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3017 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3018 PyTuple_SetItem(elt1,0,elt2);
3019 PyTuple_SetItem(elt1,1,elt3);
3020 PyList_SetItem(elt,i,elt1);
3022 PyTuple_SetItem(ret,1,elt);
3028 class MEDFileFieldsIterator
3035 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3037 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3040 PyErr_SetString(PyExc_StopIteration,"No more data.");
3047 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3050 static MEDFileIntFieldMultiTS *New();
3051 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3052 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3053 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3055 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3056 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3057 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3058 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3059 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3060 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3061 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3062 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3063 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3066 MEDFileIntFieldMultiTS()
3068 return MEDFileIntFieldMultiTS::New();
3071 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3073 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3076 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3078 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3081 MEDFileIntFieldMultiTS(DataArrayByte *db)
3083 return MEDFileIntFieldMultiTS::New(db);
3086 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3088 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3089 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3090 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3093 std::string __str__() const
3095 return self->simpleRepr();
3098 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3100 DataArrayIdType *ret1=0;
3101 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3102 PyObject *ret=PyTuple_New(2);
3103 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
3104 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3108 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3110 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3118 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3121 static MEDFileFloatFieldMultiTS *New();
3122 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3123 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3124 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3126 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3127 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3128 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3129 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3130 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3131 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3132 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3133 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3134 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3137 MEDFileFloatFieldMultiTS()
3139 return MEDFileFloatFieldMultiTS::New();
3142 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3144 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3147 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3149 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3152 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3154 return MEDFileFloatFieldMultiTS::New(db);
3157 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3159 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3160 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3161 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3164 std::string __str__() const
3166 return self->simpleRepr();
3169 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3171 DataArrayIdType *ret1=0;
3172 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3173 PyObject *ret=PyTuple_New(2);
3174 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3175 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3179 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3181 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3189 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3192 static MEDFileMeshSupports *New(const std::string& fileName);
3193 std::vector<std::string> getSupMeshNames() const;
3196 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3198 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3199 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3207 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3210 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3212 MEDFileStructureElements();
3215 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3218 static MEDFileFields *New();
3219 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3220 static MEDFileFields *New(DataArrayByte *db);
3221 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3222 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3223 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3224 MEDFileFields *deepCopy() const;
3225 MEDFileFields *shallowCpy() const;
3227 void loadArraysIfNecessary();
3228 void unloadArrays();
3229 void unloadArraysWithoutDataLoss();
3230 int getNumberOfFields() const;
3231 std::vector<std::string> getFieldsNames() const;
3232 std::vector<std::string> getMeshesNames() const;
3234 void resize(int newSize);
3235 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3236 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3237 int getPosFromFieldName(const std::string& fieldName) const;
3238 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3239 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3240 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3241 bool presenceOfStructureElements() const;
3242 void aggregate(const MEDFileFields& other);
3243 void killStructureElements();
3244 void keepOnlyStructureElements();
3245 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3246 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3247 void destroyFieldAtPos(int i);
3248 bool removeFieldsWithoutAnyTimeStep();
3253 return MEDFileFields::New();
3256 MEDFileFields(const std::string& fileName, bool loadAll=true)
3258 return MEDFileFields::New(fileName,loadAll);
3261 MEDFileFields(DataArrayByte *db)
3263 return MEDFileFields::New(db);
3266 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3268 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3271 std::string __str__() const
3273 return self->simpleRepr();
3276 MEDFileFields *partOfThisOnStructureElements() const
3278 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3282 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3284 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3288 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3290 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3291 std::size_t sz(tmp.size());
3292 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3293 for(std::size_t i=0;i<sz;i++)
3295 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3296 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3298 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3301 PyObject *getMeshSENames() const
3303 std::vector< std::pair<std::string,std::string> > ps;
3304 self->getMeshSENames(ps);
3305 return convertVectPairStToPy(ps);
3308 PyObject *getCommonIterations() const
3311 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3312 PyObject *ret=PyTuple_New(2);
3313 PyObject *ret_0=PyList_New(ret0.size());
3315 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3317 PyObject *elt=PyTuple_New(2);
3318 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3319 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3320 PyList_SetItem(ret_0,rk,elt);
3322 PyTuple_SetItem(ret,0,ret_0);
3323 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3324 PyTuple_SetItem(ret,1,ret_1);
3328 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3330 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3331 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3334 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3336 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3337 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3340 PyObject *__getitem__(PyObject *obj)
3342 if(obj && PyList_Check(obj))
3344 std::size_t sz=PyList_Size(obj);
3345 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3346 int *pt=da->getPointer();
3347 for(std::size_t i=0;i<sz;i++,pt++)
3349 PyObject *elt1=PyList_GetItem(obj,i);
3350 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3352 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3355 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3358 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3360 self->setFieldAtPos(obj,field);
3366 return self->getNumberOfFields();
3369 MEDFileFieldsIterator *__iter__()
3371 return self->iterator();
3374 bool changeMeshNames(PyObject *li)
3376 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3377 return self->changeMeshNames(modifTab);
3380 int getPosOfField(PyObject *elt0) const
3382 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3384 throw INTERP_KERNEL::Exception(msg);
3385 if(PyInt_Check(elt0))
3387 return (int)PyInt_AS_LONG(elt0);
3389 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3392 std::vector<int> getPosOfFields(PyObject *elts) const
3394 if(PyList_Check(elts))
3396 std::size_t sz=PyList_Size(elts);
3397 std::vector<int> ret(sz);
3398 for(std::size_t i=0;i<sz;i++)
3400 PyObject *elt=PyList_GetItem(elts,i);
3401 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3407 std::vector<int> ret(1);
3408 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3413 void pushFields(PyObject *fields)
3415 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3416 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3417 self->pushFields(tmp);
3420 void __delitem__(PyObject *elts)
3422 if(elts && PySlice_Check(elts))
3424 Py_ssize_t strt=2,stp=2,step=2;
3425 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3426 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3430 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3431 if(!idsToRemove.empty())
3432 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3436 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3438 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3439 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3440 return self->extractPart(extractDefCpp,mm);
3443 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3445 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3451 class MEDFileParameter1TS : public RefCountObject
3454 void setIteration(int it);
3455 int getIteration() const;
3456 void setOrder(int order);
3457 int getOrder() const;
3458 void setTimeValue(double time);
3459 void setTime(int dt, int it, double time);
3460 double getTime(int& dt, int& it);
3461 double getTimeValue() const;
3464 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3467 void setValue(double val);
3468 double getValue() const;
3469 std::string simpleRepr() const;
3472 std::string __str__() const
3474 return self->simpleRepr();
3479 class MEDFileParameterTinyInfo : public MEDFileWritable
3482 void setDescription(const std::string& name);
3483 std::string getDescription() const;
3484 void setTimeUnit(const std::string& unit);
3485 std::string getTimeUnit() const;
3488 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3491 static MEDFileParameterDouble1TS *New();
3492 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3493 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3494 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3495 virtual MEDFileParameter1TS *deepCopy() const;
3496 virtual std::string simpleRepr() const;
3497 void setName(const std::string& name);
3498 std::string getName() const;
3499 void write(const std::string& fileName, int mode) const;
3502 MEDFileParameterDouble1TS()
3504 return MEDFileParameterDouble1TS::New();
3507 MEDFileParameterDouble1TS(const std::string& fileName)
3509 return MEDFileParameterDouble1TS::New(fileName);
3512 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3514 return MEDFileParameterDouble1TS::New(fileName,paramName);
3517 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3519 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3522 std::string __str__() const
3524 return self->simpleRepr();
3527 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3530 bool ret0=self->isEqual(other,eps,what);
3531 PyObject *res=PyList_New(2);
3532 PyObject *ret0Py=ret0?Py_True:Py_False;
3534 PyList_SetItem(res,0,ret0Py);
3535 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3541 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3544 static MEDFileParameterMultiTS *New();
3545 static MEDFileParameterMultiTS *New(const std::string& fileName);
3546 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3547 std::string getName() const;
3548 void setName(const std::string& name);
3549 MEDFileParameterMultiTS *deepCopy() const;
3550 void write(const std::string& fileName, int mode) const;
3551 std::string simpleRepr() const;
3552 void appendValue(int dt, int it, double time, double val);
3553 double getDoubleValue(int iteration, int order) const;
3554 int getPosOfTimeStep(int iteration, int order) const;
3555 int getPosGivenTime(double time, double eps=1e-8) const;
3556 int getNumberOfTS() const;
3559 MEDFileParameterMultiTS()
3561 return MEDFileParameterMultiTS::New();
3564 MEDFileParameterMultiTS(const std::string& fileName)
3566 return MEDFileParameterMultiTS::New(fileName);
3569 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3571 return MEDFileParameterMultiTS::New(fileName,paramName);
3574 std::string __str__() const
3576 return self->simpleRepr();
3579 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3582 bool ret0=self->isEqual(other,eps,what);
3583 PyObject *res=PyList_New(2);
3584 PyObject *ret0Py=ret0?Py_True:Py_False;
3586 PyList_SetItem(res,0,ret0Py);
3587 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3591 void eraseTimeStepIds(PyObject *ids)
3595 std::vector<int> pos2;
3596 DataArrayInt *pos3=0;
3597 DataArrayIntTuple *pos4=0;
3598 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3603 self->eraseTimeStepIds(&pos1,&pos1+1);
3610 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3615 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3619 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3623 int getTimeStepId(PyObject *elt0) const
3625 if(elt0 && PyInt_Check(elt0))
3627 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3630 else if(elt0 && PyTuple_Check(elt0))
3632 if(PyTuple_Size(elt0)==2)
3634 PyObject *o0=PyTuple_GetItem(elt0,0);
3635 PyObject *o1=PyTuple_GetItem(elt0,1);
3636 if(PyInt_Check(o0) && PyInt_Check(o1))
3638 int iter=(int)PyInt_AS_LONG(o0);
3639 int order=(int)PyInt_AS_LONG(o1);
3640 return self->getPosOfTimeStep(iter,order);
3643 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 !");
3646 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 !");
3648 else if(elt0 && PyFloat_Check(elt0))
3650 double val=PyFloat_AS_DOUBLE(elt0);
3651 return self->getPosGivenTime(val);
3654 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3657 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3659 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3665 std::vector<int> getTimeStepIds(PyObject *elts) const
3667 if(PyList_Check(elts))
3669 std::size_t sz=PyList_Size(elts);
3670 std::vector<int> ret(sz);
3671 for(std::size_t i=0;i<sz;i++)
3673 PyObject *elt=PyList_GetItem(elts,i);
3674 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3680 std::vector<int> ret(1);
3681 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3686 void __delitem__(PyObject *elts)
3688 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3689 if(!idsToRemove.empty())
3690 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3693 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3695 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3701 PyObject *getIterations() const
3703 std::vector< std::pair<int,int> > res=self->getIterations();
3704 PyObject *ret=PyList_New(res.size());
3706 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3708 PyObject *elt=PyTuple_New(2);
3709 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3710 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3711 PyList_SetItem(ret,rk,elt);
3716 PyObject *getTimeSteps() const
3718 std::vector<double> res2;
3719 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3720 PyObject *ret=PyList_New(res.size());
3722 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3724 PyObject *elt=PyTuple_New(3);
3725 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3726 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3727 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3728 PyList_SetItem(ret,rk,elt);
3735 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3738 static MEDFileParameters *New();
3739 static MEDFileParameters *New(const std::string& fileName);
3740 static MEDFileParameters *New(DataArrayByte *db);
3741 MEDFileParameters *deepCopy() const;
3742 std::vector<std::string> getParamsNames() const;
3743 std::string simpleRepr() const;
3744 void resize(int newSize);
3745 void pushParam(MEDFileParameterMultiTS *param);
3746 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3747 void destroyParamAtPos(int i);
3748 int getPosFromParamName(const std::string& paramName) const;
3749 int getNumberOfParams() const;
3754 return MEDFileParameters::New();
3757 MEDFileParameters(const std::string& fileName)
3759 return MEDFileParameters::New(fileName);
3762 MEDFileParameters(DataArrayByte *db)
3764 return MEDFileParameters::New(db);
3767 std::string __str__() const
3769 return self->simpleRepr();
3772 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3774 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3775 if(PyInt_Check(obj))
3777 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3782 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3790 return self->getNumberOfParams();
3793 MEDFileParameterMultiTS *getParamAtPos(int i) const
3795 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3801 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3803 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3809 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3812 bool ret0=self->isEqual(other,eps,what);
3813 PyObject *res=PyList_New(2);
3814 PyObject *ret0Py=ret0?Py_True:Py_False;
3816 PyList_SetItem(res,0,ret0Py);
3817 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3823 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3826 static MEDFileData *New(DataArrayByte *db);
3827 static MEDFileData *New(const std::string& fileName);
3828 static MEDFileData *New();
3829 MEDFileData *deepCopy() const;
3830 void setFields(MEDFileFields *fields);
3831 void setMeshes(MEDFileMeshes *meshes);
3832 void setParams(MEDFileParameters *params);
3833 int getNumberOfFields() const;
3834 int getNumberOfMeshes() const;
3835 int getNumberOfParams() const;
3837 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3838 bool unPolyzeMeshes();
3839 void dealWithStructureElements();
3840 std::string getHeader() const;
3841 void setHeader(const std::string& header);
3845 MEDFileData(const std::string& fileName)
3847 return MEDFileData::New(fileName);
3850 MEDFileData(DataArrayByte *db)
3852 return MEDFileData::New(db);
3857 return MEDFileData::New();
3860 std::string __str__() const
3862 return self->simpleRepr();
3865 MEDFileMeshes *getMeshes() const
3867 MEDFileMeshes *ret=self->getMeshes();
3873 MEDFileParameters *getParams() const
3875 MEDFileParameters *ret=self->getParams();
3881 MEDFileFields *getFields() const
3883 MEDFileFields *ret=self->getFields();
3889 bool changeMeshNames(PyObject *li)
3891 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3892 return self->changeMeshNames(modifTab);
3895 static MEDFileData *Aggregate(PyObject *mfds)
3897 std::vector<const MEDFileData *> mfdsCpp;
3898 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3899 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3905 class SauvReader : public RefCountObject
3908 static SauvReader* New(const std::string& fileName);
3909 MEDFileData * loadInMEDFileDS();
3912 SauvReader(const std::string& fileName)
3914 return SauvReader::New(fileName);
3919 class SauvWriter : public RefCountObject
3922 static SauvWriter * New();
3923 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3924 void write(const std::string& fileName);
3925 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3926 bool getCpyGrpIfOnASingleFamilyStatus() const;
3931 return SauvWriter::New();
3938 class MEDFileMeshStruct;
3940 class MEDFileField1TSStructItem
3943 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3946 class MEDFileMeshStruct : public RefCountObject
3949 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3951 ~MEDFileMeshStruct();
3954 class MEDMeshMultiLev : public RefCountObject
3957 virtual MEDMeshMultiLev *prepare() const;
3958 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3959 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
3965 PyObject *retrieveFamilyIdsOnCells() const
3967 DataArrayIdType *famIds(0);
3968 bool isWithoutCopy(false);
3969 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3970 PyObject *ret=PyTuple_New(2);
3971 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3973 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3974 PyTuple_SetItem(ret,1,ret1Py);
3978 PyObject *retrieveNumberIdsOnCells() const
3980 DataArrayIdType *numIds(0);
3981 bool isWithoutCopy(false);
3982 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3983 PyObject *ret=PyTuple_New(2);
3984 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3987 PyTuple_SetItem(ret,1,ret1Py);
3991 PyObject *retrieveFamilyIdsOnNodes() const
3993 DataArrayIdType *famIds(0);
3994 bool isWithoutCopy(false);
3995 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3996 PyObject *ret=PyTuple_New(2);
3997 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3999 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4000 PyTuple_SetItem(ret,1,ret1Py);
4004 PyObject *retrieveNumberIdsOnNodes() const
4006 DataArrayIdType *numIds(0);
4007 bool isWithoutCopy(false);
4008 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4009 PyObject *ret=PyTuple_New(2);
4010 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4012 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4013 PyTuple_SetItem(ret,1,ret1Py);
4017 PyObject *getGeoTypes() const
4019 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4020 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4021 PyObject *res(PyList_New(result.size()));
4022 for(int i=0;iL!=result.end(); i++, iL++)
4023 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4029 class MEDUMeshMultiLev : public MEDMeshMultiLev
4032 ~MEDUMeshMultiLev();
4036 PyObject *buildVTUArrays() const
4038 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4039 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4040 PyObject *ret0Py=ncc?Py_True:Py_False;
4042 PyObject *ret=PyTuple_New(7);
4043 PyTuple_SetItem(ret,0,ret0Py);
4044 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4045 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4046 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4047 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4048 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4049 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4055 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4058 ~MEDStructuredMeshMultiLev();
4061 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4064 ~MEDCMeshMultiLev();
4068 PyObject *buildVTUArrays() const
4071 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4072 std::size_t sz(objs.size());
4073 PyObject *ret(PyTuple_New(2));
4074 PyObject *ret0=PyList_New(sz);
4075 for(std::size_t i=0;i<sz;i++)
4076 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4077 PyTuple_SetItem(ret,0,ret0);
4078 PyObject *ret1Py(isInternal?Py_True:Py_False);
4080 PyTuple_SetItem(ret,1,ret1Py);
4086 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4089 ~MEDCurveLinearMeshMultiLev();
4093 PyObject *buildVTUArrays() const
4095 DataArrayDouble *ret0(0);
4096 std::vector<mcIdType> ret1;
4098 self->buildVTUArrays(ret0,ret1,ret2);
4099 std::size_t sz(ret1.size());
4100 PyObject *ret=PyTuple_New(3);
4101 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4102 PyObject *ret1Py=PyList_New(sz);
4103 for(std::size_t i=0;i<sz;i++)
4104 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4105 PyTuple_SetItem(ret,1,ret1Py);
4106 PyObject *ret2Py(ret2?Py_True:Py_False);
4108 PyTuple_SetItem(ret,2,ret2Py);
4114 class MEDFileFastCellSupportComparator : public RefCountObject
4117 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4118 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4119 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4120 int getNumberOfTS() const;
4122 ~MEDFileFastCellSupportComparator();
4126 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4128 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4129 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4130 PyObject *res(PyList_New(result.size()));
4131 for(int i=0;iL!=result.end(); i++, iL++)
4132 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4143 def exit1TS(self, exctype, exc, tb):
4146 MEDFileAnyTypeField1TS.__enter__=enter1TS
4147 MEDFileAnyTypeField1TS.__exit__=exit1TS