1 // Copyright (C) 2007-2013 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 "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
50 %template(ivec) std::vector<int>;
51 %template(dvec) std::vector<double>;
52 %template(svec) std::vector<std::string>;
54 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
56 $result=convertMesh($1,$owner);
59 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
61 $result=convertMesh($1,$owner);
64 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
66 $result=convertMesh($1,$owner);
69 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
71 $result=convertFieldDiscretization($1,$owner);
74 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
76 $result=convertMultiFields($1,$owner);
79 %typemap(out) ParaMEDMEM::DataArrayChar*
81 $result=convertDataArrayChar($1,$owner);
85 %init %{ import_array(); %}
88 %feature("autodoc", "1");
89 %feature("docstring");
91 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
92 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::deepCpy;
93 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone;
94 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
95 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getMeasureField;
96 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
97 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getLocalizationOfDiscValues;
98 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getValueOnMulti;
99 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::computeTupleIdsToSelectFromCellIds;
100 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshData;
101 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
102 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
103 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
104 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
105 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
106 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
107 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
108 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
109 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
110 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
111 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
112 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
113 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
114 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
115 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
116 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
117 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
124 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
125 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
126 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
127 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
128 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
129 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
130 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
131 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
132 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
133 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
134 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
135 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator+;
136 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator-;
137 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator*;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator/;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
144 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
145 %newobject ParaMEDMEM::DataArrayInt::New;
146 %newobject ParaMEDMEM::DataArrayInt::__iter__;
147 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
148 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
149 %newobject ParaMEDMEM::DataArrayInt::performCpy;
150 %newobject ParaMEDMEM::DataArrayInt::substr;
151 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
152 %newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
153 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
154 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
155 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
156 %newobject ParaMEDMEM::DataArrayInt::selectByTupleRanges;
157 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
158 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
159 %newobject ParaMEDMEM::DataArrayInt::renumber;
160 %newobject ParaMEDMEM::DataArrayInt::renumberR;
161 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
162 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
163 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
164 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
165 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
166 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
167 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
168 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
169 %newobject ParaMEDMEM::DataArrayInt::negate;
170 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
171 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
172 %newobject ParaMEDMEM::DataArrayInt::Meld;
173 %newobject ParaMEDMEM::DataArrayInt::Add;
174 %newobject ParaMEDMEM::DataArrayInt::Substract;
175 %newobject ParaMEDMEM::DataArrayInt::Multiply;
176 %newobject ParaMEDMEM::DataArrayInt::Divide;
177 %newobject ParaMEDMEM::DataArrayInt::Pow;
178 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
179 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
180 %newobject ParaMEDMEM::DataArrayInt::Range;
181 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
182 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
183 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
184 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
185 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
186 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
187 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
188 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
189 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
190 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
191 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
192 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
193 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
194 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
195 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
196 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
197 %newobject ParaMEDMEM::DataArrayInt::__neg__;
198 %newobject ParaMEDMEM::DataArrayInt::__add__;
199 %newobject ParaMEDMEM::DataArrayInt::__radd__;
200 %newobject ParaMEDMEM::DataArrayInt::__sub__;
201 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
202 %newobject ParaMEDMEM::DataArrayInt::__mul__;
203 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
204 %newobject ParaMEDMEM::DataArrayInt::__div__;
205 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
206 %newobject ParaMEDMEM::DataArrayInt::__mod__;
207 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
208 %newobject ParaMEDMEM::DataArrayInt::__pow__;
209 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
210 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
211 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
212 %newobject ParaMEDMEM::DataArrayChar::renumber;
213 %newobject ParaMEDMEM::DataArrayChar::renumberR;
214 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
215 %newobject ParaMEDMEM::DataArrayChar::selectByTupleIdSafe;
216 %newobject ParaMEDMEM::DataArrayChar::selectByTupleId2;
217 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
218 %newobject ParaMEDMEM::DataArrayChar::keepSelectedComponents;
219 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
220 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
221 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
222 %newobject ParaMEDMEM::DataArrayChar::Meld;
223 %newobject ParaMEDMEM::DataArrayByte::New;
224 %newobject ParaMEDMEM::DataArrayByte::__iter__;
225 %newobject ParaMEDMEM::DataArrayByte::deepCpy;
226 %newobject ParaMEDMEM::DataArrayByte::performCpy;
227 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
228 %newobject ParaMEDMEM::DataArrayChar::substr;
229 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
230 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
231 %newobject ParaMEDMEM::DataArrayAsciiChar::deepCpy;
232 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
233 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
234 %newobject ParaMEDMEM::DataArrayDouble::New;
235 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
236 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
237 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
238 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
239 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
240 %newobject ParaMEDMEM::DataArrayDouble::Meld;
241 %newobject ParaMEDMEM::DataArrayDouble::Dot;
242 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
243 %newobject ParaMEDMEM::DataArrayDouble::Add;
244 %newobject ParaMEDMEM::DataArrayDouble::Substract;
245 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
246 %newobject ParaMEDMEM::DataArrayDouble::Divide;
247 %newobject ParaMEDMEM::DataArrayDouble::Pow;
248 %newobject ParaMEDMEM::DataArrayDouble::substr;
249 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
250 %newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
251 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
252 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
253 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
254 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
255 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
256 %newobject ParaMEDMEM::DataArrayDouble::negate;
257 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
258 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
259 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
260 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
261 %newobject ParaMEDMEM::DataArrayDouble::determinant;
262 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
263 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
264 %newobject ParaMEDMEM::DataArrayDouble::inverse;
265 %newobject ParaMEDMEM::DataArrayDouble::trace;
266 %newobject ParaMEDMEM::DataArrayDouble::deviator;
267 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
268 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
269 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
270 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
271 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
272 %newobject ParaMEDMEM::DataArrayDouble::renumber;
273 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
274 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
275 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
276 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
277 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
278 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
279 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
280 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
281 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
282 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
283 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
284 %newobject ParaMEDMEM::DataArrayDouble::__add__;
285 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
286 %newobject ParaMEDMEM::DataArrayDouble::__sub__;
287 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
288 %newobject ParaMEDMEM::DataArrayDouble::__mul__;
289 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
290 %newobject ParaMEDMEM::DataArrayDouble::__div__;
291 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
292 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
293 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
294 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
295 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
296 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
297 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
298 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
299 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
300 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
301 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
302 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
303 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
304 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
305 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
306 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
307 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
308 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
309 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
310 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
311 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
312 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
313 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
314 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
315 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
316 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
317 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
318 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
319 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
320 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
321 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
322 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
323 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
324 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
325 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
326 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
327 %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
328 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
329 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
330 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
331 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
332 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
333 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
334 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
335 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
336 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
337 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
338 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
339 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
340 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
341 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
342 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
343 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
344 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
345 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
346 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
347 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
348 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
349 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
350 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
351 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
352 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
353 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
354 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
355 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
356 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
357 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
358 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
359 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
360 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
361 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
362 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
363 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
364 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
365 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
366 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
367 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
368 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
369 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
370 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
371 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
372 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
373 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
374 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
375 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
377 %feature("unref") DataArrayDouble "$this->decrRef();"
378 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
379 %feature("unref") MEDCouplingMesh "$this->decrRef();"
380 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
381 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
382 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
383 %feature("unref") DataArrayInt "$this->decrRef();"
384 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
385 %feature("unref") DataArrayByte "$this->decrRef();"
386 %feature("unref") MEDCouplingField "$this->decrRef();"
387 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
388 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
389 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
390 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
391 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
392 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
393 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
394 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
395 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
397 %rename(assign) *::operator=;
398 %ignore ParaMEDMEM::MEDCouplingVersionMajMinRel;
399 %ignore ParaMEDMEM::RefCountObject::decrRef;
400 %ignore ParaMEDMEM::MemArray::operator=;
401 %ignore ParaMEDMEM::MemArray::operator[];
402 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
403 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
404 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
405 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
406 %ignore ParaMEDMEM::DataArrayIntIterator::nextt;
407 %ignore ParaMEDMEM::DataArrayIntTuple::repr;
408 %ignore ParaMEDMEM::DataArrayIntTuple::intValue;
409 %ignore ParaMEDMEM::DataArrayByteIterator::nextt;
410 %ignore ParaMEDMEM::DataArrayByteTuple::repr;
411 %ignore ParaMEDMEM::DataArrayByteTuple::byteValue;
412 %ignore ParaMEDMEM::DataArrayAsciiCharIterator::nextt;
413 %ignore ParaMEDMEM::DataArrayAsciiCharTuple::repr;
414 %ignore ParaMEDMEM::DataArrayAsciiCharTuple::asciiCharValue;
415 %ignore ParaMEDMEM::DataArrayDoubleIterator::nextt;
416 %ignore ParaMEDMEM::DataArrayDoubleTuple::repr;
417 %ignore ParaMEDMEM::DataArrayDoubleTuple::doubleValue;
418 %ignore ParaMEDMEM::DataArrayDouble::writeVTK;
419 %ignore ParaMEDMEM::DataArrayInt::writeVTK;
420 %ignore ParaMEDMEM::DataArrayDouble::SetArrayIn;
421 %ignore ParaMEDMEM::DataArrayInt::SetArrayIn;
425 %rename (InterpKernelException) INTERP_KERNEL::Exception;
427 namespace INTERP_KERNEL
432 Exception(const char* what);
433 ~Exception() throw ();
434 const char *what() const throw ();
437 std::string __str__() const
439 return std::string(self->what());
445 %include "MEDCouplingTimeLabel.hxx"
469 CONST_ON_TIME_INTERVAL = 7
470 } TypeOfTimeDiscretization;
472 const char *MEDCouplingVersionStr();
473 int MEDCouplingVersion();
474 int MEDCouplingSizeOfVoidStar();
475 PyObject *MEDCouplingVersionMajMinRel()
477 int tmp0=0,tmp1=0,tmp2=0;
478 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
479 PyObject *res = PyList_New(3);
480 PyList_SetItem(res,0,SWIG_From_int(tmp0));
481 PyList_SetItem(res,1,SWIG_From_int(tmp1));
482 PyList_SetItem(res,2,SWIG_From_int(tmp2));
490 RefCountObject(const RefCountObject& other);
493 bool decrRef() const;
494 void incrRef() const;
495 virtual std::size_t getHeapMemorySize() const;
504 UNSTRUCTURED_DESC = 6,
508 } MEDCouplingMeshType;
511 class DataArrayDouble;
512 class MEDCouplingUMesh;
513 class MEDCouplingFieldDouble;
515 %extend RefCountObject
517 std::string getHiddenCppPointer() const
519 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
524 class MEDCouplingMesh : public RefCountObject, public TimeLabel
527 void setName(const char *name);
528 const char *getName() const;
529 void setDescription(const char *descr);
530 const char *getDescription() const;
531 void setTime(double val, int iteration, int order);
532 void setTimeUnit(const char *unit);
533 const char *getTimeUnit() const;
534 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
535 bool isStructured() const throw(INTERP_KERNEL::Exception);
536 virtual MEDCouplingMesh *deepCpy() const;
537 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
538 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
539 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
540 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
541 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
542 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
543 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
544 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
545 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
546 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
547 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
548 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
549 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
550 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
551 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
552 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
553 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
554 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
555 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
556 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
557 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
559 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
560 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
561 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
562 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
563 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
564 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
565 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
566 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
567 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
568 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
569 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
570 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
571 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
574 std::string __str__() const throw(INTERP_KERNEL::Exception)
576 return self->simpleRepr();
579 PyObject *getTime() throw(INTERP_KERNEL::Exception)
582 double tmp0=self->getTime(tmp1,tmp2);
583 PyObject *res = PyList_New(3);
584 PyList_SetItem(res,0,SWIG_From_double(tmp0));
585 PyList_SetItem(res,1,SWIG_From_int(tmp1));
586 PyList_SetItem(res,2,SWIG_From_int(tmp2));
590 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
594 DataArrayDoubleTuple *aa;
595 std::vector<double> bb;
597 int spaceDim=self->getSpaceDimension();
598 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
599 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
600 return self->getCellContainingPoint(pos,eps);
603 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
607 DataArrayDoubleTuple *aa;
608 std::vector<double> bb;
610 int spaceDim=self->getSpaceDimension();
611 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
612 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
613 std::vector<int> elts,eltsIndex;
614 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
615 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
616 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
617 d0->alloc(elts.size(),1);
618 d1->alloc(eltsIndex.size(),1);
619 std::copy(elts.begin(),elts.end(),d0->getPointer());
620 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
621 PyObject *ret=PyTuple_New(2);
622 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
623 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
627 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
629 std::vector<int> elts,eltsIndex;
630 int spaceDim=self->getSpaceDimension();
632 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
633 if (!SWIG_IsOK(res1))
636 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
637 int nbOfPoints=size/spaceDim;
640 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
642 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
646 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
648 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
649 da2->checkAllocated();
650 int size=da2->getNumberOfTuples();
651 int nbOfCompo=da2->getNumberOfComponents();
652 if(nbOfCompo!=spaceDim)
654 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
656 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
658 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
659 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
660 d0->alloc(elts.size(),1);
661 d1->alloc(eltsIndex.size(),1);
662 std::copy(elts.begin(),elts.end(),d0->getPointer());
663 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
664 PyObject *ret=PyTuple_New(2);
665 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
666 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
670 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
674 DataArrayDoubleTuple *aa;
675 std::vector<double> bb;
677 int spaceDim=self->getSpaceDimension();
678 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
679 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
680 std::vector<int> elts;
681 self->getCellsContainingPoint(pos,eps,elts);
682 DataArrayInt *ret=DataArrayInt::New();
683 ret->alloc((int)elts.size(),1);
684 std::copy(elts.begin(),elts.end(),ret->getPointer());
685 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
688 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
691 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
692 if (!SWIG_IsOK(res1))
695 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
696 self->renumberCells(tmp,check);
700 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
702 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
703 da2->checkAllocated();
704 self->renumberCells(da2->getConstPointer(),check);
708 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
710 DataArrayInt *cellCor, *nodeCor;
711 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
712 PyObject *res = PyList_New(2);
713 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
714 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
718 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
720 DataArrayInt *cellCor=0,*nodeCor=0;
721 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
722 PyObject *res = PyList_New(2);
723 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
724 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
728 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
730 DataArrayInt *cellCor=0;
731 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
735 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
738 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
739 if (!SWIG_IsOK(res1))
742 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
743 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
747 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
749 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
750 da2->checkAllocated();
751 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
754 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
756 std::vector<int> conn;
757 self->getNodeIdsOfCell(cellId,conn);
758 return convertIntArrToPyList2(conn);
761 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
763 std::vector<double> coo;
764 self->getCoordinatesOfNode(nodeId,coo);
765 return convertDblArrToPyList2(coo);
768 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
772 DataArrayDoubleTuple *aa;
773 std::vector<double> bb;
775 int spaceDim=self->getSpaceDimension();
776 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
777 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
778 self->scale(pointPtr,factor);
781 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
783 int spaceDim=self->getSpaceDimension();
784 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
785 self->getBoundingBox(tmp);
786 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
790 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
793 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
794 PyObject *ret=PyTuple_New(2);
795 PyObject *ret0Py=ret0?Py_True:Py_False;
797 PyTuple_SetItem(ret,0,ret0Py);
798 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
802 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
804 int szArr,sw,iTypppArr;
805 std::vector<int> stdvecTyyppArr;
806 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
807 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
808 if(sw==3)//DataArrayInt
810 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
811 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
812 std::string name=argpt->getName();
814 ret->setName(name.c_str());
816 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
819 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
821 int szArr,sw,iTypppArr;
822 std::vector<int> stdvecTyyppArr;
824 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
825 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
826 if(sw==3)//DataArrayInt
828 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
829 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
830 std::string name=argpt->getName();
832 ret->setName(name.c_str());
835 PyObject *res = PyList_New(2);
836 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
837 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
838 PyList_SetItem(res,0,obj0);
839 PyList_SetItem(res,1,obj1);
843 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
845 std::vector<int> vals=self->getDistributionOfTypes();
846 PyObject *ret=PyList_New((int)vals.size()/3);
847 for(int j=0;j<(int)vals.size()/3;j++)
849 PyObject *ret1=PyList_New(3);
850 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
851 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
852 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
853 PyList_SetItem(ret,j,ret1);
858 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
860 std::vector<int> code;
861 std::vector<const DataArrayInt *> idsPerType;
862 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
863 convertPyToNewIntArr4(li,1,3,code);
864 return self->checkTypeConsistencyAndContig(code,idsPerType);
867 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
869 std::vector<int> code;
870 std::vector<DataArrayInt *> idsInPflPerType;
871 std::vector<DataArrayInt *> idsPerType;
872 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
873 PyObject *ret=PyTuple_New(3);
874 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
875 PyObject *ret1=PyList_New(idsInPflPerType.size());
876 for(std::size_t j=0;j<idsInPflPerType.size();j++)
877 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
878 PyTuple_SetItem(ret,1,ret1);
879 int n=idsPerType.size();
880 PyObject *ret2=PyList_New(n);
882 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
883 PyTuple_SetItem(ret,2,ret2);
887 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
891 DataArrayDoubleTuple *aa;
892 std::vector<double> bb;
894 int spaceDim=self->getSpaceDimension();
895 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
896 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
897 self->translate(vectorPtr);
900 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
902 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
905 DataArrayDoubleTuple *aa;
906 std::vector<double> bb;
908 int spaceDim=self->getSpaceDimension();
909 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
910 self->rotate(centerPtr,0,alpha);
913 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
915 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
918 DataArrayDoubleTuple *aa;
919 std::vector<double> bb;
921 int spaceDim=self->getSpaceDimension();
922 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
923 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,false);
924 self->rotate(centerPtr,vectorPtr,alpha);
927 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
929 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
930 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
931 PyObject *res=PyList_New(result.size());
932 for(int i=0;iL!=result.end(); i++, iL++)
933 PyList_SetItem(res,i,PyInt_FromLong(*iL));
937 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
939 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
940 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
941 return MEDCouplingMesh::MergeMeshes(tmp);
947 %extend ParaMEDMEM::DataArray
949 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
951 const std::vector<std::string>& comps=self->getInfoOnComponents();
952 PyObject *ret=PyList_New((int)comps.size());
953 for(int i=0;i<(int)comps.size();i++)
954 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
958 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
960 std::vector<int> tmp;
961 convertPyToNewIntArr3(li,tmp);
962 self->copyPartOfStringInfoFrom(other,tmp);
965 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
967 std::vector<int> tmp;
968 convertPyToNewIntArr3(li,tmp);
969 self->copyPartOfStringInfoFrom2(tmp,other);
973 %extend ParaMEDMEM::DataArrayInt
976 std::string __repr__() const throw(INTERP_KERNEL::Exception)
978 std::ostringstream oss;
979 self->reprQuickOverview(oss);
983 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
985 int szArr,sw,iTypppArr;
986 std::vector<int> stdvecTyyppArr;
987 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
988 self->pushBackValsSilent(tmp,tmp+szArr);
991 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
993 std::vector<int> ret1;
994 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
995 std::size_t sz=ret0.size();
996 PyObject *pyRet=PyTuple_New(2);
997 PyObject *pyRet0=PyList_New((int)sz);
998 PyObject *pyRet1=PyList_New((int)sz);
999 for(std::size_t i=0;i<sz;i++)
1001 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1002 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
1004 PyTuple_SetItem(pyRet,0,pyRet0);
1005 PyTuple_SetItem(pyRet,1,pyRet1);
1009 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
1011 DataArrayInt *ret0=0,*ret1=0;
1012 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
1013 PyObject *pyRet=PyTuple_New(2);
1014 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1015 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1020 %extend ParaMEDMEM::DataArrayChar
1022 int __len__() const throw(INTERP_KERNEL::Exception)
1024 if(self->isAllocated())
1026 return self->getNumberOfTuples();
1030 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
1034 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
1037 bool ret0=self->isEqualIfNotWhy(other,ret1);
1038 PyObject *ret=PyTuple_New(2);
1039 PyObject *ret0Py=ret0?Py_True:Py_False;
1041 PyTuple_SetItem(ret,0,ret0Py);
1042 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1046 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
1049 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1050 if (!SWIG_IsOK(res1))
1053 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1054 if(size!=self->getNumberOfTuples())
1056 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1058 self->renumberInPlace(tmp);
1062 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1064 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1065 da2->checkAllocated();
1066 int size=self->getNumberOfTuples();
1067 if(size!=self->getNumberOfTuples())
1069 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1071 self->renumberInPlace(da2->getConstPointer());
1075 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
1078 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1079 if (!SWIG_IsOK(res1))
1082 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1083 if(size!=self->getNumberOfTuples())
1085 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1087 self->renumberInPlaceR(tmp);
1091 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1093 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1094 da2->checkAllocated();
1095 int size=self->getNumberOfTuples();
1096 if(size!=self->getNumberOfTuples())
1098 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1100 self->renumberInPlaceR(da2->getConstPointer());
1104 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1107 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1108 if (!SWIG_IsOK(res1))
1111 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1112 if(size!=self->getNumberOfTuples())
1114 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1116 return self->renumber(tmp);
1120 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1122 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1123 da2->checkAllocated();
1124 int size=self->getNumberOfTuples();
1125 if(size!=self->getNumberOfTuples())
1127 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1129 return self->renumber(da2->getConstPointer());
1133 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1136 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1137 if (!SWIG_IsOK(res1))
1140 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1141 if(size!=self->getNumberOfTuples())
1143 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1145 return self->renumberR(tmp);
1149 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1151 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1152 da2->checkAllocated();
1153 int size=self->getNumberOfTuples();
1154 if(size!=self->getNumberOfTuples())
1156 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1158 return self->renumberR(da2->getConstPointer());
1162 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1165 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1166 if (!SWIG_IsOK(res1))
1169 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1170 if(size!=self->getNumberOfTuples())
1172 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1174 return self->renumberAndReduce(tmp,newNbOfTuple);
1178 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1180 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1181 da2->checkAllocated();
1182 int size=self->getNumberOfTuples();
1183 if(size!=self->getNumberOfTuples())
1185 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1187 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1191 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
1194 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1195 if (!SWIG_IsOK(res1))
1198 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1199 return self->selectByTupleIdSafe(tmp,tmp+size);
1203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1205 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1206 da2->checkAllocated();
1207 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
1211 DataArrayChar *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
1213 std::vector<int> tmp;
1214 convertPyToNewIntArr3(li,tmp);
1215 return self->keepSelectedComponents(tmp);
1218 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
1220 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
1221 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
1222 return DataArrayChar::Aggregate(tmp);
1225 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
1227 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
1228 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
1229 return DataArrayChar::Meld(tmp);
1233 %extend ParaMEDMEM::DataArrayByteTuple
1235 std::string __str__() const
1237 return self->repr();
1240 char __int__() const throw(INTERP_KERNEL::Exception)
1242 return self->byteValue();
1245 DataArrayByte *buildDAByte()
1247 return self->buildDAByte(1,self->getNumberOfCompo());
1251 %extend ParaMEDMEM::DataArrayByteIterator
1255 DataArrayByteTuple *ret=self->nextt();
1257 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayByteTuple,SWIG_POINTER_OWN | 0);
1260 PyErr_SetString(PyExc_StopIteration,"No more data.");
1266 %extend ParaMEDMEM::DataArrayByte
1268 DataArrayByte() throw(INTERP_KERNEL::Exception)
1270 return DataArrayByte::New();
1273 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1275 const char *msg="ParaMEDMEM::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !";
1276 if(PyList_Check(elt0) || PyTuple_Check(elt0))
1280 if(PyInt_Check(nbOfTuples))
1282 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1284 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
1287 if(PyInt_Check(nbOfComp))
1288 {//DataArrayByte.New([1,3,4,5],2,2)
1289 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1291 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
1292 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
1293 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
1294 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1298 throw INTERP_KERNEL::Exception(msg);
1301 {//DataArrayByte.New([1,3,4],3)
1302 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
1304 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
1305 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1310 throw INTERP_KERNEL::Exception(msg);
1313 {// DataArrayByte.New([1,3,4])
1314 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
1315 int tmpp1=-1,tmpp2=-1;
1316 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
1317 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1321 else if(PyInt_Check(elt0))
1323 int nbOfTuples1=PyInt_AS_LONG(elt0);
1325 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
1330 if(PyInt_Check(nbOfTuples))
1331 {//DataArrayByte.New(5,2)
1332 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
1334 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
1335 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
1336 ret->alloc(nbOfTuples1,nbOfCompo);
1340 throw INTERP_KERNEL::Exception(msg);
1343 throw INTERP_KERNEL::Exception(msg);
1346 {//DataArrayByte.New(5)
1347 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
1348 ret->alloc(nbOfTuples1,1);
1353 throw INTERP_KERNEL::Exception(msg);
1356 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1358 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
1361 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1363 std::ostringstream oss;
1364 self->reprQuickOverview(oss);
1368 int __int__() const throw(INTERP_KERNEL::Exception)
1370 return (int) self->byteValue();
1373 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
1375 return self->iterator();
1378 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
1380 return (int)self->getIJ(tupleId,compoId);
1383 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
1385 return (int)self->getIJSafe(tupleId,compoId);
1388 std::string __str__() const throw(INTERP_KERNEL::Exception)
1390 return self->repr();
1393 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
1395 const char *vals=self->getConstPointer();
1396 int nbOfComp=self->getNumberOfComponents();
1397 int nbOfTuples=self->getNumberOfTuples();
1398 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
1401 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
1404 int ival=-1; std::vector<int> ivval;
1405 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
1406 std::vector<char> vals(sz);
1407 std::copy(pt,pt+sz,vals.begin());
1408 return self->presenceOfTuple(vals);
1411 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
1414 int ival=-1; std::vector<int> ivval;
1415 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
1416 std::vector<char> vals2(sz);
1417 std::copy(pt,pt+sz,vals2.begin());
1418 return self->presenceOfValue(vals2);
1421 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
1424 int ival=-1; std::vector<int> ivval;
1425 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
1426 std::vector<char> vals2(sz);
1427 std::copy(pt,pt+sz,vals2.begin());
1428 return self->locateValue(vals2);
1431 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
1434 int ival=-1; std::vector<int> ivval;
1435 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
1436 std::vector<char> vals(sz);
1437 std::copy(pt,pt+sz,vals.begin());
1438 return self->locateTuple(vals);
1441 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
1444 int ival=-1; std::vector<int> ivval;
1445 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
1446 std::vector<char> vals(sz);
1447 std::copy(pt,pt+sz,vals.begin());
1448 return self->search(vals);
1451 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1453 int sz=self->getNumberOfComponents();
1454 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
1455 self->getTuple(tupleId,tmp);
1456 PyObject *ret=PyTuple_New(sz);
1457 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
1461 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1464 int r1=(int)self->getMaxValue(tmp);
1465 PyObject *ret=PyTuple_New(2);
1466 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
1467 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1471 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1474 int r1=(int)self->getMinValue(tmp);
1475 PyObject *ret=PyTuple_New(2);
1476 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
1477 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1481 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
1483 int nbOfCompo=self->getNumberOfComponents();
1488 if(PyInt_Check(obj))
1490 int val=(int)PyInt_AS_LONG(obj);
1491 return self->locateValue(val);
1494 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
1497 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
1501 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
1503 int nbOfCompo=self->getNumberOfComponents();
1510 if(PyInt_Check(obj))
1512 int val=(int)PyInt_AS_LONG(obj);
1513 return self->presenceOfValue(val);
1516 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
1519 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
1524 %extend ParaMEDMEM::DataArrayAsciiCharTuple
1526 std::string __str__() const
1528 return self->repr();
1531 DataArrayAsciiChar *buildDAAsciiChar()
1533 return self->buildDAAsciiChar(1,self->getNumberOfCompo());
1537 %extend ParaMEDMEM::DataArrayAsciiCharIterator
1541 DataArrayAsciiCharTuple *ret=self->nextt();
1543 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
1546 PyErr_SetString(PyExc_StopIteration,"No more data.");
1552 %extend ParaMEDMEM::DataArrayAsciiChar
1554 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
1556 return DataArrayAsciiChar::New();
1559 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1561 const char *msg="ParaMEDMEM::DataArrayAsciiChar::New : Available API are : \n-DataArrayAsciiChar.New()\n-DataArrayAsciiChar.New([1,3,4])\n-DataArrayAsciiChar.New([\"abc\",\"de\",\"fghi\"])\n-DataArrayAsciiChar.New([\"abc\",\"de\",\"fghi\"],\"t\")\n-DataArrayAsciiChar.New([1,3,4],3)\n-DataArrayAsciiChar.New([1,3,4,5],2,2)\n-DataArrayAsciiChar.New(5)\n-DataArrayAsciiChar.New(5,2) !";
1562 if(PyList_Check(elt0) || PyTuple_Check(elt0))
1566 if(PyInt_Check(nbOfTuples))
1568 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1570 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
1573 if(PyInt_Check(nbOfComp))
1574 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
1575 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1577 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
1578 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
1579 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
1580 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1584 throw INTERP_KERNEL::Exception(msg);
1587 {//DataArrayAsciiChar.New([1,3,4],3)
1588 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
1590 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
1591 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1595 else if(PyString_Check(nbOfTuples))
1597 if(PyString_Size(nbOfTuples)!=1)
1598 throw INTERP_KERNEL::Exception(msg);
1599 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
1600 std::vector<std::string> tmp;
1601 if(fillStringVector(elt0,tmp))
1602 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
1604 throw INTERP_KERNEL::Exception(msg);
1607 throw INTERP_KERNEL::Exception(msg);
1611 std::vector<std::string> tmmp;
1612 if(fillStringVector(elt0,tmmp))
1613 //DataArrayAsciiChar.New(["abc","de","fghi"])
1614 return DataArrayAsciiChar::New(tmmp,' ');
1617 // DataArrayAsciiChar.New([1,3,4])
1618 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
1619 int tmpp1=-1,tmpp2=-1;
1620 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
1621 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
1626 else if(PyInt_Check(elt0))
1628 int nbOfTuples1=PyInt_AS_LONG(elt0);
1630 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
1635 if(PyInt_Check(nbOfTuples))
1636 {//DataArrayAsciiChar.New(5,2)
1637 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
1639 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
1640 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
1641 ret->alloc(nbOfTuples1,nbOfCompo);
1645 throw INTERP_KERNEL::Exception(msg);
1648 throw INTERP_KERNEL::Exception(msg);
1651 {//DataArrayAsciiChar.New(5)
1652 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
1653 ret->alloc(nbOfTuples1,1);
1658 throw INTERP_KERNEL::Exception(msg);
1661 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1663 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_3(elt0,nbOfTuples,nbOfComp);
1666 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1668 std::ostringstream oss;
1669 self->reprQuickOverview(oss);
1673 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
1675 return self->iterator();
1678 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
1680 char tmp[2]; tmp[1]='\0';
1681 tmp[0]=self->getIJ(tupleId,compoId);
1682 return std::string(tmp);
1685 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
1687 char tmp[2]; tmp[1]='\0';
1688 tmp[0]=self->getIJSafe(tupleId,compoId);
1689 return std::string(tmp);
1692 std::string __str__() const throw(INTERP_KERNEL::Exception)
1694 return self->repr();
1697 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
1699 const char *vals=self->getConstPointer();
1700 int nbOfComp=self->getNumberOfComponents();
1701 int nbOfTuples=self->getNumberOfTuples();
1702 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
1705 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
1707 if(PyString_Check(tupl))
1709 Py_ssize_t sz=PyString_Size(tupl);
1710 std::vector<char> vals(sz);
1711 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
1712 return self->presenceOfTuple(vals);
1715 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
1718 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
1720 if(PyString_Check(vals))
1722 Py_ssize_t sz=PyString_Size(vals);
1723 std::vector<char> vals2(sz);
1724 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
1725 return self->presenceOfValue(vals2);
1728 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
1731 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
1733 if(PyString_Check(vals))
1735 Py_ssize_t sz=PyString_Size(vals);
1736 std::vector<char> vals2(sz);
1737 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
1738 return self->locateValue(vals2);
1741 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
1744 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
1746 if(PyString_Check(tupl))
1748 Py_ssize_t sz=PyString_Size(tupl);
1749 std::vector<char> vals(sz);
1750 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
1751 return self->locateTuple(vals);
1754 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
1757 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
1759 if(PyString_Check(strOrListOfInt))
1761 Py_ssize_t sz=PyString_Size(strOrListOfInt);
1762 std::vector<char> vals(sz);
1763 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
1764 return self->search(vals);
1767 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
1770 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
1772 int sz=self->getNumberOfComponents();
1773 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
1774 self->getTuple(tupleId,tmp);
1775 return PyString_FromString(tmp);
1778 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1781 char tmp2[2]; tmp2[1]='\0';
1782 tmp2[0]=self->getMaxValue(tmp);
1783 PyObject *ret=PyTuple_New(2);
1784 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
1785 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1789 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1792 char tmp2[2]; tmp2[1]='\0';
1793 tmp2[0]=self->getMinValue(tmp);
1794 PyObject *ret=PyTuple_New(2);
1795 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
1796 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1800 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
1802 int nbOfCompo=self->getNumberOfComponents();
1807 if(PyString_Check(obj))
1809 Py_ssize_t sz=PyString_Size(obj);
1810 char *pt=PyString_AsString(obj);
1812 return self->locateValue(pt[0]);
1814 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
1817 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
1820 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
1824 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
1826 int nbOfCompo=self->getNumberOfComponents();
1833 if(PyString_Check(obj))
1835 Py_ssize_t sz=PyString_Size(obj);
1836 char *pt=PyString_AsString(obj);
1838 return self->presenceOfValue(pt[0]);
1840 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
1843 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
1846 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
1850 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
1853 std::vector<int> stdvecTyyppArr;
1854 std::pair<int, std::pair<int,int> > sTyyppArr;
1855 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1856 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
1860 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
1862 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
1864 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
1866 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
1868 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
1872 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1874 static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance.";
1876 std::vector<int> stdvecTyyppArr;
1877 std::pair<int, std::pair<int,int> > sTyyppArr;
1878 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1879 int nbOfCompo=self->getNumberOfComponents();
1880 int nbOfTuples=self->getNumberOfTuples();
1881 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
1883 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
1884 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
1893 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
1899 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
1900 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
1903 //value vector<string>
1906 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
1907 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
1910 //value DataArrayChar
1913 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
1917 throw INTERP_KERNEL::Exception(msg);
1921 {//obj list-tuple[int]
1927 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
1933 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
1934 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
1937 //value vector<string>
1940 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
1941 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
1944 //value DataArrayChar
1947 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
1951 throw INTERP_KERNEL::Exception(msg);
1962 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
1968 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
1969 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
1972 //value vector<string>
1975 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
1976 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
1979 //value DataArrayChar
1982 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
1986 throw INTERP_KERNEL::Exception(msg);
1997 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
2003 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
2004 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
2007 //value vector<string>
2010 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
2011 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
2014 //value DataArrayChar
2017 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
2021 throw INTERP_KERNEL::Exception(msg);
2026 throw INTERP_KERNEL::Exception(msg);
2031 %ignore ParaMEDMEM::DataArray::getInfoOnComponents;
2032 %ignore ParaMEDMEM::DataArrayInt::partitionByDifferentValues;
2033 %ignore ParaMEDMEM::DataArrayChar::getIJ;
2034 %ignore ParaMEDMEM::DataArrayChar::getIJSafe;
2035 %ignore ParaMEDMEM::DataArrayChar::search;
2036 %ignore ParaMEDMEM::DataArrayChar::locateValue;
2037 %ignore ParaMEDMEM::DataArrayChar::presenceOfValue;
2039 %include "MEDCouplingMemArray.hxx"
2040 %include "NormalizedUnstructuredMesh.hxx"
2041 %include "MEDCouplingNatureOfField.hxx"
2042 %include "MEDCouplingTimeDiscretization.hxx"
2043 %include "MEDCouplingGaussLocalization.hxx"
2044 %include "MEDCouplingFieldDiscretization.hxx"
2046 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
2047 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
2049 namespace ParaMEDMEM
2051 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
2054 void updateTime() const;
2055 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2056 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
2057 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
2058 void zipCoords() throw(INTERP_KERNEL::Exception);
2059 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
2060 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
2061 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
2062 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
2063 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
2064 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
2065 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
2066 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
2067 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
2068 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
2069 //! size of returned tinyInfo must be always the same.
2070 void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
2071 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const throw(INTERP_KERNEL::Exception);
2072 void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception);
2073 void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
2074 const std::vector<std::string>& littleStrings) throw(INTERP_KERNEL::Exception);
2075 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
2076 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
2077 virtual DataArrayInt *findBoundaryNodes() const;
2080 std::string __str__() const throw(INTERP_KERNEL::Exception)
2082 return self->simpleRepr();
2085 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
2088 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
2089 PyObject *res = PyList_New(2);
2090 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2091 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
2095 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
2097 DataArrayInt *comm, *commIndex;
2098 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
2099 PyObject *res = PyList_New(2);
2100 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2101 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2105 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
2107 DataArrayDouble *ret1=self->getCoords();
2110 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
2113 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
2115 int szArr,sw,iTypppArr;
2116 std::vector<int> stdvecTyyppArr;
2117 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2118 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
2119 if(sw==3)//DataArrayInt
2121 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
2122 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
2123 std::string name=argpt->getName();
2125 ret->setName(name.c_str());
2127 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2130 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2132 int szArr,sw,iTypppArr;
2133 std::vector<int> stdvecTyyppArr;
2134 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2135 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
2136 if(sw==3)//DataArrayInt
2138 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
2139 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
2140 std::string name=argpt->getName();
2142 ret->setName(name.c_str());
2144 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2147 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2149 int szArr,sw,iTypppArr;
2150 std::vector<int> stdvecTyyppArr;
2151 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2152 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
2153 if(sw==3)//DataArrayInt
2155 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
2156 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
2157 std::string name=argpt->getName();
2159 ret->setName(name.c_str());
2161 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2164 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
2166 int szArr,sw,iTypppArr;
2167 std::vector<int> stdvecTyyppArr;
2168 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2169 self->renumberNodes(tmp,newNbOfNodes);
2172 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
2174 int szArr,sw,iTypppArr;
2175 std::vector<int> stdvecTyyppArr;
2176 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2177 self->renumberNodes2(tmp,newNbOfNodes);
2180 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2182 int spaceDim=self->getSpaceDimension();
2184 DataArrayDouble *a,*a2;
2185 DataArrayDoubleTuple *aa,*aa2;
2186 std::vector<double> bb,bb2;
2188 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
2189 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
2190 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
2191 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2192 std::vector<int> nodes;
2193 self->findNodesOnLine(p,v,eps,nodes);
2194 DataArrayInt *ret=DataArrayInt::New();
2195 ret->alloc((int)nodes.size(),1);
2196 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
2197 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2199 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2201 int spaceDim=self->getSpaceDimension();
2203 DataArrayDouble *a,*a2;
2204 DataArrayDoubleTuple *aa,*aa2;
2205 std::vector<double> bb,bb2;
2207 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
2208 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
2209 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
2210 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2211 std::vector<int> nodes;
2212 self->findNodesOnPlane(p,v,eps,nodes);
2213 DataArrayInt *ret=DataArrayInt::New();
2214 ret->alloc((int)nodes.size(),1);
2215 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
2216 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2219 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
2223 DataArrayDoubleTuple *aa;
2224 std::vector<double> bb;
2226 int spaceDim=self->getSpaceDimension();
2227 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
2228 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
2229 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
2230 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2233 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
2235 DataArrayInt *c=0,*cI=0;
2239 DataArrayDoubleTuple *aa;
2240 std::vector<double> bb;
2242 int spaceDim=self->getSpaceDimension();
2243 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
2244 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
2245 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
2246 PyObject *ret=PyTuple_New(2);
2247 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2248 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2252 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
2254 DataArrayInt *c=0,*cI=0;
2255 int spaceDim=self->getSpaceDimension();
2258 DataArrayDoubleTuple *aa;
2259 std::vector<double> bb;
2262 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
2263 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
2265 PyObject *ret=PyTuple_New(2);
2266 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2267 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
2275 DataArrayDoubleTuple *aa;
2276 std::vector<double> bb;
2278 int spaceDim=self->getSpaceDimension();
2279 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
2280 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
2282 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
2283 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2286 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2290 std::vector<int> multiVal;
2291 std::pair<int, std::pair<int,int> > slic;
2292 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2293 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2297 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
2299 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
2301 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
2303 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2307 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
2310 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
2311 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
2312 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
2313 for(int i=0;i<sz;i++)
2314 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
2317 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
2320 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
2322 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
2323 std::vector<double> val3;
2324 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
2325 "Rotate2DAlg",2,true,nbNodes);
2327 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
2328 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
2331 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
2334 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
2335 INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
2336 INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
2337 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
2338 for(int i=0;i<sz;i++)
2339 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
2342 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
2345 INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
2347 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
2348 std::vector<double> val3;
2349 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
2350 "Rotate3DAlg",3,true,nbNodes);
2352 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
2353 INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
2354 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
2359 class MEDCouplingUMeshCell
2362 INTERP_KERNEL::NormalizedCellType getType() const;
2365 std::string __str__() const throw(INTERP_KERNEL::Exception)
2367 return self->repr();
2370 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
2373 const int *r=self->getAllConn(ret2);
2374 PyObject *ret=PyTuple_New(ret2);
2375 for(int i=0;i<ret2;i++)
2376 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
2382 class MEDCouplingUMeshCellIterator
2389 MEDCouplingUMeshCell *ret=self->nextt();
2391 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
2394 PyErr_SetString(PyExc_StopIteration,"No more data.");
2401 class MEDCouplingUMeshCellByTypeIterator
2404 ~MEDCouplingUMeshCellByTypeIterator();
2409 MEDCouplingUMeshCellEntry *ret=self->nextt();
2411 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
2414 PyErr_SetString(PyExc_StopIteration,"No more data.");
2421 class MEDCouplingUMeshCellByTypeEntry
2424 ~MEDCouplingUMeshCellByTypeEntry();
2427 MEDCouplingUMeshCellByTypeIterator *__iter__()
2429 return self->iterator();
2434 class MEDCouplingUMeshCellEntry
2437 INTERP_KERNEL::NormalizedCellType getType() const;
2438 int getNumberOfElems() const;
2441 MEDCouplingUMeshCellIterator *__iter__()
2443 return self->iterator();
2448 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
2451 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
2452 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
2453 MEDCouplingUMesh *clone(bool recDeepCpy) const;
2454 void updateTime() const;
2455 void checkCoherency() const throw(INTERP_KERNEL::Exception);
2456 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2457 void allocateCells(int nbOfCells) throw(INTERP_KERNEL::Exception);
2458 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
2459 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
2460 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
2461 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
2462 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
2463 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
2464 int getMeshLength() const throw(INTERP_KERNEL::Exception);
2465 void computeTypes() throw(INTERP_KERNEL::Exception);
2466 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
2467 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2469 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
2470 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
2471 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
2472 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
2473 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
2474 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
2475 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
2476 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
2477 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
2478 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
2479 DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
2480 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
2481 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
2482 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
2483 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
2484 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
2485 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
2486 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
2487 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
2488 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
2489 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
2490 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
2491 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
2492 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
2493 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
2494 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
2495 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
2496 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
2497 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
2498 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
2499 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
2500 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
2501 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
2502 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2503 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2504 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
2505 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
2507 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
2509 return MEDCouplingUMesh::New();
2512 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
2514 return MEDCouplingUMesh::New(meshName,meshDim);
2517 std::string __str__() const throw(INTERP_KERNEL::Exception)
2519 return self->simpleRepr();
2522 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2524 std::ostringstream oss;
2525 self->reprQuickOverview(oss);
2529 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
2531 return self->cellIterator();
2534 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
2538 std::vector<int> multiVal;
2539 std::pair<int, std::pair<int,int> > slic;
2540 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2541 int nbc=self->getNumberOfCells();
2542 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2549 std::ostringstream oss;
2550 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2551 throw INTERP_KERNEL::Exception(oss.str().c_str());
2554 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
2559 int tmp=nbc+singleVal;
2560 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
2564 std::ostringstream oss;
2565 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2566 throw INTERP_KERNEL::Exception(oss.str().c_str());
2572 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
2576 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
2581 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
2582 daIntTyypp->checkAllocated();
2583 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
2586 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
2590 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
2594 std::vector<int> multiVal;
2595 std::pair<int, std::pair<int,int> > slic;
2596 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2597 int nbc=self->getNumberOfCells();
2598 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2605 std::ostringstream oss;
2606 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2607 throw INTERP_KERNEL::Exception(oss.str().c_str());
2611 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2618 int tmp=nbc+singleVal;
2619 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2624 std::ostringstream oss;
2625 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2626 throw INTERP_KERNEL::Exception(oss.str().c_str());
2632 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2638 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2639 daIntTyypp->checkAllocated();
2640 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2644 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
2648 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
2652 std::vector<int> multiVal;
2653 std::pair<int, std::pair<int,int> > slic;
2654 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2655 int nbc=self->getNumberOfCells();
2656 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2663 std::ostringstream oss;
2664 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2665 throw INTERP_KERNEL::Exception(oss.str().c_str());
2669 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2676 int tmp=nbc+singleVal;
2677 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2682 std::ostringstream oss;
2683 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2684 throw INTERP_KERNEL::Exception(oss.str().c_str());
2690 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2695 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2701 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2702 daIntTyypp->checkAllocated();
2703 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2707 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
2711 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
2713 int szArr,sw,iTypppArr;
2714 std::vector<int> stdvecTyyppArr;
2715 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2718 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2719 throw INTERP_KERNEL::Exception(oss.str().c_str());
2721 self->insertNextCell(type,size,tmp);
2724 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
2726 int szArr,sw,iTypppArr;
2727 std::vector<int> stdvecTyyppArr;
2728 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2729 self->insertNextCell(type,szArr,tmp);
2732 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
2734 DataArrayInt *ret=self->getNodalConnectivity();
2739 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
2741 DataArrayInt *ret=self->getNodalConnectivityIndex();
2746 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
2748 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
2749 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2750 PyObject *res = PyList_New(result.size());
2751 for (int i=0;iL!=result.end(); i++, iL++)
2752 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2756 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
2758 int szArr,sw,iTypppArr;
2759 std::vector<int> stdvecTyyppArr;
2760 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2761 int nbOfDepthPeelingPerformed=0;
2762 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2763 PyObject *res=PyTuple_New(2);
2764 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2765 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2769 PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
2771 DataArrayInt *v0=0,*v1=0;
2772 self->findCommonCells(compType,startCellId,v0,v1);
2773 PyObject *res = PyList_New(2);
2774 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2775 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2779 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
2781 DataArrayInt *v0=0,*v1=0;
2782 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2783 PyObject *res = PyList_New(2);
2784 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2785 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2789 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
2793 DataArrayDoubleTuple *aa;
2794 std::vector<double> bb;
2796 int nbOfCompo=self->getSpaceDimension();
2797 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2799 int cellId=-1,nodeId=-1;
2800 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId,nodeId);
2801 PyObject *ret=PyTuple_New(3);
2802 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2803 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2804 PyTuple_SetItem(ret,2,PyInt_FromLong(nodeId));
2808 PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
2812 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
2813 PyObject *res = PyList_New(3);
2814 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2815 PyList_SetItem(res,1,SWIG_From_bool(ret1));
2816 PyList_SetItem(res,2,SWIG_From_int(ret2));
2819 PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
2823 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
2824 PyObject *res = PyList_New(3);
2825 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2826 PyList_SetItem(res,1,SWIG_From_bool(ret1));
2827 PyList_SetItem(res,2,SWIG_From_int(ret2));
2830 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
2832 std::vector<int> cells;
2833 self->checkButterflyCells(cells,eps);
2834 DataArrayInt *ret=DataArrayInt::New();
2835 ret->alloc((int)cells.size(),1);
2836 std::copy(cells.begin(),cells.end(),ret->getPointer());
2837 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2840 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
2842 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2844 PyObject *ret = PyList_New(sz);
2845 for(int i=0;i<sz;i++)
2846 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2850 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
2852 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
2853 int sz=retCpp.size();
2854 PyObject *ret=PyList_New(sz);
2855 for(int i=0;i<sz;i++)
2856 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2860 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
2863 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
2864 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2865 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2868 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
2871 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2872 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2876 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
2879 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2880 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2884 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2886 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
2887 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2888 PyObject *ret=PyTuple_New(3);
2889 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2890 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2891 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2895 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2897 DataArrayInt *tmp0=0,*tmp1=0;
2898 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2899 PyObject *ret=PyTuple_New(2);
2900 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2901 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2905 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2909 std::vector<int> multiVal;
2910 std::pair<int, std::pair<int,int> > slic;
2911 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2912 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2916 return self->duplicateNodes(&singleVal,&singleVal+1);
2918 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2920 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2922 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2926 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2930 std::vector<int> multiVal;
2931 std::pair<int, std::pair<int,int> > slic;
2932 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2933 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2937 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2939 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2941 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2943 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2947 void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
2950 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2951 if (!SWIG_IsOK(res1))
2954 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2955 self->renumberNodesInConn(tmp);
2959 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2961 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2962 da2->checkAllocated();
2963 self->renumberNodesInConn(da2->getConstPointer());
2967 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2970 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2971 DataArrayInt *tmp0,*tmp1=0;
2972 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2973 PyObject *ret=PyTuple_New(2);
2974 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2975 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2979 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2981 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2982 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2983 DataArrayInt *ret1=0,*ret2=0;
2984 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2985 PyObject *ret=PyTuple_New(3);
2986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2987 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2988 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2992 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2994 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2995 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2996 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2997 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3000 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
3003 std::vector<const MEDCouplingUMesh *> meshes;
3004 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
3005 std::vector<DataArrayInt *> corr;
3006 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
3008 PyObject *ret1=PyList_New(sz);
3009 for(int i=0;i<sz;i++)
3010 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3011 PyObject *ret=PyList_New(2);
3012 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3013 PyList_SetItem(ret,1,ret1);
3017 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
3019 std::vector<MEDCouplingUMesh *> meshes;
3020 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
3021 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
3024 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
3026 std::vector<MEDCouplingUMesh *> meshes;
3027 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
3028 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
3031 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
3035 std::vector<int> multiVal;
3036 std::pair<int, std::pair<int,int> > slic;
3037 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3039 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
3040 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
3044 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
3046 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
3048 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
3050 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3054 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
3056 DataArrayInt *arrOut=0,*arrIndexOut=0;
3059 std::vector<int> multiVal;
3060 std::pair<int, std::pair<int,int> > slic;
3061 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3063 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
3064 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
3069 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
3074 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
3079 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
3083 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3085 PyObject *ret=PyTuple_New(2);
3086 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3087 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3091 static PyObject *SetPartOfIndexedArrays(PyObject *li,
3092 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
3093 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
3095 DataArrayInt *arrOut=0,*arrIndexOut=0;
3098 std::vector<int> multiVal;
3099 std::pair<int, std::pair<int,int> > slic;
3100 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3102 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
3103 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
3108 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
3113 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
3118 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
3122 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3124 PyObject *ret=PyTuple_New(2);
3125 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3126 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3130 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
3131 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
3135 std::vector<int> multiVal;
3136 std::pair<int, std::pair<int,int> > slic;
3137 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3139 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
3140 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
3145 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
3150 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
3155 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
3159 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3163 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
3167 DataArrayDoubleTuple *aa;
3168 std::vector<double> bb;
3170 int spaceDim=self->getSpaceDimension();
3171 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
3172 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
3174 std::vector<int> cells;
3175 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
3176 DataArrayInt *ret=DataArrayInt::New();
3177 ret->alloc((int)cells.size(),1);
3178 std::copy(cells.begin(),cells.end(),ret->getPointer());
3179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3182 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
3186 DataArrayDoubleTuple *aa;
3187 std::vector<double> bb;
3189 int spaceDim=self->getSpaceDimension();
3190 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
3191 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
3192 self->orientCorrectly2DCells(v,polyOnly);
3195 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
3197 std::vector<int> cells;
3198 self->arePolyhedronsNotCorrectlyOriented(cells);
3199 DataArrayInt *ret=DataArrayInt::New();
3200 ret->alloc((int)cells.size(),1);
3201 std::copy(cells.begin(),cells.end(),ret->getPointer());
3202 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3205 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
3209 self->getFastAveragePlaneOfThis(vec,pos);
3211 std::copy(vec,vec+3,vals);
3212 std::copy(pos,pos+3,vals+3);
3213 return convertDblArrToPyListOfTuple(vals,3,2);
3216 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
3218 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
3219 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
3220 return MEDCouplingUMesh::MergeUMeshes(tmp);
3223 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
3226 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
3227 PyObject *ret=PyTuple_New(2);
3228 PyObject *ret0Py=ret0?Py_True:Py_False;
3230 PyTuple_SetItem(ret,0,ret0Py);
3231 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3235 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
3238 bool ret0=self->areCellsIncludedIn2(other,ret1);
3239 PyObject *ret=PyTuple_New(2);
3240 PyObject *ret0Py=ret0?Py_True:Py_False;
3242 PyTuple_SetItem(ret,0,ret0Py);
3243 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3247 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
3249 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
3250 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
3251 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
3252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
3253 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
3254 PyObject *ret=PyTuple_New(5);
3255 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3256 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3257 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3258 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3259 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3263 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
3265 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
3266 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
3267 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
3268 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
3269 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
3270 PyObject *ret=PyTuple_New(5);
3271 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3272 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3273 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3274 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3275 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3279 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
3281 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
3282 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
3283 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
3284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
3285 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
3286 PyObject *ret=PyTuple_New(5);
3287 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3288 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3289 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3290 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3291 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3295 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
3297 DataArrayInt *neighbors=0,*neighborsIdx=0;
3298 self->computeNeighborsOfCells(neighbors,neighborsIdx);
3299 PyObject *ret=PyTuple_New(2);
3300 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3301 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3305 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
3307 DataArrayInt *neighbors=0,*neighborsIdx=0;
3308 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
3309 PyObject *ret=PyTuple_New(2);
3310 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3311 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3315 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
3317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
3318 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
3319 DataArrayInt *d2,*d3,*d4,*dd5;
3320 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
3321 PyObject *ret=PyTuple_New(7);
3322 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3323 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3324 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3325 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3326 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3327 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3328 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3332 PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
3334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
3335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
3336 self->getReverseNodalConnectivity(d0,d1);
3337 PyObject *ret=PyTuple_New(2);
3338 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3339 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3343 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
3346 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3347 da->checkAllocated();
3348 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
3351 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
3354 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3355 da->checkAllocated();
3356 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
3359 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
3362 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3363 da->checkAllocated();
3364 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
3367 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
3370 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3371 da->checkAllocated();
3372 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
3373 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
3374 PyObject *res = PyList_New(result.size());
3375 for (int i=0;iL!=result.end(); i++, iL++)
3376 PyList_SetItem(res,i,PyInt_FromLong(*iL));
3380 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
3383 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3384 da->checkAllocated();
3385 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
3386 ret->setName(da->getName().c_str());
3390 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
3393 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3394 if (!SWIG_IsOK(res1))
3397 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3398 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
3402 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3404 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3405 da2->checkAllocated();
3406 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
3410 PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
3413 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
3414 PyObject *ret=PyTuple_New(2);
3415 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3416 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
3420 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
3422 DataArrayInt *cellNb1=0,*cellNb2=0;
3423 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
3424 PyObject *ret=PyTuple_New(3);
3425 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3426 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3427 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3431 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3433 int spaceDim=self->getSpaceDimension();
3435 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
3437 DataArrayDouble *a,*a2;
3438 DataArrayDoubleTuple *aa,*aa2;
3439 std::vector<double> bb,bb2;
3441 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
3442 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
3443 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3444 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3446 DataArrayInt *cellIds=0;
3447 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
3448 PyObject *ret=PyTuple_New(2);
3449 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3450 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3454 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3456 int spaceDim=self->getSpaceDimension();
3458 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
3460 DataArrayDouble *a,*a2;
3461 DataArrayDoubleTuple *aa,*aa2;
3462 std::vector<double> bb,bb2;
3464 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
3465 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
3466 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3467 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3469 DataArrayInt *cellIds=0;
3470 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
3471 PyObject *ret=PyTuple_New(2);
3472 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
3473 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3477 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3479 int spaceDim=self->getSpaceDimension();
3481 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
3483 DataArrayDouble *a,*a2;
3484 DataArrayDoubleTuple *aa,*aa2;
3485 std::vector<double> bb,bb2;
3487 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
3488 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
3489 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3490 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3491 return self->getCellIdsCrossingPlane(orig,vect,eps);
3494 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
3498 std::vector<int> pos2;
3499 DataArrayInt *pos3=0;
3500 DataArrayIntTuple *pos4=0;
3501 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
3506 self->convertToPolyTypes(&pos1,&pos1+1);
3513 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
3518 self->convertToPolyTypes(pos3->begin(),pos3->end());
3522 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
3526 void convertAllToPoly();
3527 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
3528 bool unPolyze() throw(INTERP_KERNEL::Exception);
3529 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
3530 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
3531 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
3534 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
3537 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
3538 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
3539 void updateTime() const throw(INTERP_KERNEL::Exception);
3541 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
3543 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3546 std::string __str__() const throw(INTERP_KERNEL::Exception)
3548 return self->simpleRepr();
3551 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3553 std::ostringstream oss;
3554 self->reprQuickOverview(oss);
3558 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
3560 MEDCouplingUMesh *ret=self->getMesh2D();
3563 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3565 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
3567 MEDCouplingUMesh *ret=self->getMesh1D();
3570 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3572 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
3574 DataArrayInt *ret=self->getMesh3DIds();
3577 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3582 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
3585 void updateTime() const throw(INTERP_KERNEL::Exception);
3586 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
3587 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
3590 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3593 static MEDCouplingCMesh *New();
3594 static MEDCouplingCMesh *New(const char *meshName);
3595 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3596 void setCoords(const DataArrayDouble *coordsX,
3597 const DataArrayDouble *coordsY=0,
3598 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3599 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3603 return MEDCouplingCMesh::New();
3605 MEDCouplingCMesh(const char *meshName)
3607 return MEDCouplingCMesh::New(meshName);
3609 std::string __str__() const throw(INTERP_KERNEL::Exception)
3611 return self->simpleRepr();
3613 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3615 std::ostringstream oss;
3616 self->reprQuickOverview(oss);
3619 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3621 DataArrayDouble *ret=self->getCoordsAt(i);
3629 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3632 static MEDCouplingCurveLinearMesh *New();
3633 static MEDCouplingCurveLinearMesh *New(const char *meshName);
3634 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3635 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3636 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
3638 MEDCouplingCurveLinearMesh()
3640 return MEDCouplingCurveLinearMesh::New();
3642 MEDCouplingCurveLinearMesh(const char *meshName)
3644 return MEDCouplingCurveLinearMesh::New(meshName);
3646 std::string __str__() const throw(INTERP_KERNEL::Exception)
3648 return self->simpleRepr();
3650 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3652 std::ostringstream oss;
3653 self->reprQuickOverview(oss);
3656 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3658 DataArrayDouble *ret=self->getCoords();
3663 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3665 int szArr,sw,iTypppArr;
3666 std::vector<int> stdvecTyyppArr;
3667 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3668 self->setNodeGridStructure(tmp,tmp+szArr);
3675 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
3677 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
3679 int sz=0,sw=-1,val1=-1;
3680 std::vector<int> val2;
3681 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
3682 return self->clonePart(inp,inp+sz);
3685 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3687 std::vector<int> vVal; int iVal=-1;
3689 const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
3691 throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
3692 DataArrayInt *ret0=0,*ret1=0;
3693 self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
3694 PyObject *pyRet=PyTuple_New(2);
3695 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3696 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3701 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationP0
3703 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3704 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3707 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationOnNodes
3709 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3710 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3713 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGauss
3715 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3716 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3719 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGaussNE
3721 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3722 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3725 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
3727 PyObject *getArrayOfDiscIds() const
3729 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
3732 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3735 PyObject *splitIntoSingleGaussDicrPerCellType() const throw(INTERP_KERNEL::Exception)
3737 std::vector<int> ret1;
3738 std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
3739 std::size_t sz=ret0.size();
3740 PyObject *pyRet=PyTuple_New(2);
3741 PyObject *pyRet0=PyList_New((int)sz);
3742 PyObject *pyRet1=PyList_New((int)sz);
3743 for(std::size_t i=0;i<sz;i++)
3745 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3746 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
3748 PyTuple_SetItem(pyRet,0,pyRet0);
3749 PyTuple_SetItem(pyRet,1,pyRet1);
3754 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
3756 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
3759 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
3760 PyObject *ret=PyTuple_New(2);
3761 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3762 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
3767 %extend ParaMEDMEM::DataArrayDoubleIterator
3771 DataArrayDoubleTuple *ret=self->nextt();
3773 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
3776 PyErr_SetString(PyExc_StopIteration,"No more data.");
3782 %extend ParaMEDMEM::DataArrayDoubleTuple
3784 std::string __str__() const throw(INTERP_KERNEL::Exception)
3786 return self->repr();
3789 double __float__() const throw(INTERP_KERNEL::Exception)
3791 return self->doubleValue();
3794 DataArrayDouble *buildDADouble()
3796 return self->buildDADouble(1,self->getNumberOfCompo());
3799 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3801 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
3802 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
3803 Py_XINCREF(trueSelf);
3807 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3809 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
3810 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
3811 Py_XINCREF(trueSelf);
3815 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
3818 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
3819 Py_XINCREF(trueSelf);
3823 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
3826 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
3827 Py_XINCREF(trueSelf);
3831 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3835 std::vector<int> multiVal;
3836 std::pair<int, std::pair<int,int> > slic;
3837 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3838 const double *pt=self->getConstPointer();
3839 int nbc=self->getNumberOfCompo();
3840 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3847 std::ostringstream oss;
3848 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
3849 throw INTERP_KERNEL::Exception(oss.str().c_str());
3852 return PyFloat_FromDouble(pt[singleVal]);
3856 return PyFloat_FromDouble(pt[nbc+singleVal]);
3859 std::ostringstream oss;
3860 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
3861 throw INTERP_KERNEL::Exception(oss.str().c_str());
3867 PyObject *t=PyTuple_New(multiVal.size());
3868 for(int j=0;j<(int)multiVal.size();j++)
3870 int cid=multiVal[j];
3873 std::ostringstream oss;
3874 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
3875 throw INTERP_KERNEL::Exception(oss.str().c_str());
3877 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
3883 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
3884 PyObject *t=PyTuple_New(sz);
3885 for(int j=0;j<sz;j++)
3886 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
3890 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
3894 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3896 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
3899 std::vector<double> multiValV;
3900 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
3901 int nbc=self->getNumberOfCompo();
3902 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
3904 std::vector<int> multiVal;
3905 std::pair<int, std::pair<int,int> > slic;
3906 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3907 double *pt=self->getPointer();
3908 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
3915 std::ostringstream oss;
3916 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
3917 throw INTERP_KERNEL::Exception(oss.str().c_str());
3923 pt[singleVal]=singleValV;
3928 if(multiValV.size()!=1)
3930 std::ostringstream oss;
3931 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
3932 throw INTERP_KERNEL::Exception(oss.str().c_str());
3934 pt[singleVal]=multiValV[0];
3939 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
3943 throw INTERP_KERNEL::Exception(msg);
3952 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
3956 std::ostringstream oss;
3957 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
3958 throw INTERP_KERNEL::Exception(oss.str().c_str());
3966 if(multiVal.size()!=multiValV.size())
3968 std::ostringstream oss;
3969 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
3970 throw INTERP_KERNEL::Exception(oss.str().c_str());
3972 for(int i=0;i<(int)multiVal.size();i++)
3974 int pos=multiVal[i];
3977 std::ostringstream oss;
3978 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
3979 throw INTERP_KERNEL::Exception(oss.str().c_str());
3981 pt[multiVal[i]]=multiValV[i];
3987 const double *ptV=daIntTyyppV->getConstPointer();
3988 if(nbc>daIntTyyppV->getNumberOfCompo())
3990 std::ostringstream oss;
3991 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
3992 throw INTERP_KERNEL::Exception(oss.str().c_str());
3994 std::copy(ptV,ptV+nbc,pt);
3998 throw INTERP_KERNEL::Exception(msg);
4003 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
4008 for(int j=0;j<sz;j++)
4009 pt[slic.first+j*slic.second.second]=singleValV;
4014 if(sz!=(int)multiValV.size())
4016 std::ostringstream oss;
4017 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4018 throw INTERP_KERNEL::Exception(oss.str().c_str());
4020 for(int j=0;j<sz;j++)
4021 pt[slic.first+j*slic.second.second]=multiValV[j];
4026 const double *ptV=daIntTyyppV->getConstPointer();
4027 if(sz>daIntTyyppV->getNumberOfCompo())
4029 std::ostringstream oss;
4030 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4031 throw INTERP_KERNEL::Exception(oss.str().c_str());
4033 for(int j=0;j<sz;j++)
4034 pt[slic.first+j*slic.second.second]=ptV[j];
4038 throw INTERP_KERNEL::Exception(msg);
4042 throw INTERP_KERNEL::Exception(msg);
4047 %extend ParaMEDMEM::DataArrayDouble
4049 DataArrayDouble() throw(INTERP_KERNEL::Exception)
4051 return DataArrayDouble::New();
4054 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4056 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) !";
4057 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4061 if(PyInt_Check(nbOfTuples))
4063 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4065 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
4068 if(PyInt_Check(elt2))
4069 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
4070 int nbOfCompo=PyInt_AS_LONG(elt2);
4072 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
4073 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
4074 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
4075 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4079 throw INTERP_KERNEL::Exception(msg);
4082 {//DataArrayDouble.New([1.,3.,4.],3)
4083 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
4085 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
4086 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4091 throw INTERP_KERNEL::Exception(msg);
4094 {// DataArrayDouble.New([1.,3.,4.])
4095 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
4096 int tmpp1=-1,tmpp2=-1;
4097 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
4098 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4102 else if(PyInt_Check(elt0))
4104 int nbOfTuples1=PyInt_AS_LONG(elt0);
4106 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
4111 if(PyInt_Check(nbOfTuples))
4112 {//DataArrayDouble.New(5,2)
4113 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4115 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
4116 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
4117 ret->alloc(nbOfTuples1,nbOfCompo);
4121 throw INTERP_KERNEL::Exception(msg);
4124 throw INTERP_KERNEL::Exception(msg);
4127 {//DataArrayDouble.New(5)
4128 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
4129 ret->alloc(nbOfTuples1,1);
4134 throw INTERP_KERNEL::Exception(msg);
4137 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
4139 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
4142 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4145 std::vector<double> bb;
4147 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
4148 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
4149 self->pushBackValsSilent(tmp,tmp+nbTuples);
4152 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4154 std::ostringstream oss;
4155 self->reprQuickOverview(oss);
4159 std::string __str__() const throw(INTERP_KERNEL::Exception)
4161 return self->repr();
4164 double __float__() const throw(INTERP_KERNEL::Exception)
4166 return self->doubleValue();
4169 int __len__() const throw(INTERP_KERNEL::Exception)
4171 if(self->isAllocated())
4173 return self->getNumberOfTuples();
4177 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
4181 DataArrayDoubleIterator *__iter__()
4183 return self->iterator();
4186 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4188 const char *msg="ParaMEDMEM::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
4189 if(PyList_Check(li) || PyTuple_Check(li))
4193 if(PyInt_Check(nbOfTuples))
4195 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4197 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
4200 if(PyInt_Check(nbOfComp))
4201 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
4202 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4204 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
4205 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
4206 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
4209 throw INTERP_KERNEL::Exception(msg);
4212 {//DataArrayDouble.setValues([1.,3.,4.],3)
4214 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
4215 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
4219 throw INTERP_KERNEL::Exception(msg);
4222 {// DataArrayDouble.setValues([1.,3.,4.])
4223 int tmpp1=-1,tmpp2=-1;
4224 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
4225 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
4229 throw INTERP_KERNEL::Exception(msg);
4232 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
4234 const double *vals=self->getConstPointer();
4235 return convertDblArrToPyList(vals,self->getNbOfElems());
4238 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
4241 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
4242 PyObject *ret=PyTuple_New(2);
4243 PyObject *ret0Py=ret0?Py_True:Py_False;
4245 PyTuple_SetItem(ret,0,ret0Py);
4246 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4250 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
4252 const double *vals=self->getConstPointer();
4253 int nbOfComp=self->getNumberOfComponents();
4254 int nbOfTuples=self->getNumberOfTuples();
4255 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4258 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4261 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4262 if (!SWIG_IsOK(res1))
4265 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4266 if(size!=self->getNumberOfTuples())
4268 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4270 return self->renumber(tmp);
4274 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4276 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4277 da2->checkAllocated();
4278 int size=self->getNumberOfTuples();
4279 if(size!=self->getNumberOfTuples())
4281 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4283 return self->renumber(da2->getConstPointer());
4287 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4290 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4291 if (!SWIG_IsOK(res1))
4294 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4295 if(size!=self->getNumberOfTuples())
4297 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4299 return self->renumberR(tmp);
4303 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4305 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4306 da2->checkAllocated();
4307 int size=self->getNumberOfTuples();
4308 if(size!=self->getNumberOfTuples())
4310 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4312 return self->renumberR(da2->getConstPointer());
4316 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4319 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4320 if (!SWIG_IsOK(res1))
4323 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4324 if(size!=self->getNumberOfTuples())
4326 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4328 return self->renumberAndReduce(tmp,newNbOfTuple);
4332 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4334 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4335 da2->checkAllocated();
4336 int size=self->getNumberOfTuples();
4337 if(size!=self->getNumberOfTuples())
4339 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4341 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4345 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
4348 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4349 if (!SWIG_IsOK(res1))
4352 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4353 if(size!=self->getNumberOfTuples())
4355 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4357 self->renumberInPlace(tmp);
4361 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4363 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4364 da2->checkAllocated();
4365 int size=self->getNumberOfTuples();
4366 if(size!=self->getNumberOfTuples())
4368 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4370 self->renumberInPlace(da2->getConstPointer());
4374 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
4377 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4378 if (!SWIG_IsOK(res1))
4381 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4382 if(size!=self->getNumberOfTuples())
4384 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4386 self->renumberInPlaceR(tmp);
4390 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4392 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4393 da2->checkAllocated();
4394 int size=self->getNumberOfTuples();
4395 if(size!=self->getNumberOfTuples())
4397 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4399 self->renumberInPlaceR(da2->getConstPointer());
4403 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
4406 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4407 if (!SWIG_IsOK(res1))
4410 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4411 return self->selectByTupleId(tmp,tmp+size);
4415 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4417 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4418 da2->checkAllocated();
4419 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4423 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4426 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4427 if (!SWIG_IsOK(res1))
4430 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4431 return self->selectByTupleIdSafe(tmp,tmp+size);
4435 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4437 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4438 da2->checkAllocated();
4439 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4443 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
4445 int thisTupleId,otherTupleId;
4446 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
4447 PyObject *ret=PyTuple_New(3);
4448 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
4449 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
4450 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
4454 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4457 double r1=self->getMaxValue(tmp);
4458 PyObject *ret=PyTuple_New(2);
4459 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4460 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4464 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
4467 double r1=self->getMaxValue2(tmp);
4468 PyObject *ret=PyTuple_New(2);
4469 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4470 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4474 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4477 double r1=self->getMinValue(tmp);
4478 PyObject *ret=PyTuple_New(2);
4479 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4480 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4484 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
4487 double r1=self->getMinValue2(tmp);
4488 PyObject *ret=PyTuple_New(2);
4489 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4490 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4494 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
4496 int nbOfCompo=self->getNumberOfComponents();
4497 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
4498 self->getMinMaxPerComponent(tmp);
4499 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
4503 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
4505 int sz=self->getNumberOfComponents();
4506 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4507 self->accumulate(tmp);
4508 return convertDblArrToPyList(tmp,sz);
4511 DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
4513 std::vector<int> tmp;
4514 convertPyToNewIntArr3(li,tmp);
4515 return self->keepSelectedComponents(tmp);
4518 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
4520 DataArrayInt *comm, *commIndex;
4521 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
4522 PyObject *res = PyList_New(2);
4523 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4524 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4528 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
4532 DataArrayDoubleTuple *aa;
4533 std::vector<double> bb;
4535 int tupleId=-1,nbTuples=-1,nbOfCompo=self->getNumberOfComponents();
4536 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
4538 int cellId=-1,nodeId=-1;
4539 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
4540 PyObject *ret=PyTuple_New(2);
4541 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
4542 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
4546 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
4548 std::vector<int> tmp;
4549 convertPyToNewIntArr3(li,tmp);
4550 self->setSelectedComponents(a,tmp);
4553 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4555 int sz=self->getNumberOfComponents();
4556 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4557 self->getTuple(tupleId,tmp);
4558 return convertDblArrToPyList(tmp,sz);
4561 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
4563 std::vector<const DataArrayDouble *> tmp;
4564 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
4565 return DataArrayDouble::Aggregate(tmp);
4568 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
4570 std::vector<const DataArrayDouble *> tmp;
4571 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
4572 return DataArrayDouble::Meld(tmp);
4575 DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
4577 std::vector<std::pair<int,int> > ranges;
4578 convertPyToVectorPairInt(li,ranges);
4579 return self->selectByTupleRanges(ranges);
4582 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
4586 DataArrayDoubleTuple *aa;
4587 std::vector<double> bb;
4589 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
4590 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
4591 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
4592 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
4593 DataArrayInt *c=0,*cI=0;
4594 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
4595 PyObject *ret=PyTuple_New(2);
4596 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4597 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4601 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4603 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
4604 self->checkAllocated();
4605 int nbOfTuples=self->getNumberOfTuples();
4606 int nbOfComponents=self->getNumberOfComponents();
4608 std::vector<int> vt1,vc1;
4609 std::pair<int, std::pair<int,int> > pt1,pc1;
4610 DataArrayInt *dt1=0,*dc1=0;
4612 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
4613 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
4617 if(nbOfComponents==1)
4618 return PyFloat_FromDouble(self->getIJSafe(it1,0));
4619 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4621 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4623 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4625 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4627 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
4630 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
4631 std::vector<int> v2(1,ic1);
4632 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4636 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
4637 std::vector<int> v2(1,ic1);
4638 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4642 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
4643 std::vector<int> v2(1,ic1);
4644 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4648 ret=self->selectByTupleIdSafe(&it1,&it1+1);
4649 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4653 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
4654 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4658 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
4659 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4663 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
4664 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4668 ret=self->selectByTupleIdSafe(&it1,&it1+1);
4669 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
4670 std::vector<int> v2(nbOfComp);
4671 for(int i=0;i<nbOfComp;i++)
4672 v2[i]=pc1.first+i*pc1.second.second;
4673 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4677 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
4678 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
4679 std::vector<int> v2(nbOfComp);
4680 for(int i=0;i<nbOfComp;i++)
4681 v2[i]=pc1.first+i*pc1.second.second;
4682 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4686 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
4687 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
4688 std::vector<int> v2(nbOfComp);
4689 for(int i=0;i<nbOfComp;i++)
4690 v2[i]=pc1.first+i*pc1.second.second;
4691 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4695 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
4696 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
4697 std::vector<int> v2(nbOfComp);
4698 for(int i=0;i<nbOfComp;i++)
4699 v2[i]=pc1.first+i*pc1.second.second;
4700 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
4703 throw INTERP_KERNEL::Exception(msg);
4707 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4709 self->checkAllocated();
4710 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
4711 int nbOfTuples=self->getNumberOfTuples();
4712 int nbOfComponents=self->getNumberOfComponents();
4715 std::vector<double> v1;
4716 DataArrayDouble *d1=0;
4717 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
4719 std::vector<int> vt1,vc1;
4720 std::pair<int, std::pair<int,int> > pt1,pc1;
4721 DataArrayInt *dt1=0,*dc1=0;
4722 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
4723 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
4731 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
4734 tmp=DataArrayDouble::New();
4735 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4736 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
4739 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
4742 throw INTERP_KERNEL::Exception(msg);
4751 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
4754 tmp=DataArrayDouble::New();
4755 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4756 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
4759 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
4762 throw INTERP_KERNEL::Exception(msg);
4771 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
4774 tmp=DataArrayDouble::New();
4775 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4776 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
4779 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
4782 throw INTERP_KERNEL::Exception(msg);
4791 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
4794 tmp=DataArrayDouble::New();
4795 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4796 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
4799 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
4802 throw INTERP_KERNEL::Exception(msg);
4811 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
4814 tmp=DataArrayDouble::New();
4815 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4816 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
4819 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
4822 throw INTERP_KERNEL::Exception(msg);
4831 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
4834 tmp=DataArrayDouble::New();
4835 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4836 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
4839 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
4842 throw INTERP_KERNEL::Exception(msg);
4851 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
4854 tmp=DataArrayDouble::New();
4855 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4856 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
4859 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
4862 throw INTERP_KERNEL::Exception(msg);
4871 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
4874 tmp=DataArrayDouble::New();
4875 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4876 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
4879 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
4882 throw INTERP_KERNEL::Exception(msg);
4891 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
4894 tmp=DataArrayDouble::New();
4895 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4896 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
4899 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
4902 throw INTERP_KERNEL::Exception(msg);
4911 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
4914 tmp=DataArrayDouble::New();
4915 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4916 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
4919 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
4922 throw INTERP_KERNEL::Exception(msg);
4931 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
4934 tmp=DataArrayDouble::New();
4935 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4936 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
4939 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
4942 throw INTERP_KERNEL::Exception(msg);
4951 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
4954 tmp=DataArrayDouble::New();
4955 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4956 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
4959 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
4962 throw INTERP_KERNEL::Exception(msg);
4971 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
4974 tmp=DataArrayDouble::New();
4975 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4976 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
4979 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
4982 throw INTERP_KERNEL::Exception(msg);
4991 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
4994 tmp=DataArrayDouble::New();
4995 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4996 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
4999 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5002 throw INTERP_KERNEL::Exception(msg);
5011 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5014 tmp=DataArrayDouble::New();
5015 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5016 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
5019 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5022 throw INTERP_KERNEL::Exception(msg);
5031 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5034 tmp=DataArrayDouble::New();
5035 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
5036 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
5039 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5042 throw INTERP_KERNEL::Exception(msg);
5047 throw INTERP_KERNEL::Exception(msg);
5052 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
5054 return self->negate();
5057 DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5059 const char msg[]="Unexpected situation in __add__ !";
5062 DataArrayDoubleTuple *aa;
5063 std::vector<double> bb;
5065 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5070 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5071 ret->applyLin(1.,val);
5076 return DataArrayDouble::Add(self,a);
5080 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5081 return DataArrayDouble::Add(self,aaa);
5085 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5086 return DataArrayDouble::Add(self,aaa);
5089 throw INTERP_KERNEL::Exception(msg);
5093 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5095 const char msg[]="Unexpected situation in __radd__ !";
5098 DataArrayDoubleTuple *aa;
5099 std::vector<double> bb;
5101 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5106 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5107 ret->applyLin(1.,val);
5112 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5113 return DataArrayDouble::Add(self,aaa);
5117 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5118 return DataArrayDouble::Add(self,aaa);
5121 throw INTERP_KERNEL::Exception(msg);
5125 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5127 const char msg[]="Unexpected situation in __iadd__ !";
5130 DataArrayDoubleTuple *aa;
5131 std::vector<double> bb;
5133 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5138 self->applyLin(1.,val);
5139 Py_XINCREF(trueSelf);
5145 Py_XINCREF(trueSelf);
5150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5151 self->addEqual(aaa);
5152 Py_XINCREF(trueSelf);
5157 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5158 self->addEqual(aaa);
5159 Py_XINCREF(trueSelf);
5163 throw INTERP_KERNEL::Exception(msg);
5167 DataArrayDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5169 const char msg[]="Unexpected situation in __sub__ !";
5172 DataArrayDoubleTuple *aa;
5173 std::vector<double> bb;
5175 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5180 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5181 ret->applyLin(1.,-val);
5186 return DataArrayDouble::Substract(self,a);
5190 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5191 return DataArrayDouble::Substract(self,aaa);
5195 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5196 return DataArrayDouble::Substract(self,aaa);
5199 throw INTERP_KERNEL::Exception(msg);
5203 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5205 const char msg[]="Unexpected situation in __rsub__ !";
5208 DataArrayDoubleTuple *aa;
5209 std::vector<double> bb;
5211 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5216 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5217 ret->applyLin(-1.,val);
5222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5223 return DataArrayDouble::Substract(aaa,self);
5227 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5228 return DataArrayDouble::Substract(aaa,self);
5231 throw INTERP_KERNEL::Exception(msg);
5235 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5237 const char msg[]="Unexpected situation in __isub__ !";
5240 DataArrayDoubleTuple *aa;
5241 std::vector<double> bb;
5243 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5248 self->applyLin(1,-val);
5249 Py_XINCREF(trueSelf);
5254 self->substractEqual(a);
5255 Py_XINCREF(trueSelf);
5260 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5261 self->substractEqual(aaa);
5262 Py_XINCREF(trueSelf);
5267 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5268 self->substractEqual(aaa);
5269 Py_XINCREF(trueSelf);
5273 throw INTERP_KERNEL::Exception(msg);
5277 DataArrayDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5279 const char msg[]="Unexpected situation in __mul__ !";
5282 DataArrayDoubleTuple *aa;
5283 std::vector<double> bb;
5285 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5290 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5291 ret->applyLin(val,0.);
5296 return DataArrayDouble::Multiply(self,a);
5300 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5301 return DataArrayDouble::Multiply(self,aaa);
5305 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5306 return DataArrayDouble::Multiply(self,aaa);
5309 throw INTERP_KERNEL::Exception(msg);
5313 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5315 const char msg[]="Unexpected situation in __rmul__ !";
5318 DataArrayDoubleTuple *aa;
5319 std::vector<double> bb;
5321 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5326 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5327 ret->applyLin(val,0.);
5332 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5333 return DataArrayDouble::Multiply(self,aaa);
5337 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5338 return DataArrayDouble::Multiply(self,aaa);
5341 throw INTERP_KERNEL::Exception(msg);
5345 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5347 const char msg[]="Unexpected situation in __imul__ !";
5350 DataArrayDoubleTuple *aa;
5351 std::vector<double> bb;
5353 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5358 self->applyLin(val,0.);
5359 Py_XINCREF(trueSelf);
5364 self->multiplyEqual(a);
5365 Py_XINCREF(trueSelf);
5370 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5371 self->multiplyEqual(aaa);
5372 Py_XINCREF(trueSelf);
5377 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5378 self->multiplyEqual(aaa);
5379 Py_XINCREF(trueSelf);
5383 throw INTERP_KERNEL::Exception(msg);
5387 DataArrayDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5389 const char msg[]="Unexpected situation in __div__ !";
5392 DataArrayDoubleTuple *aa;
5393 std::vector<double> bb;
5395 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5401 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
5402 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5403 ret->applyLin(1/val,0.);
5408 return DataArrayDouble::Divide(self,a);
5412 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5413 return DataArrayDouble::Divide(self,aaa);
5417 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5418 return DataArrayDouble::Divide(self,aaa);
5421 throw INTERP_KERNEL::Exception(msg);
5425 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5427 const char msg[]="Unexpected situation in __rdiv__ !";
5430 DataArrayDoubleTuple *aa;
5431 std::vector<double> bb;
5433 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5438 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5444 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5445 return DataArrayDouble::Divide(aaa,self);
5449 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5450 return DataArrayDouble::Divide(aaa,self);
5453 throw INTERP_KERNEL::Exception(msg);
5457 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5459 const char msg[]="Unexpected situation in __idiv__ !";
5462 DataArrayDoubleTuple *aa;
5463 std::vector<double> bb;
5465 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5471 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
5472 self->applyLin(1./val,0.);
5473 Py_XINCREF(trueSelf);
5478 self->divideEqual(a);
5479 Py_XINCREF(trueSelf);
5484 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5485 self->divideEqual(aaa);
5486 Py_XINCREF(trueSelf);
5491 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5492 self->divideEqual(aaa);
5493 Py_XINCREF(trueSelf);
5497 throw INTERP_KERNEL::Exception(msg);
5501 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5503 const char msg[]="Unexpected situation in __pow__ !";
5506 DataArrayDoubleTuple *aa;
5507 std::vector<double> bb;
5509 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5514 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5520 return DataArrayDouble::Pow(self,a);
5524 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5525 return DataArrayDouble::Pow(self,aaa);
5529 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5530 return DataArrayDouble::Pow(self,aaa);
5533 throw INTERP_KERNEL::Exception(msg);
5537 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5539 const char msg[]="Unexpected situation in __rpow__ !";
5542 DataArrayDoubleTuple *aa;
5543 std::vector<double> bb;
5545 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5550 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
5551 ret->applyRPow(val);
5556 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5557 return DataArrayDouble::Pow(aaa,self);
5561 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5562 return DataArrayDouble::Pow(aaa,self);
5565 throw INTERP_KERNEL::Exception(msg);
5569 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5571 const char msg[]="Unexpected situation in __ipow__ !";
5574 DataArrayDoubleTuple *aa;
5575 std::vector<double> bb;
5577 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
5582 self->applyPow(val);
5583 Py_XINCREF(trueSelf);
5589 Py_XINCREF(trueSelf);
5594 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5595 self->powEqual(aaa);
5596 Py_XINCREF(trueSelf);
5601 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
5602 self->powEqual(aaa);
5603 Py_XINCREF(trueSelf);
5607 throw INTERP_KERNEL::Exception(msg);
5611 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
5613 DataArrayInt *c=0,*cI=0;
5615 self->computeTupleIdsNearTuples(other,eps,c,cI);
5616 PyObject *ret=PyTuple_New(2);
5617 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
5618 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
5623 %extend ParaMEDMEM::DataArrayIntTuple
5625 std::string __str__() const throw(INTERP_KERNEL::Exception)
5627 return self->repr();
5630 int __int__() const throw(INTERP_KERNEL::Exception)
5632 return self->intValue();
5635 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
5637 return self->buildDAInt(1,self->getNumberOfCompo());
5640 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5642 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
5643 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
5644 Py_XINCREF(trueSelf);
5648 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5650 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
5651 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
5652 Py_XINCREF(trueSelf);
5656 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5658 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
5659 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
5660 Py_XINCREF(trueSelf);
5664 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5666 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
5667 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
5668 Py_XINCREF(trueSelf);
5672 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
5674 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
5675 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
5676 Py_XINCREF(trueSelf);
5680 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
5684 std::vector<int> multiVal;
5685 std::pair<int, std::pair<int,int> > slic;
5686 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5687 const int *pt=self->getConstPointer();
5688 int nbc=self->getNumberOfCompo();
5689 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
5696 std::ostringstream oss;
5697 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
5698 throw INTERP_KERNEL::Exception(oss.str().c_str());
5701 return PyInt_FromLong(pt[singleVal]);
5705 return PyInt_FromLong(pt[nbc+singleVal]);
5708 std::ostringstream oss;
5709 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
5710 throw INTERP_KERNEL::Exception(oss.str().c_str());
5716 PyObject *t=PyTuple_New(multiVal.size());
5717 for(int j=0;j<(int)multiVal.size();j++)
5719 int cid=multiVal[j];
5722 std::ostringstream oss;
5723 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
5724 throw INTERP_KERNEL::Exception(oss.str().c_str());
5726 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
5732 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
5733 PyObject *t=PyTuple_New(sz);
5734 for(int j=0;j<sz;j++)
5735 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
5739 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
5743 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5745 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
5748 std::vector<int> multiValV;
5749 std::pair<int, std::pair<int,int> > slicV;
5750 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
5751 int nbc=self->getNumberOfCompo();
5752 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
5754 std::vector<int> multiVal;
5755 std::pair<int, std::pair<int,int> > slic;
5756 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5757 int *pt=self->getPointer();
5758 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
5765 std::ostringstream oss;
5766 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
5767 throw INTERP_KERNEL::Exception(oss.str().c_str());
5773 pt[singleVal]=singleValV;
5778 if(multiValV.size()!=1)
5780 std::ostringstream oss;
5781 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
5782 throw INTERP_KERNEL::Exception(oss.str().c_str());
5784 pt[singleVal]=multiValV[0];
5789 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
5793 throw INTERP_KERNEL::Exception(msg);
5802 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
5806 std::ostringstream oss;
5807 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
5808 throw INTERP_KERNEL::Exception(oss.str().c_str());
5816 if(multiVal.size()!=multiValV.size())
5818 std::ostringstream oss;
5819 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
5820 throw INTERP_KERNEL::Exception(oss.str().c_str());
5822 for(int i=0;i<(int)multiVal.size();i++)
5824 int pos=multiVal[i];
5827 std::ostringstream oss;
5828 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
5829 throw INTERP_KERNEL::Exception(oss.str().c_str());
5831 pt[multiVal[i]]=multiValV[i];
5837 const int *ptV=daIntTyyppV->getConstPointer();
5838 if(nbc>daIntTyyppV->getNumberOfCompo())
5840 std::ostringstream oss;
5841 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5842 throw INTERP_KERNEL::Exception(oss.str().c_str());
5844 std::copy(ptV,ptV+nbc,pt);
5848 throw INTERP_KERNEL::Exception(msg);
5853 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
5858 for(int j=0;j<sz;j++)
5859 pt[slic.first+j*slic.second.second]=singleValV;
5864 if(sz!=(int)multiValV.size())
5866 std::ostringstream oss;
5867 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
5868 throw INTERP_KERNEL::Exception(oss.str().c_str());
5870 for(int j=0;j<sz;j++)
5871 pt[slic.first+j*slic.second.second]=multiValV[j];
5876 const int *ptV=daIntTyyppV->getConstPointer();
5877 if(sz>daIntTyyppV->getNumberOfCompo())
5879 std::ostringstream oss;
5880 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5881 throw INTERP_KERNEL::Exception(oss.str().c_str());
5883 for(int j=0;j<sz;j++)
5884 pt[slic.first+j*slic.second.second]=ptV[j];
5888 throw INTERP_KERNEL::Exception(msg);
5892 throw INTERP_KERNEL::Exception(msg);
5897 %extend ParaMEDMEM::DataArrayIntIterator
5901 DataArrayIntTuple *ret=self->nextt();
5903 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
5906 PyErr_SetString(PyExc_StopIteration,"No more data.");
5912 %extend ParaMEDMEM::DataArrayInt
5914 DataArrayInt() throw(INTERP_KERNEL::Exception)
5916 return DataArrayInt::New();
5919 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5921 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) !";
5922 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5926 if(PyInt_Check(nbOfTuples))
5928 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5930 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
5933 if(PyInt_Check(nbOfComp))
5934 {//DataArrayInt.New([1,3,4,5],2,2)
5935 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5937 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
5938 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
5939 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5940 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5944 throw INTERP_KERNEL::Exception(msg);
5947 {//DataArrayInt.New([1,3,4],3)
5948 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
5950 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5951 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5956 throw INTERP_KERNEL::Exception(msg);
5959 {// DataArrayInt.New([1,3,4])
5960 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
5961 int tmpp1=-1,tmpp2=-1;
5962 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5963 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5967 else if(PyInt_Check(elt0))
5969 int nbOfTuples1=PyInt_AS_LONG(elt0);
5971 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
5976 if(PyInt_Check(nbOfTuples))
5977 {//DataArrayInt.New(5,2)
5978 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5980 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
5981 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
5982 ret->alloc(nbOfTuples1,nbOfCompo);
5986 throw INTERP_KERNEL::Exception(msg);
5989 throw INTERP_KERNEL::Exception(msg);
5992 {//DataArrayInt.New(5)
5993 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
5994 ret->alloc(nbOfTuples1,1);
5999 throw INTERP_KERNEL::Exception(msg);
6002 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
6004 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
6007 std::string __str__() const throw(INTERP_KERNEL::Exception)
6009 return self->repr();
6012 int __len__() const throw(INTERP_KERNEL::Exception)
6014 if(self->isAllocated())
6016 return self->getNumberOfTuples();
6020 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
6024 int __int__() const throw(INTERP_KERNEL::Exception)
6026 return self->intValue();
6029 DataArrayIntIterator *__iter__()
6031 return self->iterator();
6034 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
6036 int sz=self->getNumberOfComponents();
6037 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
6038 self->accumulate(tmp);
6039 return convertIntArrToPyList(tmp,sz);
6042 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
6044 int newNbOfTuples=-1;
6045 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
6046 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
6047 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
6048 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
6049 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
6050 PyObject *ret=PyTuple_New(2);
6051 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6052 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
6056 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
6058 const char *msg="ParaMEDMEM::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
6059 if(PyList_Check(li) || PyTuple_Check(li))
6063 if(PyInt_Check(nbOfTuples))
6065 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
6067 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
6070 if(PyInt_Check(nbOfComp))
6071 {//DataArrayInt.setValues([1,3,4,5],2,2)
6072 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
6074 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
6075 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
6076 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
6079 throw INTERP_KERNEL::Exception(msg);
6082 {//DataArrayInt.setValues([1,3,4],3)
6084 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
6085 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
6089 throw INTERP_KERNEL::Exception(msg);
6092 {// DataArrayInt.setValues([1,3,4])
6093 int tmpp1=-1,tmpp2=-1;
6094 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
6095 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
6099 throw INTERP_KERNEL::Exception(msg);
6102 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
6104 const int *vals=self->getConstPointer();
6105 return convertIntArrToPyList(vals,self->getNbOfElems());
6108 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
6111 bool ret0=self->isEqualIfNotWhy(other,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 *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
6122 const int *vals=self->getConstPointer();
6123 int nbOfComp=self->getNumberOfComponents();
6124 int nbOfTuples=self->getNumberOfTuples();
6125 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
6128 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
6130 std::vector<const DataArrayInt *> groups;
6131 std::vector< std::vector<int> > fidsOfGroups;
6132 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
6133 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
6134 PyObject *ret = PyList_New(2);
6135 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6136 int sz=fidsOfGroups.size();
6137 PyObject *ret1 = PyList_New(sz);
6138 for(int i=0;i<sz;i++)
6139 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
6140 PyList_SetItem(ret,1,ret1);
6144 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
6147 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6148 if (!SWIG_IsOK(res1))
6151 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6152 self->transformWithIndArr(tmp,tmp+size);
6156 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6157 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
6161 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
6165 std::vector<int> multiVal;
6166 std::pair<int, std::pair<int,int> > slic;
6167 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
6168 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
6172 return self->getIdsEqualList(&singleVal,&singleVal+1);
6174 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
6176 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
6178 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
6182 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
6186 std::vector<int> multiVal;
6187 std::pair<int, std::pair<int,int> > slic;
6188 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
6189 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
6193 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
6195 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
6197 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
6199 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
6203 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
6205 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
6207 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6208 if (!SWIG_IsOK(res1))
6211 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6212 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
6216 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6218 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6219 da2->checkAllocated();
6220 int size=self->getNumberOfTuples();
6221 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
6223 PyObject *ret = PyList_New(3);
6224 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6225 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6226 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
6230 DataArrayInt *transformWithIndArrR(PyObject *li) const
6233 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6234 if (!SWIG_IsOK(res1))
6237 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6238 return self->transformWithIndArrR(tmp,tmp+size);
6242 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6243 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
6247 void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
6250 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6251 if (!SWIG_IsOK(res1))
6254 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6255 if(size!=self->getNumberOfTuples())
6257 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6259 self->renumberInPlace(tmp);
6263 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6265 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6266 da2->checkAllocated();
6267 int size=self->getNumberOfTuples();
6268 if(size!=self->getNumberOfTuples())
6270 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6272 self->renumberInPlace(da2->getConstPointer());
6276 void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
6279 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6280 if (!SWIG_IsOK(res1))
6283 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6284 if(size!=self->getNumberOfTuples())
6286 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6288 self->renumberInPlaceR(tmp);
6292 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6294 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6295 da2->checkAllocated();
6296 int size=self->getNumberOfTuples();
6297 if(size!=self->getNumberOfTuples())
6299 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6301 self->renumberInPlaceR(da2->getConstPointer());
6305 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
6308 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6309 if (!SWIG_IsOK(res1))
6312 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6313 if(size!=self->getNumberOfTuples())
6315 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6317 return self->renumberAndReduce(tmp,newNbOfTuple);
6321 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6323 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6324 da2->checkAllocated();
6325 int size=self->getNumberOfTuples();
6326 if(size!=self->getNumberOfTuples())
6328 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6330 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
6334 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
6337 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6338 if (!SWIG_IsOK(res1))
6341 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6342 if(size!=self->getNumberOfTuples())
6344 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6346 return self->renumber(tmp);
6350 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6352 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6353 da2->checkAllocated();
6354 int size=self->getNumberOfTuples();
6355 if(size!=self->getNumberOfTuples())
6357 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6359 return self->renumber(da2->getConstPointer());
6363 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
6366 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6367 if (!SWIG_IsOK(res1))
6370 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6371 if(size!=self->getNumberOfTuples())
6373 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6375 return self->renumberR(tmp);
6379 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6381 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6382 da2->checkAllocated();
6383 int size=self->getNumberOfTuples();
6384 if(size!=self->getNumberOfTuples())
6386 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
6388 return self->renumberR(da2->getConstPointer());
6392 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
6395 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6396 if (!SWIG_IsOK(res1))
6399 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6400 return self->selectByTupleId(tmp,tmp+size);
6404 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6406 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6407 da2->checkAllocated();
6408 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
6412 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
6415 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
6416 if (!SWIG_IsOK(res1))
6419 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
6420 return self->selectByTupleIdSafe(tmp,tmp+size);
6424 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
6426 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
6427 da2->checkAllocated();
6428 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
6432 DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
6434 std::vector<int> tmp;
6435 convertPyToNewIntArr3(li,tmp);
6436 return self->keepSelectedComponents(tmp);
6439 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
6441 std::vector<int> tmp;
6442 convertPyToNewIntArr3(li,tmp);
6443 self->setSelectedComponents(a,tmp);
6446 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
6448 int sz=self->getNumberOfComponents();
6449 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
6450 self->getTuple(tupleId,tmp);
6451 return convertIntArrToPyList(tmp,sz);
6454 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
6456 DataArrayInt *arr=0;
6457 DataArrayInt *arrI=0;
6458 self->changeSurjectiveFormat(targetNb,arr,arrI);
6459 PyObject *res = PyList_New(2);
6460 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6461 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
6465 DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
6467 std::vector<std::pair<int,int> > ranges;
6468 convertPyToVectorPairInt(li,ranges);
6469 return self->selectByTupleRanges(ranges);
6472 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
6474 std::vector<const DataArrayInt *> tmp;
6475 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
6476 return DataArrayInt::Meld(tmp);
6479 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
6481 std::vector<const DataArrayInt *> tmp;
6482 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
6483 return DataArrayInt::Aggregate(tmp);
6486 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
6488 std::vector<const DataArrayInt *> tmp;
6489 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
6490 return DataArrayInt::BuildUnion(tmp);
6493 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
6495 std::vector<const DataArrayInt *> tmp;
6496 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
6497 return DataArrayInt::BuildIntersection(tmp);
6500 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
6503 int r1=self->getMaxValue(tmp);
6504 PyObject *ret=PyTuple_New(2);
6505 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
6506 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6510 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
6513 int r1=self->getMinValue(tmp);
6514 PyObject *ret=PyTuple_New(2);
6515 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
6516 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6520 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6522 int nbOfCompo=self->getNumberOfComponents();
6527 if(PyInt_Check(obj))
6529 int val=(int)PyInt_AS_LONG(obj);
6530 return self->locateValue(val);
6533 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
6537 std::vector<int> arr;
6538 convertPyToNewIntArr3(obj,arr);
6539 return self->locateTuple(arr);
6544 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6546 int nbOfCompo=self->getNumberOfComponents();
6553 if(PyInt_Check(obj))
6555 int val=(int)PyInt_AS_LONG(obj);
6556 return self->presenceOfValue(val);
6559 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
6563 std::vector<int> arr;
6564 convertPyToNewIntArr3(obj,arr);
6565 return self->presenceOfTuple(arr);
6570 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
6572 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
6573 self->checkAllocated();
6574 int nbOfTuples=self->getNumberOfTuples();
6575 int nbOfComponents=self->getNumberOfComponents();
6577 std::vector<int> vt1,vc1;
6578 std::pair<int, std::pair<int,int> > pt1,pc1;
6579 DataArrayInt *dt1=0,*dc1=0;
6581 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
6582 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
6587 if(nbOfComponents==1)
6588 return PyInt_FromLong(self->getIJSafe(it1,0));
6589 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6592 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6594 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6596 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6598 return PyInt_FromLong(self->getIJSafe(it1,ic1));
6601 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
6602 std::vector<int> v2(1,ic1);
6603 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6607 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
6608 std::vector<int> v2(1,ic1);
6609 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6613 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
6614 std::vector<int> v2(1,ic1);
6615 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6619 ret=self->selectByTupleIdSafe(&it1,&it1+1);
6620 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6624 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
6625 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6629 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
6630 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6634 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
6635 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6639 ret=self->selectByTupleIdSafe(&it1,&it1+1);
6640 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
6641 std::vector<int> v2(nbOfComp);
6642 for(int i=0;i<nbOfComp;i++)
6643 v2[i]=pc1.first+i*pc1.second.second;
6644 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6648 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
6649 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
6650 std::vector<int> v2(nbOfComp);
6651 for(int i=0;i<nbOfComp;i++)
6652 v2[i]=pc1.first+i*pc1.second.second;
6653 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6657 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
6658 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
6659 std::vector<int> v2(nbOfComp);
6660 for(int i=0;i<nbOfComp;i++)
6661 v2[i]=pc1.first+i*pc1.second.second;
6662 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6666 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
6667 int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
6668 std::vector<int> v2(nbOfComp);
6669 for(int i=0;i<nbOfComp;i++)
6670 v2[i]=pc1.first+i*pc1.second.second;
6671 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
6674 throw INTERP_KERNEL::Exception(msg);
6678 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6680 self->checkAllocated();
6681 const char msg[]="Unexpected situation in __setitem__ !";
6682 int nbOfTuples=self->getNumberOfTuples();
6683 int nbOfComponents=self->getNumberOfComponents();
6686 std::vector<int> v1;
6688 DataArrayIntTuple *dd1=0;
6689 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
6691 std::vector<int> vt1,vc1;
6692 std::pair<int, std::pair<int,int> > pt1,pc1;
6693 DataArrayInt *dt1=0,*dc1=0;
6694 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
6695 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
6703 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
6706 tmp=DataArrayInt::New();
6707 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6708 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
6711 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
6714 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6715 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
6718 throw INTERP_KERNEL::Exception(msg);
6727 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
6730 tmp=DataArrayInt::New();
6731 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6732 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
6735 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
6738 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6739 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
6742 throw INTERP_KERNEL::Exception(msg);
6751 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
6754 tmp=DataArrayInt::New();
6755 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6756 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
6759 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
6762 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6763 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
6766 throw INTERP_KERNEL::Exception(msg);
6775 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
6778 tmp=DataArrayInt::New();
6779 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6780 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
6783 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
6786 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6787 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
6790 throw INTERP_KERNEL::Exception(msg);
6799 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
6802 tmp=DataArrayInt::New();
6803 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6804 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
6807 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
6810 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6811 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
6814 throw INTERP_KERNEL::Exception(msg);
6823 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
6826 tmp=DataArrayInt::New();
6827 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6828 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
6831 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
6834 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6835 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
6838 throw INTERP_KERNEL::Exception(msg);
6847 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
6850 tmp=DataArrayInt::New();
6851 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6852 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
6855 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
6858 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6859 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
6862 throw INTERP_KERNEL::Exception(msg);
6871 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
6874 tmp=DataArrayInt::New();
6875 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6876 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
6879 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
6882 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6883 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
6886 throw INTERP_KERNEL::Exception(msg);
6895 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
6898 tmp=DataArrayInt::New();
6899 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6900 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
6903 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
6906 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6907 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
6910 throw INTERP_KERNEL::Exception(msg);
6919 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
6922 tmp=DataArrayInt::New();
6923 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6924 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
6927 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
6930 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6931 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
6934 throw INTERP_KERNEL::Exception(msg);
6943 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
6946 tmp=DataArrayInt::New();
6947 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6948 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
6951 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
6954 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6955 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
6958 throw INTERP_KERNEL::Exception(msg);
6967 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
6970 tmp=DataArrayInt::New();
6971 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6972 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
6975 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
6978 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
6979 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
6982 throw INTERP_KERNEL::Exception(msg);
6991 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
6994 tmp=DataArrayInt::New();
6995 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
6996 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
6999 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
7002 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
7003 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
7006 throw INTERP_KERNEL::Exception(msg);
7015 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
7018 tmp=DataArrayInt::New();
7019 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
7020 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
7023 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
7026 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
7027 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
7030 throw INTERP_KERNEL::Exception(msg);
7039 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
7042 tmp=DataArrayInt::New();
7043 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
7044 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
7047 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
7050 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
7051 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
7054 throw INTERP_KERNEL::Exception(msg);
7063 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
7066 tmp=DataArrayInt::New();
7067 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
7068 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
7071 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
7074 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
7075 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
7078 throw INTERP_KERNEL::Exception(msg);
7083 throw INTERP_KERNEL::Exception(msg);
7088 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
7090 return self->negate();
7093 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7095 const char msg[]="Unexpected situation in __add__ !";
7098 std::vector<int> aa;
7099 DataArrayIntTuple *aaa;
7101 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7106 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7107 ret->applyLin(1,val);
7112 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7113 return DataArrayInt::Add(self,aaa);
7117 return DataArrayInt::Add(self,a);
7121 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7122 return DataArrayInt::Add(self,aaaa);
7125 throw INTERP_KERNEL::Exception(msg);
7129 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7131 const char msg[]="Unexpected situation in __radd__ !";
7134 std::vector<int> aa;
7135 DataArrayIntTuple *aaa;
7137 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7142 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7143 ret->applyLin(1,val);
7148 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7149 return DataArrayInt::Add(self,aaa);
7153 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7154 return DataArrayInt::Add(self,aaaa);
7157 throw INTERP_KERNEL::Exception(msg);
7161 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7163 const char msg[]="Unexpected situation in __iadd__ !";
7166 std::vector<int> aa;
7167 DataArrayIntTuple *aaa;
7169 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7174 self->applyLin(1,val);
7175 Py_XINCREF(trueSelf);
7180 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7182 Py_XINCREF(trueSelf);
7188 Py_XINCREF(trueSelf);
7193 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7194 self->addEqual(aaaa);
7195 Py_XINCREF(trueSelf);
7199 throw INTERP_KERNEL::Exception(msg);
7203 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7205 const char msg[]="Unexpected situation in __sub__ !";
7208 std::vector<int> aa;
7209 DataArrayIntTuple *aaa;
7211 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7217 ret->applyLin(1,-val);
7222 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7223 return DataArrayInt::Substract(self,aaa);
7227 return DataArrayInt::Substract(self,a);
7231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7232 return DataArrayInt::Substract(self,aaaa);
7235 throw INTERP_KERNEL::Exception(msg);
7239 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7241 const char msg[]="Unexpected situation in __rsub__ !";
7244 std::vector<int> aa;
7245 DataArrayIntTuple *aaa;
7247 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7253 ret->applyLin(-1,val);
7258 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7259 return DataArrayInt::Substract(aaa,self);
7263 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7264 return DataArrayInt::Substract(aaaa,self);
7267 throw INTERP_KERNEL::Exception(msg);
7271 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7273 const char msg[]="Unexpected situation in __isub__ !";
7276 std::vector<int> aa;
7277 DataArrayIntTuple *aaa;
7279 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7284 self->applyLin(1,-val);
7285 Py_XINCREF(trueSelf);
7290 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7291 self->substractEqual(bb);
7292 Py_XINCREF(trueSelf);
7297 self->substractEqual(a);
7298 Py_XINCREF(trueSelf);
7303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7304 self->substractEqual(aaaa);
7305 Py_XINCREF(trueSelf);
7309 throw INTERP_KERNEL::Exception(msg);
7313 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7315 const char msg[]="Unexpected situation in __mul__ !";
7318 std::vector<int> aa;
7319 DataArrayIntTuple *aaa;
7321 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7326 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7327 ret->applyLin(val,0);
7332 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7333 return DataArrayInt::Multiply(self,aaa);
7337 return DataArrayInt::Multiply(self,a);
7341 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7342 return DataArrayInt::Multiply(self,aaaa);
7345 throw INTERP_KERNEL::Exception(msg);
7349 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7351 const char msg[]="Unexpected situation in __rmul__ !";
7354 std::vector<int> aa;
7355 DataArrayIntTuple *aaa;
7357 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7362 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7363 ret->applyLin(val,0);
7368 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7369 return DataArrayInt::Multiply(self,aaa);
7373 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7374 return DataArrayInt::Multiply(self,aaaa);
7377 throw INTERP_KERNEL::Exception(msg);
7381 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7383 const char msg[]="Unexpected situation in __imul__ !";
7386 std::vector<int> aa;
7387 DataArrayIntTuple *aaa;
7389 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7394 self->applyLin(val,0);
7395 Py_XINCREF(trueSelf);
7400 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7401 self->multiplyEqual(bb);
7402 Py_XINCREF(trueSelf);
7407 self->multiplyEqual(a);
7408 Py_XINCREF(trueSelf);
7413 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7414 self->multiplyEqual(aaaa);
7415 Py_XINCREF(trueSelf);
7419 throw INTERP_KERNEL::Exception(msg);
7423 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7425 const char msg[]="Unexpected situation in __div__ !";
7428 std::vector<int> aa;
7429 DataArrayIntTuple *aaa;
7431 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7436 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7437 ret->applyDivideBy(val);
7442 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7443 return DataArrayInt::Divide(self,aaa);
7447 return DataArrayInt::Divide(self,a);
7451 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7452 return DataArrayInt::Divide(self,aaaa);
7455 throw INTERP_KERNEL::Exception(msg);
7459 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7461 const char msg[]="Unexpected situation in __rdiv__ !";
7464 std::vector<int> aa;
7465 DataArrayIntTuple *aaa;
7467 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7472 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7478 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7479 return DataArrayInt::Divide(aaa,self);
7483 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7484 return DataArrayInt::Divide(aaaa,self);
7487 throw INTERP_KERNEL::Exception(msg);
7491 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7493 const char msg[]="Unexpected situation in __idiv__ !";
7496 std::vector<int> aa;
7497 DataArrayIntTuple *aaa;
7499 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7504 self->applyDivideBy(val);
7505 Py_XINCREF(trueSelf);
7510 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7511 self->divideEqual(bb);
7512 Py_XINCREF(trueSelf);
7517 self->divideEqual(a);
7518 Py_XINCREF(trueSelf);
7523 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7524 self->divideEqual(aaaa);
7525 Py_XINCREF(trueSelf);
7529 throw INTERP_KERNEL::Exception(msg);
7533 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7535 const char msg[]="Unexpected situation in __mod__ !";
7538 std::vector<int> aa;
7539 DataArrayIntTuple *aaa;
7541 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7546 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7547 ret->applyModulus(val);
7552 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7553 return DataArrayInt::Modulus(self,aaa);
7557 return DataArrayInt::Modulus(self,a);
7561 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7562 return DataArrayInt::Modulus(self,aaaa);
7565 throw INTERP_KERNEL::Exception(msg);
7569 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7571 const char msg[]="Unexpected situation in __rmod__ !";
7574 std::vector<int> aa;
7575 DataArrayIntTuple *aaa;
7577 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7582 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7583 ret->applyRModulus(val);
7588 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7589 return DataArrayInt::Modulus(aaa,self);
7593 return DataArrayInt::Modulus(a,self);
7597 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7598 return DataArrayInt::Modulus(aaaa,self);
7601 throw INTERP_KERNEL::Exception(msg);
7605 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7607 const char msg[]="Unexpected situation in __imod__ !";
7610 std::vector<int> aa;
7611 DataArrayIntTuple *aaa;
7613 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7618 self->applyModulus(val);
7619 Py_XINCREF(trueSelf);
7624 self->modulusEqual(a);
7625 Py_XINCREF(trueSelf);
7630 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7631 self->modulusEqual(aaaa);
7632 Py_XINCREF(trueSelf);
7636 throw INTERP_KERNEL::Exception(msg);
7640 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7642 const char msg[]="Unexpected situation in __pow__ !";
7645 std::vector<int> aa;
7646 DataArrayIntTuple *aaa;
7648 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7653 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7659 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7660 return DataArrayInt::Pow(self,aaa);
7664 return DataArrayInt::Pow(self,a);
7668 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7669 return DataArrayInt::Pow(self,aaaa);
7672 throw INTERP_KERNEL::Exception(msg);
7676 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
7678 const char msg[]="Unexpected situation in __rpow__ !";
7681 std::vector<int> aa;
7682 DataArrayIntTuple *aaa;
7684 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7689 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
7690 ret->applyRPow(val);
7695 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
7696 return DataArrayInt::Pow(aaa,self);
7700 return DataArrayInt::Pow(a,self);
7704 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7705 return DataArrayInt::Pow(aaaa,self);
7708 throw INTERP_KERNEL::Exception(msg);
7712 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
7714 const char msg[]="Unexpected situation in __ipow__ !";
7717 std::vector<int> aa;
7718 DataArrayIntTuple *aaa;
7720 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
7725 self->applyPow(val);
7726 Py_XINCREF(trueSelf);
7732 Py_XINCREF(trueSelf);
7737 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
7738 self->powEqual(aaaa);
7739 Py_XINCREF(trueSelf);
7743 throw INTERP_KERNEL::Exception(msg);
7748 namespace ParaMEDMEM
7750 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
7753 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
7754 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
7755 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
7756 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
7757 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
7758 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
7759 void setName(const char *name) throw(INTERP_KERNEL::Exception);
7760 const char *getDescription() const throw(INTERP_KERNEL::Exception);
7761 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
7762 const char *getName() const throw(INTERP_KERNEL::Exception);
7763 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
7764 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
7765 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
7766 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
7767 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
7768 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
7769 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
7770 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
7771 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
7772 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
7773 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
7774 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
7775 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
7776 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
7777 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
7778 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
7780 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
7782 MEDCouplingMesh *ret1=(MEDCouplingMesh *)self->getMesh();
7785 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
7788 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
7790 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
7793 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
7796 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
7798 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
7799 return convertIntArrToPyList3(ret);
7802 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
7805 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
7806 PyObject *ret=PyTuple_New(2);
7807 PyObject *ret0Py=ret0?Py_True:Py_False;
7809 PyTuple_SetItem(ret,0,ret0Py);
7810 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
7814 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
7816 DataArrayInt *ret1=0;
7817 MEDCouplingMesh *ret0=0;
7819 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
7820 if (!SWIG_IsOK(res1))
7823 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
7824 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
7828 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
7830 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
7831 da2->checkAllocated();
7832 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
7834 PyObject *res = PyList_New(2);
7835 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
7836 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
7840 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
7844 std::vector<int> pos2;
7845 DataArrayInt *pos3=0;
7846 DataArrayIntTuple *pos4=0;
7847 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
7852 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
7856 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
7860 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
7863 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
7867 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
7868 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
7871 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
7872 if (!SWIG_IsOK(res1))
7875 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
7876 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
7880 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
7882 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
7883 da2->checkAllocated();
7884 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
7888 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
7890 std::vector<int> tmp;
7891 self->getCellIdsHavingGaussLocalization(locId,tmp);
7892 DataArrayInt *ret=DataArrayInt::New();
7893 ret->alloc((int)tmp.size(),1);
7894 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
7895 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
7900 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
7903 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
7904 static MEDCouplingFieldTemplate *New(TypeOfField type);
7905 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
7906 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
7907 void updateTime() const;
7910 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
7912 return MEDCouplingFieldTemplate::New(f);
7915 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
7917 return MEDCouplingFieldTemplate::New(type);
7920 std::string __str__() const throw(INTERP_KERNEL::Exception)
7922 return self->simpleRepr();
7927 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
7930 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
7931 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
7932 void setTimeUnit(const char *unit);
7933 const char *getTimeUnit() const;
7934 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
7935 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
7936 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
7937 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
7938 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
7939 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
7940 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
7941 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
7942 MEDCouplingFieldDouble *deepCpy() const;
7943 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
7944 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
7945 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
7946 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
7947 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
7948 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
7949 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
7950 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
7951 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
7952 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
7953 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
7954 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
7955 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
7956 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
7957 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
7958 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
7959 void setIteration(int it) throw(INTERP_KERNEL::Exception);
7960 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
7961 void setOrder(int order) throw(INTERP_KERNEL::Exception);
7962 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
7963 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
7964 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
7965 void updateTime() const throw(INTERP_KERNEL::Exception);
7966 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
7967 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
7968 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
7969 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
7970 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
7971 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
7972 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
7973 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
7974 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
7975 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
7976 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
7977 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
7978 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
7979 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
7980 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
7981 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
7982 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
7983 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
7984 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
7985 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
7986 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
7987 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
7988 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
7989 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
7990 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
7991 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
7992 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
7993 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
7994 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
7995 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
7996 double getMaxValue() const throw(INTERP_KERNEL::Exception);
7997 double getMinValue() const throw(INTERP_KERNEL::Exception);
7998 double getAverageValue() const throw(INTERP_KERNEL::Exception);
7999 double norm2() const throw(INTERP_KERNEL::Exception);
8000 double normMax() const throw(INTERP_KERNEL::Exception);
8001 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
8002 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
8003 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
8004 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
8005 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
8006 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
8007 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8008 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8009 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8010 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8011 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8012 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8013 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8014 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8015 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8016 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8017 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8018 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8019 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
8020 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8021 MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8022 MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8023 MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8024 MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
8026 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
8028 return MEDCouplingFieldDouble::New(type,td);
8031 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
8033 return MEDCouplingFieldDouble::New(ft,td);
8036 std::string __str__() const throw(INTERP_KERNEL::Exception)
8038 return self->simpleRepr();
8041 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
8043 DataArrayDouble *ret=self->getArray();
8049 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
8051 std::vector<DataArrayDouble *> arrs=self->getArrays();
8052 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
8056 PyObject *ret=PyTuple_New(sz);
8057 for(int i=0;i<sz;i++)
8060 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
8062 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
8067 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
8069 std::vector<const DataArrayDouble *> tmp;
8070 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
8072 std::vector<DataArrayDouble *> arrs(sz);
8073 for(int i=0;i<sz;i++)
8074 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
8075 self->setArrays(arrs);
8078 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
8080 DataArrayDouble *ret=self->getEndArray();
8086 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
8090 DataArrayDoubleTuple *aa;
8091 std::vector<double> bb;
8093 const MEDCouplingMesh *mesh=self->getMesh();
8095 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
8096 int spaceDim=mesh->getSpaceDimension();
8097 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
8098 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
8100 int sz=self->getNumberOfComponents();
8101 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
8102 self->getValueOn(spaceLoc,res);
8103 return convertDblArrToPyList(res,sz);
8106 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
8108 int sz=self->getNumberOfComponents();
8109 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
8110 self->getValueOnPos(i,j,k,res);
8111 return convertDblArrToPyList(res,sz);
8114 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
8117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
8118 if (!SWIG_IsOK(res1))
8121 INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
8122 const MEDCouplingMesh *mesh=self->getMesh();
8124 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
8125 int spaceDim=mesh->getSpaceDimension();
8126 int nbOfPoints=size/spaceDim;
8127 if(size%spaceDim!=0)
8129 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
8131 return self->getValueOnMulti(tmp,nbOfPoints);
8135 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
8137 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
8138 da2->checkAllocated();
8139 int size=da2->getNumberOfTuples();
8140 int nbOfCompo=da2->getNumberOfComponents();
8141 const MEDCouplingMesh *mesh=self->getMesh();
8143 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
8144 if(nbOfCompo!=mesh->getSpaceDimension())
8146 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
8148 return self->getValueOnMulti(da2->getConstPointer(),size);
8152 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
8156 DataArrayDoubleTuple *aa;
8157 std::vector<double> bb;
8159 const MEDCouplingMesh *mesh=self->getMesh();
8161 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
8162 int spaceDim=mesh->getSpaceDimension();
8163 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
8164 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
8167 int sz=self->getNumberOfComponents();
8168 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
8169 self->getValueOn(spaceLoc,time,res);
8170 return convertDblArrToPyList(res,sz);
8173 void setValues(PyObject *li) throw(INTERP_KERNEL::Exception)
8175 if(self->getArray()!=0)
8178 double *tmp=convertPyToNewDblArr2(li,&sz);
8179 int nbTuples=self->getArray()->getNumberOfTuples();
8180 int nbOfCompo=self->getArray()->getNumberOfComponents();
8181 self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo);
8184 throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind");
8187 PyObject *getTime() throw(INTERP_KERNEL::Exception)
8190 double tmp0=self->getTime(tmp1,tmp2);
8191 PyObject *res = PyList_New(3);
8192 PyList_SetItem(res,0,SWIG_From_double(tmp0));
8193 PyList_SetItem(res,1,SWIG_From_int(tmp1));
8194 PyList_SetItem(res,2,SWIG_From_int(tmp2));
8198 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
8201 double tmp0=self->getStartTime(tmp1,tmp2);
8202 PyObject *res = PyList_New(3);
8203 PyList_SetItem(res,0,SWIG_From_double(tmp0));
8204 PyList_SetItem(res,1,SWIG_From_int(tmp1));
8205 PyList_SetItem(res,2,SWIG_From_int(tmp2));
8209 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
8212 double tmp0=self->getEndTime(tmp1,tmp2);
8213 PyObject *res = PyList_New(3);
8214 PyList_SetItem(res,0,SWIG_From_double(tmp0));
8215 PyList_SetItem(res,1,SWIG_From_int(tmp1));
8216 PyList_SetItem(res,2,SWIG_From_int(tmp2));
8219 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
8221 int sz=self->getNumberOfComponents();
8222 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
8223 self->accumulate(tmp);
8224 return convertDblArrToPyList(tmp,sz);
8226 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
8228 int sz=self->getNumberOfComponents();
8229 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
8230 self->integral(isWAbs,tmp);
8231 return convertDblArrToPyList(tmp,sz);
8233 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
8235 int sz=self->getNumberOfComponents();
8236 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
8237 self->getWeightedAverageValue(tmp,isWAbs);
8238 return convertDblArrToPyList(tmp,sz);
8240 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
8242 int sz=self->getNumberOfComponents();
8243 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
8245 return convertDblArrToPyList(tmp,sz);
8247 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
8249 int sz=self->getNumberOfComponents();
8250 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
8252 return convertDblArrToPyList(tmp,sz);
8254 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
8257 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
8258 if (!SWIG_IsOK(res1))
8261 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
8262 self->renumberCells(tmp,check);
8266 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
8268 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
8269 da2->checkAllocated();
8270 self->renumberCells(da2->getConstPointer(),check);
8273 void renumberNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
8276 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
8277 if (!SWIG_IsOK(res1))
8280 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
8281 self->renumberNodes(tmp);
8285 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
8287 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
8288 da2->checkAllocated();
8289 self->renumberNodes(da2->getConstPointer());
8293 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
8297 std::vector<int> multiVal;
8298 std::pair<int, std::pair<int,int> > slic;
8299 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
8300 const MEDCouplingMesh *mesh=self->getMesh();
8302 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
8303 int nbc=mesh->getNumberOfCells();
8304 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
8311 std::ostringstream oss;
8312 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
8313 throw INTERP_KERNEL::Exception(oss.str().c_str());
8316 return self->buildSubPart(&singleVal,&singleVal+1);
8321 int tmp=nbc+singleVal;
8322 return self->buildSubPart(&tmp,&tmp+1);
8326 std::ostringstream oss;
8327 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
8328 throw INTERP_KERNEL::Exception(oss.str().c_str());
8334 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
8338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rg=DataArrayInt::Range(slic.first,slic.second.first,slic.second.second);
8339 return self->buildSubPart(rg->begin(),rg->end());
8344 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
8345 daIntTyypp->checkAllocated();
8346 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
8349 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
8353 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
8355 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
8358 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
8361 double r1=self->getMaxValue2(tmp);
8362 PyObject *ret=PyTuple_New(2);
8363 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
8364 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
8368 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
8371 double r1=self->getMinValue2(tmp);
8372 PyObject *ret=PyTuple_New(2);
8373 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
8374 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
8378 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
8380 std::vector<int> tmp;
8381 convertPyToNewIntArr3(li,tmp);
8382 return self->keepSelectedComponents(tmp);
8385 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
8387 std::vector<int> tmp;
8388 convertPyToNewIntArr3(li,tmp);
8389 self->setSelectedComponents(f,tmp);
8392 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
8395 DataArrayDouble *a,*a2;
8396 DataArrayDoubleTuple *aa,*aa2;
8397 std::vector<double> bb,bb2;
8400 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
8401 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
8402 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
8403 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
8405 return self->extractSlice3D(orig,vect,eps);
8408 PyObject *___iadd___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
8411 Py_XINCREF(trueSelf);
8415 PyObject *___isub___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
8418 Py_XINCREF(trueSelf);
8422 PyObject *___imul___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
8425 Py_XINCREF(trueSelf);
8429 PyObject *___idiv___(PyObject *trueSelf, const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
8432 Py_XINCREF(trueSelf);
8436 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
8438 std::vector<const MEDCouplingFieldDouble *> tmp;
8439 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8440 return MEDCouplingFieldDouble::MergeFields(tmp);
8443 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
8445 std::vector<const MEDCouplingFieldDouble *> tmp;
8446 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8447 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
8452 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
8455 int getNumberOfFields() const;
8456 MEDCouplingMultiFields *deepCpy() const;
8457 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
8458 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
8459 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
8460 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
8461 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
8462 void updateTime() const throw(INTERP_KERNEL::Exception);
8465 std::string __str__() const throw(INTERP_KERNEL::Exception)
8467 return self->simpleRepr();
8469 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
8471 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
8472 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8474 std::vector<MEDCouplingFieldDouble *> fs(sz);
8475 for(int i=0;i<sz;i++)
8476 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
8477 return MEDCouplingMultiFields::New(fs);
8479 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
8481 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
8482 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8484 std::vector<MEDCouplingFieldDouble *> fs(sz);
8485 for(int i=0;i<sz;i++)
8486 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
8487 return MEDCouplingMultiFields::New(fs);
8489 PyObject *getFields() const
8491 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
8492 int sz=fields.size();
8493 PyObject *res = PyList_New(sz);
8494 for(int i=0;i<sz;i++)
8498 fields[i]->incrRef();
8499 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
8503 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
8508 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
8510 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
8514 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
8517 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
8519 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
8521 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
8523 PyObject *res = PyList_New(sz);
8524 for(int i=0;i<sz;i++)
8529 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
8533 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
8538 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
8540 std::vector<int> refs;
8541 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
8543 PyObject *res = PyList_New(sz);
8544 for(int i=0;i<sz;i++)
8549 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
8553 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
8557 PyObject *ret=PyTuple_New(2);
8558 PyTuple_SetItem(ret,0,res);
8559 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
8562 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
8564 std::vector<DataArrayDouble *> ms=self->getArrays();
8566 PyObject *res = PyList_New(sz);
8567 for(int i=0;i<sz;i++)
8572 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
8576 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
8581 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
8583 std::vector< std::vector<int> > refs;
8584 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
8586 PyObject *res = PyList_New(sz);
8587 PyObject *res2 = PyList_New(sz);
8588 for(int i=0;i<sz;i++)
8593 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
8597 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
8599 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
8602 PyObject *ret=PyTuple_New(2);
8603 PyTuple_SetItem(ret,0,res);
8604 PyTuple_SetItem(ret,1,res2);
8610 class MEDCouplingDefinitionTime
8613 MEDCouplingDefinitionTime();
8614 void assign(const MEDCouplingDefinitionTime& other);
8615 bool isEqual(const MEDCouplingDefinitionTime& other) const;
8616 double getTimeResolution() const;
8617 std::vector<double> getHotSpotsTime() const;
8620 std::string __str__() const throw(INTERP_KERNEL::Exception)
8622 std::ostringstream oss;
8623 self->appendRepr(oss);
8627 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
8629 int meshId,arrId,arrIdInField,fieldId;
8630 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
8631 PyObject *res=PyList_New(4);
8632 PyList_SetItem(res,0,PyInt_FromLong(meshId));
8633 PyList_SetItem(res,1,PyInt_FromLong(arrId));
8634 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
8635 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
8639 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
8641 int meshId,arrId,arrIdInField,fieldId;
8642 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
8643 PyObject *res=PyList_New(4);
8644 PyList_SetItem(res,0,PyInt_FromLong(meshId));
8645 PyList_SetItem(res,1,PyInt_FromLong(arrId));
8646 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
8647 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
8653 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
8656 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
8657 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
8661 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
8663 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
8664 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8666 std::vector<MEDCouplingFieldDouble *> fs(sz);
8667 for(int i=0;i<sz;i++)
8668 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
8669 return MEDCouplingFieldOverTime::New(fs);
8671 std::string __str__() const throw(INTERP_KERNEL::Exception)
8673 return self->simpleRepr();
8675 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
8677 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
8678 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
8680 std::vector<MEDCouplingFieldDouble *> fs(sz);
8681 for(int i=0;i<sz;i++)
8682 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
8683 return MEDCouplingFieldOverTime::New(fs);
8691 __filename=os.environ.get('PYTHONSTARTUP')
8692 if __filename and os.path.isfile(__filename):
8693 execfile(__filename)