1 // Copyright (C) 2017-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #define MEDCOUPLING_EXPORT
22 #define MEDLOADER_EXPORT
24 #ifdef WITH_DOCSTRINGS
25 %include "MEDLoader_doc.i"
28 %include "MEDCouplingCommon.i"
31 #include "MEDLoader.hxx"
32 #include "MEDFileJoint.hxx"
33 #include "MEDFileMesh.hxx"
34 #include "MEDFileField.hxx"
35 #include "MEDFileParameter.hxx"
36 #include "MEDFileData.hxx"
37 #include "MEDFileEquivalence.hxx"
38 #include "MEDFileEntities.hxx"
39 #include "MEDFileMeshReadSelector.hxx"
40 #include "MEDFileFieldOverView.hxx"
41 #include "MEDCouplingTypemaps.i"
42 #include "MEDLoaderTypemaps.i"
43 #include "SauvReader.hxx"
44 #include "SauvWriter.hxx"
46 using namespace MEDCoupling;
49 #if SWIG_VERSION >= 0x010329
50 %template() std::vector<std::string>;
53 %typemap(out) MEDCoupling::MEDFileMesh*
55 $result=convertMEDFileMesh($1,$owner);
58 %typemap(out) MEDCoupling::MEDFileParameter1TS*
60 $result=convertMEDFileParameter1TS($1,$owner);
63 %typemap(out) MEDCoupling::MEDFileAnyTypeFieldMultiTS*
65 $result=convertMEDFileFieldMultiTS($1,$owner);
68 %typemap(out) MEDCoupling::MEDFileAnyTypeField1TS*
70 $result=convertMEDFileField1TS($1,$owner);
73 %typemap(out) MEDCoupling::MEDMeshMultiLev*
75 $result=convertMEDMeshMultiLev($1,$owner);
78 %newobject ReadUMeshFromFamiliesSwig;
79 %newobject ReadUMeshFromGroupsSwig;
80 %newobject ReadFieldSwig;
81 %newobject MEDCoupling::ReadUMeshFromFile;
82 %newobject MEDCoupling::ReadMeshFromFile;
83 %newobject MEDCoupling::ReadFieldCell;
84 %newobject MEDCoupling::ReadFieldNode;
85 %newobject MEDCoupling::ReadFieldGauss;
86 %newobject MEDCoupling::ReadFieldGaussNE;
87 %newobject MEDCoupling::MEDFileMesh::New;
88 %newobject MEDCoupling::MEDFileMesh::createNewEmpty;
89 %newobject MEDCoupling::MEDFileMesh::deepCopy;
90 %newobject MEDCoupling::MEDFileMesh::shallowCpy;
91 %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel;
92 %newobject MEDCoupling::MEDFileMesh::__getitem__;
93 %newobject MEDCoupling::MEDFileMesh::getGroupArr;
94 %newobject MEDCoupling::MEDFileMesh::getGroupsArr;
95 %newobject MEDCoupling::MEDFileMesh::getFamilyArr;
96 %newobject MEDCoupling::MEDFileMesh::getFamiliesArr;
97 %newobject MEDCoupling::MEDFileMesh::getNodeGroupArr;
98 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
99 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
100 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
101 %newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
102 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
103 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
104 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
105 %newobject MEDCoupling::MEDFileMesh::cartesianize;
106 %newobject MEDCoupling::MEDFileData::getJoints;
107 %newobject MEDCoupling::MEDFileStructuredMesh::getImplicitFaceMesh;
108 %newobject MEDCoupling::MEDFileUMesh::New;
109 %newobject MEDCoupling::MEDFileUMesh::LoadPartOf;
110 %newobject MEDCoupling::MEDFileUMesh::getCoords;
111 %newobject MEDCoupling::MEDFileUMesh::getPartDefAtLevel;
112 %newobject MEDCoupling::MEDFileUMesh::getGroup;
113 %newobject MEDCoupling::MEDFileUMesh::getGroups;
114 %newobject MEDCoupling::MEDFileUMesh::getFamily;
115 %newobject MEDCoupling::MEDFileUMesh::getFamilies;
116 %newobject MEDCoupling::MEDFileUMesh::getLevel0Mesh;
117 %newobject MEDCoupling::MEDFileUMesh::getLevelM1Mesh;
118 %newobject MEDCoupling::MEDFileUMesh::getLevelM2Mesh;
119 %newobject MEDCoupling::MEDFileUMesh::getLevelM3Mesh;
120 %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
121 %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType;
122 %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType;
123 %newobject MEDCoupling::MEDFileUMesh::zipCoords;
124 %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart;
125 %newobject MEDCoupling::MEDFileUMesh::extractPart;
126 %newobject MEDCoupling::MEDFileUMesh::buildExtrudedMesh;
127 %newobject MEDCoupling::MEDFileUMesh::linearToQuadratic;
128 %newobject MEDCoupling::MEDFileUMesh::quadraticToLinear;
129 %newobject MEDCoupling::MEDFileUMesh::symmetry3DPlane;
130 %newobject MEDCoupling::MEDFileUMesh::Aggregate;
131 %newobject MEDCoupling::MEDFileUMesh::convertToExtrudedMesh;
132 %newobject MEDCoupling::MEDFileCMesh::New;
133 %newobject MEDCoupling::MEDFileCurveLinearMesh::New;
134 %newobject MEDCoupling::MEDFileMeshMultiTS::New;
135 %newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy;
136 %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep;
137 %newobject MEDCoupling::MEDFileMeshes::New;
138 %newobject MEDCoupling::MEDFileMeshes::deepCopy;
139 %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos;
140 %newobject MEDCoupling::MEDFileMeshes::getMeshWithName;
141 %newobject MEDCoupling::MEDFileMeshes::__getitem__;
142 %newobject MEDCoupling::MEDFileMeshes::__iter__;
144 %newobject MEDCoupling::MEDFileMeshSupports::New;
145 %newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName;
147 %newobject MEDCoupling::MEDFileStructureElements::New;
149 %newobject MEDCoupling::MEDFileFields::New;
150 %newobject MEDCoupling::MEDFileFields::NewAdv;
151 %newobject MEDCoupling::MEDFileFields::NewWithDynGT;
152 %newobject MEDCoupling::MEDFileFields::LoadPartOf;
153 %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities;
154 %newobject MEDCoupling::MEDFileFields::deepCopy;
155 %newobject MEDCoupling::MEDFileFields::shallowCpy;
156 %newobject MEDCoupling::MEDFileFields::getFieldWithName;
157 %newobject MEDCoupling::MEDFileFields::getFieldAtPos;
158 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
159 %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
160 %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
161 %newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
162 %newobject MEDCoupling::MEDFileFields::__iter__;
163 %newobject MEDCoupling::MEDFileFields::extractPart;
164 %newobject MEDCoupling::MEDFileFields::linearToQuadratic;
166 %newobject MEDCoupling::MEDFileWritableStandAlone::serialize;
167 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New;
168 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy;
169 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy;
170 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
171 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep;
172 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
173 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::__iter__;
174 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::extractPart;
175 %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::buildNewEmpty;
176 %newobject MEDCoupling::MEDFileFieldMultiTS::New;
177 %newobject MEDCoupling::MEDFileFieldMultiTS::LoadSpecificEntities;
178 %newobject MEDCoupling::MEDFileFieldMultiTS::field;
179 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevel;
180 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtTopLevel;
181 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
182 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
183 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
184 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
186 %newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
187 %newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
188 %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
189 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray;
190 %newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble;
191 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel;
192 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel;
193 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
194 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
196 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
197 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
198 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
199 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
200 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
201 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
202 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
203 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
204 %newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
206 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
207 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
208 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
209 %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy;
210 %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart;
211 %newobject MEDCoupling::MEDFileField1TS::New;
212 %newobject MEDCoupling::MEDFileField1TS::field;
213 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel;
214 %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel;
215 %newobject MEDCoupling::MEDFileField1TS::getFieldOnMeshAtLevel;
216 %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld;
217 %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray;
218 %newobject MEDCoupling::MEDFileField1TS::convertToInt;
220 %newobject MEDCoupling::MEDFileIntField1TS::New;
221 %newobject MEDCoupling::MEDFileIntField1TS::field;
222 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevel;
223 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtTopLevel;
224 %newobject MEDCoupling::MEDFileIntField1TS::getFieldOnMeshAtLevel;
225 %newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevelOld;
226 %newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
227 %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
229 %newobject MEDCoupling::MEDFileFloatField1TS::New;
230 %newobject MEDCoupling::MEDFileFloatField1TS::field;
231 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
232 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
233 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
234 %newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
235 %newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
236 %newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
238 %newobject MEDCoupling::MEDFileData::New;
239 %newobject MEDCoupling::MEDFileData::deepCopy;
240 %newobject MEDCoupling::MEDFileData::getMeshes;
241 %newobject MEDCoupling::MEDFileData::getFields;
242 %newobject MEDCoupling::MEDFileData::getParams;
243 %newobject MEDCoupling::MEDFileData::Aggregate;
245 %newobject MEDCoupling::MEDFileEntities::BuildFrom;
247 %newobject MEDCoupling::MEDFileParameterDouble1TS::New;
248 %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy;
249 %newobject MEDCoupling::MEDFileParameterMultiTS::New;
250 %newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy;
251 %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos;
252 %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__;
253 %newobject MEDCoupling::MEDFileParameters::New;
254 %newobject MEDCoupling::MEDFileParameters::deepCopy;
255 %newobject MEDCoupling::MEDFileParameters::getParamAtPos;
256 %newobject MEDCoupling::MEDFileParameters::getParamWithName;
257 %newobject MEDCoupling::MEDFileParameters::__getitem__;
259 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
260 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
261 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
262 %newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
263 %newobject MEDCoupling::MEDFileJointOneStep::New;
264 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
265 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
266 %newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
267 %newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
268 %newobject MEDCoupling::MEDFileJoint::New;
269 %newobject MEDCoupling::MEDFileJoint::deepCopy;
270 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
271 %newobject MEDCoupling::MEDFileJoint::getStepAtPos;
272 %newobject MEDCoupling::MEDFileJoint::__getitem__;
273 %newobject MEDCoupling::MEDFileJoints::New;
274 %newobject MEDCoupling::MEDFileJoints::deepCopy;
275 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
276 %newobject MEDCoupling::MEDFileJoints::getJointWithName;
277 %newobject MEDCoupling::MEDFileJoints::__getitem__;
278 %newobject MEDCoupling::MEDFileEquivalences::getEquivalence;
279 %newobject MEDCoupling::MEDFileEquivalences::getEquivalenceWithName;
280 %newobject MEDCoupling::MEDFileEquivalences::appendEmptyEquivalenceWithName;
281 %newobject MEDCoupling::MEDFileEquivalencePair::initCell;
282 %newobject MEDCoupling::MEDFileEquivalencePair::initNode;
283 %newobject MEDCoupling::MEDFileEquivalencePair::getCell;
284 %newobject MEDCoupling::MEDFileEquivalencePair::getNode;
285 %newobject MEDCoupling::MEDFileEquivalenceData::getArray;
286 %newobject MEDCoupling::MEDFileEquivalenceCell::getArray;
288 %newobject MEDCoupling::SauvWriter::New;
289 %newobject MEDCoupling::SauvReader::New;
290 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
292 %newobject MEDCoupling::MEDFileMeshStruct::New;
293 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
294 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
295 %newobject MEDCoupling::MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny;
296 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
297 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
299 %feature("unref") MEDFileMesh "$this->decrRef();"
300 %feature("unref") MEDFileUMesh "$this->decrRef();"
301 %feature("unref") MEDFileCMesh "$this->decrRef();"
302 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
303 %feature("unref") MEDFileMeshes "$this->decrRef();"
304 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
305 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
306 %feature("unref") MEDFileField1TS "$this->decrRef();"
307 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
308 %feature("unref") MEDFileFloatField1TS "$this->decrRef();"
309 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
310 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
311 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
312 %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
313 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
314 %feature("unref") MEDFileStructureElements "$this->decrRef();"
315 %feature("unref") MEDFileFields "$this->decrRef();"
316 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
317 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
318 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
319 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
320 %feature("unref") MEDFileParameters "$this->decrRef();"
321 %feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
322 %feature("unref") MEDFileJointOneStep "$this->decrRef();"
323 %feature("unref") MEDFileJoint "$this->decrRef();"
324 %feature("unref") MEDFileJoints "$this->decrRef();"
325 %feature("unref") MEDFileEquivalences "$this->decrRef();"
326 %feature("unref") MEDFileEquivalencePair "$this->decrRef();"
327 %feature("unref") MEDFileEquivalenceBase "$this->decrRef();"
328 %feature("unref") MEDFileEquivalenceData "$this->decrRef();"
329 %feature("unref") MEDFileEquivalenceCell "$this->decrRef();"
330 %feature("unref") MEDFileEquivalenceNode "$this->decrRef();"
331 %feature("unref") MEDFileData "$this->decrRef();"
332 %feature("unref") SauvReader "$this->decrRef();"
333 %feature("unref") SauvWriter "$this->decrRef();"
334 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
335 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
336 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
337 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
338 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
339 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
341 namespace MEDCoupling
344 std::string MEDFileVersionStr();
345 std::string MEDFileVersionOfFileStr(const std::string& fileName);
346 void SetEpsilonForNodeComp(double val);
347 void SetCompPolicyForCell(int val);
348 void SetTooLongStrPolicy(int val);
349 void CheckFileForRead(const std::string& fileName);
350 std::vector<std::string> GetMeshNames(const std::string& fileName);
351 std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
352 std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
353 std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
354 std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
355 std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
356 std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
357 std::vector<std::string> GetAllFieldNames(const std::string& fileName);
358 std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
359 std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
360 std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
361 double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
362 void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj);
363 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
364 MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
365 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
366 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
367 int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
368 MEDCoupling::MEDCouplingField *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
369 MEDCoupling::MEDCouplingField *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
370 MEDCoupling::MEDCouplingField *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
371 MEDCoupling::MEDCouplingField *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
372 void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch);
373 void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
374 void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch);
375 void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
376 void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch);
377 void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingField *f);
380 %rename (MEDFileVersion) MEDFileVersionSwig;
381 %rename (GetFieldIterations) GetFieldIterationsSwig;
382 %rename (GetAllFieldIterations) GetAllFieldIterationsSwig;
383 %rename (GetCellFieldIterations) GetCellFieldIterationsSwig;
384 %rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig;
385 %rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig;
386 %rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig;
387 %rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig;
388 %rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig;
389 %rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig;
390 %rename (WriteUMeshes) WriteUMeshesSwig;
391 %rename (GetTypesOfField) GetTypesOfFieldSwig;
392 %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig;
393 %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig;
394 %rename (ReadField) ReadFieldSwig;
395 %rename (GetFamiliesGroupsInfo) GetFamiliesGroupsInfoSwig;
399 PyObject *MEDFileVersionSwig()
401 int major,minor,release;
402 MEDCoupling::MEDFileVersion(major,minor,release);
403 PyObject *ret(PyTuple_New(3));
404 PyTuple_SetItem(ret,0,SWIG_From_int(major));
405 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
406 PyTuple_SetItem(ret,2,SWIG_From_int(release));
410 int MEDFileSizeOfMedInt()
412 return 8*sizeof(med_int);
415 PyObject *GetFamiliesGroupsInfoSwig(const std::string& fileName, const std::string& meshName)
417 std::map<std::string,mcIdType> families;
418 std::map<std::string,std::vector<std::string>> groupsOnFam;
419 MEDCoupling::GetFamiliesGroupsInfo(fileName,meshName,families,groupsOnFam);
420 AutoPyPtr a(convertMapStringInt(families)),b(convertMapStringVectString(groupsOnFam));
421 AutoPyPtr ret(PyTuple_New(2));
422 PyTuple_SetItem(ret,0,a.retn());
423 PyTuple_SetItem(ret,1,b.retn());
427 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName)
429 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName));
433 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName)
435 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName));
439 MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order)
441 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order));
445 MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
447 MCAuto<MEDCoupling::MEDCouplingField> ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
451 PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
453 std::vector< std::pair<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
454 PyObject *ret=PyList_New(res.size());
456 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
458 PyObject *elt=PyTuple_New(2);
459 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
460 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
461 PyList_SetItem(ret,rk,elt);
466 PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName)
468 std::vector< std::pair< std::pair<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
469 PyObject *ret=PyList_New(res.size());
471 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
473 PyObject *elt=PyTuple_New(3);
474 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
475 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
476 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
477 PyList_SetItem(ret,rk,elt);
482 PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
484 std::vector< std::pair<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
485 PyObject *ret=PyList_New(res.size());
487 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
489 PyObject *elt=PyTuple_New(2);
490 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
491 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
492 PyList_SetItem(ret,rk,elt);
497 PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
499 std::vector< std::pair<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
500 PyObject *ret=PyList_New(res.size());
502 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
504 PyObject *elt=PyTuple_New(2);
505 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
506 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
507 PyList_SetItem(ret,rk,elt);
512 PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName)
514 std::vector< std::pair<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
515 PyObject *ret=PyList_New(res.size());
517 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
519 PyObject *elt=PyTuple_New(2);
520 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
521 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
522 PyList_SetItem(ret,rk,elt);
527 PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName)
529 int meshDim,spaceDim;
530 mcIdType numberOfNodes;
531 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
532 PyObject *ret=PyTuple_New(4);
533 PyObject *elt0=PyList_New(res.size());
535 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
537 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
539 PyObject *elt1=PyList_New(obj2.size());
540 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
542 PyObject *elt2=PyTuple_New(2);
543 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
544 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
545 PyList_SetItem(elt1,j,elt2);
547 PyList_SetItem(elt0,i,elt1);
549 PyTuple_SetItem(ret,0,elt0);
550 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
551 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
552 PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes));
556 PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
557 const std::string& fieldName, PyObject *liIts)
559 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
560 std::vector<MEDCoupling::MEDCouplingFieldDouble *> res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
561 return convertFieldDoubleVecToPy(res);
564 void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
566 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
567 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
568 MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
571 void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch)
573 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
574 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
575 MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
578 void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch)
580 std::vector<const MEDCoupling::MEDCouplingUMesh *> v;
581 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v);
582 MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch);
585 PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
587 std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
588 std::size_t size=v.size();
589 PyObject *ret=PyList_New(size);
590 for(std::size_t i=0;i<size;i++)
591 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
595 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
597 std::vector<std::string> grps;
598 converPyListToVecString(li,grps);
599 return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
602 MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li)
604 std::vector<std::string> fams;
605 converPyListToVecString(li,fams);
606 return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
610 namespace MEDCoupling
612 class MEDFileWritable
615 void copyOptionsFrom(const MEDFileWritable& other) const;
616 int getTooLongStrPolicy() const;
617 void setTooLongStrPolicy(int newVal);
618 int getZipConnPolicy();
619 void setZipConnPolicy(int newVal);
622 class MEDFileWritableStandAlone : public MEDFileWritable
625 void write(const std::string& fileName, int mode) const;
626 void write33(const std::string& fileName, int mode) const;
629 DataArrayByte *serialize() const
631 MCAuto<DataArrayByte> ret(self->serialize());
635 PyObject *__getstate__()
637 PyObject *ret(PyList_New(0));
641 void __setstate__(PyObject *inp)
647 class MEDFileMeshReadSelector
650 MEDFileMeshReadSelector();
651 MEDFileMeshReadSelector(unsigned int code);
652 unsigned int getCode() const;
653 void setCode(unsigned int newCode);
654 bool isCellFamilyFieldReading() const;
655 bool isNodeFamilyFieldReading() const;
656 bool isCellNameFieldReading() const;
657 bool isNodeNameFieldReading() const;
658 bool isCellNumFieldReading() const;
659 bool isNodeNumFieldReading() const;
660 bool isGlobalNodeNumFieldReading() const;
661 void setCellFamilyFieldReading(bool b);
662 void setNodeFamilyFieldReading(bool b);
663 void setCellNameFieldReading(bool b);
664 void setNodeNameFieldReading(bool b);
665 void setCellNumFieldReading(bool b);
666 void setNodeNumFieldReading(bool b);
667 void setGlobalNodeNumFieldReading(bool b);
670 std::string __str__() const
672 std::ostringstream oss;
677 std::string __repr__() const
679 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
685 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
688 static MEDFileJointCorrespondence *New();
689 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
691 static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
692 INTERP_KERNEL::NormalizedCellType loc_geo_type,
693 INTERP_KERNEL::NormalizedCellType rem_geo_type)
695 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
696 MEDFileJointCorrespondence *deepCopy() const;
697 MEDFileJointCorrespondence *shallowCpy() const;
698 void setIsNodal(bool isNodal);
699 bool getIsNodal() const;
700 bool isEqual(const MEDFileJointCorrespondence *other) const;
701 void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
702 INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
703 void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
704 INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
705 void setCorrespondence(DataArrayIdType *corr);
706 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
707 std::string simpleRepr() const;
710 MEDFileJointCorrespondence()
712 return MEDFileJointCorrespondence::New();
714 MEDFileJointCorrespondence(DataArrayIdType* correspondence)
716 return MEDFileJointCorrespondence::New(correspondence);
718 MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
719 INTERP_KERNEL::NormalizedCellType loc_geo_type,
720 INTERP_KERNEL::NormalizedCellType rem_geo_type)
722 return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
725 std::string __str__() const
727 return self->simpleRepr();
730 DataArrayIdType *getCorrespondence() const
732 const DataArrayIdType *ret(self->getCorrespondence());
735 return const_cast<DataArrayIdType *>(ret);
740 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
743 static MEDFileJointOneStep *New(int dt=-1, int it=-1);
744 static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
745 MEDFileJointOneStep *deepCopy() const;
746 MEDFileJointOneStep *shallowCpy() const;
747 bool isEqual(const MEDFileJointOneStep *other) const;
748 void setOrder(int order);
749 int getOrder() const;
750 void setIteration(int it);
751 int getIteration() const;
752 void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
753 int getNumberOfCorrespondences() const;
754 void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
755 std::string simpleRepr() const;
758 MEDFileJointOneStep()
760 return MEDFileJointOneStep::New();
763 MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number)
765 return MEDFileJointOneStep::New(fileName,mName,jointName,number);
768 std::string __str__() const
770 return self->simpleRepr();
773 MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const
775 MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
781 MEDFileJointCorrespondence *__getitem__(int i) const
783 return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
788 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
791 static MEDFileJoint *New();
792 static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
793 static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum);
794 MEDFileJoint *deepCopy() const;
795 MEDFileJoint *shallowCpy() const;
796 bool isEqual(const MEDFileJoint *other) const;
797 void setLocalMeshName(const std::string& name);
798 std::string getLocalMeshName() const;
799 void setRemoteMeshName(const std::string& name);
800 std::string getRemoteMeshName() const;
801 void setDescription(const std::string& name);
802 std::string getDescription() const;
803 void setJointName(const std::string& name);
804 std::string getJointName() const;
805 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
806 void setDomainNumber(const int& number);
807 int getDomainNumber() const;
808 void pushStep(MEDFileJointOneStep* step);
809 int getNumberOfSteps() const;
810 std::string simpleRepr() const;
815 return MEDFileJoint::New();
818 MEDFileJoint(const std::string& fileName, const std::string& mName, int num)
820 return MEDFileJoint::New(fileName,mName,num);
823 MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
825 return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
828 std::string __str__() const
830 return self->simpleRepr();
833 MEDFileJointOneStep *getStepAtPos(int i) const
835 MEDFileJointOneStep *ret(self->getStepAtPos(i));
841 MEDFileJointOneStep *__getitem__(int i)
843 return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
848 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
851 static MEDFileJoints *New();
852 static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
853 MEDFileJoints *deepCopy() const;
854 std::string simpleRepr() const;
855 std::string getMeshName() const;
856 int getNumberOfJoints() const;
857 std::vector<std::string> getJointsNames() const;
858 bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
859 void resize(int newSize);
860 void pushJoint(MEDFileJoint *joint);
861 void setJointAtPos(int i, MEDFileJoint *joint);
862 void destroyJointAtPos(int i);
867 return MEDFileJoints::New();
870 MEDFileJoints(const std::string& fileName, const std::string& meshName)
872 return MEDFileJoints::New(fileName,meshName);
875 std::string __str__() const
877 return self->simpleRepr();
880 MEDFileJoint *__getitem__(PyObject *obj)
882 static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
885 MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
890 MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
898 return self->getNumberOfJoints();
901 MEDFileJoint *getJointAtPos(int i) const
903 MEDFileJoint *ret=self->getJointAtPos(i);
909 MEDFileJoint *getJointWithName(const std::string& paramName) const
911 MEDFileJoint *ret=self->getJointWithName(paramName);
919 class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone
922 MEDFileEquivalenceBase();
925 class MEDFileEquivalenceData : public MEDFileEquivalenceBase
928 MEDFileEquivalenceData();
930 void setArray(DataArrayInt32 *data);
933 DataArrayInt32 *getArray()
935 DataArrayInt32 *ret(self->getArray());
936 if(ret) ret->incrRef();
942 class MEDFileEquivalenceNode : public MEDFileEquivalenceData
945 MEDFileEquivalenceNode();
948 class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
951 MEDFileEquivalenceCell();
954 std::size_t size() const;
955 void setArray(int meshDimRelToMax, DataArrayInt32 *da);
956 void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
959 DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
961 DataArrayInt32 *ret(self->getArray(type));
962 if(ret) ret->incrRef();
966 PyObject *getTypes() const
968 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getTypes());
969 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
970 PyObject *res=PyList_New(result.size());
971 for(int i=0;iL!=result.end(); i++, iL++)
972 PyList_SetItem(res,i,PyInt_FromLong(*iL));
978 class MEDFileEquivalencePair : public RefCountObject, public MEDFileWritableStandAlone
981 MEDFileEquivalencePair();
983 std::string getName() const;
984 void setName(const std::string& name);
985 std::string getDescription() const;
986 void setDescription(const std::string& descr);
987 void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
990 MEDFileEquivalenceCell *initCell()
992 MEDFileEquivalenceCell *ret(self->initCell());
993 if(ret) ret->incrRef();
997 MEDFileEquivalenceNode *initNode()
999 MEDFileEquivalenceNode *ret(self->initNode());
1000 if(ret) ret->incrRef();
1004 MEDFileEquivalenceCell *getCell()
1006 MEDFileEquivalenceCell *ret(self->getCell());
1007 if(ret) ret->incrRef();
1011 MEDFileEquivalenceNode *getNode()
1013 MEDFileEquivalenceNode *ret(self->getNode());
1014 if(ret) ret->incrRef();
1020 class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
1023 MEDFileEquivalences();
1026 std::vector<std::string> getEquivalenceNames() const;
1027 void killEquivalenceWithName(const std::string& name);
1028 void killEquivalenceAt(int i);
1032 MEDFileEquivalencePair *getEquivalence(int i)
1034 MEDFileEquivalencePair *ret(self->getEquivalence(i));
1035 if(ret) ret->incrRef();
1038 MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name)
1040 MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name));
1041 if(ret) ret->incrRef();
1045 MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name)
1047 MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name));
1048 if(ret) ret->incrRef();
1054 class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
1057 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1058 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1059 static MEDFileMesh *New(DataArrayByte *db);
1060 virtual MEDFileMesh *createNewEmpty() const;
1061 virtual MEDFileMesh *deepCopy() const;
1062 virtual MEDFileMesh *shallowCpy() const;
1063 virtual void clearNonDiscrAttributes() const;
1064 void setName(const std::string& name);
1065 std::string getName();
1066 std::string getUnivName() const;
1067 bool getUnivNameWrStatus() const;
1068 void setUnivNameWrStatus(bool newStatus);
1069 void setDescription(const std::string& name);
1070 std::string getDescription() const;
1071 void setOrder(int order);
1072 int getOrder() const;
1073 void setIteration(int it);
1075 void setTimeValue(double time);
1076 void setTime(int dt, int it, double time);
1077 double getTimeValue() const;
1078 void setTimeUnit(const std::string& unit);
1079 std::string getTimeUnit() const;
1080 void setAxisType(MEDCouplingAxisType at);
1081 MEDCouplingAxisType getAxisType() const;
1082 virtual int getNumberOfNodes() const;
1083 virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
1084 virtual bool hasImplicitPart() const;
1085 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
1086 virtual void releaseImplicitPartIfAny() const;
1087 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
1088 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
1089 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
1090 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
1091 virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
1092 virtual MEDFileMesh *cartesianize() const;
1093 std::vector<int> getNonEmptyLevels() const;
1094 std::vector<int> getNonEmptyLevelsExt() const;
1095 int getSizeAtLevel(int meshDimRelToMaxExt) const;
1097 bool existsGroup(const std::string& groupName) const;
1098 bool existsFamily(int famId) const;
1099 bool existsFamily(const std::string& familyName) const;
1100 void setFamilyId(const std::string& familyName, int id);
1101 void setFamilyIdUnique(const std::string& familyName, int id);
1102 void addFamily(const std::string& familyName, int id);
1103 void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
1104 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
1105 virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
1106 void copyFamGrpMapsFrom(const MEDFileMesh& other);
1109 void clearFamGrpMaps();
1110 const std::map<std::string,int>& getFamilyInfo() const;
1111 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
1112 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
1113 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
1114 std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
1115 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
1116 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
1117 std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
1118 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
1119 std::vector<std::string> getGroupsNames() const;
1120 std::vector<std::string> getFamiliesNames() const;
1121 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
1122 std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
1123 std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
1124 std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
1125 std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
1126 std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
1127 std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
1128 std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
1129 std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
1130 std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
1131 static std::string GetMagicFamilyStr();
1132 void assignFamilyNameWithGroupName();
1133 std::vector<std::string> removeEmptyGroups();
1134 void removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name);
1135 void removeGroup(const std::string& name);
1136 void removeFamily(const std::string& name);
1137 std::vector<std::string> removeOrphanGroups();
1138 std::vector<std::string> removeOrphanFamilies();
1139 void removeFamiliesReferedByNoGroups();
1140 void rearrangeFamilies();
1142 void checkOrphanFamilyZero() const;
1143 void changeGroupName(const std::string& oldName, const std::string& newName);
1144 void changeFamilyName(const std::string& oldName, const std::string& newName);
1145 void changeFamilyId(int oldId, int newId);
1146 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
1147 void setFamilyInfo(const std::map<std::string,mcIdType>& info);
1148 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
1149 int getFamilyId(const std::string& name) const;
1150 int getMaxAbsFamilyId() const;
1151 int getMaxFamilyId() const;
1152 int getMinFamilyId() const;
1153 int getTheMaxAbsFamilyId() const;
1154 int getTheMaxFamilyId() const;
1155 int getTheMinFamilyId() const;
1156 virtual int getMaxAbsFamilyIdInArrays() const;
1157 virtual int getMaxFamilyIdInArrays() const;
1158 virtual int getMinFamilyIdInArrays() const;
1159 DataArrayIdType *getAllFamiliesIdsReferenced() const;
1160 DataArrayIdType *computeAllFamilyIdsInUse() const;
1161 std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
1162 std::string getFamilyNameGivenId(int id) const;
1163 bool ensureDifferentFamIdsPerLevel();
1164 void normalizeFamIdsTrio();
1165 void normalizeFamIdsMEDFile();
1166 virtual int getMeshDimension() const;
1167 virtual std::string simpleRepr() const;
1168 virtual std::string advancedRepr() const;
1170 virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
1171 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
1172 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
1173 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
1174 virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
1175 virtual void addNodeGroup(const DataArrayIdType *ids);
1176 virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
1177 virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1178 virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1179 virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1180 virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1181 virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
1182 virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1183 virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
1184 virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
1185 int getNumberOfJoints();
1186 MEDFileJoints *getJoints();
1187 void setJoints( MEDFileJoints* joints );
1188 void initializeEquivalences();
1189 void killEquivalences();
1190 bool presenceOfStructureElements() const;
1191 void killStructureElements();
1194 std::string __str__() const
1196 return self->simpleRepr();
1199 MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const
1201 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
1207 double tmp0=self->getTime(tmp1,tmp2);
1208 PyObject *res = PyList_New(3);
1209 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1210 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1211 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1215 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const
1218 bool ret0=self->isEqual(other,eps,what);
1219 PyObject *res=PyList_New(2);
1220 PyObject *ret0Py=ret0?Py_True:Py_False;
1222 PyList_SetItem(res,0,ret0Py);
1223 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1227 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
1229 std::vector<const DataArrayIdType *> grps;
1230 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
1231 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
1234 PyObject *areFamsEqual(const MEDFileMesh *other) const
1237 bool ret0=self->areFamsEqual(other,what);
1238 PyObject *res=PyList_New(2);
1239 PyObject *ret0Py=ret0?Py_True:Py_False;
1241 PyList_SetItem(res,0,ret0Py);
1242 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1246 PyObject *areGrpsEqual(const MEDFileMesh *other) const
1249 bool ret0=self->areGrpsEqual(other,what);
1250 PyObject *res=PyList_New(2);
1251 PyObject *ret0Py=ret0?Py_True:Py_False;
1253 PyList_SetItem(res,0,ret0Py);
1254 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1258 PyObject *getAllGeoTypes() const
1260 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
1261 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1262 PyObject *res=PyList_New(result.size());
1263 for(int i=0;iL!=result.end(); i++, iL++)
1264 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1268 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const
1270 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
1271 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1272 PyObject *res=PyList_New(result.size());
1273 for(int i=0;iL!=result.end(); i++, iL++)
1274 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1278 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
1280 const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
1283 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1286 PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
1288 const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
1291 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1294 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
1296 const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
1299 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1302 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
1304 const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
1307 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1310 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
1312 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
1315 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
1318 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created)
1321 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
1322 PyObject *ret=PyTuple_New(2);
1323 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
1324 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
1328 PyObject *unPolyze()
1330 DataArrayIdType *ret3=0;
1331 std::vector<mcIdType> ret1,ret2;
1332 bool ret0=self->unPolyze(ret1,ret2,ret3);
1333 PyObject *ret=PyTuple_New(4);
1334 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
1336 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
1337 for(int j=0;j<(int)ret1.size()/3;j++)
1339 PyObject *retLev2=PyList_New(3);
1340 PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
1341 PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
1342 PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
1343 PyList_SetItem(retLev1_0,j,retLev2);
1345 PyTuple_SetItem(ret,1,retLev1_0);
1347 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
1348 for(int j=0;j<(int)ret2.size()/3;j++)
1350 PyObject *retLev2=PyList_New(3);
1351 PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
1352 PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
1353 PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
1354 PyList_SetItem(retLev1_1,j,retLev2);
1356 PyTuple_SetItem(ret,2,retLev1_1);
1358 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1362 MEDFileEquivalences *getEquivalences()
1364 MEDFileEquivalences *ret(self->getEquivalences());
1365 if(ret) ret->incrRef();
1369 virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
1371 MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
1377 class MEDFileUMesh : public MEDFileMesh
1380 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1381 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1382 static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
1383 static MEDFileUMesh *New(DataArrayByte *db);
1384 static MEDFileUMesh *New();
1385 static const char *GetSpeStr4ExtMesh();
1387 int getSpaceDimension() const;
1388 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1389 void checkConsistency() const;
1390 void checkSMESHConsistency() const;
1391 void clearNodeAndCellNumbers();
1393 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
1394 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
1395 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
1396 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
1397 DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
1398 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
1399 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
1400 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
1401 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
1402 void forceComputationOfParts() const;
1404 void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
1405 void setCoords(DataArrayDouble *coords);
1406 void setCoordsForced(DataArrayDouble *coords);
1407 void eraseGroupsAtLevel(int meshDimRelToMaxExt);
1408 void removeMeshAtLevel(int meshDimRelToMax);
1409 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
1410 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
1411 void optimizeFamilies();
1412 DataArrayIdType *zipCoords();
1413 DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1414 DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
1415 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
1416 MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
1417 MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
1418 MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
1421 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1423 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
1426 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1428 return MEDFileUMesh::New(fileName,mrs);
1431 MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
1433 return MEDFileUMesh::New(mem);
1436 MEDFileUMesh(DataArrayByte *db)
1438 return MEDFileUMesh::New(db);
1443 return MEDFileUMesh::New();
1446 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)
1448 std::vector<int> typesCpp1;
1449 convertPyToNewIntArr3(types,typesCpp1);
1450 std::size_t sz(typesCpp1.size());
1451 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
1452 for(std::size_t ii=0;ii<sz;ii++)
1453 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
1454 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
1457 PyObject *__getstate__()
1459 std::vector<double> a0;
1460 std::vector<mcIdType> a1;
1461 std::vector<std::string> a2;
1462 std::vector< MCAuto<DataArrayIdType> > a3;
1463 MCAuto<DataArrayDouble> a4;
1464 self->serialize(a0,a1,a2,a3,a4);
1465 PyObject *ret(PyTuple_New(5));
1466 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1467 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1468 std::size_t sz(a2.size());
1469 PyObject *ret2(PyList_New(sz));
1470 for(std::size_t i=0;i<sz;i++)
1471 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1472 PyTuple_SetItem(ret,2,ret2);
1474 PyObject *ret3(PyList_New(sz));
1475 for(std::size_t i=0;i<sz;i++)
1477 DataArrayIdType *elt(a3[i]);
1480 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1482 PyTuple_SetItem(ret,3,ret3);
1483 DataArrayDouble *ret4(a4);
1486 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1490 void __setstate__(PyObject *inp)
1492 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
1493 if(!PyTuple_Check(inp))
1494 throw INTERP_KERNEL::Exception(MSG);
1495 std::size_t sz(PyTuple_Size(inp));
1497 throw INTERP_KERNEL::Exception(MSG);
1498 std::vector<double> a0;
1499 std::vector<mcIdType> a1;
1500 std::vector<std::string> a2;
1501 std::vector< MCAuto<DataArrayIdType> > a3;
1502 MCAuto<DataArrayDouble> a4;
1504 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
1506 fillArrayWithPyListDbl3(a0py,tmp,a0);
1507 convertPyToNewIntArr3(a1py,a1);
1508 fillStringVector(a2py,a2);
1510 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
1512 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
1513 if(!SWIG_IsOK(status))
1514 throw INTERP_KERNEL::Exception(MSG);
1515 a4=reinterpret_cast<DataArrayDouble *>(argp);
1516 if((DataArrayDouble *)a4)
1519 std::vector< DataArrayIdType * > a3Tmp;
1520 convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
1521 std::size_t sz(a3Tmp.size());
1523 for(std::size_t i=0;i<sz;i++)
1527 a3Tmp[i]->incrRef();
1529 self->unserialize(a0,a1,a2,a3,a4);
1533 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
1536 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
1537 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
1540 self->setMeshAtLevel(meshDimRelToMax,m0,false);
1543 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
1546 self->setMeshAtLevel(meshDimRelToMax,m1);
1549 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
1552 void __delitem__(int meshDimRelToMax)
1554 self->removeMeshAtLevel(meshDimRelToMax);
1557 MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
1559 const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
1561 DataArrayDouble *a,*a2;
1562 DataArrayDoubleTuple *aa,*aa2;
1563 std::vector<double> bb,bb2;
1565 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1566 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1567 MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1571 static MEDFileUMesh *Aggregate(PyObject *meshes)
1573 std::vector<const MEDFileUMesh *> meshesCpp;
1574 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
1575 MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
1579 PyObject *getAllDistributionOfTypes() const
1581 std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
1582 return convertVecPairIntToPy(ret);
1585 DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
1587 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1588 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1589 return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
1592 MEDFileUMesh *extractPart(PyObject *extractDef) const
1594 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
1595 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
1596 return self->extractPart(extractDefCpp);
1599 void setMeshes(PyObject *li, bool renum=false)
1601 std::vector<const MEDCouplingUMesh *> ms;
1602 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1603 self->setMeshes(ms,renum);
1606 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
1608 std::vector<const MEDCouplingUMesh *> ms;
1609 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1610 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
1613 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
1615 std::vector<const MEDCouplingUMesh *> ms;
1616 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
1617 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
1620 DataArrayDouble *getCoords() const
1622 DataArrayDouble *ret=self->getCoords();
1628 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
1630 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
1633 return const_cast<PartDefinition *>(ret);
1636 PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
1638 DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
1639 self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
1640 PyObject *ret=PyTuple_New(3);
1641 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1642 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1643 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1647 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
1649 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
1655 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
1657 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1658 std::size_t sz(tmp.size());
1659 PyObject *ret=PyList_New(sz);
1660 for(std::size_t i=0;i<sz;i++)
1664 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1671 class MEDFileStructuredMesh : public MEDFileMesh
1676 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
1678 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1686 class MEDFileCMesh : public MEDFileStructuredMesh
1689 static MEDFileCMesh *New();
1690 static MEDFileCMesh *New(DataArrayByte *db);
1691 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1692 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1693 void setMesh(MEDCouplingCMesh *m);
1694 int getSpaceDimension() const;
1699 return MEDFileCMesh::New();
1702 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1704 return MEDFileCMesh::New(fileName,mrs);
1707 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1709 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1712 MEDFileCMesh(DataArrayByte *db)
1714 return MEDFileCMesh::New(db);
1717 PyObject *getMesh() const
1719 const MEDCouplingCMesh *tmp=self->getMesh();
1722 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1727 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1730 static MEDFileCurveLinearMesh *New();
1731 static MEDFileCurveLinearMesh *New(DataArrayByte *db);
1732 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
1733 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
1734 void setMesh(MEDCouplingCurveLinearMesh *m);
1737 MEDFileCurveLinearMesh()
1739 return MEDFileCurveLinearMesh::New();
1742 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
1744 return MEDFileCurveLinearMesh::New(fileName,mrs);
1747 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
1749 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1752 MEDFileCurveLinearMesh(DataArrayByte *db)
1754 return MEDFileCurveLinearMesh::New(db);
1757 PyObject *getMesh() const
1759 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1767 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
1770 static MEDFileMeshMultiTS *New();
1771 static MEDFileMeshMultiTS *New(const std::string& fileName);
1772 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
1773 MEDFileMeshMultiTS *deepCopy() const;
1774 std::string getName() const;
1775 void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
1776 void cartesianizeMe();
1779 MEDFileMeshMultiTS()
1781 return MEDFileMeshMultiTS::New();
1784 MEDFileMeshMultiTS(const std::string& fileName)
1786 return MEDFileMeshMultiTS::New(fileName);
1789 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
1791 return MEDFileMeshMultiTS::New(fileName,mName);
1794 MEDFileMesh *getOneTimeStep() const
1796 MEDFileMesh *ret=self->getOneTimeStep();
1804 class MEDFileMeshesIterator
1811 MEDFileMesh *ret=self->nextt();
1815 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1819 PyErr_SetString(PyExc_StopIteration,"No more data.");
1826 class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
1829 static MEDFileMeshes *New();
1830 static MEDFileMeshes *New(DataArrayByte *db);
1831 MEDFileMeshes *deepCopy() const;
1832 int getNumberOfMeshes() const;
1833 std::vector<std::string> getMeshesNames() const;
1835 void resize(int newSize);
1836 void pushMesh(MEDFileMesh *mesh);
1837 void setMeshAtPos(int i, MEDFileMesh *mesh);
1838 void destroyMeshAtPos(int i);
1839 void cartesianizeMe();
1840 bool presenceOfStructureElements() const;
1841 void killStructureElements();
1846 return MEDFileMeshes::New();
1849 MEDFileMeshes(const std::string& fileName)
1851 return MEDFileMeshes::New(fileName);
1854 MEDFileMeshes(DataArrayByte *db)
1856 return MEDFileMeshes::New(db);
1859 std::string __str__() const
1861 return self->simpleRepr();
1864 MEDFileMesh *__getitem__(PyObject *obj)
1866 static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
1867 if(PyInt_Check(obj))
1869 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1874 MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
1880 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
1882 self->setMeshAtPos(obj,mesh);
1886 MEDFileMeshesIterator *__iter__()
1888 return self->iterator();
1893 return self->getNumberOfMeshes();
1896 MEDFileMesh *getMeshAtPos(int i) const
1898 MEDFileMesh *ret=self->getMeshAtPos(i);
1903 MEDFileMesh *getMeshWithName(const std::string& mname) const
1905 MEDFileMesh *ret=self->getMeshWithName(mname);
1913 class MEDFileFieldLoc : public RefCountObject
1916 std::string getName() const;
1917 int getDimension() const;
1918 int getNumberOfGaussPoints() const;
1919 int getNumberOfPointsInCells() const;
1920 const std::vector<double>& getRefCoords() const;
1921 const std::vector<double>& getGaussCoords() const;
1922 const std::vector<double>& getGaussWeights() const;
1923 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
1926 std::string __str__() const
1928 return self->repr();
1933 class MEDFileFieldGlobsReal
1936 void resetContent();
1937 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
1938 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
1939 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1940 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
1941 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
1942 void checkGlobsCoherency() const;
1943 void checkGlobsPflsPartCoherency() const;
1944 void checkGlobsLocsPartCoherency() const;
1945 std::vector<std::string> getPfls() const;
1946 std::vector<std::string> getLocs() const;
1947 bool existsPfl(const std::string& pflName) const;
1948 bool existsLoc(const std::string& locName) const;
1949 std::string createNewNameOfPfl() const;
1950 std::string createNewNameOfLoc() const;
1951 std::vector< std::vector<int> > whichAreEqualProfiles() const;
1952 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
1953 virtual std::vector<std::string> getPflsReallyUsed() const;
1954 virtual std::vector<std::string> getLocsReallyUsed() const;
1955 virtual std::vector<std::string> getPflsReallyUsedMulti() const;
1956 virtual std::vector<std::string> getLocsReallyUsedMulti() const;
1957 void killProfileIds(const std::vector<int>& pflIds);
1958 void killLocalizationIds(const std::vector<int>& locIds);
1959 void changePflName(const std::string& oldName, const std::string& newName);
1960 void changeLocName(const std::string& oldName, const std::string& newName);
1961 int getNbOfGaussPtPerCell(int locId) const;
1962 int getLocalizationId(const std::string& loc) const;
1963 int getProfileId(const std::string& pfl) const;
1964 void killStructureElementsInGlobs();
1967 PyObject *getProfile(const std::string& pflName) const
1969 const DataArrayIdType *ret=self->getProfile(pflName);
1972 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1975 PyObject *getProfileFromId(int pflId) const
1977 const DataArrayIdType *ret=self->getProfileFromId(pflId);
1980 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1983 PyObject *getLocalizationFromId(int locId) const
1985 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1988 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1991 PyObject *getLocalization(const std::string& locName) const
1993 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1996 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1999 PyObject *zipPflsNames()
2001 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
2002 return convertVecPairVecStToPy(ret);
2005 PyObject *zipLocsNames(double eps)
2007 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
2008 return convertVecPairVecStToPy(ret);
2011 void changePflsNames(PyObject *li)
2013 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2014 self->changePflsNames(v);
2017 void changePflsRefsNamesGen(PyObject *li)
2019 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2020 self->changePflsRefsNamesGen(v);
2023 void changePflsNamesInStruct(PyObject *li)
2025 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2026 self->changePflsNamesInStruct(v);
2029 void changeLocsNames(PyObject *li)
2031 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2032 self->changeLocsNames(v);
2035 void changeLocsRefsNamesGen(PyObject *li)
2037 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2038 self->changeLocsRefsNamesGen(v);
2041 void changeLocsNamesInStruct(PyObject *li)
2043 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
2044 self->changeLocsNamesInStruct(v);
2047 std::string simpleReprGlobs() const
2049 std::ostringstream oss;
2050 self->simpleReprGlobs(oss);
2056 class MEDFileEntities
2061 static MEDFileEntities *BuildFrom(PyObject *entities)
2063 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
2064 std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
2066 std::size_t sz(inp0.size());
2068 for(std::size_t i=0;i<sz;i++)
2069 inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
2071 return MEDFileEntities::BuildFrom(&inp);
2078 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2081 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
2082 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2083 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2084 static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
2086 void loadArraysIfNecessary();
2087 void unloadArrays();
2088 void unloadArraysWithoutDataLoss();
2089 int getDimension() const;
2090 int getIteration() const;
2091 int getOrder() const;
2092 std::string getName();
2093 void setName(const std::string& name);
2094 std::string getMeshName();
2095 void setMeshName(const std::string& newMeshName);
2096 int getMeshIteration() const;
2097 int getMeshOrder() const;
2098 int getNumberOfComponents() const;
2099 bool isDealingTS(int iteration, int order) const;
2100 void setInfo(const std::vector<std::string>& infos);
2101 const std::vector<std::string>& getInfo() const;
2102 bool presenceOfMultiDiscPerGeoType() const;
2103 void setTime(int iteration, int order, double val);
2104 virtual MEDFileAnyTypeField1TS *shallowCpy() const;
2105 MEDFileAnyTypeField1TS *deepCopy() const;
2106 std::string getDtUnit() const;
2107 void setDtUnit(const std::string& dtUnit);
2113 double tmp0=self->getTime(tmp1,tmp2);
2114 PyObject *res = PyList_New(3);
2115 PyList_SetItem(res,0,SWIG_From_int(tmp1));
2116 PyList_SetItem(res,1,SWIG_From_int(tmp2));
2117 PyList_SetItem(res,2,SWIG_From_double(tmp0));
2121 PyObject *getDtIt() const
2123 std::pair<int,int> res=self->getDtIt();
2124 PyObject *elt=PyTuple_New(2);
2125 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
2126 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
2130 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
2132 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
2135 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
2137 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
2140 bool changeMeshNames(PyObject *li)
2142 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2143 return self->changeMeshNames(modifTab);
2146 PyObject *getTypesOfFieldAvailable() const
2148 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
2149 PyObject *ret2=PyList_New(ret.size());
2150 for(int i=0;i<(int)ret.size();i++)
2151 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
2155 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
2157 std::vector<int> ret1;
2158 int ret0=self->getNonEmptyLevels(mname,ret1);
2159 PyObject *elt=PyTuple_New(2);
2160 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2161 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2165 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
2167 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2168 std::vector< std::vector<TypeOfField> > typesF;
2169 std::vector< std::vector<std::string> > pfls;
2170 std::vector< std::vector<std::string> > locs;
2171 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
2172 std::size_t sz=ret.size();
2173 PyObject *ret2=PyList_New(sz);
2174 for(std::size_t i=0;i<sz;i++)
2176 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2177 const std::vector<TypeOfField>& typesFI=typesF[i];
2178 const std::vector<std::string>& pflsI=pfls[i];
2179 const std::vector<std::string>& locsI=locs[i];
2180 PyObject *elt=PyTuple_New(2);
2181 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2182 std::size_t sz2=ret[i].size();
2183 PyObject *elt2=PyList_New(sz2);
2184 for(std::size_t j=0;j<sz2;j++)
2186 PyObject *elt3=PyTuple_New(4);
2187 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2188 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2189 PyTuple_SetItem(elt3,1,elt4);
2190 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2191 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2192 PyList_SetItem(elt2,j,elt3);
2194 PyTuple_SetItem(elt,1,elt2);
2195 PyList_SetItem(ret2,i,elt);
2200 PyObject *splitComponents() const
2202 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
2203 std::size_t sz=ret.size();
2204 PyObject *retPy=PyList_New(sz);
2205 for(std::size_t i=0;i<sz;i++)
2206 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2210 PyObject *splitDiscretizations() const
2212 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
2213 std::size_t sz=ret.size();
2214 PyObject *retPy=PyList_New(sz);
2215 for(std::size_t i=0;i<sz;i++)
2216 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2220 PyObject *splitMultiDiscrPerGeoTypes() const
2222 std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
2223 std::size_t sz=ret.size();
2224 PyObject *retPy=PyList_New(sz);
2225 for(std::size_t i=0;i<sz;i++)
2226 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2230 MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2232 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2233 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2234 return self->extractPart(extractDefCpp,mm);
2239 class MEDFileField1TS : public MEDFileAnyTypeField1TS
2242 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2243 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2244 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
2245 static MEDFileField1TS *New(DataArrayByte *db);
2246 static MEDFileField1TS *New();
2247 MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
2248 void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
2249 MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
2250 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2251 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2252 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2253 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2254 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2256 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2257 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2258 void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2259 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
2260 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
2263 MEDFileField1TS(const std::string& fileName, bool loadAll=true)
2265 return MEDFileField1TS::New(fileName,loadAll);
2268 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2270 return MEDFileField1TS::New(fileName,fieldName,loadAll);
2273 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2275 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
2278 MEDFileField1TS(DataArrayByte *db)
2280 return MEDFileField1TS::New(db);
2285 return MEDFileField1TS::New();
2288 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
2290 const DataArrayDouble *arr=0;
2292 arr=field->getArray();
2293 self->copyTinyInfoFrom(field,arr);
2296 std::string __str__() const
2298 return self->simpleRepr();
2301 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2303 return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
2306 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
2308 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2309 std::vector< std::vector<TypeOfField> > typesF;
2310 std::vector< std::vector<std::string> > pfls;
2311 std::vector< std::vector<std::string> > locs;
2312 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
2313 std::size_t sz=ret.size();
2314 PyObject *ret2=PyList_New(sz);
2315 for(std::size_t i=0;i<sz;i++)
2317 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2318 const std::vector<TypeOfField>& typesFI=typesF[i];
2319 const std::vector<std::string>& pflsI=pfls[i];
2320 const std::vector<std::string>& locsI=locs[i];
2321 PyObject *elt=PyTuple_New(2);
2322 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2323 std::size_t sz2=ret[i].size();
2324 PyObject *elt2=PyList_New(sz2);
2325 for(std::size_t j=0;j<sz2;j++)
2327 PyObject *elt3=PyTuple_New(4);
2328 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2329 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2330 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2331 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2332 PyList_SetItem(elt2,j,elt3);
2334 PyTuple_SetItem(elt,1,elt2);
2335 PyList_SetItem(ret2,i,elt);
2340 DataArrayDouble *getUndergroundDataArray() const
2342 DataArrayDouble *ret=self->getUndergroundDataArray();
2348 PyObject *getUndergroundDataArrayExt() const
2350 return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
2355 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
2358 static MEDFileIntField1TS *New();
2359 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
2360 static MEDFileIntField1TS *New(DataArrayByte *db);
2361 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2362 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2363 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2365 void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
2366 void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2367 void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2368 void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
2369 MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
2370 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2371 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2372 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2373 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2374 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2377 MEDFileIntField1TS()
2379 return MEDFileIntField1TS::New();
2382 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
2384 return MEDFileIntField1TS::New(fileName,loadAll);
2387 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2389 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
2392 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2394 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
2397 MEDFileIntField1TS(DataArrayByte *db)
2399 return MEDFileIntField1TS::New(db);
2402 std::string __str__() const
2404 return self->simpleRepr();
2407 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2409 return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
2412 DataArrayInt32 *getUndergroundDataArray() const
2414 DataArrayInt32 *ret=self->getUndergroundDataArray();
2420 PyObject *getUndergroundDataArrayExt() const
2422 return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
2427 class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
2430 static MEDFileFloatField1TS *New();
2431 static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
2432 static MEDFileFloatField1TS *New(DataArrayByte *db);
2433 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2434 static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
2435 MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
2437 void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
2438 void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2439 void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2440 void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
2441 MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
2442 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
2443 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
2444 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2445 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
2446 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2449 MEDFileFloatField1TS()
2451 return MEDFileFloatField1TS::New();
2454 MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
2456 return MEDFileFloatField1TS::New(fileName,loadAll);
2459 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2461 return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
2464 MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
2466 return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
2469 MEDFileFloatField1TS(DataArrayByte *db)
2471 return MEDFileFloatField1TS::New(db);
2474 std::string __str__() const
2476 return self->simpleRepr();
2479 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
2481 return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
2484 DataArrayFloat *getUndergroundDataArray() const
2486 DataArrayFloat *ret=self->getUndergroundDataArray();
2492 PyObject *getUndergroundDataArrayExt() const
2494 return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
2499 class MEDFileAnyTypeFieldMultiTSIterator
2506 MEDFileAnyTypeField1TS *ret=self->nextt();
2508 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
2511 PyErr_SetString(PyExc_StopIteration,"No more data.");
2518 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
2521 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2522 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2523 MEDFileAnyTypeFieldMultiTS *deepCopy() const;
2524 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
2525 std::string getName() const;
2526 void setName(const std::string& name);
2527 std::string getDtUnit() const;
2528 void setDtUnit(const std::string& dtUnit);
2529 std::string getMeshName() const;
2530 void setMeshName(const std::string& newMeshName);
2531 const std::vector<std::string>& getInfo() const;
2532 bool presenceOfMultiDiscPerGeoType() const;
2533 int getNumberOfComponents() const;
2534 int getNumberOfTS() const;
2535 void eraseEmptyTS();
2536 int getPosOfTimeStep(int iteration, int order) const;
2537 int getPosGivenTime(double time, double eps=1e-8) const;
2539 void loadArraysIfNecessary();
2540 void unloadArrays();
2541 void unloadArraysWithoutDataLoss();
2543 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
2544 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
2545 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
2546 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
2547 void synchronizeNameScope();
2548 MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
2553 return self->getNumberOfTS();
2556 int getTimeId(PyObject *elt0) const
2558 if(elt0 && PyInt_Check(elt0))
2560 int pos=(int)PyInt_AS_LONG(elt0);
2563 else if(elt0 && PyTuple_Check(elt0))
2565 if(PyTuple_Size(elt0)==2)
2567 PyObject *o0=PyTuple_GetItem(elt0,0);
2568 PyObject *o1=PyTuple_GetItem(elt0,1);
2569 if(PyInt_Check(o0) && PyInt_Check(o1))
2571 int iter=(int)PyInt_AS_LONG(o0);
2572 int order=(int)PyInt_AS_LONG(o1);
2573 return self->getPosOfTimeStep(iter,order);
2576 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 !");
2579 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 !");
2581 else if(elt0 && PyFloat_Check(elt0))
2583 double val=PyFloat_AS_DOUBLE(elt0);
2584 return self->getPosGivenTime(val);
2587 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2590 PyObject *getIterations() const
2592 std::vector< std::pair<int,int> > res(self->getIterations());
2593 return convertVecPairIntToPy(res);
2596 PyObject *getTimeSteps() const
2598 std::vector<double> ret1;
2599 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
2600 std::size_t sz=ret.size();
2601 PyObject *ret2=PyList_New(sz);
2602 for(std::size_t i=0;i<sz;i++)
2604 PyObject *elt=PyTuple_New(3);
2605 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
2606 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
2607 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
2608 PyList_SetItem(ret2,i,elt);
2613 PyObject *getTypesOfFieldAvailable() const
2615 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
2616 PyObject *ret2=PyList_New(ret.size());
2617 for(int i=0;i<(int)ret.size();i++)
2619 const std::vector<TypeOfField>& rett=ret[i];
2620 PyObject *ret3=PyList_New(rett.size());
2621 for(int j=0;j<(int)rett.size();j++)
2622 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
2623 PyList_SetItem(ret2,i,ret3);
2628 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
2630 std::vector<int> ret1;
2631 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
2632 PyObject *elt=PyTuple_New(2);
2633 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
2634 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
2638 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
2640 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2641 std::vector< std::vector<TypeOfField> > typesF;
2642 std::vector< std::vector<std::string> > pfls;
2643 std::vector< std::vector<std::string> > locs;
2644 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
2645 std::size_t sz=ret.size();
2646 PyObject *ret2=PyList_New(sz);
2647 for(std::size_t i=0;i<sz;i++)
2649 const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
2650 const std::vector<TypeOfField>& typesFI=typesF[i];
2651 const std::vector<std::string>& pflsI=pfls[i];
2652 const std::vector<std::string>& locsI=locs[i];
2653 PyObject *elt=PyTuple_New(2);
2654 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2655 std::size_t sz2=ret[i].size();
2656 PyObject *elt2=PyList_New(sz2);
2657 for(std::size_t j=0;j<sz2;j++)
2659 PyObject *elt3=PyTuple_New(4);
2660 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2661 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
2662 PyTuple_SetItem(elt3,1,elt4);
2663 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2664 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2665 PyList_SetItem(elt2,j,elt3);
2667 PyTuple_SetItem(elt,1,elt2);
2668 PyList_SetItem(ret2,i,elt);
2673 std::vector<int> getTimeIds(PyObject *elts) const
2675 if(PyList_Check(elts))
2677 std::size_t sz=PyList_Size(elts);
2678 std::vector<int> ret(sz);
2679 for(std::size_t i=0;i<sz;i++)
2681 PyObject *elt=PyList_GetItem(elts,i);
2682 ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
2688 std::vector<int> ret(1);
2689 ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
2694 void __delitem__(PyObject *elts)
2696 if(PySlice_Check(elts))
2698 Py_ssize_t strt=2,stp=2,step=2;
2699 GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
2700 self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
2704 std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
2705 if(!idsToRemove.empty())
2706 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2710 void eraseTimeStepIds(PyObject *li)
2714 std::vector<int> pos2;
2715 DataArrayInt32 *pos3=0;
2716 DataArrayIntTuple *pos4=0;
2717 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2722 self->eraseTimeStepIds(&pos1,&pos1+1);
2729 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2734 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2738 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2742 MEDFileAnyTypeFieldMultiTSIterator *__iter__()
2744 return self->iterator();
2747 PyObject *__getitem__(PyObject *elt0) const
2749 if(elt0 && PyList_Check(elt0))
2751 std::size_t sz=PyList_Size(elt0);
2752 MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
2753 int *pt=da->getPointer();
2754 for(std::size_t i=0;i<sz;i++,pt++)
2756 PyObject *elt1=PyList_GetItem(elt0,i);
2757 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2759 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2761 else if(elt0 && PySlice_Check(elt0))
2763 Py_ssize_t strt=2,stp=2,step=2;
2764 GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2765 return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
2768 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2771 bool changeMeshNames(PyObject *li)
2773 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2774 return self->changeMeshNames(modifTab);
2777 PyObject *splitComponents() const
2779 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2780 std::size_t sz=ret.size();
2781 PyObject *retPy=PyList_New(sz);
2782 for(std::size_t i=0;i<sz;i++)
2783 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2787 PyObject *splitDiscretizations() const
2789 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2790 std::size_t sz=ret.size();
2791 PyObject *retPy=PyList_New(sz);
2792 for(std::size_t i=0;i<sz;i++)
2793 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2797 PyObject *splitMultiDiscrPerGeoTypes() const
2799 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2800 std::size_t sz=ret.size();
2801 PyObject *retPy=PyList_New(sz);
2802 for(std::size_t i=0;i<sz;i++)
2803 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2807 void pushBackTimeSteps(PyObject *li)
2810 int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
2811 if(SWIG_IsOK(status))
2813 self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2817 std::vector<MEDFileAnyTypeField1TS *> tmp;
2818 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2819 self->pushBackTimeSteps(tmp);
2823 MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
2825 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
2826 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
2827 return self->extractPart(extractDefCpp,mm);
2830 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
2832 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2833 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2834 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2835 std::size_t sz=ret.size();
2836 PyObject *retPy=PyList_New(sz);
2837 for(std::size_t i=0;i<sz;i++)
2839 std::size_t sz2=ret[i].size();
2840 PyObject *ret1Py=PyList_New(sz2);
2841 for(std::size_t j=0;j<sz2;j++)
2843 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2846 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2848 PyList_SetItem(retPy,i,ret1Py);
2853 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
2855 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2856 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2857 std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
2858 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2859 if(ret2.size()!=ret.size())
2861 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2862 throw INTERP_KERNEL::Exception(oss.str().c_str());
2864 std::size_t sz=ret.size();
2865 PyObject *retPy=PyList_New(sz);
2866 for(std::size_t i=0;i<sz;i++)
2868 std::size_t sz2=ret[i].size();
2869 PyObject *ret0Py=PyTuple_New(2);
2870 PyObject *ret1Py=PyList_New(sz2);
2871 for(std::size_t j=0;j<sz2;j++)
2873 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2876 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2878 PyTuple_SetItem(ret0Py,0,ret1Py);
2879 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2880 PyList_SetItem(retPy,i,ret0Py);
2887 class MEDFileIntFieldMultiTS;
2889 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2892 static MEDFileFieldMultiTS *New();
2893 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
2894 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
2895 static MEDFileFieldMultiTS *New(DataArrayByte *db);
2897 MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
2898 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
2899 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
2900 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
2901 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
2902 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
2904 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
2905 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
2906 MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
2909 MEDFileFieldMultiTS()
2911 return MEDFileFieldMultiTS::New();
2914 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true)
2916 return MEDFileFieldMultiTS::New(fileName,loadAll);
2919 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
2921 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2924 MEDFileFieldMultiTS(DataArrayByte *db)
2926 return MEDFileFieldMultiTS::New(db);
2929 static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2931 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2932 std::size_t sz(tmp.size());
2933 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2934 for(std::size_t i=0;i<sz;i++)
2936 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2937 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2939 return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2942 std::string __str__() const
2944 return self->simpleRepr();
2947 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
2949 DataArrayIdType *ret1=0;
2950 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2951 PyObject *ret=PyTuple_New(2);
2952 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2957 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const
2959 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2960 std::vector< std::vector<TypeOfField> > typesF;
2961 std::vector< std::vector<std::string> > pfls;
2962 std::vector< std::vector<std::string> > locs;
2963 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2964 std::size_t sz=ret.size();
2965 PyObject *ret2=PyList_New(sz);
2966 for(std::size_t i=0;i<sz;i++)
2968 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2969 const std::vector<TypeOfField>& typesFI=typesF[i];
2970 const std::vector<std::string>& pflsI=pfls[i];
2971 const std::vector<std::string>& locsI=locs[i];
2972 PyObject *elt=PyTuple_New(2);
2973 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2974 std::size_t sz2=ret[i].size();
2975 PyObject *elt2=PyList_New(sz2);
2976 for(std::size_t j=0;j<sz2;j++)
2978 PyObject *elt3=PyTuple_New(4);
2979 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2980 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2981 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2982 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2983 PyList_SetItem(elt2,j,elt3);
2985 PyTuple_SetItem(elt,1,elt2);
2986 PyList_SetItem(ret2,i,elt);
2990 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const
2992 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2998 PyObject *getUndergroundDataArrayExt(int iteration, int order) const
3000 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
3001 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
3004 PyObject *ret=PyTuple_New(2);
3005 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3006 std::size_t sz=elt1Cpp.size();
3007 PyObject *elt=PyList_New(sz);
3008 for(std::size_t i=0;i<sz;i++)
3010 PyObject *elt1=PyTuple_New(2);
3011 PyObject *elt2=PyTuple_New(2);
3012 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
3013 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
3014 PyObject *elt3=PyTuple_New(2);
3015 PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
3016 PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
3017 PyTuple_SetItem(elt1,0,elt2);
3018 PyTuple_SetItem(elt1,1,elt3);
3019 PyList_SetItem(elt,i,elt1);
3021 PyTuple_SetItem(ret,1,elt);
3027 class MEDFileFieldsIterator
3034 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
3036 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
3039 PyErr_SetString(PyExc_StopIteration,"No more data.");
3046 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3049 static MEDFileIntFieldMultiTS *New();
3050 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3051 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3052 static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
3054 void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
3055 void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3056 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3057 MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
3058 MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3059 MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3060 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3061 MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3062 MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3065 MEDFileIntFieldMultiTS()
3067 return MEDFileIntFieldMultiTS::New();
3070 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true)
3072 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
3075 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3077 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
3080 MEDFileIntFieldMultiTS(DataArrayByte *db)
3082 return MEDFileIntFieldMultiTS::New(db);
3085 static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3087 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3088 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3089 return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3092 std::string __str__() const
3094 return self->simpleRepr();
3097 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3099 DataArrayIdType *ret1=0;
3100 DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3101 PyObject *ret=PyTuple_New(2);
3102 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
3103 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3107 DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
3109 DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
3117 class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
3120 static MEDFileFloatFieldMultiTS *New();
3121 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
3122 static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
3123 static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
3125 void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
3126 void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
3127 MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
3128 MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
3129 MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
3130 MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
3131 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
3132 MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
3133 MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
3136 MEDFileFloatFieldMultiTS()
3138 return MEDFileFloatFieldMultiTS::New();
3141 MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true)
3143 return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
3146 MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
3148 return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
3151 MEDFileFloatFieldMultiTS(DataArrayByte *db)
3153 return MEDFileFloatFieldMultiTS::New(db);
3156 static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
3158 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3159 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
3160 return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
3163 std::string __str__() const
3165 return self->simpleRepr();
3168 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
3170 DataArrayIdType *ret1=0;
3171 DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
3172 PyObject *ret=PyTuple_New(2);
3173 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
3174 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3178 DataArrayFloat *getUndergroundDataArray(int iteration, int order) const
3180 DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
3188 class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
3191 static MEDFileMeshSupports *New(const std::string& fileName);
3192 std::vector<std::string> getSupMeshNames() const;
3195 MEDFileUMesh *getSupMeshWithName(const std::string& name) const
3197 const MEDFileUMesh *ret(self->getSupMeshWithName(name));
3198 MEDFileUMesh *ret2(const_cast<MEDFileUMesh *>(ret));
3206 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
3209 static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
3211 MEDFileStructureElements();
3214 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
3217 static MEDFileFields *New();
3218 static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
3219 static MEDFileFields *New(DataArrayByte *db);
3220 static MEDFileFields *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities);
3221 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
3222 static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
3223 MEDFileFields *deepCopy() const;
3224 MEDFileFields *shallowCpy() const;
3226 void loadArraysIfNecessary();
3227 void unloadArrays();
3228 void unloadArraysWithoutDataLoss();
3229 int getNumberOfFields() const;
3230 std::vector<std::string> getFieldsNames() const;
3231 std::vector<std::string> getMeshesNames() const;
3233 void resize(int newSize);
3234 void pushField(MEDFileAnyTypeFieldMultiTS *field);
3235 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
3236 int getPosFromFieldName(const std::string& fieldName) const;
3237 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
3238 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
3239 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
3240 bool presenceOfStructureElements() const;
3241 void aggregate(const MEDFileFields& other);
3242 void killStructureElements();
3243 void keepOnlyStructureElements();
3244 void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName);
3245 void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses);
3246 void destroyFieldAtPos(int i);
3247 bool removeFieldsWithoutAnyTimeStep();
3252 return MEDFileFields::New();
3255 MEDFileFields(const std::string& fileName, bool loadAll=true)
3257 return MEDFileFields::New(fileName,loadAll);
3260 MEDFileFields(DataArrayByte *db)
3262 return MEDFileFields::New(db);
3265 MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
3267 return MEDFileFields::NewAdv(fileName,loadAll,entities);
3270 std::string __str__() const
3272 return self->simpleRepr();
3275 MEDFileFields *partOfThisOnStructureElements() const
3277 MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
3281 MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
3283 MCAuto<MEDFileFields> ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName));
3287 static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true)
3289 std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
3290 std::size_t sz(tmp.size());
3291 std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
3292 for(std::size_t i=0;i<sz;i++)
3294 entitiesCpp[i].first=(TypeOfField)tmp[i].first;
3295 entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
3297 return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
3300 PyObject *getMeshSENames() const
3302 std::vector< std::pair<std::string,std::string> > ps;
3303 self->getMeshSENames(ps);
3304 return convertVectPairStToPy(ps);
3307 PyObject *getCommonIterations() const
3310 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
3311 PyObject *ret=PyTuple_New(2);
3312 PyObject *ret_0=PyList_New(ret0.size());
3314 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
3316 PyObject *elt=PyTuple_New(2);
3317 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3318 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3319 PyList_SetItem(ret_0,rk,elt);
3321 PyTuple_SetItem(ret,0,ret_0);
3322 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
3323 PyTuple_SetItem(ret,1,ret_1);
3327 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3329 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3330 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
3333 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const
3335 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
3336 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
3339 PyObject *__getitem__(PyObject *obj)
3341 if(obj && PyList_Check(obj))
3343 std::size_t sz=PyList_Size(obj);
3344 MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
3345 int *pt=da->getPointer();
3346 for(std::size_t i=0;i<sz;i++,pt++)
3348 PyObject *elt1=PyList_GetItem(obj,i);
3349 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
3351 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_MEDCoupling__MEDFileFields, SWIG_POINTER_OWN | 0 );
3354 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
3357 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field)
3359 self->setFieldAtPos(obj,field);
3365 return self->getNumberOfFields();
3368 MEDFileFieldsIterator *__iter__()
3370 return self->iterator();
3373 bool changeMeshNames(PyObject *li)
3375 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3376 return self->changeMeshNames(modifTab);
3379 int getPosOfField(PyObject *elt0) const
3381 static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
3383 throw INTERP_KERNEL::Exception(msg);
3384 if(PyInt_Check(elt0))
3386 return (int)PyInt_AS_LONG(elt0);
3388 return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
3391 std::vector<int> getPosOfFields(PyObject *elts) const
3393 if(PyList_Check(elts))
3395 std::size_t sz=PyList_Size(elts);
3396 std::vector<int> ret(sz);
3397 for(std::size_t i=0;i<sz;i++)
3399 PyObject *elt=PyList_GetItem(elts,i);
3400 ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
3406 std::vector<int> ret(1);
3407 ret[0]=MEDCoupling_MEDFileFields_getPosOfField(self,elts);
3412 void pushFields(PyObject *fields)
3414 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
3415 convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
3416 self->pushFields(tmp);
3419 void __delitem__(PyObject *elts)
3421 if(elts && PySlice_Check(elts))
3423 Py_ssize_t strt=2,stp=2,step=2;
3424 GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
3425 self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
3429 std::vector<int> idsToRemove=MEDCoupling_MEDFileFields_getPosOfFields(self,elts);
3430 if(!idsToRemove.empty())
3431 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3435 MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
3437 std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
3438 convertToMapIntDataArrayInt(extractDef,extractDefCpp);
3439 return self->extractPart(extractDefCpp,mm);
3442 MEDFileFields *linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
3444 MCAuto<MEDFileFields> ret(self->linearToQuadratic(oldLin,newQuad));
3450 class MEDFileParameter1TS : public RefCountObject
3453 void setIteration(int it);
3454 int getIteration() const;
3455 void setOrder(int order);
3456 int getOrder() const;
3457 void setTimeValue(double time);
3458 void setTime(int dt, int it, double time);
3459 double getTime(int& dt, int& it);
3460 double getTimeValue() const;
3463 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
3466 void setValue(double val);
3467 double getValue() const;
3468 std::string simpleRepr() const;
3471 std::string __str__() const
3473 return self->simpleRepr();
3478 class MEDFileParameterTinyInfo : public MEDFileWritable
3481 void setDescription(const std::string& name);
3482 std::string getDescription() const;
3483 void setTimeUnit(const std::string& unit);
3484 std::string getTimeUnit() const;
3487 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
3490 static MEDFileParameterDouble1TS *New();
3491 static MEDFileParameterDouble1TS *New(const std::string& fileName);
3492 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
3493 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
3494 virtual MEDFileParameter1TS *deepCopy() const;
3495 virtual std::string simpleRepr() const;
3496 void setName(const std::string& name);
3497 std::string getName() const;
3498 void write(const std::string& fileName, int mode) const;
3501 MEDFileParameterDouble1TS()
3503 return MEDFileParameterDouble1TS::New();
3506 MEDFileParameterDouble1TS(const std::string& fileName)
3508 return MEDFileParameterDouble1TS::New(fileName);
3511 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
3513 return MEDFileParameterDouble1TS::New(fileName,paramName);
3516 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
3518 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
3521 std::string __str__() const
3523 return self->simpleRepr();
3526 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
3529 bool ret0=self->isEqual(other,eps,what);
3530 PyObject *res=PyList_New(2);
3531 PyObject *ret0Py=ret0?Py_True:Py_False;
3533 PyList_SetItem(res,0,ret0Py);
3534 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3540 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
3543 static MEDFileParameterMultiTS *New();
3544 static MEDFileParameterMultiTS *New(const std::string& fileName);
3545 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
3546 std::string getName() const;
3547 void setName(const std::string& name);
3548 MEDFileParameterMultiTS *deepCopy() const;
3549 void write(const std::string& fileName, int mode) const;
3550 std::string simpleRepr() const;
3551 void appendValue(int dt, int it, double time, double val);
3552 double getDoubleValue(int iteration, int order) const;
3553 int getPosOfTimeStep(int iteration, int order) const;
3554 int getPosGivenTime(double time, double eps=1e-8) const;
3555 int getNumberOfTS() const;
3558 MEDFileParameterMultiTS()
3560 return MEDFileParameterMultiTS::New();
3563 MEDFileParameterMultiTS(const std::string& fileName)
3565 return MEDFileParameterMultiTS::New(fileName);
3568 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
3570 return MEDFileParameterMultiTS::New(fileName,paramName);
3573 std::string __str__() const
3575 return self->simpleRepr();
3578 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
3581 bool ret0=self->isEqual(other,eps,what);
3582 PyObject *res=PyList_New(2);
3583 PyObject *ret0Py=ret0?Py_True:Py_False;
3585 PyList_SetItem(res,0,ret0Py);
3586 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3590 void eraseTimeStepIds(PyObject *ids)
3594 std::vector<int> pos2;
3595 DataArrayInt *pos3=0;
3596 DataArrayIntTuple *pos4=0;
3597 convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
3602 self->eraseTimeStepIds(&pos1,&pos1+1);
3609 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
3614 self->eraseTimeStepIds(pos3->begin(),pos3->end());
3618 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
3622 int getTimeStepId(PyObject *elt0) const
3624 if(elt0 && PyInt_Check(elt0))
3626 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
3629 else if(elt0 && PyTuple_Check(elt0))
3631 if(PyTuple_Size(elt0)==2)
3633 PyObject *o0=PyTuple_GetItem(elt0,0);
3634 PyObject *o1=PyTuple_GetItem(elt0,1);
3635 if(PyInt_Check(o0) && PyInt_Check(o1))
3637 int iter=(int)PyInt_AS_LONG(o0);
3638 int order=(int)PyInt_AS_LONG(o1);
3639 return self->getPosOfTimeStep(iter,order);
3642 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 !");
3645 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 !");
3647 else if(elt0 && PyFloat_Check(elt0))
3649 double val=PyFloat_AS_DOUBLE(elt0);
3650 return self->getPosGivenTime(val);
3653 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
3656 MEDFileParameter1TS *__getitem__(PyObject *elt0) const
3658 MEDFileParameter1TS *ret=self->getTimeStepAtPos(MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
3664 std::vector<int> getTimeStepIds(PyObject *elts) const
3666 if(PyList_Check(elts))
3668 std::size_t sz=PyList_Size(elts);
3669 std::vector<int> ret(sz);
3670 for(std::size_t i=0;i<sz;i++)
3672 PyObject *elt=PyList_GetItem(elts,i);
3673 ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
3679 std::vector<int> ret(1);
3680 ret[0]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elts);
3685 void __delitem__(PyObject *elts)
3687 std::vector<int> idsToRemove=MEDCoupling_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
3688 if(!idsToRemove.empty())
3689 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
3692 MEDFileParameter1TS *getTimeStepAtPos(int posId) const
3694 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
3700 PyObject *getIterations() const
3702 std::vector< std::pair<int,int> > res=self->getIterations();
3703 PyObject *ret=PyList_New(res.size());
3705 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3707 PyObject *elt=PyTuple_New(2);
3708 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3709 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3710 PyList_SetItem(ret,rk,elt);
3715 PyObject *getTimeSteps() const
3717 std::vector<double> res2;
3718 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
3719 PyObject *ret=PyList_New(res.size());
3721 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
3723 PyObject *elt=PyTuple_New(3);
3724 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
3725 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
3726 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
3727 PyList_SetItem(ret,rk,elt);
3734 class MEDFileParameters : public RefCountObject, public MEDFileWritableStandAlone
3737 static MEDFileParameters *New();
3738 static MEDFileParameters *New(const std::string& fileName);
3739 static MEDFileParameters *New(DataArrayByte *db);
3740 MEDFileParameters *deepCopy() const;
3741 std::vector<std::string> getParamsNames() const;
3742 std::string simpleRepr() const;
3743 void resize(int newSize);
3744 void pushParam(MEDFileParameterMultiTS *param);
3745 void setParamAtPos(int i, MEDFileParameterMultiTS *param);
3746 void destroyParamAtPos(int i);
3747 int getPosFromParamName(const std::string& paramName) const;
3748 int getNumberOfParams() const;
3753 return MEDFileParameters::New();
3756 MEDFileParameters(const std::string& fileName)
3758 return MEDFileParameters::New(fileName);
3761 MEDFileParameters(DataArrayByte *db)
3763 return MEDFileParameters::New(db);
3766 std::string __str__() const
3768 return self->simpleRepr();
3771 MEDFileParameterMultiTS *__getitem__(PyObject *obj)
3773 static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
3774 if(PyInt_Check(obj))
3776 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
3781 MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
3789 return self->getNumberOfParams();
3792 MEDFileParameterMultiTS *getParamAtPos(int i) const
3794 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
3800 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const
3802 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
3808 PyObject *isEqual(const MEDFileParameters *other, double eps) const
3811 bool ret0=self->isEqual(other,eps,what);
3812 PyObject *res=PyList_New(2);
3813 PyObject *ret0Py=ret0?Py_True:Py_False;
3815 PyList_SetItem(res,0,ret0Py);
3816 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
3822 class MEDFileData : public RefCountObject, public MEDFileWritableStandAlone
3825 static MEDFileData *New(DataArrayByte *db);
3826 static MEDFileData *New(const std::string& fileName);
3827 static MEDFileData *New();
3828 MEDFileData *deepCopy() const;
3829 void setFields(MEDFileFields *fields);
3830 void setMeshes(MEDFileMeshes *meshes);
3831 void setParams(MEDFileParameters *params);
3832 int getNumberOfFields() const;
3833 int getNumberOfMeshes() const;
3834 int getNumberOfParams() const;
3836 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
3837 bool unPolyzeMeshes();
3838 void dealWithStructureElements();
3839 std::string getHeader() const;
3840 void setHeader(const std::string& header);
3844 MEDFileData(const std::string& fileName)
3846 return MEDFileData::New(fileName);
3849 MEDFileData(DataArrayByte *db)
3851 return MEDFileData::New(db);
3856 return MEDFileData::New();
3859 std::string __str__() const
3861 return self->simpleRepr();
3864 MEDFileMeshes *getMeshes() const
3866 MEDFileMeshes *ret=self->getMeshes();
3872 MEDFileParameters *getParams() const
3874 MEDFileParameters *ret=self->getParams();
3880 MEDFileFields *getFields() const
3882 MEDFileFields *ret=self->getFields();
3888 bool changeMeshNames(PyObject *li)
3890 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3891 return self->changeMeshNames(modifTab);
3894 static MEDFileData *Aggregate(PyObject *mfds)
3896 std::vector<const MEDFileData *> mfdsCpp;
3897 convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileData *>(mfds,SWIGTYPE_p_MEDCoupling__MEDFileData,"MEDFileData",mfdsCpp);
3898 MCAuto<MEDFileData> ret(MEDFileData::Aggregate(mfdsCpp));
3904 class SauvReader : public RefCountObject
3907 static SauvReader* New(const std::string& fileName);
3908 MEDFileData * loadInMEDFileDS();
3911 SauvReader(const std::string& fileName)
3913 return SauvReader::New(fileName);
3918 class SauvWriter : public RefCountObject
3921 static SauvWriter * New();
3922 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
3923 void write(const std::string& fileName);
3924 void setCpyGrpIfOnASingleFamilyStatus(bool status);
3925 bool getCpyGrpIfOnASingleFamilyStatus() const;
3930 return SauvWriter::New();
3937 class MEDFileMeshStruct;
3939 class MEDFileField1TSStructItem
3942 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
3945 class MEDFileMeshStruct : public RefCountObject
3948 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
3950 ~MEDFileMeshStruct();
3953 class MEDMeshMultiLev : public RefCountObject
3956 virtual MEDMeshMultiLev *prepare() const;
3957 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
3958 DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
3964 PyObject *retrieveFamilyIdsOnCells() const
3966 DataArrayIdType *famIds(0);
3967 bool isWithoutCopy(false);
3968 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3969 PyObject *ret=PyTuple_New(2);
3970 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3972 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3973 PyTuple_SetItem(ret,1,ret1Py);
3977 PyObject *retrieveNumberIdsOnCells() const
3979 DataArrayIdType *numIds(0);
3980 bool isWithoutCopy(false);
3981 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3982 PyObject *ret=PyTuple_New(2);
3983 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3985 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3986 PyTuple_SetItem(ret,1,ret1Py);
3990 PyObject *retrieveFamilyIdsOnNodes() const
3992 DataArrayIdType *famIds(0);
3993 bool isWithoutCopy(false);
3994 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3995 PyObject *ret=PyTuple_New(2);
3996 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3998 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3999 PyTuple_SetItem(ret,1,ret1Py);
4003 PyObject *retrieveNumberIdsOnNodes() const
4005 DataArrayIdType *numIds(0);
4006 bool isWithoutCopy(false);
4007 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
4008 PyObject *ret=PyTuple_New(2);
4009 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
4011 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4012 PyTuple_SetItem(ret,1,ret1Py);
4016 PyObject *getGeoTypes() const
4018 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
4019 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4020 PyObject *res(PyList_New(result.size()));
4021 for(int i=0;iL!=result.end(); i++, iL++)
4022 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4028 class MEDUMeshMultiLev : public MEDMeshMultiLev
4031 ~MEDUMeshMultiLev();
4035 PyObject *buildVTUArrays() const
4037 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
4038 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
4039 PyObject *ret0Py=ncc?Py_True:Py_False;
4041 PyObject *ret=PyTuple_New(7);
4042 PyTuple_SetItem(ret,0,ret0Py);
4043 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4044 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
4045 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4046 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4047 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4048 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4054 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
4057 ~MEDStructuredMeshMultiLev();
4060 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
4063 ~MEDCMeshMultiLev();
4067 PyObject *buildVTUArrays() const
4070 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
4071 std::size_t sz(objs.size());
4072 PyObject *ret(PyTuple_New(2));
4073 PyObject *ret0=PyList_New(sz);
4074 for(std::size_t i=0;i<sz;i++)
4075 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4076 PyTuple_SetItem(ret,0,ret0);
4077 PyObject *ret1Py(isInternal?Py_True:Py_False);
4079 PyTuple_SetItem(ret,1,ret1Py);
4085 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
4088 ~MEDCurveLinearMeshMultiLev();
4092 PyObject *buildVTUArrays() const
4094 DataArrayDouble *ret0(0);
4095 std::vector<mcIdType> ret1;
4097 self->buildVTUArrays(ret0,ret1,ret2);
4098 std::size_t sz(ret1.size());
4099 PyObject *ret=PyTuple_New(3);
4100 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4101 PyObject *ret1Py=PyList_New(sz);
4102 for(std::size_t i=0;i<sz;i++)
4103 PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
4104 PyTuple_SetItem(ret,1,ret1Py);
4105 PyObject *ret2Py(ret2?Py_True:Py_False);
4107 PyTuple_SetItem(ret,2,ret2Py);
4113 class MEDFileFastCellSupportComparator : public RefCountObject
4116 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
4117 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4118 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
4119 int getNumberOfTS() const;
4121 ~MEDFileFastCellSupportComparator();
4125 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
4127 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
4128 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
4129 PyObject *res(PyList_New(result.size()));
4130 for(int i=0;iL!=result.end(); i++, iL++)
4131 PyList_SetItem(res,i,PyInt_FromLong(*iL));
4142 def exit1TS(self, exctype, exc, tb):
4145 MEDFileAnyTypeField1TS.__enter__=enter1TS
4146 MEDFileAnyTypeField1TS.__exit__=exit1TS