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 unsigned int getCode() const;
676 void setCode(unsigned int newCode);
677 bool isCellFamilyFieldReading() const;
678 bool isNodeFamilyFieldReading() const;
679 bool isCellNameFieldReading() const;
680 bool isNodeNameFieldReading() const;
681 bool isCellNumFieldReading() const;
682 bool isNodeNumFieldReading() const;
683 bool isGlobalNodeNumFieldReading() const;
684 void setCellFamilyFieldReading(bool b);
685 void setNodeFamilyFieldReading(bool b);
686 void setCellNameFieldReading(bool b);
687 void setNodeNameFieldReading(bool b);
688 void setCellNumFieldReading(bool b);
689 void setNodeNumFieldReading(bool b);
690 void setGlobalNodeNumFieldReading(bool b);
693 std::string __str__() const
695 std::ostringstream oss;
700 std::string __repr__() const
702 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
708 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
711 static MEDFileJointCorrespondence *New();
712 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
714 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
715 INTERP_KERNEL::NormalizedCellType loc_geo_type,
716 INTERP_KERNEL::NormalizedCellType rem_geo_type)
718 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
719 MEDFileJointCorrespondence *deepCopy() const;
720 MEDFileJointCorrespondence *shallowCpy() const;
721 void setIsNodal(bool isNodal);
722 bool getIsNodal() const;
723 bool isEqual(const MEDFileJointCorrespondence *other) const;
724 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
725 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
726 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
727 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
728 void setCorrespondence(DataArrayIdType *corr);
729 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
730 std::string simpleRepr() const;
733 MEDFileJointCorrespondence()
735 return MEDFileJointCorrespondence::New();
737 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
739 return MEDFileJointCorrespondence::New(correspondence);
741 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
742 INTERP_KERNEL::NormalizedCellType loc_geo_type,
743 INTERP_KERNEL::NormalizedCellType rem_geo_type)
745 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
748 std::string __str__() const
750 return self->simpleRepr();
753 DataArrayIdType *getCorrespondence() const
755 const DataArrayIdType *ret(self->getCorrespondence());
758 return const_cast<DataArrayIdType *>(ret);
763 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
766 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
767 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
768 MEDFileJointOneStep *deepCopy() const;
769 MEDFileJointOneStep *shallowCpy() const;
770 bool isEqual(const MEDFileJointOneStep *other) const;
771 void setOrder(int order);
772 int getOrder() const;
773 void setIteration(int it);
774 int getIteration() const;
775 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
776 int getNumberOfCorrespondences() const;
777 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
778 std::string simpleRepr() const;
781 MEDFileJointOneStep()
783 return MEDFileJointOneStep::New();
786 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
788 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
791 std::string __str__() const
793 return self->simpleRepr();
796 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
798 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
804 MEDFileJointCorrespondence *__getitem__(int i) const
806 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
811 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
814 static MEDFileJoint *New();
815 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
816 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
817 MEDFileJoint *deepCopy() const;
818 MEDFileJoint *shallowCpy() const;
819 bool isEqual(const MEDFileJoint *other) const;
820 void setLocalMeshName(const std::string& name);
821 std::string getLocalMeshName() const;
822 void setRemoteMeshName(const std::string& name);
823 std::string getRemoteMeshName() const;
824 void setDescription(const std::string& name);
825 std::string getDescription() const;
826 void setJointName(const std::string& name);
827 std::string getJointName() const;
828 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
829 void setDomainNumber(const int& number);
830 int getDomainNumber() const;
831 void pushStep(MEDFileJointOneStep* step);
832 int getNumberOfSteps() const;
833 std::string simpleRepr() const;
838 return MEDFileJoint::New();
841 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
843 return MEDFileJoint::New(fileName,mName,num);
846 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
848 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
851 std::string __str__() const
853 return self->simpleRepr();
856 MEDFileJointOneStep *getStepAtPos(int i) const
858 MEDFileJointOneStep *ret(self->getStepAtPos(i));
864 MEDFileJointOneStep *__getitem__(int i)
866 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
871 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
874 static MEDFileJoints *New();
875 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
876 MEDFileJoints *deepCopy() const;
877 std::string simpleRepr() const;
878 std::string getMeshName() const;
879 int getNumberOfJoints() const;
880 std::vector<std::string> getJointsNames() const;
881 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
882 void resize(int newSize);
883 void pushJoint(MEDFileJoint *joint);
884 void setJointAtPos(int i, MEDFileJoint *joint);
885 void destroyJointAtPos(int i);
890 return MEDFileJoints::New();
893 MEDFileJoints(const std::string& fileName, const std::string& meshName)
895 return MEDFileJoints::New(fileName,meshName);
898 std::string __str__() const
900 return self->simpleRepr();
903 MEDFileJoint *__getitem__(PyObject *obj)
905 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
908 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
913 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
921 return self->getNumberOfJoints();
924 MEDFileJoint *getJointAtPos(int i) const
926 MEDFileJoint *ret=self->getJointAtPos(i);
932 MEDFileJoint *getJointWithName(const std::string& paramName) const
934 MEDFileJoint *ret=self->getJointWithName(paramName);
942 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
945 MEDFileEquivalenceBase();
948 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
951 MEDFileEquivalenceData();
953 void setArray(DataArrayInt32 *data);
956 DataArrayInt32 *getArray()
958 DataArrayInt32 *ret(self->getArray());
959 if(ret) ret->incrRef();
965 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
968 MEDFileEquivalenceNode();
971 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
974 MEDFileEquivalenceCell();
977 std::size_t size() const;
978 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
979 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
982 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
984 DataArrayInt32 *ret(self->getArray(type));
985 if(ret) ret->incrRef();
989 PyObject *getTypes() const
991 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
992 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
993 PyObject *res=PyList_New(result.size());
994 for(int i=0;iL!=result.end(); i++, iL++)
995 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1001 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
1004 MEDFileEquivalencePair();
1006 std::string getName() const;
1007 void setName(const std::string& name);
1008 std::string getDescription() const;
1009 void setDescription(const std::string& descr);
1010 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
1013 MEDFileEquivalenceCell *initCell()
1015 MEDFileEquivalenceCell *ret(self->initCell());
1016 if(ret) ret->incrRef();
1020 MEDFileEquivalenceNode *initNode()
1022 MEDFileEquivalenceNode *ret(self->initNode());
1023 if(ret) ret->incrRef();
1027 MEDFileEquivalenceCell *getCell()
1029 MEDFileEquivalenceCell *ret(self->getCell());
1030 if(ret) ret->incrRef();
1034 MEDFileEquivalenceNode *getNode()
1036 MEDFileEquivalenceNode *ret(self->getNode());
1037 if(ret) ret->incrRef();
1043 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1046 MEDFileEquivalences();
1049 std::vector<std::string> getEquivalenceNames() const;
1050 void killEquivalenceWithName(const std::string& name);
1051 void killEquivalenceAt(int i);
1055 MEDFileEquivalencePair *getEquivalence(int i)
1057 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1058 if(ret) ret->incrRef();
1061 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1063 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1064 if(ret) ret->incrRef();
1068 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1070 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1071 if(ret) ret->incrRef();
1077 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1080 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1081 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1082 static MEDFileMesh *New(DataArrayByte *db);
1083 virtual MEDFileMesh *createNewEmpty() const;
1084 virtual MEDFileMesh *deepCopy() const;
1085 virtual MEDFileMesh *shallowCpy() const;
1086 virtual void clearNonDiscrAttributes() const;
1087 void setName(const std::string& name);
1088 std::string getName();
1089 std::string getUnivName() const;
1090 bool getUnivNameWrStatus() const;
1091 void setUnivNameWrStatus(bool newStatus);
1092 void setDescription(const std::string& name);
1093 std::string getDescription() const;
1094 void setOrder(int order);
1095 int getOrder() const;
1096 void setIteration(int it);
1098 void setTimeValue(double time);
1099 void setTime(int dt, int it, double time);
1100 double getTimeValue() const;
1101 void setTimeUnit(const std::string& unit);
1102 std::string getTimeUnit() const;
1103 void setAxisType(MEDCouplingAxisType at);
1104 MEDCouplingAxisType getAxisType() const;
1105 virtual int getNumberOfNodes() const;
1106 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1107 virtual bool hasImplicitPart() const;
1108 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1109 virtual void releaseImplicitPartIfAny() const;
1110 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1111 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1112 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1113 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1114 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1115 virtual MEDFileMesh *cartesianize() const;
1116 std::vector<int> getNonEmptyLevels() const;
1117 std::vector<int> getNonEmptyLevelsExt() const;
1118 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1120 bool existsGroup(const std::string& groupName) const;
1121 bool existsFamily(int famId) const;
1122 bool existsFamily(const std::string& familyName) const;
1123 void setFamilyId(const std::string& familyName, int id);
1124 void setFamilyIdUnique(const std::string& familyName, int id);
1125 void addFamily(const std::string& familyName, int id);
1126 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1127 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1128 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1129 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1132 void clearFamGrpMaps();
1133 const std::map<std::string,int>& getFamilyInfo() const;
1134 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1135 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1136 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1137 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1138 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1139 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1140 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1141 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1142 std::vector<std::string> getGroupsNames() const;
1143 std::vector<std::string> getFamiliesNames() const;
1144 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1145 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1146 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1147 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1148 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1149 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1150 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1151 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1152 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1153 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1154 static std::string GetMagicFamilyStr();
1155 void assignFamilyNameWithGroupName();
1156 std::vector<std::string> removeEmptyGroups();
1157 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1158 void removeGroup(const std::string& name);
1159 void removeFamily(const std::string& name);
1160 std::vector<std::string> removeOrphanGroups();
1161 std::vector<std::string> removeOrphanFamilies();
1162 void removeFamiliesReferedByNoGroups();
1163 void rearrangeFamilies();
1165 void checkOrphanFamilyZero() const;
1166 void changeGroupName(const std::string& oldName, const std::string& newName);
1167 void changeFamilyName(const std::string& oldName, const std::string& newName);
1168 void changeFamilyId(int oldId, int newId);
1169 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1170 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1171 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1172 int getFamilyId(const std::string& name) const;
1173 int getMaxAbsFamilyId() const;
1174 int getMaxFamilyId() const;
1175 int getMinFamilyId() const;
1176 int getTheMaxAbsFamilyId() const;
1177 int getTheMaxFamilyId() const;
1178 int getTheMinFamilyId() const;
1179 virtual int getMaxAbsFamilyIdInArrays() const;
1180 virtual int getMaxFamilyIdInArrays() const;
1181 virtual int getMinFamilyIdInArrays() const;
1182 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1183 DataArrayIdType *computeAllFamilyIdsInUse() const;
1184 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1185 std::string getFamilyNameGivenId(int id) const;
1186 bool ensureDifferentFamIdsPerLevel();
1187 void normalizeFamIdsTrio();
1188 void normalizeFamIdsMEDFile();
1189 virtual int getMeshDimension() const;
1190 virtual std::string simpleRepr() const;
1191 virtual std::string advancedRepr() const;
1193 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1194 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1195 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1196 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1197 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1198 virtual void addNodeGroup(const DataArrayIdType *ids);
1199 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1200 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1201 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1202 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1203 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1204 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1205 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1206 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1207 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1208 int getNumberOfJoints();
1209 MEDFileJoints *getJoints();
1210 void setJoints( MEDFileJoints* joints );
1211 void initializeEquivalences();
1212 void killEquivalences();
1213 bool presenceOfStructureElements() const;
1214 void killStructureElements();
1217 std::string __str__() const
1219 return self->simpleRepr();
1222 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1224 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1227 static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(int geoType)
1229 med_geometry_type geoType2((med_geometry_type) geoType);
1230 return MEDFileMesh::ConvertFromMEDFileGeoType(geoType2);
1236 double tmp0=self->getTime(tmp1,tmp2);
1237 PyObject *res = PyList_New(3);
1238 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1239 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1240 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1244 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1247 bool ret0=self->isEqual(other,eps,what);
1248 PyObject *res=PyList_New(2);
1249 PyObject *ret0Py=ret0?Py_True:Py_False;
1251 PyList_SetItem(res,0,ret0Py);
1252 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1256 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1258 std::vector<const DataArrayIdType *> grps;
1259 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1260 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1263 PyObject *areFamsEqual(const MEDFileMesh *other) const
1266 bool ret0=self->areFamsEqual(other,what);
1267 PyObject *res=PyList_New(2);
1268 PyObject *ret0Py=ret0?Py_True:Py_False;
1270 PyList_SetItem(res,0,ret0Py);
1271 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1275 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1278 bool ret0=self->areGrpsEqual(other,what);
1279 PyObject *res=PyList_New(2);
1280 PyObject *ret0Py=ret0?Py_True:Py_False;
1282 PyList_SetItem(res,0,ret0Py);
1283 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1287 PyObject *getAllGeoTypes() const
1289 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1290 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1291 PyObject *res=PyList_New(result.size());
1292 for(int i=0;iL!=result.end(); i++, iL++)
1293 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1297 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1299 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1300 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1301 PyObject *res=PyList_New(result.size());
1302 for(int i=0;iL!=result.end(); i++, iL++)
1303 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1307 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1309 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1312 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1315 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1317 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1320 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1323 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1325 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1328 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1331 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1333 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1336 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1339 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1341 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1344 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1347 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1350 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1351 PyObject *ret=PyTuple_New(2);
1352 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1353 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1357 PyObject *unPolyze()
1359 DataArrayIdType *ret3=0;
1360 std::vector<mcIdType> ret1,ret2;
1361 bool ret0=self->unPolyze(ret1,ret2,ret3);
1362 PyObject *ret=PyTuple_New(4);
1363 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1365 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1366 for(int j=0;j<(int)ret1.size()/3;j++)
1368 PyObject *retLev2=PyList_New(3);
1369 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1370 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1371 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1372 PyList_SetItem(retLev1_0,j,retLev2);
1374 PyTuple_SetItem(ret,1,retLev1_0);
1376 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1377 for(int j=0;j<(int)ret2.size()/3;j++)
1379 PyObject *retLev2=PyList_New(3);
1380 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1381 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1382 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1383 PyList_SetItem(retLev1_1,j,retLev2);
1385 PyTuple_SetItem(ret,2,retLev1_1);
1387 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1391 MEDFileEquivalences *getEquivalences()
1393 MEDFileEquivalences *ret(self->getEquivalences());
1394 if(ret) ret->incrRef();
1398 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1400 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1406 class MEDFileUMesh : public MEDFileMesh
1409 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1410 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1411 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1412 static MEDFileUMesh *New(DataArrayByte *db);
1413 static MEDFileUMesh *New();
1414 static const char *GetSpeStr4ExtMesh();
1416 int getSpaceDimension() const;
1417 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1418 void checkConsistency() const;
1419 void checkSMESHConsistency() const;
1420 void clearNodeAndCellNumbers();
1422 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1423 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1424 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1425 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1426 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1427 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1428 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1429 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1430 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1431 void forceComputationOfParts() const;
1433 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1434 void setCoords(DataArrayDouble *coords);
1435 void setCoordsForced(DataArrayDouble *coords);
1436 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1437 void removeMeshAtLevel(int meshDimRelToMax);
1438 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1439 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1440 void optimizeFamilies();
1441 DataArrayIdType *computeFetchedNodeIds() const;
1442 DataArrayIdType *zipCoords();
1443 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1444 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1445 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1446 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1447 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1448 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1451 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1453 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1456 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1458 return MEDFileUMesh::New(fileName,mrs);
1461 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1463 return MEDFileUMesh::New(mem);
1466 MEDFileUMesh(DataArrayByte *db)
1468 return MEDFileUMesh::New(db);
1473 return MEDFileUMesh::New();
1476 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)
1478 std::vector<int> typesCpp1;
1479 convertPyToNewIntArr3(types,typesCpp1);
1480 std::size_t sz(typesCpp1.size());
1481 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1482 for(std::size_t ii=0;ii<sz;ii++)
1483 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1484 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1487 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)
1489 MCAuto<DataArrayDouble> coords;
1490 MCAuto<PartDefinition> partCoords;
1491 MCAuto<DataArrayIdType> famCoords,numCoords;
1492 MCAuto<DataArrayAsciiChar> nameCoord;
1493 MEDFileUMesh::LoadPartCoords(fileName,mName,dt,it,infosOnComp,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoord);
1494 PyObject *ret(PyTuple_New(5));
1495 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1496 PyTuple_SetItem(ret,1,convertPartDefinition(partCoords.retn(),SWIG_POINTER_OWN | 0));
1497 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(famCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1498 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(numCoords.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1499 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(nameCoord.retn()),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 ));
1503 PyObject *__getstate__()
1505 std::vector<double> a0;
1506 std::vector<mcIdType> a1;
1507 std::vector<std::string> a2;
1508 std::vector< MCAuto<DataArrayIdType> > a3;
1509 MCAuto<DataArrayDouble> a4;
1510 self->serialize(a0,a1,a2,a3,a4);
1511 PyObject *ret(PyTuple_New(5));
1512 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1513 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1514 std::size_t sz(a2.size());
1515 PyObject *ret2(PyList_New(sz));
1516 for(std::size_t i=0;i<sz;i++)
1517 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1518 PyTuple_SetItem(ret,2,ret2);
1520 PyObject *ret3(PyList_New(sz));
1521 for(std::size_t i=0;i<sz;i++)
1523 DataArrayIdType *elt(a3[i]);
1526 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1528 PyTuple_SetItem(ret,3,ret3);
1529 DataArrayDouble *ret4(a4);
1532 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1536 void __setstate__(PyObject *inp)
1538 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1539 if(!PyTuple_Check(inp))
1540 throw INTERP_KERNEL::Exception(MSG);
1541 std::size_t sz(PyTuple_Size(inp));
1543 throw INTERP_KERNEL::Exception(MSG);
1544 std::vector<double> a0;
1545 std::vector<mcIdType> a1;
1546 std::vector<std::string> a2;
1547 std::vector< MCAuto<DataArrayIdType> > a3;
1548 MCAuto<DataArrayDouble> a4;
1550 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1552 fillArrayWithPyListDbl3(a0py,tmp,a0);
1553 convertPyToNewIntArr3(a1py,a1);
1554 fillStringVector(a2py,a2);
1556 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1558 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1559 if(!SWIG_IsOK(status))
1560 throw INTERP_KERNEL::Exception(MSG);
1561 a4=reinterpret_cast<DataArrayDouble *>(argp);
1562 if((DataArrayDouble *)a4)
1565 std::vector< DataArrayIdType * > a3Tmp;
1566 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1567 std::size_t sz(a3Tmp.size());
1569 for(std::size_t i=0;i<sz;i++)
1573 a3Tmp[i]->incrRef();
1575 self->unserialize(a0,a1,a2,a3,a4);
1579 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1582 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1583 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1586 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1589 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1592 self->setMeshAtLevel(meshDimRelToMax,m1);
1595 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1598 void __delitem__(int meshDimRelToMax)
1600 self->removeMeshAtLevel(meshDimRelToMax);
1603 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1605 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1607 DataArrayDouble *a,*a2;
1608 DataArrayDoubleTuple *aa,*aa2;
1609 std::vector<double> bb,bb2;
1611 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1612 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1613 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1617 static MEDFileUMesh *Aggregate(PyObject *meshes)
1619 std::vector<const MEDFileUMesh *> meshesCpp;
1620 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1621 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1625 PyObject *getAllDistributionOfTypes() const
1627 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1628 return convertVecPairIntToPy(ret);
1631 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1633 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1634 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1635 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1638 MEDFileUMesh *extractPart(PyObject *extractDef) const
1640 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1641 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1642 return self->extractPart(extractDefCpp);
1645 void setMeshes(PyObject *li, bool renum=false)
1647 std::vector<const MEDCouplingUMesh *> ms;
1648 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1649 self->setMeshes(ms,renum);
1652 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1654 std::vector<const MEDCouplingUMesh *> ms;
1655 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1656 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1659 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1661 std::vector<const MEDCouplingUMesh *> ms;
1662 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1663 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1666 DataArrayDouble *getCoords() const
1668 DataArrayDouble *ret=self->getCoords();
1674 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1676 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1679 return const_cast<PartDefinition *>(ret);
1682 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1684 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1685 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1686 PyObject *ret=PyTuple_New(3);
1687 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1688 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1689 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1693 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1695 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1701 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1703 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1704 std::size_t sz(tmp.size());
1705 PyObject *ret=PyList_New(sz);
1706 for(std::size_t i=0;i<sz;i++)
1710 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1717 class MEDFileStructuredMesh : public MEDFileMesh
1722 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1724 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1732 class MEDFileCMesh : public MEDFileStructuredMesh
1735 static MEDFileCMesh *New();
1736 static MEDFileCMesh *New(DataArrayByte *db);
1737 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1738 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1739 void setMesh(MEDCouplingCMesh *m);
1740 int getSpaceDimension() const;
1745 return MEDFileCMesh::New();
1748 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1750 return MEDFileCMesh::New(fileName,mrs);
1753 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1755 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1758 MEDFileCMesh(DataArrayByte *db)
1760 return MEDFileCMesh::New(db);
1763 PyObject *getMesh() const
1765 const MEDCouplingCMesh *tmp=self->getMesh();
1768 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1773 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1776 static MEDFileCurveLinearMesh *New();
1777 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1778 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1779 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1780 void setMesh(MEDCouplingCurveLinearMesh *m);
1783 MEDFileCurveLinearMesh()
1785 return MEDFileCurveLinearMesh::New();
1788 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1790 return MEDFileCurveLinearMesh::New(fileName,mrs);
1793 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1795 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1798 MEDFileCurveLinearMesh(DataArrayByte *db)
1800 return MEDFileCurveLinearMesh::New(db);
1803 PyObject *getMesh() const
1805 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1808 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1813 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1816 static MEDFileMeshMultiTS *New();
1817 static MEDFileMeshMultiTS *New(const std::string& fileName);
1818 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1819 MEDFileMeshMultiTS *deepCopy() const;
1820 std::string getName() const;
1821 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1822 void cartesianizeMe();
1825 MEDFileMeshMultiTS()
1827 return MEDFileMeshMultiTS::New();
1830 MEDFileMeshMultiTS(const std::string& fileName)
1832 return MEDFileMeshMultiTS::New(fileName);
1835 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1837 return MEDFileMeshMultiTS::New(fileName,mName);
1840 MEDFileMesh *getOneTimeStep() const
1842 MEDFileMesh *ret=self->getOneTimeStep();
1850 class MEDFileMeshesIterator
1857 MEDFileMesh *ret=self->nextt();
1861 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1865 PyErr_SetString(PyExc_StopIteration,"No more data.");
1872 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1875 static MEDFileMeshes *New();
1876 static MEDFileMeshes *New(DataArrayByte *db);
1877 MEDFileMeshes *deepCopy() const;
1878 int getNumberOfMeshes() const;
1879 std::vector<std::string> getMeshesNames() const;
1881 void resize(int newSize);
1882 void pushMesh(MEDFileMesh *mesh);
1883 void setMeshAtPos(int i, MEDFileMesh *mesh);
1884 void destroyMeshAtPos(int i);
1885 void cartesianizeMe();
1886 bool presenceOfStructureElements() const;
1887 void killStructureElements();
1892 return MEDFileMeshes::New();
1895 MEDFileMeshes(const std::string& fileName)
1897 return MEDFileMeshes::New(fileName);
1900 MEDFileMeshes(DataArrayByte *db)
1902 return MEDFileMeshes::New(db);
1905 std::string __str__() const
1907 return self->simpleRepr();
1910 MEDFileMesh *__getitem__(PyObject *obj)
1912 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1913 if(PyInt_Check(obj))
1915 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1920 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1926 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1928 self->setMeshAtPos(obj,mesh);
1932 MEDFileMeshesIterator *__iter__()
1934 return self->iterator();
1939 return self->getNumberOfMeshes();
1942 MEDFileMesh *getMeshAtPos(int i) const
1944 MEDFileMesh *ret=self->getMeshAtPos(i);
1949 MEDFileMesh *getMeshWithName(const std::string& mname) const
1951 MEDFileMesh *ret=self->getMeshWithName(mname);
1959 class MEDFileFieldLoc : public RefCountObject
1962 std::string getName() const;
1963 int getDimension() const;
1964 int getNumberOfGaussPoints() const;
1965 int getNumberOfPointsInCells() const;
1966 const std::vector<double>& getRefCoords() const;
1967 const std::vector<double>& getGaussCoords() const;
1968 const std::vector<double>& getGaussWeights() const;
1969 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1972 std::string __str__() const
1974 return self->repr();
1979 class MEDFileFieldGlobsReal
1982 void resetContent();
1983 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1984 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1985 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1986 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1987 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1988 void checkGlobsCoherency() const;
1989 void checkGlobsPflsPartCoherency() const;
1990 void checkGlobsLocsPartCoherency() const;
1991 std::vector<std::string> getPfls() const;
1992 std::vector<std::string> getLocs() const;
1993 bool existsPfl(const std::string& pflName) const;
1994 bool existsLoc(const std::string& locName) const;
1995 std::string createNewNameOfPfl() const;
1996 std::string createNewNameOfLoc() const;
1997 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1998 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1999 virtual std::vector<std::string> getPflsReallyUsed() const;
2000 virtual std::vector<std::string> getLocsReallyUsed() const;
2001 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
2002 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
2003 void killProfileIds(const std::vector<int>& pflIds);
2004 void killLocalizationIds(const std::vector<int>& locIds);
2005 void changePflName(const std::string& oldName, const std::string& newName);
2006 void changeLocName(const std::string& oldName, const std::string& newName);
2007 int getNbOfGaussPtPerCell(int locId) const;
2008 int getLocalizationId(const std::string& loc) const;
2009 int getProfileId(const std::string& pfl) const;
2010 void killStructureElementsInGlobs();
2013 PyObject *getProfile(const std::string& pflName) const
2015 const DataArrayIdType *ret=self->getProfile(pflName);
2018 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2021 PyObject *getProfileFromId(int pflId) const
2023 const DataArrayIdType *ret=self->getProfileFromId(pflId);
2026 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2029 PyObject *getLocalizationFromId(int locId) const
2031 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
2034 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2037 PyObject *getLocalization(const std::string& locName) const
2039 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
2042 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
2045 PyObject *zipPflsNames()
2047 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2048 return convertVecPairVecStToPy(ret);
2051 PyObject *zipLocsNames(double eps)
2053 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2054 return convertVecPairVecStToPy(ret);
2057 void changePflsNames(PyObject *li)
2059 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2060 self->changePflsNames(v);
2063 void changePflsRefsNamesGen(PyObject *li)
2065 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2066 self->changePflsRefsNamesGen(v);
2069 void changePflsNamesInStruct(PyObject *li)
2071 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2072 self->changePflsNamesInStruct(v);
2075 void changeLocsNames(PyObject *li)
2077 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2078 self->changeLocsNames(v);
2081 void changeLocsRefsNamesGen(PyObject *li)
2083 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2084 self->changeLocsRefsNamesGen(v);
2087 void changeLocsNamesInStruct(PyObject *li)
2089 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2090 self->changeLocsNamesInStruct(v);
2093 std::string simpleReprGlobs() const
2095 std::ostringstream oss;
2096 self->simpleReprGlobs(oss);
2102 class MEDFileEntities
2107 static MEDFileEntities *BuildFrom(PyObject *entities)
2109 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2110 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2112 std::size_t sz(inp0.size());
2114 for(std::size_t i=0;i<sz;i++)
2115 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2117 return MEDFileEntities::BuildFrom(&inp);
2124 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2127 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2128 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2129 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2130 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2132 void loadArraysIfNecessary();
2133 void unloadArrays();
2134 void unloadArraysWithoutDataLoss();
2135 int getDimension() const;
2136 int getIteration() const;
2137 int getOrder() const;
2138 std::string getName();
2139 void setName(const std::string& name);
2140 std::string getMeshName();
2141 void setMeshName(const std::string& newMeshName);
2142 int getMeshIteration() const;
2143 int getMeshOrder() const;
2144 int getNumberOfComponents() const;
2145 bool isDealingTS(int iteration, int order) const;
2146 void setInfo(const std::vector<std::string>& infos);
2147 const std::vector<std::string>& getInfo() const;
2148 bool presenceOfMultiDiscPerGeoType() const;
2149 void setTime(int iteration, int order, double val);
2150 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2151 MEDFileAnyTypeField1TS *deepCopy() const;
2152 std::string getDtUnit() const;
2153 void setDtUnit(const std::string& dtUnit);
2159 double tmp0=self->getTime(tmp1,tmp2);
2160 PyObject *res = PyList_New(3);
2161 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2162 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2163 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2167 PyObject *getDtIt() const
2169 std::pair<int,int> res=self->getDtIt();
2170 PyObject *elt=PyTuple_New(2);
2171 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2172 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2176 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2178 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2181 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2183 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2186 bool changeMeshNames(PyObject *li)
2188 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2189 return self->changeMeshNames(modifTab);
2192 PyObject *getTypesOfFieldAvailable() const
2194 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2195 PyObject *ret2=PyList_New(ret.size());
2196 for(int i=0;i<(int)ret.size();i++)
2197 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2201 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2203 std::vector<int> ret1;
2204 int ret0=self->getNonEmptyLevels(mname,ret1);
2205 PyObject *elt=PyTuple_New(2);
2206 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2207 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2211 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2213 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2214 std::vector< std::vector<TypeOfField> > typesF;
2215 std::vector< std::vector<std::string> > pfls;
2216 std::vector< std::vector<std::string> > locs;
2217 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2218 std::size_t sz=ret.size();
2219 PyObject *ret2=PyList_New(sz);
2220 for(std::size_t i=0;i<sz;i++)
2222 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2223 const std::vector<TypeOfField>& typesFI=typesF[i];
2224 const std::vector<std::string>& pflsI=pfls[i];
2225 const std::vector<std::string>& locsI=locs[i];
2226 PyObject *elt=PyTuple_New(2);
2227 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2228 std::size_t sz2=ret[i].size();
2229 PyObject *elt2=PyList_New(sz2);
2230 for(std::size_t j=0;j<sz2;j++)
2232 PyObject *elt3=PyTuple_New(4);
2233 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2234 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2235 PyTuple_SetItem(elt3,1,elt4);
2236 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2237 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2238 PyList_SetItem(elt2,j,elt3);
2240 PyTuple_SetItem(elt,1,elt2);
2241 PyList_SetItem(ret2,i,elt);
2246 PyObject *splitComponents() const
2248 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2249 std::size_t sz=ret.size();
2250 PyObject *retPy=PyList_New(sz);
2251 for(std::size_t i=0;i<sz;i++)
2252 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2256 PyObject *splitDiscretizations() const
2258 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2259 std::size_t sz=ret.size();
2260 PyObject *retPy=PyList_New(sz);
2261 for(std::size_t i=0;i<sz;i++)
2262 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2266 PyObject *splitMultiDiscrPerGeoTypes() const
2268 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2269 std::size_t sz=ret.size();
2270 PyObject *retPy=PyList_New(sz);
2271 for(std::size_t i=0;i<sz;i++)
2272 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2276 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2278 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2279 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2280 return self->extractPart(extractDefCpp,mm);
2285 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2288 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2289 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2290 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2291 static MEDFileField1TS *New(DataArrayByte *db);
2292 static MEDFileField1TS *New();
2293 MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2294 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2295 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2296 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2297 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2298 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2299 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2300 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2302 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2303 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2304 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2305 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2306 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2309 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2311 return MEDFileField1TS::New(fileName,loadAll);
2314 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2316 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2319 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2321 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2324 MEDFileField1TS(DataArrayByte *db)
2326 return MEDFileField1TS::New(db);
2331 return MEDFileField1TS::New();
2334 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2336 const DataArrayDouble *arr=0;
2338 arr=field->getArray();
2339 self->copyTinyInfoFrom(field,arr);
2342 std::string __str__() const
2344 return self->simpleRepr();
2347 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2349 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2352 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2354 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2355 std::vector< std::vector<TypeOfField> > typesF;
2356 std::vector< std::vector<std::string> > pfls;
2357 std::vector< std::vector<std::string> > locs;
2358 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2359 std::size_t sz=ret.size();
2360 PyObject *ret2=PyList_New(sz);
2361 for(std::size_t i=0;i<sz;i++)
2363 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2364 const std::vector<TypeOfField>& typesFI=typesF[i];
2365 const std::vector<std::string>& pflsI=pfls[i];
2366 const std::vector<std::string>& locsI=locs[i];
2367 PyObject *elt=PyTuple_New(2);
2368 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2369 std::size_t sz2=ret[i].size();
2370 PyObject *elt2=PyList_New(sz2);
2371 for(std::size_t j=0;j<sz2;j++)
2373 PyObject *elt3=PyTuple_New(4);
2374 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2375 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2376 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2377 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2378 PyList_SetItem(elt2,j,elt3);
2380 PyTuple_SetItem(elt,1,elt2);
2381 PyList_SetItem(ret2,i,elt);
2386 DataArrayDouble *getUndergroundDataArray() const
2388 DataArrayDouble *ret=self->getUndergroundDataArray();
2394 PyObject *getUndergroundDataArrayExt() const
2396 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2401 class MEDFileInt32Field1TS : public MEDFileAnyTypeField1TS
2404 static MEDFileInt32Field1TS *New();
2405 static MEDFileInt32Field1TS *New(const std::string& fileName, bool loadAll=true);
2406 static MEDFileInt32Field1TS *New(DataArrayByte *db);
2407 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2408 static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2409 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2411 void setFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
2412 void setFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2413 void setFieldProfileFlatly(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2414 void copyTimeInfoFrom(MEDCouplingFieldInt32 *mcf);
2415 MEDCouplingFieldInt32 *field(const MEDFileMesh *mesh) const;
2416 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2417 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2418 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2419 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2420 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2423 MEDFileInt32Field1TS()
2425 return MEDFileInt32Field1TS::New();
2428 MEDFileInt32Field1TS(const std::string& fileName, bool loadAll=true)
2430 return MEDFileInt32Field1TS::New(fileName,loadAll);
2433 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2435 return MEDFileInt32Field1TS::New(fileName,fieldName,loadAll);
2438 MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2440 return MEDFileInt32Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2443 MEDFileInt32Field1TS(DataArrayByte *db)
2445 return MEDFileInt32Field1TS::New(db);
2448 std::string __str__() const
2450 return self->simpleRepr();
2453 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2455 return MEDFileField1TS_getFieldWithProfile<Int32>(self,type,meshDimRelToMax,mesh);
2458 DataArrayInt32 *getUndergroundDataArray() const
2460 DataArrayInt32 *ret=self->getUndergroundDataArray();
2466 PyObject *getUndergroundDataArrayExt() const
2468 return MEDFileField1TS_getUndergroundDataArrayExt<Int32>(self);
2473 class MEDFileInt64Field1TS : public MEDFileAnyTypeField1TS
2476 static MEDFileInt64Field1TS *New();
2477 static MEDFileInt64Field1TS *New(const std::string& fileName, bool loadAll=true);
2478 static MEDFileInt64Field1TS *New(DataArrayByte *db);
2479 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2480 static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2481 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2483 void setFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
2484 void setFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2485 void setFieldProfileFlatly(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2486 void copyTimeInfoFrom(MEDCouplingFieldInt64 *mcf);
2487 MEDCouplingFieldInt64 *field(const MEDFileMesh *mesh) const;
2488 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2489 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2490 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2491 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2492 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2495 MEDFileInt64Field1TS()
2497 return MEDFileInt64Field1TS::New();
2500 MEDFileInt64Field1TS(const std::string& fileName, bool loadAll=true)
2502 return MEDFileInt64Field1TS::New(fileName,loadAll);
2505 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2507 return MEDFileInt64Field1TS::New(fileName,fieldName,loadAll);
2510 MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2512 return MEDFileInt64Field1TS::New(fileName,fieldName,iteration,order,loadAll);
2515 MEDFileInt64Field1TS(DataArrayByte *db)
2517 return MEDFileInt64Field1TS::New(db);
2520 std::string __str__() const
2522 return self->simpleRepr();
2525 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2527 return MEDFileField1TS_getFieldWithProfile<Int64>(self,type,meshDimRelToMax,mesh);
2530 DataArrayInt64 *getUndergroundDataArray() const
2532 DataArrayInt64 *ret=self->getUndergroundDataArray();
2538 PyObject *getUndergroundDataArrayExt() const
2540 return MEDFileField1TS_getUndergroundDataArrayExt<Int64>(self);
2545 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2548 static MEDFileFloatField1TS *New();
2549 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2550 static MEDFileFloatField1TS *New(DataArrayByte *db);
2551 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2552 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2553 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2555 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2556 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2557 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2558 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2559 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2560 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2561 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2562 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2563 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2564 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2567 MEDFileFloatField1TS()
2569 return MEDFileFloatField1TS::New();
2572 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2574 return MEDFileFloatField1TS::New(fileName,loadAll);
2577 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2579 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2582 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2584 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2587 MEDFileFloatField1TS(DataArrayByte *db)
2589 return MEDFileFloatField1TS::New(db);
2592 std::string __str__() const
2594 return self->simpleRepr();
2597 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2599 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2602 DataArrayFloat *getUndergroundDataArray() const
2604 DataArrayFloat *ret=self->getUndergroundDataArray();
2610 PyObject *getUndergroundDataArrayExt() const
2612 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2617 class MEDFileAnyTypeFieldMultiTSIterator
2624 MEDFileAnyTypeField1TS *ret=self->nextt();
2626 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2629 PyErr_SetString(PyExc_StopIteration,"No more data.");
2636 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2639 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2640 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2641 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2642 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2643 std::string getName() const;
2644 void setName(const std::string& name);
2645 std::string getDtUnit() const;
2646 void setDtUnit(const std::string& dtUnit);
2647 std::string getMeshName() const;
2648 void setMeshName(const std::string& newMeshName);
2649 const std::vector<std::string>& getInfo() const;
2650 bool presenceOfMultiDiscPerGeoType() const;
2651 int getNumberOfComponents() const;
2652 int getNumberOfTS() const;
2653 void eraseEmptyTS();
2654 int getPosOfTimeStep(int iteration, int order) const;
2655 int getPosGivenTime(double time, double eps=1e-8) const;
2657 void loadArraysIfNecessary();
2658 void unloadArrays();
2659 void unloadArraysWithoutDataLoss();
2661 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2662 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2663 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2664 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2665 void synchronizeNameScope();
2666 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2671 return self->getNumberOfTS();
2674 int getTimeId(PyObject *elt0) const
2676 if(elt0 && PyInt_Check(elt0))
2678 int pos=(int)PyInt_AS_LONG(elt0);
2681 else if(elt0 && PyTuple_Check(elt0))
2683 if(PyTuple_Size(elt0)==2)
2685 PyObject *o0=PyTuple_GetItem(elt0,0);
2686 PyObject *o1=PyTuple_GetItem(elt0,1);
2687 if(PyInt_Check(o0) && PyInt_Check(o1))
2689 int iter=(int)PyInt_AS_LONG(o0);
2690 int order=(int)PyInt_AS_LONG(o1);
2691 return self->getPosOfTimeStep(iter,order);
2694 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 !");
2697 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 !");
2699 else if(elt0 && PyFloat_Check(elt0))
2701 double val=PyFloat_AS_DOUBLE(elt0);
2702 return self->getPosGivenTime(val);
2705 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2708 PyObject *getIterations() const
2710 std::vector< std::pair<int,int> > res(self->getIterations());
2711 return convertVecPairIntToPy(res);
2714 PyObject *getTimeSteps() const
2716 std::vector<double> ret1;
2717 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2718 std::size_t sz=ret.size();
2719 PyObject *ret2=PyList_New(sz);
2720 for(std::size_t i=0;i<sz;i++)
2722 PyObject *elt=PyTuple_New(3);
2723 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2724 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2725 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2726 PyList_SetItem(ret2,i,elt);
2731 PyObject *getTypesOfFieldAvailable() const
2733 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2734 PyObject *ret2=PyList_New(ret.size());
2735 for(int i=0;i<(int)ret.size();i++)
2737 const std::vector<TypeOfField>& rett=ret[i];
2738 PyObject *ret3=PyList_New(rett.size());
2739 for(int j=0;j<(int)rett.size();j++)
2740 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2741 PyList_SetItem(ret2,i,ret3);
2746 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2748 std::vector<int> ret1;
2749 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2750 PyObject *elt=PyTuple_New(2);
2751 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2752 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2756 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2758 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2759 std::vector< std::vector<TypeOfField> > typesF;
2760 std::vector< std::vector<std::string> > pfls;
2761 std::vector< std::vector<std::string> > locs;
2762 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2763 std::size_t sz=ret.size();
2764 PyObject *ret2=PyList_New(sz);
2765 for(std::size_t i=0;i<sz;i++)
2767 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2768 const std::vector<TypeOfField>& typesFI=typesF[i];
2769 const std::vector<std::string>& pflsI=pfls[i];
2770 const std::vector<std::string>& locsI=locs[i];
2771 PyObject *elt=PyTuple_New(2);
2772 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2773 std::size_t sz2=ret[i].size();
2774 PyObject *elt2=PyList_New(sz2);
2775 for(std::size_t j=0;j<sz2;j++)
2777 PyObject *elt3=PyTuple_New(4);
2778 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2779 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2780 PyTuple_SetItem(elt3,1,elt4);
2781 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2782 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2783 PyList_SetItem(elt2,j,elt3);
2785 PyTuple_SetItem(elt,1,elt2);
2786 PyList_SetItem(ret2,i,elt);
2791 std::vector<int> getTimeIds(PyObject *elts) const
2793 if(PyList_Check(elts))
2795 std::size_t sz=PyList_Size(elts);
2796 std::vector<int> ret(sz);
2797 for(std::size_t i=0;i<sz;i++)
2799 PyObject *elt=PyList_GetItem(elts,i);
2800 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2806 std::vector<int> ret(1);
2807 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2812 void __delitem__(PyObject *elts)
2814 if(PySlice_Check(elts))
2816 Py_ssize_t strt=2,stp=2,step=2;
2817 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2818 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2822 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2823 if(!idsToRemove.empty())
2824 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2828 void eraseTimeStepIds(PyObject *li)
2832 std::vector<int> pos2;
2833 DataArrayInt32 *pos3=0;
2834 DataArrayIntTuple *pos4=0;
2835 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2840 self->eraseTimeStepIds(&pos1,&pos1+1);
2847 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2852 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2856 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2860 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2862 return self->iterator();
2865 PyObject *__getitem__(PyObject *elt0) const
2867 if(elt0 && PyList_Check(elt0))
2869 std::size_t sz=PyList_Size(elt0);
2870 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2871 int *pt=da->getPointer();
2872 for(std::size_t i=0;i<sz;i++,pt++)
2874 PyObject *elt1=PyList_GetItem(elt0,i);
2875 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2877 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2879 else if(elt0 && PySlice_Check(elt0))
2881 Py_ssize_t strt=2,stp=2,step=2;
2882 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2883 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2886 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2889 bool changeMeshNames(PyObject *li)
2891 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2892 return self->changeMeshNames(modifTab);
2895 PyObject *splitComponents() const
2897 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2898 std::size_t sz=ret.size();
2899 PyObject *retPy=PyList_New(sz);
2900 for(std::size_t i=0;i<sz;i++)
2901 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2905 PyObject *splitDiscretizations() const
2907 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2908 std::size_t sz=ret.size();
2909 PyObject *retPy=PyList_New(sz);
2910 for(std::size_t i=0;i<sz;i++)
2911 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2915 PyObject *splitMultiDiscrPerGeoTypes() const
2917 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2918 std::size_t sz=ret.size();
2919 PyObject *retPy=PyList_New(sz);
2920 for(std::size_t i=0;i<sz;i++)
2921 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2925 void pushBackTimeSteps(PyObject *li)
2928 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2929 if(SWIG_IsOK(status))
2931 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2935 std::vector<MEDFileAnyTypeField1TS *> tmp;
2936 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2937 self->pushBackTimeSteps(tmp);
2941 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2943 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2944 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2945 return self->extractPart(extractDefCpp,mm);
2948 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2950 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2951 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2952 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2953 std::size_t sz=ret.size();
2954 PyObject *retPy=PyList_New(sz);
2955 for(std::size_t i=0;i<sz;i++)
2957 std::size_t sz2=ret[i].size();
2958 PyObject *ret1Py=PyList_New(sz2);
2959 for(std::size_t j=0;j<sz2;j++)
2961 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2964 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2966 PyList_SetItem(retPy,i,ret1Py);
2971 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2973 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2974 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2975 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2976 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2977 if(ret2.size()!=ret.size())
2979 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2980 throw INTERP_KERNEL::Exception(oss.str().c_str());
2982 std::size_t sz=ret.size();
2983 PyObject *retPy=PyList_New(sz);
2984 for(std::size_t i=0;i<sz;i++)
2986 std::size_t sz2=ret[i].size();
2987 PyObject *ret0Py=PyTuple_New(2);
2988 PyObject *ret1Py=PyList_New(sz2);
2989 for(std::size_t j=0;j<sz2;j++)
2991 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2994 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2996 PyTuple_SetItem(ret0Py,0,ret1Py);
2997 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2998 PyList_SetItem(retPy,i,ret0Py);
3005 class MEDFileInt32FieldMultiTS;
3006 class MEDFileInt64FieldMultiTS;
3008 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3011 static MEDFileFieldMultiTS *New();
3012 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3013 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3014 static MEDFileFieldMultiTS *New(DataArrayByte *db);
3016 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
3017 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3018 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3019 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3020 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3021 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3023 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
3024 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3025 MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
3028 MEDFileFieldMultiTS()
3030 return MEDFileFieldMultiTS::New();
3033 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
3035 return MEDFileFieldMultiTS::New(fileName,loadAll);
3038 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3040 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
3043 MEDFileFieldMultiTS(DataArrayByte *db)
3045 return MEDFileFieldMultiTS::New(db);
3048 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3050 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3051 std::size_t sz(tmp.size());
3052 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3053 for(std::size_t i=0;i<sz;i++)
3055 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3056 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3058 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3061 std::string __str__() const
3063 return self->simpleRepr();
3066 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3068 DataArrayIdType *ret1=0;
3069 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3070 PyObject *ret=PyTuple_New(2);
3071 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3072 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3076 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
3078 std::vector<INTERP_KERNEL::NormalizedCellType> types;
3079 std::vector< std::vector<TypeOfField> > typesF;
3080 std::vector< std::vector<std::string> > pfls;
3081 std::vector< std::vector<std::string> > locs;
3082 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
3083 std::size_t sz=ret.size();
3084 PyObject *ret2=PyList_New(sz);
3085 for(std::size_t i=0;i<sz;i++)
3087 const std::vector<DataArrayDouble *>& dadsI=ret[i];
3088 const std::vector<TypeOfField>& typesFI=typesF[i];
3089 const std::vector<std::string>& pflsI=pfls[i];
3090 const std::vector<std::string>& locsI=locs[i];
3091 PyObject *elt=PyTuple_New(2);
3092 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
3093 std::size_t sz2=ret[i].size();
3094 PyObject *elt2=PyList_New(sz2);
3095 for(std::size_t j=0;j<sz2;j++)
3097 PyObject *elt3=PyTuple_New(4);
3098 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
3099 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3100 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
3101 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
3102 PyList_SetItem(elt2,j,elt3);
3104 PyTuple_SetItem(elt,1,elt2);
3105 PyList_SetItem(ret2,i,elt);
3109 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
3111 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
3117 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3119 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3120 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3123 PyObject *ret=PyTuple_New(2);
3124 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3125 std::size_t sz=elt1Cpp.size();
3126 PyObject *elt=PyList_New(sz);
3127 for(std::size_t i=0;i<sz;i++)
3129 PyObject *elt1=PyTuple_New(2);
3130 PyObject *elt2=PyTuple_New(2);
3131 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3132 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3133 PyObject *elt3=PyTuple_New(2);
3134 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3135 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3136 PyTuple_SetItem(elt1,0,elt2);
3137 PyTuple_SetItem(elt1,1,elt3);
3138 PyList_SetItem(elt,i,elt1);
3140 PyTuple_SetItem(ret,1,elt);
3146 class MEDFileFieldsIterator
3153 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3155 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3158 PyErr_SetString(PyExc_StopIteration,"No more data.");
3165 class MEDFileInt32FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3168 static MEDFileInt32FieldMultiTS *New();
3169 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3170 static MEDFileInt32FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3171 static MEDFileInt32FieldMultiTS *New(DataArrayByte *db);
3173 void appendFieldNoProfileSBT(const MEDCouplingFieldInt32 *field);
3174 void appendFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3175 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3176 MEDCouplingFieldInt32 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3177 MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3178 MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3179 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3180 MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3181 MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3184 MEDFileInt32FieldMultiTS()
3186 return MEDFileInt32FieldMultiTS::New();
3189 MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true)
3191 return MEDFileInt32FieldMultiTS::New(fileName,loadAll);
3194 MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3196 return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll);
3199 MEDFileInt32FieldMultiTS(DataArrayByte *db)
3201 return MEDFileInt32FieldMultiTS::New(db);
3204 static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3206 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3207 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3208 return MEDFileInt32FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3211 std::string __str__() const
3213 return self->simpleRepr();
3216 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3218 DataArrayIdType *ret1=0;
3219 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3220 PyObject *ret=PyTuple_New(2);
3221 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int32>::TI, SWIG_POINTER_OWN | 0 ));
3222 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3226 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3228 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3236 class MEDFileInt64FieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3239 static MEDFileInt64FieldMultiTS *New();
3240 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3241 static MEDFileInt64FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3242 static MEDFileInt64FieldMultiTS *New(DataArrayByte *db);
3244 void appendFieldNoProfileSBT(const MEDCouplingFieldInt64 *field);
3245 void appendFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3246 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3247 MEDCouplingFieldInt64 *field(int iteration, int order, const MEDFileMesh *mesh) const;
3248 MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3249 MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3250 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3251 MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3252 MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3255 MEDFileInt64FieldMultiTS()
3257 return MEDFileInt64FieldMultiTS::New();
3260 MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true)
3262 return MEDFileInt64FieldMultiTS::New(fileName,loadAll);
3265 MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3267 return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll);
3270 MEDFileInt64FieldMultiTS(DataArrayByte *db)
3272 return MEDFileInt64FieldMultiTS::New(db);
3275 static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3277 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3278 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3279 return MEDFileInt64FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3282 std::string __str__() const
3284 return self->simpleRepr();
3287 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3289 DataArrayIdType *ret1=0;
3290 DataArrayInt64 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3291 PyObject *ret=PyTuple_New(2);
3292 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<Int64>::TI, SWIG_POINTER_OWN | 0 ));
3293 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3297 DataArrayInt64 *getUndergroundDataArray(int iteration, int order) const
3299 DataArrayInt64 *ret=self->getUndergroundDataArray(iteration,order);
3307 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3310 static MEDFileFloatFieldMultiTS *New();
3311 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3312 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3313 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3315 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3316 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3317 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3318 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3319 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3320 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3321 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3322 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3323 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3326 MEDFileFloatFieldMultiTS()
3328 return MEDFileFloatFieldMultiTS::New();
3331 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3333 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3336 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3338 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3341 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3343 return MEDFileFloatFieldMultiTS::New(db);
3346 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3348 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3349 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3350 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3353 std::string __str__() const
3355 return self->simpleRepr();
3358 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3360 DataArrayIdType *ret1=0;
3361 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3362 PyObject *ret=PyTuple_New(2);
3363 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3364 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3368 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3370 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3378 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3381 static MEDFileMeshSupports *New(const std::string& fileName);
3382 std::vector<std::string> getSupMeshNames() const;
3385 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3387 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3388 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3396 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3399 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3401 MEDFileStructureElements();
3404 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3407 static MEDFileFields *New();
3408 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3409 static MEDFileFields *New(DataArrayByte *db);
3410 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3411 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3412 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3413 MEDFileFields *deepCopy() const;
3414 MEDFileFields *shallowCpy() const;
3416 void loadArraysIfNecessary();
3417 void unloadArrays();
3418 void unloadArraysWithoutDataLoss();
3419 int getNumberOfFields() const;
3420 std::vector<std::string> getFieldsNames() const;
3421 std::vector<std::string> getMeshesNames() const;
3423 void resize(int newSize);
3424 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3425 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3426 int getPosFromFieldName(const std::string& fieldName) const;
3427 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3428 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3429 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3430 bool presenceOfStructureElements() const;
3431 void aggregate(const MEDFileFields& other);
3432 void killStructureElements();
3433 void keepOnlyStructureElements();
3434 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3435 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3436 void destroyFieldAtPos(int i);
3437 bool removeFieldsWithoutAnyTimeStep();
3442 return MEDFileFields::New();
3445 MEDFileFields(const std::string& fileName, bool loadAll=true)
3447 return MEDFileFields::New(fileName,loadAll);
3450 MEDFileFields(DataArrayByte *db)
3452 return MEDFileFields::New(db);
3455 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3457 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3460 std::string __str__() const
3462 return self->simpleRepr();
3465 MEDFileFields *partOfThisOnStructureElements() const
3467 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3471 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3473 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3477 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3479 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3480 std::size_t sz(tmp.size());
3481 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3482 for(std::size_t i=0;i<sz;i++)
3484 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3485 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3487 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3490 PyObject *getMeshSENames() const
3492 std::vector< std::pair<std::string,std::string> > ps;
3493 self->getMeshSENames(ps);
3494 return convertVectPairStToPy(ps);
3497 PyObject *getCommonIterations() const
3500 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3501 PyObject *ret=PyTuple_New(2);
3502 PyObject *ret_0=PyList_New(ret0.size());
3504 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3506 PyObject *elt=PyTuple_New(2);
3507 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3508 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3509 PyList_SetItem(ret_0,rk,elt);
3511 PyTuple_SetItem(ret,0,ret_0);
3512 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3513 PyTuple_SetItem(ret,1,ret_1);
3517 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3519 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3520 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3523 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3525 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3526 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3529 PyObject *__getitem__(PyObject *obj)
3531 if(obj && PyList_Check(obj))
3533 std::size_t sz=PyList_Size(obj);
3534 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3535 int *pt=da->getPointer();
3536 for(std::size_t i=0;i<sz;i++,pt++)
3538 PyObject *elt1=PyList_GetItem(obj,i);
3539 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3541 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3544 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3547 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3549 self->setFieldAtPos(obj,field);
3555 return self->getNumberOfFields();
3558 MEDFileFieldsIterator *__iter__()
3560 return self->iterator();
3563 bool changeMeshNames(PyObject *li)
3565 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3566 return self->changeMeshNames(modifTab);
3569 int getPosOfField(PyObject *elt0) const
3571 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3573 throw INTERP_KERNEL::Exception(msg);
3574 if(PyInt_Check(elt0))
3576 return (int)PyInt_AS_LONG(elt0);
3578 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3581 std::vector<int> getPosOfFields(PyObject *elts) const
3583 if(PyList_Check(elts))
3585 std::size_t sz=PyList_Size(elts);
3586 std::vector<int> ret(sz);
3587 for(std::size_t i=0;i<sz;i++)
3589 PyObject *elt=PyList_GetItem(elts,i);
3590 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3596 std::vector<int> ret(1);
3597 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3602 void pushFields(PyObject *fields)
3604 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3605 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3606 self->pushFields(tmp);
3609 void __delitem__(PyObject *elts)
3611 if(elts && PySlice_Check(elts))
3613 Py_ssize_t strt=2,stp=2,step=2;
3614 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3615 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3619 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3620 if(!idsToRemove.empty())
3621 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3625 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3627 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3628 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3629 return self->extractPart(extractDefCpp,mm);
3632 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3634 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3640 class MEDFileParameter1TS : public RefCountObject
3643 void setIteration(int it);
3644 int getIteration() const;
3645 void setOrder(int order);
3646 int getOrder() const;
3647 void setTimeValue(double time);
3648 void setTime(int dt, int it, double time);
3649 double getTime(int& dt, int& it);
3650 double getTimeValue() const;
3653 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3656 void setValue(double val);
3657 double getValue() const;
3658 std::string simpleRepr() const;
3661 std::string __str__() const
3663 return self->simpleRepr();
3668 class MEDFileParameterTinyInfo : public MEDFileWritable
3671 void setDescription(const std::string& name);
3672 std::string getDescription() const;
3673 void setTimeUnit(const std::string& unit);
3674 std::string getTimeUnit() const;
3677 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3680 static MEDFileParameterDouble1TS *New();
3681 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3682 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3683 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3684 virtual MEDFileParameter1TS *deepCopy() const;
3685 virtual std::string simpleRepr() const;
3686 void setName(const std::string& name);
3687 std::string getName() const;
3688 void write(const std::string& fileName, int mode) const;
3691 MEDFileParameterDouble1TS()
3693 return MEDFileParameterDouble1TS::New();
3696 MEDFileParameterDouble1TS(const std::string& fileName)
3698 return MEDFileParameterDouble1TS::New(fileName);
3701 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3703 return MEDFileParameterDouble1TS::New(fileName,paramName);
3706 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3708 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3711 std::string __str__() const
3713 return self->simpleRepr();
3716 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3719 bool ret0=self->isEqual(other,eps,what);
3720 PyObject *res=PyList_New(2);
3721 PyObject *ret0Py=ret0?Py_True:Py_False;
3723 PyList_SetItem(res,0,ret0Py);
3724 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3730 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3733 static MEDFileParameterMultiTS *New();
3734 static MEDFileParameterMultiTS *New(const std::string& fileName);
3735 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3736 std::string getName() const;
3737 void setName(const std::string& name);
3738 MEDFileParameterMultiTS *deepCopy() const;
3739 void write(const std::string& fileName, int mode) const;
3740 std::string simpleRepr() const;
3741 void appendValue(int dt, int it, double time, double val);
3742 double getDoubleValue(int iteration, int order) const;
3743 int getPosOfTimeStep(int iteration, int order) const;
3744 int getPosGivenTime(double time, double eps=1e-8) const;
3745 int getNumberOfTS() const;
3748 MEDFileParameterMultiTS()
3750 return MEDFileParameterMultiTS::New();
3753 MEDFileParameterMultiTS(const std::string& fileName)
3755 return MEDFileParameterMultiTS::New(fileName);
3758 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3760 return MEDFileParameterMultiTS::New(fileName,paramName);
3763 std::string __str__() const
3765 return self->simpleRepr();
3768 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3771 bool ret0=self->isEqual(other,eps,what);
3772 PyObject *res=PyList_New(2);
3773 PyObject *ret0Py=ret0?Py_True:Py_False;
3775 PyList_SetItem(res,0,ret0Py);
3776 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3780 void eraseTimeStepIds(PyObject *ids)
3784 std::vector<int> pos2;
3785 DataArrayInt *pos3=0;
3786 DataArrayIntTuple *pos4=0;
3787 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3792 self->eraseTimeStepIds(&pos1,&pos1+1);
3799 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3804 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3808 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3812 int getTimeStepId(PyObject *elt0) const
3814 if(elt0 && PyInt_Check(elt0))
3816 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3819 else if(elt0 && PyTuple_Check(elt0))
3821 if(PyTuple_Size(elt0)==2)
3823 PyObject *o0=PyTuple_GetItem(elt0,0);
3824 PyObject *o1=PyTuple_GetItem(elt0,1);
3825 if(PyInt_Check(o0) && PyInt_Check(o1))
3827 int iter=(int)PyInt_AS_LONG(o0);
3828 int order=(int)PyInt_AS_LONG(o1);
3829 return self->getPosOfTimeStep(iter,order);
3832 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 !");
3835 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 !");
3837 else if(elt0 && PyFloat_Check(elt0))
3839 double val=PyFloat_AS_DOUBLE(elt0);
3840 return self->getPosGivenTime(val);
3843 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3846 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3848 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3854 std::vector<int> getTimeStepIds(PyObject *elts) const
3856 if(PyList_Check(elts))
3858 std::size_t sz=PyList_Size(elts);
3859 std::vector<int> ret(sz);
3860 for(std::size_t i=0;i<sz;i++)
3862 PyObject *elt=PyList_GetItem(elts,i);
3863 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3869 std::vector<int> ret(1);
3870 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3875 void __delitem__(PyObject *elts)
3877 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3878 if(!idsToRemove.empty())
3879 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3882 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3884 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3890 PyObject *getIterations() const
3892 std::vector< std::pair<int,int> > res=self->getIterations();
3893 PyObject *ret=PyList_New(res.size());
3895 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3897 PyObject *elt=PyTuple_New(2);
3898 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3899 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3900 PyList_SetItem(ret,rk,elt);
3905 PyObject *getTimeSteps() const
3907 std::vector<double> res2;
3908 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3909 PyObject *ret=PyList_New(res.size());
3911 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3913 PyObject *elt=PyTuple_New(3);
3914 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3915 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3916 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3917 PyList_SetItem(ret,rk,elt);
3924 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3927 static MEDFileParameters *New();
3928 static MEDFileParameters *New(const std::string& fileName);
3929 static MEDFileParameters *New(DataArrayByte *db);
3930 MEDFileParameters *deepCopy() const;
3931 std::vector<std::string> getParamsNames() const;
3932 std::string simpleRepr() const;
3933 void resize(int newSize);
3934 void pushParam(MEDFileParameterMultiTS *param);
3935 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3936 void destroyParamAtPos(int i);
3937 int getPosFromParamName(const std::string& paramName) const;
3938 int getNumberOfParams() const;
3943 return MEDFileParameters::New();
3946 MEDFileParameters(const std::string& fileName)
3948 return MEDFileParameters::New(fileName);
3951 MEDFileParameters(DataArrayByte *db)
3953 return MEDFileParameters::New(db);
3956 std::string __str__() const
3958 return self->simpleRepr();
3961 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3963 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3964 if(PyInt_Check(obj))
3966 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3971 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3979 return self->getNumberOfParams();
3982 MEDFileParameterMultiTS *getParamAtPos(int i) const
3984 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3990 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3992 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3998 PyObject *isEqual(const MEDFileParameters *other, double eps) const
4001 bool ret0=self->isEqual(other,eps,what);
4002 PyObject *res=PyList_New(2);
4003 PyObject *ret0Py=ret0?Py_True:Py_False;
4005 PyList_SetItem(res,0,ret0Py);
4006 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
4012 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
4015 static MEDFileData *New(DataArrayByte *db);
4016 static MEDFileData *New(const std::string& fileName);
4017 static MEDFileData *New();
4018 MEDFileData *deepCopy() const;
4019 void setFields(MEDFileFields *fields);
4020 void setMeshes(MEDFileMeshes *meshes);
4021 void setParams(MEDFileParameters *params);
4022 int getNumberOfFields() const;
4023 int getNumberOfMeshes() const;
4024 int getNumberOfParams() const;
4026 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
4027 bool unPolyzeMeshes();
4028 void dealWithStructureElements();
4029 std::string getHeader() const;
4030 void setHeader(const std::string& header);
4034 MEDFileData(const std::string& fileName)
4036 return MEDFileData::New(fileName);
4039 MEDFileData(DataArrayByte *db)
4041 return MEDFileData::New(db);
4046 return MEDFileData::New();
4049 std::string __str__() const
4051 return self->simpleRepr();
4054 MEDFileMeshes *getMeshes() const
4056 MEDFileMeshes *ret=self->getMeshes();
4062 MEDFileParameters *getParams() const
4064 MEDFileParameters *ret=self->getParams();
4070 MEDFileFields *getFields() const
4072 MEDFileFields *ret=self->getFields();
4078 bool changeMeshNames(PyObject *li)
4080 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
4081 return self->changeMeshNames(modifTab);
4084 static MEDFileData *Aggregate(PyObject *mfds)
4086 std::vector<const MEDFileData *> mfdsCpp;
4087 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
4088 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
4094 class SauvReader : public RefCountObject
4097 static SauvReader* New(const std::string& fileName);
4098 MEDFileData * loadInMEDFileDS();
4101 SauvReader(const std::string& fileName)
4103 return SauvReader::New(fileName);
4108 class SauvWriter : public RefCountObject
4111 static SauvWriter * New();
4112 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
4113 void write(const std::string& fileName);
4114 void setCpyGrpIfOnASingleFamilyStatus(bool status);
4115 bool getCpyGrpIfOnASingleFamilyStatus() const;
4120 return SauvWriter::New();
4127 class MEDFileMeshStruct;
4129 class MEDFileField1TSStructItem
4132 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
4135 class MEDFileMeshStruct : public RefCountObject
4138 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
4140 ~MEDFileMeshStruct();
4143 class MEDMeshMultiLev : public RefCountObject
4146 virtual MEDMeshMultiLev *prepare() const;
4147 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
4148 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
4154 PyObject *retrieveFamilyIdsOnCells() const
4156 DataArrayIdType *famIds(0);
4157 bool isWithoutCopy(false);
4158 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
4159 PyObject *ret=PyTuple_New(2);
4160 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4162 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4163 PyTuple_SetItem(ret,1,ret1Py);
4167 PyObject *retrieveNumberIdsOnCells() const
4169 DataArrayIdType *numIds(0);
4170 bool isWithoutCopy(false);
4171 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
4172 PyObject *ret=PyTuple_New(2);
4173 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4175 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4176 PyTuple_SetItem(ret,1,ret1Py);
4180 PyObject *retrieveFamilyIdsOnNodes() const
4182 DataArrayIdType *famIds(0);
4183 bool isWithoutCopy(false);
4184 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
4185 PyObject *ret=PyTuple_New(2);
4186 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4188 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4189 PyTuple_SetItem(ret,1,ret1Py);
4193 PyObject *retrieveNumberIdsOnNodes() const
4195 DataArrayIdType *numIds(0);
4196 bool isWithoutCopy(false);
4197 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4198 PyObject *ret=PyTuple_New(2);
4199 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4201 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4202 PyTuple_SetItem(ret,1,ret1Py);
4206 PyObject *getGeoTypes() const
4208 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4209 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4210 PyObject *res(PyList_New(result.size()));
4211 for(int i=0;iL!=result.end(); i++, iL++)
4212 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4218 class MEDUMeshMultiLev : public MEDMeshMultiLev
4221 ~MEDUMeshMultiLev();
4225 PyObject *buildVTUArrays() const
4227 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4228 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4229 PyObject *ret0Py=ncc?Py_True:Py_False;
4231 PyObject *ret=PyTuple_New(7);
4232 PyTuple_SetItem(ret,0,ret0Py);
4233 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4234 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4235 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4236 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4237 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4238 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4244 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4247 ~MEDStructuredMeshMultiLev();
4250 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4253 ~MEDCMeshMultiLev();
4257 PyObject *buildVTUArrays() const
4260 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4261 std::size_t sz(objs.size());
4262 PyObject *ret(PyTuple_New(2));
4263 PyObject *ret0=PyList_New(sz);
4264 for(std::size_t i=0;i<sz;i++)
4265 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4266 PyTuple_SetItem(ret,0,ret0);
4267 PyObject *ret1Py(isInternal?Py_True:Py_False);
4269 PyTuple_SetItem(ret,1,ret1Py);
4275 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4278 ~MEDCurveLinearMeshMultiLev();
4282 PyObject *buildVTUArrays() const
4284 DataArrayDouble *ret0(0);
4285 std::vector<mcIdType> ret1;
4287 self->buildVTUArrays(ret0,ret1,ret2);
4288 std::size_t sz(ret1.size());
4289 PyObject *ret=PyTuple_New(3);
4290 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4291 PyObject *ret1Py=PyList_New(sz);
4292 for(std::size_t i=0;i<sz;i++)
4293 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4294 PyTuple_SetItem(ret,1,ret1Py);
4295 PyObject *ret2Py(ret2?Py_True:Py_False);
4297 PyTuple_SetItem(ret,2,ret2Py);
4303 class MEDFileFastCellSupportComparator : public RefCountObject
4306 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4307 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4308 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4309 int getNumberOfTS() const;
4311 ~MEDFileFastCellSupportComparator();
4315 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4317 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4318 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4319 PyObject *res(PyList_New(result.size()));
4320 for(int i=0;iL!=result.end(); i++, iL++)
4321 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4332 def exit1TS(self, exctype, exc, tb):
4335 MEDFileAnyTypeField1TS.__enter__=enter1TS
4336 MEDFileAnyTypeField1TS.__exit__=exit1TS
4337 MEDFileIntField1TS = MEDFileInt32Field1TS
4338 MEDFileIntFieldMultiTS = MEDFileInt32FieldMultiTS
4339 if MEDCouplingUse64BitIDs():
4340 MEDFileIDField1TS = MEDFileInt64Field1TS
4341 MEDFileIDFieldMultiTS = MEDFileInt64FieldMultiTS
4343 MEDFileIDField1TS = MEDFileInt32Field1TS
4344 MEDFileIDFieldMultiTS = MEDFileInt32FieldMultiTS