1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #define MEDCOUPLING_EXPORT
28 #include "MEDCouplingMemArray.hxx"
29 #include "MEDCouplingUMesh.hxx"
30 #include "MEDCouplingExtrudedMesh.hxx"
31 #include "MEDCouplingCMesh.hxx"
32 #include "MEDCouplingField.hxx"
33 #include "MEDCouplingFieldDouble.hxx"
34 #include "MEDCouplingFieldTemplate.hxx"
35 #include "MEDCouplingGaussLocalization.hxx"
36 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
37 #include "MEDCouplingMultiFields.hxx"
38 #include "MEDCouplingFieldOverTime.hxx"
39 #include "MEDCouplingDefinitionTime.hxx"
40 #include "MEDCouplingFieldDiscretization.hxx"
41 #include "MEDCouplingTypemaps.i"
43 #include "InterpKernelAutoPtr.hxx"
45 using namespace ParaMEDMEM;
46 using namespace INTERP_KERNEL;
49 %template(ivec) std::vector<int>;
50 %template(dvec) std::vector<double>;
51 %template(svec) std::vector<std::string>;
53 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
55 $result=convertMesh($1,$owner);
58 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
60 $result=convertMesh($1,$owner);
63 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
65 $result=convertFieldDiscretization($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
70 $result=convertMultiFields($1,$owner);
74 %init %{ import_array(); %}
77 %feature("autodoc", "1");
78 %feature("docstring");
80 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
81 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
82 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
83 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
84 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
85 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
86 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
87 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
88 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
89 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
90 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
91 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
92 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
93 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
94 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
95 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
96 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
97 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
98 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
99 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
100 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
101 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
102 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
103 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
104 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
105 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
106 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
107 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
108 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
109 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
110 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
111 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
112 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
113 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
114 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
115 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator+;
116 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator-;
117 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator*;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator/;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
124 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
125 %newobject ParaMEDMEM::DataArrayInt::New;
126 %newobject ParaMEDMEM::DataArrayInt::__iter__;
127 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
128 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
129 %newobject ParaMEDMEM::DataArrayInt::performCpy;
130 %newobject ParaMEDMEM::DataArrayInt::substr;
131 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
132 %newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
133 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
134 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
135 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
136 %newobject ParaMEDMEM::DataArrayInt::selectByTupleRanges;
137 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
138 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
139 %newobject ParaMEDMEM::DataArrayInt::renumber;
140 %newobject ParaMEDMEM::DataArrayInt::renumberR;
141 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
142 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
143 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
144 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
145 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
146 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
147 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
148 %newobject ParaMEDMEM::DataArrayInt::negate;
149 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
150 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
151 %newobject ParaMEDMEM::DataArrayInt::Meld;
152 %newobject ParaMEDMEM::DataArrayInt::Add;
153 %newobject ParaMEDMEM::DataArrayInt::Substract;
154 %newobject ParaMEDMEM::DataArrayInt::Multiply;
155 %newobject ParaMEDMEM::DataArrayInt::Divide;
156 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
157 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
158 %newobject ParaMEDMEM::DataArrayInt::Range;
159 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
160 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
161 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
162 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
163 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
164 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
165 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
166 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
167 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
168 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
169 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
170 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
171 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
172 %newobject ParaMEDMEM::DataArrayInt::__neg__;
173 %newobject ParaMEDMEM::DataArrayInt::__add__;
174 %newobject ParaMEDMEM::DataArrayInt::__radd__;
175 %newobject ParaMEDMEM::DataArrayInt::__sub__;
176 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
177 %newobject ParaMEDMEM::DataArrayInt::__mul__;
178 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
179 %newobject ParaMEDMEM::DataArrayInt::__div__;
180 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
181 %newobject ParaMEDMEM::DataArrayInt::__mod__;
182 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
183 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
184 %newobject ParaMEDMEM::DataArrayDouble::New;
185 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
186 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
187 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
188 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
189 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
190 %newobject ParaMEDMEM::DataArrayDouble::Meld;
191 %newobject ParaMEDMEM::DataArrayDouble::Dot;
192 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
193 %newobject ParaMEDMEM::DataArrayDouble::Add;
194 %newobject ParaMEDMEM::DataArrayDouble::Substract;
195 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
196 %newobject ParaMEDMEM::DataArrayDouble::Divide;
197 %newobject ParaMEDMEM::DataArrayDouble::substr;
198 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
199 %newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
200 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
201 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
202 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
203 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
204 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
205 %newobject ParaMEDMEM::DataArrayDouble::negate;
206 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
207 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
208 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
209 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
210 %newobject ParaMEDMEM::DataArrayDouble::determinant;
211 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
212 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
213 %newobject ParaMEDMEM::DataArrayDouble::inverse;
214 %newobject ParaMEDMEM::DataArrayDouble::trace;
215 %newobject ParaMEDMEM::DataArrayDouble::deviator;
216 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
217 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
218 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
219 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
220 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
221 %newobject ParaMEDMEM::DataArrayDouble::renumber;
222 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
223 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
224 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
225 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
226 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
227 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
228 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
229 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
230 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
231 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
232 %newobject ParaMEDMEM::DataArrayDouble::__add__;
233 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
234 %newobject ParaMEDMEM::DataArrayDouble::__sub__;
235 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
236 %newobject ParaMEDMEM::DataArrayDouble::__mul__;
237 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
238 %newobject ParaMEDMEM::DataArrayDouble::__div__;
239 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
240 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
241 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
242 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
243 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
244 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
245 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
246 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
247 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
248 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
249 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
250 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
251 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
252 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
253 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
254 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
255 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
256 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
257 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
258 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
259 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
260 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::giveCellsWithType;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::computeNbOfNodesPerCell;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
293 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
294 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
295 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
296 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
297 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
298 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
301 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
302 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
303 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
304 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
308 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
309 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
310 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
312 %feature("unref") DataArrayDouble "$this->decrRef();"
313 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
314 %feature("unref") MEDCouplingMesh "$this->decrRef();"
315 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
316 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
317 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
318 %feature("unref") DataArrayInt "$this->decrRef();"
319 %feature("unref") MEDCouplingField "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
325 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
326 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
327 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
328 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
330 %rename(assign) *::operator=;
331 %ignore ParaMEDMEM::RefCountObject::decrRef;
332 %ignore ParaMEDMEM::MemArray::operator=;
333 %ignore ParaMEDMEM::MemArray::operator[];
334 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
335 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
336 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
337 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
338 %ignore ParaMEDMEM::DataArrayIntIterator::nextt;
339 %ignore ParaMEDMEM::DataArrayIntTuple::repr;
340 %ignore ParaMEDMEM::DataArrayIntTuple::intValue;
341 %ignore ParaMEDMEM::DataArrayDoubleIterator::nextt;
342 %ignore ParaMEDMEM::DataArrayDoubleTuple::repr;
343 %ignore ParaMEDMEM::DataArrayDoubleTuple::doubleValue;
344 %ignore ParaMEDMEM::DataArrayDouble::writeVTK;
345 %ignore ParaMEDMEM::DataArrayInt::writeVTK;
346 %ignore ParaMEDMEM::DataArrayDouble::SetArrayIn;
347 %ignore ParaMEDMEM::DataArrayInt::SetArrayIn;
351 %rename (InterpKernelException) INTERP_KERNEL::Exception;
353 namespace INTERP_KERNEL
358 Exception(const char* what);
359 ~Exception() throw ();
360 const char *what() const throw ();
363 std::string __str__() const
365 return std::string(self->what());
371 %include "MEDCouplingTimeLabel.hxx"
372 %include "MEDCouplingRefCountObject.hxx"
379 UNSTRUCTURED_DESC = 6,
382 } MEDCouplingMeshType;
385 class DataArrayDouble;
386 class MEDCouplingUMesh;
387 class MEDCouplingFieldDouble;
389 %extend RefCountObject
391 std::string getHiddenCppPointer() const
393 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
398 class MEDCouplingMesh : public RefCountObject, public TimeLabel
401 void setName(const char *name);
402 const char *getName() const;
403 void setDescription(const char *descr);
404 const char *getDescription() const;
405 void setTime(double val, int iteration, int order);
406 void setTimeUnit(const char *unit);
407 const char *getTimeUnit() const;
408 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
409 bool isStructured() const throw(INTERP_KERNEL::Exception);
410 virtual MEDCouplingMesh *deepCpy() const;
411 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
412 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
414 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
415 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
416 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
418 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
419 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
420 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
421 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
424 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
425 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
426 virtual std::string simpleRepr() const;
427 virtual std::string advancedRepr() const;
428 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
431 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
433 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
438 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
439 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
440 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
441 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
444 std::string __str__() const
446 return self->simpleRepr();
449 PyObject *getTime() throw(INTERP_KERNEL::Exception)
452 double tmp0=self->getTime(tmp1,tmp2);
453 PyObject *res = PyList_New(3);
454 PyList_SetItem(res,0,SWIG_From_double(tmp0));
455 PyList_SetItem(res,1,SWIG_From_int(tmp1));
456 PyList_SetItem(res,2,SWIG_From_int(tmp2));
460 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
464 DataArrayDoubleTuple *aa;
465 std::vector<double> bb;
467 int spaceDim=self->getSpaceDimension();
468 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
469 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
470 return self->getCellContainingPoint(pos,eps);
473 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
477 DataArrayDoubleTuple *aa;
478 std::vector<double> bb;
480 int spaceDim=self->getSpaceDimension();
481 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
482 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
483 std::vector<int> elts,eltsIndex;
484 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
485 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
486 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
487 d0->alloc(elts.size(),1);
488 d1->alloc(eltsIndex.size(),1);
489 std::copy(elts.begin(),elts.end(),d0->getPointer());
490 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
491 PyObject *ret=PyTuple_New(2);
492 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
493 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
499 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
501 std::vector<int> elts,eltsIndex;
502 int spaceDim=self->getSpaceDimension();
504 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
505 if (!SWIG_IsOK(res1))
508 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
509 int nbOfPoints=size/spaceDim;
512 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
514 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
518 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
520 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
521 da2->checkAllocated();
522 int size=da2->getNumberOfTuples();
523 int nbOfCompo=da2->getNumberOfComponents();
524 if(nbOfCompo!=spaceDim)
526 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
528 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
530 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
531 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
532 d0->alloc(elts.size(),1);
533 d1->alloc(eltsIndex.size(),1);
534 std::copy(elts.begin(),elts.end(),d0->getPointer());
535 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
536 PyObject *ret=PyTuple_New(2);
537 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
538 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
544 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
548 DataArrayDoubleTuple *aa;
549 std::vector<double> bb;
551 int spaceDim=self->getSpaceDimension();
552 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
553 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
554 std::vector<int> elts;
555 self->getCellsContainingPoint(pos,eps,elts);
556 DataArrayInt *ret=DataArrayInt::New();
557 ret->alloc((int)elts.size(),1);
558 std::copy(elts.begin(),elts.end(),ret->getPointer());
559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
562 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
565 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
566 if (!SWIG_IsOK(res1))
569 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
570 self->renumberCells(tmp,check);
574 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
576 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
577 da2->checkAllocated();
578 self->renumberCells(da2->getConstPointer(),check);
582 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
584 DataArrayInt *cellCor, *nodeCor;
585 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
586 PyObject *res = PyList_New(2);
587 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
588 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
591 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
594 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
595 if (!SWIG_IsOK(res1))
598 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
599 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
603 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
605 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
606 da2->checkAllocated();
607 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
610 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
612 std::vector<int> conn;
613 self->getNodeIdsOfCell(cellId,conn);
614 return convertIntArrToPyList2(conn);
617 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
619 std::vector<double> coo;
620 self->getCoordinatesOfNode(nodeId,coo);
621 return convertDblArrToPyList2(coo);
624 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
628 DataArrayDoubleTuple *aa;
629 std::vector<double> bb;
631 int spaceDim=self->getSpaceDimension();
632 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
633 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
634 self->scale(pointPtr,factor);
637 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
639 int spaceDim=self->getSpaceDimension();
640 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
641 self->getBoundingBox(tmp);
642 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
646 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
649 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
650 PyObject *ret=PyTuple_New(2);
651 PyObject *ret0Py=ret0?Py_True:Py_False;
653 PyTuple_SetItem(ret,0,ret0Py);
654 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
658 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
661 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
662 if (!SWIG_IsOK(res1))
665 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
666 MEDCouplingMesh *ret=self->buildPart(tmp,((const int *)tmp)+size);
667 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
671 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
673 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
674 da2->checkAllocated();
675 MEDCouplingMesh *ret=self->buildPart(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
676 ret->setName(da2->getName().c_str());
677 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
681 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
685 MEDCouplingMesh *ret=0;
686 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
687 if (!SWIG_IsOK(res1))
690 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
691 ret=self->buildPartAndReduceNodes(tmp,((const int *)tmp)+size,arr);
695 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
697 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
698 da2->checkAllocated();
699 ret=self->buildPartAndReduceNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),arr);
700 ret->setName(da2->getName().c_str());
702 PyObject *res = PyList_New(2);
703 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
704 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
705 PyList_SetItem(res,0,obj0);
706 PyList_SetItem(res,1,obj1);
710 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
712 std::vector<int> vals=self->getDistributionOfTypes();
713 PyObject *ret=PyList_New((int)vals.size()/3);
714 for(int j=0;j<(int)vals.size()/3;j++)
716 PyObject *ret1=PyList_New(3);
717 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
718 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
719 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
720 PyList_SetItem(ret,j,ret1);
725 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
727 std::vector<int> code;
728 std::vector<const DataArrayInt *> idsPerType;
729 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
730 convertPyToNewIntArr4(li,1,3,code);
731 return self->checkTypeConsistencyAndContig(code,idsPerType);
734 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
736 std::vector<int> code;
737 std::vector<DataArrayInt *> idsInPflPerType;
738 std::vector<DataArrayInt *> idsPerType;
739 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
740 PyObject *ret=PyTuple_New(3);
741 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
742 PyObject *ret1=PyList_New(idsInPflPerType.size());
743 for(std::size_t j=0;j<idsInPflPerType.size();j++)
744 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
745 PyTuple_SetItem(ret,1,ret1);
746 int n=idsPerType.size();
747 PyObject *ret2=PyList_New(n);
749 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
750 PyTuple_SetItem(ret,2,ret2);
754 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
758 DataArrayDoubleTuple *aa;
759 std::vector<double> bb;
761 int spaceDim=self->getSpaceDimension();
762 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
763 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
764 self->translate(vectorPtr);
767 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
769 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
772 DataArrayDoubleTuple *aa;
773 std::vector<double> bb;
775 int spaceDim=self->getSpaceDimension();
776 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
777 self->rotate(centerPtr,0,alpha);
780 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
782 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
785 DataArrayDoubleTuple *aa;
786 std::vector<double> bb;
788 int spaceDim=self->getSpaceDimension();
789 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
790 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,false);
791 self->rotate(centerPtr,vectorPtr,alpha);
794 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
796 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
797 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
798 PyObject *res=PyList_New(result.size());
799 for(int i=0;iL!=result.end(); i++, iL++)
800 PyList_SetItem(res,i,PyInt_FromLong(*iL));
804 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
806 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
807 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
808 return MEDCouplingMesh::MergeMeshes(tmp);
814 %extend ParaMEDMEM::DataArray
816 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
818 const std::vector<std::string>& comps=self->getInfoOnComponents();
819 PyObject *ret=PyList_New((int)comps.size());
820 for(int i=0;i<(int)comps.size();i++)
821 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
825 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
827 std::vector<int> tmp;
828 convertPyToNewIntArr3(li,tmp);
829 self->copyPartOfStringInfoFrom(other,tmp);
832 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
834 std::vector<int> tmp;
835 convertPyToNewIntArr3(li,tmp);
836 self->copyPartOfStringInfoFrom2(tmp,other);
840 %extend ParaMEDMEM::DataArrayInt
842 PyObject *getDifferentValues() const throw(INTERP_KERNEL::Exception)
844 std::set<int> ret=self->getDifferentValues();
845 return convertIntArrToPyList3(ret);
849 %ignore ParaMEDMEM::DataArray::getInfoOnComponents;
850 %ignore ParaMEDMEM::DataArrayInt::getDifferentValues;
852 %include "MEDCouplingMemArray.hxx"
853 %include "NormalizedUnstructuredMesh.hxx"
854 %include "MEDCouplingNatureOfField.hxx"
855 %include "MEDCouplingTimeDiscretization.hxx"
856 %include "MEDCouplingFieldDiscretization.hxx"
857 %include "MEDCouplingGaussLocalization.hxx"
861 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
864 void updateTime() const;
865 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
866 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
867 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
868 void zipCoords() throw(INTERP_KERNEL::Exception);
869 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
870 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
871 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
872 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
873 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
874 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
875 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
876 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
877 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
878 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
879 //! size of returned tinyInfo must be always the same.
880 void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
881 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
882 void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception);
883 void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
884 const std::vector<std::string>& littleStrings) throw(INTERP_KERNEL::Exception);
885 virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) throw(INTERP_KERNEL::Exception);
886 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
887 virtual DataArrayInt *findBoundaryNodes() const;
890 std::string __str__() const
892 return self->simpleRepr();
895 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
898 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
899 PyObject *res = PyList_New(2);
900 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
901 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
905 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
907 DataArrayInt *comm, *commIndex;
908 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
909 PyObject *res = PyList_New(2);
910 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
911 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
915 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
917 DataArrayDouble *ret1=self->getCoords();
919 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
921 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
924 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
925 if (!SWIG_IsOK(res1))
928 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
929 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,((const int *)tmp)+size,keepCoords);
930 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
934 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
936 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
937 da2->checkAllocated();
938 MEDCouplingPointSet *ret=self->buildPartOfMySelf(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),keepCoords);
939 ret->setName(da2->getName().c_str());
940 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
943 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
946 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
947 if (!SWIG_IsOK(res1))
950 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
951 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
952 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
956 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
958 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
959 da2->checkAllocated();
960 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
961 ret->setName(da2->getName().c_str());
962 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
965 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
968 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
969 if (!SWIG_IsOK(res1))
972 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
973 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
974 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
978 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
980 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
981 da2->checkAllocated();
982 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
983 ret->setName(da2->getName().c_str());
984 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
988 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
991 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
992 if (!SWIG_IsOK(res1))
995 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
996 self->renumberNodes(tmp,newNbOfNodes);
1000 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1002 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1003 da2->checkAllocated();
1004 self->renumberNodes(da2->getConstPointer(),newNbOfNodes);
1007 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1010 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1011 if (!SWIG_IsOK(res1))
1014 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1015 self->renumberNodes2(tmp,newNbOfNodes);
1019 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1021 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1022 da2->checkAllocated();
1023 self->renumberNodes2(da2->getConstPointer(),newNbOfNodes);
1026 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1028 int spaceDim=self->getSpaceDimension();
1030 DataArrayDouble *a,*a2;
1031 DataArrayDoubleTuple *aa,*aa2;
1032 std::vector<double> bb,bb2;
1034 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1035 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1036 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1037 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1038 std::vector<int> nodes;
1039 self->findNodesOnLine(p,v,eps,nodes);
1040 DataArrayInt *ret=DataArrayInt::New();
1041 ret->alloc((int)nodes.size(),1);
1042 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1043 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1045 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1047 int spaceDim=self->getSpaceDimension();
1049 DataArrayDouble *a,*a2;
1050 DataArrayDoubleTuple *aa,*aa2;
1051 std::vector<double> bb,bb2;
1053 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1054 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1055 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1056 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1057 std::vector<int> nodes;
1058 self->findNodesOnPlane(p,v,eps,nodes);
1059 DataArrayInt *ret=DataArrayInt::New();
1060 ret->alloc((int)nodes.size(),1);
1061 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1062 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1064 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1068 DataArrayDoubleTuple *aa;
1069 std::vector<double> bb;
1071 int spaceDim=self->getSpaceDimension();
1072 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1073 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1074 std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
1075 DataArrayInt *ret=DataArrayInt::New();
1076 ret->alloc((int)tmp.size(),1);
1077 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1081 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
1083 std::vector<int> c,cI;
1087 DataArrayDoubleTuple *aa;
1088 std::vector<double> bb;
1090 int spaceDim=self->getSpaceDimension();
1091 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1092 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
1093 self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
1094 PyObject *ret=PyTuple_New(2);
1095 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1096 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1097 d0->alloc(c.size(),1);
1098 d1->alloc(cI.size(),1);
1099 std::copy(c.begin(),c.end(),d0->getPointer());
1100 std::copy(cI.begin(),cI.end(),d1->getPointer());
1101 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1102 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1108 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1110 std::vector<int> c,cI;
1111 int spaceDim=self->getSpaceDimension();
1113 int res1=SWIG_ConvertPtr(pt,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1114 if (!SWIG_IsOK(res1))
1117 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(pt,&size);
1118 int nbOfPoints=size/spaceDim;
1119 if(size%spaceDim!=0)
1121 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
1123 self->getNodeIdsNearPoints(tmp,nbOfPoints,eps,c,cI);
1127 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
1129 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
1130 da2->checkAllocated();
1131 int size=da2->getNumberOfTuples();
1132 int nbOfCompo=da2->getNumberOfComponents();
1133 if(nbOfCompo!=spaceDim)
1135 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
1137 self->getNodeIdsNearPoints(da2->getConstPointer(),size,eps,c,cI);
1139 PyObject *ret=PyTuple_New(2);
1140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1141 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1142 d0->alloc(c.size(),1);
1143 d1->alloc(cI.size(),1);
1144 std::copy(c.begin(),c.end(),d0->getPointer());
1145 std::copy(cI.begin(),cI.end(),d1->getPointer());
1146 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1147 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1153 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1155 std::vector<int> elems;
1160 DataArrayDoubleTuple *aa;
1161 std::vector<double> bb;
1163 int spaceDim=self->getSpaceDimension();
1164 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1165 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1167 self->getCellsInBoundingBox(tmp,eps,elems);
1168 DataArrayInt *ret=DataArrayInt::New();
1169 ret->alloc((int)elems.size(),1);
1170 std::copy(elems.begin(),elems.end(),ret->getPointer());
1171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1174 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1178 std::vector<int> multiVal;
1179 std::pair<int, std::pair<int,int> > slic;
1180 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1181 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1185 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1187 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1189 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1191 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1195 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1198 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1199 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1200 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1201 for(int i=0;i<sz;i++)
1202 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1204 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1207 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
1208 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1209 double *v=convertPyToNewDblArr2(vect,&sz2);
1210 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1211 for(int i=0;i<sz;i++)
1212 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1217 class MEDCouplingUMeshCell
1220 INTERP_KERNEL::NormalizedCellType getType() const;
1223 std::string __str__() const
1225 return self->repr();
1228 PyObject *getAllConn() const
1231 const int *r=self->getAllConn(ret2);
1232 PyObject *ret=PyTuple_New(ret2);
1233 for(int i=0;i<ret2;i++)
1234 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1240 class MEDCouplingUMeshCellIterator
1247 MEDCouplingUMeshCell *ret=self->nextt();
1249 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1252 PyErr_SetString(PyExc_StopIteration,"No more data.");
1259 class MEDCouplingUMeshCellByTypeIterator
1262 ~MEDCouplingUMeshCellByTypeIterator();
1267 MEDCouplingUMeshCellEntry *ret=self->nextt();
1269 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1272 PyErr_SetString(PyExc_StopIteration,"No more data.");
1279 class MEDCouplingUMeshCellByTypeEntry
1282 ~MEDCouplingUMeshCellByTypeEntry();
1285 MEDCouplingUMeshCellByTypeIterator *__iter__()
1287 return self->iterator();
1292 class MEDCouplingUMeshCellEntry
1295 INTERP_KERNEL::NormalizedCellType getType() const;
1296 int getNumberOfElems() const;
1299 MEDCouplingUMeshCellIterator *__iter__()
1301 return self->iterator();
1306 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1309 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1310 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1311 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1312 void updateTime() const;
1313 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1314 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1315 void allocateCells(int nbOfCells) throw(INTERP_KERNEL::Exception);
1316 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1317 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1318 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1319 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1320 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1321 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1322 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1323 void computeTypes() throw(INTERP_KERNEL::Exception);
1324 DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
1325 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1326 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1328 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1329 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1330 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1331 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1332 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1333 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1334 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1335 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1336 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1337 DataArrayInt *zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception);
1338 DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
1339 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1340 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1341 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1342 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1343 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1344 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1345 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1346 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1347 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1348 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1349 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1350 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1351 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1352 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1353 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1354 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1355 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1356 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1357 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1358 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1359 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1361 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1363 return MEDCouplingUMesh::New();
1366 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1368 return MEDCouplingUMesh::New(meshName,meshDim);
1371 std::string __str__() const
1373 return self->simpleRepr();
1376 MEDCouplingUMeshCellIterator *__iter__()
1378 return self->cellIterator();
1381 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1385 std::vector<int> multiVal;
1386 std::pair<int, std::pair<int,int> > slic;
1387 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1388 int nbc=self->getNumberOfCells();
1389 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1396 std::ostringstream oss;
1397 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1398 throw INTERP_KERNEL::Exception(oss.str().c_str());
1401 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1406 int tmp=nbc+singleVal;
1407 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1411 std::ostringstream oss;
1412 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1413 throw INTERP_KERNEL::Exception(oss.str().c_str());
1419 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1423 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1428 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1429 daIntTyypp->checkAllocated();
1430 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1433 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1437 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1441 std::vector<int> multiVal;
1442 std::pair<int, std::pair<int,int> > slic;
1443 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1444 int nbc=self->getNumberOfCells();
1445 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1452 std::ostringstream oss;
1453 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1454 throw INTERP_KERNEL::Exception(oss.str().c_str());
1458 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1465 int tmp=nbc+singleVal;
1466 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1471 std::ostringstream oss;
1472 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1473 throw INTERP_KERNEL::Exception(oss.str().c_str());
1479 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1485 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1486 daIntTyypp->checkAllocated();
1487 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1491 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1495 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1499 std::vector<int> multiVal;
1500 std::pair<int, std::pair<int,int> > slic;
1501 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1502 int nbc=self->getNumberOfCells();
1503 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1510 std::ostringstream oss;
1511 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1512 throw INTERP_KERNEL::Exception(oss.str().c_str());
1516 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1523 int tmp=nbc+singleVal;
1524 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1529 std::ostringstream oss;
1530 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1531 throw INTERP_KERNEL::Exception(oss.str().c_str());
1537 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1542 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1548 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1549 daIntTyypp->checkAllocated();
1550 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1554 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1558 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1561 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1564 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << sz << " !";
1565 throw INTERP_KERNEL::Exception(oss.str().c_str());
1567 self->insertNextCell(type,size,tmp);
1570 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1573 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
1574 self->insertNextCell(type,sz,tmp);
1577 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1579 DataArrayInt *ret=self->getNodalConnectivity();
1584 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1586 DataArrayInt *ret=self->getNodalConnectivityIndex();
1591 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1593 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1594 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1595 PyObject *res = PyList_New(result.size());
1596 for (int i=0;iL!=result.end(); i++, iL++)
1597 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1600 PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1604 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1605 PyObject *res = PyList_New(3);
1606 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1607 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1608 PyList_SetItem(res,2,SWIG_From_int(ret2));
1611 PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1615 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1616 PyObject *res = PyList_New(3);
1617 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1618 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1619 PyList_SetItem(res,2,SWIG_From_int(ret2));
1622 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1624 std::vector<int> cells;
1625 self->checkButterflyCells(cells,eps);
1626 DataArrayInt *ret=DataArrayInt::New();
1627 ret->alloc((int)cells.size(),1);
1628 std::copy(cells.begin(),cells.end(),ret->getPointer());
1629 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1632 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1634 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1636 PyObject *ret = PyList_New(sz);
1637 for(int i=0;i<sz;i++)
1638 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1642 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1644 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1645 int sz=retCpp.size();
1646 PyObject *ret=PyList_New(sz);
1647 for(int i=0;i<sz;i++)
1648 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1652 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1655 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1656 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1657 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1660 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1663 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1664 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1668 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1671 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1672 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1676 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1678 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1679 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1680 PyObject *ret=PyTuple_New(3);
1681 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1682 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1683 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1687 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1689 DataArrayInt *tmp0=0,*tmp1=0;
1690 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1691 PyObject *ret=PyTuple_New(2);
1692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1697 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1701 std::vector<int> multiVal;
1702 std::pair<int, std::pair<int,int> > slic;
1703 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1704 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1708 return self->duplicateNodes(&singleVal,&singleVal+1);
1710 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1712 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1714 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1718 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1722 std::vector<int> multiVal;
1723 std::pair<int, std::pair<int,int> > slic;
1724 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1725 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1729 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1731 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1733 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1735 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1739 void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1742 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1743 if (!SWIG_IsOK(res1))
1746 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1747 self->renumberNodesInConn(tmp);
1751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1753 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1754 da2->checkAllocated();
1755 self->renumberNodesInConn(da2->getConstPointer());
1759 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1762 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1763 DataArrayInt *tmp0,*tmp1=0;
1764 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1765 PyObject *ret=PyTuple_New(2);
1766 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1767 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1771 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1773 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1774 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1775 DataArrayInt *ret1=0,*ret2=0;
1776 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1777 PyObject *ret=PyTuple_New(3);
1778 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1779 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1780 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1784 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1786 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1787 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1788 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1789 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1792 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1795 std::vector<const MEDCouplingUMesh *> meshes;
1796 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1797 std::vector<DataArrayInt *> corr;
1798 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1800 PyObject *ret1=PyList_New(sz);
1801 for(int i=0;i<sz;i++)
1802 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1803 PyObject *ret=PyList_New(2);
1804 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1805 PyList_SetItem(ret,1,ret1);
1809 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1811 std::vector<MEDCouplingUMesh *> meshes;
1812 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1813 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1816 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1818 std::vector<MEDCouplingUMesh *> meshes;
1819 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1820 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1823 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1827 std::vector<int> multiVal;
1828 std::pair<int, std::pair<int,int> > slic;
1829 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1831 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1832 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1836 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
1838 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
1840 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
1842 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1846 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
1848 DataArrayInt *arrOut=0,*arrIndexOut=0;
1851 std::vector<int> multiVal;
1852 std::pair<int, std::pair<int,int> > slic;
1853 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1855 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
1856 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1861 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
1866 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1871 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
1875 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1877 PyObject *ret=PyTuple_New(2);
1878 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1879 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1883 static PyObject *SetPartOfIndexedArrays(PyObject *li,
1884 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
1885 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
1887 DataArrayInt *arrOut=0,*arrIndexOut=0;
1890 std::vector<int> multiVal;
1891 std::pair<int, std::pair<int,int> > slic;
1892 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1894 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
1895 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1900 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1905 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1910 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
1914 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1916 PyObject *ret=PyTuple_New(2);
1917 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1922 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
1923 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
1927 std::vector<int> multiVal;
1928 std::pair<int, std::pair<int,int> > slic;
1929 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1931 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
1932 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1937 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
1942 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
1947 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
1951 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1955 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
1959 DataArrayDoubleTuple *aa;
1960 std::vector<double> bb;
1962 int spaceDim=self->getSpaceDimension();
1963 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
1964 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
1966 std::vector<int> cells;
1967 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
1968 DataArrayInt *ret=DataArrayInt::New();
1969 ret->alloc((int)cells.size(),1);
1970 std::copy(cells.begin(),cells.end(),ret->getPointer());
1971 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1974 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
1978 DataArrayDoubleTuple *aa;
1979 std::vector<double> bb;
1981 int spaceDim=self->getSpaceDimension();
1982 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
1983 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
1984 self->orientCorrectly2DCells(v,polyOnly);
1987 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
1989 std::vector<int> cells;
1990 self->arePolyhedronsNotCorrectlyOriented(cells);
1991 DataArrayInt *ret=DataArrayInt::New();
1992 ret->alloc((int)cells.size(),1);
1993 std::copy(cells.begin(),cells.end(),ret->getPointer());
1994 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1997 PyObject *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
1999 std::vector<int> cells;
2000 self->findAndCorrectBadOriented3DExtrudedCells(cells);
2001 DataArrayInt *ret=DataArrayInt::New();
2002 ret->alloc((int)cells.size(),1);
2003 std::copy(cells.begin(),cells.end(),ret->getPointer());
2004 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2007 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2011 self->getFastAveragePlaneOfThis(vec,pos);
2013 std::copy(vec,vec+3,vals);
2014 std::copy(pos,pos+3,vals+3);
2015 return convertDblArrToPyListOfTuple(vals,3,2);
2018 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2020 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2021 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2022 return MEDCouplingUMesh::MergeUMeshes(tmp);
2025 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2028 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2029 PyObject *ret=PyTuple_New(2);
2030 PyObject *ret0Py=ret0?Py_True:Py_False;
2032 PyTuple_SetItem(ret,0,ret0Py);
2033 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2037 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2040 bool ret0=self->areCellsIncludedIn2(other,ret1);
2041 PyObject *ret=PyTuple_New(2);
2042 PyObject *ret0Py=ret0?Py_True:Py_False;
2044 PyTuple_SetItem(ret,0,ret0Py);
2045 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2049 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2051 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2052 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2053 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2055 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2056 PyObject *ret=PyTuple_New(5);
2057 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2058 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2059 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2061 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2071 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2072 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2073 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2074 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2075 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2076 PyObject *ret=PyTuple_New(5);
2077 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2078 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2080 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2081 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2089 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2091 DataArrayInt *neighbors=0,*neighborsIdx=0;
2092 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2093 PyObject *ret=PyTuple_New(2);
2094 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2095 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2099 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2101 DataArrayInt *neighbors=0,*neighborsIdx=0;
2102 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2103 PyObject *ret=PyTuple_New(2);
2104 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2105 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2109 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2111 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2112 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2113 DataArrayInt *d2,*d3,*d4,*dd5;
2114 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2115 PyObject *ret=PyTuple_New(7);
2116 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2117 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2118 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr((DataArrayInt *)d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2119 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2120 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2121 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2122 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2128 PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2130 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2132 self->getReverseNodalConnectivity(d0,d1);
2133 PyObject *ret=PyTuple_New(2);
2134 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2135 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2141 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2144 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2145 da->checkAllocated();
2146 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2149 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2152 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2153 da->checkAllocated();
2154 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2157 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2160 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2161 da->checkAllocated();
2162 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2165 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2168 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2169 da->checkAllocated();
2170 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2171 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2172 PyObject *res = PyList_New(result.size());
2173 for (int i=0;iL!=result.end(); i++, iL++)
2174 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2178 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2181 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2182 da->checkAllocated();
2183 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2184 ret->setName(da->getName().c_str());
2188 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2191 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2192 if (!SWIG_IsOK(res1))
2195 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2196 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
2200 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2202 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2203 da2->checkAllocated();
2204 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
2208 PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
2211 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
2212 PyObject *ret=PyTuple_New(2);
2213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2218 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2220 DataArrayInt *cellNb1=0,*cellNb2=0;
2221 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2222 PyObject *ret=PyTuple_New(3);
2223 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2224 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2225 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2229 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2231 int spaceDim=self->getSpaceDimension();
2233 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2235 DataArrayDouble *a,*a2;
2236 DataArrayDoubleTuple *aa,*aa2;
2237 std::vector<double> bb,bb2;
2239 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2240 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2241 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2242 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2244 DataArrayInt *cellIds=0;
2245 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2246 PyObject *ret=PyTuple_New(2);
2247 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2248 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2252 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2254 int spaceDim=self->getSpaceDimension();
2256 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2258 DataArrayDouble *a,*a2;
2259 DataArrayDoubleTuple *aa,*aa2;
2260 std::vector<double> bb,bb2;
2262 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2263 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2264 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2265 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2267 DataArrayInt *cellIds=0;
2268 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2269 PyObject *ret=PyTuple_New(2);
2270 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2277 int spaceDim=self->getSpaceDimension();
2279 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2281 DataArrayDouble *a,*a2;
2282 DataArrayDoubleTuple *aa,*aa2;
2283 std::vector<double> bb,bb2;
2285 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2286 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2287 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2288 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2289 return self->getCellIdsCrossingPlane(orig,vect,eps);
2292 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2296 std::vector<int> pos2;
2297 DataArrayInt *pos3=0;
2298 DataArrayIntTuple *pos4=0;
2299 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2304 self->convertToPolyTypes(&pos1,&pos1+1);
2311 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2316 self->convertToPolyTypes(pos3->begin(),pos3->end());
2320 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2324 void convertAllToPoly();
2325 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2326 bool unPolyze() throw(INTERP_KERNEL::Exception);
2327 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2328 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2329 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2332 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2335 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2336 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2337 void updateTime() const throw(INTERP_KERNEL::Exception);
2339 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2341 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2344 std::string __str__() const
2346 return self->simpleRepr();
2348 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2350 MEDCouplingUMesh *ret=self->getMesh2D();
2352 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2354 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2356 MEDCouplingUMesh *ret=self->getMesh1D();
2358 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2360 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2362 DataArrayInt *ret=self->getMesh3DIds();
2364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2369 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingMesh
2372 static MEDCouplingCMesh *New();
2373 static MEDCouplingCMesh *New(const char *meshName);
2374 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2375 void setCoords(const DataArrayDouble *coordsX,
2376 const DataArrayDouble *coordsY=0,
2377 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2378 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2379 void updateTime() const throw(INTERP_KERNEL::Exception);
2383 return MEDCouplingCMesh::New();
2385 MEDCouplingCMesh(const char *meshName)
2387 return MEDCouplingCMesh::New(meshName);
2389 std::string __str__() const
2391 return self->simpleRepr();
2393 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2395 DataArrayDouble *ret=self->getCoordsAt(i);
2403 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2405 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2408 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2409 PyObject *ret=PyTuple_New(2);
2410 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2411 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2416 %extend ParaMEDMEM::DataArrayDoubleIterator
2420 DataArrayDoubleTuple *ret=self->nextt();
2422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2425 PyErr_SetString(PyExc_StopIteration,"No more data.");
2431 %extend ParaMEDMEM::DataArrayDoubleTuple
2433 std::string __str__() const
2435 return self->repr();
2438 double __float__() const throw(INTERP_KERNEL::Exception)
2440 return self->doubleValue();
2443 DataArrayDouble *buildDADouble()
2445 return self->buildDADouble(1,self->getNumberOfCompo());
2448 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2452 std::vector<int> multiVal;
2453 std::pair<int, std::pair<int,int> > slic;
2454 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2455 const double *pt=self->getConstPointer();
2456 int nbc=self->getNumberOfCompo();
2457 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2464 std::ostringstream oss;
2465 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2466 throw INTERP_KERNEL::Exception(oss.str().c_str());
2469 return PyFloat_FromDouble(pt[singleVal]);
2473 return PyFloat_FromDouble(pt[nbc+singleVal]);
2476 std::ostringstream oss;
2477 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2478 throw INTERP_KERNEL::Exception(oss.str().c_str());
2484 PyObject *t=PyTuple_New(multiVal.size());
2485 for(int j=0;j<(int)multiVal.size();j++)
2487 int cid=multiVal[j];
2490 std::ostringstream oss;
2491 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2492 throw INTERP_KERNEL::Exception(oss.str().c_str());
2494 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2500 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2501 PyObject *t=PyTuple_New(sz);
2502 for(int j=0;j<sz;j++)
2503 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2507 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2511 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2513 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2516 std::vector<double> multiValV;
2517 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2518 int nbc=self->getNumberOfCompo();
2519 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2521 std::vector<int> multiVal;
2522 std::pair<int, std::pair<int,int> > slic;
2523 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2524 double *pt=self->getPointer();
2525 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2532 std::ostringstream oss;
2533 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2534 throw INTERP_KERNEL::Exception(oss.str().c_str());
2540 pt[singleVal]=singleValV;
2545 if(multiValV.size()!=1)
2547 std::ostringstream oss;
2548 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2549 throw INTERP_KERNEL::Exception(oss.str().c_str());
2551 pt[singleVal]=multiValV[0];
2556 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2560 throw INTERP_KERNEL::Exception(msg);
2569 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2573 std::ostringstream oss;
2574 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2575 throw INTERP_KERNEL::Exception(oss.str().c_str());
2583 if(multiVal.size()!=multiValV.size())
2585 std::ostringstream oss;
2586 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2587 throw INTERP_KERNEL::Exception(oss.str().c_str());
2589 for(int i=0;i<(int)multiVal.size();i++)
2591 int pos=multiVal[i];
2594 std::ostringstream oss;
2595 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2596 throw INTERP_KERNEL::Exception(oss.str().c_str());
2598 pt[multiVal[i]]=multiValV[i];
2604 const double *ptV=daIntTyyppV->getConstPointer();
2605 if(nbc>daIntTyyppV->getNumberOfCompo())
2607 std::ostringstream oss;
2608 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2609 throw INTERP_KERNEL::Exception(oss.str().c_str());
2611 std::copy(ptV,ptV+nbc,pt);
2615 throw INTERP_KERNEL::Exception(msg);
2620 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
2625 for(int j=0;j<sz;j++)
2626 pt[slic.first+j*slic.second.second]=singleValV;
2631 if(sz!=(int)multiValV.size())
2633 std::ostringstream oss;
2634 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2635 throw INTERP_KERNEL::Exception(oss.str().c_str());
2637 for(int j=0;j<sz;j++)
2638 pt[slic.first+j*slic.second.second]=multiValV[j];
2643 const double *ptV=daIntTyyppV->getConstPointer();
2644 if(sz>daIntTyyppV->getNumberOfCompo())
2646 std::ostringstream oss;
2647 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2648 throw INTERP_KERNEL::Exception(oss.str().c_str());
2650 for(int j=0;j<sz;j++)
2651 pt[slic.first+j*slic.second.second]=ptV[j];
2655 throw INTERP_KERNEL::Exception(msg);
2659 throw INTERP_KERNEL::Exception(msg);
2664 %extend ParaMEDMEM::DataArrayDouble
2666 DataArrayDouble() throw(INTERP_KERNEL::Exception)
2668 return DataArrayDouble::New();
2671 static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2673 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) !";
2674 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2678 if(PyInt_Check(elt1))
2680 int nbOfTuples=PyInt_AS_LONG(elt1);
2682 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2685 if(PyInt_Check(elt2))
2686 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
2687 int nbOfCompo=PyInt_AS_LONG(elt2);
2689 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2690 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2691 double *tmp=new double[nbOfTuples*nbOfCompo];
2692 try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples*nbOfCompo,0.,true); }
2693 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2694 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
2699 throw INTERP_KERNEL::Exception(msg);
2702 {//DataArrayDouble.New([1.,3.,4.],3)
2703 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2704 double *tmp=new double[nbOfTuples];
2705 try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples,0.,true); }
2706 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2707 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
2713 throw INTERP_KERNEL::Exception(msg);
2716 {// DataArrayDouble.New([1.,3.,4.])
2718 if(PyList_Check(elt0))
2719 szz=PyList_Size(elt0);
2721 szz=PyTuple_Size(elt0);
2722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2723 double *tmp=new double[szz];
2724 try { fillArrayWithPyListDbl(elt0,tmp,szz,0.,true); }
2725 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
2726 ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
2731 else if(PyInt_Check(elt0))
2733 int nbOfTuples=PyInt_AS_LONG(elt0);
2735 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2740 if(PyInt_Check(elt1))
2741 {//DataArrayDouble.New(5,2)
2742 int nbOfCompo=PyInt_AS_LONG(elt1);
2744 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2745 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2746 ret->alloc(nbOfTuples,nbOfCompo);
2751 throw INTERP_KERNEL::Exception(msg);
2754 throw INTERP_KERNEL::Exception(msg);
2757 {//DataArrayDouble.New(5)
2758 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
2759 ret->alloc(nbOfTuples,1);
2765 throw INTERP_KERNEL::Exception(msg);
2768 DataArrayDouble(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
2770 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,elt1,elt2);
2773 std::string __str__() const
2775 return self->repr();
2778 double __float__() const throw(INTERP_KERNEL::Exception)
2780 return self->doubleValue();
2783 int __len__() const throw(INTERP_KERNEL::Exception)
2785 if(self->isAllocated())
2787 return self->getNumberOfTuples();
2791 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
2795 DataArrayDoubleIterator *__iter__()
2797 return self->iterator();
2800 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
2802 double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
2805 fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
2807 catch(INTERP_KERNEL::Exception& e)
2812 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
2815 PyObject *getValues() throw(INTERP_KERNEL::Exception)
2817 const double *vals=self->getPointer();
2818 return convertDblArrToPyList(vals,self->getNbOfElems());
2821 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
2824 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
2825 PyObject *ret=PyTuple_New(2);
2826 PyObject *ret0Py=ret0?Py_True:Py_False;
2828 PyTuple_SetItem(ret,0,ret0Py);
2829 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2833 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
2835 const double *vals=self->getPointer();
2836 int nbOfComp=self->getNumberOfComponents();
2837 int nbOfTuples=self->getNumberOfTuples();
2838 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2841 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2844 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2845 if (!SWIG_IsOK(res1))
2848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2849 if(size!=self->getNumberOfTuples())
2851 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2853 return self->renumber(tmp);
2857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2859 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2860 da2->checkAllocated();
2861 int size=self->getNumberOfTuples();
2862 if(size!=self->getNumberOfTuples())
2864 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2866 return self->renumber(da2->getConstPointer());
2870 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2874 if (!SWIG_IsOK(res1))
2877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2878 if(size!=self->getNumberOfTuples())
2880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2882 return self->renumberR(tmp);
2886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2889 da2->checkAllocated();
2890 int size=self->getNumberOfTuples();
2891 if(size!=self->getNumberOfTuples())
2893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2895 return self->renumberR(da2->getConstPointer());
2899 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2902 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2903 if (!SWIG_IsOK(res1))
2906 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2907 if(size!=self->getNumberOfTuples())
2909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2911 return self->renumberAndReduce(tmp,newNbOfTuple);
2915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2917 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2918 da2->checkAllocated();
2919 int size=self->getNumberOfTuples();
2920 if(size!=self->getNumberOfTuples())
2922 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2924 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2928 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
2931 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2932 if (!SWIG_IsOK(res1))
2935 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2936 if(size!=self->getNumberOfTuples())
2938 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2940 self->renumberInPlace(tmp);
2944 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2946 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2947 da2->checkAllocated();
2948 int size=self->getNumberOfTuples();
2949 if(size!=self->getNumberOfTuples())
2951 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2953 self->renumberInPlace(da2->getConstPointer());
2957 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
2960 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2961 if (!SWIG_IsOK(res1))
2964 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2965 if(size!=self->getNumberOfTuples())
2967 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2969 self->renumberInPlaceR(tmp);
2973 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2975 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2976 da2->checkAllocated();
2977 int size=self->getNumberOfTuples();
2978 if(size!=self->getNumberOfTuples())
2980 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2982 self->renumberInPlaceR(da2->getConstPointer());
2986 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2989 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2990 if (!SWIG_IsOK(res1))
2993 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2994 return self->selectByTupleId(tmp,tmp+size);
2998 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3000 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3001 da2->checkAllocated();
3002 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3006 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
3009 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3010 if (!SWIG_IsOK(res1))
3013 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3014 return self->selectByTupleIdSafe(tmp,tmp+size);
3018 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3020 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3021 da2->checkAllocated();
3022 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3026 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3029 double r1=self->getMaxValue(tmp);
3030 PyObject *ret=PyTuple_New(2);
3031 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3032 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3036 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3039 double r1=self->getMaxValue2(tmp);
3040 PyObject *ret=PyTuple_New(2);
3041 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3042 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3046 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3049 double r1=self->getMinValue(tmp);
3050 PyObject *ret=PyTuple_New(2);
3051 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3052 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3056 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3059 double r1=self->getMinValue2(tmp);
3060 PyObject *ret=PyTuple_New(2);
3061 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3062 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3066 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
3068 int nbOfCompo=self->getNumberOfComponents();
3069 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
3070 self->getMinMaxPerComponent(tmp);
3071 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
3075 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3077 int sz=self->getNumberOfComponents();
3078 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3079 self->accumulate(tmp);
3080 return convertDblArrToPyList(tmp,sz);
3083 DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3085 std::vector<int> tmp;
3086 convertPyToNewIntArr3(li,tmp);
3087 return self->keepSelectedComponents(tmp);
3090 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
3092 DataArrayInt *comm, *commIndex;
3093 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
3094 PyObject *res = PyList_New(2);
3095 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3096 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3100 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3102 std::vector<int> tmp;
3103 convertPyToNewIntArr3(li,tmp);
3104 self->setSelectedComponents(a,tmp);
3107 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3109 int sz=self->getNumberOfComponents();
3110 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3111 self->getTuple(tupleId,tmp);
3112 return convertDblArrToPyList(tmp,sz);
3115 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3117 std::vector<const DataArrayDouble *> tmp;
3118 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3119 return DataArrayDouble::Aggregate(tmp);
3122 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3124 std::vector<const DataArrayDouble *> tmp;
3125 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3126 return DataArrayDouble::Meld(tmp);
3129 DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
3131 std::vector<std::pair<int,int> > ranges;
3132 convertPyToVectorPairInt(li,ranges);
3133 return self->selectByTupleRanges(ranges);
3136 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
3140 DataArrayDoubleTuple *aa;
3141 std::vector<double> bb;
3143 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
3144 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
3145 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
3146 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
3147 std::vector<int> c,cI;
3148 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
3149 DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
3150 ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
3151 ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
3152 PyObject *ret=PyTuple_New(2);
3153 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3154 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3158 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3160 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
3161 self->checkAllocated();
3162 int nbOfTuples=self->getNumberOfTuples();
3163 int nbOfComponents=self->getNumberOfComponents();
3165 std::vector<int> vt1,vc1;
3166 std::pair<int, std::pair<int,int> > pt1,pc1;
3167 DataArrayInt *dt1=0,*dc1=0;
3169 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3170 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
3174 if(nbOfComponents==1)
3175 return PyFloat_FromDouble(self->getIJSafe(it1,0));
3176 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3178 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3180 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3182 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3184 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
3187 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3188 std::vector<int> v2(1,ic1);
3189 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3193 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3194 std::vector<int> v2(1,ic1);
3195 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3199 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3200 std::vector<int> v2(1,ic1);
3201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3205 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3206 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3210 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3215 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3216 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3220 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3225 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3226 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3227 std::vector<int> v2(nbOfComp);
3228 for(int i=0;i<nbOfComp;i++)
3229 v2[i]=pc1.first+i*pc1.second.second;
3230 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3234 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3235 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3236 std::vector<int> v2(nbOfComp);
3237 for(int i=0;i<nbOfComp;i++)
3238 v2[i]=pc1.first+i*pc1.second.second;
3239 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3243 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3244 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3245 std::vector<int> v2(nbOfComp);
3246 for(int i=0;i<nbOfComp;i++)
3247 v2[i]=pc1.first+i*pc1.second.second;
3248 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3252 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3253 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
3254 std::vector<int> v2(nbOfComp);
3255 for(int i=0;i<nbOfComp;i++)
3256 v2[i]=pc1.first+i*pc1.second.second;
3257 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
3260 throw INTERP_KERNEL::Exception(msg);
3264 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3266 self->checkAllocated();
3267 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
3268 int nbOfTuples=self->getNumberOfTuples();
3269 int nbOfComponents=self->getNumberOfComponents();
3272 std::vector<double> v1;
3273 DataArrayDouble *d1=0;
3274 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
3276 std::vector<int> vt1,vc1;
3277 std::pair<int, std::pair<int,int> > pt1,pc1;
3278 DataArrayInt *dt1=0,*dc1=0;
3279 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3280 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
3288 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3291 tmp=DataArrayDouble::New();
3292 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3293 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3296 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3299 throw INTERP_KERNEL::Exception(msg);
3308 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3311 tmp=DataArrayDouble::New();
3312 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3313 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3316 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3319 throw INTERP_KERNEL::Exception(msg);
3328 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3331 tmp=DataArrayDouble::New();
3332 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3333 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3336 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3339 throw INTERP_KERNEL::Exception(msg);
3348 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3351 tmp=DataArrayDouble::New();
3352 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3353 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3356 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3359 throw INTERP_KERNEL::Exception(msg);
3368 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3371 tmp=DataArrayDouble::New();
3372 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3373 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3376 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3379 throw INTERP_KERNEL::Exception(msg);
3388 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3391 tmp=DataArrayDouble::New();
3392 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3393 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3396 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3399 throw INTERP_KERNEL::Exception(msg);
3408 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3411 tmp=DataArrayDouble::New();
3412 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3413 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3416 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3419 throw INTERP_KERNEL::Exception(msg);
3428 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3431 tmp=DataArrayDouble::New();
3432 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3433 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3436 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3439 throw INTERP_KERNEL::Exception(msg);
3448 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3451 tmp=DataArrayDouble::New();
3452 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3453 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3456 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3459 throw INTERP_KERNEL::Exception(msg);
3468 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3471 tmp=DataArrayDouble::New();
3472 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3473 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3476 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3479 throw INTERP_KERNEL::Exception(msg);
3486 int ee=pt1.second.first;
3487 int ss=pt1.second.second;
3489 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
3490 int nbOfE=(ee-bb)/ss;
3491 std::vector<int> nv(nbOfE);
3492 for(int jj=0;jj<nbOfE;jj++)
3497 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3500 tmp=DataArrayDouble::New();
3501 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3502 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3505 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
3508 throw INTERP_KERNEL::Exception(msg);
3517 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3520 tmp=DataArrayDouble::New();
3521 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3522 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3525 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3528 throw INTERP_KERNEL::Exception(msg);
3537 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3540 tmp=DataArrayDouble::New();
3541 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3542 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3545 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3548 throw INTERP_KERNEL::Exception(msg);
3557 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3560 tmp=DataArrayDouble::New();
3561 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3562 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3565 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3568 throw INTERP_KERNEL::Exception(msg);
3577 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3580 tmp=DataArrayDouble::New();
3581 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
3582 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3585 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3600 tmp=DataArrayDouble::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3605 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3608 throw INTERP_KERNEL::Exception(msg);
3613 throw INTERP_KERNEL::Exception(msg);
3618 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3620 return self->negate();
3623 DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3625 const char msg[]="Unexpected situation in __add__ !";
3628 DataArrayDoubleTuple *aa;
3629 std::vector<double> bb;
3631 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3636 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3637 ret->applyLin(1.,val);
3643 return DataArrayDouble::Add(self,a);
3647 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3648 return DataArrayDouble::Add(self,aaa);
3652 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3653 return DataArrayDouble::Add(self,aaa);
3656 throw INTERP_KERNEL::Exception(msg);
3660 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3662 const char msg[]="Unexpected situation in __radd__ !";
3665 DataArrayDoubleTuple *aa;
3666 std::vector<double> bb;
3668 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3673 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3674 ret->applyLin(1.,val);
3680 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3681 return DataArrayDouble::Add(self,aaa);
3685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3686 return DataArrayDouble::Add(self,aaa);
3689 throw INTERP_KERNEL::Exception(msg);
3693 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3695 const char msg[]="Unexpected situation in __iadd__ !";
3698 DataArrayDoubleTuple *aa;
3699 std::vector<double> bb;
3701 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3706 self->applyLin(1.,val);
3707 Py_XINCREF(trueSelf);
3713 Py_XINCREF(trueSelf);
3718 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3719 self->addEqual(aaa);
3720 Py_XINCREF(trueSelf);
3725 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3726 self->addEqual(aaa);
3727 Py_XINCREF(trueSelf);
3731 throw INTERP_KERNEL::Exception(msg);
3735 DataArrayDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3737 const char msg[]="Unexpected situation in __sub__ !";
3740 DataArrayDoubleTuple *aa;
3741 std::vector<double> bb;
3743 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3748 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3749 ret->applyLin(1.,-val);
3755 return DataArrayDouble::Substract(self,a);
3759 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3760 return DataArrayDouble::Substract(self,aaa);
3764 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3765 return DataArrayDouble::Substract(self,aaa);
3768 throw INTERP_KERNEL::Exception(msg);
3772 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3774 const char msg[]="Unexpected situation in __rsub__ !";
3777 DataArrayDoubleTuple *aa;
3778 std::vector<double> bb;
3780 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3785 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3786 ret->applyLin(-1.,val);
3792 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3793 return DataArrayDouble::Substract(aaa,self);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3798 return DataArrayDouble::Substract(aaa,self);
3801 throw INTERP_KERNEL::Exception(msg);
3805 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3807 const char msg[]="Unexpected situation in __isub__ !";
3810 DataArrayDoubleTuple *aa;
3811 std::vector<double> bb;
3813 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3818 self->applyLin(1,-val);
3819 Py_XINCREF(trueSelf);
3824 self->substractEqual(a);
3825 Py_XINCREF(trueSelf);
3830 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3831 self->substractEqual(aaa);
3832 Py_XINCREF(trueSelf);
3837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3838 self->substractEqual(aaa);
3839 Py_XINCREF(trueSelf);
3843 throw INTERP_KERNEL::Exception(msg);
3847 DataArrayDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3849 const char msg[]="Unexpected situation in __mul__ !";
3852 DataArrayDoubleTuple *aa;
3853 std::vector<double> bb;
3855 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3860 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3861 ret->applyLin(val,0.);
3867 return DataArrayDouble::Multiply(self,a);
3871 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3872 return DataArrayDouble::Multiply(self,aaa);
3876 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3877 return DataArrayDouble::Multiply(self,aaa);
3880 throw INTERP_KERNEL::Exception(msg);
3884 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3886 const char msg[]="Unexpected situation in __rmul__ !";
3889 DataArrayDoubleTuple *aa;
3890 std::vector<double> bb;
3892 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3897 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3898 ret->applyLin(val,0.);
3904 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3905 return DataArrayDouble::Multiply(self,aaa);
3909 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3910 return DataArrayDouble::Multiply(self,aaa);
3913 throw INTERP_KERNEL::Exception(msg);
3917 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3919 const char msg[]="Unexpected situation in __imul__ !";
3922 DataArrayDoubleTuple *aa;
3923 std::vector<double> bb;
3925 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3930 self->applyLin(val,0.);
3931 Py_XINCREF(trueSelf);
3936 self->multiplyEqual(a);
3937 Py_XINCREF(trueSelf);
3942 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3943 self->multiplyEqual(aaa);
3944 Py_XINCREF(trueSelf);
3949 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3950 self->multiplyEqual(aaa);
3951 Py_XINCREF(trueSelf);
3955 throw INTERP_KERNEL::Exception(msg);
3959 DataArrayDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3961 const char msg[]="Unexpected situation in __div__ !";
3964 DataArrayDoubleTuple *aa;
3965 std::vector<double> bb;
3967 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3973 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
3974 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
3975 ret->applyLin(1/val,0.);
3981 return DataArrayDouble::Divide(self,a);
3985 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3986 return DataArrayDouble::Divide(self,aaa);
3990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3991 return DataArrayDouble::Divide(self,aaa);
3994 throw INTERP_KERNEL::Exception(msg);
3998 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4000 const char msg[]="Unexpected situation in __rdiv__ !";
4003 DataArrayDoubleTuple *aa;
4004 std::vector<double> bb;
4006 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4011 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4019 return DataArrayDouble::Divide(aaa,self);
4023 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4024 return DataArrayDouble::Divide(aaa,self);
4027 throw INTERP_KERNEL::Exception(msg);
4031 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4033 const char msg[]="Unexpected situation in __idiv__ !";
4036 DataArrayDoubleTuple *aa;
4037 std::vector<double> bb;
4039 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4045 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
4046 self->applyLin(1./val,0.);
4047 Py_XINCREF(trueSelf);
4052 self->divideEqual(a);
4053 Py_XINCREF(trueSelf);
4058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4059 self->divideEqual(aaa);
4060 Py_XINCREF(trueSelf);
4065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4066 self->divideEqual(aaa);
4067 Py_XINCREF(trueSelf);
4071 throw INTERP_KERNEL::Exception(msg);
4075 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
4077 std::vector<int> c,cI;
4079 self->computeTupleIdsNearTuples(other,eps,c,cI);
4080 PyObject *ret=PyTuple_New(2);
4081 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
4082 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
4083 d0->alloc(c.size(),1);
4084 d1->alloc(cI.size(),1);
4085 std::copy(c.begin(),c.end(),d0->getPointer());
4086 std::copy(cI.begin(),cI.end(),d1->getPointer());
4087 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4088 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4095 %extend ParaMEDMEM::DataArrayIntTuple
4097 std::string __str__() const
4099 return self->repr();
4102 int __int__() const throw(INTERP_KERNEL::Exception)
4104 return self->intValue();
4107 DataArrayInt *buildDAInt()
4109 return self->buildDAInt(1,self->getNumberOfCompo());
4112 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4116 std::vector<int> multiVal;
4117 std::pair<int, std::pair<int,int> > slic;
4118 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4119 const int *pt=self->getConstPointer();
4120 int nbc=self->getNumberOfCompo();
4121 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4128 std::ostringstream oss;
4129 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4130 throw INTERP_KERNEL::Exception(oss.str().c_str());
4133 return PyInt_FromLong(pt[singleVal]);
4137 return PyInt_FromLong(pt[nbc+singleVal]);
4140 std::ostringstream oss;
4141 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4142 throw INTERP_KERNEL::Exception(oss.str().c_str());
4148 PyObject *t=PyTuple_New(multiVal.size());
4149 for(int j=0;j<(int)multiVal.size();j++)
4151 int cid=multiVal[j];
4154 std::ostringstream oss;
4155 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4156 throw INTERP_KERNEL::Exception(oss.str().c_str());
4158 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4164 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4165 PyObject *t=PyTuple_New(sz);
4166 for(int j=0;j<sz;j++)
4167 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4171 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4175 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4177 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4180 std::vector<int> multiValV;
4181 std::pair<int, std::pair<int,int> > slicV;
4182 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4183 int nbc=self->getNumberOfCompo();
4184 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4186 std::vector<int> multiVal;
4187 std::pair<int, std::pair<int,int> > slic;
4188 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4189 int *pt=self->getPointer();
4190 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4197 std::ostringstream oss;
4198 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4199 throw INTERP_KERNEL::Exception(oss.str().c_str());
4205 pt[singleVal]=singleValV;
4210 if(multiValV.size()!=1)
4212 std::ostringstream oss;
4213 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4214 throw INTERP_KERNEL::Exception(oss.str().c_str());
4216 pt[singleVal]=multiValV[0];
4221 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4225 throw INTERP_KERNEL::Exception(msg);
4234 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4238 std::ostringstream oss;
4239 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4240 throw INTERP_KERNEL::Exception(oss.str().c_str());
4248 if(multiVal.size()!=multiValV.size())
4250 std::ostringstream oss;
4251 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4252 throw INTERP_KERNEL::Exception(oss.str().c_str());
4254 for(int i=0;i<(int)multiVal.size();i++)
4256 int pos=multiVal[i];
4259 std::ostringstream oss;
4260 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4261 throw INTERP_KERNEL::Exception(oss.str().c_str());
4263 pt[multiVal[i]]=multiValV[i];
4269 const int *ptV=daIntTyyppV->getConstPointer();
4270 if(nbc>daIntTyyppV->getNumberOfCompo())
4272 std::ostringstream oss;
4273 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4274 throw INTERP_KERNEL::Exception(oss.str().c_str());
4276 std::copy(ptV,ptV+nbc,pt);
4280 throw INTERP_KERNEL::Exception(msg);
4285 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4290 for(int j=0;j<sz;j++)
4291 pt[slic.first+j*slic.second.second]=singleValV;
4296 if(sz!=(int)multiValV.size())
4298 std::ostringstream oss;
4299 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4300 throw INTERP_KERNEL::Exception(oss.str().c_str());
4302 for(int j=0;j<sz;j++)
4303 pt[slic.first+j*slic.second.second]=multiValV[j];
4308 const int *ptV=daIntTyyppV->getConstPointer();
4309 if(sz>daIntTyyppV->getNumberOfCompo())
4311 std::ostringstream oss;
4312 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4313 throw INTERP_KERNEL::Exception(oss.str().c_str());
4315 for(int j=0;j<sz;j++)
4316 pt[slic.first+j*slic.second.second]=ptV[j];
4320 throw INTERP_KERNEL::Exception(msg);
4324 throw INTERP_KERNEL::Exception(msg);
4329 %extend ParaMEDMEM::DataArrayIntIterator
4333 DataArrayIntTuple *ret=self->nextt();
4335 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4338 PyErr_SetString(PyExc_StopIteration,"No more data.");
4344 %extend ParaMEDMEM::DataArrayInt
4346 DataArrayInt() throw(INTERP_KERNEL::Exception)
4348 return DataArrayInt::New();
4351 static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4353 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) !";
4354 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4358 if(PyInt_Check(elt1))
4360 int nbOfTuples=PyInt_AS_LONG(elt1);
4362 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4365 if(PyInt_Check(elt2))
4366 {//DataArrayInt.New([1,3,4,5],2,2)
4367 int nbOfCompo=PyInt_AS_LONG(elt2);
4369 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4370 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4371 int *tmp=new int[nbOfTuples*nbOfCompo];
4372 try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples*nbOfCompo,0,true); }
4373 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4374 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
4379 throw INTERP_KERNEL::Exception(msg);
4382 {//DataArrayInt.New([1,3,4],3)
4383 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4384 int *tmp=new int[nbOfTuples];
4385 try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples,0,true); }
4386 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4387 ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
4393 throw INTERP_KERNEL::Exception(msg);
4396 {// DataArrayInt.New([1,3,4])
4398 if(PyList_Check(elt0))
4399 szz=PyList_Size(elt0);
4401 szz=PyTuple_Size(elt0);
4402 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4403 int *tmp=new int[szz];
4404 try { fillArrayWithPyListInt(elt0,tmp,szz,0,true); }
4405 catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
4406 ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
4411 else if(PyInt_Check(elt0))
4413 int nbOfTuples=PyInt_AS_LONG(elt0);
4415 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
4420 if(PyInt_Check(elt1))
4421 {//DataArrayInt.New(5,2)
4422 int nbOfCompo=PyInt_AS_LONG(elt1);
4424 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
4425 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4426 ret->alloc(nbOfTuples,nbOfCompo);
4431 throw INTERP_KERNEL::Exception(msg);
4434 throw INTERP_KERNEL::Exception(msg);
4437 {//DataArrayInt.New(5)
4438 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
4439 ret->alloc(nbOfTuples,1);
4445 throw INTERP_KERNEL::Exception(msg);
4448 DataArrayInt(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4450 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,elt1,elt2);
4453 std::string __str__() const
4455 return self->repr();
4458 int __len__() const throw(INTERP_KERNEL::Exception)
4460 if(self->isAllocated())
4462 return self->getNumberOfTuples();
4466 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
4470 int __int__() const throw(INTERP_KERNEL::Exception)
4472 return self->intValue();
4475 DataArrayIntIterator *__iter__()
4477 return self->iterator();
4480 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const DataArrayInt *arr, const DataArrayInt *arrI) throw(INTERP_KERNEL::Exception)
4482 int newNbOfTuples=-1;
4483 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arr,arrI,newNbOfTuples);
4484 PyObject *ret=PyTuple_New(2);
4485 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4486 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
4490 void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
4492 int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
4495 fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
4497 catch(INTERP_KERNEL::Exception& e)
4502 self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
4505 PyObject *getValues() throw(INTERP_KERNEL::Exception)
4507 const int *vals=self->getPointer();
4508 return convertIntArrToPyList(vals,self->getNbOfElems());
4511 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
4514 bool ret0=self->isEqualIfNotWhy(other,ret1);
4515 PyObject *ret=PyTuple_New(2);
4516 PyObject *ret0Py=ret0?Py_True:Py_False;
4518 PyTuple_SetItem(ret,0,ret0Py);
4519 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4523 PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
4525 const int *vals=self->getPointer();
4526 int nbOfComp=self->getNumberOfComponents();
4527 int nbOfTuples=self->getNumberOfTuples();
4528 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4531 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
4533 std::vector<const DataArrayInt *> groups;
4534 std::vector< std::vector<int> > fidsOfGroups;
4535 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
4536 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
4537 PyObject *ret = PyList_New(2);
4538 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4539 int sz=fidsOfGroups.size();
4540 PyObject *ret1 = PyList_New(sz);
4541 for(int i=0;i<sz;i++)
4542 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
4543 PyList_SetItem(ret,1,ret1);
4547 void transformWithIndArr(PyObject *li)
4550 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4551 if (!SWIG_IsOK(res1))
4554 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4555 self->transformWithIndArr(tmp,tmp+size);
4559 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4560 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4564 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4568 std::vector<int> multiVal;
4569 std::pair<int, std::pair<int,int> > slic;
4570 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4571 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4575 return self->getIdsEqualList(&singleVal,&singleVal+1);
4577 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4579 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
4581 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4585 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
4589 std::vector<int> multiVal;
4590 std::pair<int, std::pair<int,int> > slic;
4591 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4592 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
4596 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
4598 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
4600 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
4602 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
4606 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
4608 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
4610 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4611 if (!SWIG_IsOK(res1))
4614 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4615 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
4619 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4621 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4622 da2->checkAllocated();
4623 int size=self->getNumberOfTuples();
4624 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
4626 PyObject *ret = PyList_New(3);
4627 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4628 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4629 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4633 DataArrayInt *transformWithIndArrR(PyObject *li) const
4636 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4637 if (!SWIG_IsOK(res1))
4640 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4641 return self->transformWithIndArrR(tmp,tmp+size);
4645 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4646 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4650 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
4653 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4654 if (!SWIG_IsOK(res1))
4657 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4658 if(size!=self->getNumberOfTuples())
4660 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4662 self->renumberInPlace(tmp);
4666 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4668 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4669 da2->checkAllocated();
4670 int size=self->getNumberOfTuples();
4671 if(size!=self->getNumberOfTuples())
4673 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4675 self->renumberInPlace(da2->getConstPointer());
4679 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
4682 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4683 if (!SWIG_IsOK(res1))
4686 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4687 if(size!=self->getNumberOfTuples())
4689 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4691 self->renumberInPlaceR(tmp);
4695 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4697 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4698 da2->checkAllocated();
4699 int size=self->getNumberOfTuples();
4700 if(size!=self->getNumberOfTuples())
4702 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4704 self->renumberInPlaceR(da2->getConstPointer());
4708 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4711 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4712 if (!SWIG_IsOK(res1))
4715 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4716 if(size!=self->getNumberOfTuples())
4718 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4720 return self->renumberAndReduce(tmp,newNbOfTuple);
4724 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4726 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4727 da2->checkAllocated();
4728 int size=self->getNumberOfTuples();
4729 if(size!=self->getNumberOfTuples())
4731 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4733 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4737 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4740 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4741 if (!SWIG_IsOK(res1))
4744 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4745 if(size!=self->getNumberOfTuples())
4747 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4749 return self->renumber(tmp);
4753 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4755 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4756 da2->checkAllocated();
4757 int size=self->getNumberOfTuples();
4758 if(size!=self->getNumberOfTuples())
4760 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4762 return self->renumber(da2->getConstPointer());
4766 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
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 if(size!=self->getNumberOfTuples())
4776 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4778 return self->renumberR(tmp);
4782 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4784 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4785 da2->checkAllocated();
4786 int size=self->getNumberOfTuples();
4787 if(size!=self->getNumberOfTuples())
4789 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4791 return self->renumberR(da2->getConstPointer());
4795 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
4798 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4799 if (!SWIG_IsOK(res1))
4802 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4803 return self->selectByTupleId(tmp,tmp+size);
4807 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4809 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4810 da2->checkAllocated();
4811 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4815 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4818 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4819 if (!SWIG_IsOK(res1))
4822 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4823 return self->selectByTupleIdSafe(tmp,tmp+size);
4827 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4829 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4830 da2->checkAllocated();
4831 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4835 DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
4837 std::vector<int> tmp;
4838 convertPyToNewIntArr3(li,tmp);
4839 return self->keepSelectedComponents(tmp);
4842 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
4844 std::vector<int> tmp;
4845 convertPyToNewIntArr3(li,tmp);
4846 self->setSelectedComponents(a,tmp);
4849 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4851 int sz=self->getNumberOfComponents();
4852 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
4853 self->getTuple(tupleId,tmp);
4854 return convertIntArrToPyList(tmp,sz);
4857 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
4859 DataArrayInt *arr=0;
4860 DataArrayInt *arrI=0;
4861 self->changeSurjectiveFormat(targetNb,arr,arrI);
4862 PyObject *res = PyList_New(2);
4863 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4864 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
4868 DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
4870 std::vector<std::pair<int,int> > ranges;
4871 convertPyToVectorPairInt(li,ranges);
4872 return self->selectByTupleRanges(ranges);
4875 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
4877 std::vector<const DataArrayInt *> tmp;
4878 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4879 return DataArrayInt::Meld(tmp);
4882 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
4884 std::vector<const DataArrayInt *> tmp;
4885 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4886 return DataArrayInt::Aggregate(tmp);
4889 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
4891 std::vector<const DataArrayInt *> tmp;
4892 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4893 return DataArrayInt::BuildUnion(tmp);
4896 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
4898 std::vector<const DataArrayInt *> tmp;
4899 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
4900 return DataArrayInt::BuildIntersection(tmp);
4903 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4906 int r1=self->getMaxValue(tmp);
4907 PyObject *ret=PyTuple_New(2);
4908 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4909 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4913 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4916 int r1=self->getMinValue(tmp);
4917 PyObject *ret=PyTuple_New(2);
4918 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4919 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4923 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4925 int nbOfCompo=self->getNumberOfComponents();
4930 if(PyInt_Check(obj))
4932 int val=(int)PyInt_AS_LONG(obj);
4933 return self->locateValue(val);
4936 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
4940 std::vector<int> arr;
4941 convertPyToNewIntArr3(obj,arr);
4942 return self->locateTuple(arr);
4947 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4949 int nbOfCompo=self->getNumberOfComponents();
4956 if(PyInt_Check(obj))
4958 int val=(int)PyInt_AS_LONG(obj);
4959 return self->presenceOfValue(val);
4962 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
4966 std::vector<int> arr;
4967 convertPyToNewIntArr3(obj,arr);
4968 return self->presenceOfTuple(arr);
4973 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4975 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
4976 self->checkAllocated();
4977 int nbOfTuples=self->getNumberOfTuples();
4978 int nbOfComponents=self->getNumberOfComponents();
4980 std::vector<int> vt1,vc1;
4981 std::pair<int, std::pair<int,int> > pt1,pc1;
4982 DataArrayInt *dt1=0,*dc1=0;
4984 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
4985 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
4990 if(nbOfComponents==1)
4991 return PyInt_FromLong(self->getIJSafe(it1,0));
4992 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
4995 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
4997 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
4999 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5001 return PyInt_FromLong(self->getIJSafe(it1,ic1));
5004 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5005 std::vector<int> v2(1,ic1);
5006 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5010 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5011 std::vector<int> v2(1,ic1);
5012 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5016 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5017 std::vector<int> v2(1,ic1);
5018 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5022 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5023 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5027 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5028 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5032 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5033 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5037 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5038 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5042 ret=self->selectByTupleIdSafe(&it1,&it1+1);
5043 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5044 std::vector<int> v2(nbOfComp);
5045 for(int i=0;i<nbOfComp;i++)
5046 v2[i]=pc1.first+i*pc1.second.second;
5047 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5051 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
5052 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5053 std::vector<int> v2(nbOfComp);
5054 for(int i=0;i<nbOfComp;i++)
5055 v2[i]=pc1.first+i*pc1.second.second;
5056 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5060 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
5061 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5062 std::vector<int> v2(nbOfComp);
5063 for(int i=0;i<nbOfComp;i++)
5064 v2[i]=pc1.first+i*pc1.second.second;
5065 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5069 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
5070 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
5071 std::vector<int> v2(nbOfComp);
5072 for(int i=0;i<nbOfComp;i++)
5073 v2[i]=pc1.first+i*pc1.second.second;
5074 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
5077 throw INTERP_KERNEL::Exception(msg);
5081 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5083 self->checkAllocated();
5084 const char msg[]="Unexpected situation in __setitem__ !";
5085 int nbOfTuples=self->getNumberOfTuples();
5086 int nbOfComponents=self->getNumberOfComponents();
5089 std::vector<int> v1;
5091 DataArrayIntTuple *dd1=0;
5092 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5094 std::vector<int> vt1,vc1;
5095 std::pair<int, std::pair<int,int> > pt1,pc1;
5096 DataArrayInt *dt1=0,*dc1=0;
5097 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5098 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5106 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5109 tmp=DataArrayInt::New();
5110 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5111 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
5114 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
5117 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5118 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
5121 throw INTERP_KERNEL::Exception(msg);
5130 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5133 tmp=DataArrayInt::New();
5134 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5135 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
5138 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5141 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5142 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5145 throw INTERP_KERNEL::Exception(msg);
5154 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5157 tmp=DataArrayInt::New();
5158 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5159 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
5162 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5165 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5166 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5169 throw INTERP_KERNEL::Exception(msg);
5178 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5181 tmp=DataArrayInt::New();
5182 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5183 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
5186 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5189 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5190 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5193 throw INTERP_KERNEL::Exception(msg);
5202 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5205 tmp=DataArrayInt::New();
5206 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5207 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
5210 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
5213 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5214 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
5217 throw INTERP_KERNEL::Exception(msg);
5226 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5229 tmp=DataArrayInt::New();
5230 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5231 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
5234 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5237 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5238 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5241 throw INTERP_KERNEL::Exception(msg);
5250 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5253 tmp=DataArrayInt::New();
5254 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5255 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
5258 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5261 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5262 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5265 throw INTERP_KERNEL::Exception(msg);
5274 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5277 tmp=DataArrayInt::New();
5278 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5279 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
5282 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5285 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5286 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5289 throw INTERP_KERNEL::Exception(msg);
5298 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5301 tmp=DataArrayInt::New();
5302 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5303 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
5306 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5309 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5310 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5313 throw INTERP_KERNEL::Exception(msg);
5322 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5325 tmp=DataArrayInt::New();
5326 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5327 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5330 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5333 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5334 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5337 throw INTERP_KERNEL::Exception(msg);
5344 int ee=pt1.second.first;
5345 int ss=pt1.second.second;
5347 throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
5348 int nbOfE=(ee-bb)/ss;
5349 std::vector<int> nv(nbOfE);
5350 for(int jj=0;jj<nbOfE;jj++)
5355 self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5358 tmp=DataArrayInt::New();
5359 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5360 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
5363 self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5366 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5367 self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
5370 throw INTERP_KERNEL::Exception(msg);
5379 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5382 tmp=DataArrayInt::New();
5383 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5384 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
5387 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5390 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5391 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5394 throw INTERP_KERNEL::Exception(msg);
5403 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5406 tmp=DataArrayInt::New();
5407 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5408 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
5411 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5414 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5415 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5418 throw INTERP_KERNEL::Exception(msg);
5427 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5430 tmp=DataArrayInt::New();
5431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5432 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
5435 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5439 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5442 throw INTERP_KERNEL::Exception(msg);
5451 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5454 tmp=DataArrayInt::New();
5455 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
5456 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
5459 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5463 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5466 throw INTERP_KERNEL::Exception(msg);
5475 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5478 tmp=DataArrayInt::New();
5479 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5480 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
5483 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
5487 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5490 throw INTERP_KERNEL::Exception(msg);
5495 throw INTERP_KERNEL::Exception(msg);
5500 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
5502 return self->negate();
5505 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5507 const char msg[]="Unexpected situation in __add__ !";
5510 std::vector<int> aa;
5511 DataArrayIntTuple *aaa;
5513 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5518 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5519 ret->applyLin(1,val);
5525 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5526 return DataArrayInt::Add(self,aaa);
5530 return DataArrayInt::Add(self,a);
5534 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5535 return DataArrayInt::Add(self,aaaa);
5538 throw INTERP_KERNEL::Exception(msg);
5542 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5544 const char msg[]="Unexpected situation in __radd__ !";
5547 std::vector<int> aa;
5548 DataArrayIntTuple *aaa;
5550 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5555 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5556 ret->applyLin(1,val);
5562 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5563 return DataArrayInt::Add(self,aaa);
5567 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5568 return DataArrayInt::Add(self,aaaa);
5571 throw INTERP_KERNEL::Exception(msg);
5575 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5577 const char msg[]="Unexpected situation in __iadd__ !";
5580 std::vector<int> aa;
5581 DataArrayIntTuple *aaa;
5583 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5588 self->applyLin(1,val);
5589 Py_XINCREF(trueSelf);
5594 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5596 Py_XINCREF(trueSelf);
5602 Py_XINCREF(trueSelf);
5607 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5608 self->addEqual(aaaa);
5609 Py_XINCREF(trueSelf);
5613 throw INTERP_KERNEL::Exception(msg);
5617 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5619 const char msg[]="Unexpected situation in __sub__ !";
5622 std::vector<int> aa;
5623 DataArrayIntTuple *aaa;
5625 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5630 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5631 ret->applyLin(1,-val);
5637 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5638 return DataArrayInt::Substract(self,aaa);
5642 return DataArrayInt::Substract(self,a);
5646 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5647 return DataArrayInt::Substract(self,aaaa);
5650 throw INTERP_KERNEL::Exception(msg);
5654 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5656 const char msg[]="Unexpected situation in __rsub__ !";
5659 std::vector<int> aa;
5660 DataArrayIntTuple *aaa;
5662 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5668 ret->applyLin(-1,val);
5674 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5675 return DataArrayInt::Substract(aaa,self);
5679 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5680 return DataArrayInt::Substract(aaaa,self);
5683 throw INTERP_KERNEL::Exception(msg);
5687 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5689 const char msg[]="Unexpected situation in __isub__ !";
5692 std::vector<int> aa;
5693 DataArrayIntTuple *aaa;
5695 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5700 self->applyLin(1,-val);
5701 Py_XINCREF(trueSelf);
5706 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5707 self->substractEqual(bb);
5708 Py_XINCREF(trueSelf);
5713 self->substractEqual(a);
5714 Py_XINCREF(trueSelf);
5719 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5720 self->substractEqual(aaaa);
5721 Py_XINCREF(trueSelf);
5725 throw INTERP_KERNEL::Exception(msg);
5729 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5731 const char msg[]="Unexpected situation in __mul__ !";
5734 std::vector<int> aa;
5735 DataArrayIntTuple *aaa;
5737 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5742 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5743 ret->applyLin(val,0);
5749 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5750 return DataArrayInt::Multiply(self,aaa);
5754 return DataArrayInt::Multiply(self,a);
5758 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5759 return DataArrayInt::Multiply(self,aaaa);
5762 throw INTERP_KERNEL::Exception(msg);
5766 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5768 const char msg[]="Unexpected situation in __rmul__ !";
5771 std::vector<int> aa;
5772 DataArrayIntTuple *aaa;
5774 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5779 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5780 ret->applyLin(val,0);
5786 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5787 return DataArrayInt::Multiply(self,aaa);
5791 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5792 return DataArrayInt::Multiply(self,aaaa);
5795 throw INTERP_KERNEL::Exception(msg);
5799 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5801 const char msg[]="Unexpected situation in __imul__ !";
5804 std::vector<int> aa;
5805 DataArrayIntTuple *aaa;
5807 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5812 self->applyLin(val,0);
5813 Py_XINCREF(trueSelf);
5818 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5819 self->multiplyEqual(bb);
5820 Py_XINCREF(trueSelf);
5825 self->multiplyEqual(a);
5826 Py_XINCREF(trueSelf);
5831 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5832 self->multiplyEqual(aaaa);
5833 Py_XINCREF(trueSelf);
5837 throw INTERP_KERNEL::Exception(msg);
5841 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5843 const char msg[]="Unexpected situation in __div__ !";
5846 std::vector<int> aa;
5847 DataArrayIntTuple *aaa;
5849 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5854 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5855 ret->applyDivideBy(val);
5861 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5862 return DataArrayInt::Divide(self,aaa);
5866 return DataArrayInt::Divide(self,a);
5870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5871 return DataArrayInt::Divide(self,aaaa);
5874 throw INTERP_KERNEL::Exception(msg);
5878 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5880 const char msg[]="Unexpected situation in __rdiv__ !";
5883 std::vector<int> aa;
5884 DataArrayIntTuple *aaa;
5886 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5891 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5898 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5899 return DataArrayInt::Divide(aaa,self);
5903 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5904 return DataArrayInt::Divide(aaaa,self);
5907 throw INTERP_KERNEL::Exception(msg);
5911 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5913 const char msg[]="Unexpected situation in __idiv__ !";
5916 std::vector<int> aa;
5917 DataArrayIntTuple *aaa;
5919 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5924 self->applyDivideBy(val);
5925 Py_XINCREF(trueSelf);
5930 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5931 self->divideEqual(bb);
5932 Py_XINCREF(trueSelf);
5937 self->divideEqual(a);
5938 Py_XINCREF(trueSelf);
5943 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5944 self->divideEqual(aaaa);
5945 Py_XINCREF(trueSelf);
5949 throw INTERP_KERNEL::Exception(msg);
5953 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5955 const char msg[]="Unexpected situation in __mod__ !";
5958 std::vector<int> aa;
5959 DataArrayIntTuple *aaa;
5961 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
5966 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
5967 ret->applyModulus(val);
5973 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
5974 return DataArrayInt::Modulus(self,aaa);
5978 return DataArrayInt::Modulus(self,a);
5982 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
5983 return DataArrayInt::Modulus(self,aaaa);
5986 throw INTERP_KERNEL::Exception(msg);
5990 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5992 const char msg[]="Unexpected situation in __rmod__ !";
5995 std::vector<int> aa;
5996 DataArrayIntTuple *aaa;
5998 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6003 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
6004 ret->applyRModulus(val);
6010 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
6011 return DataArrayInt::Modulus(aaa,self);
6015 return DataArrayInt::Modulus(a,self);
6019 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6020 return DataArrayInt::Modulus(aaaa,self);
6023 throw INTERP_KERNEL::Exception(msg);
6027 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
6029 const char msg[]="Unexpected situation in __imod__ !";
6032 std::vector<int> aa;
6033 DataArrayIntTuple *aaa;
6035 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
6040 self->applyModulus(val);
6041 Py_XINCREF(trueSelf);
6046 self->modulusEqual(a);
6047 Py_XINCREF(trueSelf);
6052 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
6053 self->modulusEqual(aaaa);
6054 Py_XINCREF(trueSelf);
6058 throw INTERP_KERNEL::Exception(msg);
6063 namespace ParaMEDMEM
6065 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
6068 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6069 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
6070 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6071 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
6072 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
6073 void setName(const char *name) throw(INTERP_KERNEL::Exception);
6074 const char *getDescription() const throw(INTERP_KERNEL::Exception);
6075 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
6076 const char *getName() const throw(INTERP_KERNEL::Exception);
6077 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
6078 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
6079 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
6080 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
6081 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
6082 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
6083 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
6084 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
6085 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
6086 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
6087 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
6088 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
6089 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
6090 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
6092 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
6094 MEDCouplingMesh *ret1=(MEDCouplingMesh *)self->getMesh();
6097 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
6100 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
6102 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
6105 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
6108 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
6111 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
6112 PyObject *ret=PyTuple_New(2);
6113 PyObject *ret0Py=ret0?Py_True:Py_False;
6115 PyTuple_SetItem(ret,0,ret0Py);
6116 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6120 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
6122 DataArrayInt *ret1=0;
6123 MEDCouplingMesh *ret0=0;
6125 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6126 if (!SWIG_IsOK(res1))
6129 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6130 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
6134 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6136 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6137 da2->checkAllocated();
6138 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
6140 PyObject *res = PyList_New(2);
6141 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
6142 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6146 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
6150 std::vector<int> pos2;
6151 DataArrayInt *pos3=0;
6152 DataArrayIntTuple *pos4=0;
6153 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
6158 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
6162 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
6166 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
6169 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
6173 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
6174 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
6177 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6178 if (!SWIG_IsOK(res1))
6181 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6182 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
6186 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6188 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6189 da2->checkAllocated();
6190 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
6194 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
6196 std::vector<int> tmp;
6197 self->getCellIdsHavingGaussLocalization(locId,tmp);
6198 DataArrayInt *ret=DataArrayInt::New();
6199 ret->alloc((int)tmp.size(),1);
6200 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
6201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6206 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
6209 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
6210 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
6211 void setTimeUnit(const char *unit);
6212 const char *getTimeUnit() const;
6213 void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6214 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
6215 std::string simpleRepr() const;
6216 std::string advancedRepr() const;
6217 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
6218 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
6219 MEDCouplingFieldDouble *deepCpy() const;
6220 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
6221 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
6222 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
6223 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
6224 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6225 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
6226 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6227 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6228 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
6229 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
6230 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
6231 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
6232 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
6233 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
6234 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
6235 void setIteration(int it) throw(INTERP_KERNEL::Exception);
6236 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
6237 void setOrder(int order) throw(INTERP_KERNEL::Exception);
6238 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
6239 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
6240 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
6241 void updateTime() const throw(INTERP_KERNEL::Exception);
6242 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6243 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
6244 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6245 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6246 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6247 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
6248 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
6249 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
6250 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
6251 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
6252 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
6253 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
6254 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
6255 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
6256 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
6257 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
6258 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
6259 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
6260 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
6261 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6262 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6263 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6264 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6265 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
6266 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
6267 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
6268 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
6269 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
6270 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
6271 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
6272 double getMaxValue() const throw(INTERP_KERNEL::Exception);
6273 double getMinValue() const throw(INTERP_KERNEL::Exception);
6274 double getAverageValue() const throw(INTERP_KERNEL::Exception);
6275 double norm2() const throw(INTERP_KERNEL::Exception);
6276 double normMax() const throw(INTERP_KERNEL::Exception);
6277 double getWeightedAverageValue() const throw(INTERP_KERNEL::Exception);
6278 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
6279 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
6280 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
6281 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
6282 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6283 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6284 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6285 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6286 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6287 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6288 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6289 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6290 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6291 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6292 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6293 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6294 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
6295 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6296 MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6297 MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6298 MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6299 MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
6301 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME)
6303 return MEDCouplingFieldDouble::New(type,td);
6306 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME)
6308 return MEDCouplingFieldDouble::New(ft,td);
6311 std::string __str__() const
6313 return self->simpleRepr();
6316 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
6318 DataArrayDouble *ret=self->getArray();
6324 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
6326 std::vector<DataArrayDouble *> arrs=self->getArrays();
6327 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
6331 PyObject *ret=PyTuple_New(sz);
6332 for(int i=0;i<sz;i++)
6335 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6337 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
6342 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
6344 std::vector<const DataArrayDouble *> tmp;
6345 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
6347 std::vector<DataArrayDouble *> arrs(sz);
6348 for(int i=0;i<sz;i++)
6349 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
6350 self->setArrays(arrs);
6353 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
6355 DataArrayDouble *ret=self->getEndArray();
6361 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
6365 DataArrayDoubleTuple *aa;
6366 std::vector<double> bb;
6368 const MEDCouplingMesh *mesh=self->getMesh();
6370 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6371 int spaceDim=mesh->getSpaceDimension();
6372 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6373 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6375 int sz=self->getNumberOfComponents();
6376 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6377 self->getValueOn(spaceLoc,res);
6378 return convertDblArrToPyList(res,sz);
6381 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
6383 int sz=self->getNumberOfComponents();
6384 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6385 self->getValueOnPos(i,j,k,res);
6386 return convertDblArrToPyList(res,sz);
6389 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
6392 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
6393 if (!SWIG_IsOK(res1))
6396 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
6397 const MEDCouplingMesh *mesh=self->getMesh();
6399 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6400 int spaceDim=mesh->getSpaceDimension();
6401 int nbOfPoints=size/spaceDim;
6402 if(size%spaceDim!=0)
6404 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
6406 return self->getValueOnMulti(tmp,nbOfPoints);
6410 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
6412 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
6413 da2->checkAllocated();
6414 int size=da2->getNumberOfTuples();
6415 int nbOfCompo=da2->getNumberOfComponents();
6416 const MEDCouplingMesh *mesh=self->getMesh();
6418 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
6419 if(nbOfCompo!=mesh->getSpaceDimension())
6421 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
6423 return self->getValueOnMulti(da2->getConstPointer(),size);
6427 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
6431 DataArrayDoubleTuple *aa;
6432 std::vector<double> bb;
6434 const MEDCouplingMesh *mesh=self->getMesh();
6436 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
6437 int spaceDim=mesh->getSpaceDimension();
6438 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
6439 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
6442 int sz=self->getNumberOfComponents();
6443 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
6444 self->getValueOn(spaceLoc,time,res);
6445 return convertDblArrToPyList(res,sz);
6448 void setValues(PyObject *li) throw(INTERP_KERNEL::Exception)
6450 if(self->getArray()!=0)
6453 double *tmp=convertPyToNewDblArr2(li,&sz);
6454 int nbTuples=self->getArray()->getNumberOfTuples();
6455 int nbOfCompo=self->getArray()->getNumberOfComponents();
6456 self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo);
6459 throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind");
6462 PyObject *getTime() throw(INTERP_KERNEL::Exception)
6465 double tmp0=self->getTime(tmp1,tmp2);
6466 PyObject *res = PyList_New(3);
6467 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6468 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6469 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6473 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
6476 double tmp0=self->getStartTime(tmp1,tmp2);
6477 PyObject *res = PyList_New(3);
6478 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6479 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6480 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6484 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
6487 double tmp0=self->getEndTime(tmp1,tmp2);
6488 PyObject *res = PyList_New(3);
6489 PyList_SetItem(res,0,SWIG_From_double(tmp0));
6490 PyList_SetItem(res,1,SWIG_From_int(tmp1));
6491 PyList_SetItem(res,2,SWIG_From_int(tmp2));
6494 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
6496 int sz=self->getNumberOfComponents();
6497 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6498 self->accumulate(tmp);
6499 PyObject *ret=convertDblArrToPyList(tmp,sz);
6502 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
6504 int sz=self->getNumberOfComponents();
6505 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6506 self->integral(isWAbs,tmp);
6507 PyObject *ret=convertDblArrToPyList(tmp,sz);
6510 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
6512 int sz=self->getNumberOfComponents();
6513 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6515 PyObject *ret=convertDblArrToPyList(tmp,sz);
6518 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
6520 int sz=self->getNumberOfComponents();
6521 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
6523 PyObject *ret=convertDblArrToPyList(tmp,sz);
6526 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
6529 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6530 if (!SWIG_IsOK(res1))
6533 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6534 self->renumberCells(tmp,check);
6538 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6540 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6541 da2->checkAllocated();
6542 self->renumberCells(da2->getConstPointer(),check);
6545 void renumberNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
6548 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6549 if (!SWIG_IsOK(res1))
6552 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6553 self->renumberNodes(tmp);
6557 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6559 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6560 da2->checkAllocated();
6561 self->renumberNodes(da2->getConstPointer());
6565 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
6569 std::vector<int> multiVal;
6570 std::pair<int, std::pair<int,int> > slic;
6571 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
6572 const MEDCouplingMesh *mesh=self->getMesh();
6574 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
6575 int nbc=mesh->getNumberOfCells();
6576 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
6583 std::ostringstream oss;
6584 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6585 throw INTERP_KERNEL::Exception(oss.str().c_str());
6588 return self->buildSubPart(&singleVal,&singleVal+1);
6593 int tmp=nbc+singleVal;
6594 return self->buildSubPart(&tmp,&tmp+1);
6598 std::ostringstream oss;
6599 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
6600 throw INTERP_KERNEL::Exception(oss.str().c_str());
6606 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
6610 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rg=DataArrayInt::Range(slic.first,slic.second.first,slic.second.second);
6611 return self->buildSubPart(rg->begin(),rg->end());
6616 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
6617 daIntTyypp->checkAllocated();
6618 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
6621 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
6625 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
6627 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
6630 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
6633 double r1=self->getMaxValue2(tmp);
6634 PyObject *ret=PyTuple_New(2);
6635 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6636 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6640 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
6643 double r1=self->getMinValue2(tmp);
6644 PyObject *ret=PyTuple_New(2);
6645 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
6646 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6650 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
6652 std::vector<int> tmp;
6653 convertPyToNewIntArr3(li,tmp);
6654 return self->keepSelectedComponents(tmp);
6657 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
6659 std::vector<int> tmp;
6660 convertPyToNewIntArr3(li,tmp);
6661 self->setSelectedComponents(f,tmp);
6664 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
6667 DataArrayDouble *a,*a2;
6668 DataArrayDoubleTuple *aa,*aa2;
6669 std::vector<double> bb,bb2;
6672 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
6673 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
6674 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
6675 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
6677 return self->extractSlice3D(orig,vect,eps);
6680 PyObject *___iadd___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6683 Py_XINCREF(trueSelf);
6687 PyObject *___isub___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6690 Py_XINCREF(trueSelf);
6694 PyObject *___imul___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6697 Py_XINCREF(trueSelf);
6701 PyObject *___idiv___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
6704 Py_XINCREF(trueSelf);
6708 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6710 std::vector<const MEDCouplingFieldDouble *> tmp;
6711 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6712 return MEDCouplingFieldDouble::MergeFields(tmp);
6715 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
6717 std::vector<const MEDCouplingFieldDouble *> tmp;
6718 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6719 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
6724 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
6727 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
6728 static MEDCouplingFieldTemplate *New(TypeOfField type);
6729 std::string simpleRepr() const;
6730 std::string advancedRepr() const;
6731 void updateTime() const;
6734 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception)
6736 return MEDCouplingFieldTemplate::New(f);
6739 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
6741 return MEDCouplingFieldTemplate::New(type);
6744 std::string __str__() const
6746 return self->simpleRepr();
6751 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
6754 int getNumberOfFields() const;
6755 MEDCouplingMultiFields *deepCpy() const;
6756 virtual std::string simpleRepr() const;
6757 virtual std::string advancedRepr() const;
6758 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6759 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
6760 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
6761 void updateTime() const throw(INTERP_KERNEL::Exception);
6764 std::string __str__() const
6766 return self->simpleRepr();
6768 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
6770 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6771 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6773 std::vector<MEDCouplingFieldDouble *> fs(sz);
6774 for(int i=0;i<sz;i++)
6775 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6776 return MEDCouplingMultiFields::New(fs);
6778 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
6780 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6781 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6783 std::vector<MEDCouplingFieldDouble *> fs(sz);
6784 for(int i=0;i<sz;i++)
6785 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6786 return MEDCouplingMultiFields::New(fs);
6788 PyObject *getFields() const
6790 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
6791 int sz=fields.size();
6792 PyObject *res = PyList_New(sz);
6793 for(int i=0;i<sz;i++)
6797 fields[i]->incrRef();
6798 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
6802 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
6807 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
6809 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
6813 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
6816 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
6818 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
6820 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
6822 PyObject *res = PyList_New(sz);
6823 for(int i=0;i<sz;i++)
6828 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6832 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6837 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
6839 std::vector<int> refs;
6840 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
6842 PyObject *res = PyList_New(sz);
6843 for(int i=0;i<sz;i++)
6848 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
6852 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
6856 PyObject *ret=PyTuple_New(2);
6857 PyTuple_SetItem(ret,0,res);
6858 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
6861 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
6863 std::vector<DataArrayDouble *> ms=self->getArrays();
6865 PyObject *res = PyList_New(sz);
6866 for(int i=0;i<sz;i++)
6871 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6875 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
6880 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
6882 std::vector< std::vector<int> > refs;
6883 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
6885 PyObject *res = PyList_New(sz);
6886 PyObject *res2 = PyList_New(sz);
6887 for(int i=0;i<sz;i++)
6892 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6896 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
6898 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
6901 PyObject *ret=PyTuple_New(2);
6902 PyTuple_SetItem(ret,0,res);
6903 PyTuple_SetItem(ret,1,res2);
6909 class MEDCouplingDefinitionTime
6912 MEDCouplingDefinitionTime();
6913 void assign(const MEDCouplingDefinitionTime& other);
6914 bool isEqual(const MEDCouplingDefinitionTime& other) const;
6915 double getTimeResolution() const;
6916 std::vector<double> getHotSpotsTime() const;
6919 std::string __str__() const
6921 std::ostringstream oss;
6922 self->appendRepr(oss);
6926 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
6928 int meshId,arrId,arrIdInField,fieldId;
6929 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
6930 PyObject *res=PyList_New(4);
6931 PyList_SetItem(res,0,PyInt_FromLong(meshId));
6932 PyList_SetItem(res,1,PyInt_FromLong(arrId));
6933 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
6934 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
6938 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
6940 int meshId,arrId,arrIdInField,fieldId;
6941 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
6942 PyObject *res=PyList_New(4);
6943 PyList_SetItem(res,0,PyInt_FromLong(meshId));
6944 PyList_SetItem(res,1,PyInt_FromLong(arrId));
6945 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
6946 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
6952 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
6955 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
6956 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
6960 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
6962 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6963 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6965 std::vector<MEDCouplingFieldDouble *> fs(sz);
6966 for(int i=0;i<sz;i++)
6967 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6968 return MEDCouplingFieldOverTime::New(fs);
6970 std::string __str__() const
6972 return self->simpleRepr();
6974 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
6976 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
6977 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
6979 std::vector<MEDCouplingFieldDouble *> fs(sz);
6980 for(int i=0;i<sz;i++)
6981 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
6982 return MEDCouplingFieldOverTime::New(fs);
6990 __filename=os.environ.get('PYTHONSTARTUP')
6991 if __filename and os.path.isfile(__filename):
6992 execfile(__filename)