1 // Copyright (C) 2017-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #define MEDCOUPLING_EXPORT
22 #define MEDLOADER_EXPORT
24 #ifdef WITH_DOCSTRINGS
25 %include "MEDLoader_doc.i"
28 %include "MEDCouplingCommon.i"
31 #include "MEDLoader.hxx"
32 #include "MEDFileJoint.hxx"
33 #include "MEDFileMesh.hxx"
34 #include "MEDFileField.hxx"
35 #include "MEDFileParameter.hxx"
36 #include "MEDFileData.hxx"
37 #include "MEDFileEquivalence.hxx"
38 #include "MEDFileEntities.hxx"
39 #include "MEDFileMeshReadSelector.hxx"
40 #include "MEDFileFieldOverView.hxx"
41 #include "MEDCouplingTypemaps.i"
42 #include "MEDLoaderTypemaps.i"
43 #include "SauvReader.hxx"
44 #include "SauvWriter.hxx"
46 using namespace MEDCoupling;
49 #if SWIG_VERSION >= 0x010329
50 %template() std::vector<std::string>;
53 %typemap(out) MEDCoupling::MEDFileMesh*
55 $result=convertMEDFileMesh($1,$owner);
58 %typemap(out) MEDCoupling::MEDFileParameter1TS*
60 $result=convertMEDFileParameter1TS($1,$owner);
63 %typemap(out) MEDCoupling::MEDFileAnyTypeFieldMultiTS*
65 $result=convertMEDFileFieldMultiTS($1,$owner);
68 %typemap(out) MEDCoupling::MEDFileAnyTypeField1TS*
70 $result=convertMEDFileField1TS($1,$owner);
73 %typemap(out) MEDCoupling::MEDMeshMultiLev*
75 $result=convertMEDMeshMultiLev($1,$owner);
78 %newobject ReadUMeshFromFamiliesSwig;
79 %newobject ReadUMeshFromGroupsSwig;
80 %newobject ReadFieldSwig;
81 %newobject MEDCoupling::ReadUMeshFromFile;
82 %newobject MEDCoupling::ReadMeshFromFile;
83 %newobject MEDCoupling::ReadFieldCell;
84 %newobject MEDCoupling::ReadFieldNode;
85 %newobject MEDCoupling::ReadFieldGauss;
86 %newobject MEDCoupling::ReadFieldGaussNE;
87 %newobject MEDCoupling::MEDFileMesh::New;
88 %newobject MEDCoupling::MEDFileMesh::createNewEmpty;
89 %newobject MEDCoupling::MEDFileMesh::deepCopy;
90 %newobject MEDCoupling::MEDFileMesh::shallowCpy;
91 %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel;
92 %newobject MEDCoupling::MEDFileMesh::__getitem__;
93 %newobject MEDCoupling::MEDFileMesh::getGroupArr;
94 %newobject MEDCoupling::MEDFileMesh::getGroupsArr;
95 %newobject MEDCoupling::MEDFileMesh::getFamilyArr;
96 %newobject MEDCoupling::MEDFileMesh::getFamiliesArr;
97 %newobject MEDCoupling::MEDFileMesh::getNodeGroupArr;
98 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
99 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
100 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
101 %newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
102 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
103 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
104 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
105 %newobject MEDCoupling::MEDFileMesh::cartesianize;
106 %newobject MEDCoupling::MEDFileData::getJoints;
107 %newobject MEDCoupling::MEDFileStructuredMesh::getImplicitFaceMesh;
108 %newobject MEDCoupling::MEDFileUMesh::New;
109 %newobject MEDCoupling::MEDFileUMesh::LoadPartOf;
110 %newobject MEDCoupling::MEDFileUMesh::getCoords;
111 %newobject MEDCoupling::MEDFileUMesh::getPartDefAtLevel;
112 %newobject MEDCoupling::MEDFileUMesh::getGroup;
113 %newobject MEDCoupling::MEDFileUMesh::getGroups;
114 %newobject MEDCoupling::MEDFileUMesh::getFamily;
115 %newobject MEDCoupling::MEDFileUMesh::getFamilies;
116 %newobject MEDCoupling::MEDFileUMesh::getLevel0Mesh;
117 %newobject MEDCoupling::MEDFileUMesh::getLevelM1Mesh;
118 %newobject MEDCoupling::MEDFileUMesh::getLevelM2Mesh;
119 %newobject MEDCoupling::MEDFileUMesh::getLevelM3Mesh;
120 %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
121 %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType;
122 %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType;
123 %newobject MEDCoupling::MEDFileUMesh::computeFetchedNodeIds;
124 %newobject MEDCoupling::MEDFileUMesh::zipCoords;
125 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
126 %newobject MEDCoupling::MEDFileUMesh::extractPart;
127 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
128 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
129 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
130 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
131 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
132 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
133 %newobject MEDCoupling::MEDFileCMesh::New;
134 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
135 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
136 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
137 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
138 %newobject MEDCoupling::MEDFileMeshes::New;
139 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
140 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
141 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
142 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
143 %newobject MEDCoupling::MEDFileMeshes::__iter__;
145 %newobject MEDCoupling::MEDFileMeshSupports::New;
146 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
148 %newobject MEDCoupling::MEDFileStructureElements::New;
150 %newobject MEDCoupling::MEDFileFields::New;
151 %newobject MEDCoupling::MEDFileFields::NewAdv;
152 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
153 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
154 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
155 %newobject MEDCoupling::MEDFileFields::deepCopy;
156 %newobject MEDCoupling::MEDFileFields::shallowCpy;
157 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
158 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
159 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
160 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
161 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
162 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
163 %newobject MEDCoupling::MEDFileFields::__iter__;
164 %newobject MEDCoupling::MEDFileFields::extractPart;
165 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
167 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
168 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
169 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
175 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
176 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
177 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
178 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
184 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
185 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
187 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::New;
188 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::field;
189 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::LoadSpecificEntities;
190 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getUndergroundDataArray;
191 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::convertToDouble;
192 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevel;
193 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtTopLevel;
194 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldOnMeshAtLevel;
195 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevelOld;
197 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::New;
198 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::field;
199 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::LoadSpecificEntities;
200 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getUndergroundDataArray;
201 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::convertToDouble;
202 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevel;
203 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtTopLevel;
204 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldOnMeshAtLevel;
205 %newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevelOld;
207 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
208 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
209 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
210 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
211 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
212 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
213 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
214 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
215 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
217 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
218 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
219 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
220 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
221 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
222 %newobject MEDCoupling::MEDFileField1TS::New;
223 %newobject MEDCoupling::MEDFileField1TS::field;
224 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
225 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
226 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
227 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
228 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
229 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
231 %newobject MEDCoupling::MEDFileInt32Field1TS::New;
232 %newobject MEDCoupling::MEDFileInt32Field1TS::field;
233 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevel;
234 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtTopLevel;
235 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldOnMeshAtLevel;
236 %newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevelOld;
237 %newobject MEDCoupling::MEDFileInt32Field1TS::getUndergroundDataArray;
238 %newobject MEDCoupling::MEDFileInt32Field1TS::convertToDouble;
240 %newobject MEDCoupling::MEDFileInt64Field1TS::New;
241 %newobject MEDCoupling::MEDFileInt64Field1TS::field;
242 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevel;
243 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtTopLevel;
244 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldOnMeshAtLevel;
245 %newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevelOld;
246 %newobject MEDCoupling::MEDFileInt64Field1TS::getUndergroundDataArray;
247 %newobject MEDCoupling::MEDFileInt64Field1TS::convertToDouble;
249 %newobject MEDCoupling::MEDFileFloatField1TS::New;
250 %newobject MEDCoupling::MEDFileFloatField1TS::field;
251 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
252 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
253 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
254 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
255 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
256 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
258 %newobject MEDCoupling::MEDFileData::New;
259 %newobject MEDCoupling::MEDFileData::deepCopy;
260 %newobject MEDCoupling::MEDFileData::getMeshes;
261 %newobject MEDCoupling::MEDFileData::getFields;
262 %newobject MEDCoupling::MEDFileData::getParams;
263 %newobject MEDCoupling::MEDFileData::Aggregate;
265 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
267 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
268 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
269 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
270 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
271 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
272 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
273 %newobject MEDCoupling::MEDFileParameters::New;
274 %newobject MEDCoupling::MEDFileParameters::deepCopy;
275 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
276 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
277 %newobject MEDCoupling::MEDFileParameters::__getitem__;
279 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
280 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
281 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
282 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
283 %newobject MEDCoupling::MEDFileJointOneStep::New;
284 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
285 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
286 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
287 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
288 %newobject MEDCoupling::MEDFileJoint::New;
289 %newobject MEDCoupling::MEDFileJoint::deepCopy;
290 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
291 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
292 %newobject MEDCoupling::MEDFileJoint::__getitem__;
293 %newobject MEDCoupling::MEDFileJoints::New;
294 %newobject MEDCoupling::MEDFileJoints::deepCopy;
295 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
296 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
297 %newobject MEDCoupling::MEDFileJoints::__getitem__;
298 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
299 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
300 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
301 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
302 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
303 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
304 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
305 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
306 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
308 %newobject MEDCoupling::SauvWriter::New;
309 %newobject MEDCoupling::SauvReader::New;
310 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
312 %newobject MEDCoupling::MEDFileMeshStruct::New;
313 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
314 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
315 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
316 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
317 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
319 %feature("unref") MEDFileMesh "$this->decrRef();"
320 %feature("unref") MEDFileUMesh "$this->decrRef();"
321 %feature("unref") MEDFileCMesh "$this->decrRef();"
322 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
323 %feature("unref") MEDFileMeshes "$this->decrRef();"
324 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
325 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
326 %feature("unref") MEDFileField1TS "$this->decrRef();"
327 %feature("unref") MEDFileInt32Field1TS "$this->decrRef();"
328 %feature("unref") MEDFileInt64Field1TS "$this->decrRef();"
329 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
330 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
331 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
332 %feature("unref") MEDFileInt32FieldMultiTS "$this->decrRef();"
333 %feature("unref") MEDFileInt64FieldMultiTS "$this->decrRef();"
334 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
335 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
336 %feature("unref") MEDFileStructureElements "$this->decrRef();"
337 %feature("unref") MEDFileFields "$this->decrRef();"
338 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
339 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
340 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
341 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
342 %feature("unref") MEDFileParameters "$this->decrRef();"
343 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
344 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
345 %feature("unref") MEDFileJoint "$this->decrRef();"
346 %feature("unref") MEDFileJoints "$this->decrRef();"
347 %feature("unref") MEDFileEquivalences "$this->decrRef();"
348 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
349 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
350 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
351 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
352 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
353 %feature("unref") MEDFileData "$this->decrRef();"
354 %feature("unref") SauvReader "$this->decrRef();"
355 %feature("unref") SauvWriter "$this->decrRef();"
356 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
357 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
358 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
359 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
360 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
361 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
363 namespace MEDCoupling
366 std::string MEDFileVersionStr();
367 std::string MEDFileVersionOfFileStr(const std::string& fileName);
368 void SetEpsilonForNodeComp(double val);
369 void SetCompPolicyForCell(int val);
370 void SetTooLongStrPolicy(int val);
371 void CheckFileForRead(const std::string& fileName);
372 std::vector<std::string> GetMeshNames(const std::string& fileName);
373 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
374 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
375 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
376 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
377 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
378 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
379 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
380 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
381 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
382 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
383 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
384 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
385 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
386 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
387 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
388 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
389 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
390 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
391 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
392 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
393 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
394 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
395 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
396 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
397 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
398 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
399 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
402 %rename (MEDFileVersion) MEDFileVersionSwig;
403 %rename (GetFieldIterations) GetFieldIterationsSwig;
404 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
405 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
406 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
407 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
408 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
409 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
410 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
411 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
412 %rename (WriteUMeshes) WriteUMeshesSwig;
413 %rename (GetTypesOfField) GetTypesOfFieldSwig;
414 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
415 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
416 %rename (ReadField) ReadFieldSwig;
417 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
421 PyObject *MEDFileVersionSwig()
423 int major,minor,release;
424 MEDCoupling::MEDFileVersion(major,minor,release);
425 PyObject *ret(PyTuple_New(3));
426 PyTuple_SetItem(ret,0,SWIG_From_int(major));
427 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
428 PyTuple_SetItem(ret,2,SWIG_From_int(release));
432 int MEDFileSizeOfMedInt()
434 return 8*sizeof(med_int);
437 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
439 std::map<std::string,mcIdType> families;
440 std::map<std::string,std::vector<std::string>> groupsOnFam;
441 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
442 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
443 AutoPyPtr ret(PyTuple_New(2));
444 PyTuple_SetItem(ret,0,a.retn());
445 PyTuple_SetItem(ret,1,b.retn());
449 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
451 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
455 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
457 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
461 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
463 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
467 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
469 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
473 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
475 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
476 PyObject *ret=PyList_New(res.size());
478 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
480 PyObject *elt=PyTuple_New(2);
481 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
482 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
483 PyList_SetItem(ret,rk,elt);
488 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
490 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
491 PyObject *ret=PyList_New(res.size());
493 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
495 PyObject *elt=PyTuple_New(3);
496 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
497 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
498 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
499 PyList_SetItem(ret,rk,elt);
504 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
506 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
507 PyObject *ret=PyList_New(res.size());
509 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
511 PyObject *elt=PyTuple_New(2);
512 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
513 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
514 PyList_SetItem(ret,rk,elt);
519 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
521 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
522 PyObject *ret=PyList_New(res.size());
524 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
526 PyObject *elt=PyTuple_New(2);
527 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
528 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
529 PyList_SetItem(ret,rk,elt);
534 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
536 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
537 PyObject *ret=PyList_New(res.size());
539 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
541 PyObject *elt=PyTuple_New(2);
542 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
543 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
544 PyList_SetItem(ret,rk,elt);
549 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
551 int meshDim,spaceDim;
552 mcIdType numberOfNodes;
553 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
554 PyObject *ret=PyTuple_New(4);
555 PyObject *elt0=PyList_New(res.size());
557 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
559 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
561 PyObject *elt1=PyList_New(obj2.size());
562 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
564 PyObject *elt2=PyTuple_New(2);
565 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
566 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
567 PyList_SetItem(elt1,j,elt2);
569 PyList_SetItem(elt0,i,elt1);
571 PyTuple_SetItem(ret,0,elt0);
572 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
573 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
574 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
578 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
579 const std::string& fieldName, PyObject *liIts)
581 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
582 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
583 return convertFieldDoubleVecToPy(res);
586 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
588 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
589 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
590 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
593 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
595 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
596 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
597 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
600 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
602 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
603 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
604 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
607 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
609 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
610 std::size_t size=v.size();
611 PyObject *ret=PyList_New(size);
612 for(std::size_t i=0;i<size;i++)
613 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
617 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
619 std::vector<std::string> grps;
620 converPyListToVecString(li,grps);
621 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
624 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
626 std::vector<std::string> fams;
627 converPyListToVecString(li,fams);
628 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
632 namespace MEDCoupling
634 class MEDFileWritable
637 void copyOptionsFrom(const MEDFileWritable& other) const;
638 int getTooLongStrPolicy() const;
639 void setTooLongStrPolicy(int newVal);
640 int getZipConnPolicy();
641 void setZipConnPolicy(int newVal);
644 class MEDFileWritableStandAlone : public MEDFileWritable
647 void write(const std::string& fileName, int mode) const;
648 void write33(const std::string& fileName, int mode) const;
649 void write30(const std::string& fileName, int mode) const;
652 DataArrayByte *serialize() const
654 MCAuto<DataArrayByte> ret(self->serialize());
658 PyObject *__getstate__()
660 PyObject *ret(PyList_New(0));
664 void __setstate__(PyObject *inp)
670 class MEDFileMeshReadSelector
673 MEDFileMeshReadSelector();
674 MEDFileMeshReadSelector(unsigned int code);
675 mcIdType getNumberOfCoordsLoadSessions();
676 void setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions);
677 unsigned int getCode() const;
678 void setCode(unsigned int newCode);
679 bool isCellFamilyFieldReading() const;
680 bool isNodeFamilyFieldReading() const;
681 bool isCellNameFieldReading() const;
682 bool isNodeNameFieldReading() const;
683 bool isCellNumFieldReading() const;
684 bool isNodeNumFieldReading() const;
685 bool isGlobalNodeNumFieldReading() const;
686 void setCellFamilyFieldReading(bool b);
687 void setNodeFamilyFieldReading(bool b);
688 void setCellNameFieldReading(bool b);
689 void setNodeNameFieldReading(bool b);
690 void setCellNumFieldReading(bool b);
691 void setNodeNumFieldReading(bool b);
692 void setGlobalNodeNumFieldReading(bool b);
695 std::string __str__() const
697 std::ostringstream oss;
702 std::string __repr__() const
704 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
710 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
713 static MEDFileJointCorrespondence *New();
714 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
716 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
717 INTERP_KERNEL::NormalizedCellType loc_geo_type,
718 INTERP_KERNEL::NormalizedCellType rem_geo_type)
720 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
721 MEDFileJointCorrespondence *deepCopy() const;
722 MEDFileJointCorrespondence *shallowCpy() const;
723 void setIsNodal(bool isNodal);
724 bool getIsNodal() const;
725 bool isEqual(const MEDFileJointCorrespondence *other) const;
726 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
727 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
728 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
729 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
730 void setCorrespondence(DataArrayIdType *corr);
731 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
732 std::string simpleRepr() const;
735 MEDFileJointCorrespondence()
737 return MEDFileJointCorrespondence::New();
739 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
741 return MEDFileJointCorrespondence::New(correspondence);
743 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
744 INTERP_KERNEL::NormalizedCellType loc_geo_type,
745 INTERP_KERNEL::NormalizedCellType rem_geo_type)
747 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
750 std::string __str__() const
752 return self->simpleRepr();
755 DataArrayIdType *getCorrespondence() const
757 const DataArrayIdType *ret(self->getCorrespondence());
760 return const_cast<DataArrayIdType *>(ret);
765 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
768 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
769 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
770 MEDFileJointOneStep *deepCopy() const;
771 MEDFileJointOneStep *shallowCpy() const;
772 bool isEqual(const MEDFileJointOneStep *other) const;
773 void setOrder(int order);
774 int getOrder() const;
775 void setIteration(int it);
776 int getIteration() const;
777 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
778 int getNumberOfCorrespondences() const;
779 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
780 std::string simpleRepr() const;
783 MEDFileJointOneStep()
785 return MEDFileJointOneStep::New();
788 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
790 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
793 std::string __str__() const
795 return self->simpleRepr();
798 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
800 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
806 MEDFileJointCorrespondence *__getitem__(int i) const
808 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
813 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
816 static MEDFileJoint *New();
817 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
818 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
819 MEDFileJoint *deepCopy() const;
820 MEDFileJoint *shallowCpy() const;
821 bool isEqual(const MEDFileJoint *other) const;
822 void setLocalMeshName(const std::string& name);
823 std::string getLocalMeshName() const;
824 void setRemoteMeshName(const std::string& name);
825 std::string getRemoteMeshName() const;
826 void setDescription(const std::string& name);
827 std::string getDescription() const;
828 void setJointName(const std::string& name);
829 std::string getJointName() const;
830 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
831 void setDomainNumber(const int& number);
832 int getDomainNumber() const;
833 void pushStep(MEDFileJointOneStep* step);
834 int getNumberOfSteps() const;
835 std::string simpleRepr() const;
840 return MEDFileJoint::New();
843 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
845 return MEDFileJoint::New(fileName,mName,num);
848 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
850 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
853 std::string __str__() const
855 return self->simpleRepr();
858 MEDFileJointOneStep *getStepAtPos(int i) const
860 MEDFileJointOneStep *ret(self->getStepAtPos(i));
866 MEDFileJointOneStep *__getitem__(int i)
868 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
873 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
876 static MEDFileJoints *New();
877 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
878 MEDFileJoints *deepCopy() const;
879 std::string simpleRepr() const;
880 std::string getMeshName() const;
881 int getNumberOfJoints() const;
882 std::vector<std::string> getJointsNames() const;
883 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
884 void resize(int newSize);
885 void pushJoint(MEDFileJoint *joint);
886 void setJointAtPos(int i, MEDFileJoint *joint);
887 void destroyJointAtPos(int i);
892 return MEDFileJoints::New();
895 MEDFileJoints(const std::string& fileName, const std::string& meshName)
897 return MEDFileJoints::New(fileName,meshName);
900 std::string __str__() const
902 return self->simpleRepr();
905 MEDFileJoint *__getitem__(PyObject *obj)
907 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
910 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
915 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
923 return self->getNumberOfJoints();
926 MEDFileJoint *getJointAtPos(int i) const
928 MEDFileJoint *ret=self->getJointAtPos(i);
934 MEDFileJoint *getJointWithName(const std::string& paramName) const
936 MEDFileJoint *ret=self->getJointWithName(paramName);
944 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
947 MEDFileEquivalenceBase();
950 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
953 MEDFileEquivalenceData();
955 void setArray(DataArrayInt32 *data);
958 DataArrayInt32 *getArray()
960 DataArrayInt32 *ret(self->getArray());
961 if(ret) ret->incrRef();
967 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
970 MEDFileEquivalenceNode();
973 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
976 MEDFileEquivalenceCell();
979 std::size_t size() const;
980 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
981 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
984 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
986 DataArrayInt32 *ret(self->getArray(type));
987 if(ret) ret->incrRef();
991 PyObject *getTypes() const
993 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
994 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
995 PyObject *res=PyList_New(result.size());
996 for(int i=0;iL!=result.end(); i++, iL++)
997 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1003 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
1006 MEDFileEquivalencePair();
1008 std::string getName() const;
1009 void setName(const std::string& name);
1010 std::string getDescription() const;
1011 void setDescription(const std::string& descr);
1012 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
1015 MEDFileEquivalenceCell *initCell()
1017 MEDFileEquivalenceCell *ret(self->initCell());
1018 if(ret) ret->incrRef();
1022 MEDFileEquivalenceNode *initNode()
1024 MEDFileEquivalenceNode *ret(self->initNode());
1025 if(ret) ret->incrRef();
1029 MEDFileEquivalenceCell *getCell()
1031 MEDFileEquivalenceCell *ret(self->getCell());
1032 if(ret) ret->incrRef();
1036 MEDFileEquivalenceNode *getNode()
1038 MEDFileEquivalenceNode *ret(self->getNode());
1039 if(ret) ret->incrRef();
1045 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1048 MEDFileEquivalences();
1051 std::vector<std::string> getEquivalenceNames() const;
1052 void killEquivalenceWithName(const std::string& name);
1053 void killEquivalenceAt(int i);
1057 MEDFileEquivalencePair *getEquivalence(int i)
1059 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1060 if(ret) ret->incrRef();
1063 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1065 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1066 if(ret) ret->incrRef();
1070 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1072 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1073 if(ret) ret->incrRef();
1079 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1082 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1083 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1084 static MEDFileMesh *New(DataArrayByte *db);
1085 virtual MEDFileMesh *createNewEmpty() const;
1086 virtual MEDFileMesh *deepCopy() const;
1087 virtual MEDFileMesh *shallowCpy() const;
1088 virtual void clearNonDiscrAttributes() const;
1089 void setName(const std::string& name);
1090 std::string getName();
1091 std::string getUnivName() const;
1092 bool getUnivNameWrStatus() const;
1093 void setUnivNameWrStatus(bool newStatus);
1094 void setDescription(const std::string& name);
1095 std::string getDescription() const;
1096 void setOrder(int order);
1097 int getOrder() const;
1098 void setIteration(int it);
1100 void setTimeValue(double time);
1101 void setTime(int dt, int it, double time);
1102 double getTimeValue() const;
1103 void setTimeUnit(const std::string& unit);
1104 std::string getTimeUnit() const;
1105 void setAxisType(MEDCouplingAxisType at);
1106 MEDCouplingAxisType getAxisType() const;
1107 virtual int getNumberOfNodes() const;
1108 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1109 virtual bool hasImplicitPart() const;
1110 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1111 virtual void releaseImplicitPartIfAny() const;
1112 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1113 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1114 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1115 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1116 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1117 virtual MEDFileMesh *cartesianize() const;
1118 std::vector<int> getNonEmptyLevels() const;
1119 std::vector<int> getNonEmptyLevelsExt() const;
1120 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1122 bool existsGroup(const std::string& groupName) const;
1123 bool existsFamily(int famId) const;
1124 bool existsFamily(const std::string& familyName) const;
1125 void setFamilyId(const std::string& familyName, int id);
1126 void setFamilyIdUnique(const std::string& familyName, int id);
1127 void addFamily(const std::string& familyName, int id);
1128 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1129 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1130 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1131 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1134 void clearFamGrpMaps();
1135 const std::map<std::string,int>& getFamilyInfo() const;
1136 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1137 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1138 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1139 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1140 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1141 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1142 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1143 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1144 std::vector<std::string> getGroupsNames() const;
1145 std::vector<std::string> getFamiliesNames() const;
1146 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1147 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1148 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1149 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1150 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1151 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1152 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1153 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1154 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1155 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1156 static std::string GetMagicFamilyStr();
1157 void assignFamilyNameWithGroupName();
1158 std::vector<std::string> removeEmptyGroups();
1159 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1160 void removeGroup(const std::string& name);
1161 void removeFamily(const std::string& name);
1162 std::vector<std::string> removeOrphanGroups();
1163 std::vector<std::string> removeOrphanFamilies();
1164 void removeFamiliesReferedByNoGroups();
1165 void rearrangeFamilies();
1167 void checkOrphanFamilyZero() const;
1168 void changeGroupName(const std::string& oldName, const std::string& newName);
1169 void changeFamilyName(const std::string& oldName, const std::string& newName);
1170 void changeFamilyId(int oldId, int newId);
1171 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1172 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1173 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1174 int getFamilyId(const std::string& name) const;
1175 int getMaxAbsFamilyId() const;
1176 int getMaxFamilyId() const;
1177 int getMinFamilyId() const;
1178 int getTheMaxAbsFamilyId() const;
1179 int getTheMaxFamilyId() const;
1180 int getTheMinFamilyId() const;
1181 virtual int getMaxAbsFamilyIdInArrays() const;
1182 virtual int getMaxFamilyIdInArrays() const;
1183 virtual int getMinFamilyIdInArrays() const;
1184 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1185 DataArrayIdType *computeAllFamilyIdsInUse() const;
1186 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1187 std::string getFamilyNameGivenId(int id) const;
1188 bool ensureDifferentFamIdsPerLevel();
1189 void normalizeFamIdsTrio();
1190 void normalizeFamIdsMEDFile();
1191 virtual int getMeshDimension() const;
1192 virtual std::string simpleRepr() const;
1193 virtual std::string advancedRepr() const;
1195 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1196 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1197 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1198 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1199 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1200 virtual void addNodeGroup(const DataArrayIdType *ids);
1201 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1202 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1203 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1204 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1205 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1206 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1207 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1208 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1209 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1210 int getNumberOfJoints();
1211 MEDFileJoints *getJoints();
1212 void setJoints( MEDFileJoints* joints );
1213 void initializeEquivalences();
1214 void killEquivalences();
1215 bool presenceOfStructureElements() const;
1216 void killStructureElements();
1219 std::string __str__() const
1221 return self->simpleRepr();
1224 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1226 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1229 static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(int geoType)
1231 med_geometry_type geoType2((med_geometry_type) geoType);
1232 return MEDFileMesh::ConvertFromMEDFileGeoType(geoType2);
1238 double tmp0=self->getTime(tmp1,tmp2);
1239 PyObject *res = PyList_New(3);
1240 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1241 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1242 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1246 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1249 bool ret0=self->isEqual(other,eps,what);
1250 PyObject *res=PyList_New(2);
1251 PyObject *ret0Py=ret0?Py_True:Py_False;
1253 PyList_SetItem(res,0,ret0Py);
1254 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1258 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1260 std::vector<const DataArrayIdType *> grps;
1261 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1262 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1265 PyObject *areFamsEqual(const MEDFileMesh *other) const
1268 bool ret0=self->areFamsEqual(other,what);
1269 PyObject *res=PyList_New(2);
1270 PyObject *ret0Py=ret0?Py_True:Py_False;
1272 PyList_SetItem(res,0,ret0Py);
1273 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1277 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1280 bool ret0=self->areGrpsEqual(other,what);
1281 PyObject *res=PyList_New(2);
1282 PyObject *ret0Py=ret0?Py_True:Py_False;
1284 PyList_SetItem(res,0,ret0Py);
1285 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1289 PyObject *getAllGeoTypes() const
1291 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1292 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1293 PyObject *res=PyList_New(result.size());
1294 for(int i=0;iL!=result.end(); i++, iL++)
1295 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1299 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1301 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1302 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1303 PyObject *res=PyList_New(result.size());
1304 for(int i=0;iL!=result.end(); i++, iL++)
1305 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1309 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1311 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1314 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1317 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1319 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1322 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1325 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1327 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1330 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1333 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1335 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1338 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1341 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1343 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1346 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1349 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1352 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1353 PyObject *ret=PyTuple_New(2);
1354 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1355 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1359 PyObject *unPolyze()
1361 DataArrayIdType *ret3=0;
1362 std::vector<mcIdType> ret1,ret2;
1363 bool ret0=self->unPolyze(ret1,ret2,ret3);
1364 PyObject *ret=PyTuple_New(4);
1365 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1367 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1368 for(int j=0;j<(int)ret1.size()/3;j++)
1370 PyObject *retLev2=PyList_New(3);
1371 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1372 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1373 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1374 PyList_SetItem(retLev1_0,j,retLev2);
1376 PyTuple_SetItem(ret,1,retLev1_0);
1378 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1379 for(int j=0;j<(int)ret2.size()/3;j++)
1381 PyObject *retLev2=PyList_New(3);
1382 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1383 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1384 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1385 PyList_SetItem(retLev1_1,j,retLev2);
1387 PyTuple_SetItem(ret,2,retLev1_1);
1389 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1393 MEDFileEquivalences *getEquivalences()
1395 MEDFileEquivalences *ret(self->getEquivalences());
1396 if(ret) ret->incrRef();
1400 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1402 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1408 class MEDFileUMesh : public MEDFileMesh
1411 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1412 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1413 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1414 static MEDFileUMesh *New(DataArrayByte *db);
1415 static MEDFileUMesh *New();
1416 static const char *GetSpeStr4ExtMesh();
1418 int getSpaceDimension() const;
1419 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1420 void checkConsistency() const;
1421 void checkSMESHConsistency() const;
1422 void clearNodeAndCellNumbers();
1424 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1425 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1426 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1427 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1428 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1429 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1430 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1431 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1432 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1433 void forceComputationOfParts() const;
1435 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1436 void setCoords(DataArrayDouble *coords);
1437 void setCoordsForced(DataArrayDouble *coords);
1438 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1439 void removeMeshAtLevel(int meshDimRelToMax);
1440 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1441 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1442 void optimizeFamilies();
1443 DataArrayIdType *computeFetchedNodeIds() const;
1444 DataArrayIdType *zipCoords();
1445 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1446 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1447 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1448 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1449 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1450 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1453 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1455 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1458 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1460 return MEDFileUMesh::New(fileName,mrs);
1463 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1465 return MEDFileUMesh::New(mem);
1468 MEDFileUMesh(DataArrayByte *db)
1470 return MEDFileUMesh::New(db);
1475 return MEDFileUMesh::New();
1478 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)
1480 std::vector<int> typesCpp1;
1481 convertPyToNewIntArr3(types,typesCpp1);
1482 std::size_t sz(typesCpp1.size());
1483 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1484 for(std::size_t ii=0;ii<sz;ii++)
1485 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1486 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1489 static PyObject *LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector<std::string>& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId)
1491 MCAuto<DataArrayDouble> coords;
1492 MCAuto<PartDefinition> partCoords;
1493 MCAuto<DataArrayIdType> famCoords,numCoords;
1494 MCAuto<DataArrayAsciiChar> nameCoord;
1495 MEDFileUMesh::LoadPartCoords(fileName,mName,dt,it,infosOnComp,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoord);
1496 PyObject *ret(PyTuple_New(5));
1497 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1498 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1499 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1500 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1501 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1505 PyObject *__getstate__()
1507 std::vector<double> a0;
1508 std::vector<mcIdType> a1;
1509 std::vector<std::string> a2;
1510 std::vector< MCAuto<DataArrayIdType> > a3;
1511 MCAuto<DataArrayDouble> a4;
1512 self->serialize(a0,a1,a2,a3,a4);
1513 PyObject *ret(PyTuple_New(5));
1514 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1515 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1516 std::size_t sz(a2.size());
1517 PyObject *ret2(PyList_New(sz));
1518 for(std::size_t i=0;i<sz;i++)
1519 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1520 PyTuple_SetItem(ret,2,ret2);
1522 PyObject *ret3(PyList_New(sz));
1523 for(std::size_t i=0;i<sz;i++)
1525 DataArrayIdType *elt(a3[i]);
1528 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1530 PyTuple_SetItem(ret,3,ret3);
1531 DataArrayDouble *ret4(a4);
1534 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1538 void __setstate__(PyObject *inp)
1540 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1541 if(!PyTuple_Check(inp))
1542 throw INTERP_KERNEL::Exception(MSG);
1543 std::size_t sz(PyTuple_Size(inp));
1545 throw INTERP_KERNEL::Exception(MSG);
1546 std::vector<double> a0;
1547 std::vector<mcIdType> a1;
1548 std::vector<std::string> a2;
1549 std::vector< MCAuto<DataArrayIdType> > a3;
1550 MCAuto<DataArrayDouble> a4;
1552 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1554 fillArrayWithPyListDbl3(a0py,tmp,a0);
1555 convertPyToNewIntArr3(a1py,a1);
1556 fillStringVector(a2py,a2);
1558 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1560 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1561 if(!SWIG_IsOK(status))
1562 throw INTERP_KERNEL::Exception(MSG);
1563 a4=reinterpret_cast<DataArrayDouble *>(argp);
1564 if((DataArrayDouble *)a4)
1567 std::vector< DataArrayIdType * > a3Tmp;
1568 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1569 std::size_t sz(a3Tmp.size());
1571 for(std::size_t i=0;i<sz;i++)
1575 a3Tmp[i]->incrRef();
1577 self->unserialize(a0,a1,a2,a3,a4);
1581 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1584 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1585 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1588 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1591 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1594 self->setMeshAtLevel(meshDimRelToMax,m1);
1597 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1600 void __delitem__(int meshDimRelToMax)
1602 self->removeMeshAtLevel(meshDimRelToMax);
1605 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1607 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1609 DataArrayDouble *a,*a2;
1610 DataArrayDoubleTuple *aa,*aa2;
1611 std::vector<double> bb,bb2;
1613 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1614 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1615 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1619 static MEDFileUMesh *Aggregate(PyObject *meshes)
1621 std::vector<const MEDFileUMesh *> meshesCpp;
1622 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1623 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1627 PyObject *getAllDistributionOfTypes() const
1629 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1630 return convertVecPairIntToPy(ret);
1633 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1635 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1636 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1637 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1640 MEDFileUMesh *extractPart(PyObject *extractDef) const
1642 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1643 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1644 return self->extractPart(extractDefCpp);
1647 void setMeshes(PyObject *li, bool renum=false)
1649 std::vector<const MEDCouplingUMesh *> ms;
1650 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1651 self->setMeshes(ms,renum);
1654 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1656 std::vector<const MEDCouplingUMesh *> ms;
1657 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1658 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1661 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1663 std::vector<const MEDCouplingUMesh *> ms;
1664 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1665 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1668 DataArrayDouble *getCoords() const
1670 DataArrayDouble *ret=self->getCoords();
1676 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1678 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1681 return const_cast<PartDefinition *>(ret);
1684 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1686 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1687 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1688 PyObject *ret=PyTuple_New(3);
1689 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1690 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1691 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1695 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1697 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1703 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1705 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1706 std::size_t sz(tmp.size());
1707 PyObject *ret=PyList_New(sz);
1708 for(std::size_t i=0;i<sz;i++)
1712 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1719 class MEDFileStructuredMesh : public MEDFileMesh
1724 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1726 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1734 class MEDFileCMesh : public MEDFileStructuredMesh
1737 static MEDFileCMesh *New();
1738 static MEDFileCMesh *New(DataArrayByte *db);
1739 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1740 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1741 void setMesh(MEDCouplingCMesh *m);
1742 int getSpaceDimension() const;
1747 return MEDFileCMesh::New();
1750 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1752 return MEDFileCMesh::New(fileName,mrs);
1755 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1757 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1760 MEDFileCMesh(DataArrayByte *db)
1762 return MEDFileCMesh::New(db);
1765 PyObject *getMesh() const
1767 const MEDCouplingCMesh *tmp=self->getMesh();
1770 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1775 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1778 static MEDFileCurveLinearMesh *New();
1779 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1780 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1781 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1782 void setMesh(MEDCouplingCurveLinearMesh *m);
1783 int getSpaceDimension() const;
1784 int getMeshDimension() const;
1787 MEDFileCurveLinearMesh()
1789 return MEDFileCurveLinearMesh::New();
1792 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1794 return MEDFileCurveLinearMesh::New(fileName,mrs);
1797 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1799 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1802 MEDFileCurveLinearMesh(DataArrayByte *db)
1804 return MEDFileCurveLinearMesh::New(db);
1807 PyObject *getMesh() const
1809 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1812 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1817 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1820 static MEDFileMeshMultiTS *New();
1821 static MEDFileMeshMultiTS *New(const std::string& fileName);
1822 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1823 MEDFileMeshMultiTS *deepCopy() const;
1824 std::string getName() const;
1825 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1826 void cartesianizeMe();
1829 MEDFileMeshMultiTS()
1831 return MEDFileMeshMultiTS::New();
1834 MEDFileMeshMultiTS(const std::string& fileName)
1836 return MEDFileMeshMultiTS::New(fileName);
1839 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1841 return MEDFileMeshMultiTS::New(fileName,mName);
1844 MEDFileMesh *getOneTimeStep() const
1846 MEDFileMesh *ret=self->getOneTimeStep();
1854 class MEDFileMeshesIterator
1861 MEDFileMesh *ret=self->nextt();
1865 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1869 PyErr_SetString(PyExc_StopIteration,"No more data.");
1876 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1879 static MEDFileMeshes *New();
1880 static MEDFileMeshes *New(DataArrayByte *db);
1881 MEDFileMeshes *deepCopy() const;
1882 int getNumberOfMeshes() const;
1883 std::vector<std::string> getMeshesNames() const;
1885 void resize(int newSize);
1886 void pushMesh(MEDFileMesh *mesh);
1887 void setMeshAtPos(int i, MEDFileMesh *mesh);
1888 void destroyMeshAtPos(int i);
1889 void cartesianizeMe();
1890 bool presenceOfStructureElements() const;
1891 void killStructureElements();
1896 return MEDFileMeshes::New();
1899 MEDFileMeshes(const std::string& fileName)
1901 return MEDFileMeshes::New(fileName);
1904 MEDFileMeshes(DataArrayByte *db)
1906 return MEDFileMeshes::New(db);
1909 std::string __str__() const
1911 return self->simpleRepr();
1914 MEDFileMesh *__getitem__(PyObject *obj)
1916 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1917 if(PyInt_Check(obj))
1919 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1924 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1930 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1932 self->setMeshAtPos(obj,mesh);
1936 MEDFileMeshesIterator *__iter__()
1938 return self->iterator();
1943 return self->getNumberOfMeshes();
1946 MEDFileMesh *getMeshAtPos(int i) const
1948 MEDFileMesh *ret=self->getMeshAtPos(i);
1953 MEDFileMesh *getMeshWithName(const std::string& mname) const
1955 MEDFileMesh *ret=self->getMeshWithName(mname);
1963 class MEDFileFieldLoc : public RefCountObject
1966 std::string getName() const;
1967 int getDimension() const;
1968 int getNumberOfGaussPoints() const;
1969 int getNumberOfPointsInCells() const;
1970 const std::vector<double>& getRefCoords() const;
1971 const std::vector<double>& getGaussCoords() const;
1972 const std::vector<double>& getGaussWeights() const;
1973 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1976 std::string __str__() const
1978 return self->repr();
1983 class MEDFileFieldGlobsReal
1986 void resetContent();
1987 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1988 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1989 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1990 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1991 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1992 void checkGlobsCoherency() const;
1993 void checkGlobsPflsPartCoherency() const;
1994 void checkGlobsLocsPartCoherency() const;
1995 std::vector<std::string> getPfls() const;
1996 std::vector<std::string> getLocs() const;
1997 bool existsPfl(const std::string& pflName) const;
1998 bool existsLoc(const std::string& locName) const;
1999 std::string createNewNameOfPfl() const;
2000 std::string createNewNameOfLoc() const;
2001 std::vector< std::vector<int> > whichAreEqualProfiles() const;
2002 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
2003 virtual std::vector<std::string> getPflsReallyUsed() const;
2004 virtual std::vector<std::string> getLocsReallyUsed() const;
2005 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
2006 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
2007 void killProfileIds(const std::vector<int>& pflIds);
2008 void killLocalizationIds(const std::vector<int>& locIds);
2009 void changePflName(const std::string& oldName, const std::string& newName);
2010 void changeLocName(const std::string& oldName, const std::string& newName);
2011 int getNbOfGaussPtPerCell(int locId) const;
2012 int getLocalizationId(const std::string& loc) const;
2013 int getProfileId(const std::string& pfl) const;
2014 void killStructureElementsInGlobs();
2017 PyObject *getProfile(const std::string& pflName) const
2019 const DataArrayIdType *ret=self->getProfile(pflName);
2022 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2025 PyObject *getProfileFromId(int pflId) const
2027 const DataArrayIdType *ret=self->getProfileFromId(pflId);
2030 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2033 PyObject *getLocalizationFromId(int locId) const
2035 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2038 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2041 PyObject *getLocalization(const std::string& locName) const
2043 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2046 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2049 PyObject *zipPflsNames()
2051 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2052 return convertVecPairVecStToPy(ret);
2055 PyObject *zipLocsNames(double eps)
2057 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2058 return convertVecPairVecStToPy(ret);
2061 void changePflsNames(PyObject *li)
2063 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2064 self->changePflsNames(v);
2067 void changePflsRefsNamesGen(PyObject *li)
2069 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2070 self->changePflsRefsNamesGen(v);
2073 void changePflsNamesInStruct(PyObject *li)
2075 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2076 self->changePflsNamesInStruct(v);
2079 void changeLocsNames(PyObject *li)
2081 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2082 self->changeLocsNames(v);
2085 void changeLocsRefsNamesGen(PyObject *li)
2087 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2088 self->changeLocsRefsNamesGen(v);
2091 void changeLocsNamesInStruct(PyObject *li)
2093 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2094 self->changeLocsNamesInStruct(v);
2097 std::string simpleReprGlobs() const
2099 std::ostringstream oss;
2100 self->simpleReprGlobs(oss);
2106 class MEDFileEntities
2111 static MEDFileEntities *BuildFrom(PyObject *entities)
2113 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2114 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2116 std::size_t sz(inp0.size());
2118 for(std::size_t i=0;i<sz;i++)
2119 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2121 return MEDFileEntities::BuildFrom(&inp);
2128 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2131 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2132 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2133 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2134 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2136 void loadArraysIfNecessary();
2137 void unloadArrays();
2138 void unloadArraysWithoutDataLoss();
2139 int getDimension() const;
2140 int getIteration() const;
2141 int getOrder() const;
2142 std::string getName();
2143 void setName(const std::string& name);
2144 std::string getMeshName();
2145 void setMeshName(const std::string& newMeshName);
2146 int getMeshIteration() const;
2147 int getMeshOrder() const;
2148 int getNumberOfComponents() const;
2149 bool isDealingTS(int iteration, int order) const;
2150 void setInfo(const std::vector<std::string>& infos);
2151 const std::vector<std::string>& getInfo() const;
2152 bool presenceOfMultiDiscPerGeoType() const;
2153 void setTime(int iteration, int order, double val);
2154 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2155 MEDFileAnyTypeField1TS *deepCopy() const;
2156 std::string getDtUnit() const;
2157 void setDtUnit(const std::string& dtUnit);
2163 double tmp0=self->getTime(tmp1,tmp2);
2164 PyObject *res = PyList_New(3);
2165 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2166 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2167 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2171 PyObject *getDtIt() const
2173 std::pair<int,int> res=self->getDtIt();
2174 PyObject *elt=PyTuple_New(2);
2175 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2176 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2180 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2182 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2185 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2187 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2190 bool changeMeshNames(PyObject *li)
2192 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2193 return self->changeMeshNames(modifTab);
2196 PyObject *getTypesOfFieldAvailable() const
2198 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2199 PyObject *ret2=PyList_New(ret.size());
2200 for(int i=0;i<(int)ret.size();i++)
2201 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2205 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2207 std::vector<int> ret1;
2208 int ret0=self->getNonEmptyLevels(mname,ret1);
2209 PyObject *elt=PyTuple_New(2);
2210 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2211 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2215 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2217 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2218 std::vector< std::vector<TypeOfField> > typesF;
2219 std::vector< std::vector<std::string> > pfls;
2220 std::vector< std::vector<std::string> > locs;
2221 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2222 std::size_t sz=ret.size();
2223 PyObject *ret2=PyList_New(sz);
2224 for(std::size_t i=0;i<sz;i++)
2226 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2227 const std::vector<TypeOfField>& typesFI=typesF[i];
2228 const std::vector<std::string>& pflsI=pfls[i];
2229 const std::vector<std::string>& locsI=locs[i];
2230 PyObject *elt=PyTuple_New(2);
2231 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2232 std::size_t sz2=ret[i].size();
2233 PyObject *elt2=PyList_New(sz2);
2234 for(std::size_t j=0;j<sz2;j++)
2236 PyObject *elt3=PyTuple_New(4);
2237 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2238 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2239 PyTuple_SetItem(elt3,1,elt4);
2240 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2241 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2242 PyList_SetItem(elt2,j,elt3);
2244 PyTuple_SetItem(elt,1,elt2);
2245 PyList_SetItem(ret2,i,elt);
2250 PyObject *splitComponents() const
2252 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2253 std::size_t sz=ret.size();
2254 PyObject *retPy=PyList_New(sz);
2255 for(std::size_t i=0;i<sz;i++)
2256 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2260 PyObject *splitDiscretizations() const
2262 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2263 std::size_t sz=ret.size();
2264 PyObject *retPy=PyList_New(sz);
2265 for(std::size_t i=0;i<sz;i++)
2266 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2270 PyObject *splitMultiDiscrPerGeoTypes() const
2272 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2273 std::size_t sz=ret.size();
2274 PyObject *retPy=PyList_New(sz);
2275 for(std::size_t i=0;i<sz;i++)
2276 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2280 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2282 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2283 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2284 return self->extractPart(extractDefCpp,mm);
2289 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2292 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2293 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2294 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2295 static MEDFileField1TS *New(DataArrayByte *db);
2296 static MEDFileField1TS *New();
2297 MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2298 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2299 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2300 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2301 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2302 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2303 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2304 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2306 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2307 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2308 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2309 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2310 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2313 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2315 return MEDFileField1TS::New(fileName,loadAll);
2318 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2320 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2323 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2325 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2328 MEDFileField1TS(DataArrayByte *db)
2330 return MEDFileField1TS::New(db);
2335 return MEDFileField1TS::New();
2338 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2340 const DataArrayDouble *arr=0;
2342 arr=field->getArray();
2343 self->copyTinyInfoFrom(field,arr);
2346 std::string __str__() const
2348 return self->simpleRepr();
2351 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2353 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2356 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2358 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2359 std::vector< std::vector<TypeOfField> > typesF;
2360 std::vector< std::vector<std::string> > pfls;
2361 std::vector< std::vector<std::string> > locs;
2362 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2363 std::size_t sz=ret.size();
2364 PyObject *ret2=PyList_New(sz);
2365 for(std::size_t i=0;i<sz;i++)
2367 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2368 const std::vector<TypeOfField>& typesFI=typesF[i];
2369 const std::vector<std::string>& pflsI=pfls[i];
2370 const std::vector<std::string>& locsI=locs[i];
2371 PyObject *elt=PyTuple_New(2);
2372 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2373 std::size_t sz2=ret[i].size();
2374 PyObject *elt2=PyList_New(sz2);
2375 for(std::size_t j=0;j<sz2;j++)
2377 PyObject *elt3=PyTuple_New(4);
2378 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2379 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2380 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2381 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2382 PyList_SetItem(elt2,j,elt3);
2384 PyTuple_SetItem(elt,1,elt2);
2385 PyList_SetItem(ret2,i,elt);
2390 DataArrayDouble *getUndergroundDataArray() const
2392 DataArrayDouble *ret=self->getUndergroundDataArray();
2398 PyObject *getUndergroundDataArrayExt() const
2400 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2405 class MEDFileInt32Field1TS : public MEDFileAnyTypeField1TS
2408 static MEDFileInt32Field1TS *New();
2409 static MEDFileInt32Field1TS *New(const std::string& fileName, bool loadAll=true);
2410 static MEDFileInt32Field1TS *New(DataArrayByte *db);
2411 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2412 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2413 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2415 void setFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
2416 void setFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2417 void setFieldProfileFlatly(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2418 void copyTimeInfoFrom(MEDCouplingFieldInt32 *mcf);
2419 MEDCouplingFieldInt32 *field(const MEDFileMesh *mesh) const;
2420 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2421 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2422 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2423 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2424 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2427 MEDFileInt32Field1TS()
2429 return MEDFileInt32Field1TS::New();
2432 MEDFileInt32Field1TS(const std::string& fileName, bool loadAll=true)
2434 return MEDFileInt32Field1TS::New(fileName,loadAll);
2437 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2439 return MEDFileInt32Field1TS::New(fileName,fieldName,loadAll);
2442 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2444 return MEDFileInt32Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2447 MEDFileInt32Field1TS(DataArrayByte *db)
2449 return MEDFileInt32Field1TS::New(db);
2452 std::string __str__() const
2454 return self->simpleRepr();
2457 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2459 return MEDFileField1TS_getFieldWithProfile<Int32>(self,type,meshDimRelToMax,mesh);
2462 DataArrayInt32 *getUndergroundDataArray() const
2464 DataArrayInt32 *ret=self->getUndergroundDataArray();
2470 PyObject *getUndergroundDataArrayExt() const
2472 return MEDFileField1TS_getUndergroundDataArrayExt<Int32>(self);
2477 class MEDFileInt64Field1TS : public MEDFileAnyTypeField1TS
2480 static MEDFileInt64Field1TS *New();
2481 static MEDFileInt64Field1TS *New(const std::string& fileName, bool loadAll=true);
2482 static MEDFileInt64Field1TS *New(DataArrayByte *db);
2483 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2484 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2485 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2487 void setFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
2488 void setFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2489 void setFieldProfileFlatly(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2490 void copyTimeInfoFrom(MEDCouplingFieldInt64 *mcf);
2491 MEDCouplingFieldInt64 *field(const MEDFileMesh *mesh) const;
2492 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2493 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2494 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2495 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2496 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2499 MEDFileInt64Field1TS()
2501 return MEDFileInt64Field1TS::New();
2504 MEDFileInt64Field1TS(const std::string& fileName, bool loadAll=true)
2506 return MEDFileInt64Field1TS::New(fileName,loadAll);
2509 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2511 return MEDFileInt64Field1TS::New(fileName,fieldName,loadAll);
2514 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2516 return MEDFileInt64Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2519 MEDFileInt64Field1TS(DataArrayByte *db)
2521 return MEDFileInt64Field1TS::New(db);
2524 std::string __str__() const
2526 return self->simpleRepr();
2529 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2531 return MEDFileField1TS_getFieldWithProfile<Int64>(self,type,meshDimRelToMax,mesh);
2534 DataArrayInt64 *getUndergroundDataArray() const
2536 DataArrayInt64 *ret=self->getUndergroundDataArray();
2542 PyObject *getUndergroundDataArrayExt() const
2544 return MEDFileField1TS_getUndergroundDataArrayExt<Int64>(self);
2549 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2552 static MEDFileFloatField1TS *New();
2553 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2554 static MEDFileFloatField1TS *New(DataArrayByte *db);
2555 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2556 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2557 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2559 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2560 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2561 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2562 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2563 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2564 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2565 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2566 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2567 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2568 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2571 MEDFileFloatField1TS()
2573 return MEDFileFloatField1TS::New();
2576 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2578 return MEDFileFloatField1TS::New(fileName,loadAll);
2581 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2583 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2586 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2588 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2591 MEDFileFloatField1TS(DataArrayByte *db)
2593 return MEDFileFloatField1TS::New(db);
2596 std::string __str__() const
2598 return self->simpleRepr();
2601 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2603 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2606 DataArrayFloat *getUndergroundDataArray() const
2608 DataArrayFloat *ret=self->getUndergroundDataArray();
2614 PyObject *getUndergroundDataArrayExt() const
2616 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2621 class MEDFileAnyTypeFieldMultiTSIterator
2628 MEDFileAnyTypeField1TS *ret=self->nextt();
2630 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2633 PyErr_SetString(PyExc_StopIteration,"No more data.");
2640 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2643 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2644 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2645 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2646 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2647 std::string getName() const;
2648 void setName(const std::string& name);
2649 std::string getDtUnit() const;
2650 void setDtUnit(const std::string& dtUnit);
2651 std::string getMeshName() const;
2652 void setMeshName(const std::string& newMeshName);
2653 const std::vector<std::string>& getInfo() const;
2654 bool presenceOfMultiDiscPerGeoType() const;
2655 int getNumberOfComponents() const;
2656 int getNumberOfTS() const;
2657 void eraseEmptyTS();
2658 int getPosOfTimeStep(int iteration, int order) const;
2659 int getPosGivenTime(double time, double eps=1e-8) const;
2661 void loadArraysIfNecessary();
2662 void unloadArrays();
2663 void unloadArraysWithoutDataLoss();
2665 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2666 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2667 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2668 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2669 void synchronizeNameScope();
2670 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2675 return self->getNumberOfTS();
2678 int getTimeId(PyObject *elt0) const
2680 if(elt0 && PyInt_Check(elt0))
2682 int pos=(int)PyInt_AS_LONG(elt0);
2685 else if(elt0 && PyTuple_Check(elt0))
2687 if(PyTuple_Size(elt0)==2)
2689 PyObject *o0=PyTuple_GetItem(elt0,0);
2690 PyObject *o1=PyTuple_GetItem(elt0,1);
2691 if(PyInt_Check(o0) && PyInt_Check(o1))
2693 int iter=(int)PyInt_AS_LONG(o0);
2694 int order=(int)PyInt_AS_LONG(o1);
2695 return self->getPosOfTimeStep(iter,order);
2698 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 !");
2701 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 !");
2703 else if(elt0 && PyFloat_Check(elt0))
2705 double val=PyFloat_AS_DOUBLE(elt0);
2706 return self->getPosGivenTime(val);
2709 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2712 PyObject *getIterations() const
2714 std::vector< std::pair<int,int> > res(self->getIterations());
2715 return convertVecPairIntToPy(res);
2718 PyObject *getTimeSteps() const
2720 std::vector<double> ret1;
2721 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2722 std::size_t sz=ret.size();
2723 PyObject *ret2=PyList_New(sz);
2724 for(std::size_t i=0;i<sz;i++)
2726 PyObject *elt=PyTuple_New(3);
2727 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2728 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2729 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2730 PyList_SetItem(ret2,i,elt);
2735 PyObject *getTypesOfFieldAvailable() const
2737 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2738 PyObject *ret2=PyList_New(ret.size());
2739 for(int i=0;i<(int)ret.size();i++)
2741 const std::vector<TypeOfField>& rett=ret[i];
2742 PyObject *ret3=PyList_New(rett.size());
2743 for(int j=0;j<(int)rett.size();j++)
2744 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2745 PyList_SetItem(ret2,i,ret3);
2750 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2752 std::vector<int> ret1;
2753 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2754 PyObject *elt=PyTuple_New(2);
2755 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2756 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2760 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2762 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2763 std::vector< std::vector<TypeOfField> > typesF;
2764 std::vector< std::vector<std::string> > pfls;
2765 std::vector< std::vector<std::string> > locs;
2766 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2767 std::size_t sz=ret.size();
2768 PyObject *ret2=PyList_New(sz);
2769 for(std::size_t i=0;i<sz;i++)
2771 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2772 const std::vector<TypeOfField>& typesFI=typesF[i];
2773 const std::vector<std::string>& pflsI=pfls[i];
2774 const std::vector<std::string>& locsI=locs[i];
2775 PyObject *elt=PyTuple_New(2);
2776 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2777 std::size_t sz2=ret[i].size();
2778 PyObject *elt2=PyList_New(sz2);
2779 for(std::size_t j=0;j<sz2;j++)
2781 PyObject *elt3=PyTuple_New(4);
2782 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2783 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2784 PyTuple_SetItem(elt3,1,elt4);
2785 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2786 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2787 PyList_SetItem(elt2,j,elt3);
2789 PyTuple_SetItem(elt,1,elt2);
2790 PyList_SetItem(ret2,i,elt);
2795 std::vector<int> getTimeIds(PyObject *elts) const
2797 if(PyList_Check(elts))
2799 std::size_t sz=PyList_Size(elts);
2800 std::vector<int> ret(sz);
2801 for(std::size_t i=0;i<sz;i++)
2803 PyObject *elt=PyList_GetItem(elts,i);
2804 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2810 std::vector<int> ret(1);
2811 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2816 void __delitem__(PyObject *elts)
2818 if(PySlice_Check(elts))
2820 Py_ssize_t strt=2,stp=2,step=2;
2821 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2822 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2826 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2827 if(!idsToRemove.empty())
2828 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2832 void eraseTimeStepIds(PyObject *li)
2836 std::vector<int> pos2;
2837 DataArrayInt32 *pos3=0;
2838 DataArrayIntTuple *pos4=0;
2839 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2844 self->eraseTimeStepIds(&pos1,&pos1+1);
2851 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2856 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2860 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2864 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2866 return self->iterator();
2869 PyObject *__getitem__(PyObject *elt0) const
2871 if(elt0 && PyList_Check(elt0))
2873 std::size_t sz=PyList_Size(elt0);
2874 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2875 int *pt=da->getPointer();
2876 for(std::size_t i=0;i<sz;i++,pt++)
2878 PyObject *elt1=PyList_GetItem(elt0,i);
2879 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2881 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2883 else if(elt0 && PySlice_Check(elt0))
2885 Py_ssize_t strt=2,stp=2,step=2;
2886 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2887 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2890 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2893 bool changeMeshNames(PyObject *li)
2895 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2896 return self->changeMeshNames(modifTab);
2899 PyObject *splitComponents() const
2901 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2902 std::size_t sz=ret.size();
2903 PyObject *retPy=PyList_New(sz);
2904 for(std::size_t i=0;i<sz;i++)
2905 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2909 PyObject *splitDiscretizations() const
2911 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2912 std::size_t sz=ret.size();
2913 PyObject *retPy=PyList_New(sz);
2914 for(std::size_t i=0;i<sz;i++)
2915 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2919 PyObject *splitMultiDiscrPerGeoTypes() const
2921 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2922 std::size_t sz=ret.size();
2923 PyObject *retPy=PyList_New(sz);
2924 for(std::size_t i=0;i<sz;i++)
2925 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2929 void pushBackTimeSteps(PyObject *li)
2932 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2933 if(SWIG_IsOK(status))
2935 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2939 std::vector<MEDFileAnyTypeField1TS *> tmp;
2940 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2941 self->pushBackTimeSteps(tmp);
2945 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2947 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2948 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2949 return self->extractPart(extractDefCpp,mm);
2952 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2954 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2955 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2956 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2957 std::size_t sz=ret.size();
2958 PyObject *retPy=PyList_New(sz);
2959 for(std::size_t i=0;i<sz;i++)
2961 std::size_t sz2=ret[i].size();
2962 PyObject *ret1Py=PyList_New(sz2);
2963 for(std::size_t j=0;j<sz2;j++)
2965 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2968 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2970 PyList_SetItem(retPy,i,ret1Py);
2975 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2977 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2978 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2979 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2980 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2981 if(ret2.size()!=ret.size())
2983 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2984 throw INTERP_KERNEL::Exception(oss.str().c_str());
2986 std::size_t sz=ret.size();
2987 PyObject *retPy=PyList_New(sz);
2988 for(std::size_t i=0;i<sz;i++)
2990 std::size_t sz2=ret[i].size();
2991 PyObject *ret0Py=PyTuple_New(2);
2992 PyObject *ret1Py=PyList_New(sz2);
2993 for(std::size_t j=0;j<sz2;j++)
2995 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2998 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
3000 PyTuple_SetItem(ret0Py,0,ret1Py);
3001 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
3002 PyList_SetItem(retPy,i,ret0Py);
3009 class MEDFileInt32FieldMultiTS;
3010 class MEDFileInt64FieldMultiTS;
3012 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3015 static MEDFileFieldMultiTS *New();
3016 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3017 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3018 static MEDFileFieldMultiTS *New(DataArrayByte *db);
3020 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
3021 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3022 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3023 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3024 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3025 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3027 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
3028 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3029 MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
3032 MEDFileFieldMultiTS()
3034 return MEDFileFieldMultiTS::New();
3037 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
3039 return MEDFileFieldMultiTS::New(fileName,loadAll);
3042 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3044 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
3047 MEDFileFieldMultiTS(DataArrayByte *db)
3049 return MEDFileFieldMultiTS::New(db);
3052 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3054 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3055 std::size_t sz(tmp.size());
3056 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3057 for(std::size_t i=0;i<sz;i++)
3059 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3060 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3062 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3065 std::string __str__() const
3067 return self->simpleRepr();
3070 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3072 DataArrayIdType *ret1=0;
3073 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3074 PyObject *ret=PyTuple_New(2);
3075 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3076 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3080 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
3082 std::vector<INTERP_KERNEL::NormalizedCellType> types;
3083 std::vector< std::vector<TypeOfField> > typesF;
3084 std::vector< std::vector<std::string> > pfls;
3085 std::vector< std::vector<std::string> > locs;
3086 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
3087 std::size_t sz=ret.size();
3088 PyObject *ret2=PyList_New(sz);
3089 for(std::size_t i=0;i<sz;i++)
3091 const std::vector<DataArrayDouble *>& dadsI=ret[i];
3092 const std::vector<TypeOfField>& typesFI=typesF[i];
3093 const std::vector<std::string>& pflsI=pfls[i];
3094 const std::vector<std::string>& locsI=locs[i];
3095 PyObject *elt=PyTuple_New(2);
3096 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
3097 std::size_t sz2=ret[i].size();
3098 PyObject *elt2=PyList_New(sz2);
3099 for(std::size_t j=0;j<sz2;j++)
3101 PyObject *elt3=PyTuple_New(4);
3102 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
3103 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3104 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3105 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3106 PyList_SetItem(elt2,j,elt3);
3108 PyTuple_SetItem(elt,1,elt2);
3109 PyList_SetItem(ret2,i,elt);
3113 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3115 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3121 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3123 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3124 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3127 PyObject *ret=PyTuple_New(2);
3128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3129 std::size_t sz=elt1Cpp.size();
3130 PyObject *elt=PyList_New(sz);
3131 for(std::size_t i=0;i<sz;i++)
3133 PyObject *elt1=PyTuple_New(2);
3134 PyObject *elt2=PyTuple_New(2);
3135 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3136 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3137 PyObject *elt3=PyTuple_New(2);
3138 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3139 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3140 PyTuple_SetItem(elt1,0,elt2);
3141 PyTuple_SetItem(elt1,1,elt3);
3142 PyList_SetItem(elt,i,elt1);
3144 PyTuple_SetItem(ret,1,elt);
3150 class MEDFileFieldsIterator
3157 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3159 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3162 PyErr_SetString(PyExc_StopIteration,"No more data.");
3169 class MEDFileInt32FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3172 static MEDFileInt32FieldMultiTS *New();
3173 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3174 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3175 static MEDFileInt32FieldMultiTS *New(DataArrayByte *db);
3177 void appendFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
3178 void appendFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3179 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3180 MEDCouplingFieldInt32 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3181 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3182 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3183 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3184 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3185 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3188 MEDFileInt32FieldMultiTS()
3190 return MEDFileInt32FieldMultiTS::New();
3193 MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true)
3195 return MEDFileInt32FieldMultiTS::New(fileName,loadAll);
3198 MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3200 return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll);
3203 MEDFileInt32FieldMultiTS(DataArrayByte *db)
3205 return MEDFileInt32FieldMultiTS::New(db);
3208 static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3210 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3211 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3212 return MEDFileInt32FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3215 std::string __str__() const
3217 return self->simpleRepr();
3220 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3222 DataArrayIdType *ret1=0;
3223 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3224 PyObject *ret=PyTuple_New(2);
3225 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int32>::TI, SWIG_POINTER_OWN | 0 ));
3226 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3230 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3232 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3240 class MEDFileInt64FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3243 static MEDFileInt64FieldMultiTS *New();
3244 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3245 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3246 static MEDFileInt64FieldMultiTS *New(DataArrayByte *db);
3248 void appendFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
3249 void appendFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3250 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3251 MEDCouplingFieldInt64 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3252 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3253 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3254 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3255 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3256 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3259 MEDFileInt64FieldMultiTS()
3261 return MEDFileInt64FieldMultiTS::New();
3264 MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true)
3266 return MEDFileInt64FieldMultiTS::New(fileName,loadAll);
3269 MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3271 return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll);
3274 MEDFileInt64FieldMultiTS(DataArrayByte *db)
3276 return MEDFileInt64FieldMultiTS::New(db);
3279 static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3281 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3282 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3283 return MEDFileInt64FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3286 std::string __str__() const
3288 return self->simpleRepr();
3291 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3293 DataArrayIdType *ret1=0;
3294 DataArrayInt64 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3295 PyObject *ret=PyTuple_New(2);
3296 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int64>::TI, SWIG_POINTER_OWN | 0 ));
3297 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3301 DataArrayInt64 *getUndergroundDataArray(int iteration, int order) const
3303 DataArrayInt64 *ret=self->getUndergroundDataArray(iteration,order);
3311 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3314 static MEDFileFloatFieldMultiTS *New();
3315 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3316 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3317 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3319 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3320 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3321 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3322 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3323 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3324 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3325 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3326 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3327 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3330 MEDFileFloatFieldMultiTS()
3332 return MEDFileFloatFieldMultiTS::New();
3335 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3337 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3340 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3342 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3345 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3347 return MEDFileFloatFieldMultiTS::New(db);
3350 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3352 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3353 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3354 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3357 std::string __str__() const
3359 return self->simpleRepr();
3362 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3364 DataArrayIdType *ret1=0;
3365 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3366 PyObject *ret=PyTuple_New(2);
3367 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3368 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3372 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3374 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3382 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3385 static MEDFileMeshSupports *New(const std::string& fileName);
3386 std::vector<std::string> getSupMeshNames() const;
3389 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3391 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3392 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3400 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3403 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3405 MEDFileStructureElements();
3408 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3411 static MEDFileFields *New();
3412 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3413 static MEDFileFields *New(DataArrayByte *db);
3414 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3415 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3416 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3417 MEDFileFields *deepCopy() const;
3418 MEDFileFields *shallowCpy() const;
3420 void loadArraysIfNecessary();
3421 void unloadArrays();
3422 void unloadArraysWithoutDataLoss();
3423 int getNumberOfFields() const;
3424 std::vector<std::string> getFieldsNames() const;
3425 std::vector<std::string> getMeshesNames() const;
3427 void resize(int newSize);
3428 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3429 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3430 int getPosFromFieldName(const std::string& fieldName) const;
3431 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3432 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3433 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3434 bool presenceOfStructureElements() const;
3435 void aggregate(const MEDFileFields& other);
3436 void killStructureElements();
3437 void keepOnlyStructureElements();
3438 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3439 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3440 void destroyFieldAtPos(int i);
3441 bool removeFieldsWithoutAnyTimeStep();
3446 return MEDFileFields::New();
3449 MEDFileFields(const std::string& fileName, bool loadAll=true)
3451 return MEDFileFields::New(fileName,loadAll);
3454 MEDFileFields(DataArrayByte *db)
3456 return MEDFileFields::New(db);
3459 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3461 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3464 std::string __str__() const
3466 return self->simpleRepr();
3469 MEDFileFields *partOfThisOnStructureElements() const
3471 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3475 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3477 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3481 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3483 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3484 std::size_t sz(tmp.size());
3485 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3486 for(std::size_t i=0;i<sz;i++)
3488 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3489 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3491 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3494 PyObject *getMeshSENames() const
3496 std::vector< std::pair<std::string,std::string> > ps;
3497 self->getMeshSENames(ps);
3498 return convertVectPairStToPy(ps);
3501 PyObject *getCommonIterations() const
3504 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3505 PyObject *ret=PyTuple_New(2);
3506 PyObject *ret_0=PyList_New(ret0.size());
3508 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3510 PyObject *elt=PyTuple_New(2);
3511 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3512 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3513 PyList_SetItem(ret_0,rk,elt);
3515 PyTuple_SetItem(ret,0,ret_0);
3516 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3517 PyTuple_SetItem(ret,1,ret_1);
3521 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3523 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3524 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3527 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3529 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3530 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3533 PyObject *__getitem__(PyObject *obj)
3535 if(obj && PyList_Check(obj))
3537 std::size_t sz=PyList_Size(obj);
3538 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3539 int *pt=da->getPointer();
3540 for(std::size_t i=0;i<sz;i++,pt++)
3542 PyObject *elt1=PyList_GetItem(obj,i);
3543 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3545 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3548 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3551 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3553 self->setFieldAtPos(obj,field);
3559 return self->getNumberOfFields();
3562 MEDFileFieldsIterator *__iter__()
3564 return self->iterator();
3567 bool changeMeshNames(PyObject *li)
3569 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3570 return self->changeMeshNames(modifTab);
3573 int getPosOfField(PyObject *elt0) const
3575 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3577 throw INTERP_KERNEL::Exception(msg);
3578 if(PyInt_Check(elt0))
3580 return (int)PyInt_AS_LONG(elt0);
3582 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3585 std::vector<int> getPosOfFields(PyObject *elts) const
3587 if(PyList_Check(elts))
3589 std::size_t sz=PyList_Size(elts);
3590 std::vector<int> ret(sz);
3591 for(std::size_t i=0;i<sz;i++)
3593 PyObject *elt=PyList_GetItem(elts,i);
3594 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3600 std::vector<int> ret(1);
3601 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3606 void pushFields(PyObject *fields)
3608 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3609 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3610 self->pushFields(tmp);
3613 void __delitem__(PyObject *elts)
3615 if(elts && PySlice_Check(elts))
3617 Py_ssize_t strt=2,stp=2,step=2;
3618 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3619 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3623 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3624 if(!idsToRemove.empty())
3625 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3629 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3631 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3632 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3633 return self->extractPart(extractDefCpp,mm);
3636 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3638 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3644 class MEDFileParameter1TS : public RefCountObject
3647 void setIteration(int it);
3648 int getIteration() const;
3649 void setOrder(int order);
3650 int getOrder() const;
3651 void setTimeValue(double time);
3652 void setTime(int dt, int it, double time);
3653 double getTime(int& dt, int& it);
3654 double getTimeValue() const;
3657 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3660 void setValue(double val);
3661 double getValue() const;
3662 std::string simpleRepr() const;
3665 std::string __str__() const
3667 return self->simpleRepr();
3672 class MEDFileParameterTinyInfo : public MEDFileWritable
3675 void setDescription(const std::string& name);
3676 std::string getDescription() const;
3677 void setTimeUnit(const std::string& unit);
3678 std::string getTimeUnit() const;
3681 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3684 static MEDFileParameterDouble1TS *New();
3685 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3686 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3687 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3688 virtual MEDFileParameter1TS *deepCopy() const;
3689 virtual std::string simpleRepr() const;
3690 void setName(const std::string& name);
3691 std::string getName() const;
3692 void write(const std::string& fileName, int mode) const;
3695 MEDFileParameterDouble1TS()
3697 return MEDFileParameterDouble1TS::New();
3700 MEDFileParameterDouble1TS(const std::string& fileName)
3702 return MEDFileParameterDouble1TS::New(fileName);
3705 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3707 return MEDFileParameterDouble1TS::New(fileName,paramName);
3710 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3712 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3715 std::string __str__() const
3717 return self->simpleRepr();
3720 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3723 bool ret0=self->isEqual(other,eps,what);
3724 PyObject *res=PyList_New(2);
3725 PyObject *ret0Py=ret0?Py_True:Py_False;
3727 PyList_SetItem(res,0,ret0Py);
3728 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3734 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3737 static MEDFileParameterMultiTS *New();
3738 static MEDFileParameterMultiTS *New(const std::string& fileName);
3739 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3740 std::string getName() const;
3741 void setName(const std::string& name);
3742 MEDFileParameterMultiTS *deepCopy() const;
3743 void write(const std::string& fileName, int mode) const;
3744 std::string simpleRepr() const;
3745 void appendValue(int dt, int it, double time, double val);
3746 double getDoubleValue(int iteration, int order) const;
3747 int getPosOfTimeStep(int iteration, int order) const;
3748 int getPosGivenTime(double time, double eps=1e-8) const;
3749 int getNumberOfTS() const;
3752 MEDFileParameterMultiTS()
3754 return MEDFileParameterMultiTS::New();
3757 MEDFileParameterMultiTS(const std::string& fileName)
3759 return MEDFileParameterMultiTS::New(fileName);
3762 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3764 return MEDFileParameterMultiTS::New(fileName,paramName);
3767 std::string __str__() const
3769 return self->simpleRepr();
3772 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3775 bool ret0=self->isEqual(other,eps,what);
3776 PyObject *res=PyList_New(2);
3777 PyObject *ret0Py=ret0?Py_True:Py_False;
3779 PyList_SetItem(res,0,ret0Py);
3780 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3784 void eraseTimeStepIds(PyObject *ids)
3788 std::vector<int> pos2;
3789 DataArrayInt *pos3=0;
3790 DataArrayIntTuple *pos4=0;
3791 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3796 self->eraseTimeStepIds(&pos1,&pos1+1);
3803 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3808 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3812 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3816 int getTimeStepId(PyObject *elt0) const
3818 if(elt0 && PyInt_Check(elt0))
3820 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3823 else if(elt0 && PyTuple_Check(elt0))
3825 if(PyTuple_Size(elt0)==2)
3827 PyObject *o0=PyTuple_GetItem(elt0,0);
3828 PyObject *o1=PyTuple_GetItem(elt0,1);
3829 if(PyInt_Check(o0) && PyInt_Check(o1))
3831 int iter=(int)PyInt_AS_LONG(o0);
3832 int order=(int)PyInt_AS_LONG(o1);
3833 return self->getPosOfTimeStep(iter,order);
3836 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 !");
3839 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 !");
3841 else if(elt0 && PyFloat_Check(elt0))
3843 double val=PyFloat_AS_DOUBLE(elt0);
3844 return self->getPosGivenTime(val);
3847 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3850 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3852 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3858 std::vector<int> getTimeStepIds(PyObject *elts) const
3860 if(PyList_Check(elts))
3862 std::size_t sz=PyList_Size(elts);
3863 std::vector<int> ret(sz);
3864 for(std::size_t i=0;i<sz;i++)
3866 PyObject *elt=PyList_GetItem(elts,i);
3867 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3873 std::vector<int> ret(1);
3874 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3879 void __delitem__(PyObject *elts)
3881 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3882 if(!idsToRemove.empty())
3883 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3886 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3888 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3894 PyObject *getIterations() const
3896 std::vector< std::pair<int,int> > res=self->getIterations();
3897 PyObject *ret=PyList_New(res.size());
3899 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3901 PyObject *elt=PyTuple_New(2);
3902 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3903 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3904 PyList_SetItem(ret,rk,elt);
3909 PyObject *getTimeSteps() const
3911 std::vector<double> res2;
3912 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3913 PyObject *ret=PyList_New(res.size());
3915 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3917 PyObject *elt=PyTuple_New(3);
3918 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3919 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3920 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3921 PyList_SetItem(ret,rk,elt);
3928 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3931 static MEDFileParameters *New();
3932 static MEDFileParameters *New(const std::string& fileName);
3933 static MEDFileParameters *New(DataArrayByte *db);
3934 MEDFileParameters *deepCopy() const;
3935 std::vector<std::string> getParamsNames() const;
3936 std::string simpleRepr() const;
3937 void resize(int newSize);
3938 void pushParam(MEDFileParameterMultiTS *param);
3939 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3940 void destroyParamAtPos(int i);
3941 int getPosFromParamName(const std::string& paramName) const;
3942 int getNumberOfParams() const;
3947 return MEDFileParameters::New();
3950 MEDFileParameters(const std::string& fileName)
3952 return MEDFileParameters::New(fileName);
3955 MEDFileParameters(DataArrayByte *db)
3957 return MEDFileParameters::New(db);
3960 std::string __str__() const
3962 return self->simpleRepr();
3965 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3967 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3968 if(PyInt_Check(obj))
3970 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3975 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3983 return self->getNumberOfParams();
3986 MEDFileParameterMultiTS *getParamAtPos(int i) const
3988 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3994 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3996 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
4002 PyObject *isEqual(const MEDFileParameters *other, double eps) const
4005 bool ret0=self->isEqual(other,eps,what);
4006 PyObject *res=PyList_New(2);
4007 PyObject *ret0Py=ret0?Py_True:Py_False;
4009 PyList_SetItem(res,0,ret0Py);
4010 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
4016 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
4019 static MEDFileData *New(DataArrayByte *db);
4020 static MEDFileData *New(const std::string& fileName);
4021 static MEDFileData *New();
4022 MEDFileData *deepCopy() const;
4023 void setFields(MEDFileFields *fields);
4024 void setMeshes(MEDFileMeshes *meshes);
4025 void setParams(MEDFileParameters *params);
4026 int getNumberOfFields() const;
4027 int getNumberOfMeshes() const;
4028 int getNumberOfParams() const;
4030 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
4031 bool unPolyzeMeshes();
4032 void dealWithStructureElements();
4033 std::string getHeader() const;
4034 void setHeader(const std::string& header);
4038 MEDFileData(const std::string& fileName)
4040 return MEDFileData::New(fileName);
4043 MEDFileData(DataArrayByte *db)
4045 return MEDFileData::New(db);
4050 return MEDFileData::New();
4053 std::string __str__() const
4055 return self->simpleRepr();
4058 MEDFileMeshes *getMeshes() const
4060 MEDFileMeshes *ret=self->getMeshes();
4066 MEDFileParameters *getParams() const
4068 MEDFileParameters *ret=self->getParams();
4074 MEDFileFields *getFields() const
4076 MEDFileFields *ret=self->getFields();
4082 bool changeMeshNames(PyObject *li)
4084 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
4085 return self->changeMeshNames(modifTab);
4088 static MEDFileData *Aggregate(PyObject *mfds)
4090 std::vector<const MEDFileData *> mfdsCpp;
4091 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
4092 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
4098 class SauvReader : public RefCountObject
4101 static SauvReader* New(const std::string& fileName);
4102 MEDFileData * loadInMEDFileDS();
4105 SauvReader(const std::string& fileName)
4107 return SauvReader::New(fileName);
4112 class SauvWriter : public RefCountObject
4115 static SauvWriter * New();
4116 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
4117 void write(const std::string& fileName);
4118 void setCpyGrpIfOnASingleFamilyStatus(bool status);
4119 bool getCpyGrpIfOnASingleFamilyStatus() const;
4124 return SauvWriter::New();
4131 class MEDFileMeshStruct;
4133 class MEDFileField1TSStructItem
4136 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
4139 class MEDFileMeshStruct : public RefCountObject
4142 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
4144 ~MEDFileMeshStruct();
4147 class MEDMeshMultiLev : public RefCountObject
4150 virtual MEDMeshMultiLev *prepare() const;
4151 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
4152 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
4158 PyObject *retrieveFamilyIdsOnCells() const
4160 DataArrayIdType *famIds(0);
4161 bool isWithoutCopy(false);
4162 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
4163 PyObject *ret=PyTuple_New(2);
4164 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4166 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4167 PyTuple_SetItem(ret,1,ret1Py);
4171 PyObject *retrieveNumberIdsOnCells() const
4173 DataArrayIdType *numIds(0);
4174 bool isWithoutCopy(false);
4175 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4176 PyObject *ret=PyTuple_New(2);
4177 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4179 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4180 PyTuple_SetItem(ret,1,ret1Py);
4184 PyObject *retrieveFamilyIdsOnNodes() const
4186 DataArrayIdType *famIds(0);
4187 bool isWithoutCopy(false);
4188 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4189 PyObject *ret=PyTuple_New(2);
4190 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4192 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4193 PyTuple_SetItem(ret,1,ret1Py);
4197 PyObject *retrieveNumberIdsOnNodes() const
4199 DataArrayIdType *numIds(0);
4200 bool isWithoutCopy(false);
4201 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4202 PyObject *ret=PyTuple_New(2);
4203 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4205 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4206 PyTuple_SetItem(ret,1,ret1Py);
4210 PyObject *getGeoTypes() const
4212 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4213 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4214 PyObject *res(PyList_New(result.size()));
4215 for(int i=0;iL!=result.end(); i++, iL++)
4216 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4222 class MEDUMeshMultiLev : public MEDMeshMultiLev
4225 ~MEDUMeshMultiLev();
4229 PyObject *buildVTUArrays() const
4231 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4232 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4233 PyObject *ret0Py=ncc?Py_True:Py_False;
4235 PyObject *ret=PyTuple_New(7);
4236 PyTuple_SetItem(ret,0,ret0Py);
4237 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4238 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4239 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4240 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4241 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4242 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4248 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4251 ~MEDStructuredMeshMultiLev();
4254 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4257 ~MEDCMeshMultiLev();
4261 PyObject *buildVTUArrays() const
4264 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4265 std::size_t sz(objs.size());
4266 PyObject *ret(PyTuple_New(2));
4267 PyObject *ret0=PyList_New(sz);
4268 for(std::size_t i=0;i<sz;i++)
4269 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4270 PyTuple_SetItem(ret,0,ret0);
4271 PyObject *ret1Py(isInternal?Py_True:Py_False);
4273 PyTuple_SetItem(ret,1,ret1Py);
4279 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4282 ~MEDCurveLinearMeshMultiLev();
4286 PyObject *buildVTUArrays() const
4288 DataArrayDouble *ret0(0);
4289 std::vector<mcIdType> ret1;
4291 self->buildVTUArrays(ret0,ret1,ret2);
4292 std::size_t sz(ret1.size());
4293 PyObject *ret=PyTuple_New(3);
4294 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4295 PyObject *ret1Py=PyList_New(sz);
4296 for(std::size_t i=0;i<sz;i++)
4297 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4298 PyTuple_SetItem(ret,1,ret1Py);
4299 PyObject *ret2Py(ret2?Py_True:Py_False);
4301 PyTuple_SetItem(ret,2,ret2Py);
4307 class MEDFileFastCellSupportComparator : public RefCountObject
4310 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4311 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4312 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4313 int getNumberOfTS() const;
4315 ~MEDFileFastCellSupportComparator();
4319 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4321 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4322 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4323 PyObject *res(PyList_New(result.size()));
4324 for(int i=0;iL!=result.end(); i++, iL++)
4325 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4336 def exit1TS(self, exctype, exc, tb):
4339 MEDFileAnyTypeField1TS.__enter__=enter1TS
4340 MEDFileAnyTypeField1TS.__exit__=exit1TS
4341 MEDFileIntField1TS = MEDFileInt32Field1TS
4342 MEDFileIntFieldMultiTS = MEDFileInt32FieldMultiTS
4343 if MEDCouplingUse64BitIDs():
4344 MEDFileIDField1TS = MEDFileInt64Field1TS
4345 MEDFileIDFieldMultiTS = MEDFileInt64FieldMultiTS
4347 MEDFileIDField1TS = MEDFileInt32Field1TS
4348 MEDFileIDFieldMultiTS = MEDFileInt32FieldMultiTS