Salome HOME
Behavior modification for slices in medcoupling and medloader. start==stop==length...
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingCommon.i
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 %module MEDCoupling
22
23 %include std_vector.i
24 %include std_string.i
25
26 %{
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
43
44 #include "InterpKernelAutoPtr.hxx"
45
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
48
49 %}
50
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
54
55 ////////////////////
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
57 {
58   $result=convertMesh($1,$owner);
59 }
60
61 %typemap(out) MEDCouplingMesh*
62 {
63   $result=convertMesh($1,$owner);
64 }
65 //$$$$$$$$$$$$$$$$$$
66
67 ////////////////////
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
69 {
70   $result=convertMesh($1,$owner);
71 }
72
73 %typemap(out) MEDCouplingPointSet*
74 {
75   $result=convertMesh($1,$owner);
76 }
77 //$$$$$$$$$$$$$$$$$$
78
79
80 ////////////////////
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
82 {
83   $result=convertMesh($1,$owner);
84 }
85
86 %typemap(out) MEDCoupling1GTUMesh*
87 {
88   $result=convertMesh($1,$owner);
89 }
90 //$$$$$$$$$$$$$$$$$$
91
92 ////////////////////
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
94 {
95   $result=convertMesh($1,$owner);
96 }
97
98 %typemap(out) MEDCouplingStructuredMesh*
99 {
100   $result=convertMesh($1,$owner);
101 }
102 //$$$$$$$$$$$$$$$$$$
103
104 ////////////////////
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
106 {
107   $result=convertFieldDiscretization($1,$owner);
108 }
109
110 %typemap(out) MEDCouplingFieldDiscretization*
111 {
112   $result=convertFieldDiscretization($1,$owner);
113 }
114 //$$$$$$$$$$$$$$$$$$
115
116 ////////////////////
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
118 {
119   $result=convertMultiFields($1,$owner);
120 }
121
122 %typemap(out) MEDCouplingMultiFields*
123 {
124   $result=convertMultiFields($1,$owner);
125 }
126 //$$$$$$$$$$$$$$$$$$
127
128 #ifdef WITH_NUMPY
129 %init %{ import_array(); %}
130 #endif
131
132 %feature("autodoc", "1");
133 %feature("docstring");
134
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
188 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
189 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
196 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
200 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
202 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
206 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
207 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
208 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
209 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
275 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
276 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
277 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
278 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
279 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
292 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
293 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
296 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
297 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
298 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
299 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
300 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
301 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
302 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
303 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
304 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
305 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
306 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
307
308 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
309 %feature("unref") MEDCouplingMesh "$this->decrRef();"
310 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
311 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
312 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
313 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
314 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
315 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
316 %feature("unref") MEDCouplingField "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
318 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
323 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
325 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
326
327 %rename(assign) *::operator=;
328 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
329 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
330 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
331 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
332
333 %nodefaultctor;
334
335 %rename (InterpKernelException) INTERP_KERNEL::Exception;
336
337 %include "MEDCouplingRefCountObject.i"
338 %include "MEDCouplingMemArray.i"
339
340 namespace ParaMEDMEM
341 {
342   typedef enum
343     {
344       ON_CELLS = 0,
345       ON_NODES = 1,
346       ON_GAUSS_PT = 2,
347       ON_GAUSS_NE = 3,
348       ON_NODES_KR = 4
349     } TypeOfField;
350
351   typedef enum
352     {
353       NO_TIME = 4,
354       ONE_TIME = 5,
355       LINEAR_TIME = 6,
356       CONST_ON_TIME_INTERVAL = 7
357     } TypeOfTimeDiscretization;
358
359   typedef enum
360     {
361       UNSTRUCTURED = 5,
362       CARTESIAN = 7,
363       EXTRUDED = 8,
364       CURVE_LINEAR = 9,
365       SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
366       SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
367     } MEDCouplingMeshType;
368
369   class DataArrayInt;
370   class DataArrayDouble;
371   class MEDCouplingUMesh;
372   class MEDCouplingFieldDouble;
373
374   %extend RefCountObject
375   {
376     std::string getHiddenCppPointer() const
377     {
378       std::ostringstream oss; oss << "C++ Pointer address is : " << self;
379       return oss.str();
380     }
381   }
382
383   %extend MEDCouplingGaussLocalization
384   {
385     std::string __str__() const throw(INTERP_KERNEL::Exception)
386     {
387       return self->getStringRepr();
388     }
389
390     std::string __repr__() const throw(INTERP_KERNEL::Exception)
391     {
392       std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
393       oss << self->getStringRepr();
394       return oss.str();
395     }
396   }
397
398   //== MEDCouplingMesh
399   
400   class MEDCouplingMesh : public RefCountObject, public TimeLabel
401   {
402   public:
403     void setName(const std::string& name);
404     std::string getName() const;
405     void setDescription(const std::string& descr);
406     std::string getDescription() const;
407     void setTime(double val, int iteration, int order);
408     void setTimeUnit(const std::string& unit);
409     std::string getTimeUnit() const;
410     virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
411     bool isStructured() const throw(INTERP_KERNEL::Exception);
412     virtual MEDCouplingMesh *deepCpy() const;
413     virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
414     virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
415     virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
416     virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
417     virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
418     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
419     virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
420     virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
421     virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
422     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
423     virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
424     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
425     virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
426     virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
427     virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
428     virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
429     virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
430     virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
431     virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
432     virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
433     virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
434     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
435     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
436     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
437     void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
438     // tools
439     virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
440     virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
441     virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
442     virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
443     virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
444     virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
445     virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
446     virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
447     virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
448     virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
449     static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
450     static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451     static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
452     static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453     static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
454     static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
455     static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
456     %extend
457        {
458          std::string __str__() const throw(INTERP_KERNEL::Exception)
459          {
460            return self->simpleRepr();
461          }
462
463          PyObject *getTime() throw(INTERP_KERNEL::Exception)
464          {
465            int tmp1,tmp2;
466            double tmp0=self->getTime(tmp1,tmp2);
467            PyObject *res = PyList_New(3);
468            PyList_SetItem(res,0,SWIG_From_double(tmp0));
469            PyList_SetItem(res,1,SWIG_From_int(tmp1));
470            PyList_SetItem(res,2,SWIG_From_int(tmp2));
471            return res;
472          }
473
474          int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
475          {
476            double val;
477            DataArrayDouble *a;
478            DataArrayDoubleTuple *aa;
479            std::vector<double> bb;
480            int sw;
481            int spaceDim=self->getSpaceDimension();
482            const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
483            const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
484            return self->getCellContainingPoint(pos,eps);
485          }
486
487          PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
488          {
489            double val;
490            DataArrayDouble *a;
491            DataArrayDoubleTuple *aa;
492            std::vector<double> bb;
493            int sw;
494            int spaceDim=self->getSpaceDimension();
495            const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
496            const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
497            MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
498            self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
499            PyObject *ret=PyTuple_New(2);
500            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
501            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
502            return ret;
503          }
504
505          PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
506          {
507            MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
508            int spaceDim=self->getSpaceDimension();
509            void *da=0;
510            int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 |  0 );
511            if (!SWIG_IsOK(res1))
512              {
513                int size;
514                INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
515                int nbOfPoints=size/spaceDim;
516                if(size%spaceDim!=0)
517                  {
518                    throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
519                  }
520                self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
521              }
522            else
523              {
524                DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
525                if(!da2)
526                  throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
527                da2->checkAllocated();
528                int size=da2->getNumberOfTuples();
529                int nbOfCompo=da2->getNumberOfComponents();
530                if(nbOfCompo!=spaceDim)
531                  {
532                    throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
533                  }
534                self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
535              }
536            PyObject *ret=PyTuple_New(2);
537            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
538            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
539            return ret;
540          }
541
542          PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
543          {
544            double val;
545            DataArrayDouble *a;
546            DataArrayDoubleTuple *aa;
547            std::vector<double> bb;
548            int sw;
549            int spaceDim=self->getSpaceDimension();
550            const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
551            const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
552            std::vector<int> elts;
553            self->getCellsContainingPoint(pos,eps,elts);
554            DataArrayInt *ret=DataArrayInt::New();
555            ret->alloc((int)elts.size(),1);
556            std::copy(elts.begin(),elts.end(),ret->getPointer());
557            return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
558          }
559          
560          virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
561          {
562            MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
563            MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
564            self->getReverseNodalConnectivity(d0,d1);
565            PyObject *ret=PyTuple_New(2);
566            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
567            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
568            return ret;
569          }
570          
571          void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
572          {
573            int sw,sz(-1);
574            int v0; std::vector<int> v1;
575            const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
576            self->renumberCells(ids,check);
577          }
578
579          PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
580          {
581            DataArrayInt *cellCor, *nodeCor;
582            self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
583            PyObject *res = PyList_New(2);
584            PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
585            PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
586            return res;
587          }
588
589          PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
590          {
591            DataArrayInt *cellCor=0,*nodeCor=0;
592            self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
593            PyObject *res = PyList_New(2);
594            PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
595            PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
596            return res;
597          }
598          
599          DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
600          {
601            DataArrayInt *cellCor=0;
602            self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
603            return cellCor;
604          }
605
606          DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
607          {
608            void *da=0;
609            int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
610            if (!SWIG_IsOK(res1))
611              {
612                int size;
613                INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
614                return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
615              }
616            else
617              {
618                DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
619                if(!da2)
620                  throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
621                da2->checkAllocated();
622                return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
623              }
624          }
625          PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
626          {
627            std::vector<int> conn;
628            self->getNodeIdsOfCell(cellId,conn);
629            return convertIntArrToPyList2(conn);
630          }
631
632          PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
633          {
634            std::vector<double> coo;
635            self->getCoordinatesOfNode(nodeId,coo);
636            return convertDblArrToPyList2(coo);
637          }
638
639          void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
640          {
641            double val;
642            DataArrayDouble *a;
643            DataArrayDoubleTuple *aa;
644            std::vector<double> bb;
645            int sw;
646            int spaceDim=self->getSpaceDimension();
647            const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
648            const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
649            self->scale(pointPtr,factor);
650          }
651
652          PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
653          {
654            int spaceDim=self->getSpaceDimension();
655            INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
656            self->getBoundingBox(tmp);
657            PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
658            return ret;
659          }
660
661          PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
662          {
663            std::string ret1;
664            bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
665            PyObject *ret=PyTuple_New(2);
666            PyObject *ret0Py=ret0?Py_True:Py_False;
667            Py_XINCREF(ret0Py);
668            PyTuple_SetItem(ret,0,ret0Py);
669            PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
670            return ret;
671          }
672
673          PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
674          {
675            int szArr,sw,iTypppArr;
676            std::vector<int> stdvecTyyppArr;
677            const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
678            MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
679            if(sw==3)//DataArrayInt
680              { 
681                void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
682                DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
683                std::string name=argpt->getName();
684                if(!name.empty())
685                  ret->setName(name.c_str());
686              }
687            return convertMesh(ret, SWIG_POINTER_OWN | 0 );
688          }
689         
690          PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
691          {
692            int szArr,sw,iTypppArr;
693            std::vector<int> stdvecTyyppArr;
694            DataArrayInt *arr=0;
695            const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
696            MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
697            if(sw==3)//DataArrayInt
698              { 
699                void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
700                DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
701                std::string name=argpt->getName();
702                if(!name.empty())
703                  ret->setName(name.c_str());
704              }
705            //
706            PyObject *res = PyList_New(2);
707            PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
708            PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
709            PyList_SetItem(res,0,obj0);
710            PyList_SetItem(res,1,obj1);
711            return res;
712          }
713
714          PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
715          {
716            int a,b,c;
717            DataArrayInt *arr=0;
718            MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
719            PyObject *res = PyTuple_New(2);
720            PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
721            PyObject *obj1=0;
722            if(arr)
723              obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
724            else
725              obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
726            PyTuple_SetItem(res,0,obj0);
727            PyTuple_SetItem(res,1,obj1);
728            return res;
729          }
730
731         PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
732         {
733           std::vector<int> vals=self->getDistributionOfTypes();
734           if(vals.size()%3!=0)
735             throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
736           PyObject *ret=PyList_New((int)vals.size()/3);
737           for(int j=0;j<(int)vals.size()/3;j++)
738              {
739                PyObject *ret1=PyList_New(3);
740                PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
741                PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
742                PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
743                PyList_SetItem(ret,j,ret1);
744              }
745           return ret;
746         }
747
748         DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
749         {
750           std::vector<int> code;
751           std::vector<const DataArrayInt *> idsPerType;
752           convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
753           convertPyToNewIntArr4(li,1,3,code);
754           return self->checkTypeConsistencyAndContig(code,idsPerType);
755         }
756
757         PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
758         {
759           std::vector<int> code;
760           std::vector<DataArrayInt *> idsInPflPerType;
761           std::vector<DataArrayInt *> idsPerType;
762           self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
763           PyObject *ret=PyTuple_New(3);
764           //
765           if(code.size()%3!=0)
766             throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
767           PyObject *ret0=PyList_New((int)code.size()/3);
768           for(int j=0;j<(int)code.size()/3;j++)
769              {
770                PyObject *ret00=PyList_New(3);
771                PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
772                PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
773                PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
774                PyList_SetItem(ret0,j,ret00);
775              }
776           PyTuple_SetItem(ret,0,ret0);
777           //
778           PyObject *ret1=PyList_New(idsInPflPerType.size());
779           for(std::size_t j=0;j<idsInPflPerType.size();j++)
780             PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
781           PyTuple_SetItem(ret,1,ret1);
782           int n=idsPerType.size();
783           PyObject *ret2=PyList_New(n);
784           for(int i=0;i<n;i++)
785             PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
786           PyTuple_SetItem(ret,2,ret2);
787           return ret;
788         }
789
790         void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
791         {
792           double val;
793           DataArrayDouble *a;
794           DataArrayDoubleTuple *aa;
795           std::vector<double> bb;
796           int sw;
797           int spaceDim=self->getSpaceDimension();
798           const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
799           const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
800           self->translate(vectorPtr);
801         }
802
803          void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
804          {
805            const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
806            double val;
807            DataArrayDouble *a;
808            DataArrayDoubleTuple *aa;
809            std::vector<double> bb;
810            int sw;
811            int spaceDim=self->getSpaceDimension();
812            const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
813            self->rotate(centerPtr,0,alpha);
814          }
815
816          void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
817          {
818            const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
819            double val,val2;
820            DataArrayDouble *a,*a2;
821            DataArrayDoubleTuple *aa,*aa2;
822            std::vector<double> bb,bb2;
823            int sw;
824            int spaceDim=self->getSpaceDimension();
825            const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
826            const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
827            self->rotate(centerPtr,vectorPtr,alpha);
828          }
829
830          PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
831          {
832            std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
833            std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
834            PyObject *res=PyList_New(result.size());
835            for(int i=0;iL!=result.end(); i++, iL++)
836              PyList_SetItem(res,i,PyInt_FromLong(*iL));
837            return res;
838          }
839          
840          static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
841          {
842             std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
843             convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
844             return MEDCouplingMesh::MergeMeshes(tmp);
845          }
846        }
847   };
848 }
849
850 //== MEDCouplingMesh End
851
852 %include "NormalizedGeometricTypes"
853 %include "MEDCouplingNatureOfFieldEnum"
854 //
855 namespace ParaMEDMEM
856 {
857   class MEDCouplingNatureOfField
858   {
859   public:
860     static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
861     static std::string GetReprNoThrow(NatureOfField nat);
862     static std::string GetAllPossibilitiesStr();
863   };
864 }
865
866 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
867 // include "MEDCouplingTimeDiscretization.i"
868
869 namespace ParaMEDMEM
870 {
871   class MEDCouplingGaussLocalization
872   {
873   public:
874     MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
875                                  const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
876     MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
877     INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
878     void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
879     int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
880     int getDimension() const throw(INTERP_KERNEL::Exception);
881     int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
882     std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
883     void checkCoherency() const throw(INTERP_KERNEL::Exception);
884     bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
885     //
886     const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
887     double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
888     const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
889     double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
890     const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
891     double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
892     void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
893     void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
894     void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
895     void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
896     void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
897     void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
898     //
899     static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
900   };
901 }
902
903 %include "MEDCouplingFieldDiscretization.i"
904
905 //== MEDCouplingPointSet
906
907 namespace ParaMEDMEM
908 {
909   class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
910     {
911     public:
912       void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
913       DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
914       bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
915       void zipCoords() throw(INTERP_KERNEL::Exception);
916       double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
917       void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
918       void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
919       void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
920       virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
921       virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
922       virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
923       static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
924       static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
925       static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
926       virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
927       virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
928       virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
929       virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
930       virtual DataArrayInt *findBoundaryNodes() const;
931       virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
932       virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
933       virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
934       virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
935       virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
936       virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
937       %extend 
938          {
939            std::string __str__() const throw(INTERP_KERNEL::Exception)
940            {
941              return self->simpleRepr();
942            }
943            
944            PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
945            {
946              int newNbOfNodes;
947              DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
948              PyObject *res = PyList_New(2);
949              PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
950              PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
951              return res;
952            }
953            
954            PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
955            {
956              DataArrayInt *comm, *commIndex;
957              self->findCommonNodes(prec,limitTupleId,comm,commIndex);
958              PyObject *res = PyList_New(2);
959              PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
960              PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
961              return res;
962            }
963            
964            PyObject *getCoords() throw(INTERP_KERNEL::Exception)
965            {
966              DataArrayDouble *ret1=self->getCoords();
967              if (ret1)
968                 ret1->incrRef();
969              return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
970            }
971            
972            PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
973            {
974              int szArr,sw,iTypppArr;
975              std::vector<int> stdvecTyyppArr;
976              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
977              MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
978              if(sw==3)//DataArrayInt
979                { 
980                  void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
981                  DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
982                  std::string name=argpt->getName();
983                  if(!name.empty())
984                    ret->setName(name.c_str());
985                }
986              return convertMesh(ret, SWIG_POINTER_OWN | 0 );
987            }
988            
989            PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
990            {
991              int szArr,sw,iTypppArr;
992              std::vector<int> stdvecTyyppArr;
993              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
994              MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
995              if(sw==3)//DataArrayInt
996                { 
997                  void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
998                  DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
999                  std::string name=argpt->getName();
1000                  if(!name.empty())
1001                    ret->setName(name.c_str());
1002                }
1003              return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1004            }
1005
1006            virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1007            {
1008              int szArr,sw,iTypppArr;
1009              std::vector<int> stdvecTyyppArr;
1010              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1011              MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1012              if(sw==3)//DataArrayInt
1013                { 
1014                  void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1015                  DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1016                  std::string name=argpt->getName();
1017                  if(!name.empty())
1018                    ret->setName(name.c_str());
1019                }
1020              return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1021            }
1022
1023            virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1024            {
1025              MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1026              return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1027            }
1028
1029            PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1030            {
1031              int szArr,sw,iTypppArr;
1032              std::vector<int> stdvecTyyppArr;
1033              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1034              MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1035              if(sw==3)//DataArrayInt
1036                { 
1037                  void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1038                  DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1039                  std::string name=argpt->getName();
1040                  if(!name.empty())
1041                    ret->setName(name.c_str());
1042                }
1043              return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1044            }
1045
1046            void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1047            {
1048              int szArr,sw,iTypppArr;
1049              std::vector<int> stdvecTyyppArr;
1050              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1051              self->renumberNodes(tmp,newNbOfNodes);
1052            }
1053
1054            void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1055            {
1056              int szArr,sw,iTypppArr;
1057              std::vector<int> stdvecTyyppArr;
1058              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1059              self->renumberNodes2(tmp,newNbOfNodes);
1060            }
1061
1062            PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1063              {
1064                int spaceDim=self->getSpaceDimension();
1065                double val,val2;
1066                DataArrayDouble *a,*a2;
1067                DataArrayDoubleTuple *aa,*aa2;
1068                std::vector<double> bb,bb2;
1069                int sw;
1070                const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1071                const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1072                const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1073                const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1074                std::vector<int> nodes;
1075                self->findNodesOnLine(p,v,eps,nodes);
1076                DataArrayInt *ret=DataArrayInt::New();
1077                ret->alloc((int)nodes.size(),1);
1078                std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1079                return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1080              }
1081            PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1082              {
1083                int spaceDim=self->getSpaceDimension();
1084                double val,val2;
1085                DataArrayDouble *a,*a2;
1086                DataArrayDoubleTuple *aa,*aa2;
1087                std::vector<double> bb,bb2;
1088                int sw;
1089                const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1090                const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1091                const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1092                const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1093                std::vector<int> nodes;
1094                self->findNodesOnPlane(p,v,eps,nodes);
1095                DataArrayInt *ret=DataArrayInt::New();
1096                ret->alloc((int)nodes.size(),1);
1097                std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1098                return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1099              }
1100            
1101            PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1102            {
1103              double val;
1104              DataArrayDouble *a;
1105              DataArrayDoubleTuple *aa;
1106              std::vector<double> bb;
1107              int sw;
1108              int spaceDim=self->getSpaceDimension();
1109              const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1110              const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1111              DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1112              return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1113            }
1114
1115            PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1116            {
1117              DataArrayInt *c=0,*cI=0;
1118              //
1119              double val;
1120              DataArrayDouble *a;
1121              DataArrayDoubleTuple *aa;
1122              std::vector<double> bb;
1123              int sw;
1124              int spaceDim=self->getSpaceDimension();
1125              const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1126              const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1127              self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1128              PyObject *ret=PyTuple_New(2);
1129              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1130              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1131              return ret;
1132            }
1133
1134            PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1135            {
1136              DataArrayInt *c=0,*cI=0;
1137              int spaceDim=self->getSpaceDimension();
1138              double val;
1139              DataArrayDouble *a;
1140              DataArrayDoubleTuple *aa;
1141              std::vector<double> bb;
1142              int sw;
1143              int nbOfTuples=-1;
1144              const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1145              self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1146              //
1147              PyObject *ret=PyTuple_New(2);
1148              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1149              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1150              return ret;
1151            }
1152
1153            PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1154            {
1155              double val;
1156              DataArrayDouble *a;
1157              DataArrayDoubleTuple *aa;
1158              std::vector<double> bb;
1159              int sw;
1160              int spaceDim=self->getSpaceDimension();
1161              const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1162              const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1163              //
1164              DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1165              return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1166            }
1167
1168            void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1169            {
1170              int sw;
1171              int singleVal;
1172              std::vector<int> multiVal;
1173              std::pair<int, std::pair<int,int> > slic;
1174              ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1175              convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1176              switch(sw)
1177                {
1178                case 1:
1179                  return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1180                case 2:
1181                  return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1182                case 4:
1183                  return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1184                default:
1185                  throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1186                }
1187            }
1188
1189            virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1190            {
1191              DataArrayInt *v0=0,*v1=0;
1192              self->findCommonCells(compType,startCellId,v0,v1);
1193              PyObject *res = PyList_New(2);
1194              PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1195              PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1196              return res;
1197            }
1198
1199       
1200            virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1201            {
1202              void *da=0;
1203              int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1204              if (!SWIG_IsOK(res1))
1205                {
1206                  int size;
1207                  INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1208                  self->renumberNodesInConn(tmp);
1209                }
1210              else
1211                {
1212                  DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1213                  if(!da2)
1214                    throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1215                  da2->checkAllocated();
1216                  self->renumberNodesInConn(da2->getConstPointer());
1217                }
1218            }
1219
1220            virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1221            {
1222              int ret1=-1;
1223              DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1224              PyObject *ret=PyTuple_New(2);
1225              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1226              PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1227              return ret;
1228            }
1229
1230            virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1231            {
1232              DataArrayInt *ret=0;
1233              //
1234              int szArr,sw,iTypppArr;
1235              std::vector<int> stdvecTyyppArr;
1236              const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1237              self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1238              return ret;
1239            }
1240
1241            virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1242            {
1243              bool ret1;
1244              int ret2;
1245              DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1246              PyObject *res = PyList_New(3);
1247              PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1248              PyList_SetItem(res,1,SWIG_From_bool(ret1));
1249              PyList_SetItem(res,2,SWIG_From_int(ret2));
1250              return res;
1251            }
1252            
1253            virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1254            {
1255              bool ret1;
1256              int ret2;
1257              DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1258              PyObject *res = PyList_New(3);
1259              PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1260              PyList_SetItem(res,1,SWIG_From_bool(ret1));
1261              PyList_SetItem(res,2,SWIG_From_int(ret2));
1262              return res;
1263            }
1264            
1265            DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1266            {
1267              void *da=0;
1268              int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
1269              if (!SWIG_IsOK(res1))
1270                {
1271                  int size;
1272                  INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1273                  return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1274                }
1275              else
1276                {
1277                  DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1278                  if(!da2)
1279                    throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1280                  da2->checkAllocated();
1281                  return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1282                }
1283            }
1284
1285            MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1286            {
1287              int sw;
1288              int singleVal;
1289              std::vector<int> multiVal;
1290              std::pair<int, std::pair<int,int> > slic;
1291              ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1292              int nbc=self->getNumberOfCells();
1293              convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1294              switch(sw)
1295                {
1296                case 1:
1297                  {
1298                    if(singleVal>=nbc)
1299                      {
1300                        std::ostringstream oss;
1301                        oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1302                        throw INTERP_KERNEL::Exception(oss.str().c_str());
1303                      }
1304                    if(singleVal>=0)
1305                      return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1306                    else
1307                      {
1308                        if(nbc+singleVal>0)
1309                          {
1310                            int tmp=nbc+singleVal;
1311                            return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1312                          }
1313                        else
1314                          {
1315                            std::ostringstream oss;
1316                            oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1317                            throw INTERP_KERNEL::Exception(oss.str().c_str());
1318                          }
1319                      }
1320                  }
1321                case 2:
1322                  {
1323                    return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1324                  }
1325                case 3:
1326                  {
1327                    return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1328                  }
1329                case 4:
1330                  {
1331                    if(!daIntTyypp)
1332                      throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1333                    daIntTyypp->checkAllocated();
1334                    return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1335                  }
1336                default:
1337                  throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1338                }
1339            }
1340            
1341            static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1342            {
1343              int sz;
1344              INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1345              INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1346              ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1347              for(int i=0;i<sz;i++)
1348                PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1349            }
1350            
1351            static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1352            {
1353              int sz;
1354              INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1355              int sw,nbNodes=0;
1356              double val0;  ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1357              std::vector<double> val3;
1358              const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1359                                                             "Rotate2DAlg",2,true,nbNodes);
1360              if(sw!=2 && sw!=3)
1361                throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1362              ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1363            }
1364            
1365            static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1366            {
1367              int sz,sz2;
1368              INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1369              INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1370              INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1371              ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1372              for(int i=0;i<sz;i++)
1373                PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1374            }
1375            
1376            static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1377            {
1378              int sz,sz2;
1379              INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1380              int sw,nbNodes=0;
1381              double val0;  ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1382              std::vector<double> val3;
1383              const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1384                                                             "Rotate3DAlg",3,true,nbNodes);
1385              if(sw!=2 && sw!=3)
1386                throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1387              INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1388              ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1389            }
1390          }
1391     };
1392
1393   //== MEDCouplingPointSet End
1394
1395   class MEDCouplingUMeshCell
1396   {
1397   public:
1398     INTERP_KERNEL::NormalizedCellType getType() const;
1399     %extend
1400       {
1401         std::string __str__() const throw(INTERP_KERNEL::Exception)
1402         {
1403           return self->repr();
1404         }
1405
1406         PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1407         {
1408           int ret2;
1409           const int *r=self->getAllConn(ret2);
1410           PyObject *ret=PyTuple_New(ret2);
1411           for(int i=0;i<ret2;i++)
1412             PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1413           return ret;
1414         }
1415       }
1416   };
1417
1418   class MEDCouplingUMeshCellIterator
1419   {
1420   public:
1421     %extend
1422       {
1423         PyObject *next()
1424         {
1425           MEDCouplingUMeshCell *ret=self->nextt();
1426           if(ret)
1427             return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1428           else
1429             {
1430               PyErr_SetString(PyExc_StopIteration,"No more data.");
1431               return 0;
1432             }
1433         }
1434       }
1435   };
1436
1437   class MEDCouplingUMeshCellByTypeIterator
1438   {
1439   public:
1440     ~MEDCouplingUMeshCellByTypeIterator();
1441     %extend
1442       {
1443         PyObject *next()
1444         {
1445           MEDCouplingUMeshCellEntry *ret=self->nextt();
1446           if(ret)
1447             return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1448           else
1449             {
1450               PyErr_SetString(PyExc_StopIteration,"No more data.");
1451               return 0;
1452             }
1453         }
1454       }
1455   };
1456
1457   class MEDCouplingUMeshCellByTypeEntry
1458   {
1459   public:
1460     ~MEDCouplingUMeshCellByTypeEntry();
1461     %extend
1462       {
1463         MEDCouplingUMeshCellByTypeIterator *__iter__()
1464         {
1465           return self->iterator();
1466         }
1467       }
1468   };
1469
1470   class MEDCouplingUMeshCellEntry
1471   {
1472   public:
1473     INTERP_KERNEL::NormalizedCellType getType() const;
1474     int getNumberOfElems() const;
1475     %extend
1476       {
1477         MEDCouplingUMeshCellIterator *__iter__()
1478         {
1479           return self->iterator();
1480         }
1481       }
1482   };
1483   
1484   //== MEDCouplingUMesh
1485
1486   class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1487   {
1488   public:
1489     static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1490     static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1491     MEDCouplingUMesh *clone(bool recDeepCpy) const;
1492     void checkCoherency() const throw(INTERP_KERNEL::Exception);
1493     void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1494     void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1495     void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1496     MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1497     void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1498     INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1499     void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1500     int getMeshLength() const throw(INTERP_KERNEL::Exception);
1501     void computeTypes() throw(INTERP_KERNEL::Exception);
1502     std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1503     MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1504     //tools
1505     DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1506     void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1507     std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1508     DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1509     MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1510     bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1511     bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1512     DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1513     DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1514     DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1515     DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1516     DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1517     MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1518     MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1519     MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1520     void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1521     bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1522     bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1523     MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1524     bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1525     void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1526     void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1527     void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1528     DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1529     void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1530     bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1531     MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1532     MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1533     MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1534     MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1535     DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1536     DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1537     std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1538     DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1539     DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1540     ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1541     DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1542     DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1543     DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1544     DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1545     DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1546     DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1547     int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) throw(INTERP_KERNEL::Exception);
1548     static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1549     static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1550     static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1551     static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1552     static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1553     %extend {
1554       MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1555       {
1556         return MEDCouplingUMesh::New();
1557       }
1558       
1559       MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1560       {
1561         return MEDCouplingUMesh::New(meshName,meshDim);
1562       }
1563       
1564       std::string __str__() const throw(INTERP_KERNEL::Exception)
1565       {
1566         return self->simpleRepr();
1567       }
1568       
1569       std::string __repr__() const throw(INTERP_KERNEL::Exception)
1570       {
1571         std::ostringstream oss;
1572         self->reprQuickOverview(oss);
1573         return oss.str();
1574       }
1575       
1576       MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1577       {
1578         return self->cellIterator();
1579       }
1580
1581       PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1582       {
1583         std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1584         std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1585         PyObject *res=PyList_New(result.size());
1586         for(int i=0;iL!=result.end(); i++, iL++)
1587           PyList_SetItem(res,i,PyInt_FromLong(*iL));
1588         return res;
1589       }
1590       
1591       void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1592       {
1593         int sw;
1594         int singleVal;
1595         std::vector<int> multiVal;
1596         std::pair<int, std::pair<int,int> > slic;
1597         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1598         int nbc=self->getNumberOfCells();
1599         convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1600         switch(sw)
1601           {
1602           case 1:
1603             {
1604               if(singleVal>=nbc)
1605                 {
1606                   std::ostringstream oss;
1607                   oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1608                   throw INTERP_KERNEL::Exception(oss.str().c_str());
1609                 }
1610               if(singleVal>=0)
1611                 {
1612                   self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1613                   break;
1614                 }
1615               else
1616                 {
1617                   if(nbc+singleVal>0)
1618                     {
1619                       int tmp=nbc+singleVal;
1620                       self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1621                       break;
1622                     }
1623                   else
1624                     {
1625                       std::ostringstream oss;
1626                       oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1627                       throw INTERP_KERNEL::Exception(oss.str().c_str());
1628                     }
1629                 }
1630             }
1631           case 2:
1632             {
1633               self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1634               break;
1635             }
1636           case 4:
1637             {
1638               if(!daIntTyypp)
1639                 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1640               daIntTyypp->checkAllocated();
1641               self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1642               break;
1643             }
1644           default:
1645             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1646           }
1647       }
1648
1649       void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1650       {
1651         int sw;
1652         int singleVal;
1653         std::vector<int> multiVal;
1654         std::pair<int, std::pair<int,int> > slic;
1655         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1656         int nbc=self->getNumberOfCells();
1657         convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1658         switch(sw)
1659           {
1660           case 1:
1661             {
1662               if(singleVal>=nbc)
1663                 {
1664                   std::ostringstream oss;
1665                   oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1666                   throw INTERP_KERNEL::Exception(oss.str().c_str());
1667                 }
1668               if(singleVal>=0)
1669                 {
1670                   self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1671                   break;
1672                 }
1673               else
1674                 {
1675                   if(nbc+singleVal>0)
1676                     {
1677                       int tmp=nbc+singleVal;
1678                       self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1679                       break;
1680                     }
1681                   else
1682                     {
1683                       std::ostringstream oss;
1684                       oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1685                       throw INTERP_KERNEL::Exception(oss.str().c_str());
1686                     }
1687                 }
1688             }
1689           case 2:
1690             {
1691               self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1692               break;
1693             }
1694           case 3:
1695             {
1696               self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1697               break;
1698             }
1699           case 4:
1700             {
1701               if(!daIntTyypp)
1702                 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1703               daIntTyypp->checkAllocated();
1704               self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1705               break;
1706             }
1707           default:
1708             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1709           }
1710       }
1711
1712       void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1713       {
1714         int szArr,sw,iTypppArr;
1715         std::vector<int> stdvecTyyppArr;
1716         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1717         if(size>szArr)
1718           {
1719             std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1720             throw INTERP_KERNEL::Exception(oss.str().c_str());
1721           }
1722         self->insertNextCell(type,size,tmp);
1723       }
1724
1725       void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1726       {
1727         int szArr,sw,iTypppArr;
1728         std::vector<int> stdvecTyyppArr;
1729         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1730         self->insertNextCell(type,szArr,tmp);
1731       }
1732       
1733       DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1734       {
1735         DataArrayInt *ret=self->getNodalConnectivity();
1736         if(ret)
1737           ret->incrRef();
1738         return ret;
1739       }
1740       DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1741       {
1742         DataArrayInt *ret=self->getNodalConnectivityIndex();
1743         if(ret)
1744           ret->incrRef();
1745         return ret;
1746       }
1747       
1748       static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1749       {
1750         int szArr,sw,iTypppArr;
1751         std::vector<int> stdvecTyyppArr;
1752         const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1753         int nbOfDepthPeelingPerformed=0;
1754         DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1755         PyObject *res=PyTuple_New(2);
1756         PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1757         PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1758         return res;
1759       }
1760
1761       static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1762       {
1763         DataArrayInt *v0=0,*v1=0;
1764         MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1765         PyObject *res = PyList_New(2);
1766         PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1767         PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1768         return res;
1769       }
1770       
1771       PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1772       {
1773         double val;
1774         DataArrayDouble *a;
1775         DataArrayDoubleTuple *aa;
1776         std::vector<double> bb;
1777         int sw;
1778         int nbOfCompo=self->getSpaceDimension();
1779         const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1780         //
1781         int cellId=-1;
1782         double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1783         PyObject *ret=PyTuple_New(2);
1784         PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1785         PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1786         return ret;
1787       }
1788
1789       PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1790       {
1791         DataArrayInt *ret1=0;
1792         DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1793         PyObject *ret=PyTuple_New(2);
1794         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1795         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1796         return ret;
1797       }
1798
1799       PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1800       {
1801         int ret2(-1);
1802         DataArrayInt *ret1(0);
1803         MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1804         PyObject *ret=PyTuple_New(3);
1805         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1806         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1807         PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1808         return ret;
1809       }
1810       
1811       PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1812       {
1813         std::vector<int> cells;
1814         self->checkButterflyCells(cells,eps);
1815         DataArrayInt *ret=DataArrayInt::New();
1816         ret->alloc((int)cells.size(),1);
1817         std::copy(cells.begin(),cells.end(),ret->getPointer());
1818         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1819       }
1820
1821       PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1822       {
1823         std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1824         int sz=ms.size();
1825         PyObject *ret = PyList_New(sz);
1826         for(int i=0;i<sz;i++)
1827           PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1828         return ret;
1829       }
1830
1831       PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1832       {
1833         std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1834         int sz=retCpp.size();
1835         PyObject *ret=PyList_New(sz);
1836         for(int i=0;i<sz;i++)
1837           PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1838         return ret;
1839       }
1840
1841       PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1842       {
1843         int size;
1844         INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1845         MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1846         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1847       }
1848
1849       bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1850       {
1851         int sz;
1852         INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1853         bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1854         return ret;
1855       }
1856
1857       DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1858       {
1859         int sz;
1860         INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1861         DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1862         return ret;
1863       }
1864
1865       PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1866       {
1867         DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1868         self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1869         PyObject *ret=PyTuple_New(3);
1870         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1871         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1872         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1873         return ret;
1874       }
1875
1876       PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1877       {
1878         DataArrayInt *tmp0=0,*tmp1=0;
1879         self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1880         PyObject *ret=PyTuple_New(2);
1881         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1882         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1883         return ret;
1884       }
1885
1886       void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1887       {
1888         int sw;
1889         int singleVal;
1890         std::vector<int> multiVal;
1891         std::pair<int, std::pair<int,int> > slic;
1892         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1893         convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1894         switch(sw)
1895           {
1896           case 1:
1897             return self->duplicateNodes(&singleVal,&singleVal+1);
1898           case 2:
1899             return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1900           case 4:
1901             return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1902           default:
1903             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1904           }
1905       }
1906
1907       void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1908       {
1909         int sw;
1910         int singleVal;
1911         std::vector<int> multiVal;
1912         std::pair<int, std::pair<int,int> > slic;
1913         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1914         convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1915         switch(sw)
1916           {
1917           case 1:
1918             return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1919           case 2:
1920             return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1921           case 4:
1922             return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1923           default:
1924             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1925           }
1926       }
1927
1928       PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1929       {
1930         int sz;
1931         INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1932         DataArrayInt *tmp0,*tmp1=0;
1933         tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1934         PyObject *ret=PyTuple_New(2);
1935         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1936         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1937         return ret;
1938       }
1939
1940       PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1941       {
1942         DataArrayInt *ret0=0,*ret1=0;
1943         self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1944         PyObject *ret=PyTuple_New(2);
1945         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1946         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947         return ret;
1948       }
1949
1950       static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1951       {
1952         std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1953         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1954         DataArrayInt *ret1=0,*ret2=0;
1955         MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1956         PyObject *ret=PyTuple_New(3);
1957         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1958         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1959         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1960         return ret;
1961       }
1962
1963       static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1964       {
1965         std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1966         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1967         MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1968         return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1969       }
1970
1971       static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1972       {
1973         int sz;
1974         std::vector<const MEDCouplingUMesh *> meshes;
1975         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1976         std::vector<DataArrayInt *> corr;
1977         MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1978         sz=corr.size();
1979         PyObject *ret1=PyList_New(sz);
1980         for(int i=0;i<sz;i++)
1981           PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1982         PyObject *ret=PyList_New(2);
1983         PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1984         PyList_SetItem(ret,1,ret1);
1985         return ret;
1986       }
1987
1988       static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1989       {
1990         std::vector<MEDCouplingUMesh *> meshes;
1991         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1992         MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1993       }
1994
1995       static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1996       {
1997         std::vector<MEDCouplingUMesh *> meshes;
1998         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1999         MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2000       }
2001
2002       static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2003       {
2004         int sw;
2005         int singleVal;
2006         std::vector<int> multiVal;
2007         std::pair<int, std::pair<int,int> > slic;
2008         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2009         if(!arrIndx)
2010           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2011         convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2012         switch(sw)
2013           {
2014           case 1:
2015             return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2016           case 2:
2017             return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2018           case 4:
2019             return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2020           default:
2021             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2022           }
2023       }
2024       
2025       static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2026       {
2027         DataArrayInt *arrOut=0,*arrIndexOut=0;
2028         int sw;
2029         int singleVal;
2030         std::vector<int> multiVal;
2031         std::pair<int, std::pair<int,int> > slic;
2032         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2033         if(!arrIndxIn)
2034           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2035         convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2036         switch(sw)
2037           {
2038           case 1:
2039             {
2040               MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2041               break;
2042             }
2043           case 2:
2044             {
2045               MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2046               break;
2047             }
2048           case 4:
2049             {
2050               MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2051               break;
2052             }
2053           default:
2054             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2055           }
2056         PyObject *ret=PyTuple_New(2);
2057         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2058         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2059         return ret;
2060       }
2061
2062       static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2063       {
2064         DataArrayInt *arrOut=0,*arrIndexOut=0;
2065         MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2066         PyObject *ret=PyTuple_New(2);
2067         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2068         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069         return ret;
2070       }
2071
2072       static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2073       {
2074         if(!PySlice_Check(slic))
2075           throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2076         Py_ssize_t strt=2,stp=2,step=2;
2077         PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2078         if(!arrIndxIn)
2079           throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2080         arrIndxIn->checkAllocated();
2081         if(arrIndxIn->getNumberOfComponents()!=1)
2082           throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2083         GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2084         DataArrayInt *arrOut=0,*arrIndexOut=0;
2085         MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2086         PyObject *ret=PyTuple_New(2);
2087         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2088         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2089         return ret;
2090       }
2091
2092       static PyObject *SetPartOfIndexedArrays(PyObject *li,
2093                                               const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2094                                               const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2095       {
2096         DataArrayInt *arrOut=0,*arrIndexOut=0;
2097         int sw;
2098         int singleVal;
2099         std::vector<int> multiVal;
2100         std::pair<int, std::pair<int,int> > slic;
2101         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2102         if(!arrIndxIn)
2103           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2104         convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2105         switch(sw)
2106           {
2107           case 1:
2108             {
2109               MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2110               break;
2111             }
2112           case 2:
2113             {
2114               MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2115               break;
2116             }
2117           case 4:
2118             {
2119               MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2120               break;
2121             }
2122           default:
2123             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2124           }
2125         PyObject *ret=PyTuple_New(2);
2126         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2127         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2128         return ret;
2129       }
2130
2131       static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2132                                                 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2133       {
2134         int sw;
2135         int singleVal;
2136         std::vector<int> multiVal;
2137         std::pair<int, std::pair<int,int> > slic;
2138         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2139         if(!arrIndxIn)
2140           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2141         convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2142         switch(sw)
2143           {
2144           case 1:
2145             {
2146               MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2147               break;
2148             }
2149           case 2:
2150             {
2151               MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2152               break;
2153             }
2154           case 4:
2155             {
2156               MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2157               break;
2158             }
2159           default:
2160             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2161           }
2162       }
2163
2164       PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2165       {
2166         double val;
2167         DataArrayDouble *a;
2168         DataArrayDoubleTuple *aa;
2169         std::vector<double> bb;
2170         int sw;
2171         int spaceDim=self->getSpaceDimension();
2172         const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2173         const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2174         //
2175         std::vector<int> cells;
2176         self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2177         DataArrayInt *ret=DataArrayInt::New();
2178         ret->alloc((int)cells.size(),1);
2179         std::copy(cells.begin(),cells.end(),ret->getPointer());
2180         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2181       }
2182
2183       void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2184       {
2185         double val;
2186         DataArrayDouble *a;
2187         DataArrayDoubleTuple *aa;
2188         std::vector<double> bb;
2189         int sw;
2190         int spaceDim=self->getSpaceDimension();
2191         const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2192         const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2193         self->orientCorrectly2DCells(v,polyOnly);
2194       }
2195       
2196       PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2197       {
2198         std::vector<int> cells;
2199         self->arePolyhedronsNotCorrectlyOriented(cells);
2200         DataArrayInt *ret=DataArrayInt::New();
2201         ret->alloc((int)cells.size(),1);
2202         std::copy(cells.begin(),cells.end(),ret->getPointer());
2203         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2204       }
2205
2206       PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2207       {
2208         double vec[3];
2209         double pos[3];
2210         self->getFastAveragePlaneOfThis(vec,pos);
2211         double vals[6];
2212         std::copy(vec,vec+3,vals);
2213         std::copy(pos,pos+3,vals+3);
2214         return convertDblArrToPyListOfTuple(vals,3,2);
2215       }
2216       
2217       static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2218       {
2219         std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2220         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2221         return MEDCouplingUMesh::MergeUMeshes(tmp);
2222       }
2223
2224       PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2225       {
2226         DataArrayInt *ret1;
2227         bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2228         PyObject *ret=PyTuple_New(2);
2229         PyObject *ret0Py=ret0?Py_True:Py_False;
2230         Py_XINCREF(ret0Py);
2231         PyTuple_SetItem(ret,0,ret0Py);
2232         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2233         return ret;
2234       }
2235
2236       PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2237       {
2238         DataArrayInt *ret1;
2239         bool ret0=self->areCellsIncludedIn2(other,ret1);
2240         PyObject *ret=PyTuple_New(2);
2241         PyObject *ret0Py=ret0?Py_True:Py_False;
2242         Py_XINCREF(ret0Py);
2243         PyTuple_SetItem(ret,0,ret0Py);
2244         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2245         return ret;
2246       }
2247
2248       PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2249       {
2250         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2251         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2252         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2253         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2254         MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2255         PyObject *ret=PyTuple_New(5);
2256         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2257         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2258         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2259         PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2260         PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2261         return ret;
2262       }
2263
2264       PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2265       {
2266         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2267         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2268         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2269         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2270         MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2271         PyObject *ret=PyTuple_New(5);
2272         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2273         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2274         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275         PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2276         PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2277         return ret;
2278       }
2279
2280       PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2281       {
2282         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2283         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2284         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2285         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2286         MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2287         PyObject *ret=PyTuple_New(5);
2288         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2289         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2290         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2291         PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2292         PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2293         return ret;
2294       }
2295       
2296       PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2297       {
2298         DataArrayInt *neighbors=0,*neighborsIdx=0;
2299         self->computeNeighborsOfCells(neighbors,neighborsIdx);
2300         PyObject *ret=PyTuple_New(2);
2301         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2302         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2303         return ret;
2304       }
2305
2306       static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2307       {
2308         DataArrayInt *neighbors=0,*neighborsIdx=0;
2309         MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2310         PyObject *ret=PyTuple_New(2);
2311         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2313         return ret;
2314       }
2315
2316       PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2317       {
2318         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2319         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2320         DataArrayInt *d2,*d3,*d4,*dd5;
2321         MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2322         PyObject *ret=PyTuple_New(7);
2323         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2324         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2325         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326         PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327         PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328         PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329         PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2330         return ret;
2331       }
2332
2333       DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2334       {
2335         if(!da)
2336           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2337         da->checkAllocated();
2338         return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2339       }
2340
2341       DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2342       {
2343         if(!da)
2344           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2345         da->checkAllocated();
2346         return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2347       }
2348
2349       MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2350       {
2351         if(!da)
2352           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2353         da->checkAllocated();
2354         return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2355       }
2356
2357       PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2358       {
2359         if(!da)
2360           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2361         da->checkAllocated();
2362         std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2363         std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2364         PyObject *res = PyList_New(result.size());
2365         for (int i=0;iL!=result.end(); i++, iL++)
2366           PyList_SetItem(res,i,PyInt_FromLong(*iL));
2367         return res;
2368       }
2369
2370       DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2371       {
2372         if(!da)
2373           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2374         da->checkAllocated();
2375         DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2376         ret->setName(da->getName().c_str());
2377         return ret;
2378       }
2379
2380       static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2381       {
2382         DataArrayInt *cellNb1=0,*cellNb2=0;
2383         MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2384         PyObject *ret=PyTuple_New(3);
2385         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2386         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2387         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2388         return ret;
2389       }
2390
2391       PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2392       {
2393         int spaceDim=self->getSpaceDimension();
2394         if(spaceDim!=3)
2395           throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2396         double val,val2;
2397         DataArrayDouble *a,*a2;
2398         DataArrayDoubleTuple *aa,*aa2;
2399         std::vector<double> bb,bb2;
2400         int sw;
2401         const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2402         const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2403         const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2404         const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2405         //
2406         DataArrayInt *cellIds=0;
2407         MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2408         PyObject *ret=PyTuple_New(2);
2409         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2410         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2411         return ret;
2412       }
2413
2414       PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2415       {
2416         int spaceDim=self->getSpaceDimension();
2417         if(spaceDim!=3)
2418           throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2419         double val,val2;
2420         DataArrayDouble *a,*a2;
2421         DataArrayDoubleTuple *aa,*aa2;
2422         std::vector<double> bb,bb2;
2423         int sw;
2424         const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2425         const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2426         const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2427         const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2428         //
2429         DataArrayInt *cellIds=0;
2430         MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2431         PyObject *ret=PyTuple_New(2);
2432         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2433         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2434         return ret;
2435       }
2436
2437       DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2438       {
2439         int spaceDim=self->getSpaceDimension();
2440         if(spaceDim!=3)
2441           throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2442         double val,val2;
2443         DataArrayDouble *a,*a2;
2444         DataArrayDoubleTuple *aa,*aa2;
2445         std::vector<double> bb,bb2;
2446         int sw;
2447         const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2448         const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2449         const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2450         const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2451         return self->getCellIdsCrossingPlane(orig,vect,eps);
2452       }
2453
2454       void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2455       {
2456         int sw;
2457         int pos1;
2458         std::vector<int> pos2;
2459         DataArrayInt *pos3=0;
2460         DataArrayIntTuple *pos4=0;
2461         convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2462         switch(sw)
2463           {
2464           case 1:
2465             {
2466               self->convertToPolyTypes(&pos1,&pos1+1);
2467               return;
2468             }
2469           case 2:
2470             {
2471               if(pos2.empty())
2472                 return;
2473               self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2474               return ;
2475             }
2476           case 3:
2477             {
2478               self->convertToPolyTypes(pos3->begin(),pos3->end());
2479               return ;
2480             }
2481           default:
2482             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2483           }
2484       }
2485     }
2486     void convertAllToPoly();
2487     void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2488     bool unPolyze() throw(INTERP_KERNEL::Exception);
2489     void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2490     MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2491     MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2492   };
2493
2494   //== MEDCouplingUMesh End
2495
2496   //== MEDCouplingExtrudedMesh
2497
2498   class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2499   {
2500   public:
2501     static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2502     MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2503     %extend {
2504       MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2505       {
2506         return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2507       }
2508       
2509       std::string __str__() const throw(INTERP_KERNEL::Exception)
2510       {
2511         return self->simpleRepr();
2512       }
2513
2514       std::string __repr__() const throw(INTERP_KERNEL::Exception)
2515       {
2516         std::ostringstream oss;
2517         self->reprQuickOverview(oss);
2518         return oss.str();
2519       }
2520       
2521       PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2522       {
2523         MEDCouplingUMesh *ret=self->getMesh2D();
2524         if(ret)
2525           ret->incrRef();
2526         return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2527       }
2528       PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2529       {
2530         MEDCouplingUMesh *ret=self->getMesh1D();
2531         if(ret)
2532           ret->incrRef();
2533         return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2534       }
2535       PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2536       {
2537         DataArrayInt *ret=self->getMesh3DIds();
2538         if(ret)
2539           ret->incrRef();
2540         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2541       } 
2542     }
2543   };
2544
2545   //== MEDCouplingExtrudedMesh End
2546
2547   class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2548   {
2549   public:
2550     static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2551     static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2552     INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2553     int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2554     virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2555     virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2556     %extend
2557     {
2558       virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2559       {
2560         int szArr,sw,iTypppArr;
2561         std::vector<int> stdvecTyyppArr;
2562         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2563         self->insertNextCell(tmp,tmp+szArr);
2564       }
2565
2566       virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2567       {
2568         DataArrayInt *ret=self->getNodalConnectivity();
2569         if(ret) ret->incrRef();
2570         return ret;
2571       }
2572       
2573       static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2574       {
2575         std::vector< const MEDCoupling1GTUMesh *> parts;
2576         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2577         return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2578       }
2579     }
2580   };
2581
2582   //== MEDCoupling1SGTUMesh
2583
2584   class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2585   {
2586   public:
2587     static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2588     static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2589     void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2590     int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2591     static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2592     MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2593     MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2594     MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2595     DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2596     %extend
2597     {
2598       MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2599       {
2600         return MEDCoupling1SGTUMesh::New(name,type);
2601       }
2602
2603       MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2604       {
2605         return MEDCoupling1SGTUMesh::New(m);
2606       }
2607
2608       std::string __str__() const throw(INTERP_KERNEL::Exception)
2609       {
2610         return self->simpleRepr();
2611       }
2612       
2613       std::string __repr__() const throw(INTERP_KERNEL::Exception)
2614       {
2615         std::ostringstream oss;
2616         self->reprQuickOverview(oss);
2617         return oss.str();
2618       }
2619
2620       static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2621       {
2622         std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2623         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2624         return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2625       }
2626       
2627       static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2628       {
2629         std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2630         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2631         return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2632       }
2633     }
2634   };
2635   
2636   //== MEDCoupling1SGTUMesh End
2637
2638   //== MEDCoupling1DGTUMesh
2639
2640   class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2641   {
2642   public:
2643     static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2644     static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2645     void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2646     MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2647     bool isPacked() const throw(INTERP_KERNEL::Exception);
2648     %extend
2649     {
2650       MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2651       {
2652         return MEDCoupling1DGTUMesh::New(name,type);
2653       }
2654
2655       MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2656       {
2657         return MEDCoupling1DGTUMesh::New(m);
2658       }
2659
2660       std::string __str__() const throw(INTERP_KERNEL::Exception)
2661       {
2662         return self->simpleRepr();
2663       }
2664       
2665       std::string __repr__() const throw(INTERP_KERNEL::Exception)
2666       {
2667         std::ostringstream oss;
2668         self->reprQuickOverview(oss);
2669         return oss.str();
2670       }
2671
2672       DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2673       {
2674         DataArrayInt *ret=self->getNodalConnectivityIndex();
2675         if(ret) ret->incrRef();
2676         return ret;
2677       }
2678
2679       PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2680       {
2681         DataArrayInt *ret1=0,*ret2=0;
2682         bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2683         PyObject *ret0Py=ret0?Py_True:Py_False;
2684         Py_XINCREF(ret0Py);
2685         PyObject *ret=PyTuple_New(3);
2686         PyTuple_SetItem(ret,0,ret0Py);
2687         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2688         PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2689         return ret;
2690       }
2691       
2692       PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2693       {
2694         bool ret1;
2695         MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2696         PyObject *ret=PyTuple_New(2);
2697         PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2698         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2699         PyTuple_SetItem(ret,1,ret1Py);
2700         return ret;
2701       }
2702
2703       static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2704       {
2705         std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2706         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2707         return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2708       }
2709       
2710       static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2711       {
2712         std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2713         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2714         return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2715       }
2716       
2717       static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2718       {
2719         std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2720         convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2721         return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2722       }
2723     }
2724   };
2725
2726   //== MEDCoupling1DGTUMeshEnd
2727
2728   class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2729   {
2730   public:
2731     int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2732     int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2733     virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2734     std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2735     MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2736     static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2737     %extend
2738     {
2739       virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2740       {
2741         int tmpp1=-1,tmpp2=-1;
2742         std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2743         std::vector< std::pair<int,int> > inp;
2744         if(tmpp2==2)
2745           {
2746             inp.resize(tmpp1);
2747             for(int i=0;i<tmpp1;i++)
2748               { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2749           }
2750         else if(tmpp2==1)
2751           {
2752             if(tmpp1%2!=0)
2753               throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2754             inp.resize(tmpp1/2);
2755             for(int i=0;i<tmpp1/2;i++)
2756               { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2757           }
2758         else
2759           throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2760         return self->buildStructuredSubPart(inp);
2761       }
2762
2763       static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2764       {
2765         int tmpp1=-1,tmpp2=-1;
2766         std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2767         std::vector< std::pair<int,int> > inp;
2768         if(tmpp2==2)
2769           {
2770             inp.resize(tmpp1);
2771             for(int i=0;i<tmpp1;i++)
2772               { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2773           }
2774         else if(tmpp2==1)
2775           {
2776             if(tmpp1%2!=0)
2777               throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2778             inp.resize(tmpp1/2);
2779             for(int i=0;i<tmpp1/2;i++)
2780               { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2781           }
2782         else
2783           throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2784         //
2785         int szArr,sw,iTypppArr;
2786         std::vector<int> stdvecTyyppArr;
2787         const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2788         std::vector<int> tmp5(tmp4,tmp4+szArr);
2789         //
2790         return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2791       }
2792
2793       static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2794       {
2795         int szArr,sw,iTypppArr;
2796         std::vector<int> stdvecTyyppArr;
2797         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2798         return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2799       }
2800
2801       static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2802       {
2803         int szArr,sw,iTypppArr;
2804         std::vector<int> stdvecTyyppArr;
2805         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2806         int szArr2,sw2,iTypppArr2;
2807         std::vector<int> stdvecTyyppArr2;
2808         const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2809         std::vector<int> tmp3(tmp2,tmp2+szArr2);
2810         std::vector< std::pair<int,int> > partCompactFormat;
2811         bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2812         PyObject *ret=PyTuple_New(2);
2813         PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2814         PyTuple_SetItem(ret,0,ret0Py);
2815         PyObject *ret1Py=PyList_New(partCompactFormat.size());
2816         for(std::size_t i=0;i<partCompactFormat.size();i++)
2817           {
2818             PyObject *tmp4=PyTuple_New(2);
2819             PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2820             PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2821             PyList_SetItem(ret1Py,i,tmp4);
2822           }
2823         PyTuple_SetItem(ret,1,ret1Py);
2824         return ret;
2825       }
2826     }
2827   };
2828
2829   //== MEDCouplingCMesh
2830   
2831   class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2832   {
2833   public:
2834     static MEDCouplingCMesh *New();
2835     static MEDCouplingCMesh *New(const std::string& meshName);
2836     MEDCouplingCMesh *clone(bool recDeepCpy) const;
2837     void setCoords(const DataArrayDouble *coordsX,
2838                    const DataArrayDouble *coordsY=0,
2839                    const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2840     void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2841     %extend {
2842       MEDCouplingCMesh()
2843       {
2844         return MEDCouplingCMesh::New();
2845       }
2846       MEDCouplingCMesh(const std::string& meshName)
2847       {
2848         return MEDCouplingCMesh::New(meshName);
2849       }
2850       std::string __str__() const throw(INTERP_KERNEL::Exception)
2851       {
2852         return self->simpleRepr();
2853       }
2854       std::string __repr__() const throw(INTERP_KERNEL::Exception)
2855       {
2856         std::ostringstream oss;
2857         self->reprQuickOverview(oss);
2858         return oss.str();
2859       }
2860       DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2861       {
2862         DataArrayDouble *ret=self->getCoordsAt(i);
2863         if(ret)
2864           ret->incrRef();
2865         return ret;
2866       }
2867     }
2868   };
2869
2870   //== MEDCouplingCMesh End
2871
2872   //== MEDCouplingCurveLinearMesh
2873
2874   class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2875   {
2876   public:
2877     static MEDCouplingCurveLinearMesh *New();
2878     static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2879     MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2880     void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2881     %extend {
2882       MEDCouplingCurveLinearMesh()
2883       {
2884         return MEDCouplingCurveLinearMesh::New();
2885       }
2886       MEDCouplingCurveLinearMesh(const std::string& meshName)
2887       {
2888         return MEDCouplingCurveLinearMesh::New(meshName);
2889       }
2890       std::string __str__() const throw(INTERP_KERNEL::Exception) 
2891       {
2892         return self->simpleRepr();
2893       }
2894       std::string __repr__() const throw(INTERP_KERNEL::Exception)
2895       {
2896         std::ostringstream oss;
2897         self->reprQuickOverview(oss);
2898         return oss.str();
2899       }
2900       DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2901       {
2902         DataArrayDouble *ret=self->getCoords();
2903         if(ret)
2904           ret->incrRef();
2905         return ret;
2906       }
2907       void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2908       {
2909         int szArr,sw,iTypppArr;
2910         std::vector<int> stdvecTyyppArr;
2911         const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2912         self->setNodeGridStructure(tmp,tmp+szArr);
2913       }
2914     }
2915   };
2916
2917   //== MEDCouplingCurveLinearMesh End
2918 }
2919
2920 namespace ParaMEDMEM
2921 {
2922   class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2923   {
2924   public:
2925     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2926     virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2927     virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2928     virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2929     virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2930     void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2931     void setName(const char *name) throw(INTERP_KERNEL::Exception);
2932     std::string getDescription() const throw(INTERP_KERNEL::Exception);
2933     void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2934     std::string getName() const throw(INTERP_KERNEL::Exception);
2935     TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2936     NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2937     virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2938     DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2939     MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2940     int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2941     int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2942     void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2943                                     const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2944     void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2945     MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2946     int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2947     int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2948     const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2949     int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2950     void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2951     %extend {
2952       PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2953       {
2954         MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2955         if(ret1)
2956           ret1->incrRef();
2957         return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2958       }
2959
2960       PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2961       {
2962         MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2963         if(ret)
2964           ret->incrRef();
2965         return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2966       }
2967
2968       PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2969       {
2970         std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2971         return convertIntArrToPyList3(ret);
2972       }
2973
2974       PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2975       {
2976         std::string ret1;
2977         bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2978         PyObject *ret=PyTuple_New(2);
2979         PyObject *ret0Py=ret0?Py_True:Py_False;
2980         Py_XINCREF(ret0Py);
2981         PyTuple_SetItem(ret,0,ret0Py);
2982         PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2983         return ret;
2984       }
2985
2986       PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2987       {
2988         DataArrayInt *ret1=0;
2989         MEDCouplingMesh *ret0=0;
2990         void *da=0;
2991         int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
2992         if (!SWIG_IsOK(res1))
2993           {
2994             int size;
2995             INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2996             ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2997           }
2998         else
2999           {
3000             DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3001             if(!da2)
3002               throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3003             da2->checkAllocated();
3004             ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3005           }
3006         PyObject *res = PyList_New(2);
3007         PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3008         PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3009         return res;
3010       }
3011
3012       PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3013       {
3014         DataArrayInt *ret1=0;
3015         int bb,ee,ss;
3016         MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3017         PyObject *res=PyTuple_New(2);
3018         PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3019         if(ret1)
3020           PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3021         else
3022           {
3023             PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3024             PyTuple_SetItem(res,1,res1);
3025           }
3026         return res;
3027       }
3028
3029       DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3030       {
3031         int sw,sz(-1);
3032         int v0; std::vector<int> v1;
3033         const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3034         return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3035       }
3036
3037       void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3038                                        const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3039       {
3040         void *da=0;
3041         int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
3042         if (!SWIG_IsOK(res1))
3043           {
3044             int size;
3045             INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3046             self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3047           }
3048         else
3049           {
3050             DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3051             if(!da2)
3052               throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3053             da2->checkAllocated();
3054             self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3055           }
3056       }
3057
3058       PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3059       {
3060         std::vector<int> tmp;
3061         self->getCellIdsHavingGaussLocalization(locId,tmp);
3062         DataArrayInt *ret=DataArrayInt::New();
3063         ret->alloc((int)tmp.size(),1);
3064         std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3065         return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3066       }
3067       
3068       int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3069       {
3070         std::vector<int> inp0;
3071         convertPyToNewIntArr4(code,1,3,inp0);
3072         std::vector<const DataArrayInt *> inp1;
3073         convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3074         return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3075       }
3076     }
3077   };
3078   
3079   class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3080   {
3081   public:
3082     static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3083     static MEDCouplingFieldTemplate *New(TypeOfField type);
3084     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3085     std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3086     %extend
3087        {
3088          MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3089          {
3090            return MEDCouplingFieldTemplate::New(f);
3091          }
3092          
3093          MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3094          {
3095            return MEDCouplingFieldTemplate::New(type);
3096          }
3097          
3098          std::string __str__() const throw(INTERP_KERNEL::Exception)
3099          {
3100            return self->simpleRepr();
3101          }
3102          
3103          std::string __repr__() const throw(INTERP_KERNEL::Exception)
3104          {
3105            std::ostringstream oss;
3106            self->reprQuickOverview(oss);
3107            return oss.str();
3108          }
3109        }
3110   };
3111   
3112   class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3113   {
3114   public:
3115     static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3116     static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3117     void setTimeUnit(const std::string& unit);
3118     std::string getTimeUnit() const;
3119     void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3120     void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3121     void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3122     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3123     std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3124     void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3125     MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3126     MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3127     MEDCouplingFieldDouble *deepCpy() const;
3128     MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3129     MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3130     MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3131     TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3132     double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3133     double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3134     void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3135     void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3136     void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3137     void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3138     void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3139     void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3140     void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3141     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3142     int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3143     int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3144     void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3145     double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3146     void setIteration(int it) throw(INTERP_KERNEL::Exception);
3147     void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3148     void setOrder(int order) throw(INTERP_KERNEL::Exception);
3149     void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3150     void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3151     void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3152     void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3153     void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3154     bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3155     bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3156     bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3157     bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3158     bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3159     MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3160     MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3161     MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3162     MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3163     MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3164     MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3165     MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3166     MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3167     MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3168     void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3169     void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3170     MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3171     void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3172     void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3173     void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3174     void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3175     void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3176     void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3177     void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3178     void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3179     void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3180     void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3181     double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3182     double getMaxValue() const throw(INTERP_KERNEL::Exception);
3183     double getMinValue() const throw(INTERP_KERNEL::Exception);
3184     double getAverageValue() const throw(INTERP_KERNEL::Exception);
3185     double norm2() const throw(INTERP_KERNEL::Exception);
3186     double normMax() const throw(INTERP_KERNEL::Exception);
3187     //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3188     double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3189     double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3190     double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3191     double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3192     DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3193     MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3194     static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3195     static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196     static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197     MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3198     static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199     MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3200     static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3201     MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3202     static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3203     static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3204     static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3205     static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3206     static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3207     MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3208     MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3209     %extend {
3210       MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3211       {
3212         return MEDCouplingFieldDouble::New(type,td);
3213       }
3214
3215       MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3216       {
3217         return MEDCouplingFieldDouble::New(ft,td);
3218       }
3219
3220       std::string __str__() const throw(INTERP_KERNEL::Exception)
3221       {
3222         return self->simpleRepr();
3223       }
3224
3225       std::string __repr__() const throw(INTERP_KERNEL::Exception)
3226       {
3227         std::ostringstream oss;
3228         self->reprQuickOverview(oss);
3229         return oss.str();
3230       }
3231
3232       DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3233       {
3234         DataArrayDouble *ret=self->getArray();
3235         if(ret)
3236           ret->incrRef();
3237         return ret;
3238       }
3239
3240       PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3241       {
3242         std::vector<DataArrayDouble *> arrs=self->getArrays();
3243         for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3244           if(*it)
3245             (*it)->incrRef();
3246         int sz=arrs.size();
3247         PyObject *ret=PyTuple_New(sz);
3248         for(int i=0;i<sz;i++)
3249           {
3250             if(arrs[i])
3251               PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3252             else
3253               PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3254           }
3255         return ret;
3256       }
3257
3258       void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3259       {
3260         std::vector<const DataArrayDouble *> tmp;
3261         convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3262         int sz=tmp.size();
3263         std::vector<DataArrayDouble *> arrs(sz);
3264         for(int i=0;i<sz;i++)
3265           arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3266         self->setArrays(arrs);
3267       }
3268
3269       DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3270       {
3271         DataArrayDouble *ret=self->getEndArray();
3272         if(ret)
3273           ret->incrRef();
3274         return ret;
3275       }
3276
3277       PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3278       {
3279         double val;
3280         DataArrayDouble *a;
3281         DataArrayDoubleTuple *aa;
3282         std::vector<double> bb;
3283         int sw;
3284         const MEDCouplingMesh *mesh=self->getMesh();
3285         if(!mesh)
3286           throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3287         int spaceDim=mesh->getSpaceDimension();
3288         const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3289         const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3290         //
3291         int sz=self->getNumberOfComponents();
3292         INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3293         self->getValueOn(spaceLoc,res);
3294         return convertDblArrToPyList(res,sz);
3295       }
3296
3297        PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3298        {
3299          int sz=self->getNumberOfComponents();
3300          INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3301          self->getValueOnPos(i,j,k,res);
3302          return convertDblArrToPyList(res,sz);
3303        }
3304
3305       DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3306       {
3307         const MEDCouplingMesh *mesh(self->getMesh());
3308         if(!mesh)
3309           throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3310         //
3311         int sw,nbPts;
3312         double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3313         const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3314                                                          mesh->getSpaceDimension(),true,nbPts);
3315         return self->getValueOnMulti(inp,nbPts);
3316       }
3317
3318       PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3319       {
3320         double val;
3321         DataArrayDouble *a;
3322         DataArrayDoubleTuple *aa;
3323         std::vector<double> bb;
3324         int sw;
3325         const MEDCouplingMesh *mesh=self->getMesh();
3326         if(!mesh)
3327           throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3328         int spaceDim=mesh->getSpaceDimension();
3329         const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3330         const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3331         //
3332         //
3333         int sz=self->getNumberOfComponents();
3334         INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3335         self->getValueOn(spaceLoc,time,res);
3336         return convertDblArrToPyList(res,sz);
3337       }
3338
3339       void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3340       {
3341         if(self->getArray()!=0)
3342           ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3343         else
3344           {
3345             MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3346             ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3347             self->setArray(arr);
3348           }
3349       }
3350       
3351       PyObject *getTime() throw(INTERP_KERNEL::Exception)
3352       {
3353         int tmp1,tmp2;
3354         double tmp0=self->getTime(tmp1,tmp2);
3355         PyObject *res = PyList_New(3);
3356         PyList_SetItem(res,0,SWIG_From_double(tmp0));
3357         PyList_SetItem(res,1,SWIG_From_int(tmp1));
3358         PyList_SetItem(res,2,SWIG_From_int(tmp2));
3359         return res;
3360       }
3361
3362       PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3363       {
3364         int tmp1,tmp2;
3365         double tmp0=self->getStartTime(tmp1,tmp2);
3366         PyObject *res = PyList_New(3);
3367         PyList_SetItem(res,0,SWIG_From_double(tmp0));
3368         PyList_SetItem(res,1,SWIG_From_int(tmp1));
3369         PyList_SetItem(res,2,SWIG_From_int(tmp2));
3370         return res;
3371       }
3372
3373       PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3374       {
3375         int tmp1,tmp2;
3376         double tmp0=self->getEndTime(tmp1,tmp2);
3377         PyObject *res = PyList_New(3);
3378         PyList_SetItem(res,0,SWIG_From_double(tmp0));
3379         PyList_SetItem(res,1,SWIG_From_int(tmp1));
3380         PyList_SetItem(res,2,SWIG_From_int(tmp2));
3381         return res;
3382       }
3383       PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3384       {
3385         int sz=self->getNumberOfComponents();
3386         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3387         self->accumulate(tmp);
3388         return convertDblArrToPyList(tmp,sz);
3389       }
3390       PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3391       {
3392         int sz=self->getNumberOfComponents();
3393         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3394         self->integral(isWAbs,tmp);
3395         return convertDblArrToPyList(tmp,sz);
3396       }
3397       PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3398       {
3399         int sz=self->getNumberOfComponents();
3400         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3401         self->getWeightedAverageValue(tmp,isWAbs);
3402         return convertDblArrToPyList(tmp,sz);
3403       }
3404       PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3405       {
3406         int sz=self->getNumberOfComponents();
3407         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3408         self->normL1(tmp);
3409         return convertDblArrToPyList(tmp,sz);
3410       }
3411       PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3412       {
3413         int sz=self->getNumberOfComponents();
3414         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3415         self->normL2(tmp);
3416         return convertDblArrToPyList(tmp,sz);
3417       }
3418       void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3419       {
3420         int szArr,sw,iTypppArr;
3421         std::vector<int> stdvecTyyppArr;
3422         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3423         self->renumberCells(tmp,check);
3424       }
3425       
3426       void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3427       {
3428         int szArr,sw,iTypppArr;
3429         std::vector<int> stdvecTyyppArr;
3430         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3431         self->renumberCellsWithoutMesh(tmp,check);
3432       }
3433       
3434       void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3435       {
3436         int szArr,sw,iTypppArr;
3437         std::vector<int> stdvecTyyppArr;
3438         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3439         self->renumberNodes(tmp,eps);
3440       }
3441
3442       void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3443       {
3444         int szArr,sw,iTypppArr;
3445         std::vector<int> stdvecTyyppArr;
3446         const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3447         self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3448       }
3449
3450       MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3451       {
3452         int sw;
3453         int singleVal;
3454         std::vector<int> multiVal;
3455         std::pair<int, std::pair<int,int> > slic;
3456         ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3457         const MEDCouplingMesh *mesh=self->getMesh();
3458         if(!mesh)
3459           throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3460         int nbc=mesh->getNumberOfCells();
3461         convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3462         switch(sw)
3463           {
3464           case 1:
3465             {
3466               if(singleVal>=nbc)
3467                 {
3468                   std::ostringstream oss;
3469                   oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3470                   throw INTERP_KERNEL::Exception(oss.str().c_str());
3471                 }
3472               if(singleVal>=0)
3473                 return self->buildSubPart(&singleVal,&singleVal+1);
3474               else
3475                 {
3476                   if(nbc+singleVal>0)
3477                     {
3478                       int tmp=nbc+singleVal;
3479                       return self->buildSubPart(&tmp,&tmp+1);
3480                     }
3481                   else
3482                     {
3483                       std::ostringstream oss;
3484                       oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3485                       throw INTERP_KERNEL::Exception(oss.str().c_str());
3486                     }
3487                 }
3488             }
3489           case 2:
3490             {
3491               return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3492             }
3493           case 3:
3494             {
3495               return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3496             }
3497           case 4:
3498             {
3499               if(!daIntTyypp)
3500                 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3501               daIntTyypp->checkAllocated();
3502               return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3503             }
3504           default:
3505             throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3506           }
3507       }
3508
3509       MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3510       {
3511         const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call  Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
3512         if(PyTuple_Check(li))
3513           {
3514             Py_ssize_t sz=PyTuple_Size(li);
3515             if(sz!=2)
3516               throw INTERP_KERNEL::Exception(msg);
3517             PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3518             int sw;
3519             int singleVal;
3520             std::vector<int> multiVal;
3521             std::pair<int, std::pair<int,int> > slic;
3522             ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3523             if(!self->getArray())
3524               throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3525             try
3526               { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3527             catch(INTERP_KERNEL::Exception& e)
3528               { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3529             MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3530             DataArrayDouble *ret0Arr=ret0->getArray();
3531             if(!ret0Arr)
3532               throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3533             switch(sw)
3534               {
3535               case 1:
3536                 {
3537                   std::vector<int> v2(1,singleVal);
3538                   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3539                   ret0->setArray(aarr);
3540                   return ret0.retn();
3541                 }
3542               case 2:
3543                 {
3544                   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3545                   ret0->setArray(aarr);
3546                   return ret0.retn();
3547                 }
3548               case 3:
3549                 {
3550                   int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3551                   std::vector<int> v2(nbOfComp);
3552                   for(int i=0;i<nbOfComp;i++)
3553                     v2[i]=slic.first+i*slic.second.second;
3554                   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3555                   ret0->setArray(aarr);
3556                   return ret0.retn();
3557                 }
3558               default:
3559                 throw INTERP_KERNEL::Exception(msg);
3560               }
3561             
3562           }
3563         else
3564           return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3565       }
3566
3567       PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3568       {
3569         DataArrayInt *tmp;
3570         double r1=self->getMaxValue2(tmp);
3571         PyObject *ret=PyTuple_New(2);
3572         PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3573         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3574         return ret;
3575       }
3576       
3577       PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3578       {
3579         DataArrayInt *tmp;
3580         double r1=self->getMinValue2(tmp);
3581         PyObject *ret=PyTuple_New(2);
3582         PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3583         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3584         return ret;
3585       }
3586       
3587       MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3588       {
3589         std::vector<int> tmp;
3590         convertPyToNewIntArr3(li,tmp);
3591         return self->keepSelectedComponents(tmp);
3592       }
3593
3594       void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3595       {
3596         std::vector<int> tmp;
3597         convertPyToNewIntArr3(li,tmp);
3598         self->setSelectedComponents(f,tmp);
3599       }
3600
3601       MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3602       {
3603         double val,val2;
3604         DataArrayDouble *a,*a2;
3605         DataArrayDoubleTuple *aa,*aa2;
3606         std::vector<double> bb,bb2;
3607         int sw;
3608         int spaceDim=3;
3609         const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3610         const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3611         const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3612         const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3613         //
3614         return self->extractSlice3D(orig,vect,eps);
3615       }
3616
3617       MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3618       {
3619         return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3620       }
3621
3622       MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3623       {
3624         return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3625       }
3626
3627       MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3628       {
3629         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3630         const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3631         void *argp;
3632         //
3633         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3634           {
3635             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3636             if(other)
3637               return (*self)-(*other);
3638             else
3639               throw INTERP_KERNEL::Exception(msg);
3640           }
3641         //
3642         double val;
3643         DataArrayDouble *a;
3644         DataArrayDoubleTuple *aa;
3645         std::vector<double> bb;
3646         int sw;
3647         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3648         switch(sw)
3649           {
3650           case 1:
3651             {
3652               if(!self->getArray())
3653                 throw INTERP_KERNEL::Exception(msg2);
3654               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3655               ret->applyLin(1.,-val);
3656               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3657               ret2->setArray(ret);
3658               return ret2.retn();
3659             }
3660           case 2:
3661             {
3662               if(!self->getArray())
3663                 throw INTERP_KERNEL::Exception(msg2);
3664               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3665               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3666               ret2->setArray(ret);
3667               return ret2.retn();
3668             }
3669           case 3:
3670             {
3671               if(!self->getArray())
3672                 throw INTERP_KERNEL::Exception(msg2);
3673               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3674               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3675               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3676               ret2->setArray(ret);
3677               return ret2.retn();
3678             }
3679           case 4:
3680             {
3681               if(!self->getArray())
3682                 throw INTERP_KERNEL::Exception(msg2);
3683               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3684               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3685               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3686               ret2->setArray(ret);
3687               return ret2.retn();
3688             }
3689           default:
3690             { throw INTERP_KERNEL::Exception(msg); }
3691           }
3692       }
3693
3694       MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3695       {
3696         return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3697       }
3698
3699       MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3700       {
3701         return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3702       }
3703
3704       MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3705       {
3706         return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3707       }
3708
3709       MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3710       {
3711         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3712         const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3713         void *argp;
3714         //
3715         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3716           {
3717             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3718             if(other)
3719               return (*self)/(*other);
3720             else
3721               throw INTERP_KERNEL::Exception(msg);
3722           }
3723         //
3724         double val;
3725         DataArrayDouble *a;
3726         DataArrayDoubleTuple *aa;
3727         std::vector<double> bb;
3728         int sw;
3729         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3730         switch(sw)
3731           {
3732           case 1:
3733             {
3734               if(val==0.)
3735                 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3736               if(!self->getArray())
3737                 throw INTERP_KERNEL::Exception(msg2);
3738               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3739               ret->applyLin(1./val,0);
3740               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3741               ret2->setArray(ret);
3742               return ret2.retn();
3743             }
3744           case 2:
3745             {
3746               if(!self->getArray())
3747                 throw INTERP_KERNEL::Exception(msg2);
3748               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3749               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3750               ret2->setArray(ret);
3751               return ret2.retn();
3752             }
3753           case 3:
3754             {
3755               if(!self->getArray())
3756                 throw INTERP_KERNEL::Exception(msg2);
3757               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3758               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3759               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3760               ret2->setArray(ret);
3761               return ret2.retn();
3762             }
3763           case 4:
3764             {
3765               if(!self->getArray())
3766                 throw INTERP_KERNEL::Exception(msg2);
3767               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3768               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3769               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3770               ret2->setArray(ret);
3771               return ret2.retn();
3772             }
3773           default:
3774             { throw INTERP_KERNEL::Exception(msg); }
3775           }
3776       }
3777
3778       MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3779       {
3780         return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3781       }
3782
3783       MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3784       {
3785         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3786         const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3787         void *argp;
3788         //
3789         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3790           {
3791             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3792             if(other)
3793               return (*self)^(*other);
3794             else
3795               throw INTERP_KERNEL::Exception(msg);
3796           }
3797         //
3798         double val;
3799         DataArrayDouble *a;
3800         DataArrayDoubleTuple *aa;
3801         std::vector<double> bb;
3802         int sw;
3803         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3804         switch(sw)
3805           {
3806           case 1:
3807             {
3808               if(!self->getArray())
3809                 throw INTERP_KERNEL::Exception(msg2);
3810               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3811               ret->applyPow(val);
3812               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3813               ret2->setArray(ret);
3814               return ret2.retn();
3815             }
3816           case 2:
3817             {
3818               if(!self->getArray())
3819                 throw INTERP_KERNEL::Exception(msg2);
3820               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3821               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3822               ret2->setArray(ret);
3823               return ret2.retn();
3824             }
3825           case 3:
3826             {
3827               if(!self->getArray())
3828                 throw INTERP_KERNEL::Exception(msg2);
3829               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3830               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3831               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3832               ret2->setArray(ret);
3833               return ret2.retn();
3834             }
3835           case 4:
3836             {
3837               if(!self->getArray())
3838                 throw INTERP_KERNEL::Exception(msg2);
3839               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3840               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3841               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3842               ret2->setArray(ret);
3843               return ret2.retn();
3844             }
3845           default:
3846             { throw INTERP_KERNEL::Exception(msg); }
3847           }
3848       }
3849
3850       MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3851       {
3852         return self->negate();
3853       }
3854
3855       PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3856       {
3857         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3858         const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3859         void *argp;
3860         //
3861         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3862           {
3863             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3864             if(other)
3865               {
3866                 *self+=*other;
3867                 Py_XINCREF(trueSelf);
3868                 return trueSelf;
3869               }
3870             else
3871               throw INTERP_KERNEL::Exception(msg);
3872           }
3873         //
3874         double val;
3875         DataArrayDouble *a;
3876         DataArrayDoubleTuple *aa;
3877         std::vector<double> bb;
3878         int sw;
3879         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3880         switch(sw)
3881           {
3882           case 1:
3883             {
3884               if(!self->getArray())
3885                 throw INTERP_KERNEL::Exception(msg2);
3886               self->getArray()->applyLin(1.,val);
3887               Py_XINCREF(trueSelf);
3888               return trueSelf;
3889             }
3890           case 2:
3891             {
3892               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3893               ret2->setArray(a);
3894               *self+=*ret2;
3895               Py_XINCREF(trueSelf);
3896               return trueSelf;
3897             }
3898           case 3:
3899             {
3900               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3901               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3902               ret2->setArray(aaa);
3903               *self+=*ret2;
3904               Py_XINCREF(trueSelf);
3905               return trueSelf;
3906             }
3907           case 4:
3908             {
3909               if(!self->getArray())
3910                 throw INTERP_KERNEL::Exception(msg2);
3911               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3912               self->getArray()->addEqual(aaa);
3913               Py_XINCREF(trueSelf);
3914               return trueSelf;
3915             }
3916           default:
3917             { throw INTERP_KERNEL::Exception(msg); }
3918           }
3919       }
3920
3921       PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3922       {
3923         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3924         const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3925         void *argp;
3926         //
3927         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3928           {
3929             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3930             if(other)
3931               {
3932                 *self-=*other;
3933                 Py_XINCREF(trueSelf);
3934                 return trueSelf;
3935               }
3936             else
3937               throw INTERP_KERNEL::Exception(msg);
3938           }
3939         //
3940         double val;
3941         DataArrayDouble *a;
3942         DataArrayDoubleTuple *aa;
3943         std::vector<double> bb;
3944         int sw;
3945         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3946         switch(sw)
3947           {
3948           case 1:
3949             {
3950               if(!self->getArray())
3951                 throw INTERP_KERNEL::Exception(msg2);
3952               self->getArray()->applyLin(1.,-val);
3953               Py_XINCREF(trueSelf);
3954               return trueSelf;
3955             }
3956           case 2:
3957             {
3958               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3959               ret2->setArray(a);
3960               *self-=*ret2;
3961               Py_XINCREF(trueSelf);
3962               return trueSelf;
3963             }
3964           case 3:
3965             {
3966               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3967               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3968               ret2->setArray(aaa);
3969               *self-=*ret2;
3970               Py_XINCREF(trueSelf);
3971               return trueSelf;
3972             }
3973           case 4:
3974             {
3975               if(!self->getArray())
3976                 throw INTERP_KERNEL::Exception(msg2);
3977               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3978               self->getArray()->substractEqual(aaa);
3979               Py_XINCREF(trueSelf);
3980               return trueSelf;
3981             }
3982           default:
3983             { throw INTERP_KERNEL::Exception(msg); }
3984           }
3985       }
3986
3987       PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3988       {
3989         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3990         const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3991         void *argp;
3992         //
3993         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3994           {
3995             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3996             if(other)
3997               {
3998                 *self*=*other;
3999                 Py_XINCREF(trueSelf);
4000                 return trueSelf;
4001               }
4002             else
4003               throw INTERP_KERNEL::Exception(msg);
4004           }
4005         //
4006         double val;
4007         DataArrayDouble *a;
4008         DataArrayDoubleTuple *aa;
4009         std::vector<double> bb;
4010         int sw;
4011         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4012         switch(sw)
4013           {
4014           case 1:
4015             {
4016               if(!self->getArray())
4017                 throw INTERP_KERNEL::Exception(msg2);
4018               self->getArray()->applyLin(val,0);
4019               Py_XINCREF(trueSelf);
4020               return trueSelf;
4021             }
4022           case 2:
4023             {
4024               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4025               ret2->setArray(a);
4026               *self*=*ret2;
4027               Py_XINCREF(trueSelf);
4028               return trueSelf;
4029             }
4030           case 3:
4031             {
4032               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4033               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4034               ret2->setArray(aaa);
4035               *self*=*ret2;
4036               Py_XINCREF(trueSelf);
4037               return trueSelf;
4038             }
4039           case 4:
4040             {
4041               if(!self->getArray())
4042                 throw INTERP_KERNEL::Exception(msg2);
4043               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4044               self->getArray()->multiplyEqual(aaa);
4045               Py_XINCREF(trueSelf);
4046               return trueSelf;
4047             }
4048           default:
4049             { throw INTERP_KERNEL::Exception(msg); }
4050           }
4051       }
4052
4053       PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4054       {
4055         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4056         const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4057         void *argp;
4058         //
4059         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4060           {
4061             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4062             if(other)
4063               {
4064                 *self/=*other;
4065                 Py_XINCREF(trueSelf);
4066                 return trueSelf;
4067               }
4068             else
4069               throw INTERP_KERNEL::Exception(msg);
4070           }
4071         //
4072         double val;
4073         DataArrayDouble *a;
4074         DataArrayDoubleTuple *aa;
4075         std::vector<double> bb;
4076         int sw;
4077         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4078         switch(sw)
4079           {
4080           case 1:
4081             {
4082               if(val==0.)
4083                 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4084               if(!self->getArray())
4085                 throw INTERP_KERNEL::Exception(msg2);
4086               self->getArray()->applyLin(1./val,0);
4087               Py_XINCREF(trueSelf);
4088               return trueSelf;
4089             }
4090           case 2:
4091             {
4092               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4093               ret2->setArray(a);
4094               *self/=*ret2;
4095               Py_XINCREF(trueSelf);
4096               return trueSelf;
4097             }
4098           case 3:
4099             {
4100               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4101               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4102               ret2->setArray(aaa);
4103               *self/=*ret2;
4104               Py_XINCREF(trueSelf);
4105               return trueSelf;
4106             }
4107           case 4:
4108             {
4109               if(!self->getArray())
4110                 throw INTERP_KERNEL::Exception(msg2);
4111               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4112               self->getArray()->divideEqual(aaa);
4113               Py_XINCREF(trueSelf);
4114               return trueSelf;
4115             }
4116           default:
4117             { throw INTERP_KERNEL::Exception(msg); }
4118           }
4119       }
4120
4121       PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4122       {
4123         const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4124         const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4125         void *argp;
4126         //
4127         if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4128           {
4129             MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4130             if(other)
4131               {
4132                 *self^=*other;
4133                 Py_XINCREF(trueSelf);
4134                 return trueSelf;
4135               }
4136             else
4137               throw INTERP_KERNEL::Exception(msg);
4138           }
4139         //
4140         double val;
4141         DataArrayDouble *a;
4142         DataArrayDoubleTuple *aa;
4143         std::vector<double> bb;
4144         int sw;
4145         convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4146         switch(sw)
4147           {
4148           case 1:
4149             {
4150               if(!self->getArray())
4151                 throw INTERP_KERNEL::Exception(msg2);
4152               self->getArray()->applyPow(val);
4153               Py_XINCREF(trueSelf);
4154               return trueSelf;
4155             }
4156           case 2:
4157             {
4158               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4159               ret2->setArray(a);
4160               *self^=*ret2;
4161               Py_XINCREF(trueSelf);
4162               return trueSelf;
4163             }
4164           case 3:
4165             {
4166               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4167               MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4168               ret2->setArray(aaa);
4169               *self^=*ret2;
4170               Py_XINCREF(trueSelf);
4171               return trueSelf;
4172             }
4173           case 4:
4174             {
4175               if(!self->getArray())
4176                 throw INTERP_KERNEL::Exception(msg2);
4177               MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4178               self->getArray()->powEqual(aaa);
4179               Py_XINCREF(trueSelf);
4180               return trueSelf;
4181             }
4182           default:
4183             { throw INTERP_KERNEL::Exception(msg); }
4184           }
4185       }
4186
4187       static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4188       {
4189         std::vector<const MEDCouplingFieldDouble *> tmp;
4190         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4191         return MEDCouplingFieldDouble::MergeFields(tmp);
4192       }
4193
4194       static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4195       {
4196         std::vector<const MEDCouplingFieldDouble *> tmp;
4197         convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4198         MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4199       }
4200     }
4201   };
4202
4203   class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4204   {
4205   public:
4206     int getNumberOfFields() const;
4207     MEDCouplingMultiFields *deepCpy() const;
4208     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4209     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4210     virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4211     virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4212     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4213     %extend
4214        {
4215          std::string __str__() const throw(INTERP_KERNEL::Exception)
4216          {
4217            return self->simpleRepr();
4218          }
4219          static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4220          {
4221            std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4222            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4223            int sz=tmp.size();
4224            std::vector<MEDCouplingFieldDouble *> fs(sz);
4225            for(int i=0;i<sz;i++)
4226              fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4227            return MEDCouplingMultiFields::New(fs);
4228          }
4229          MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4230          {
4231            std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4232            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4233            int sz=tmp.size();
4234            std::vector<MEDCouplingFieldDouble *> fs(sz);
4235            for(int i=0;i<sz;i++)
4236              fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4237            return MEDCouplingMultiFields::New(fs);
4238          }
4239          PyObject *getFields() const
4240          {
4241            std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4242            int sz=fields.size();
4243            PyObject *res = PyList_New(sz);
4244            for(int i=0;i<sz;i++)
4245              {
4246                if(fields[i])
4247                  {
4248                    fields[i]->incrRef();
4249                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4250                  }
4251                else
4252                  {
4253                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4254                  }
4255              }
4256            return res;
4257          }
4258          PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4259          {
4260            const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4261            if(ret)
4262              {
4263                ret->incrRef();
4264                return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4265              }
4266            else
4267              return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4268          }
4269          PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4270          {
4271            std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4272            int sz=ms.size();
4273            PyObject *res = PyList_New(sz);
4274            for(int i=0;i<sz;i++)
4275              {
4276                if(ms[i])
4277                  {
4278                    ms[i]->incrRef();
4279                    PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4280                  }
4281                else
4282                  {
4283                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4284                  }
4285              }
4286            return res;
4287          }
4288          PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4289          {
4290            std::vector<int> refs;
4291            std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4292            int sz=ms.size();
4293            PyObject *res = PyList_New(sz);
4294            for(int i=0;i<sz;i++)
4295              {
4296                if(ms[i])
4297                  {
4298                    ms[i]->incrRef();
4299                    PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4300                  }
4301                else
4302                  {
4303                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4304                  }
4305              }
4306            //
4307            PyObject *ret=PyTuple_New(2);
4308            PyTuple_SetItem(ret,0,res);
4309            PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4310            return ret;
4311          }
4312          PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4313          {
4314            std::vector<DataArrayDouble *> ms=self->getArrays();
4315            int sz=ms.size();
4316            PyObject *res = PyList_New(sz);
4317            for(int i=0;i<sz;i++)
4318              {
4319                if(ms[i])
4320                  {
4321                    ms[i]->incrRef();
4322                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4323                  }
4324                else
4325                  {
4326                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4327                  }
4328              }
4329            return res;
4330          }
4331          PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4332          {
4333            std::vector< std::vector<int> > refs;
4334            std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4335            int sz=ms.size();
4336            PyObject *res = PyList_New(sz);
4337            PyObject *res2 = PyList_New(sz);
4338            for(int i=0;i<sz;i++)
4339              {
4340                if(ms[i])
4341                  {
4342                    ms[i]->incrRef();
4343                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4344                  }
4345                else
4346                  {
4347                    PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4348                  }
4349                PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4350              }
4351            //
4352            PyObject *ret=PyTuple_New(2);
4353            PyTuple_SetItem(ret,0,res);
4354            PyTuple_SetItem(ret,1,res2);
4355            return ret;
4356          }
4357        }
4358   };
4359   
4360   class MEDCouplingDefinitionTime
4361   {
4362   public:
4363     MEDCouplingDefinitionTime();
4364     void assign(const MEDCouplingDefinitionTime& other);
4365     bool isEqual(const MEDCouplingDefinitionTime& other) const;
4366     double getTimeResolution() const;
4367     std::vector<double> getHotSpotsTime() const;
4368     %extend
4369       {
4370         std::string __str__() const throw(INTERP_KERNEL::Exception)
4371           {
4372             std::ostringstream oss;
4373             self->appendRepr(oss);
4374             return oss.str();
4375           }
4376
4377         PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4378         {
4379           int meshId,arrId,arrIdInField,fieldId;
4380           self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4381           PyObject *res=PyList_New(4);
4382           PyList_SetItem(res,0,PyInt_FromLong(meshId));
4383           PyList_SetItem(res,1,PyInt_FromLong(arrId));
4384           PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4385           PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4386           return res;
4387         }
4388
4389         PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4390         {
4391           int meshId,arrId,arrIdInField,fieldId;
4392           self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4393           PyObject *res=PyList_New(4);
4394           PyList_SetItem(res,0,PyInt_FromLong(meshId));
4395           PyList_SetItem(res,1,PyInt_FromLong(arrId));
4396           PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4397           PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4398           return res;
4399         }
4400       }
4401   };
4402
4403   class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4404   {
4405   public:
4406     double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4407     MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4408     
4409     %extend
4410       {
4411         MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4412           {
4413             std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4414             convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4415             int sz=tmp.size();
4416             std::vector<MEDCouplingFieldDouble *> fs(sz);
4417             for(int i=0;i<sz;i++)
4418               fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4419             return MEDCouplingFieldOverTime::New(fs);
4420           }
4421         std::string __str__() const throw(INTERP_KERNEL::Exception)
4422           {
4423             return self->simpleRepr();
4424           }
4425         static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4426         {
4427           std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4428           convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4429            int sz=tmp.size();
4430            std::vector<MEDCouplingFieldDouble *> fs(sz);
4431            for(int i=0;i<sz;i++)
4432              fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4433            return MEDCouplingFieldOverTime::New(fs);
4434          }
4435       }
4436   };
4437 }
4438
4439 %pythoncode %{
4440 import os
4441 __filename=os.environ.get('PYTHONSTARTUP')
4442 if __filename and os.path.isfile(__filename):
4443   execfile(__filename)
4444   pass
4445 %}