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::MEDCouplingFieldDiscretization::clone;
82 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
83 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
84 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
85 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
86 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
87 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
88 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
89 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
90 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
91 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
92 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
93 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
94 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
95 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
96 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
97 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
98 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
99 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
100 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
101 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
102 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
103 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
104 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
105 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
106 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
107 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
108 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
109 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
110 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
111 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
112 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
113 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
114 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
115 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
116 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
117 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator+;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator-;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator*;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator/;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
124 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
125 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
126 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
127 %newobject ParaMEDMEM::DataArrayInt::New;
128 %newobject ParaMEDMEM::DataArrayInt::__iter__;
129 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
130 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
131 %newobject ParaMEDMEM::DataArrayInt::performCpy;
132 %newobject ParaMEDMEM::DataArrayInt::substr;
133 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
134 %newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
135 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
136 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
137 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
138 %newobject ParaMEDMEM::DataArrayInt::selectByTupleRanges;
139 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
140 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
141 %newobject ParaMEDMEM::DataArrayInt::renumber;
142 %newobject ParaMEDMEM::DataArrayInt::renumberR;
143 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
144 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
145 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
146 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
147 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
148 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
149 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
150 %newobject ParaMEDMEM::DataArrayInt::negate;
151 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
152 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
153 %newobject ParaMEDMEM::DataArrayInt::Meld;
154 %newobject ParaMEDMEM::DataArrayInt::Add;
155 %newobject ParaMEDMEM::DataArrayInt::Substract;
156 %newobject ParaMEDMEM::DataArrayInt::Multiply;
157 %newobject ParaMEDMEM::DataArrayInt::Divide;
158 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
159 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
160 %newobject ParaMEDMEM::DataArrayInt::Range;
161 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
162 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
163 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
164 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
165 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
166 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
167 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
168 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
169 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
170 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
171 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
172 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
173 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
174 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
175 %newobject ParaMEDMEM::DataArrayInt::__neg__;
176 %newobject ParaMEDMEM::DataArrayInt::__add__;
177 %newobject ParaMEDMEM::DataArrayInt::__radd__;
178 %newobject ParaMEDMEM::DataArrayInt::__sub__;
179 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
180 %newobject ParaMEDMEM::DataArrayInt::__mul__;
181 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
182 %newobject ParaMEDMEM::DataArrayInt::__div__;
183 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
184 %newobject ParaMEDMEM::DataArrayInt::__mod__;
185 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
186 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
187 %newobject ParaMEDMEM::DataArrayDouble::New;
188 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
189 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
190 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
191 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
192 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
193 %newobject ParaMEDMEM::DataArrayDouble::Meld;
194 %newobject ParaMEDMEM::DataArrayDouble::Dot;
195 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
196 %newobject ParaMEDMEM::DataArrayDouble::Add;
197 %newobject ParaMEDMEM::DataArrayDouble::Substract;
198 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
199 %newobject ParaMEDMEM::DataArrayDouble::Divide;
200 %newobject ParaMEDMEM::DataArrayDouble::substr;
201 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
202 %newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
203 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
204 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
205 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
206 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
207 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
208 %newobject ParaMEDMEM::DataArrayDouble::negate;
209 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
210 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
211 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
212 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
213 %newobject ParaMEDMEM::DataArrayDouble::determinant;
214 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
215 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
216 %newobject ParaMEDMEM::DataArrayDouble::inverse;
217 %newobject ParaMEDMEM::DataArrayDouble::trace;
218 %newobject ParaMEDMEM::DataArrayDouble::deviator;
219 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
220 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
221 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
222 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
223 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
224 %newobject ParaMEDMEM::DataArrayDouble::renumber;
225 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
226 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
227 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
228 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
229 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
230 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
231 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
232 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
233 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
234 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
235 %newobject ParaMEDMEM::DataArrayDouble::__add__;
236 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
237 %newobject ParaMEDMEM::DataArrayDouble::__sub__;
238 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
239 %newobject ParaMEDMEM::DataArrayDouble::__mul__;
240 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
241 %newobject ParaMEDMEM::DataArrayDouble::__div__;
242 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
243 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
244 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
245 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
246 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
247 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
248 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
249 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
250 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
251 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
252 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
253 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
254 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
255 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
256 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
257 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
258 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
259 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
260 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
261 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
262 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
263 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::giveCellsWithType;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::computeNbOfNodesPerCell;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
293 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
294 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
295 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
296 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
297 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
298 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
301 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
302 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
303 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
304 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
305 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
306 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
307 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
308 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
309 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
310 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
311 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
312 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
313 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
315 %feature("unref") DataArrayDouble "$this->decrRef();"
316 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
317 %feature("unref") MEDCouplingMesh "$this->decrRef();"
318 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
319 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
320 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
321 %feature("unref") DataArrayInt "$this->decrRef();"
322 %feature("unref") MEDCouplingField "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
325 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
326 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
327 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
328 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
329 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
330 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
331 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
333 %rename(assign) *::operator=;
334 %ignore ParaMEDMEM::MEDCouplingVersionMajMinRel;
335 %ignore ParaMEDMEM::RefCountObject::decrRef;
336 %ignore ParaMEDMEM::MemArray::operator=;
337 %ignore ParaMEDMEM::MemArray::operator[];
338 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
339 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
340 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
341 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
342 %ignore ParaMEDMEM::DataArrayIntIterator::nextt;
343 %ignore ParaMEDMEM::DataArrayIntTuple::repr;
344 %ignore ParaMEDMEM::DataArrayIntTuple::intValue;
345 %ignore ParaMEDMEM::DataArrayDoubleIterator::nextt;
346 %ignore ParaMEDMEM::DataArrayDoubleTuple::repr;
347 %ignore ParaMEDMEM::DataArrayDoubleTuple::doubleValue;
348 %ignore ParaMEDMEM::DataArrayDouble::writeVTK;
349 %ignore ParaMEDMEM::DataArrayInt::writeVTK;
350 %ignore ParaMEDMEM::DataArrayDouble::SetArrayIn;
351 %ignore ParaMEDMEM::DataArrayInt::SetArrayIn;
355 %rename (InterpKernelException) INTERP_KERNEL::Exception;
357 namespace INTERP_KERNEL
362 Exception(const char* what);
363 ~Exception() throw ();
364 const char *what() const throw ();
367 std::string __str__() const
369 return std::string(self->what());
375 %include "MEDCouplingTimeLabel.hxx"
376 %include "MEDCouplingRefCountObject.hxx"
383 UNSTRUCTURED_DESC = 6,
386 } MEDCouplingMeshType;
389 class DataArrayDouble;
390 class MEDCouplingUMesh;
391 class MEDCouplingFieldDouble;
393 %extend RefCountObject
395 std::string getHiddenCppPointer() const
397 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
402 class MEDCouplingMesh : public RefCountObject, public TimeLabel
405 void setName(const char *name);
406 const char *getName() const;
407 void setDescription(const char *descr);
408 const char *getDescription() const;
409 void setTime(double val, int iteration, int order);
410 void setTimeUnit(const char *unit);
411 const char *getTimeUnit() const;
412 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
413 bool isStructured() const throw(INTERP_KERNEL::Exception);
414 virtual MEDCouplingMesh *deepCpy() const;
415 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
416 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
417 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
418 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
419 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
420 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
421 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
422 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
423 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
424 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
425 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
428 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
429 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
430 virtual std::string simpleRepr() const;
431 virtual std::string advancedRepr() const;
432 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
442 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
443 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
444 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
445 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
446 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 std::string __str__() const
451 return self->simpleRepr();
454 PyObject *getTime() throw(INTERP_KERNEL::Exception)
457 double tmp0=self->getTime(tmp1,tmp2);
458 PyObject *res = PyList_New(3);
459 PyList_SetItem(res,0,SWIG_From_double(tmp0));
460 PyList_SetItem(res,1,SWIG_From_int(tmp1));
461 PyList_SetItem(res,2,SWIG_From_int(tmp2));
465 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
469 DataArrayDoubleTuple *aa;
470 std::vector<double> bb;
472 int spaceDim=self->getSpaceDimension();
473 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
474 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
475 return self->getCellContainingPoint(pos,eps);
478 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
482 DataArrayDoubleTuple *aa;
483 std::vector<double> bb;
485 int spaceDim=self->getSpaceDimension();
486 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
487 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
488 std::vector<int> elts,eltsIndex;
489 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
490 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
491 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
492 d0->alloc(elts.size(),1);
493 d1->alloc(eltsIndex.size(),1);
494 std::copy(elts.begin(),elts.end(),d0->getPointer());
495 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
496 PyObject *ret=PyTuple_New(2);
497 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
498 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
504 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
506 std::vector<int> elts,eltsIndex;
507 int spaceDim=self->getSpaceDimension();
509 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
510 if (!SWIG_IsOK(res1))
513 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
514 int nbOfPoints=size/spaceDim;
517 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
519 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
523 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
525 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
526 da2->checkAllocated();
527 int size=da2->getNumberOfTuples();
528 int nbOfCompo=da2->getNumberOfComponents();
529 if(nbOfCompo!=spaceDim)
531 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
533 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
535 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
536 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
537 d0->alloc(elts.size(),1);
538 d1->alloc(eltsIndex.size(),1);
539 std::copy(elts.begin(),elts.end(),d0->getPointer());
540 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
541 PyObject *ret=PyTuple_New(2);
542 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
543 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
549 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
553 DataArrayDoubleTuple *aa;
554 std::vector<double> bb;
556 int spaceDim=self->getSpaceDimension();
557 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
558 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
559 std::vector<int> elts;
560 self->getCellsContainingPoint(pos,eps,elts);
561 DataArrayInt *ret=DataArrayInt::New();
562 ret->alloc((int)elts.size(),1);
563 std::copy(elts.begin(),elts.end(),ret->getPointer());
564 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
567 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
570 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
571 if (!SWIG_IsOK(res1))
574 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
575 self->renumberCells(tmp,check);
579 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
581 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
582 da2->checkAllocated();
583 self->renumberCells(da2->getConstPointer(),check);
587 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
589 DataArrayInt *cellCor, *nodeCor;
590 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
591 PyObject *res = PyList_New(2);
592 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
593 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
596 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
599 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
600 if (!SWIG_IsOK(res1))
603 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
604 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
608 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
610 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
611 da2->checkAllocated();
612 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
615 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
617 std::vector<int> conn;
618 self->getNodeIdsOfCell(cellId,conn);
619 return convertIntArrToPyList2(conn);
622 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
624 std::vector<double> coo;
625 self->getCoordinatesOfNode(nodeId,coo);
626 return convertDblArrToPyList2(coo);
629 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
633 DataArrayDoubleTuple *aa;
634 std::vector<double> bb;
636 int spaceDim=self->getSpaceDimension();
637 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
638 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
639 self->scale(pointPtr,factor);
642 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
644 int spaceDim=self->getSpaceDimension();
645 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
646 self->getBoundingBox(tmp);
647 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
651 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
654 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
655 PyObject *ret=PyTuple_New(2);
656 PyObject *ret0Py=ret0?Py_True:Py_False;
658 PyTuple_SetItem(ret,0,ret0Py);
659 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
663 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
666 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
667 if (!SWIG_IsOK(res1))
670 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
671 MEDCouplingMesh *ret=self->buildPart(tmp,((const int *)tmp)+size);
672 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
676 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
678 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
679 da2->checkAllocated();
680 MEDCouplingMesh *ret=self->buildPart(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
681 ret->setName(da2->getName().c_str());
682 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
686 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
690 MEDCouplingMesh *ret=0;
691 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
692 if (!SWIG_IsOK(res1))
695 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
696 ret=self->buildPartAndReduceNodes(tmp,((const int *)tmp)+size,arr);
700 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
702 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
703 da2->checkAllocated();
704 ret=self->buildPartAndReduceNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),arr);
705 ret->setName(da2->getName().c_str());
707 PyObject *res = PyList_New(2);
708 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
709 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
710 PyList_SetItem(res,0,obj0);
711 PyList_SetItem(res,1,obj1);
715 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
717 std::vector<int> vals=self->getDistributionOfTypes();
718 PyObject *ret=PyList_New((int)vals.size()/3);
719 for(int j=0;j<(int)vals.size()/3;j++)
721 PyObject *ret1=PyList_New(3);
722 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
723 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
724 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
725 PyList_SetItem(ret,j,ret1);
730 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
732 std::vector<int> code;
733 std::vector<const DataArrayInt *> idsPerType;
734 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
735 convertPyToNewIntArr4(li,1,3,code);
736 return self->checkTypeConsistencyAndContig(code,idsPerType);
739 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
741 std::vector<int> code;
742 std::vector<DataArrayInt *> idsInPflPerType;
743 std::vector<DataArrayInt *> idsPerType;
744 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
745 PyObject *ret=PyTuple_New(3);
746 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
747 PyObject *ret1=PyList_New(idsInPflPerType.size());
748 for(std::size_t j=0;j<idsInPflPerType.size();j++)
749 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
750 PyTuple_SetItem(ret,1,ret1);
751 int n=idsPerType.size();
752 PyObject *ret2=PyList_New(n);
754 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
755 PyTuple_SetItem(ret,2,ret2);
759 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
763 DataArrayDoubleTuple *aa;
764 std::vector<double> bb;
766 int spaceDim=self->getSpaceDimension();
767 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
768 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
769 self->translate(vectorPtr);
772 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
774 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
777 DataArrayDoubleTuple *aa;
778 std::vector<double> bb;
780 int spaceDim=self->getSpaceDimension();
781 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
782 self->rotate(centerPtr,0,alpha);
785 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
787 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
790 DataArrayDoubleTuple *aa;
791 std::vector<double> bb;
793 int spaceDim=self->getSpaceDimension();
794 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
795 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,false);
796 self->rotate(centerPtr,vectorPtr,alpha);
799 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
801 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
802 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
803 PyObject *res=PyList_New(result.size());
804 for(int i=0;iL!=result.end(); i++, iL++)
805 PyList_SetItem(res,i,PyInt_FromLong(*iL));
809 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
811 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
812 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
813 return MEDCouplingMesh::MergeMeshes(tmp);
819 %extend ParaMEDMEM::DataArray
821 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
823 const std::vector<std::string>& comps=self->getInfoOnComponents();
824 PyObject *ret=PyList_New((int)comps.size());
825 for(int i=0;i<(int)comps.size();i++)
826 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
830 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
832 std::vector<int> tmp;
833 convertPyToNewIntArr3(li,tmp);
834 self->copyPartOfStringInfoFrom(other,tmp);
837 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
839 std::vector<int> tmp;
840 convertPyToNewIntArr3(li,tmp);
841 self->copyPartOfStringInfoFrom2(tmp,other);
845 %extend ParaMEDMEM::DataArrayInt
847 PyObject *getDifferentValues() const throw(INTERP_KERNEL::Exception)
849 std::set<int> ret=self->getDifferentValues();
850 return convertIntArrToPyList3(ret);
853 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
855 std::vector<int> ret1;
856 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
857 std::size_t sz=ret0.size();
858 PyObject *pyRet=PyTuple_New(2);
859 PyObject *pyRet0=PyList_New((int)sz);
860 PyObject *pyRet1=PyList_New((int)sz);
861 for(std::size_t i=0;i<sz;i++)
863 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
864 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
866 PyTuple_SetItem(pyRet,0,pyRet0);
867 PyTuple_SetItem(pyRet,1,pyRet1);
872 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
874 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
876 int sz=0,sw=-1,val1=-1;
877 std::vector<int> val2;
878 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
879 return self->clonePart(inp,inp+sz);
883 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
885 PyObject *getArrayOfDiscIds() const
887 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
890 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
894 %ignore ParaMEDMEM::DataArray::getInfoOnComponents;
895 %ignore ParaMEDMEM::DataArrayInt::getDifferentValues;
896 %ignore ParaMEDMEM::DataArrayInt::partitionByDifferentValues;
897 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
898 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
900 %include "MEDCouplingMemArray.hxx"
901 %include "NormalizedUnstructuredMesh.hxx"
902 %include "MEDCouplingNatureOfField.hxx"
903 %include "MEDCouplingTimeDiscretization.hxx"
904 %include "MEDCouplingFieldDiscretization.hxx"
905 %include "MEDCouplingGaussLocalization.hxx"
909 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
912 void updateTime() const;
913 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
914 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
915 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
916 void zipCoords() throw(INTERP_KERNEL::Exception);
917 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
918 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
919 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
920 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
921 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
922 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
923 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
924 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
925 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
926 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
927 //! size of returned tinyInfo must be always the same.
928 void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
929 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
930 void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception);
931 void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
932 const std::vector<std::string>& littleStrings) throw(INTERP_KERNEL::Exception);
933 virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) throw(INTERP_KERNEL::Exception);
934 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
935 virtual DataArrayInt *findBoundaryNodes() const;
938 std::string __str__() const
940 return self->simpleRepr();
943 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
946 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
947 PyObject *res = PyList_New(2);
948 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
949 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
953 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
955 DataArrayInt *comm, *commIndex;
956 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
957 PyObject *res = PyList_New(2);
958 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
959 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
963 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
965 DataArrayDouble *ret1=self->getCoords();
967 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
969 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
972 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
973 if (!SWIG_IsOK(res1))
976 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
977 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,((const int *)tmp)+size,keepCoords);
978 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
982 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
984 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
985 da2->checkAllocated();
986 MEDCouplingPointSet *ret=self->buildPartOfMySelf(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),keepCoords);
987 ret->setName(da2->getName().c_str());
988 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
991 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
994 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
995 if (!SWIG_IsOK(res1))
998 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
999 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
1000 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1004 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1006 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1007 da2->checkAllocated();
1008 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1009 ret->setName(da2->getName().c_str());
1010 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1013 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1016 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1017 if (!SWIG_IsOK(res1))
1020 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1021 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
1022 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1026 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1028 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1029 da2->checkAllocated();
1030 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1031 ret->setName(da2->getName().c_str());
1032 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1036 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1039 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1040 if (!SWIG_IsOK(res1))
1043 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1044 self->renumberNodes(tmp,newNbOfNodes);
1048 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1050 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1051 da2->checkAllocated();
1052 self->renumberNodes(da2->getConstPointer(),newNbOfNodes);
1055 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1058 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1059 if (!SWIG_IsOK(res1))
1062 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1063 self->renumberNodes2(tmp,newNbOfNodes);
1067 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1069 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1070 da2->checkAllocated();
1071 self->renumberNodes2(da2->getConstPointer(),newNbOfNodes);
1074 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1076 int spaceDim=self->getSpaceDimension();
1078 DataArrayDouble *a,*a2;
1079 DataArrayDoubleTuple *aa,*aa2;
1080 std::vector<double> bb,bb2;
1082 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1083 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1084 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1085 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1086 std::vector<int> nodes;
1087 self->findNodesOnLine(p,v,eps,nodes);
1088 DataArrayInt *ret=DataArrayInt::New();
1089 ret->alloc((int)nodes.size(),1);
1090 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1091 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1093 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1095 int spaceDim=self->getSpaceDimension();
1097 DataArrayDouble *a,*a2;
1098 DataArrayDoubleTuple *aa,*aa2;
1099 std::vector<double> bb,bb2;
1101 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1102 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1103 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1104 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1105 std::vector<int> nodes;
1106 self->findNodesOnPlane(p,v,eps,nodes);
1107 DataArrayInt *ret=DataArrayInt::New();
1108 ret->alloc((int)nodes.size(),1);
1109 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1112 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1116 DataArrayDoubleTuple *aa;
1117 std::vector<double> bb;
1119 int spaceDim=self->getSpaceDimension();
1120 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1121 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1122 std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
1123 DataArrayInt *ret=DataArrayInt::New();
1124 ret->alloc((int)tmp.size(),1);
1125 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1126 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1129 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
1131 std::vector<int> c,cI;
1135 DataArrayDoubleTuple *aa;
1136 std::vector<double> bb;
1138 int spaceDim=self->getSpaceDimension();
1139 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1140 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
1141 self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
1142 PyObject *ret=PyTuple_New(2);
1143 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1144 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1145 d0->alloc(c.size(),1);
1146 d1->alloc(cI.size(),1);
1147 std::copy(c.begin(),c.end(),d0->getPointer());
1148 std::copy(cI.begin(),cI.end(),d1->getPointer());
1149 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1150 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1156 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1158 std::vector<int> c,cI;
1159 int spaceDim=self->getSpaceDimension();
1161 int res1=SWIG_ConvertPtr(pt,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1162 if (!SWIG_IsOK(res1))
1165 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(pt,&size);
1166 int nbOfPoints=size/spaceDim;
1167 if(size%spaceDim!=0)
1169 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
1171 self->getNodeIdsNearPoints(tmp,nbOfPoints,eps,c,cI);
1175 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
1177 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
1178 da2->checkAllocated();
1179 int size=da2->getNumberOfTuples();
1180 int nbOfCompo=da2->getNumberOfComponents();
1181 if(nbOfCompo!=spaceDim)
1183 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
1185 self->getNodeIdsNearPoints(da2->getConstPointer(),size,eps,c,cI);
1187 PyObject *ret=PyTuple_New(2);
1188 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1189 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1190 d0->alloc(c.size(),1);
1191 d1->alloc(cI.size(),1);
1192 std::copy(c.begin(),c.end(),d0->getPointer());
1193 std::copy(cI.begin(),cI.end(),d1->getPointer());
1194 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1195 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1201 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1203 std::vector<int> elems;
1208 DataArrayDoubleTuple *aa;
1209 std::vector<double> bb;
1211 int spaceDim=self->getSpaceDimension();
1212 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1213 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1215 self->getCellsInBoundingBox(tmp,eps,elems);
1216 DataArrayInt *ret=DataArrayInt::New();
1217 ret->alloc((int)elems.size(),1);
1218 std::copy(elems.begin(),elems.end(),ret->getPointer());
1219 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1222 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1226 std::vector<int> multiVal;
1227 std::pair<int, std::pair<int,int> > slic;
1228 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1229 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1233 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1235 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1237 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1239 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1243 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1246 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1247 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1248 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1249 for(int i=0;i<sz;i++)
1250 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1253 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1256 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1258 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1259 std::vector<double> val3;
1260 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1261 "Rotate2DAlg",2,true,nbNodes);
1263 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1264 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1267 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1270 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1271 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1272 INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1273 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1274 for(int i=0;i<sz;i++)
1275 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1278 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1281 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1283 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1284 std::vector<double> val3;
1285 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1286 "Rotate3DAlg",3,true,nbNodes);
1288 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1289 INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1290 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1295 class MEDCouplingUMeshCell
1298 INTERP_KERNEL::NormalizedCellType getType() const;
1301 std::string __str__() const
1303 return self->repr();
1306 PyObject *getAllConn() const
1309 const int *r=self->getAllConn(ret2);
1310 PyObject *ret=PyTuple_New(ret2);
1311 for(int i=0;i<ret2;i++)
1312 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1318 class MEDCouplingUMeshCellIterator
1325 MEDCouplingUMeshCell *ret=self->nextt();
1327 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1330 PyErr_SetString(PyExc_StopIteration,"No more data.");
1337 class MEDCouplingUMeshCellByTypeIterator
1340 ~MEDCouplingUMeshCellByTypeIterator();
1345 MEDCouplingUMeshCellEntry *ret=self->nextt();
1347 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1350 PyErr_SetString(PyExc_StopIteration,"No more data.");
1357 class MEDCouplingUMeshCellByTypeEntry
1360 ~MEDCouplingUMeshCellByTypeEntry();
1363 MEDCouplingUMeshCellByTypeIterator *__iter__()
1365 return self->iterator();
1370 class MEDCouplingUMeshCellEntry
1373 INTERP_KERNEL::NormalizedCellType getType() const;
1374 int getNumberOfElems() const;
1377 MEDCouplingUMeshCellIterator *__iter__()
1379 return self->iterator();
1384 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1387 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1388 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1389 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1390 void updateTime() const;
1391 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1392 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1393 void allocateCells(int nbOfCells) throw(INTERP_KERNEL::Exception);
1394 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1395 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1396 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1397 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1398 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1399 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1400 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1401 void computeTypes() throw(INTERP_KERNEL::Exception);
1402 DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
1403 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1404 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1406 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1407 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1408 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1409 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1410 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1411 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1412 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1413 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1414 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1415 DataArrayInt *zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception);
1416 DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
1417 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1418 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1419 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1420 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1421 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1422 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1423 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1424 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1425 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1426 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1427 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1428 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1429 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1430 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1431 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1432 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1433 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1434 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1435 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1436 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1437 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1438 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1440 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1442 return MEDCouplingUMesh::New();
1445 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1447 return MEDCouplingUMesh::New(meshName,meshDim);
1450 std::string __str__() const
1452 return self->simpleRepr();
1455 MEDCouplingUMeshCellIterator *__iter__()
1457 return self->cellIterator();
1460 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1464 std::vector<int> multiVal;
1465 std::pair<int, std::pair<int,int> > slic;
1466 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1467 int nbc=self->getNumberOfCells();
1468 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1475 std::ostringstream oss;
1476 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1477 throw INTERP_KERNEL::Exception(oss.str().c_str());
1480 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1485 int tmp=nbc+singleVal;
1486 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1490 std::ostringstream oss;
1491 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1492 throw INTERP_KERNEL::Exception(oss.str().c_str());
1498 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1502 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1507 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1508 daIntTyypp->checkAllocated();
1509 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1512 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1516 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1520 std::vector<int> multiVal;
1521 std::pair<int, std::pair<int,int> > slic;
1522 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1523 int nbc=self->getNumberOfCells();
1524 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1531 std::ostringstream oss;
1532 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1533 throw INTERP_KERNEL::Exception(oss.str().c_str());
1537 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1544 int tmp=nbc+singleVal;
1545 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1550 std::ostringstream oss;
1551 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1552 throw INTERP_KERNEL::Exception(oss.str().c_str());
1558 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1564 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1565 daIntTyypp->checkAllocated();
1566 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1570 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1574 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1578 std::vector<int> multiVal;
1579 std::pair<int, std::pair<int,int> > slic;
1580 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1581 int nbc=self->getNumberOfCells();
1582 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1589 std::ostringstream oss;
1590 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1591 throw INTERP_KERNEL::Exception(oss.str().c_str());
1595 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1602 int tmp=nbc+singleVal;
1603 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1608 std::ostringstream oss;
1609 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1610 throw INTERP_KERNEL::Exception(oss.str().c_str());
1616 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1621 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1627 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1628 daIntTyypp->checkAllocated();
1629 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1633 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1637 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1640 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1643 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << sz << " !";
1644 throw INTERP_KERNEL::Exception(oss.str().c_str());
1646 self->insertNextCell(type,size,tmp);
1649 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1652 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1653 self->insertNextCell(type,sz,tmp);
1656 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1658 DataArrayInt *ret=self->getNodalConnectivity();
1663 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1665 DataArrayInt *ret=self->getNodalConnectivityIndex();
1670 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1672 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1673 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1674 PyObject *res = PyList_New(result.size());
1675 for (int i=0;iL!=result.end(); i++, iL++)
1676 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1679 PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1683 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1684 PyObject *res = PyList_New(3);
1685 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1686 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1687 PyList_SetItem(res,2,SWIG_From_int(ret2));
1690 PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1694 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1695 PyObject *res = PyList_New(3);
1696 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1697 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1698 PyList_SetItem(res,2,SWIG_From_int(ret2));
1701 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1703 std::vector<int> cells;
1704 self->checkButterflyCells(cells,eps);
1705 DataArrayInt *ret=DataArrayInt::New();
1706 ret->alloc((int)cells.size(),1);
1707 std::copy(cells.begin(),cells.end(),ret->getPointer());
1708 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1711 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1713 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1715 PyObject *ret = PyList_New(sz);
1716 for(int i=0;i<sz;i++)
1717 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1721 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1723 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1724 int sz=retCpp.size();
1725 PyObject *ret=PyList_New(sz);
1726 for(int i=0;i<sz;i++)
1727 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1731 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1734 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1735 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1736 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1739 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1742 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1743 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1747 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1750 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1751 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1755 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1757 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1758 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1759 PyObject *ret=PyTuple_New(3);
1760 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1761 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1762 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1766 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1768 DataArrayInt *tmp0=0,*tmp1=0;
1769 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1770 PyObject *ret=PyTuple_New(2);
1771 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1772 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1776 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1780 std::vector<int> multiVal;
1781 std::pair<int, std::pair<int,int> > slic;
1782 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1783 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1787 return self->duplicateNodes(&singleVal,&singleVal+1);
1789 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1791 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1793 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1797 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1801 std::vector<int> multiVal;
1802 std::pair<int, std::pair<int,int> > slic;
1803 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1804 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1808 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1810 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1812 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1814 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1818 void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1821 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1822 if (!SWIG_IsOK(res1))
1825 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1826 self->renumberNodesInConn(tmp);
1830 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1832 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1833 da2->checkAllocated();
1834 self->renumberNodesInConn(da2->getConstPointer());
1838 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1841 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1842 DataArrayInt *tmp0,*tmp1=0;
1843 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1844 PyObject *ret=PyTuple_New(2);
1845 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1846 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1850 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1852 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1853 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1854 DataArrayInt *ret1=0,*ret2=0;
1855 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1856 PyObject *ret=PyTuple_New(3);
1857 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1858 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1859 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1863 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1865 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1866 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1867 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1868 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1871 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1874 std::vector<const MEDCouplingUMesh *> meshes;
1875 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1876 std::vector<DataArrayInt *> corr;
1877 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1879 PyObject *ret1=PyList_New(sz);
1880 for(int i=0;i<sz;i++)
1881 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1882 PyObject *ret=PyList_New(2);
1883 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1884 PyList_SetItem(ret,1,ret1);
1888 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1890 std::vector<MEDCouplingUMesh *> meshes;
1891 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1892 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1895 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1897 std::vector<MEDCouplingUMesh *> meshes;
1898 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1899 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1902 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1906 std::vector<int> multiVal;
1907 std::pair<int, std::pair<int,int> > slic;
1908 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1910 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1911 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1915 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
1917 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
1919 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
1921 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1925 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
1927 DataArrayInt *arrOut=0,*arrIndexOut=0;
1930 std::vector<int> multiVal;
1931 std::pair<int, std::pair<int,int> > slic;
1932 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1934 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
1935 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1940 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
1945 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1950 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1954 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1956 PyObject *ret=PyTuple_New(2);
1957 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1958 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1962 static PyObject *SetPartOfIndexedArrays(PyObject *li,
1963 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
1964 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
1966 DataArrayInt *arrOut=0,*arrIndexOut=0;
1969 std::vector<int> multiVal;
1970 std::pair<int, std::pair<int,int> > slic;
1971 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1973 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
1974 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1979 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1984 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1989 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1993 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1995 PyObject *ret=PyTuple_New(2);
1996 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1997 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2001 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2002 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2006 std::vector<int> multiVal;
2007 std::pair<int, std::pair<int,int> > slic;
2008 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2010 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2011 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2016 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2021 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2026 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2030 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2034 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2038 DataArrayDoubleTuple *aa;
2039 std::vector<double> bb;
2041 int spaceDim=self->getSpaceDimension();
2042 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2043 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2045 std::vector<int> cells;
2046 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2047 DataArrayInt *ret=DataArrayInt::New();
2048 ret->alloc((int)cells.size(),1);
2049 std::copy(cells.begin(),cells.end(),ret->getPointer());
2050 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2053 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2057 DataArrayDoubleTuple *aa;
2058 std::vector<double> bb;
2060 int spaceDim=self->getSpaceDimension();
2061 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2062 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2063 self->orientCorrectly2DCells(v,polyOnly);
2066 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2068 std::vector<int> cells;
2069 self->arePolyhedronsNotCorrectlyOriented(cells);
2070 DataArrayInt *ret=DataArrayInt::New();
2071 ret->alloc((int)cells.size(),1);
2072 std::copy(cells.begin(),cells.end(),ret->getPointer());
2073 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2076 PyObject *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
2078 std::vector<int> cells;
2079 self->findAndCorrectBadOriented3DExtrudedCells(cells);
2080 DataArrayInt *ret=DataArrayInt::New();
2081 ret->alloc((int)cells.size(),1);
2082 std::copy(cells.begin(),cells.end(),ret->getPointer());
2083 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2086 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2090 self->getFastAveragePlaneOfThis(vec,pos);
2092 std::copy(vec,vec+3,vals);
2093 std::copy(pos,pos+3,vals+3);
2094 return convertDblArrToPyListOfTuple(vals,3,2);
2097 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2099 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2100 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2101 return MEDCouplingUMesh::MergeUMeshes(tmp);
2104 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2107 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2108 PyObject *ret=PyTuple_New(2);
2109 PyObject *ret0Py=ret0?Py_True:Py_False;
2111 PyTuple_SetItem(ret,0,ret0Py);
2112 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2116 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2119 bool ret0=self->areCellsIncludedIn2(other,ret1);
2120 PyObject *ret=PyTuple_New(2);
2121 PyObject *ret0Py=ret0?Py_True:Py_False;
2123 PyTuple_SetItem(ret,0,ret0Py);
2124 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2128 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2130 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2132 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2133 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2134 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2135 PyObject *ret=PyTuple_New(5);
2136 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2137 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2138 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2139 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2140 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2148 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2150 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2151 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2153 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2154 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2155 PyObject *ret=PyTuple_New(5);
2156 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2157 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2158 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2160 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2168 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2170 DataArrayInt *neighbors=0,*neighborsIdx=0;
2171 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2172 PyObject *ret=PyTuple_New(2);
2173 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2174 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2178 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2180 DataArrayInt *neighbors=0,*neighborsIdx=0;
2181 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2182 PyObject *ret=PyTuple_New(2);
2183 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2184 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2188 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2190 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2191 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2192 DataArrayInt *d2,*d3,*d4,*dd5;
2193 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2194 PyObject *ret=PyTuple_New(7);
2195 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2196 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2197 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2199 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2200 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2201 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2207 PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2209 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2210 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2211 self->getReverseNodalConnectivity(d0,d1);
2212 PyObject *ret=PyTuple_New(2);
2213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2220 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2223 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2224 da->checkAllocated();
2225 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2228 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2231 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2232 da->checkAllocated();
2233 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2236 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2239 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2240 da->checkAllocated();
2241 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2244 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2247 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2248 da->checkAllocated();
2249 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2250 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2251 PyObject *res = PyList_New(result.size());
2252 for (int i=0;iL!=result.end(); i++, iL++)
2253 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2257 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2260 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2261 da->checkAllocated();
2262 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2263 ret->setName(da->getName().c_str());
2267 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2270 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2271 if (!SWIG_IsOK(res1))
2274 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2275 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
2279 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2281 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2282 da2->checkAllocated();
2283 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
2287 PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
2290 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
2291 PyObject *ret=PyTuple_New(2);
2292 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2293 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2297 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2299 DataArrayInt *cellNb1=0,*cellNb2=0;
2300 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2301 PyObject *ret=PyTuple_New(3);
2302 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2303 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2304 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2310 int spaceDim=self->getSpaceDimension();
2312 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2314 DataArrayDouble *a,*a2;
2315 DataArrayDoubleTuple *aa,*aa2;
2316 std::vector<double> bb,bb2;
2318 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2319 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2320 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2321 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2323 DataArrayInt *cellIds=0;
2324 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2325 PyObject *ret=PyTuple_New(2);
2326 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2333 int spaceDim=self->getSpaceDimension();
2335 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2337 DataArrayDouble *a,*a2;
2338 DataArrayDoubleTuple *aa,*aa2;
2339 std::vector<double> bb,bb2;
2341 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2342 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2343 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2344 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2346 DataArrayInt *cellIds=0;
2347 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2348 PyObject *ret=PyTuple_New(2);
2349 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2350 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2354 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2356 int spaceDim=self->getSpaceDimension();
2358 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2360 DataArrayDouble *a,*a2;
2361 DataArrayDoubleTuple *aa,*aa2;
2362 std::vector<double> bb,bb2;
2364 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2365 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2366 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2367 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2368 return self->getCellIdsCrossingPlane(orig,vect,eps);
2371 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2375 std::vector<int> pos2;
2376 DataArrayInt *pos3=0;
2377 DataArrayIntTuple *pos4=0;
2378 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2383 self->convertToPolyTypes(&pos1,&pos1+1);
2390 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2395 self->convertToPolyTypes(pos3->begin(),pos3->end());
2399 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2403 void convertAllToPoly();
2404 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2405 bool unPolyze() throw(INTERP_KERNEL::Exception);
2406 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2407 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2408 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2411 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2414 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2415 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2416 void updateTime() const throw(INTERP_KERNEL::Exception);
2418 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2420 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2423 std::string __str__() const
2425 return self->simpleRepr();
2427 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2429 MEDCouplingUMesh *ret=self->getMesh2D();
2431 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2433 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2435 MEDCouplingUMesh *ret=self->getMesh1D();
2437 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2439 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2441 DataArrayInt *ret=self->getMesh3DIds();
2443 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2448 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingMesh
2451 static MEDCouplingCMesh *New();
2452 static MEDCouplingCMesh *New(const char *meshName);
2453 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2454 void setCoords(const DataArrayDouble *coordsX,
2455 const DataArrayDouble *coordsY=0,
2456 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2457 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2458 void updateTime() const throw(INTERP_KERNEL::Exception);
2462 return MEDCouplingCMesh::New();
2464 MEDCouplingCMesh(const char *meshName)
2466 return MEDCouplingCMesh::New(meshName);
2468 std::string __str__() const
2470 return self->simpleRepr();
2472 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2474 DataArrayDouble *ret=self->getCoordsAt(i);
2482 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2484 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2487 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2488 PyObject *ret=PyTuple_New(2);
2489 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2490 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2495 %extend ParaMEDMEM::DataArrayDoubleIterator
2499 DataArrayDoubleTuple *ret=self->nextt();
2501 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2504 PyErr_SetString(PyExc_StopIteration,"No more data.");
2510 %extend ParaMEDMEM::DataArrayDoubleTuple
2512 std::string __str__() const
2514 return self->repr();
2517 double __float__() const throw(INTERP_KERNEL::Exception)
2519 return self->doubleValue();
2522 DataArrayDouble *buildDADouble()
2524 return self->buildDADouble(1,self->getNumberOfCompo());
2527 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2529 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2530 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2531 Py_XINCREF(trueSelf);
2535 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2537 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2538 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2539 Py_XINCREF(trueSelf);
2543 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2545 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2546 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2547 Py_XINCREF(trueSelf);
2551 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2553 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2554 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2555 Py_XINCREF(trueSelf);
2559 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2563 std::vector<int> multiVal;
2564 std::pair<int, std::pair<int,int> > slic;
2565 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2566 const double *pt=self->getConstPointer();
2567 int nbc=self->getNumberOfCompo();
2568 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2575 std::ostringstream oss;
2576 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2577 throw INTERP_KERNEL::Exception(oss.str().c_str());
2580 return PyFloat_FromDouble(pt[singleVal]);
2584 return PyFloat_FromDouble(pt[nbc+singleVal]);
2587 std::ostringstream oss;
2588 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2589 throw INTERP_KERNEL::Exception(oss.str().c_str());
2595 PyObject *t=PyTuple_New(multiVal.size());
2596 for(int j=0;j<(int)multiVal.size();j++)
2598 int cid=multiVal[j];
2601 std::ostringstream oss;
2602 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2603 throw INTERP_KERNEL::Exception(oss.str().c_str());
2605 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2611 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2612 PyObject *t=PyTuple_New(sz);
2613 for(int j=0;j<sz;j++)
2614 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2618 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2622 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2624 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2627 std::vector<double> multiValV;
2628 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2629 int nbc=self->getNumberOfCompo();
2630 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2632 std::vector<int> multiVal;
2633 std::pair<int, std::pair<int,int> > slic;
2634 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2635 double *pt=self->getPointer();
2636 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2643 std::ostringstream oss;
2644 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2645 throw INTERP_KERNEL::Exception(oss.str().c_str());
2651 pt[singleVal]=singleValV;
2656 if(multiValV.size()!=1)
2658 std::ostringstream oss;
2659 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2660 throw INTERP_KERNEL::Exception(oss.str().c_str());
2662 pt[singleVal]=multiValV[0];
2667 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2671 throw INTERP_KERNEL::Exception(msg);
2680 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2684 std::ostringstream oss;
2685 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2686 throw INTERP_KERNEL::Exception(oss.str().c_str());
2694 if(multiVal.size()!=multiValV.size())
2696 std::ostringstream oss;
2697 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2698 throw INTERP_KERNEL::Exception(oss.str().c_str());
2700 for(int i=0;i<(int)multiVal.size();i++)
2702 int pos=multiVal[i];
2705 std::ostringstream oss;
2706 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2707 throw INTERP_KERNEL::Exception(oss.str().c_str());
2709 pt[multiVal[i]]=multiValV[i];
2715 const double *ptV=daIntTyyppV->getConstPointer();
2716 if(nbc>daIntTyyppV->getNumberOfCompo())
2718 std::ostringstream oss;
2719 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2720 throw INTERP_KERNEL::Exception(oss.str().c_str());
2722 std::copy(ptV,ptV+nbc,pt);
2726 throw INTERP_KERNEL::Exception(msg);
2731 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2736 for(int j=0;j<sz;j++)
2737 pt[slic.first+j*slic.second.second]=singleValV;
2742 if(sz!=(int)multiValV.size())
2744 std::ostringstream oss;
2745 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2746 throw INTERP_KERNEL::Exception(oss.str().c_str());
2748 for(int j=0;j<sz;j++)
2749 pt[slic.first+j*slic.second.second]=multiValV[j];
2754 const double *ptV=daIntTyyppV->getConstPointer();
2755 if(sz>daIntTyyppV->getNumberOfCompo())
2757 std::ostringstream oss;
2758 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2759 throw INTERP_KERNEL::Exception(oss.str().c_str());
2761 for(int j=0;j<sz;j++)
2762 pt[slic.first+j*slic.second.second]=ptV[j];
2766 throw INTERP_KERNEL::Exception(msg);
2770 throw INTERP_KERNEL::Exception(msg);
2775 %extend ParaMEDMEM::DataArrayDouble
2777 DataArrayDouble() throw(INTERP_KERNEL::Exception)
2779 return DataArrayDouble::New();
2782 static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2784 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) !";
2785 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2789 if(PyInt_Check(elt1))
2791 int nbOfTuples=PyInt_AS_LONG(elt1);
2793 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2796 if(PyInt_Check(elt2))
2797 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
2798 int nbOfCompo=PyInt_AS_LONG(elt2);
2800 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2801 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2802 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples,nbOfCompo);
2803 ret->alloc(nbOfTuples,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2808 throw INTERP_KERNEL::Exception(msg);
2811 {//DataArrayDouble.New([1.,3.,4.],3)
2812 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2814 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples,tmpp1);
2815 ret->alloc(nbOfTuples,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2821 throw INTERP_KERNEL::Exception(msg);
2824 {// DataArrayDouble.New([1.,3.,4.])
2825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2826 int tmpp1=-1,tmpp2=-1;
2827 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
2828 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2833 else if(PyInt_Check(elt0))
2835 int nbOfTuples=PyInt_AS_LONG(elt0);
2837 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2842 if(PyInt_Check(elt1))
2843 {//DataArrayDouble.New(5,2)
2844 int nbOfCompo=PyInt_AS_LONG(elt1);
2846 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2847 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2848 ret->alloc(nbOfTuples,nbOfCompo);
2853 throw INTERP_KERNEL::Exception(msg);
2856 throw INTERP_KERNEL::Exception(msg);
2859 {//DataArrayDouble.New(5)
2860 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2861 ret->alloc(nbOfTuples,1);
2867 throw INTERP_KERNEL::Exception(msg);
2870 DataArrayDouble(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2872 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,elt1,elt2);
2875 std::string __str__() const
2877 return self->repr();
2880 double __float__() const throw(INTERP_KERNEL::Exception)
2882 return self->doubleValue();
2885 int __len__() const throw(INTERP_KERNEL::Exception)
2887 if(self->isAllocated())
2889 return self->getNumberOfTuples();
2893 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
2897 DataArrayDoubleIterator *__iter__()
2899 return self->iterator();
2902 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
2904 double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
2907 fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
2909 catch(INTERP_KERNEL::Exception& e)
2914 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
2917 PyObject *getValues() throw(INTERP_KERNEL::Exception)
2919 const double *vals=self->getPointer();
2920 return convertDblArrToPyList(vals,self->getNbOfElems());
2923 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
2926 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
2927 PyObject *ret=PyTuple_New(2);
2928 PyObject *ret0Py=ret0?Py_True:Py_False;
2930 PyTuple_SetItem(ret,0,ret0Py);
2931 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2935 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
2937 const double *vals=self->getPointer();
2938 int nbOfComp=self->getNumberOfComponents();
2939 int nbOfTuples=self->getNumberOfTuples();
2940 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2943 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2946 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2947 if (!SWIG_IsOK(res1))
2950 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2951 if(size!=self->getNumberOfTuples())
2953 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2955 return self->renumber(tmp);
2959 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2961 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2962 da2->checkAllocated();
2963 int size=self->getNumberOfTuples();
2964 if(size!=self->getNumberOfTuples())
2966 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2968 return self->renumber(da2->getConstPointer());
2972 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2975 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2976 if (!SWIG_IsOK(res1))
2979 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2980 if(size!=self->getNumberOfTuples())
2982 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2984 return self->renumberR(tmp);
2988 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2990 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2991 da2->checkAllocated();
2992 int size=self->getNumberOfTuples();
2993 if(size!=self->getNumberOfTuples())
2995 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2997 return self->renumberR(da2->getConstPointer());
3001 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3004 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3005 if (!SWIG_IsOK(res1))
3008 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3009 if(size!=self->getNumberOfTuples())
3011 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3013 return self->renumberAndReduce(tmp,newNbOfTuple);
3017 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3019 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3020 da2->checkAllocated();
3021 int size=self->getNumberOfTuples();
3022 if(size!=self->getNumberOfTuples())
3024 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3026 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3030 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
3033 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3034 if (!SWIG_IsOK(res1))
3037 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3038 if(size!=self->getNumberOfTuples())
3040 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3042 self->renumberInPlace(tmp);
3046 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3048 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3049 da2->checkAllocated();
3050 int size=self->getNumberOfTuples();
3051 if(size!=self->getNumberOfTuples())
3053 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3055 self->renumberInPlace(da2->getConstPointer());
3059 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
3062 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3063 if (!SWIG_IsOK(res1))
3066 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3067 if(size!=self->getNumberOfTuples())
3069 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3071 self->renumberInPlaceR(tmp);
3075 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3077 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3078 da2->checkAllocated();
3079 int size=self->getNumberOfTuples();
3080 if(size!=self->getNumberOfTuples())
3082 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3084 self->renumberInPlaceR(da2->getConstPointer());
3088 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
3091 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3092 if (!SWIG_IsOK(res1))
3095 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3096 return self->selectByTupleId(tmp,tmp+size);
3100 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3102 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3103 da2->checkAllocated();
3104 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3108 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
3111 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3112 if (!SWIG_IsOK(res1))
3115 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3116 return self->selectByTupleIdSafe(tmp,tmp+size);
3120 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3122 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3123 da2->checkAllocated();
3124 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3128 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3131 double r1=self->getMaxValue(tmp);
3132 PyObject *ret=PyTuple_New(2);
3133 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3134 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3138 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3141 double r1=self->getMaxValue2(tmp);
3142 PyObject *ret=PyTuple_New(2);
3143 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3144 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3148 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3151 double r1=self->getMinValue(tmp);
3152 PyObject *ret=PyTuple_New(2);
3153 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3154 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3158 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3161 double r1=self->getMinValue2(tmp);
3162 PyObject *ret=PyTuple_New(2);
3163 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3164 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3168 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
3170 int nbOfCompo=self->getNumberOfComponents();
3171 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
3172 self->getMinMaxPerComponent(tmp);
3173 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
3177 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3179 int sz=self->getNumberOfComponents();
3180 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3181 self->accumulate(tmp);
3182 return convertDblArrToPyList(tmp,sz);
3185 DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3187 std::vector<int> tmp;
3188 convertPyToNewIntArr3(li,tmp);
3189 return self->keepSelectedComponents(tmp);
3192 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
3194 DataArrayInt *comm, *commIndex;
3195 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
3196 PyObject *res = PyList_New(2);
3197 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3198 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3202 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3204 std::vector<int> tmp;
3205 convertPyToNewIntArr3(li,tmp);
3206 self->setSelectedComponents(a,tmp);
3209 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3211 int sz=self->getNumberOfComponents();
3212 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3213 self->getTuple(tupleId,tmp);
3214 return convertDblArrToPyList(tmp,sz);
3217 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3219 std::vector<const DataArrayDouble *> tmp;
3220 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3221 return DataArrayDouble::Aggregate(tmp);
3224 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3226 std::vector<const DataArrayDouble *> tmp;
3227 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3228 return DataArrayDouble::Meld(tmp);
3231 DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
3233 std::vector<std::pair<int,int> > ranges;
3234 convertPyToVectorPairInt(li,ranges);
3235 return self->selectByTupleRanges(ranges);
3238 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
3242 DataArrayDoubleTuple *aa;
3243 std::vector<double> bb;
3245 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
3246 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
3247 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
3248 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
3249 std::vector<int> c,cI;
3250 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
3251 DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
3252 ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
3253 ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
3254 PyObject *ret=PyTuple_New(2);
3255 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3256 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3260 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3262 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
3263 self->checkAllocated();
3264 int nbOfTuples=self->getNumberOfTuples();
3265 int nbOfComponents=self->getNumberOfComponents();
3267 std::vector<int> vt1,vc1;
3268 std::pair<int, std::pair<int,int> > pt1,pc1;
3269 DataArrayInt *dt1=0,*dc1=0;
3271 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3272 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
3276 if(nbOfComponents==1)
3277 return PyFloat_FromDouble(self->getIJSafe(it1,0));
3278 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3280 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3282 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3284 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3286 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
3289 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3290 std::vector<int> v2(1,ic1);
3291 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3295 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3296 std::vector<int> v2(1,ic1);
3297 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3301 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3302 std::vector<int> v2(1,ic1);
3303 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3307 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3308 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3312 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3313 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3317 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3318 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3322 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3323 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3327 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3328 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3329 std::vector<int> v2(nbOfComp);
3330 for(int i=0;i<nbOfComp;i++)
3331 v2[i]=pc1.first+i*pc1.second.second;
3332 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3336 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3337 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3338 std::vector<int> v2(nbOfComp);
3339 for(int i=0;i<nbOfComp;i++)
3340 v2[i]=pc1.first+i*pc1.second.second;
3341 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3345 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3346 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3347 std::vector<int> v2(nbOfComp);
3348 for(int i=0;i<nbOfComp;i++)
3349 v2[i]=pc1.first+i*pc1.second.second;
3350 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3354 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3355 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3356 std::vector<int> v2(nbOfComp);
3357 for(int i=0;i<nbOfComp;i++)
3358 v2[i]=pc1.first+i*pc1.second.second;
3359 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3362 throw INTERP_KERNEL::Exception(msg);
3366 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3368 self->checkAllocated();
3369 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
3370 int nbOfTuples=self->getNumberOfTuples();
3371 int nbOfComponents=self->getNumberOfComponents();
3374 std::vector<double> v1;
3375 DataArrayDouble *d1=0;
3376 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
3378 std::vector<int> vt1,vc1;
3379 std::pair<int, std::pair<int,int> > pt1,pc1;
3380 DataArrayInt *dt1=0,*dc1=0;
3381 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3382 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
3390 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3393 tmp=DataArrayDouble::New();
3394 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3395 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3398 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3401 throw INTERP_KERNEL::Exception(msg);
3410 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3413 tmp=DataArrayDouble::New();
3414 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3415 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3418 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3421 throw INTERP_KERNEL::Exception(msg);
3430 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3433 tmp=DataArrayDouble::New();
3434 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3435 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3438 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3441 throw INTERP_KERNEL::Exception(msg);
3450 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3453 tmp=DataArrayDouble::New();
3454 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3455 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3458 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3461 throw INTERP_KERNEL::Exception(msg);
3470 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3473 tmp=DataArrayDouble::New();
3474 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3475 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3478 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3481 throw INTERP_KERNEL::Exception(msg);
3490 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3493 tmp=DataArrayDouble::New();
3494 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3495 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3498 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3501 throw INTERP_KERNEL::Exception(msg);
3510 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3513 tmp=DataArrayDouble::New();
3514 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3515 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3518 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3521 throw INTERP_KERNEL::Exception(msg);
3530 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3533 tmp=DataArrayDouble::New();
3534 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3535 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3538 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3541 throw INTERP_KERNEL::Exception(msg);
3550 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3553 tmp=DataArrayDouble::New();
3554 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3555 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3558 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3561 throw INTERP_KERNEL::Exception(msg);
3570 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3573 tmp=DataArrayDouble::New();
3574 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3575 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3578 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3581 throw INTERP_KERNEL::Exception(msg);
3588 int ee=pt1.second.first;
3589 int ss=pt1.second.second;
3591 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
3592 int nbOfE=(ee-bb)/ss;
3593 std::vector<int> nv(nbOfE);
3594 for(int jj=0;jj<nbOfE;jj++)
3599 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3602 tmp=DataArrayDouble::New();
3603 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3604 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3607 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3610 throw INTERP_KERNEL::Exception(msg);
3619 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3622 tmp=DataArrayDouble::New();
3623 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3624 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3627 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3630 throw INTERP_KERNEL::Exception(msg);
3639 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3642 tmp=DataArrayDouble::New();
3643 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3644 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3647 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3650 throw INTERP_KERNEL::Exception(msg);
3659 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3662 tmp=DataArrayDouble::New();
3663 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3664 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3667 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3670 throw INTERP_KERNEL::Exception(msg);
3679 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3682 tmp=DataArrayDouble::New();
3683 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3684 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3687 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3690 throw INTERP_KERNEL::Exception(msg);
3699 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3702 tmp=DataArrayDouble::New();
3703 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3704 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3707 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3710 throw INTERP_KERNEL::Exception(msg);
3715 throw INTERP_KERNEL::Exception(msg);
3720 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3722 return self->negate();
3725 DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3727 const char msg[]="Unexpected situation in __add__ !";
3730 DataArrayDoubleTuple *aa;
3731 std::vector<double> bb;
3733 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3738 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3739 ret->applyLin(1.,val);
3745 return DataArrayDouble::Add(self,a);
3749 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3750 return DataArrayDouble::Add(self,aaa);
3754 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3755 return DataArrayDouble::Add(self,aaa);
3758 throw INTERP_KERNEL::Exception(msg);
3762 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3764 const char msg[]="Unexpected situation in __radd__ !";
3767 DataArrayDoubleTuple *aa;
3768 std::vector<double> bb;
3770 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3775 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3776 ret->applyLin(1.,val);
3782 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3783 return DataArrayDouble::Add(self,aaa);
3787 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3788 return DataArrayDouble::Add(self,aaa);
3791 throw INTERP_KERNEL::Exception(msg);
3795 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3797 const char msg[]="Unexpected situation in __iadd__ !";
3800 DataArrayDoubleTuple *aa;
3801 std::vector<double> bb;
3803 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3808 self->applyLin(1.,val);
3809 Py_XINCREF(trueSelf);
3815 Py_XINCREF(trueSelf);
3820 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3821 self->addEqual(aaa);
3822 Py_XINCREF(trueSelf);
3827 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3828 self->addEqual(aaa);
3829 Py_XINCREF(trueSelf);
3833 throw INTERP_KERNEL::Exception(msg);
3837 DataArrayDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3839 const char msg[]="Unexpected situation in __sub__ !";
3842 DataArrayDoubleTuple *aa;
3843 std::vector<double> bb;
3845 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3850 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3851 ret->applyLin(1.,-val);
3857 return DataArrayDouble::Substract(self,a);
3861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3862 return DataArrayDouble::Substract(self,aaa);
3866 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3867 return DataArrayDouble::Substract(self,aaa);
3870 throw INTERP_KERNEL::Exception(msg);
3874 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3876 const char msg[]="Unexpected situation in __rsub__ !";
3879 DataArrayDoubleTuple *aa;
3880 std::vector<double> bb;
3882 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3887 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3888 ret->applyLin(-1.,val);
3894 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3895 return DataArrayDouble::Substract(aaa,self);
3899 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3900 return DataArrayDouble::Substract(aaa,self);
3903 throw INTERP_KERNEL::Exception(msg);
3907 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3909 const char msg[]="Unexpected situation in __isub__ !";
3912 DataArrayDoubleTuple *aa;
3913 std::vector<double> bb;
3915 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3920 self->applyLin(1,-val);
3921 Py_XINCREF(trueSelf);
3926 self->substractEqual(a);
3927 Py_XINCREF(trueSelf);
3932 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3933 self->substractEqual(aaa);
3934 Py_XINCREF(trueSelf);
3939 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3940 self->substractEqual(aaa);
3941 Py_XINCREF(trueSelf);
3945 throw INTERP_KERNEL::Exception(msg);
3949 DataArrayDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3951 const char msg[]="Unexpected situation in __mul__ !";
3954 DataArrayDoubleTuple *aa;
3955 std::vector<double> bb;
3957 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3962 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3963 ret->applyLin(val,0.);
3969 return DataArrayDouble::Multiply(self,a);
3973 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3974 return DataArrayDouble::Multiply(self,aaa);
3978 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3979 return DataArrayDouble::Multiply(self,aaa);
3982 throw INTERP_KERNEL::Exception(msg);
3986 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3988 const char msg[]="Unexpected situation in __rmul__ !";
3991 DataArrayDoubleTuple *aa;
3992 std::vector<double> bb;
3994 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4000 ret->applyLin(val,0.);
4006 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4007 return DataArrayDouble::Multiply(self,aaa);
4011 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4012 return DataArrayDouble::Multiply(self,aaa);
4015 throw INTERP_KERNEL::Exception(msg);
4019 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4021 const char msg[]="Unexpected situation in __imul__ !";
4024 DataArrayDoubleTuple *aa;
4025 std::vector<double> bb;
4027 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4032 self->applyLin(val,0.);
4033 Py_XINCREF(trueSelf);
4038 self->multiplyEqual(a);
4039 Py_XINCREF(trueSelf);
4044 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4045 self->multiplyEqual(aaa);
4046 Py_XINCREF(trueSelf);
4051 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4052 self->multiplyEqual(aaa);
4053 Py_XINCREF(trueSelf);
4057 throw INTERP_KERNEL::Exception(msg);
4061 DataArrayDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4063 const char msg[]="Unexpected situation in __div__ !";
4066 DataArrayDoubleTuple *aa;
4067 std::vector<double> bb;
4069 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4075 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4077 ret->applyLin(1/val,0.);
4083 return DataArrayDouble::Divide(self,a);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4088 return DataArrayDouble::Divide(self,aaa);
4092 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4093 return DataArrayDouble::Divide(self,aaa);
4096 throw INTERP_KERNEL::Exception(msg);
4100 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4102 const char msg[]="Unexpected situation in __rdiv__ !";
4105 DataArrayDoubleTuple *aa;
4106 std::vector<double> bb;
4108 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4113 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4120 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4121 return DataArrayDouble::Divide(aaa,self);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4126 return DataArrayDouble::Divide(aaa,self);
4129 throw INTERP_KERNEL::Exception(msg);
4133 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 const char msg[]="Unexpected situation in __idiv__ !";
4138 DataArrayDoubleTuple *aa;
4139 std::vector<double> bb;
4141 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4147 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
4148 self->applyLin(1./val,0.);
4149 Py_XINCREF(trueSelf);
4154 self->divideEqual(a);
4155 Py_XINCREF(trueSelf);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4161 self->divideEqual(aaa);
4162 Py_XINCREF(trueSelf);
4167 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4168 self->divideEqual(aaa);
4169 Py_XINCREF(trueSelf);
4173 throw INTERP_KERNEL::Exception(msg);
4177 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
4179 std::vector<int> c,cI;
4181 self->computeTupleIdsNearTuples(other,eps,c,cI);
4182 PyObject *ret=PyTuple_New(2);
4183 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
4184 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
4185 d0->alloc(c.size(),1);
4186 d1->alloc(cI.size(),1);
4187 std::copy(c.begin(),c.end(),d0->getPointer());
4188 std::copy(cI.begin(),cI.end(),d1->getPointer());
4189 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4190 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4197 %extend ParaMEDMEM::DataArrayIntTuple
4199 std::string __str__() const
4201 return self->repr();
4204 int __int__() const throw(INTERP_KERNEL::Exception)
4206 return self->intValue();
4209 DataArrayInt *buildDAInt()
4211 return self->buildDAInt(1,self->getNumberOfCompo());
4214 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4217 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4218 Py_XINCREF(trueSelf);
4222 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4224 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4225 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4226 Py_XINCREF(trueSelf);
4230 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4232 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4233 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4234 Py_XINCREF(trueSelf);
4238 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4240 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4241 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4242 Py_XINCREF(trueSelf);
4246 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4249 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4250 Py_XINCREF(trueSelf);
4254 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4258 std::vector<int> multiVal;
4259 std::pair<int, std::pair<int,int> > slic;
4260 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4261 const int *pt=self->getConstPointer();
4262 int nbc=self->getNumberOfCompo();
4263 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4270 std::ostringstream oss;
4271 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4272 throw INTERP_KERNEL::Exception(oss.str().c_str());
4275 return PyInt_FromLong(pt[singleVal]);
4279 return PyInt_FromLong(pt[nbc+singleVal]);
4282 std::ostringstream oss;
4283 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4284 throw INTERP_KERNEL::Exception(oss.str().c_str());
4290 PyObject *t=PyTuple_New(multiVal.size());
4291 for(int j=0;j<(int)multiVal.size();j++)
4293 int cid=multiVal[j];
4296 std::ostringstream oss;
4297 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4298 throw INTERP_KERNEL::Exception(oss.str().c_str());
4300 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4306 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4307 PyObject *t=PyTuple_New(sz);
4308 for(int j=0;j<sz;j++)
4309 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4313 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4317 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4319 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4322 std::vector<int> multiValV;
4323 std::pair<int, std::pair<int,int> > slicV;
4324 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4325 int nbc=self->getNumberOfCompo();
4326 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4328 std::vector<int> multiVal;
4329 std::pair<int, std::pair<int,int> > slic;
4330 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4331 int *pt=self->getPointer();
4332 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4339 std::ostringstream oss;
4340 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4341 throw INTERP_KERNEL::Exception(oss.str().c_str());
4347 pt[singleVal]=singleValV;
4352 if(multiValV.size()!=1)
4354 std::ostringstream oss;
4355 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4356 throw INTERP_KERNEL::Exception(oss.str().c_str());
4358 pt[singleVal]=multiValV[0];
4363 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4367 throw INTERP_KERNEL::Exception(msg);
4376 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4380 std::ostringstream oss;
4381 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4382 throw INTERP_KERNEL::Exception(oss.str().c_str());
4390 if(multiVal.size()!=multiValV.size())
4392 std::ostringstream oss;
4393 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4394 throw INTERP_KERNEL::Exception(oss.str().c_str());
4396 for(int i=0;i<(int)multiVal.size();i++)
4398 int pos=multiVal[i];
4401 std::ostringstream oss;
4402 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4403 throw INTERP_KERNEL::Exception(oss.str().c_str());
4405 pt[multiVal[i]]=multiValV[i];
4411 const int *ptV=daIntTyyppV->getConstPointer();
4412 if(nbc>daIntTyyppV->getNumberOfCompo())
4414 std::ostringstream oss;
4415 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4416 throw INTERP_KERNEL::Exception(oss.str().c_str());
4418 std::copy(ptV,ptV+nbc,pt);
4422 throw INTERP_KERNEL::Exception(msg);
4427 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4432 for(int j=0;j<sz;j++)
4433 pt[slic.first+j*slic.second.second]=singleValV;
4438 if(sz!=(int)multiValV.size())
4440 std::ostringstream oss;
4441 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4442 throw INTERP_KERNEL::Exception(oss.str().c_str());
4444 for(int j=0;j<sz;j++)
4445 pt[slic.first+j*slic.second.second]=multiValV[j];
4450 const int *ptV=daIntTyyppV->getConstPointer();
4451 if(sz>daIntTyyppV->getNumberOfCompo())
4453 std::ostringstream oss;
4454 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4455 throw INTERP_KERNEL::Exception(oss.str().c_str());
4457 for(int j=0;j<sz;j++)
4458 pt[slic.first+j*slic.second.second]=ptV[j];
4462 throw INTERP_KERNEL::Exception(msg);
4466 throw INTERP_KERNEL::Exception(msg);
4471 %extend ParaMEDMEM::DataArrayIntIterator
4475 DataArrayIntTuple *ret=self->nextt();
4477 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4480 PyErr_SetString(PyExc_StopIteration,"No more data.");
4486 %extend ParaMEDMEM::DataArrayInt
4488 DataArrayInt() throw(INTERP_KERNEL::Exception)
4490 return DataArrayInt::New();
4493 static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4495 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) !";
4496 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4500 if(PyInt_Check(elt1))
4502 int nbOfTuples=PyInt_AS_LONG(elt1);
4504 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4507 if(PyInt_Check(elt2))
4508 {//DataArrayInt.New([1,3,4,5],2,2)
4509 int nbOfCompo=PyInt_AS_LONG(elt2);
4511 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4512 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4513 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples,nbOfCompo);
4514 ret->alloc(nbOfTuples,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4519 throw INTERP_KERNEL::Exception(msg);
4522 {//DataArrayInt.New([1,3,4],3)
4523 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4525 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples,tmpp1);
4526 ret->alloc(nbOfTuples,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4532 throw INTERP_KERNEL::Exception(msg);
4535 {// DataArrayInt.New([1,3,4])
4536 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4537 int tmpp1=-1,tmpp2=-1;
4538 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4539 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4544 else if(PyInt_Check(elt0))
4546 int nbOfTuples=PyInt_AS_LONG(elt0);
4548 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4553 if(PyInt_Check(elt1))
4554 {//DataArrayInt.New(5,2)
4555 int nbOfCompo=PyInt_AS_LONG(elt1);
4557 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4558 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4559 ret->alloc(nbOfTuples,nbOfCompo);
4564 throw INTERP_KERNEL::Exception(msg);
4567 throw INTERP_KERNEL::Exception(msg);
4570 {//DataArrayInt.New(5)
4571 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4572 ret->alloc(nbOfTuples,1);
4578 throw INTERP_KERNEL::Exception(msg);
4581 DataArrayInt(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4583 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,elt1,elt2);
4586 std::string __str__() const
4588 return self->repr();
4591 int __len__() const throw(INTERP_KERNEL::Exception)
4593 if(self->isAllocated())
4595 return self->getNumberOfTuples();
4599 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
4603 int __int__() const throw(INTERP_KERNEL::Exception)
4605 return self->intValue();
4608 DataArrayIntIterator *__iter__()
4610 return self->iterator();
4613 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const DataArrayInt *arr, const DataArrayInt *arrI) throw(INTERP_KERNEL::Exception)
4615 int newNbOfTuples=-1;
4616 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arr,arrI,newNbOfTuples);
4617 PyObject *ret=PyTuple_New(2);
4618 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4619 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
4623 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
4625 int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
4628 fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
4630 catch(INTERP_KERNEL::Exception& e)
4635 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
4638 PyObject *getValues() throw(INTERP_KERNEL::Exception)
4640 const int *vals=self->getPointer();
4641 return convertIntArrToPyList(vals,self->getNbOfElems());
4644 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
4647 bool ret0=self->isEqualIfNotWhy(other,ret1);
4648 PyObject *ret=PyTuple_New(2);
4649 PyObject *ret0Py=ret0?Py_True:Py_False;
4651 PyTuple_SetItem(ret,0,ret0Py);
4652 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4656 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
4658 const int *vals=self->getPointer();
4659 int nbOfComp=self->getNumberOfComponents();
4660 int nbOfTuples=self->getNumberOfTuples();
4661 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4664 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
4666 std::vector<const DataArrayInt *> groups;
4667 std::vector< std::vector<int> > fidsOfGroups;
4668 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
4669 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
4670 PyObject *ret = PyList_New(2);
4671 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4672 int sz=fidsOfGroups.size();
4673 PyObject *ret1 = PyList_New(sz);
4674 for(int i=0;i<sz;i++)
4675 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
4676 PyList_SetItem(ret,1,ret1);
4680 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
4683 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4684 if (!SWIG_IsOK(res1))
4687 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4688 self->transformWithIndArr(tmp,tmp+size);
4692 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4693 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4697 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4701 std::vector<int> multiVal;
4702 std::pair<int, std::pair<int,int> > slic;
4703 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4704 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4708 return self->getIdsEqualList(&singleVal,&singleVal+1);
4710 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4712 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
4714 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4718 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4722 std::vector<int> multiVal;
4723 std::pair<int, std::pair<int,int> > slic;
4724 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4725 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4729 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
4731 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4733 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
4735 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4739 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
4741 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
4743 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4744 if (!SWIG_IsOK(res1))
4747 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4748 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
4752 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4754 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4755 da2->checkAllocated();
4756 int size=self->getNumberOfTuples();
4757 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
4759 PyObject *ret = PyList_New(3);
4760 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4761 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4762 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4766 DataArrayInt *transformWithIndArrR(PyObject *li) const
4769 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4770 if (!SWIG_IsOK(res1))
4773 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4774 return self->transformWithIndArrR(tmp,tmp+size);
4778 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4779 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4783 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
4786 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4787 if (!SWIG_IsOK(res1))
4790 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4791 if(size!=self->getNumberOfTuples())
4793 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4795 self->renumberInPlace(tmp);
4799 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4801 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4802 da2->checkAllocated();
4803 int size=self->getNumberOfTuples();
4804 if(size!=self->getNumberOfTuples())
4806 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4808 self->renumberInPlace(da2->getConstPointer());
4812 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
4815 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4816 if (!SWIG_IsOK(res1))
4819 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4820 if(size!=self->getNumberOfTuples())
4822 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4824 self->renumberInPlaceR(tmp);
4828 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4830 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4831 da2->checkAllocated();
4832 int size=self->getNumberOfTuples();
4833 if(size!=self->getNumberOfTuples())
4835 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4837 self->renumberInPlaceR(da2->getConstPointer());
4841 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4844 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4845 if (!SWIG_IsOK(res1))
4848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4849 if(size!=self->getNumberOfTuples())
4851 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4853 return self->renumberAndReduce(tmp,newNbOfTuple);
4857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4859 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4860 da2->checkAllocated();
4861 int size=self->getNumberOfTuples();
4862 if(size!=self->getNumberOfTuples())
4864 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4866 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4870 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4874 if (!SWIG_IsOK(res1))
4877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4878 if(size!=self->getNumberOfTuples())
4880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4882 return self->renumber(tmp);
4886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4889 da2->checkAllocated();
4890 int size=self->getNumberOfTuples();
4891 if(size!=self->getNumberOfTuples())
4893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4895 return self->renumber(da2->getConstPointer());
4899 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4902 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4903 if (!SWIG_IsOK(res1))
4906 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4907 if(size!=self->getNumberOfTuples())
4909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4911 return self->renumberR(tmp);
4915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4917 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4918 da2->checkAllocated();
4919 int size=self->getNumberOfTuples();
4920 if(size!=self->getNumberOfTuples())
4922 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4924 return self->renumberR(da2->getConstPointer());
4928 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
4931 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4932 if (!SWIG_IsOK(res1))
4935 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4936 return self->selectByTupleId(tmp,tmp+size);
4940 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4942 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4943 da2->checkAllocated();
4944 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4948 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4951 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4952 if (!SWIG_IsOK(res1))
4955 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4956 return self->selectByTupleIdSafe(tmp,tmp+size);
4960 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4962 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4963 da2->checkAllocated();
4964 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4968 DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
4970 std::vector<int> tmp;
4971 convertPyToNewIntArr3(li,tmp);
4972 return self->keepSelectedComponents(tmp);
4975 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
4977 std::vector<int> tmp;
4978 convertPyToNewIntArr3(li,tmp);
4979 self->setSelectedComponents(a,tmp);
4982 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4984 int sz=self->getNumberOfComponents();
4985 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
4986 self->getTuple(tupleId,tmp);
4987 return convertIntArrToPyList(tmp,sz);
4990 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
4992 DataArrayInt *arr=0;
4993 DataArrayInt *arrI=0;
4994 self->changeSurjectiveFormat(targetNb,arr,arrI);
4995 PyObject *res = PyList_New(2);
4996 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4997 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
5001 DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
5003 std::vector<std::pair<int,int> > ranges;
5004 convertPyToVectorPairInt(li,ranges);
5005 return self->selectByTupleRanges(ranges);
5008 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
5010 std::vector<const DataArrayInt *> tmp;
5011 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
5012 return DataArrayInt::Meld(tmp);
5015 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
5017 std::vector<const DataArrayInt *> tmp;
5018 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
5019 return DataArrayInt::Aggregate(tmp);
5022 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
5024 std::vector<const DataArrayInt *> tmp;
5025 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
5026 return DataArrayInt::BuildUnion(tmp);
5029 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
5031 std::vector<const DataArrayInt *> tmp;
5032 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
5033 return DataArrayInt::BuildIntersection(tmp);
5036 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5039 int r1=self->getMaxValue(tmp);
5040 PyObject *ret=PyTuple_New(2);
5041 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5042 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5046 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5049 int r1=self->getMinValue(tmp);
5050 PyObject *ret=PyTuple_New(2);
5051 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5052 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5056 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5058 int nbOfCompo=self->getNumberOfComponents();
5063 if(PyInt_Check(obj))
5065 int val=(int)PyInt_AS_LONG(obj);
5066 return self->locateValue(val);
5069 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
5073 std::vector<int> arr;
5074 convertPyToNewIntArr3(obj,arr);
5075 return self->locateTuple(arr);
5080 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5082 int nbOfCompo=self->getNumberOfComponents();
5089 if(PyInt_Check(obj))
5091 int val=(int)PyInt_AS_LONG(obj);
5092 return self->presenceOfValue(val);
5095 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5099 std::vector<int> arr;
5100 convertPyToNewIntArr3(obj,arr);
5101 return self->presenceOfTuple(arr);
5106 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5108 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
5109 self->checkAllocated();
5110 int nbOfTuples=self->getNumberOfTuples();
5111 int nbOfComponents=self->getNumberOfComponents();
5113 std::vector<int> vt1,vc1;
5114 std::pair<int, std::pair<int,int> > pt1,pc1;
5115 DataArrayInt *dt1=0,*dc1=0;
5117 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5118 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
5123 if(nbOfComponents==1)
5124 return PyInt_FromLong(self->getIJSafe(it1,0));
5125 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5128 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5130 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5132 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5134 return PyInt_FromLong(self->getIJSafe(it1,ic1));
5137 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5138 std::vector<int> v2(1,ic1);
5139 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5143 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5144 std::vector<int> v2(1,ic1);
5145 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5149 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5150 std::vector<int> v2(1,ic1);
5151 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5155 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5156 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5160 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5165 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5166 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5170 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5175 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5176 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5177 std::vector<int> v2(nbOfComp);
5178 for(int i=0;i<nbOfComp;i++)
5179 v2[i]=pc1.first+i*pc1.second.second;
5180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5184 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5185 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5186 std::vector<int> v2(nbOfComp);
5187 for(int i=0;i<nbOfComp;i++)
5188 v2[i]=pc1.first+i*pc1.second.second;
5189 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5193 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5194 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5195 std::vector<int> v2(nbOfComp);
5196 for(int i=0;i<nbOfComp;i++)
5197 v2[i]=pc1.first+i*pc1.second.second;
5198 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5202 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5203 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5204 std::vector<int> v2(nbOfComp);
5205 for(int i=0;i<nbOfComp;i++)
5206 v2[i]=pc1.first+i*pc1.second.second;
5207 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5210 throw INTERP_KERNEL::Exception(msg);
5214 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5216 self->checkAllocated();
5217 const char msg[]="Unexpected situation in __setitem__ !";
5218 int nbOfTuples=self->getNumberOfTuples();
5219 int nbOfComponents=self->getNumberOfComponents();
5222 std::vector<int> v1;
5224 DataArrayIntTuple *dd1=0;
5225 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5227 std::vector<int> vt1,vc1;
5228 std::pair<int, std::pair<int,int> > pt1,pc1;
5229 DataArrayInt *dt1=0,*dc1=0;
5230 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5239 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5242 tmp=DataArrayInt::New();
5243 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5244 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
5247 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
5250 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5251 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
5254 throw INTERP_KERNEL::Exception(msg);
5263 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5266 tmp=DataArrayInt::New();
5267 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5268 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
5271 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5274 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5275 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5278 throw INTERP_KERNEL::Exception(msg);
5287 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5290 tmp=DataArrayInt::New();
5291 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5292 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
5295 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5298 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5299 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5302 throw INTERP_KERNEL::Exception(msg);
5311 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5314 tmp=DataArrayInt::New();
5315 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5316 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
5319 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5322 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5323 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5326 throw INTERP_KERNEL::Exception(msg);
5335 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5338 tmp=DataArrayInt::New();
5339 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5340 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
5343 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
5346 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5347 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
5350 throw INTERP_KERNEL::Exception(msg);
5359 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5362 tmp=DataArrayInt::New();
5363 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5364 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
5367 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5370 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5371 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5374 throw INTERP_KERNEL::Exception(msg);
5383 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5386 tmp=DataArrayInt::New();
5387 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5388 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
5391 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5394 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5395 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5398 throw INTERP_KERNEL::Exception(msg);
5407 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5410 tmp=DataArrayInt::New();
5411 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5412 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
5415 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5418 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5419 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5422 throw INTERP_KERNEL::Exception(msg);
5431 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5434 tmp=DataArrayInt::New();
5435 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5436 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
5439 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5442 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5443 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5446 throw INTERP_KERNEL::Exception(msg);
5455 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5458 tmp=DataArrayInt::New();
5459 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5460 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5463 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5466 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5467 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5470 throw INTERP_KERNEL::Exception(msg);
5477 int ee=pt1.second.first;
5478 int ss=pt1.second.second;
5480 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
5481 int nbOfE=(ee-bb)/ss;
5482 std::vector<int> nv(nbOfE);
5483 for(int jj=0;jj<nbOfE;jj++)
5488 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5491 tmp=DataArrayInt::New();
5492 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5493 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5496 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5499 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5500 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5503 throw INTERP_KERNEL::Exception(msg);
5512 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5515 tmp=DataArrayInt::New();
5516 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5517 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
5520 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5523 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5524 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5527 throw INTERP_KERNEL::Exception(msg);
5536 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5539 tmp=DataArrayInt::New();
5540 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5541 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
5544 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5547 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5548 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5551 throw INTERP_KERNEL::Exception(msg);
5560 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5563 tmp=DataArrayInt::New();
5564 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5565 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
5568 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5571 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5572 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5575 throw INTERP_KERNEL::Exception(msg);
5584 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5587 tmp=DataArrayInt::New();
5588 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5589 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
5592 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5595 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5596 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5599 throw INTERP_KERNEL::Exception(msg);
5608 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5611 tmp=DataArrayInt::New();
5612 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5613 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
5616 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5619 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5620 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5623 throw INTERP_KERNEL::Exception(msg);
5628 throw INTERP_KERNEL::Exception(msg);
5633 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
5635 return self->negate();
5638 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5640 const char msg[]="Unexpected situation in __add__ !";
5643 std::vector<int> aa;
5644 DataArrayIntTuple *aaa;
5646 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5651 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5652 ret->applyLin(1,val);
5658 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5659 return DataArrayInt::Add(self,aaa);
5663 return DataArrayInt::Add(self,a);
5667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5668 return DataArrayInt::Add(self,aaaa);
5671 throw INTERP_KERNEL::Exception(msg);
5675 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5677 const char msg[]="Unexpected situation in __radd__ !";
5680 std::vector<int> aa;
5681 DataArrayIntTuple *aaa;
5683 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5689 ret->applyLin(1,val);
5695 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5696 return DataArrayInt::Add(self,aaa);
5700 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5701 return DataArrayInt::Add(self,aaaa);
5704 throw INTERP_KERNEL::Exception(msg);
5708 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5710 const char msg[]="Unexpected situation in __iadd__ !";
5713 std::vector<int> aa;
5714 DataArrayIntTuple *aaa;
5716 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5721 self->applyLin(1,val);
5722 Py_XINCREF(trueSelf);
5727 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5729 Py_XINCREF(trueSelf);
5735 Py_XINCREF(trueSelf);
5740 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5741 self->addEqual(aaaa);
5742 Py_XINCREF(trueSelf);
5746 throw INTERP_KERNEL::Exception(msg);
5750 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5752 const char msg[]="Unexpected situation in __sub__ !";
5755 std::vector<int> aa;
5756 DataArrayIntTuple *aaa;
5758 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5763 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5764 ret->applyLin(1,-val);
5770 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5771 return DataArrayInt::Substract(self,aaa);
5775 return DataArrayInt::Substract(self,a);
5779 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5780 return DataArrayInt::Substract(self,aaaa);
5783 throw INTERP_KERNEL::Exception(msg);
5787 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5789 const char msg[]="Unexpected situation in __rsub__ !";
5792 std::vector<int> aa;
5793 DataArrayIntTuple *aaa;
5795 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5800 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5801 ret->applyLin(-1,val);
5807 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5808 return DataArrayInt::Substract(aaa,self);
5812 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5813 return DataArrayInt::Substract(aaaa,self);
5816 throw INTERP_KERNEL::Exception(msg);
5820 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5822 const char msg[]="Unexpected situation in __isub__ !";
5825 std::vector<int> aa;
5826 DataArrayIntTuple *aaa;
5828 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5833 self->applyLin(1,-val);
5834 Py_XINCREF(trueSelf);
5839 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5840 self->substractEqual(bb);
5841 Py_XINCREF(trueSelf);
5846 self->substractEqual(a);
5847 Py_XINCREF(trueSelf);
5852 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5853 self->substractEqual(aaaa);
5854 Py_XINCREF(trueSelf);
5858 throw INTERP_KERNEL::Exception(msg);
5862 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5864 const char msg[]="Unexpected situation in __mul__ !";
5867 std::vector<int> aa;
5868 DataArrayIntTuple *aaa;
5870 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5875 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5876 ret->applyLin(val,0);
5882 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5883 return DataArrayInt::Multiply(self,aaa);
5887 return DataArrayInt::Multiply(self,a);
5891 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5892 return DataArrayInt::Multiply(self,aaaa);
5895 throw INTERP_KERNEL::Exception(msg);
5899 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5901 const char msg[]="Unexpected situation in __rmul__ !";
5904 std::vector<int> aa;
5905 DataArrayIntTuple *aaa;
5907 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5912 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5913 ret->applyLin(val,0);
5919 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5920 return DataArrayInt::Multiply(self,aaa);
5924 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5925 return DataArrayInt::Multiply(self,aaaa);
5928 throw INTERP_KERNEL::Exception(msg);
5932 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5934 const char msg[]="Unexpected situation in __imul__ !";
5937 std::vector<int> aa;
5938 DataArrayIntTuple *aaa;
5940 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5945 self->applyLin(val,0);
5946 Py_XINCREF(trueSelf);
5951 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5952 self->multiplyEqual(bb);
5953 Py_XINCREF(trueSelf);
5958 self->multiplyEqual(a);
5959 Py_XINCREF(trueSelf);
5964 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5965 self->multiplyEqual(aaaa);
5966 Py_XINCREF(trueSelf);
5970 throw INTERP_KERNEL::Exception(msg);
5974 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5976 const char msg[]="Unexpected situation in __div__ !";
5979 std::vector<int> aa;
5980 DataArrayIntTuple *aaa;
5982 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5987 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5988 ret->applyDivideBy(val);
5994 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5995 return DataArrayInt::Divide(self,aaa);
5999 return DataArrayInt::Divide(self,a);
6003 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6004 return DataArrayInt::Divide(self,aaaa);
6007 throw INTERP_KERNEL::Exception(msg);
6011 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6013 const char msg[]="Unexpected situation in __rdiv__ !";
6016 std::vector<int> aa;
6017 DataArrayIntTuple *aaa;
6019 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6024 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6031 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6032 return DataArrayInt::Divide(aaa,self);
6036 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6037 return DataArrayInt::Divide(aaaa,self);
6040 throw INTERP_KERNEL::Exception(msg);
6044 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
6046 const char msg[]="Unexpected situation in __idiv__ !";
6049 std::vector<int> aa;
6050 DataArrayIntTuple *aaa;
6052 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6057 self->applyDivideBy(val);
6058 Py_XINCREF(trueSelf);
6063 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6064 self->divideEqual(bb);
6065 Py_XINCREF(trueSelf);
6070 self->divideEqual(a);
6071 Py_XINCREF(trueSelf);
6076 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6077 self->divideEqual(aaaa);
6078 Py_XINCREF(trueSelf);
6082 throw INTERP_KERNEL::Exception(msg);
6086 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6088 const char msg[]="Unexpected situation in __mod__ !";
6091 std::vector<int> aa;
6092 DataArrayIntTuple *aaa;
6094 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6099 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6100 ret->applyModulus(val);
6106 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6107 return DataArrayInt::Modulus(self,aaa);
6111 return DataArrayInt::Modulus(self,a);
6115 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6116 return DataArrayInt::Modulus(self,aaaa);
6119 throw INTERP_KERNEL::Exception(msg);
6123 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6125 const char msg[]="Unexpected situation in __rmod__ !";
6128 std::vector<int> aa;
6129 DataArrayIntTuple *aaa;
6131 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6136 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6137 ret->applyRModulus(val);
6143 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6144 return DataArrayInt::Modulus(aaa,self);
6148 return DataArrayInt::Modulus(a,self);
6152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6153 return DataArrayInt::Modulus(aaaa,self);
6156 throw INTERP_KERNEL::Exception(msg);
6160 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
6162 const char msg[]="Unexpected situation in __imod__ !";
6165 std::vector<int> aa;
6166 DataArrayIntTuple *aaa;
6168 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6173 self->applyModulus(val);
6174 Py_XINCREF(trueSelf);
6179 self->modulusEqual(a);
6180 Py_XINCREF(trueSelf);
6185 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6186 self->modulusEqual(aaaa);
6187 Py_XINCREF(trueSelf);
6191 throw INTERP_KERNEL::Exception(msg);
6196 namespace ParaMEDMEM
6198 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
6201 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6202 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
6203 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6204 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6205 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
6206 void setName(const char *name) throw(INTERP_KERNEL::Exception);
6207 const char *getDescription() const throw(INTERP_KERNEL::Exception);
6208 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
6209 const char *getName() const throw(INTERP_KERNEL::Exception);
6210 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
6211 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
6212 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
6213 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
6214 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
6215 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
6216 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
6217 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
6218 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
6219 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
6220 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
6221 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
6222 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
6223 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
6224 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
6225 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
6227 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
6229 MEDCouplingMesh *ret1=(MEDCouplingMesh *)self->getMesh();
6232 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
6235 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
6237 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
6240 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
6243 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
6245 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
6246 return convertIntArrToPyList3(ret);
6249 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
6252 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
6253 PyObject *ret=PyTuple_New(2);
6254 PyObject *ret0Py=ret0?Py_True:Py_False;
6256 PyTuple_SetItem(ret,0,ret0Py);
6257 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6261 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
6263 DataArrayInt *ret1=0;
6264 MEDCouplingMesh *ret0=0;
6266 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6267 if (!SWIG_IsOK(res1))
6270 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6271 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
6275 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6277 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6278 da2->checkAllocated();
6279 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
6281 PyObject *res = PyList_New(2);
6282 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
6283 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6287 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
6291 std::vector<int> pos2;
6292 DataArrayInt *pos3=0;
6293 DataArrayIntTuple *pos4=0;
6294 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
6299 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
6303 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
6307 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
6310 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
6314 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
6315 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
6318 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6319 if (!SWIG_IsOK(res1))
6322 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6323 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
6327 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6329 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6330 da2->checkAllocated();
6331 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
6335 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
6337 std::vector<int> tmp;
6338 self->getCellIdsHavingGaussLocalization(locId,tmp);
6339 DataArrayInt *ret=DataArrayInt::New();
6340 ret->alloc((int)tmp.size(),1);
6341 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
6342 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6347 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
6350 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
6351 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
6352 void setTimeUnit(const char *unit);
6353 const char *getTimeUnit() const;
6354 void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6355 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6356 std::string simpleRepr() const;
6357 std::string advancedRepr() const;
6358 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
6359 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
6360 MEDCouplingFieldDouble *deepCpy() const;
6361 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
6362 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
6363 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
6364 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
6365 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6366 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6367 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6368 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6369 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6370 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
6371 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
6372 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
6373 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
6374 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
6375 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
6376 void setIteration(int it) throw(INTERP_KERNEL::Exception);
6377 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
6378 void setOrder(int order) throw(INTERP_KERNEL::Exception);
6379 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
6380 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
6381 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
6382 void updateTime() const throw(INTERP_KERNEL::Exception);
6383 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6384 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6385 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6386 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6387 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6388 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6389 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
6390 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
6391 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
6392 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
6393 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
6394 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
6395 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
6396 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
6397 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
6398 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
6399 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
6400 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
6401 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
6402 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6403 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6404 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6405 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6406 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6407 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6408 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
6409 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
6410 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
6411 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
6412 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
6413 double getMaxValue() const throw(INTERP_KERNEL::Exception);
6414 double getMinValue() const throw(INTERP_KERNEL::Exception);
6415 double getAverageValue() const throw(INTERP_KERNEL::Exception);
6416 double norm2() const throw(INTERP_KERNEL::Exception);
6417 double normMax() const throw(INTERP_KERNEL::Exception);
6418 double getWeightedAverageValue() const throw(INTERP_KERNEL::Exception);
6419 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
6420 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
6421 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
6422 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
6423 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6424 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6425 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6426 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6427 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6428 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6429 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6430 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6431 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6432 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6433 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6434 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6435 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6436 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6437 MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6438 MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6439 MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6440 MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6442 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME)
6444 return MEDCouplingFieldDouble::New(type,td);
6447 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME)
6449 return MEDCouplingFieldDouble::New(ft,td);
6452 std::string __str__() const
6454 return self->simpleRepr();
6457 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
6459 DataArrayDouble *ret=self->getArray();
6465 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
6467 std::vector<DataArrayDouble *> arrs=self->getArrays();
6468 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
6472 PyObject *ret=PyTuple_New(sz);
6473 for(int i=0;i<sz;i++)
6476 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6478 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
6483 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
6485 std::vector<const DataArrayDouble *> tmp;
6486 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
6488 std::vector<DataArrayDouble *> arrs(sz);
6489 for(int i=0;i<sz;i++)
6490 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
6491 self->setArrays(arrs);
6494 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
6496 DataArrayDouble *ret=self->getEndArray();
6502 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
6506 DataArrayDoubleTuple *aa;
6507 std::vector<double> bb;
6509 const MEDCouplingMesh *mesh=self->getMesh();
6511 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6512 int spaceDim=mesh->getSpaceDimension();
6513 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6514 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6516 int sz=self->getNumberOfComponents();
6517 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6518 self->getValueOn(spaceLoc,res);
6519 return convertDblArrToPyList(res,sz);
6522 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
6524 int sz=self->getNumberOfComponents();
6525 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6526 self->getValueOnPos(i,j,k,res);
6527 return convertDblArrToPyList(res,sz);
6530 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
6533 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
6534 if (!SWIG_IsOK(res1))
6537 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
6538 const MEDCouplingMesh *mesh=self->getMesh();
6540 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6541 int spaceDim=mesh->getSpaceDimension();
6542 int nbOfPoints=size/spaceDim;
6543 if(size%spaceDim!=0)
6545 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
6547 return self->getValueOnMulti(tmp,nbOfPoints);
6551 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
6553 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
6554 da2->checkAllocated();
6555 int size=da2->getNumberOfTuples();
6556 int nbOfCompo=da2->getNumberOfComponents();
6557 const MEDCouplingMesh *mesh=self->getMesh();
6559 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6560 if(nbOfCompo!=mesh->getSpaceDimension())
6562 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
6564 return self->getValueOnMulti(da2->getConstPointer(),size);
6568 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
6572 DataArrayDoubleTuple *aa;
6573 std::vector<double> bb;
6575 const MEDCouplingMesh *mesh=self->getMesh();
6577 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6578 int spaceDim=mesh->getSpaceDimension();
6579 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6580 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6583 int sz=self->getNumberOfComponents();
6584 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6585 self->getValueOn(spaceLoc,time,res);
6586 return convertDblArrToPyList(res,sz);
6589 void setValues(PyObject *li) throw(INTERP_KERNEL::Exception)
6591 if(self->getArray()!=0)
6594 double *tmp=convertPyToNewDblArr2(li,&sz);
6595 int nbTuples=self->getArray()->getNumberOfTuples();
6596 int nbOfCompo=self->getArray()->getNumberOfComponents();
6597 self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo);
6600 throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind");
6603 PyObject *getTime() throw(INTERP_KERNEL::Exception)
6606 double tmp0=self->getTime(tmp1,tmp2);
6607 PyObject *res = PyList_New(3);
6608 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6609 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6610 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6614 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
6617 double tmp0=self->getStartTime(tmp1,tmp2);
6618 PyObject *res = PyList_New(3);
6619 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6620 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6621 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6625 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
6628 double tmp0=self->getEndTime(tmp1,tmp2);
6629 PyObject *res = PyList_New(3);
6630 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6631 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6632 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6635 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
6637 int sz=self->getNumberOfComponents();
6638 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6639 self->accumulate(tmp);
6640 PyObject *ret=convertDblArrToPyList(tmp,sz);
6643 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
6645 int sz=self->getNumberOfComponents();
6646 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6647 self->integral(isWAbs,tmp);
6648 PyObject *ret=convertDblArrToPyList(tmp,sz);
6651 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
6653 int sz=self->getNumberOfComponents();
6654 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6656 PyObject *ret=convertDblArrToPyList(tmp,sz);
6659 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
6661 int sz=self->getNumberOfComponents();
6662 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6664 PyObject *ret=convertDblArrToPyList(tmp,sz);
6667 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
6670 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6671 if (!SWIG_IsOK(res1))
6674 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6675 self->renumberCells(tmp,check);
6679 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6681 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6682 da2->checkAllocated();
6683 self->renumberCells(da2->getConstPointer(),check);
6686 void renumberNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
6689 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6690 if (!SWIG_IsOK(res1))
6693 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6694 self->renumberNodes(tmp);
6698 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6700 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6701 da2->checkAllocated();
6702 self->renumberNodes(da2->getConstPointer());
6706 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
6710 std::vector<int> multiVal;
6711 std::pair<int, std::pair<int,int> > slic;
6712 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
6713 const MEDCouplingMesh *mesh=self->getMesh();
6715 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
6716 int nbc=mesh->getNumberOfCells();
6717 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
6724 std::ostringstream oss;
6725 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6726 throw INTERP_KERNEL::Exception(oss.str().c_str());
6729 return self->buildSubPart(&singleVal,&singleVal+1);
6734 int tmp=nbc+singleVal;
6735 return self->buildSubPart(&tmp,&tmp+1);
6739 std::ostringstream oss;
6740 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6741 throw INTERP_KERNEL::Exception(oss.str().c_str());
6747 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
6751 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rg=DataArrayInt::Range(slic.first,slic.second.first,slic.second.second);
6752 return self->buildSubPart(rg->begin(),rg->end());
6757 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
6758 daIntTyypp->checkAllocated();
6759 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
6762 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
6766 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
6768 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
6771 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
6774 double r1=self->getMaxValue2(tmp);
6775 PyObject *ret=PyTuple_New(2);
6776 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6777 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6781 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
6784 double r1=self->getMinValue2(tmp);
6785 PyObject *ret=PyTuple_New(2);
6786 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6787 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6791 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
6793 std::vector<int> tmp;
6794 convertPyToNewIntArr3(li,tmp);
6795 return self->keepSelectedComponents(tmp);
6798 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
6800 std::vector<int> tmp;
6801 convertPyToNewIntArr3(li,tmp);
6802 self->setSelectedComponents(f,tmp);
6805 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
6808 DataArrayDouble *a,*a2;
6809 DataArrayDoubleTuple *aa,*aa2;
6810 std::vector<double> bb,bb2;
6813 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
6814 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
6815 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
6816 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
6818 return self->extractSlice3D(orig,vect,eps);
6821 PyObject *___iadd___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6824 Py_XINCREF(trueSelf);
6828 PyObject *___isub___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6831 Py_XINCREF(trueSelf);
6835 PyObject *___imul___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6838 Py_XINCREF(trueSelf);
6842 PyObject *___idiv___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6845 Py_XINCREF(trueSelf);
6849 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6851 std::vector<const MEDCouplingFieldDouble *> tmp;
6852 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6853 return MEDCouplingFieldDouble::MergeFields(tmp);
6856 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
6858 std::vector<const MEDCouplingFieldDouble *> tmp;
6859 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6860 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
6865 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
6868 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
6869 static MEDCouplingFieldTemplate *New(TypeOfField type);
6870 std::string simpleRepr() const;
6871 std::string advancedRepr() const;
6872 void updateTime() const;
6875 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception)
6877 return MEDCouplingFieldTemplate::New(f);
6880 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
6882 return MEDCouplingFieldTemplate::New(type);
6885 std::string __str__() const
6887 return self->simpleRepr();
6892 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
6895 int getNumberOfFields() const;
6896 MEDCouplingMultiFields *deepCpy() const;
6897 virtual std::string simpleRepr() const;
6898 virtual std::string advancedRepr() const;
6899 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6900 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6901 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6902 void updateTime() const throw(INTERP_KERNEL::Exception);
6905 std::string __str__() const
6907 return self->simpleRepr();
6909 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
6911 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6912 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6914 std::vector<MEDCouplingFieldDouble *> fs(sz);
6915 for(int i=0;i<sz;i++)
6916 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6917 return MEDCouplingMultiFields::New(fs);
6919 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6921 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6922 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6924 std::vector<MEDCouplingFieldDouble *> fs(sz);
6925 for(int i=0;i<sz;i++)
6926 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6927 return MEDCouplingMultiFields::New(fs);
6929 PyObject *getFields() const
6931 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
6932 int sz=fields.size();
6933 PyObject *res = PyList_New(sz);
6934 for(int i=0;i<sz;i++)
6938 fields[i]->incrRef();
6939 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
6943 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
6948 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
6950 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
6954 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
6957 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
6959 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
6961 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
6963 PyObject *res = PyList_New(sz);
6964 for(int i=0;i<sz;i++)
6969 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6973 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6978 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
6980 std::vector<int> refs;
6981 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
6983 PyObject *res = PyList_New(sz);
6984 for(int i=0;i<sz;i++)
6989 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6993 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6997 PyObject *ret=PyTuple_New(2);
6998 PyTuple_SetItem(ret,0,res);
6999 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
7002 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
7004 std::vector<DataArrayDouble *> ms=self->getArrays();
7006 PyObject *res = PyList_New(sz);
7007 for(int i=0;i<sz;i++)
7012 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
7016 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
7021 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
7023 std::vector< std::vector<int> > refs;
7024 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
7026 PyObject *res = PyList_New(sz);
7027 PyObject *res2 = PyList_New(sz);
7028 for(int i=0;i<sz;i++)
7033 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
7037 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
7039 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
7042 PyObject *ret=PyTuple_New(2);
7043 PyTuple_SetItem(ret,0,res);
7044 PyTuple_SetItem(ret,1,res2);
7050 class MEDCouplingDefinitionTime
7053 MEDCouplingDefinitionTime();
7054 void assign(const MEDCouplingDefinitionTime& other);
7055 bool isEqual(const MEDCouplingDefinitionTime& other) const;
7056 double getTimeResolution() const;
7057 std::vector<double> getHotSpotsTime() const;
7060 std::string __str__() const
7062 std::ostringstream oss;
7063 self->appendRepr(oss);
7067 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
7069 int meshId,arrId,arrIdInField,fieldId;
7070 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
7071 PyObject *res=PyList_New(4);
7072 PyList_SetItem(res,0,PyInt_FromLong(meshId));
7073 PyList_SetItem(res,1,PyInt_FromLong(arrId));
7074 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
7075 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
7079 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
7081 int meshId,arrId,arrIdInField,fieldId;
7082 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
7083 PyObject *res=PyList_New(4);
7084 PyList_SetItem(res,0,PyInt_FromLong(meshId));
7085 PyList_SetItem(res,1,PyInt_FromLong(arrId));
7086 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
7087 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
7093 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
7096 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
7097 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
7101 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
7103 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
7104 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
7106 std::vector<MEDCouplingFieldDouble *> fs(sz);
7107 for(int i=0;i<sz;i++)
7108 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
7109 return MEDCouplingFieldOverTime::New(fs);
7111 std::string __str__() const
7113 return self->simpleRepr();
7115 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
7117 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
7118 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
7120 std::vector<MEDCouplingFieldDouble *> fs(sz);
7121 for(int i=0;i<sz;i++)
7122 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
7123 return MEDCouplingFieldOverTime::New(fs);
7130 PyObject *MEDCouplingVersionMajMinRel()
7132 int tmp0=0,tmp1=0,tmp2=0;
7133 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
7134 PyObject *res = PyList_New(3);
7135 PyList_SetItem(res,0,SWIG_From_int(tmp0));
7136 PyList_SetItem(res,1,SWIG_From_int(tmp1));
7137 PyList_SetItem(res,2,SWIG_From_int(tmp2));
7144 __filename=os.environ.get('PYTHONSTARTUP')
7145 if __filename and os.path.isfile(__filename):
7146 execfile(__filename)