1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #define MEDCOUPLING_EXPORT
28 #include "MEDCouplingMemArray.hxx"
29 #include "MEDCouplingUMesh.hxx"
30 #include "MEDCouplingExtrudedMesh.hxx"
31 #include "MEDCouplingCMesh.hxx"
32 #include "MEDCouplingField.hxx"
33 #include "MEDCouplingFieldDouble.hxx"
34 #include "MEDCouplingFieldTemplate.hxx"
35 #include "MEDCouplingGaussLocalization.hxx"
36 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
37 #include "MEDCouplingMultiFields.hxx"
38 #include "MEDCouplingFieldOverTime.hxx"
39 #include "MEDCouplingDefinitionTime.hxx"
40 #include "MEDCouplingFieldDiscretization.hxx"
41 #include "MEDCouplingTypemaps.i"
43 #include "InterpKernelAutoPtr.hxx"
45 using namespace ParaMEDMEM;
46 using namespace INTERP_KERNEL;
49 %template(ivec) std::vector<int>;
50 %template(dvec) std::vector<double>;
51 %template(svec) std::vector<std::string>;
53 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
55 $result=convertMesh($1,$owner);
58 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
60 $result=convertMesh($1,$owner);
63 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
65 $result=convertFieldDiscretization($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
70 $result=convertMultiFields($1,$owner);
74 %init %{ import_array(); %}
77 %feature("autodoc", "1");
78 %feature("docstring");
80 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
81 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
82 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
83 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
84 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
85 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
86 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
87 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
88 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
89 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
90 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
91 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
92 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
93 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
94 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
95 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
96 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
97 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
98 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
99 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
100 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
101 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
102 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
103 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
104 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
105 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
106 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
107 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
108 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
109 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
110 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
111 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
112 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
113 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
114 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
115 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator+;
116 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator-;
117 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator*;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator/;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
124 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
125 %newobject ParaMEDMEM::DataArrayInt::New;
126 %newobject ParaMEDMEM::DataArrayInt::__iter__;
127 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
128 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
129 %newobject ParaMEDMEM::DataArrayInt::performCpy;
130 %newobject ParaMEDMEM::DataArrayInt::substr;
131 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
132 %newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
133 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
134 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
135 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
136 %newobject ParaMEDMEM::DataArrayInt::selectByTupleRanges;
137 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
138 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
139 %newobject ParaMEDMEM::DataArrayInt::renumber;
140 %newobject ParaMEDMEM::DataArrayInt::renumberR;
141 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
142 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
143 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
144 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
145 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
146 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
147 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
148 %newobject ParaMEDMEM::DataArrayInt::negate;
149 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
150 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
151 %newobject ParaMEDMEM::DataArrayInt::Meld;
152 %newobject ParaMEDMEM::DataArrayInt::Add;
153 %newobject ParaMEDMEM::DataArrayInt::Substract;
154 %newobject ParaMEDMEM::DataArrayInt::Multiply;
155 %newobject ParaMEDMEM::DataArrayInt::Divide;
156 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
157 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
158 %newobject ParaMEDMEM::DataArrayInt::Range;
159 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
160 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
161 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
162 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
163 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
164 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
165 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
166 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
167 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
168 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
169 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
170 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
171 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
172 %newobject ParaMEDMEM::DataArrayInt::__neg__;
173 %newobject ParaMEDMEM::DataArrayInt::__add__;
174 %newobject ParaMEDMEM::DataArrayInt::__radd__;
175 %newobject ParaMEDMEM::DataArrayInt::__sub__;
176 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
177 %newobject ParaMEDMEM::DataArrayInt::__mul__;
178 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
179 %newobject ParaMEDMEM::DataArrayInt::__div__;
180 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
181 %newobject ParaMEDMEM::DataArrayInt::__mod__;
182 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
183 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
184 %newobject ParaMEDMEM::DataArrayDouble::New;
185 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
186 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
187 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
188 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
189 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
190 %newobject ParaMEDMEM::DataArrayDouble::Meld;
191 %newobject ParaMEDMEM::DataArrayDouble::Dot;
192 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
193 %newobject ParaMEDMEM::DataArrayDouble::Add;
194 %newobject ParaMEDMEM::DataArrayDouble::Substract;
195 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
196 %newobject ParaMEDMEM::DataArrayDouble::Divide;
197 %newobject ParaMEDMEM::DataArrayDouble::substr;
198 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
199 %newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
200 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
201 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
202 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
203 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
204 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
205 %newobject ParaMEDMEM::DataArrayDouble::negate;
206 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
207 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
208 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
209 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
210 %newobject ParaMEDMEM::DataArrayDouble::determinant;
211 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
212 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
213 %newobject ParaMEDMEM::DataArrayDouble::inverse;
214 %newobject ParaMEDMEM::DataArrayDouble::trace;
215 %newobject ParaMEDMEM::DataArrayDouble::deviator;
216 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
217 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
218 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
219 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
220 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
221 %newobject ParaMEDMEM::DataArrayDouble::renumber;
222 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
223 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
224 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
225 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
226 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
227 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
228 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
229 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
230 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
231 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
232 %newobject ParaMEDMEM::DataArrayDouble::__add__;
233 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
234 %newobject ParaMEDMEM::DataArrayDouble::__sub__;
235 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
236 %newobject ParaMEDMEM::DataArrayDouble::__mul__;
237 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
238 %newobject ParaMEDMEM::DataArrayDouble::__div__;
239 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
240 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
241 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
242 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
243 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
244 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
245 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
246 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
247 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
248 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
249 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
250 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
251 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
252 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
253 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
254 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
255 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
256 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
257 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
258 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
259 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
260 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::giveCellsWithType;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::computeNbOfNodesPerCell;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
293 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
294 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
295 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
296 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
297 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
298 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
301 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
302 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
303 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
304 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
308 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
309 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
310 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
312 %feature("unref") DataArrayDouble "$this->decrRef();"
313 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
314 %feature("unref") MEDCouplingMesh "$this->decrRef();"
315 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
316 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
317 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
318 %feature("unref") DataArrayInt "$this->decrRef();"
319 %feature("unref") MEDCouplingField "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
325 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
326 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
327 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
328 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
330 %rename(assign) *::operator=;
331 %ignore ParaMEDMEM::RefCountObject::decrRef;
332 %ignore ParaMEDMEM::MemArray::operator=;
333 %ignore ParaMEDMEM::MemArray::operator[];
334 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
335 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
336 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
337 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
338 %ignore ParaMEDMEM::DataArrayIntIterator::nextt;
339 %ignore ParaMEDMEM::DataArrayIntTuple::repr;
340 %ignore ParaMEDMEM::DataArrayIntTuple::intValue;
341 %ignore ParaMEDMEM::DataArrayDoubleIterator::nextt;
342 %ignore ParaMEDMEM::DataArrayDoubleTuple::repr;
343 %ignore ParaMEDMEM::DataArrayDoubleTuple::doubleValue;
344 %ignore ParaMEDMEM::DataArrayDouble::writeVTK;
345 %ignore ParaMEDMEM::DataArrayInt::writeVTK;
346 %ignore ParaMEDMEM::DataArrayDouble::SetArrayIn;
347 %ignore ParaMEDMEM::DataArrayInt::SetArrayIn;
351 %rename (InterpKernelException) INTERP_KERNEL::Exception;
353 namespace INTERP_KERNEL
358 Exception(const char* what);
359 ~Exception() throw ();
360 const char *what() const throw ();
363 std::string __str__() const
365 return std::string(self->what());
371 %include "MEDCouplingTimeLabel.hxx"
372 %include "MEDCouplingRefCountObject.hxx"
379 UNSTRUCTURED_DESC = 6,
382 } MEDCouplingMeshType;
385 class DataArrayDouble;
386 class MEDCouplingUMesh;
387 class MEDCouplingFieldDouble;
389 %extend RefCountObject
391 std::string getHiddenCppPointer() const
393 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
398 class MEDCouplingMesh : public RefCountObject, public TimeLabel
401 void setName(const char *name);
402 const char *getName() const;
403 void setDescription(const char *descr);
404 const char *getDescription() const;
405 void setTime(double val, int iteration, int order);
406 void setTimeUnit(const char *unit);
407 const char *getTimeUnit() const;
408 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
409 bool isStructured() const throw(INTERP_KERNEL::Exception);
410 virtual MEDCouplingMesh *deepCpy() const;
411 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
412 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
414 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
415 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
416 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
418 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
419 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
420 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
421 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
424 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
425 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
426 virtual std::string simpleRepr() const;
427 virtual std::string advancedRepr() const;
428 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
431 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
433 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
438 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
439 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
440 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
441 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
444 std::string __str__() const
446 return self->simpleRepr();
449 PyObject *getTime() throw(INTERP_KERNEL::Exception)
452 double tmp0=self->getTime(tmp1,tmp2);
453 PyObject *res = PyList_New(3);
454 PyList_SetItem(res,0,SWIG_From_double(tmp0));
455 PyList_SetItem(res,1,SWIG_From_int(tmp1));
456 PyList_SetItem(res,2,SWIG_From_int(tmp2));
460 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
464 DataArrayDoubleTuple *aa;
465 std::vector<double> bb;
467 int spaceDim=self->getSpaceDimension();
468 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
469 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
470 return self->getCellContainingPoint(pos,eps);
473 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
477 DataArrayDoubleTuple *aa;
478 std::vector<double> bb;
480 int spaceDim=self->getSpaceDimension();
481 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
482 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
483 std::vector<int> elts,eltsIndex;
484 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
485 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
486 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
487 d0->alloc(elts.size(),1);
488 d1->alloc(eltsIndex.size(),1);
489 std::copy(elts.begin(),elts.end(),d0->getPointer());
490 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
491 PyObject *ret=PyTuple_New(2);
492 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
493 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
499 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
501 std::vector<int> elts,eltsIndex;
502 int spaceDim=self->getSpaceDimension();
504 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
505 if (!SWIG_IsOK(res1))
508 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
509 int nbOfPoints=size/spaceDim;
512 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
514 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
518 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
520 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
521 da2->checkAllocated();
522 int size=da2->getNumberOfTuples();
523 int nbOfCompo=da2->getNumberOfComponents();
524 if(nbOfCompo!=spaceDim)
526 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
528 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
530 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
531 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
532 d0->alloc(elts.size(),1);
533 d1->alloc(eltsIndex.size(),1);
534 std::copy(elts.begin(),elts.end(),d0->getPointer());
535 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
536 PyObject *ret=PyTuple_New(2);
537 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
538 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
544 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
548 DataArrayDoubleTuple *aa;
549 std::vector<double> bb;
551 int spaceDim=self->getSpaceDimension();
552 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
553 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
554 std::vector<int> elts;
555 self->getCellsContainingPoint(pos,eps,elts);
556 DataArrayInt *ret=DataArrayInt::New();
557 ret->alloc((int)elts.size(),1);
558 std::copy(elts.begin(),elts.end(),ret->getPointer());
559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
562 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
565 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
566 if (!SWIG_IsOK(res1))
569 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
570 self->renumberCells(tmp,check);
574 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
576 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
577 da2->checkAllocated();
578 self->renumberCells(da2->getConstPointer(),check);
582 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
584 DataArrayInt *cellCor, *nodeCor;
585 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
586 PyObject *res = PyList_New(2);
587 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
588 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
591 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
594 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
595 if (!SWIG_IsOK(res1))
598 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
599 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
603 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
605 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
606 da2->checkAllocated();
607 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
610 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
612 std::vector<int> conn;
613 self->getNodeIdsOfCell(cellId,conn);
614 return convertIntArrToPyList2(conn);
617 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
619 std::vector<double> coo;
620 self->getCoordinatesOfNode(nodeId,coo);
621 return convertDblArrToPyList2(coo);
624 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
628 DataArrayDoubleTuple *aa;
629 std::vector<double> bb;
631 int spaceDim=self->getSpaceDimension();
632 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
633 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
634 self->scale(pointPtr,factor);
637 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
639 int spaceDim=self->getSpaceDimension();
640 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
641 self->getBoundingBox(tmp);
642 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
646 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
649 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
650 PyObject *ret=PyTuple_New(2);
651 PyObject *ret0Py=ret0?Py_True:Py_False;
653 PyTuple_SetItem(ret,0,ret0Py);
654 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
658 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
661 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
662 if (!SWIG_IsOK(res1))
665 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
666 MEDCouplingMesh *ret=self->buildPart(tmp,((const int *)tmp)+size);
667 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
671 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
673 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
674 da2->checkAllocated();
675 MEDCouplingMesh *ret=self->buildPart(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
676 ret->setName(da2->getName().c_str());
677 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
681 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
685 MEDCouplingMesh *ret=0;
686 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
687 if (!SWIG_IsOK(res1))
690 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
691 ret=self->buildPartAndReduceNodes(tmp,((const int *)tmp)+size,arr);
695 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
697 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
698 da2->checkAllocated();
699 ret=self->buildPartAndReduceNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),arr);
700 ret->setName(da2->getName().c_str());
702 PyObject *res = PyList_New(2);
703 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
704 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
705 PyList_SetItem(res,0,obj0);
706 PyList_SetItem(res,1,obj1);
710 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
712 std::vector<int> vals=self->getDistributionOfTypes();
713 PyObject *ret=PyList_New((int)vals.size()/3);
714 for(int j=0;j<(int)vals.size()/3;j++)
716 PyObject *ret1=PyList_New(3);
717 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
718 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
719 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
720 PyList_SetItem(ret,j,ret1);
725 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
727 std::vector<int> code;
728 std::vector<const DataArrayInt *> idsPerType;
729 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
730 convertPyToNewIntArr4(li,1,3,code);
731 return self->checkTypeConsistencyAndContig(code,idsPerType);
734 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
736 std::vector<int> code;
737 std::vector<DataArrayInt *> idsInPflPerType;
738 std::vector<DataArrayInt *> idsPerType;
739 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
740 PyObject *ret=PyTuple_New(3);
741 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
742 PyObject *ret1=PyList_New(idsInPflPerType.size());
743 for(std::size_t j=0;j<idsInPflPerType.size();j++)
744 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
745 PyTuple_SetItem(ret,1,ret1);
746 int n=idsPerType.size();
747 PyObject *ret2=PyList_New(n);
749 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
750 PyTuple_SetItem(ret,2,ret2);
754 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
758 DataArrayDoubleTuple *aa;
759 std::vector<double> bb;
761 int spaceDim=self->getSpaceDimension();
762 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
763 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
764 self->translate(vectorPtr);
767 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
769 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
772 DataArrayDoubleTuple *aa;
773 std::vector<double> bb;
775 int spaceDim=self->getSpaceDimension();
776 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
777 self->rotate(centerPtr,0,alpha);
780 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
782 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
785 DataArrayDoubleTuple *aa;
786 std::vector<double> bb;
788 int spaceDim=self->getSpaceDimension();
789 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
790 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,false);
791 self->rotate(centerPtr,vectorPtr,alpha);
794 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
796 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
797 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
798 PyObject *res=PyList_New(result.size());
799 for(int i=0;iL!=result.end(); i++, iL++)
800 PyList_SetItem(res,i,PyInt_FromLong(*iL));
804 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
806 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
807 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
808 return MEDCouplingMesh::MergeMeshes(tmp);
814 %extend ParaMEDMEM::DataArray
816 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
818 const std::vector<std::string>& comps=self->getInfoOnComponents();
819 PyObject *ret=PyList_New((int)comps.size());
820 for(int i=0;i<(int)comps.size();i++)
821 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
825 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
827 std::vector<int> tmp;
828 convertPyToNewIntArr3(li,tmp);
829 self->copyPartOfStringInfoFrom(other,tmp);
832 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
834 std::vector<int> tmp;
835 convertPyToNewIntArr3(li,tmp);
836 self->copyPartOfStringInfoFrom2(tmp,other);
840 %extend ParaMEDMEM::DataArrayInt
842 PyObject *getDifferentValues() const throw(INTERP_KERNEL::Exception)
844 std::set<int> ret=self->getDifferentValues();
845 return convertIntArrToPyList3(ret);
849 %ignore ParaMEDMEM::DataArray::getInfoOnComponents;
850 %ignore ParaMEDMEM::DataArrayInt::getDifferentValues;
852 %include "MEDCouplingMemArray.hxx"
853 %include "NormalizedUnstructuredMesh.hxx"
854 %include "MEDCouplingNatureOfField.hxx"
855 %include "MEDCouplingTimeDiscretization.hxx"
856 %include "MEDCouplingFieldDiscretization.hxx"
857 %include "MEDCouplingGaussLocalization.hxx"
861 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
864 void updateTime() const;
865 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
866 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
867 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
868 void zipCoords() throw(INTERP_KERNEL::Exception);
869 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
870 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
871 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
872 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
873 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
874 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
875 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
876 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
877 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
878 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
879 //! size of returned tinyInfo must be always the same.
880 void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
881 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
882 void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception);
883 void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
884 const std::vector<std::string>& littleStrings) throw(INTERP_KERNEL::Exception);
885 virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) throw(INTERP_KERNEL::Exception);
886 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
887 virtual DataArrayInt *findBoundaryNodes() const;
890 std::string __str__() const
892 return self->simpleRepr();
895 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
898 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
899 PyObject *res = PyList_New(2);
900 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
901 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
905 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
907 DataArrayInt *comm, *commIndex;
908 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
909 PyObject *res = PyList_New(2);
910 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
911 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
915 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
917 DataArrayDouble *ret1=self->getCoords();
919 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
921 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
924 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
925 if (!SWIG_IsOK(res1))
928 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
929 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,((const int *)tmp)+size,keepCoords);
930 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
934 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
936 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
937 da2->checkAllocated();
938 MEDCouplingPointSet *ret=self->buildPartOfMySelf(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),keepCoords);
939 ret->setName(da2->getName().c_str());
940 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
943 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
946 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
947 if (!SWIG_IsOK(res1))
950 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
951 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
952 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
956 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
958 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
959 da2->checkAllocated();
960 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
961 ret->setName(da2->getName().c_str());
962 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
965 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
968 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
969 if (!SWIG_IsOK(res1))
972 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
973 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
974 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
978 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
980 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
981 da2->checkAllocated();
982 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
983 ret->setName(da2->getName().c_str());
984 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
988 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
991 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
992 if (!SWIG_IsOK(res1))
995 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
996 self->renumberNodes(tmp,newNbOfNodes);
1000 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1002 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1003 da2->checkAllocated();
1004 self->renumberNodes(da2->getConstPointer(),newNbOfNodes);
1007 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1010 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1011 if (!SWIG_IsOK(res1))
1014 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1015 self->renumberNodes2(tmp,newNbOfNodes);
1019 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1021 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1022 da2->checkAllocated();
1023 self->renumberNodes2(da2->getConstPointer(),newNbOfNodes);
1026 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1028 int spaceDim=self->getSpaceDimension();
1030 DataArrayDouble *a,*a2;
1031 DataArrayDoubleTuple *aa,*aa2;
1032 std::vector<double> bb,bb2;
1034 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1035 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1036 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1037 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1038 std::vector<int> nodes;
1039 self->findNodesOnLine(p,v,eps,nodes);
1040 DataArrayInt *ret=DataArrayInt::New();
1041 ret->alloc((int)nodes.size(),1);
1042 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1043 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1045 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1047 int spaceDim=self->getSpaceDimension();
1049 DataArrayDouble *a,*a2;
1050 DataArrayDoubleTuple *aa,*aa2;
1051 std::vector<double> bb,bb2;
1053 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1054 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1055 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1056 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1057 std::vector<int> nodes;
1058 self->findNodesOnPlane(p,v,eps,nodes);
1059 DataArrayInt *ret=DataArrayInt::New();
1060 ret->alloc((int)nodes.size(),1);
1061 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1062 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1064 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1068 DataArrayDoubleTuple *aa;
1069 std::vector<double> bb;
1071 int spaceDim=self->getSpaceDimension();
1072 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1073 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1074 std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
1075 DataArrayInt *ret=DataArrayInt::New();
1076 ret->alloc((int)tmp.size(),1);
1077 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1081 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
1083 std::vector<int> c,cI;
1087 DataArrayDoubleTuple *aa;
1088 std::vector<double> bb;
1090 int spaceDim=self->getSpaceDimension();
1091 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1092 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
1093 self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
1094 PyObject *ret=PyTuple_New(2);
1095 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1096 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1097 d0->alloc(c.size(),1);
1098 d1->alloc(cI.size(),1);
1099 std::copy(c.begin(),c.end(),d0->getPointer());
1100 std::copy(cI.begin(),cI.end(),d1->getPointer());
1101 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1102 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1108 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1110 std::vector<int> c,cI;
1111 int spaceDim=self->getSpaceDimension();
1113 int res1=SWIG_ConvertPtr(pt,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1114 if (!SWIG_IsOK(res1))
1117 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(pt,&size);
1118 int nbOfPoints=size/spaceDim;
1119 if(size%spaceDim!=0)
1121 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
1123 self->getNodeIdsNearPoints(tmp,nbOfPoints,eps,c,cI);
1127 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
1129 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
1130 da2->checkAllocated();
1131 int size=da2->getNumberOfTuples();
1132 int nbOfCompo=da2->getNumberOfComponents();
1133 if(nbOfCompo!=spaceDim)
1135 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
1137 self->getNodeIdsNearPoints(da2->getConstPointer(),size,eps,c,cI);
1139 PyObject *ret=PyTuple_New(2);
1140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1141 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1142 d0->alloc(c.size(),1);
1143 d1->alloc(cI.size(),1);
1144 std::copy(c.begin(),c.end(),d0->getPointer());
1145 std::copy(cI.begin(),cI.end(),d1->getPointer());
1146 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1147 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1153 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1155 std::vector<int> elems;
1160 DataArrayDoubleTuple *aa;
1161 std::vector<double> bb;
1163 int spaceDim=self->getSpaceDimension();
1164 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1165 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1167 self->getCellsInBoundingBox(tmp,eps,elems);
1168 DataArrayInt *ret=DataArrayInt::New();
1169 ret->alloc((int)elems.size(),1);
1170 std::copy(elems.begin(),elems.end(),ret->getPointer());
1171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1174 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1178 std::vector<int> multiVal;
1179 std::pair<int, std::pair<int,int> > slic;
1180 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1181 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1185 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1187 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1189 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1191 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1195 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1198 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1199 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1200 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1201 for(int i=0;i<sz;i++)
1202 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1204 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1207 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1208 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1209 double *v=convertPyToNewDblArr2(vect,&sz2);
1210 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1211 for(int i=0;i<sz;i++)
1212 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1217 class MEDCouplingUMeshCell
1220 INTERP_KERNEL::NormalizedCellType getType() const;
1223 std::string __str__() const
1225 return self->repr();
1228 PyObject *getAllConn() const
1231 const int *r=self->getAllConn(ret2);
1232 PyObject *ret=PyTuple_New(ret2);
1233 for(int i=0;i<ret2;i++)
1234 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1240 class MEDCouplingUMeshCellIterator
1247 MEDCouplingUMeshCell *ret=self->nextt();
1249 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1252 PyErr_SetString(PyExc_StopIteration,"No more data.");
1259 class MEDCouplingUMeshCellByTypeIterator
1262 ~MEDCouplingUMeshCellByTypeIterator();
1267 MEDCouplingUMeshCellEntry *ret=self->nextt();
1269 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1272 PyErr_SetString(PyExc_StopIteration,"No more data.");
1279 class MEDCouplingUMeshCellByTypeEntry
1282 ~MEDCouplingUMeshCellByTypeEntry();
1285 MEDCouplingUMeshCellByTypeIterator *__iter__()
1287 return self->iterator();
1292 class MEDCouplingUMeshCellEntry
1295 INTERP_KERNEL::NormalizedCellType getType() const;
1296 int getNumberOfElems() const;
1299 MEDCouplingUMeshCellIterator *__iter__()
1301 return self->iterator();
1306 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1309 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1310 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1311 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1312 void updateTime() const;
1313 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1314 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1315 void allocateCells(int nbOfCells) throw(INTERP_KERNEL::Exception);
1316 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1317 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1318 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1319 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1320 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1321 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1322 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1323 void computeTypes() throw(INTERP_KERNEL::Exception);
1324 DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
1325 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1326 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1328 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1329 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1330 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1331 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1332 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1333 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1334 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1335 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1336 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1337 DataArrayInt *zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception);
1338 DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
1339 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1340 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1341 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1342 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1343 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1344 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1345 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1346 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1347 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1348 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1349 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1350 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1351 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1352 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1353 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1354 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1355 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1356 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1357 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1358 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1359 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1361 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1363 return MEDCouplingUMesh::New();
1366 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1368 return MEDCouplingUMesh::New(meshName,meshDim);
1371 std::string __str__() const
1373 return self->simpleRepr();
1376 MEDCouplingUMeshCellIterator *__iter__()
1378 return self->cellIterator();
1381 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1385 std::vector<int> multiVal;
1386 std::pair<int, std::pair<int,int> > slic;
1387 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1388 int nbc=self->getNumberOfCells();
1389 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1396 std::ostringstream oss;
1397 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1398 throw INTERP_KERNEL::Exception(oss.str().c_str());
1401 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1406 int tmp=nbc+singleVal;
1407 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1411 std::ostringstream oss;
1412 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1413 throw INTERP_KERNEL::Exception(oss.str().c_str());
1419 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1423 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1428 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1429 daIntTyypp->checkAllocated();
1430 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1433 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1437 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1441 std::vector<int> multiVal;
1442 std::pair<int, std::pair<int,int> > slic;
1443 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1444 int nbc=self->getNumberOfCells();
1445 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1452 std::ostringstream oss;
1453 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1454 throw INTERP_KERNEL::Exception(oss.str().c_str());
1458 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1465 int tmp=nbc+singleVal;
1466 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1471 std::ostringstream oss;
1472 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1473 throw INTERP_KERNEL::Exception(oss.str().c_str());
1479 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1485 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1486 daIntTyypp->checkAllocated();
1487 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1491 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1495 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1499 std::vector<int> multiVal;
1500 std::pair<int, std::pair<int,int> > slic;
1501 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1502 int nbc=self->getNumberOfCells();
1503 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1510 std::ostringstream oss;
1511 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1512 throw INTERP_KERNEL::Exception(oss.str().c_str());
1516 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1523 int tmp=nbc+singleVal;
1524 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1529 std::ostringstream oss;
1530 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1531 throw INTERP_KERNEL::Exception(oss.str().c_str());
1537 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1542 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1548 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1549 daIntTyypp->checkAllocated();
1550 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1554 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1558 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1561 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1564 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << sz << " !";
1565 throw INTERP_KERNEL::Exception(oss.str().c_str());
1567 self->insertNextCell(type,size,tmp);
1570 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1573 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1574 self->insertNextCell(type,sz,tmp);
1577 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1579 DataArrayInt *ret=self->getNodalConnectivity();
1584 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1586 DataArrayInt *ret=self->getNodalConnectivityIndex();
1591 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1593 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1594 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1595 PyObject *res = PyList_New(result.size());
1596 for (int i=0;iL!=result.end(); i++, iL++)
1597 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1600 PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1604 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1605 PyObject *res = PyList_New(3);
1606 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1607 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1608 PyList_SetItem(res,2,SWIG_From_int(ret2));
1611 PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1615 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1616 PyObject *res = PyList_New(3);
1617 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1618 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1619 PyList_SetItem(res,2,SWIG_From_int(ret2));
1622 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1624 std::vector<int> cells;
1625 self->checkButterflyCells(cells,eps);
1626 DataArrayInt *ret=DataArrayInt::New();
1627 ret->alloc((int)cells.size(),1);
1628 std::copy(cells.begin(),cells.end(),ret->getPointer());
1629 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1632 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1634 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1636 PyObject *ret = PyList_New(sz);
1637 for(int i=0;i<sz;i++)
1638 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1642 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1644 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1645 int sz=retCpp.size();
1646 PyObject *ret=PyList_New(sz);
1647 for(int i=0;i<sz;i++)
1648 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1652 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1655 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1656 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1657 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1660 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1663 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1664 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1668 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1671 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1672 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1676 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1678 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1679 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1680 PyObject *ret=PyTuple_New(3);
1681 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1682 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1683 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1687 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1689 DataArrayInt *tmp0=0,*tmp1=0;
1690 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1691 PyObject *ret=PyTuple_New(2);
1692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1697 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1701 std::vector<int> multiVal;
1702 std::pair<int, std::pair<int,int> > slic;
1703 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1704 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1708 return self->duplicateNodes(&singleVal,&singleVal+1);
1710 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1712 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1714 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1718 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1722 std::vector<int> multiVal;
1723 std::pair<int, std::pair<int,int> > slic;
1724 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1725 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1729 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1731 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1733 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1735 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1739 void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1742 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1743 if (!SWIG_IsOK(res1))
1746 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1747 self->renumberNodesInConn(tmp);
1751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1753 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1754 da2->checkAllocated();
1755 self->renumberNodesInConn(da2->getConstPointer());
1759 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1762 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1763 DataArrayInt *tmp0,*tmp1=0;
1764 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1765 PyObject *ret=PyTuple_New(2);
1766 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1767 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1771 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1773 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1774 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1775 DataArrayInt *ret1=0,*ret2=0;
1776 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1777 PyObject *ret=PyTuple_New(3);
1778 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1779 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1780 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1784 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1786 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1787 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1788 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1789 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1792 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1795 std::vector<const MEDCouplingUMesh *> meshes;
1796 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1797 std::vector<DataArrayInt *> corr;
1798 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1800 PyObject *ret1=PyList_New(sz);
1801 for(int i=0;i<sz;i++)
1802 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1803 PyObject *ret=PyList_New(2);
1804 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1805 PyList_SetItem(ret,1,ret1);
1809 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1811 std::vector<MEDCouplingUMesh *> meshes;
1812 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1813 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1816 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1818 std::vector<MEDCouplingUMesh *> meshes;
1819 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1820 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1823 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1827 std::vector<int> multiVal;
1828 std::pair<int, std::pair<int,int> > slic;
1829 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1831 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1832 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1836 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
1838 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
1840 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
1842 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1846 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
1848 DataArrayInt *arrOut=0,*arrIndexOut=0;
1851 std::vector<int> multiVal;
1852 std::pair<int, std::pair<int,int> > slic;
1853 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1855 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
1856 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1861 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
1866 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1871 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1875 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1877 PyObject *ret=PyTuple_New(2);
1878 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1879 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1883 static PyObject *SetPartOfIndexedArrays(PyObject *li,
1884 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
1885 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
1887 DataArrayInt *arrOut=0,*arrIndexOut=0;
1890 std::vector<int> multiVal;
1891 std::pair<int, std::pair<int,int> > slic;
1892 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1894 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
1895 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1900 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1905 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1910 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1914 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1916 PyObject *ret=PyTuple_New(2);
1917 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1922 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
1923 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
1927 std::vector<int> multiVal;
1928 std::pair<int, std::pair<int,int> > slic;
1929 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1931 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
1932 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1937 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
1942 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
1947 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
1951 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1955 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
1959 DataArrayDoubleTuple *aa;
1960 std::vector<double> bb;
1962 int spaceDim=self->getSpaceDimension();
1963 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
1964 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
1966 std::vector<int> cells;
1967 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
1968 DataArrayInt *ret=DataArrayInt::New();
1969 ret->alloc((int)cells.size(),1);
1970 std::copy(cells.begin(),cells.end(),ret->getPointer());
1971 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1974 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
1978 DataArrayDoubleTuple *aa;
1979 std::vector<double> bb;
1981 int spaceDim=self->getSpaceDimension();
1982 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
1983 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
1984 self->orientCorrectly2DCells(v,polyOnly);
1987 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
1989 std::vector<int> cells;
1990 self->arePolyhedronsNotCorrectlyOriented(cells);
1991 DataArrayInt *ret=DataArrayInt::New();
1992 ret->alloc((int)cells.size(),1);
1993 std::copy(cells.begin(),cells.end(),ret->getPointer());
1994 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1997 PyObject *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
1999 std::vector<int> cells;
2000 self->findAndCorrectBadOriented3DExtrudedCells(cells);
2001 DataArrayInt *ret=DataArrayInt::New();
2002 ret->alloc((int)cells.size(),1);
2003 std::copy(cells.begin(),cells.end(),ret->getPointer());
2004 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2007 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2011 self->getFastAveragePlaneOfThis(vec,pos);
2013 std::copy(vec,vec+3,vals);
2014 std::copy(pos,pos+3,vals+3);
2015 return convertDblArrToPyListOfTuple(vals,3,2);
2018 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2020 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2021 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2022 return MEDCouplingUMesh::MergeUMeshes(tmp);
2025 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2028 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2029 PyObject *ret=PyTuple_New(2);
2030 PyObject *ret0Py=ret0?Py_True:Py_False;
2032 PyTuple_SetItem(ret,0,ret0Py);
2033 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2037 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2040 bool ret0=self->areCellsIncludedIn2(other,ret1);
2041 PyObject *ret=PyTuple_New(2);
2042 PyObject *ret0Py=ret0?Py_True:Py_False;
2044 PyTuple_SetItem(ret,0,ret0Py);
2045 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2049 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2051 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2052 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2053 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2055 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2056 PyObject *ret=PyTuple_New(5);
2057 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2058 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2059 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2061 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2071 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2072 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2073 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2074 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2075 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2076 PyObject *ret=PyTuple_New(5);
2077 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2078 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2080 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2081 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2089 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2091 DataArrayInt *neighbors=0,*neighborsIdx=0;
2092 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2093 PyObject *ret=PyTuple_New(2);
2094 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2095 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2099 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2101 DataArrayInt *neighbors=0,*neighborsIdx=0;
2102 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2103 PyObject *ret=PyTuple_New(2);
2104 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2105 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2109 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2111 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2112 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2113 DataArrayInt *d2,*d3,*d4,*dd5;
2114 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2115 PyObject *ret=PyTuple_New(7);
2116 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2117 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2118 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2119 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2120 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2121 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2122 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2128 PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2130 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2132 self->getReverseNodalConnectivity(d0,d1);
2133 PyObject *ret=PyTuple_New(2);
2134 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2135 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2141 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2144 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2145 da->checkAllocated();
2146 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2149 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2152 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2153 da->checkAllocated();
2154 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2157 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2160 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2161 da->checkAllocated();
2162 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2165 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2168 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2169 da->checkAllocated();
2170 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2171 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2172 PyObject *res = PyList_New(result.size());
2173 for (int i=0;iL!=result.end(); i++, iL++)
2174 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2178 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2181 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2182 da->checkAllocated();
2183 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2184 ret->setName(da->getName().c_str());
2188 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2191 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2192 if (!SWIG_IsOK(res1))
2195 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2196 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
2200 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2202 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2203 da2->checkAllocated();
2204 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
2208 PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
2211 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
2212 PyObject *ret=PyTuple_New(2);
2213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2218 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2220 DataArrayInt *cellNb1=0,*cellNb2=0;
2221 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2222 PyObject *ret=PyTuple_New(3);
2223 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2224 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2225 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2229 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2231 int spaceDim=self->getSpaceDimension();
2233 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2235 DataArrayDouble *a,*a2;
2236 DataArrayDoubleTuple *aa,*aa2;
2237 std::vector<double> bb,bb2;
2239 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2240 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2241 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2242 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2244 DataArrayInt *cellIds=0;
2245 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2246 PyObject *ret=PyTuple_New(2);
2247 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2248 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2252 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2254 int spaceDim=self->getSpaceDimension();
2256 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2258 DataArrayDouble *a,*a2;
2259 DataArrayDoubleTuple *aa,*aa2;
2260 std::vector<double> bb,bb2;
2262 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2263 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2264 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2265 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2267 DataArrayInt *cellIds=0;
2268 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2269 PyObject *ret=PyTuple_New(2);
2270 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2277 int spaceDim=self->getSpaceDimension();
2279 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2281 DataArrayDouble *a,*a2;
2282 DataArrayDoubleTuple *aa,*aa2;
2283 std::vector<double> bb,bb2;
2285 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2286 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2287 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2288 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2289 return self->getCellIdsCrossingPlane(orig,vect,eps);
2292 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2296 std::vector<int> pos2;
2297 DataArrayInt *pos3=0;
2298 DataArrayIntTuple *pos4=0;
2299 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2304 self->convertToPolyTypes(&pos1,&pos1+1);
2311 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2316 self->convertToPolyTypes(pos3->begin(),pos3->end());
2320 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2324 void convertAllToPoly();
2325 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2326 bool unPolyze() throw(INTERP_KERNEL::Exception);
2327 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2328 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2329 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2332 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2335 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2336 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2337 void updateTime() const throw(INTERP_KERNEL::Exception);
2339 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2341 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2344 std::string __str__() const
2346 return self->simpleRepr();
2348 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2350 MEDCouplingUMesh *ret=self->getMesh2D();
2352 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2354 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2356 MEDCouplingUMesh *ret=self->getMesh1D();
2358 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2360 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2362 DataArrayInt *ret=self->getMesh3DIds();
2364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2369 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingMesh
2372 static MEDCouplingCMesh *New();
2373 static MEDCouplingCMesh *New(const char *meshName);
2374 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2375 void setCoords(const DataArrayDouble *coordsX,
2376 const DataArrayDouble *coordsY=0,
2377 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2378 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2379 void updateTime() const throw(INTERP_KERNEL::Exception);
2383 return MEDCouplingCMesh::New();
2385 MEDCouplingCMesh(const char *meshName)
2387 return MEDCouplingCMesh::New(meshName);
2389 std::string __str__() const
2391 return self->simpleRepr();
2393 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2395 DataArrayDouble *ret=self->getCoordsAt(i);
2403 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2405 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2408 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2409 PyObject *ret=PyTuple_New(2);
2410 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2411 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2416 %extend ParaMEDMEM::DataArrayDoubleIterator
2420 DataArrayDoubleTuple *ret=self->nextt();
2422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2425 PyErr_SetString(PyExc_StopIteration,"No more data.");
2431 %extend ParaMEDMEM::DataArrayDoubleTuple
2433 std::string __str__() const
2435 return self->repr();
2438 double __float__() const throw(INTERP_KERNEL::Exception)
2440 return self->doubleValue();
2443 DataArrayDouble *buildDADouble()
2445 return self->buildDADouble(1,self->getNumberOfCompo());
2448 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2450 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2451 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2452 Py_XINCREF(trueSelf);
2456 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2458 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2459 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2460 Py_XINCREF(trueSelf);
2464 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2466 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2467 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2468 Py_XINCREF(trueSelf);
2472 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2474 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2475 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2476 Py_XINCREF(trueSelf);
2480 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2484 std::vector<int> multiVal;
2485 std::pair<int, std::pair<int,int> > slic;
2486 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2487 const double *pt=self->getConstPointer();
2488 int nbc=self->getNumberOfCompo();
2489 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2496 std::ostringstream oss;
2497 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2498 throw INTERP_KERNEL::Exception(oss.str().c_str());
2501 return PyFloat_FromDouble(pt[singleVal]);
2505 return PyFloat_FromDouble(pt[nbc+singleVal]);
2508 std::ostringstream oss;
2509 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2510 throw INTERP_KERNEL::Exception(oss.str().c_str());
2516 PyObject *t=PyTuple_New(multiVal.size());
2517 for(int j=0;j<(int)multiVal.size();j++)
2519 int cid=multiVal[j];
2522 std::ostringstream oss;
2523 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2524 throw INTERP_KERNEL::Exception(oss.str().c_str());
2526 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2532 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2533 PyObject *t=PyTuple_New(sz);
2534 for(int j=0;j<sz;j++)
2535 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2539 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2543 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2545 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2548 std::vector<double> multiValV;
2549 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2550 int nbc=self->getNumberOfCompo();
2551 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2553 std::vector<int> multiVal;
2554 std::pair<int, std::pair<int,int> > slic;
2555 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2556 double *pt=self->getPointer();
2557 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2564 std::ostringstream oss;
2565 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2566 throw INTERP_KERNEL::Exception(oss.str().c_str());
2572 pt[singleVal]=singleValV;
2577 if(multiValV.size()!=1)
2579 std::ostringstream oss;
2580 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2581 throw INTERP_KERNEL::Exception(oss.str().c_str());
2583 pt[singleVal]=multiValV[0];
2588 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2592 throw INTERP_KERNEL::Exception(msg);
2601 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2605 std::ostringstream oss;
2606 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2607 throw INTERP_KERNEL::Exception(oss.str().c_str());
2615 if(multiVal.size()!=multiValV.size())
2617 std::ostringstream oss;
2618 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2619 throw INTERP_KERNEL::Exception(oss.str().c_str());
2621 for(int i=0;i<(int)multiVal.size();i++)
2623 int pos=multiVal[i];
2626 std::ostringstream oss;
2627 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2628 throw INTERP_KERNEL::Exception(oss.str().c_str());
2630 pt[multiVal[i]]=multiValV[i];
2636 const double *ptV=daIntTyyppV->getConstPointer();
2637 if(nbc>daIntTyyppV->getNumberOfCompo())
2639 std::ostringstream oss;
2640 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2641 throw INTERP_KERNEL::Exception(oss.str().c_str());
2643 std::copy(ptV,ptV+nbc,pt);
2647 throw INTERP_KERNEL::Exception(msg);
2652 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2657 for(int j=0;j<sz;j++)
2658 pt[slic.first+j*slic.second.second]=singleValV;
2663 if(sz!=(int)multiValV.size())
2665 std::ostringstream oss;
2666 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2667 throw INTERP_KERNEL::Exception(oss.str().c_str());
2669 for(int j=0;j<sz;j++)
2670 pt[slic.first+j*slic.second.second]=multiValV[j];
2675 const double *ptV=daIntTyyppV->getConstPointer();
2676 if(sz>daIntTyyppV->getNumberOfCompo())
2678 std::ostringstream oss;
2679 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2680 throw INTERP_KERNEL::Exception(oss.str().c_str());
2682 for(int j=0;j<sz;j++)
2683 pt[slic.first+j*slic.second.second]=ptV[j];
2687 throw INTERP_KERNEL::Exception(msg);
2691 throw INTERP_KERNEL::Exception(msg);
2696 %extend ParaMEDMEM::DataArrayDouble
2698 DataArrayDouble() throw(INTERP_KERNEL::Exception)
2700 return DataArrayDouble::New();
2703 static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2705 const char *msg="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n--DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2) !";
2706 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2710 if(PyInt_Check(elt1))
2712 int nbOfTuples=PyInt_AS_LONG(elt1);
2714 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2717 if(PyInt_Check(elt2))
2718 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
2719 int nbOfCompo=PyInt_AS_LONG(elt2);
2721 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2723 double *tmp=new double[nbOfTuples*nbOfCompo];
2724 try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples*nbOfCompo,0.,true); }
2725 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2726 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
2731 throw INTERP_KERNEL::Exception(msg);
2734 {//DataArrayDouble.New([1.,3.,4.],3)
2735 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2736 double *tmp=new double[nbOfTuples];
2737 try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples,0.,true); }
2738 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2739 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
2745 throw INTERP_KERNEL::Exception(msg);
2748 {// DataArrayDouble.New([1.,3.,4.])
2750 if(PyList_Check(elt0))
2751 szz=PyList_Size(elt0);
2753 szz=PyTuple_Size(elt0);
2754 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2755 double *tmp=new double[szz];
2756 try { fillArrayWithPyListDbl(elt0,tmp,szz,0.,true); }
2757 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2758 ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
2763 else if(PyInt_Check(elt0))
2765 int nbOfTuples=PyInt_AS_LONG(elt0);
2767 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2772 if(PyInt_Check(elt1))
2773 {//DataArrayDouble.New(5,2)
2774 int nbOfCompo=PyInt_AS_LONG(elt1);
2776 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2777 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2778 ret->alloc(nbOfTuples,nbOfCompo);
2783 throw INTERP_KERNEL::Exception(msg);
2786 throw INTERP_KERNEL::Exception(msg);
2789 {//DataArrayDouble.New(5)
2790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2791 ret->alloc(nbOfTuples,1);
2797 throw INTERP_KERNEL::Exception(msg);
2800 DataArrayDouble(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2802 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,elt1,elt2);
2805 std::string __str__() const
2807 return self->repr();
2810 double __float__() const throw(INTERP_KERNEL::Exception)
2812 return self->doubleValue();
2815 int __len__() const throw(INTERP_KERNEL::Exception)
2817 if(self->isAllocated())
2819 return self->getNumberOfTuples();
2823 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
2827 DataArrayDoubleIterator *__iter__()
2829 return self->iterator();
2832 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
2834 double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
2837 fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
2839 catch(INTERP_KERNEL::Exception& e)
2844 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
2847 PyObject *getValues() throw(INTERP_KERNEL::Exception)
2849 const double *vals=self->getPointer();
2850 return convertDblArrToPyList(vals,self->getNbOfElems());
2853 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
2856 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
2857 PyObject *ret=PyTuple_New(2);
2858 PyObject *ret0Py=ret0?Py_True:Py_False;
2860 PyTuple_SetItem(ret,0,ret0Py);
2861 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2865 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
2867 const double *vals=self->getPointer();
2868 int nbOfComp=self->getNumberOfComponents();
2869 int nbOfTuples=self->getNumberOfTuples();
2870 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2873 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2876 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2877 if (!SWIG_IsOK(res1))
2880 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2881 if(size!=self->getNumberOfTuples())
2883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2885 return self->renumber(tmp);
2889 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2891 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2892 da2->checkAllocated();
2893 int size=self->getNumberOfTuples();
2894 if(size!=self->getNumberOfTuples())
2896 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2898 return self->renumber(da2->getConstPointer());
2902 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2905 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2906 if (!SWIG_IsOK(res1))
2909 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2910 if(size!=self->getNumberOfTuples())
2912 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2914 return self->renumberR(tmp);
2918 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2920 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2921 da2->checkAllocated();
2922 int size=self->getNumberOfTuples();
2923 if(size!=self->getNumberOfTuples())
2925 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2927 return self->renumberR(da2->getConstPointer());
2931 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2934 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2935 if (!SWIG_IsOK(res1))
2938 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2939 if(size!=self->getNumberOfTuples())
2941 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2943 return self->renumberAndReduce(tmp,newNbOfTuple);
2947 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2949 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2950 da2->checkAllocated();
2951 int size=self->getNumberOfTuples();
2952 if(size!=self->getNumberOfTuples())
2954 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2956 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2960 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
2963 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2964 if (!SWIG_IsOK(res1))
2967 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2968 if(size!=self->getNumberOfTuples())
2970 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2972 self->renumberInPlace(tmp);
2976 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2978 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2979 da2->checkAllocated();
2980 int size=self->getNumberOfTuples();
2981 if(size!=self->getNumberOfTuples())
2983 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2985 self->renumberInPlace(da2->getConstPointer());
2989 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
2992 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2993 if (!SWIG_IsOK(res1))
2996 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2997 if(size!=self->getNumberOfTuples())
2999 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3001 self->renumberInPlaceR(tmp);
3005 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3007 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3008 da2->checkAllocated();
3009 int size=self->getNumberOfTuples();
3010 if(size!=self->getNumberOfTuples())
3012 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3014 self->renumberInPlaceR(da2->getConstPointer());
3018 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
3021 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3022 if (!SWIG_IsOK(res1))
3025 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3026 return self->selectByTupleId(tmp,tmp+size);
3030 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3032 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3033 da2->checkAllocated();
3034 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3038 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
3041 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3042 if (!SWIG_IsOK(res1))
3045 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3046 return self->selectByTupleIdSafe(tmp,tmp+size);
3050 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3052 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3053 da2->checkAllocated();
3054 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3058 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3061 double r1=self->getMaxValue(tmp);
3062 PyObject *ret=PyTuple_New(2);
3063 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3064 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3068 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3071 double r1=self->getMaxValue2(tmp);
3072 PyObject *ret=PyTuple_New(2);
3073 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3074 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3078 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3081 double r1=self->getMinValue(tmp);
3082 PyObject *ret=PyTuple_New(2);
3083 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3084 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3088 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3091 double r1=self->getMinValue2(tmp);
3092 PyObject *ret=PyTuple_New(2);
3093 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3094 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3098 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
3100 int nbOfCompo=self->getNumberOfComponents();
3101 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
3102 self->getMinMaxPerComponent(tmp);
3103 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
3107 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3109 int sz=self->getNumberOfComponents();
3110 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3111 self->accumulate(tmp);
3112 return convertDblArrToPyList(tmp,sz);
3115 DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3117 std::vector<int> tmp;
3118 convertPyToNewIntArr3(li,tmp);
3119 return self->keepSelectedComponents(tmp);
3122 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
3124 DataArrayInt *comm, *commIndex;
3125 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
3126 PyObject *res = PyList_New(2);
3127 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3128 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3132 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3134 std::vector<int> tmp;
3135 convertPyToNewIntArr3(li,tmp);
3136 self->setSelectedComponents(a,tmp);
3139 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3141 int sz=self->getNumberOfComponents();
3142 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3143 self->getTuple(tupleId,tmp);
3144 return convertDblArrToPyList(tmp,sz);
3147 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3149 std::vector<const DataArrayDouble *> tmp;
3150 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3151 return DataArrayDouble::Aggregate(tmp);
3154 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3156 std::vector<const DataArrayDouble *> tmp;
3157 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3158 return DataArrayDouble::Meld(tmp);
3161 DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
3163 std::vector<std::pair<int,int> > ranges;
3164 convertPyToVectorPairInt(li,ranges);
3165 return self->selectByTupleRanges(ranges);
3168 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
3172 DataArrayDoubleTuple *aa;
3173 std::vector<double> bb;
3175 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
3176 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
3177 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
3178 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
3179 std::vector<int> c,cI;
3180 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
3181 DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
3182 ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
3183 ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
3184 PyObject *ret=PyTuple_New(2);
3185 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3186 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3190 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3192 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
3193 self->checkAllocated();
3194 int nbOfTuples=self->getNumberOfTuples();
3195 int nbOfComponents=self->getNumberOfComponents();
3197 std::vector<int> vt1,vc1;
3198 std::pair<int, std::pair<int,int> > pt1,pc1;
3199 DataArrayInt *dt1=0,*dc1=0;
3201 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3202 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
3206 if(nbOfComponents==1)
3207 return PyFloat_FromDouble(self->getIJSafe(it1,0));
3208 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3210 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3212 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3214 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3216 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
3219 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3220 std::vector<int> v2(1,ic1);
3221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3225 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3226 std::vector<int> v2(1,ic1);
3227 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3231 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3232 std::vector<int> v2(1,ic1);
3233 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3237 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3238 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3242 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3243 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3247 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3248 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3252 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3253 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3257 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3258 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3259 std::vector<int> v2(nbOfComp);
3260 for(int i=0;i<nbOfComp;i++)
3261 v2[i]=pc1.first+i*pc1.second.second;
3262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3266 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3267 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3268 std::vector<int> v2(nbOfComp);
3269 for(int i=0;i<nbOfComp;i++)
3270 v2[i]=pc1.first+i*pc1.second.second;
3271 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3275 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3276 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3277 std::vector<int> v2(nbOfComp);
3278 for(int i=0;i<nbOfComp;i++)
3279 v2[i]=pc1.first+i*pc1.second.second;
3280 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3284 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3285 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3286 std::vector<int> v2(nbOfComp);
3287 for(int i=0;i<nbOfComp;i++)
3288 v2[i]=pc1.first+i*pc1.second.second;
3289 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3292 throw INTERP_KERNEL::Exception(msg);
3296 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3298 self->checkAllocated();
3299 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
3300 int nbOfTuples=self->getNumberOfTuples();
3301 int nbOfComponents=self->getNumberOfComponents();
3304 std::vector<double> v1;
3305 DataArrayDouble *d1=0;
3306 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
3308 std::vector<int> vt1,vc1;
3309 std::pair<int, std::pair<int,int> > pt1,pc1;
3310 DataArrayInt *dt1=0,*dc1=0;
3311 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3312 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
3320 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3323 tmp=DataArrayDouble::New();
3324 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3325 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3328 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3331 throw INTERP_KERNEL::Exception(msg);
3340 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3343 tmp=DataArrayDouble::New();
3344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3345 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3348 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3351 throw INTERP_KERNEL::Exception(msg);
3360 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3363 tmp=DataArrayDouble::New();
3364 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3365 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3368 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3371 throw INTERP_KERNEL::Exception(msg);
3380 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3383 tmp=DataArrayDouble::New();
3384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3385 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3388 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3391 throw INTERP_KERNEL::Exception(msg);
3400 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3403 tmp=DataArrayDouble::New();
3404 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3405 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3408 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3411 throw INTERP_KERNEL::Exception(msg);
3420 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3423 tmp=DataArrayDouble::New();
3424 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3425 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3428 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3431 throw INTERP_KERNEL::Exception(msg);
3440 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3443 tmp=DataArrayDouble::New();
3444 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3445 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3448 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3451 throw INTERP_KERNEL::Exception(msg);
3460 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3463 tmp=DataArrayDouble::New();
3464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3465 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3468 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3471 throw INTERP_KERNEL::Exception(msg);
3480 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3483 tmp=DataArrayDouble::New();
3484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3485 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3488 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3491 throw INTERP_KERNEL::Exception(msg);
3500 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3503 tmp=DataArrayDouble::New();
3504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3505 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3508 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3511 throw INTERP_KERNEL::Exception(msg);
3518 int ee=pt1.second.first;
3519 int ss=pt1.second.second;
3521 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
3522 int nbOfE=(ee-bb)/ss;
3523 std::vector<int> nv(nbOfE);
3524 for(int jj=0;jj<nbOfE;jj++)
3529 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3532 tmp=DataArrayDouble::New();
3533 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3534 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3537 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3552 tmp=DataArrayDouble::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3557 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3560 throw INTERP_KERNEL::Exception(msg);
3569 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3572 tmp=DataArrayDouble::New();
3573 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3574 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3577 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3580 throw INTERP_KERNEL::Exception(msg);
3589 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3592 tmp=DataArrayDouble::New();
3593 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3594 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3597 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3600 throw INTERP_KERNEL::Exception(msg);
3609 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3612 tmp=DataArrayDouble::New();
3613 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3614 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3617 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3620 throw INTERP_KERNEL::Exception(msg);
3629 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3632 tmp=DataArrayDouble::New();
3633 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3634 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3637 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3640 throw INTERP_KERNEL::Exception(msg);
3645 throw INTERP_KERNEL::Exception(msg);
3650 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3652 return self->negate();
3655 DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3657 const char msg[]="Unexpected situation in __add__ !";
3660 DataArrayDoubleTuple *aa;
3661 std::vector<double> bb;
3663 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3668 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3669 ret->applyLin(1.,val);
3675 return DataArrayDouble::Add(self,a);
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3680 return DataArrayDouble::Add(self,aaa);
3684 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3685 return DataArrayDouble::Add(self,aaa);
3688 throw INTERP_KERNEL::Exception(msg);
3692 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3694 const char msg[]="Unexpected situation in __radd__ !";
3697 DataArrayDoubleTuple *aa;
3698 std::vector<double> bb;
3700 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3705 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3706 ret->applyLin(1.,val);
3712 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3713 return DataArrayDouble::Add(self,aaa);
3717 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3718 return DataArrayDouble::Add(self,aaa);
3721 throw INTERP_KERNEL::Exception(msg);
3725 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3727 const char msg[]="Unexpected situation in __iadd__ !";
3730 DataArrayDoubleTuple *aa;
3731 std::vector<double> bb;
3733 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3738 self->applyLin(1.,val);
3739 Py_XINCREF(trueSelf);
3745 Py_XINCREF(trueSelf);
3750 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3751 self->addEqual(aaa);
3752 Py_XINCREF(trueSelf);
3757 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3758 self->addEqual(aaa);
3759 Py_XINCREF(trueSelf);
3763 throw INTERP_KERNEL::Exception(msg);
3767 DataArrayDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3769 const char msg[]="Unexpected situation in __sub__ !";
3772 DataArrayDoubleTuple *aa;
3773 std::vector<double> bb;
3775 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3781 ret->applyLin(1.,-val);
3787 return DataArrayDouble::Substract(self,a);
3791 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3792 return DataArrayDouble::Substract(self,aaa);
3796 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3797 return DataArrayDouble::Substract(self,aaa);
3800 throw INTERP_KERNEL::Exception(msg);
3804 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3806 const char msg[]="Unexpected situation in __rsub__ !";
3809 DataArrayDoubleTuple *aa;
3810 std::vector<double> bb;
3812 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3818 ret->applyLin(-1.,val);
3824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3825 return DataArrayDouble::Substract(aaa,self);
3829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3830 return DataArrayDouble::Substract(aaa,self);
3833 throw INTERP_KERNEL::Exception(msg);
3837 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3839 const char msg[]="Unexpected situation in __isub__ !";
3842 DataArrayDoubleTuple *aa;
3843 std::vector<double> bb;
3845 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3850 self->applyLin(1,-val);
3851 Py_XINCREF(trueSelf);
3856 self->substractEqual(a);
3857 Py_XINCREF(trueSelf);
3862 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3863 self->substractEqual(aaa);
3864 Py_XINCREF(trueSelf);
3869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3870 self->substractEqual(aaa);
3871 Py_XINCREF(trueSelf);
3875 throw INTERP_KERNEL::Exception(msg);
3879 DataArrayDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3881 const char msg[]="Unexpected situation in __mul__ !";
3884 DataArrayDoubleTuple *aa;
3885 std::vector<double> bb;
3887 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3892 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3893 ret->applyLin(val,0.);
3899 return DataArrayDouble::Multiply(self,a);
3903 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3904 return DataArrayDouble::Multiply(self,aaa);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3909 return DataArrayDouble::Multiply(self,aaa);
3912 throw INTERP_KERNEL::Exception(msg);
3916 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 const char msg[]="Unexpected situation in __rmul__ !";
3921 DataArrayDoubleTuple *aa;
3922 std::vector<double> bb;
3924 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3930 ret->applyLin(val,0.);
3936 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3937 return DataArrayDouble::Multiply(self,aaa);
3941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3942 return DataArrayDouble::Multiply(self,aaa);
3945 throw INTERP_KERNEL::Exception(msg);
3949 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3951 const char msg[]="Unexpected situation in __imul__ !";
3954 DataArrayDoubleTuple *aa;
3955 std::vector<double> bb;
3957 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3962 self->applyLin(val,0.);
3963 Py_XINCREF(trueSelf);
3968 self->multiplyEqual(a);
3969 Py_XINCREF(trueSelf);
3974 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3975 self->multiplyEqual(aaa);
3976 Py_XINCREF(trueSelf);
3981 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3982 self->multiplyEqual(aaa);
3983 Py_XINCREF(trueSelf);
3987 throw INTERP_KERNEL::Exception(msg);
3991 DataArrayDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3993 const char msg[]="Unexpected situation in __div__ !";
3996 DataArrayDoubleTuple *aa;
3997 std::vector<double> bb;
3999 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4005 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
4006 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4007 ret->applyLin(1/val,0.);
4013 return DataArrayDouble::Divide(self,a);
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4018 return DataArrayDouble::Divide(self,aaa);
4022 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4023 return DataArrayDouble::Divide(self,aaa);
4026 throw INTERP_KERNEL::Exception(msg);
4030 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4032 const char msg[]="Unexpected situation in __rdiv__ !";
4035 DataArrayDoubleTuple *aa;
4036 std::vector<double> bb;
4038 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4043 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4050 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4051 return DataArrayDouble::Divide(aaa,self);
4055 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4056 return DataArrayDouble::Divide(aaa,self);
4059 throw INTERP_KERNEL::Exception(msg);
4063 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4065 const char msg[]="Unexpected situation in __idiv__ !";
4068 DataArrayDoubleTuple *aa;
4069 std::vector<double> bb;
4071 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4077 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
4078 self->applyLin(1./val,0.);
4079 Py_XINCREF(trueSelf);
4084 self->divideEqual(a);
4085 Py_XINCREF(trueSelf);
4090 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4091 self->divideEqual(aaa);
4092 Py_XINCREF(trueSelf);
4097 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4098 self->divideEqual(aaa);
4099 Py_XINCREF(trueSelf);
4103 throw INTERP_KERNEL::Exception(msg);
4107 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
4109 std::vector<int> c,cI;
4111 self->computeTupleIdsNearTuples(other,eps,c,cI);
4112 PyObject *ret=PyTuple_New(2);
4113 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
4114 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
4115 d0->alloc(c.size(),1);
4116 d1->alloc(cI.size(),1);
4117 std::copy(c.begin(),c.end(),d0->getPointer());
4118 std::copy(cI.begin(),cI.end(),d1->getPointer());
4119 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4120 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4127 %extend ParaMEDMEM::DataArrayIntTuple
4129 std::string __str__() const
4131 return self->repr();
4134 int __int__() const throw(INTERP_KERNEL::Exception)
4136 return self->intValue();
4139 DataArrayInt *buildDAInt()
4141 return self->buildDAInt(1,self->getNumberOfCompo());
4144 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4146 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4147 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4148 Py_XINCREF(trueSelf);
4152 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4154 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4155 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4156 Py_XINCREF(trueSelf);
4160 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4162 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4163 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4164 Py_XINCREF(trueSelf);
4168 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4170 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4171 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4172 Py_XINCREF(trueSelf);
4176 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4178 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4179 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4180 Py_XINCREF(trueSelf);
4184 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4188 std::vector<int> multiVal;
4189 std::pair<int, std::pair<int,int> > slic;
4190 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4191 const int *pt=self->getConstPointer();
4192 int nbc=self->getNumberOfCompo();
4193 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4200 std::ostringstream oss;
4201 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4202 throw INTERP_KERNEL::Exception(oss.str().c_str());
4205 return PyInt_FromLong(pt[singleVal]);
4209 return PyInt_FromLong(pt[nbc+singleVal]);
4212 std::ostringstream oss;
4213 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4214 throw INTERP_KERNEL::Exception(oss.str().c_str());
4220 PyObject *t=PyTuple_New(multiVal.size());
4221 for(int j=0;j<(int)multiVal.size();j++)
4223 int cid=multiVal[j];
4226 std::ostringstream oss;
4227 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4228 throw INTERP_KERNEL::Exception(oss.str().c_str());
4230 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4236 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4237 PyObject *t=PyTuple_New(sz);
4238 for(int j=0;j<sz;j++)
4239 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4243 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4247 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4249 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4252 std::vector<int> multiValV;
4253 std::pair<int, std::pair<int,int> > slicV;
4254 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4255 int nbc=self->getNumberOfCompo();
4256 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4258 std::vector<int> multiVal;
4259 std::pair<int, std::pair<int,int> > slic;
4260 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4261 int *pt=self->getPointer();
4262 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4269 std::ostringstream oss;
4270 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4271 throw INTERP_KERNEL::Exception(oss.str().c_str());
4277 pt[singleVal]=singleValV;
4282 if(multiValV.size()!=1)
4284 std::ostringstream oss;
4285 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4286 throw INTERP_KERNEL::Exception(oss.str().c_str());
4288 pt[singleVal]=multiValV[0];
4293 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4297 throw INTERP_KERNEL::Exception(msg);
4306 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4310 std::ostringstream oss;
4311 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4312 throw INTERP_KERNEL::Exception(oss.str().c_str());
4320 if(multiVal.size()!=multiValV.size())
4322 std::ostringstream oss;
4323 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4324 throw INTERP_KERNEL::Exception(oss.str().c_str());
4326 for(int i=0;i<(int)multiVal.size();i++)
4328 int pos=multiVal[i];
4331 std::ostringstream oss;
4332 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4333 throw INTERP_KERNEL::Exception(oss.str().c_str());
4335 pt[multiVal[i]]=multiValV[i];
4341 const int *ptV=daIntTyyppV->getConstPointer();
4342 if(nbc>daIntTyyppV->getNumberOfCompo())
4344 std::ostringstream oss;
4345 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4346 throw INTERP_KERNEL::Exception(oss.str().c_str());
4348 std::copy(ptV,ptV+nbc,pt);
4352 throw INTERP_KERNEL::Exception(msg);
4357 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4362 for(int j=0;j<sz;j++)
4363 pt[slic.first+j*slic.second.second]=singleValV;
4368 if(sz!=(int)multiValV.size())
4370 std::ostringstream oss;
4371 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4372 throw INTERP_KERNEL::Exception(oss.str().c_str());
4374 for(int j=0;j<sz;j++)
4375 pt[slic.first+j*slic.second.second]=multiValV[j];
4380 const int *ptV=daIntTyyppV->getConstPointer();
4381 if(sz>daIntTyyppV->getNumberOfCompo())
4383 std::ostringstream oss;
4384 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4385 throw INTERP_KERNEL::Exception(oss.str().c_str());
4387 for(int j=0;j<sz;j++)
4388 pt[slic.first+j*slic.second.second]=ptV[j];
4392 throw INTERP_KERNEL::Exception(msg);
4396 throw INTERP_KERNEL::Exception(msg);
4401 %extend ParaMEDMEM::DataArrayIntIterator
4405 DataArrayIntTuple *ret=self->nextt();
4407 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4410 PyErr_SetString(PyExc_StopIteration,"No more data.");
4416 %extend ParaMEDMEM::DataArrayInt
4418 DataArrayInt() throw(INTERP_KERNEL::Exception)
4420 return DataArrayInt::New();
4423 static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4425 const char *msg="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n--DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2) !";
4426 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4430 if(PyInt_Check(elt1))
4432 int nbOfTuples=PyInt_AS_LONG(elt1);
4434 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4437 if(PyInt_Check(elt2))
4438 {//DataArrayInt.New([1,3,4,5],2,2)
4439 int nbOfCompo=PyInt_AS_LONG(elt2);
4441 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4442 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4443 int *tmp=new int[nbOfTuples*nbOfCompo];
4444 try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples*nbOfCompo,0,true); }
4445 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4446 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
4451 throw INTERP_KERNEL::Exception(msg);
4454 {//DataArrayInt.New([1,3,4],3)
4455 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4456 int *tmp=new int[nbOfTuples];
4457 try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples,0,true); }
4458 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4459 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
4465 throw INTERP_KERNEL::Exception(msg);
4468 {// DataArrayInt.New([1,3,4])
4470 if(PyList_Check(elt0))
4471 szz=PyList_Size(elt0);
4473 szz=PyTuple_Size(elt0);
4474 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4475 int *tmp=new int[szz];
4476 try { fillArrayWithPyListInt(elt0,tmp,szz,0,true); }
4477 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4478 ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
4483 else if(PyInt_Check(elt0))
4485 int nbOfTuples=PyInt_AS_LONG(elt0);
4487 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4492 if(PyInt_Check(elt1))
4493 {//DataArrayInt.New(5,2)
4494 int nbOfCompo=PyInt_AS_LONG(elt1);
4496 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4497 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4498 ret->alloc(nbOfTuples,nbOfCompo);
4503 throw INTERP_KERNEL::Exception(msg);
4506 throw INTERP_KERNEL::Exception(msg);
4509 {//DataArrayInt.New(5)
4510 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4511 ret->alloc(nbOfTuples,1);
4517 throw INTERP_KERNEL::Exception(msg);
4520 DataArrayInt(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4522 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,elt1,elt2);
4525 std::string __str__() const
4527 return self->repr();
4530 int __len__() const throw(INTERP_KERNEL::Exception)
4532 if(self->isAllocated())
4534 return self->getNumberOfTuples();
4538 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
4542 int __int__() const throw(INTERP_KERNEL::Exception)
4544 return self->intValue();
4547 DataArrayIntIterator *__iter__()
4549 return self->iterator();
4552 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const DataArrayInt *arr, const DataArrayInt *arrI) throw(INTERP_KERNEL::Exception)
4554 int newNbOfTuples=-1;
4555 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arr,arrI,newNbOfTuples);
4556 PyObject *ret=PyTuple_New(2);
4557 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4558 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
4562 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
4564 int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
4567 fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
4569 catch(INTERP_KERNEL::Exception& e)
4574 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
4577 PyObject *getValues() throw(INTERP_KERNEL::Exception)
4579 const int *vals=self->getPointer();
4580 return convertIntArrToPyList(vals,self->getNbOfElems());
4583 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
4586 bool ret0=self->isEqualIfNotWhy(other,ret1);
4587 PyObject *ret=PyTuple_New(2);
4588 PyObject *ret0Py=ret0?Py_True:Py_False;
4590 PyTuple_SetItem(ret,0,ret0Py);
4591 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4595 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
4597 const int *vals=self->getPointer();
4598 int nbOfComp=self->getNumberOfComponents();
4599 int nbOfTuples=self->getNumberOfTuples();
4600 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4603 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
4605 std::vector<const DataArrayInt *> groups;
4606 std::vector< std::vector<int> > fidsOfGroups;
4607 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
4608 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
4609 PyObject *ret = PyList_New(2);
4610 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4611 int sz=fidsOfGroups.size();
4612 PyObject *ret1 = PyList_New(sz);
4613 for(int i=0;i<sz;i++)
4614 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
4615 PyList_SetItem(ret,1,ret1);
4619 void transformWithIndArr(PyObject *li)
4622 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4623 if (!SWIG_IsOK(res1))
4626 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4627 self->transformWithIndArr(tmp,tmp+size);
4631 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4632 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4636 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4640 std::vector<int> multiVal;
4641 std::pair<int, std::pair<int,int> > slic;
4642 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4643 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4647 return self->getIdsEqualList(&singleVal,&singleVal+1);
4649 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4651 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
4653 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4657 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4661 std::vector<int> multiVal;
4662 std::pair<int, std::pair<int,int> > slic;
4663 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4664 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4668 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
4670 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4672 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
4674 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4678 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
4680 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
4682 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4683 if (!SWIG_IsOK(res1))
4686 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4687 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
4691 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4693 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4694 da2->checkAllocated();
4695 int size=self->getNumberOfTuples();
4696 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
4698 PyObject *ret = PyList_New(3);
4699 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4700 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4701 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4705 DataArrayInt *transformWithIndArrR(PyObject *li) const
4708 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4709 if (!SWIG_IsOK(res1))
4712 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4713 return self->transformWithIndArrR(tmp,tmp+size);
4717 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4718 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4722 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
4725 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4726 if (!SWIG_IsOK(res1))
4729 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4730 if(size!=self->getNumberOfTuples())
4732 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4734 self->renumberInPlace(tmp);
4738 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4740 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4741 da2->checkAllocated();
4742 int size=self->getNumberOfTuples();
4743 if(size!=self->getNumberOfTuples())
4745 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4747 self->renumberInPlace(da2->getConstPointer());
4751 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
4754 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4755 if (!SWIG_IsOK(res1))
4758 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4759 if(size!=self->getNumberOfTuples())
4761 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4763 self->renumberInPlaceR(tmp);
4767 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4769 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4770 da2->checkAllocated();
4771 int size=self->getNumberOfTuples();
4772 if(size!=self->getNumberOfTuples())
4774 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4776 self->renumberInPlaceR(da2->getConstPointer());
4780 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4783 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4784 if (!SWIG_IsOK(res1))
4787 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4788 if(size!=self->getNumberOfTuples())
4790 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4792 return self->renumberAndReduce(tmp,newNbOfTuple);
4796 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4798 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4799 da2->checkAllocated();
4800 int size=self->getNumberOfTuples();
4801 if(size!=self->getNumberOfTuples())
4803 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4805 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4809 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4812 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4813 if (!SWIG_IsOK(res1))
4816 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4817 if(size!=self->getNumberOfTuples())
4819 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4821 return self->renumber(tmp);
4825 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4827 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4828 da2->checkAllocated();
4829 int size=self->getNumberOfTuples();
4830 if(size!=self->getNumberOfTuples())
4832 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4834 return self->renumber(da2->getConstPointer());
4838 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4841 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4842 if (!SWIG_IsOK(res1))
4845 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4846 if(size!=self->getNumberOfTuples())
4848 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4850 return self->renumberR(tmp);
4854 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4856 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4857 da2->checkAllocated();
4858 int size=self->getNumberOfTuples();
4859 if(size!=self->getNumberOfTuples())
4861 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4863 return self->renumberR(da2->getConstPointer());
4867 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
4870 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4871 if (!SWIG_IsOK(res1))
4874 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4875 return self->selectByTupleId(tmp,tmp+size);
4879 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4881 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4882 da2->checkAllocated();
4883 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4887 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4890 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4891 if (!SWIG_IsOK(res1))
4894 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4895 return self->selectByTupleIdSafe(tmp,tmp+size);
4899 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4901 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4902 da2->checkAllocated();
4903 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4907 DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
4909 std::vector<int> tmp;
4910 convertPyToNewIntArr3(li,tmp);
4911 return self->keepSelectedComponents(tmp);
4914 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
4916 std::vector<int> tmp;
4917 convertPyToNewIntArr3(li,tmp);
4918 self->setSelectedComponents(a,tmp);
4921 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4923 int sz=self->getNumberOfComponents();
4924 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
4925 self->getTuple(tupleId,tmp);
4926 return convertIntArrToPyList(tmp,sz);
4929 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
4931 DataArrayInt *arr=0;
4932 DataArrayInt *arrI=0;
4933 self->changeSurjectiveFormat(targetNb,arr,arrI);
4934 PyObject *res = PyList_New(2);
4935 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4936 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4940 DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
4942 std::vector<std::pair<int,int> > ranges;
4943 convertPyToVectorPairInt(li,ranges);
4944 return self->selectByTupleRanges(ranges);
4947 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
4949 std::vector<const DataArrayInt *> tmp;
4950 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4951 return DataArrayInt::Meld(tmp);
4954 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
4956 std::vector<const DataArrayInt *> tmp;
4957 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4958 return DataArrayInt::Aggregate(tmp);
4961 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
4963 std::vector<const DataArrayInt *> tmp;
4964 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4965 return DataArrayInt::BuildUnion(tmp);
4968 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
4970 std::vector<const DataArrayInt *> tmp;
4971 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4972 return DataArrayInt::BuildIntersection(tmp);
4975 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4978 int r1=self->getMaxValue(tmp);
4979 PyObject *ret=PyTuple_New(2);
4980 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4981 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4985 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4988 int r1=self->getMinValue(tmp);
4989 PyObject *ret=PyTuple_New(2);
4990 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4991 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4995 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4997 int nbOfCompo=self->getNumberOfComponents();
5002 if(PyInt_Check(obj))
5004 int val=(int)PyInt_AS_LONG(obj);
5005 return self->locateValue(val);
5008 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
5012 std::vector<int> arr;
5013 convertPyToNewIntArr3(obj,arr);
5014 return self->locateTuple(arr);
5019 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5021 int nbOfCompo=self->getNumberOfComponents();
5028 if(PyInt_Check(obj))
5030 int val=(int)PyInt_AS_LONG(obj);
5031 return self->presenceOfValue(val);
5034 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5038 std::vector<int> arr;
5039 convertPyToNewIntArr3(obj,arr);
5040 return self->presenceOfTuple(arr);
5045 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5047 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
5048 self->checkAllocated();
5049 int nbOfTuples=self->getNumberOfTuples();
5050 int nbOfComponents=self->getNumberOfComponents();
5052 std::vector<int> vt1,vc1;
5053 std::pair<int, std::pair<int,int> > pt1,pc1;
5054 DataArrayInt *dt1=0,*dc1=0;
5056 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5057 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
5062 if(nbOfComponents==1)
5063 return PyInt_FromLong(self->getIJSafe(it1,0));
5064 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5067 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5069 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5071 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5073 return PyInt_FromLong(self->getIJSafe(it1,ic1));
5076 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5077 std::vector<int> v2(1,ic1);
5078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5082 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5083 std::vector<int> v2(1,ic1);
5084 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5088 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5089 std::vector<int> v2(1,ic1);
5090 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5094 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5095 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5099 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5104 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5105 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5109 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5114 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5115 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5116 std::vector<int> v2(nbOfComp);
5117 for(int i=0;i<nbOfComp;i++)
5118 v2[i]=pc1.first+i*pc1.second.second;
5119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5123 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5124 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5125 std::vector<int> v2(nbOfComp);
5126 for(int i=0;i<nbOfComp;i++)
5127 v2[i]=pc1.first+i*pc1.second.second;
5128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5132 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5133 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5134 std::vector<int> v2(nbOfComp);
5135 for(int i=0;i<nbOfComp;i++)
5136 v2[i]=pc1.first+i*pc1.second.second;
5137 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5141 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5142 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5143 std::vector<int> v2(nbOfComp);
5144 for(int i=0;i<nbOfComp;i++)
5145 v2[i]=pc1.first+i*pc1.second.second;
5146 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5149 throw INTERP_KERNEL::Exception(msg);
5153 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5155 self->checkAllocated();
5156 const char msg[]="Unexpected situation in __setitem__ !";
5157 int nbOfTuples=self->getNumberOfTuples();
5158 int nbOfComponents=self->getNumberOfComponents();
5161 std::vector<int> v1;
5163 DataArrayIntTuple *dd1=0;
5164 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5166 std::vector<int> vt1,vc1;
5167 std::pair<int, std::pair<int,int> > pt1,pc1;
5168 DataArrayInt *dt1=0,*dc1=0;
5169 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5170 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5178 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5181 tmp=DataArrayInt::New();
5182 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5183 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
5186 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
5189 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5190 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
5193 throw INTERP_KERNEL::Exception(msg);
5202 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5205 tmp=DataArrayInt::New();
5206 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5207 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
5210 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5213 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5214 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5217 throw INTERP_KERNEL::Exception(msg);
5226 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5229 tmp=DataArrayInt::New();
5230 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5231 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
5234 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5237 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5238 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5241 throw INTERP_KERNEL::Exception(msg);
5250 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5253 tmp=DataArrayInt::New();
5254 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5255 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
5258 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5261 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5262 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5265 throw INTERP_KERNEL::Exception(msg);
5274 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5277 tmp=DataArrayInt::New();
5278 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5279 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
5282 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
5285 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5286 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
5289 throw INTERP_KERNEL::Exception(msg);
5298 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5301 tmp=DataArrayInt::New();
5302 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5303 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
5306 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5309 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5310 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5313 throw INTERP_KERNEL::Exception(msg);
5322 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5325 tmp=DataArrayInt::New();
5326 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5327 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
5330 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5333 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5334 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5337 throw INTERP_KERNEL::Exception(msg);
5346 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5349 tmp=DataArrayInt::New();
5350 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5351 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
5354 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5357 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5358 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5361 throw INTERP_KERNEL::Exception(msg);
5370 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5373 tmp=DataArrayInt::New();
5374 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5375 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
5378 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5381 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5382 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5385 throw INTERP_KERNEL::Exception(msg);
5394 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5397 tmp=DataArrayInt::New();
5398 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5399 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5402 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5405 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5406 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5409 throw INTERP_KERNEL::Exception(msg);
5416 int ee=pt1.second.first;
5417 int ss=pt1.second.second;
5419 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
5420 int nbOfE=(ee-bb)/ss;
5421 std::vector<int> nv(nbOfE);
5422 for(int jj=0;jj<nbOfE;jj++)
5427 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5430 tmp=DataArrayInt::New();
5431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5432 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5435 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5439 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5442 throw INTERP_KERNEL::Exception(msg);
5451 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5454 tmp=DataArrayInt::New();
5455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5456 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
5459 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5463 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5466 throw INTERP_KERNEL::Exception(msg);
5475 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5478 tmp=DataArrayInt::New();
5479 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5480 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
5483 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5487 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5490 throw INTERP_KERNEL::Exception(msg);
5499 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5502 tmp=DataArrayInt::New();
5503 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5504 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
5507 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5510 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5511 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5514 throw INTERP_KERNEL::Exception(msg);
5523 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5526 tmp=DataArrayInt::New();
5527 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5528 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
5531 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5534 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5535 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5538 throw INTERP_KERNEL::Exception(msg);
5547 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5550 tmp=DataArrayInt::New();
5551 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5552 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
5555 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5558 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5559 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5562 throw INTERP_KERNEL::Exception(msg);
5567 throw INTERP_KERNEL::Exception(msg);
5572 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
5574 return self->negate();
5577 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5579 const char msg[]="Unexpected situation in __add__ !";
5582 std::vector<int> aa;
5583 DataArrayIntTuple *aaa;
5585 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5590 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5591 ret->applyLin(1,val);
5597 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5598 return DataArrayInt::Add(self,aaa);
5602 return DataArrayInt::Add(self,a);
5606 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5607 return DataArrayInt::Add(self,aaaa);
5610 throw INTERP_KERNEL::Exception(msg);
5614 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5616 const char msg[]="Unexpected situation in __radd__ !";
5619 std::vector<int> aa;
5620 DataArrayIntTuple *aaa;
5622 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5627 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5628 ret->applyLin(1,val);
5634 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5635 return DataArrayInt::Add(self,aaa);
5639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5640 return DataArrayInt::Add(self,aaaa);
5643 throw INTERP_KERNEL::Exception(msg);
5647 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5649 const char msg[]="Unexpected situation in __iadd__ !";
5652 std::vector<int> aa;
5653 DataArrayIntTuple *aaa;
5655 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5660 self->applyLin(1,val);
5661 Py_XINCREF(trueSelf);
5666 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5668 Py_XINCREF(trueSelf);
5674 Py_XINCREF(trueSelf);
5679 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5680 self->addEqual(aaaa);
5681 Py_XINCREF(trueSelf);
5685 throw INTERP_KERNEL::Exception(msg);
5689 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5691 const char msg[]="Unexpected situation in __sub__ !";
5694 std::vector<int> aa;
5695 DataArrayIntTuple *aaa;
5697 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5702 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5703 ret->applyLin(1,-val);
5709 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5710 return DataArrayInt::Substract(self,aaa);
5714 return DataArrayInt::Substract(self,a);
5718 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5719 return DataArrayInt::Substract(self,aaaa);
5722 throw INTERP_KERNEL::Exception(msg);
5726 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5728 const char msg[]="Unexpected situation in __rsub__ !";
5731 std::vector<int> aa;
5732 DataArrayIntTuple *aaa;
5734 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5739 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5740 ret->applyLin(-1,val);
5746 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5747 return DataArrayInt::Substract(aaa,self);
5751 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5752 return DataArrayInt::Substract(aaaa,self);
5755 throw INTERP_KERNEL::Exception(msg);
5759 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5761 const char msg[]="Unexpected situation in __isub__ !";
5764 std::vector<int> aa;
5765 DataArrayIntTuple *aaa;
5767 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5772 self->applyLin(1,-val);
5773 Py_XINCREF(trueSelf);
5778 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5779 self->substractEqual(bb);
5780 Py_XINCREF(trueSelf);
5785 self->substractEqual(a);
5786 Py_XINCREF(trueSelf);
5791 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5792 self->substractEqual(aaaa);
5793 Py_XINCREF(trueSelf);
5797 throw INTERP_KERNEL::Exception(msg);
5801 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5803 const char msg[]="Unexpected situation in __mul__ !";
5806 std::vector<int> aa;
5807 DataArrayIntTuple *aaa;
5809 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5814 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5815 ret->applyLin(val,0);
5821 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5822 return DataArrayInt::Multiply(self,aaa);
5826 return DataArrayInt::Multiply(self,a);
5830 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5831 return DataArrayInt::Multiply(self,aaaa);
5834 throw INTERP_KERNEL::Exception(msg);
5838 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5840 const char msg[]="Unexpected situation in __rmul__ !";
5843 std::vector<int> aa;
5844 DataArrayIntTuple *aaa;
5846 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5851 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5852 ret->applyLin(val,0);
5858 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5859 return DataArrayInt::Multiply(self,aaa);
5863 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5864 return DataArrayInt::Multiply(self,aaaa);
5867 throw INTERP_KERNEL::Exception(msg);
5871 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5873 const char msg[]="Unexpected situation in __imul__ !";
5876 std::vector<int> aa;
5877 DataArrayIntTuple *aaa;
5879 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5884 self->applyLin(val,0);
5885 Py_XINCREF(trueSelf);
5890 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5891 self->multiplyEqual(bb);
5892 Py_XINCREF(trueSelf);
5897 self->multiplyEqual(a);
5898 Py_XINCREF(trueSelf);
5903 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5904 self->multiplyEqual(aaaa);
5905 Py_XINCREF(trueSelf);
5909 throw INTERP_KERNEL::Exception(msg);
5913 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5915 const char msg[]="Unexpected situation in __div__ !";
5918 std::vector<int> aa;
5919 DataArrayIntTuple *aaa;
5921 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5926 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5927 ret->applyDivideBy(val);
5933 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5934 return DataArrayInt::Divide(self,aaa);
5938 return DataArrayInt::Divide(self,a);
5942 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5943 return DataArrayInt::Divide(self,aaaa);
5946 throw INTERP_KERNEL::Exception(msg);
5950 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5952 const char msg[]="Unexpected situation in __rdiv__ !";
5955 std::vector<int> aa;
5956 DataArrayIntTuple *aaa;
5958 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5963 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5970 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5971 return DataArrayInt::Divide(aaa,self);
5975 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5976 return DataArrayInt::Divide(aaaa,self);
5979 throw INTERP_KERNEL::Exception(msg);
5983 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5985 const char msg[]="Unexpected situation in __idiv__ !";
5988 std::vector<int> aa;
5989 DataArrayIntTuple *aaa;
5991 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5996 self->applyDivideBy(val);
5997 Py_XINCREF(trueSelf);
6002 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6003 self->divideEqual(bb);
6004 Py_XINCREF(trueSelf);
6009 self->divideEqual(a);
6010 Py_XINCREF(trueSelf);
6015 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6016 self->divideEqual(aaaa);
6017 Py_XINCREF(trueSelf);
6021 throw INTERP_KERNEL::Exception(msg);
6025 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6027 const char msg[]="Unexpected situation in __mod__ !";
6030 std::vector<int> aa;
6031 DataArrayIntTuple *aaa;
6033 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6038 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6039 ret->applyModulus(val);
6045 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6046 return DataArrayInt::Modulus(self,aaa);
6050 return DataArrayInt::Modulus(self,a);
6054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6055 return DataArrayInt::Modulus(self,aaaa);
6058 throw INTERP_KERNEL::Exception(msg);
6062 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6064 const char msg[]="Unexpected situation in __rmod__ !";
6067 std::vector<int> aa;
6068 DataArrayIntTuple *aaa;
6070 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6075 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6076 ret->applyRModulus(val);
6082 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6083 return DataArrayInt::Modulus(aaa,self);
6087 return DataArrayInt::Modulus(a,self);
6091 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6092 return DataArrayInt::Modulus(aaaa,self);
6095 throw INTERP_KERNEL::Exception(msg);
6099 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
6101 const char msg[]="Unexpected situation in __imod__ !";
6104 std::vector<int> aa;
6105 DataArrayIntTuple *aaa;
6107 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6112 self->applyModulus(val);
6113 Py_XINCREF(trueSelf);
6118 self->modulusEqual(a);
6119 Py_XINCREF(trueSelf);
6124 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6125 self->modulusEqual(aaaa);
6126 Py_XINCREF(trueSelf);
6130 throw INTERP_KERNEL::Exception(msg);
6135 namespace ParaMEDMEM
6137 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
6140 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6141 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
6142 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6143 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6144 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
6145 void setName(const char *name) throw(INTERP_KERNEL::Exception);
6146 const char *getDescription() const throw(INTERP_KERNEL::Exception);
6147 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
6148 const char *getName() const throw(INTERP_KERNEL::Exception);
6149 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
6150 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
6151 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
6152 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
6153 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
6154 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
6155 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
6156 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
6157 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
6158 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
6159 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
6160 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
6161 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
6162 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
6164 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
6166 MEDCouplingMesh *ret1=(MEDCouplingMesh *)self->getMesh();
6169 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
6172 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
6174 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
6177 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
6180 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
6183 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
6184 PyObject *ret=PyTuple_New(2);
6185 PyObject *ret0Py=ret0?Py_True:Py_False;
6187 PyTuple_SetItem(ret,0,ret0Py);
6188 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6192 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
6194 DataArrayInt *ret1=0;
6195 MEDCouplingMesh *ret0=0;
6197 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6198 if (!SWIG_IsOK(res1))
6201 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6202 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
6206 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6208 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6209 da2->checkAllocated();
6210 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
6212 PyObject *res = PyList_New(2);
6213 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
6214 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6218 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
6222 std::vector<int> pos2;
6223 DataArrayInt *pos3=0;
6224 DataArrayIntTuple *pos4=0;
6225 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
6230 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
6234 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
6238 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
6241 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
6245 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
6246 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
6249 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6250 if (!SWIG_IsOK(res1))
6253 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6254 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
6258 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6260 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6261 da2->checkAllocated();
6262 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
6266 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
6268 std::vector<int> tmp;
6269 self->getCellIdsHavingGaussLocalization(locId,tmp);
6270 DataArrayInt *ret=DataArrayInt::New();
6271 ret->alloc((int)tmp.size(),1);
6272 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
6273 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6278 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
6281 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
6282 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
6283 void setTimeUnit(const char *unit);
6284 const char *getTimeUnit() const;
6285 void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6286 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6287 std::string simpleRepr() const;
6288 std::string advancedRepr() const;
6289 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
6290 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
6291 MEDCouplingFieldDouble *deepCpy() const;
6292 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
6293 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
6294 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
6295 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
6296 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6297 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6298 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6299 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6300 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6301 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
6302 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
6303 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
6304 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
6305 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
6306 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
6307 void setIteration(int it) throw(INTERP_KERNEL::Exception);
6308 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
6309 void setOrder(int order) throw(INTERP_KERNEL::Exception);
6310 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
6311 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
6312 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
6313 void updateTime() const throw(INTERP_KERNEL::Exception);
6314 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6315 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6316 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6317 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6318 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6319 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6320 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
6321 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
6322 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
6323 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
6324 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
6325 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
6326 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
6327 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
6328 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
6329 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
6330 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
6331 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
6332 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
6333 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6334 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6335 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6336 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6337 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6338 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6339 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
6340 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
6341 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
6342 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
6343 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
6344 double getMaxValue() const throw(INTERP_KERNEL::Exception);
6345 double getMinValue() const throw(INTERP_KERNEL::Exception);
6346 double getAverageValue() const throw(INTERP_KERNEL::Exception);
6347 double norm2() const throw(INTERP_KERNEL::Exception);
6348 double normMax() const throw(INTERP_KERNEL::Exception);
6349 double getWeightedAverageValue() const throw(INTERP_KERNEL::Exception);
6350 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
6351 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
6352 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
6353 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
6354 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6355 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6356 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6357 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6358 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6359 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6360 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6361 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6362 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6363 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6364 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6365 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6366 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6367 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6368 MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6369 MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6370 MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6371 MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6373 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME)
6375 return MEDCouplingFieldDouble::New(type,td);
6378 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME)
6380 return MEDCouplingFieldDouble::New(ft,td);
6383 std::string __str__() const
6385 return self->simpleRepr();
6388 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
6390 DataArrayDouble *ret=self->getArray();
6396 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
6398 std::vector<DataArrayDouble *> arrs=self->getArrays();
6399 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
6403 PyObject *ret=PyTuple_New(sz);
6404 for(int i=0;i<sz;i++)
6407 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6409 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
6414 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
6416 std::vector<const DataArrayDouble *> tmp;
6417 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
6419 std::vector<DataArrayDouble *> arrs(sz);
6420 for(int i=0;i<sz;i++)
6421 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
6422 self->setArrays(arrs);
6425 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
6427 DataArrayDouble *ret=self->getEndArray();
6433 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
6437 DataArrayDoubleTuple *aa;
6438 std::vector<double> bb;
6440 const MEDCouplingMesh *mesh=self->getMesh();
6442 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6443 int spaceDim=mesh->getSpaceDimension();
6444 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6445 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6447 int sz=self->getNumberOfComponents();
6448 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6449 self->getValueOn(spaceLoc,res);
6450 return convertDblArrToPyList(res,sz);
6453 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
6455 int sz=self->getNumberOfComponents();
6456 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6457 self->getValueOnPos(i,j,k,res);
6458 return convertDblArrToPyList(res,sz);
6461 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
6464 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
6465 if (!SWIG_IsOK(res1))
6468 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
6469 const MEDCouplingMesh *mesh=self->getMesh();
6471 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6472 int spaceDim=mesh->getSpaceDimension();
6473 int nbOfPoints=size/spaceDim;
6474 if(size%spaceDim!=0)
6476 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
6478 return self->getValueOnMulti(tmp,nbOfPoints);
6482 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
6484 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
6485 da2->checkAllocated();
6486 int size=da2->getNumberOfTuples();
6487 int nbOfCompo=da2->getNumberOfComponents();
6488 const MEDCouplingMesh *mesh=self->getMesh();
6490 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6491 if(nbOfCompo!=mesh->getSpaceDimension())
6493 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
6495 return self->getValueOnMulti(da2->getConstPointer(),size);
6499 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
6503 DataArrayDoubleTuple *aa;
6504 std::vector<double> bb;
6506 const MEDCouplingMesh *mesh=self->getMesh();
6508 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6509 int spaceDim=mesh->getSpaceDimension();
6510 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6511 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6514 int sz=self->getNumberOfComponents();
6515 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6516 self->getValueOn(spaceLoc,time,res);
6517 return convertDblArrToPyList(res,sz);
6520 void setValues(PyObject *li) throw(INTERP_KERNEL::Exception)
6522 if(self->getArray()!=0)
6525 double *tmp=convertPyToNewDblArr2(li,&sz);
6526 int nbTuples=self->getArray()->getNumberOfTuples();
6527 int nbOfCompo=self->getArray()->getNumberOfComponents();
6528 self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo);
6531 throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind");
6534 PyObject *getTime() throw(INTERP_KERNEL::Exception)
6537 double tmp0=self->getTime(tmp1,tmp2);
6538 PyObject *res = PyList_New(3);
6539 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6540 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6541 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6545 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
6548 double tmp0=self->getStartTime(tmp1,tmp2);
6549 PyObject *res = PyList_New(3);
6550 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6551 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6552 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6556 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
6559 double tmp0=self->getEndTime(tmp1,tmp2);
6560 PyObject *res = PyList_New(3);
6561 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6562 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6563 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6566 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
6568 int sz=self->getNumberOfComponents();
6569 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6570 self->accumulate(tmp);
6571 PyObject *ret=convertDblArrToPyList(tmp,sz);
6574 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
6576 int sz=self->getNumberOfComponents();
6577 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6578 self->integral(isWAbs,tmp);
6579 PyObject *ret=convertDblArrToPyList(tmp,sz);
6582 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
6584 int sz=self->getNumberOfComponents();
6585 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6587 PyObject *ret=convertDblArrToPyList(tmp,sz);
6590 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
6592 int sz=self->getNumberOfComponents();
6593 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6595 PyObject *ret=convertDblArrToPyList(tmp,sz);
6598 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
6601 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6602 if (!SWIG_IsOK(res1))
6605 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6606 self->renumberCells(tmp,check);
6610 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6612 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6613 da2->checkAllocated();
6614 self->renumberCells(da2->getConstPointer(),check);
6617 void renumberNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
6620 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6621 if (!SWIG_IsOK(res1))
6624 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6625 self->renumberNodes(tmp);
6629 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6631 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6632 da2->checkAllocated();
6633 self->renumberNodes(da2->getConstPointer());
6637 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
6641 std::vector<int> multiVal;
6642 std::pair<int, std::pair<int,int> > slic;
6643 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
6644 const MEDCouplingMesh *mesh=self->getMesh();
6646 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
6647 int nbc=mesh->getNumberOfCells();
6648 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
6655 std::ostringstream oss;
6656 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6657 throw INTERP_KERNEL::Exception(oss.str().c_str());
6660 return self->buildSubPart(&singleVal,&singleVal+1);
6665 int tmp=nbc+singleVal;
6666 return self->buildSubPart(&tmp,&tmp+1);
6670 std::ostringstream oss;
6671 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6672 throw INTERP_KERNEL::Exception(oss.str().c_str());
6678 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
6682 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rg=DataArrayInt::Range(slic.first,slic.second.first,slic.second.second);
6683 return self->buildSubPart(rg->begin(),rg->end());
6688 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
6689 daIntTyypp->checkAllocated();
6690 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
6693 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
6697 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
6699 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
6702 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
6705 double r1=self->getMaxValue2(tmp);
6706 PyObject *ret=PyTuple_New(2);
6707 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6708 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6712 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
6715 double r1=self->getMinValue2(tmp);
6716 PyObject *ret=PyTuple_New(2);
6717 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6718 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6722 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
6724 std::vector<int> tmp;
6725 convertPyToNewIntArr3(li,tmp);
6726 return self->keepSelectedComponents(tmp);
6729 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
6731 std::vector<int> tmp;
6732 convertPyToNewIntArr3(li,tmp);
6733 self->setSelectedComponents(f,tmp);
6736 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
6739 DataArrayDouble *a,*a2;
6740 DataArrayDoubleTuple *aa,*aa2;
6741 std::vector<double> bb,bb2;
6744 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
6745 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
6746 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
6747 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
6749 return self->extractSlice3D(orig,vect,eps);
6752 PyObject *___iadd___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6755 Py_XINCREF(trueSelf);
6759 PyObject *___isub___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6762 Py_XINCREF(trueSelf);
6766 PyObject *___imul___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6769 Py_XINCREF(trueSelf);
6773 PyObject *___idiv___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6776 Py_XINCREF(trueSelf);
6780 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6782 std::vector<const MEDCouplingFieldDouble *> tmp;
6783 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6784 return MEDCouplingFieldDouble::MergeFields(tmp);
6787 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
6789 std::vector<const MEDCouplingFieldDouble *> tmp;
6790 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6791 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
6796 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
6799 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
6800 static MEDCouplingFieldTemplate *New(TypeOfField type);
6801 std::string simpleRepr() const;
6802 std::string advancedRepr() const;
6803 void updateTime() const;
6806 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception)
6808 return MEDCouplingFieldTemplate::New(f);
6811 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
6813 return MEDCouplingFieldTemplate::New(type);
6816 std::string __str__() const
6818 return self->simpleRepr();
6823 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
6826 int getNumberOfFields() const;
6827 MEDCouplingMultiFields *deepCpy() const;
6828 virtual std::string simpleRepr() const;
6829 virtual std::string advancedRepr() const;
6830 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6831 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6832 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6833 void updateTime() const throw(INTERP_KERNEL::Exception);
6836 std::string __str__() const
6838 return self->simpleRepr();
6840 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
6842 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6843 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6845 std::vector<MEDCouplingFieldDouble *> fs(sz);
6846 for(int i=0;i<sz;i++)
6847 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6848 return MEDCouplingMultiFields::New(fs);
6850 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6852 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6853 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6855 std::vector<MEDCouplingFieldDouble *> fs(sz);
6856 for(int i=0;i<sz;i++)
6857 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6858 return MEDCouplingMultiFields::New(fs);
6860 PyObject *getFields() const
6862 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
6863 int sz=fields.size();
6864 PyObject *res = PyList_New(sz);
6865 for(int i=0;i<sz;i++)
6869 fields[i]->incrRef();
6870 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
6874 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
6879 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
6881 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
6885 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
6888 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
6890 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
6892 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
6894 PyObject *res = PyList_New(sz);
6895 for(int i=0;i<sz;i++)
6900 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6904 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6909 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
6911 std::vector<int> refs;
6912 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
6914 PyObject *res = PyList_New(sz);
6915 for(int i=0;i<sz;i++)
6920 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6924 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6928 PyObject *ret=PyTuple_New(2);
6929 PyTuple_SetItem(ret,0,res);
6930 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
6933 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
6935 std::vector<DataArrayDouble *> ms=self->getArrays();
6937 PyObject *res = PyList_New(sz);
6938 for(int i=0;i<sz;i++)
6943 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6947 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
6952 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
6954 std::vector< std::vector<int> > refs;
6955 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
6957 PyObject *res = PyList_New(sz);
6958 PyObject *res2 = PyList_New(sz);
6959 for(int i=0;i<sz;i++)
6964 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6968 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
6970 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
6973 PyObject *ret=PyTuple_New(2);
6974 PyTuple_SetItem(ret,0,res);
6975 PyTuple_SetItem(ret,1,res2);
6981 class MEDCouplingDefinitionTime
6984 MEDCouplingDefinitionTime();
6985 void assign(const MEDCouplingDefinitionTime& other);
6986 bool isEqual(const MEDCouplingDefinitionTime& other) const;
6987 double getTimeResolution() const;
6988 std::vector<double> getHotSpotsTime() const;
6991 std::string __str__() const
6993 std::ostringstream oss;
6994 self->appendRepr(oss);
6998 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
7000 int meshId,arrId,arrIdInField,fieldId;
7001 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
7002 PyObject *res=PyList_New(4);
7003 PyList_SetItem(res,0,PyInt_FromLong(meshId));
7004 PyList_SetItem(res,1,PyInt_FromLong(arrId));
7005 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
7006 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
7010 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
7012 int meshId,arrId,arrIdInField,fieldId;
7013 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
7014 PyObject *res=PyList_New(4);
7015 PyList_SetItem(res,0,PyInt_FromLong(meshId));
7016 PyList_SetItem(res,1,PyInt_FromLong(arrId));
7017 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
7018 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
7024 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
7027 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
7028 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
7032 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
7034 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
7035 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
7037 std::vector<MEDCouplingFieldDouble *> fs(sz);
7038 for(int i=0;i<sz;i++)
7039 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
7040 return MEDCouplingFieldOverTime::New(fs);
7042 std::string __str__() const
7044 return self->simpleRepr();
7046 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
7048 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
7049 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
7051 std::vector<MEDCouplingFieldDouble *> fs(sz);
7052 for(int i=0;i<sz;i++)
7053 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
7054 return MEDCouplingFieldOverTime::New(fs);
7062 __filename=os.environ.get('PYTHONSTARTUP')
7063 if __filename and os.path.isfile(__filename):
7064 execfile(__filename)