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 "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingTypemaps.i"
45 #include "InterpKernelAutoPtr.hxx"
47 using namespace ParaMEDMEM;
48 using namespace INTERP_KERNEL;
52 %template(ivec) std::vector<int>;
53 %template(dvec) std::vector<double>;
54 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
63 $result=convertMesh($1,$owner);
66 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
68 $result=convertMesh($1,$owner);
71 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
73 $result=convertMesh($1,$owner);
76 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
78 $result=convertFieldDiscretization($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
83 $result=convertMultiFields($1,$owner);
86 %typemap(out) ParaMEDMEM::DataArray*
88 $result=convertDataArray($1,$owner);
91 %typemap(out) ParaMEDMEM::DataArrayChar*
93 $result=convertDataArrayChar($1,$owner);
97 %init %{ import_array(); %}
100 %feature("autodoc", "1");
101 %feature("docstring");
103 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::New;
104 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
105 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::deepCpy;
106 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone;
107 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
108 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePartRange;
109 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getMeasureField;
110 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
111 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getLocalizationOfDiscValues;
112 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getValueOnMulti;
113 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::computeTupleIdsToSelectFromCellIds;
114 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshData;
115 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
116 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
117 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
124 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
125 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
126 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
127 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
128 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
129 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
130 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
131 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
132 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
133 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
134 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
135 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
136 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
137 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
166 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
167 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
168 %newobject ParaMEDMEM::DataArrayInt::New;
169 %newobject ParaMEDMEM::DataArrayInt::__iter__;
170 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
171 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
172 %newobject ParaMEDMEM::DataArrayInt::performCpy;
173 %newobject ParaMEDMEM::DataArrayInt::substr;
174 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
175 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
176 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
177 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
178 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
179 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
180 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
181 %newobject ParaMEDMEM::DataArrayInt::renumber;
182 %newobject ParaMEDMEM::DataArrayInt::renumberR;
183 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
184 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
185 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
186 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
187 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
188 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
189 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
190 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
191 %newobject ParaMEDMEM::DataArrayInt::negate;
192 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
193 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
194 %newobject ParaMEDMEM::DataArrayInt::Meld;
195 %newobject ParaMEDMEM::DataArrayInt::Add;
196 %newobject ParaMEDMEM::DataArrayInt::Substract;
197 %newobject ParaMEDMEM::DataArrayInt::Multiply;
198 %newobject ParaMEDMEM::DataArrayInt::Divide;
199 %newobject ParaMEDMEM::DataArrayInt::Pow;
200 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
201 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
202 %newobject ParaMEDMEM::DataArrayInt::Range;
203 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
204 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
205 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
206 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
207 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
208 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
209 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
210 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
211 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
212 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
213 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
214 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
215 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
216 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
217 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
218 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
219 %newobject ParaMEDMEM::DataArrayInt::__neg__;
220 %newobject ParaMEDMEM::DataArrayInt::__add__;
221 %newobject ParaMEDMEM::DataArrayInt::__radd__;
222 %newobject ParaMEDMEM::DataArrayInt::__sub__;
223 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
224 %newobject ParaMEDMEM::DataArrayInt::__mul__;
225 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
226 %newobject ParaMEDMEM::DataArrayInt::__div__;
227 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
228 %newobject ParaMEDMEM::DataArrayInt::__mod__;
229 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
230 %newobject ParaMEDMEM::DataArrayInt::__pow__;
231 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
232 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
233 %newobject ParaMEDMEM::DataArrayChar::deepCpy;
234 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
235 %newobject ParaMEDMEM::DataArrayChar::renumber;
236 %newobject ParaMEDMEM::DataArrayChar::renumberR;
237 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
238 %newobject ParaMEDMEM::DataArrayChar::selectByTupleIdSafe;
239 %newobject ParaMEDMEM::DataArrayChar::selectByTupleId2;
240 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
241 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
242 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
243 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
244 %newobject ParaMEDMEM::DataArrayChar::Meld;
245 %newobject ParaMEDMEM::DataArrayByte::New;
246 %newobject ParaMEDMEM::DataArrayByte::__iter__;
247 %newobject ParaMEDMEM::DataArrayByte::performCpy;
248 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
249 %newobject ParaMEDMEM::DataArrayChar::substr;
250 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
251 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
252 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
253 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
254 %newobject ParaMEDMEM::DataArrayDouble::New;
255 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
256 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
257 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
258 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
259 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
260 %newobject ParaMEDMEM::DataArrayDouble::Meld;
261 %newobject ParaMEDMEM::DataArrayDouble::Dot;
262 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
263 %newobject ParaMEDMEM::DataArrayDouble::Add;
264 %newobject ParaMEDMEM::DataArrayDouble::Substract;
265 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
266 %newobject ParaMEDMEM::DataArrayDouble::Divide;
267 %newobject ParaMEDMEM::DataArrayDouble::Pow;
268 %newobject ParaMEDMEM::DataArrayDouble::substr;
269 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
270 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
271 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
272 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
273 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
274 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
275 %newobject ParaMEDMEM::DataArrayDouble::negate;
276 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
277 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
278 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
279 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
280 %newobject ParaMEDMEM::DataArrayDouble::determinant;
281 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
282 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
283 %newobject ParaMEDMEM::DataArrayDouble::inverse;
284 %newobject ParaMEDMEM::DataArrayDouble::trace;
285 %newobject ParaMEDMEM::DataArrayDouble::deviator;
286 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
287 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
288 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
289 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
290 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
291 %newobject ParaMEDMEM::DataArrayDouble::renumber;
292 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
293 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
294 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
295 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
296 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
297 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
298 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
299 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
300 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
301 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
302 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
303 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
304 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
305 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
306 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
307 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
308 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
309 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
310 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
311 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
312 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
313 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
314 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
315 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
316 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
317 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
318 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
319 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
320 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
321 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
322 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
323 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
324 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
325 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
326 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
327 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
328 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
329 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
330 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
331 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
332 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
333 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
334 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
335 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
336 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
337 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
338 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
339 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
340 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
341 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
342 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
343 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
344 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
345 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
346 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
347 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
348 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
349 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
350 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
351 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
352 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
353 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
354 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
355 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
356 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
357 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
358 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
359 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
360 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
361 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
362 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
363 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
364 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
365 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
366 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
367 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
368 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
369 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
370 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
371 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
372 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
373 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
374 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
375 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
376 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
377 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
378 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
379 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
380 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
381 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
382 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
383 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
384 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
385 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
386 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
387 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
388 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::getNodalConnectivity;
389 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
390 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
391 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
392 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
393 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
394 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
395 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
396 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
397 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
398 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
399 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
400 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
401 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
402 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
404 %feature("unref") DataArray "$this->decrRef();"
405 %feature("unref") DataArrayDouble "$this->decrRef();"
406 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
407 %feature("unref") MEDCouplingMesh "$this->decrRef();"
408 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
409 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
410 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
411 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
412 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
413 %feature("unref") DataArrayInt "$this->decrRef();"
414 %feature("unref") DataArrayChar "$this->decrRef();"
415 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
416 %feature("unref") DataArrayByte "$this->decrRef();"
417 %feature("unref") MEDCouplingField "$this->decrRef();"
418 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
419 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
420 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
421 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
422 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
423 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
424 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
425 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
426 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
428 %rename(assign) *::operator=;
429 %ignore ParaMEDMEM::RefCountObject::decrRef;
430 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
431 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
432 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
433 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
437 %rename (InterpKernelException) INTERP_KERNEL::Exception;
439 namespace INTERP_KERNEL
444 Exception(const char* what);
445 ~Exception() throw ();
446 const char *what() const throw ();
449 std::string __str__() const
451 return std::string(self->what());
462 void declareAsNew() const;
463 virtual void updateTime() const;
464 unsigned int getTimeOfThis() const;
492 CONST_ON_TIME_INTERVAL = 7
493 } TypeOfTimeDiscretization;
495 const char *MEDCouplingVersionStr();
496 int MEDCouplingVersion();
497 int MEDCouplingSizeOfVoidStar();
503 RefCountObject(const RefCountObject& other);
506 bool decrRef() const;
507 void incrRef() const;
508 virtual std::size_t getHeapMemorySize() const;
514 PyObject *MEDCouplingVersionMajMinRel()
516 int tmp0=0,tmp1=0,tmp2=0;
517 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
518 PyObject *res = PyList_New(3);
519 PyList_SetItem(res,0,SWIG_From_int(tmp0));
520 PyList_SetItem(res,1,SWIG_From_int(tmp1));
521 PyList_SetItem(res,2,SWIG_From_int(tmp2));
525 bool MEDCouplingHasNumPyBindings()
534 std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
536 static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
537 std::ostringstream oss; oss << "MEDCouplingCompletionScript : error when trying to activate completion ! readline not present ?\nScript is :\n" << script;
538 if(PyRun_SimpleString(script)!=0)
539 throw INTERP_KERNEL::Exception(oss.str().c_str());
540 return std::string(script);
544 %include "MEDCouplingMemArray.i"
551 UNSTRUCTURED_DESC = 6,
555 } MEDCouplingMeshType;
558 class DataArrayDouble;
559 class MEDCouplingUMesh;
560 class MEDCouplingFieldDouble;
562 %extend RefCountObject
564 std::string getHiddenCppPointer() const
566 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
571 %extend MEDCouplingGaussLocalization
573 std::string __str__() const throw(INTERP_KERNEL::Exception)
575 return self->getStringRepr();
578 std::string __repr__() const throw(INTERP_KERNEL::Exception)
580 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
581 oss << self->getStringRepr();
588 class MEDCouplingMesh : public RefCountObject, public TimeLabel
591 void setName(const char *name);
592 const char *getName() const;
593 void setDescription(const char *descr);
594 const char *getDescription() const;
595 void setTime(double val, int iteration, int order);
596 void setTimeUnit(const char *unit);
597 const char *getTimeUnit() const;
598 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
599 bool isStructured() const throw(INTERP_KERNEL::Exception);
600 virtual MEDCouplingMesh *deepCpy() const;
601 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
602 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
603 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
604 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
605 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
606 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
607 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
608 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
609 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
610 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
611 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
612 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
613 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
614 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
615 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
616 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
617 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
618 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
619 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
620 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
621 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
622 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
623 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
624 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
626 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
627 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
628 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
629 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
630 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
631 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
632 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
633 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
634 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
635 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
636 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
637 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
638 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
639 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
640 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
641 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
642 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
645 std::string __str__() const throw(INTERP_KERNEL::Exception)
647 return self->simpleRepr();
650 PyObject *getTime() throw(INTERP_KERNEL::Exception)
653 double tmp0=self->getTime(tmp1,tmp2);
654 PyObject *res = PyList_New(3);
655 PyList_SetItem(res,0,SWIG_From_double(tmp0));
656 PyList_SetItem(res,1,SWIG_From_int(tmp1));
657 PyList_SetItem(res,2,SWIG_From_int(tmp2));
661 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
665 DataArrayDoubleTuple *aa;
666 std::vector<double> bb;
668 int spaceDim=self->getSpaceDimension();
669 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
670 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
671 return self->getCellContainingPoint(pos,eps);
674 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
678 DataArrayDoubleTuple *aa;
679 std::vector<double> bb;
681 int spaceDim=self->getSpaceDimension();
682 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
683 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
684 std::vector<int> elts,eltsIndex;
685 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
686 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
687 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
688 d0->alloc(elts.size(),1);
689 d1->alloc(eltsIndex.size(),1);
690 std::copy(elts.begin(),elts.end(),d0->getPointer());
691 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
692 PyObject *ret=PyTuple_New(2);
693 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
694 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
698 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
700 std::vector<int> elts,eltsIndex;
701 int spaceDim=self->getSpaceDimension();
703 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
704 if (!SWIG_IsOK(res1))
707 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
708 int nbOfPoints=size/spaceDim;
711 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
713 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
717 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
719 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
720 da2->checkAllocated();
721 int size=da2->getNumberOfTuples();
722 int nbOfCompo=da2->getNumberOfComponents();
723 if(nbOfCompo!=spaceDim)
725 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
727 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
729 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
730 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
731 d0->alloc(elts.size(),1);
732 d1->alloc(eltsIndex.size(),1);
733 std::copy(elts.begin(),elts.end(),d0->getPointer());
734 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
735 PyObject *ret=PyTuple_New(2);
736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
741 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
745 DataArrayDoubleTuple *aa;
746 std::vector<double> bb;
748 int spaceDim=self->getSpaceDimension();
749 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
750 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
751 std::vector<int> elts;
752 self->getCellsContainingPoint(pos,eps,elts);
753 DataArrayInt *ret=DataArrayInt::New();
754 ret->alloc((int)elts.size(),1);
755 std::copy(elts.begin(),elts.end(),ret->getPointer());
756 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
759 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
762 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
763 if (!SWIG_IsOK(res1))
766 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
767 self->renumberCells(tmp,check);
771 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
773 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
774 da2->checkAllocated();
775 self->renumberCells(da2->getConstPointer(),check);
779 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
781 DataArrayInt *cellCor, *nodeCor;
782 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
783 PyObject *res = PyList_New(2);
784 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
785 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
789 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
791 DataArrayInt *cellCor=0,*nodeCor=0;
792 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
793 PyObject *res = PyList_New(2);
794 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
795 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
799 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
801 DataArrayInt *cellCor=0;
802 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
806 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
809 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
810 if (!SWIG_IsOK(res1))
813 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
814 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
818 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
820 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
821 da2->checkAllocated();
822 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
825 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
827 std::vector<int> conn;
828 self->getNodeIdsOfCell(cellId,conn);
829 return convertIntArrToPyList2(conn);
832 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
834 std::vector<double> coo;
835 self->getCoordinatesOfNode(nodeId,coo);
836 return convertDblArrToPyList2(coo);
839 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
843 DataArrayDoubleTuple *aa;
844 std::vector<double> bb;
846 int spaceDim=self->getSpaceDimension();
847 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
848 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
849 self->scale(pointPtr,factor);
852 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
854 int spaceDim=self->getSpaceDimension();
855 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
856 self->getBoundingBox(tmp);
857 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
861 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
864 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
865 PyObject *ret=PyTuple_New(2);
866 PyObject *ret0Py=ret0?Py_True:Py_False;
868 PyTuple_SetItem(ret,0,ret0Py);
869 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
873 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
875 int szArr,sw,iTypppArr;
876 std::vector<int> stdvecTyyppArr;
877 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
878 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
879 if(sw==3)//DataArrayInt
881 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
882 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
883 std::string name=argpt->getName();
885 ret->setName(name.c_str());
887 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
890 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
892 int szArr,sw,iTypppArr;
893 std::vector<int> stdvecTyyppArr;
895 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
896 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
897 if(sw==3)//DataArrayInt
899 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
900 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
901 std::string name=argpt->getName();
903 ret->setName(name.c_str());
906 PyObject *res = PyList_New(2);
907 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
908 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
909 PyList_SetItem(res,0,obj0);
910 PyList_SetItem(res,1,obj1);
914 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
918 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
919 PyObject *res = PyTuple_New(2);
920 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
923 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
925 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
926 PyTuple_SetItem(res,0,obj0);
927 PyTuple_SetItem(res,1,obj1);
931 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
933 std::vector<int> vals=self->getDistributionOfTypes();
934 PyObject *ret=PyList_New((int)vals.size()/3);
935 for(int j=0;j<(int)vals.size()/3;j++)
937 PyObject *ret1=PyList_New(3);
938 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
939 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
940 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
941 PyList_SetItem(ret,j,ret1);
946 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
948 std::vector<int> code;
949 std::vector<const DataArrayInt *> idsPerType;
950 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
951 convertPyToNewIntArr4(li,1,3,code);
952 return self->checkTypeConsistencyAndContig(code,idsPerType);
955 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
957 std::vector<int> code;
958 std::vector<DataArrayInt *> idsInPflPerType;
959 std::vector<DataArrayInt *> idsPerType;
960 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
961 PyObject *ret=PyTuple_New(3);
962 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
963 PyObject *ret1=PyList_New(idsInPflPerType.size());
964 for(std::size_t j=0;j<idsInPflPerType.size();j++)
965 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
966 PyTuple_SetItem(ret,1,ret1);
967 int n=idsPerType.size();
968 PyObject *ret2=PyList_New(n);
970 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
971 PyTuple_SetItem(ret,2,ret2);
975 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
979 DataArrayDoubleTuple *aa;
980 std::vector<double> bb;
982 int spaceDim=self->getSpaceDimension();
983 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
984 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
985 self->translate(vectorPtr);
988 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
990 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
993 DataArrayDoubleTuple *aa;
994 std::vector<double> bb;
996 int spaceDim=self->getSpaceDimension();
997 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
998 self->rotate(centerPtr,0,alpha);
1001 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
1003 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1005 DataArrayDouble *a,*a2;
1006 DataArrayDoubleTuple *aa,*aa2;
1007 std::vector<double> bb,bb2;
1009 int spaceDim=self->getSpaceDimension();
1010 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1011 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
1012 self->rotate(centerPtr,vectorPtr,alpha);
1015 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
1017 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1018 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1019 PyObject *res=PyList_New(result.size());
1020 for(int i=0;iL!=result.end(); i++, iL++)
1021 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1025 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
1027 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
1028 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1029 return MEDCouplingMesh::MergeMeshes(tmp);
1035 //== MEDCouplingMesh End
1037 %include "NormalizedUnstructuredMesh.hxx"
1038 %include "MEDCouplingNatureOfField.hxx"
1039 %include "MEDCouplingTimeDiscretization.hxx"
1040 %include "MEDCouplingGaussLocalization.hxx"
1041 %include "MEDCouplingFieldDiscretization.hxx"
1043 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
1044 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshDataRange;
1045 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
1047 //== MEDCouplingPointSet
1049 namespace ParaMEDMEM
1051 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1054 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1055 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1056 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1057 void zipCoords() throw(INTERP_KERNEL::Exception);
1058 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1059 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1060 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1061 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1062 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1063 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1064 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1065 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1066 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1067 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1068 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1069 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1070 virtual DataArrayInt *findBoundaryNodes() const;
1071 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1072 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1073 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1074 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1077 std::string __str__() const throw(INTERP_KERNEL::Exception)
1079 return self->simpleRepr();
1082 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1085 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1086 PyObject *res = PyList_New(2);
1087 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1088 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1092 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1094 DataArrayInt *comm, *commIndex;
1095 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1096 PyObject *res = PyList_New(2);
1097 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1098 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1102 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1104 DataArrayDouble *ret1=self->getCoords();
1107 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1110 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1112 int szArr,sw,iTypppArr;
1113 std::vector<int> stdvecTyyppArr;
1114 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1115 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1116 if(sw==3)//DataArrayInt
1118 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1119 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1120 std::string name=argpt->getName();
1122 ret->setName(name.c_str());
1124 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1127 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1129 int szArr,sw,iTypppArr;
1130 std::vector<int> stdvecTyyppArr;
1131 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1132 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1133 if(sw==3)//DataArrayInt
1135 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1136 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1137 std::string name=argpt->getName();
1139 ret->setName(name.c_str());
1141 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1144 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1146 int szArr,sw,iTypppArr;
1147 std::vector<int> stdvecTyyppArr;
1148 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1149 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1150 if(sw==3)//DataArrayInt
1152 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1153 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1154 std::string name=argpt->getName();
1156 ret->setName(name.c_str());
1158 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1161 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1163 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1164 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1167 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1169 int szArr,sw,iTypppArr;
1170 std::vector<int> stdvecTyyppArr;
1171 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1172 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1173 if(sw==3)//DataArrayInt
1175 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1176 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1177 std::string name=argpt->getName();
1179 ret->setName(name.c_str());
1181 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1184 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1186 int szArr,sw,iTypppArr;
1187 std::vector<int> stdvecTyyppArr;
1188 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1189 self->renumberNodes(tmp,newNbOfNodes);
1192 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1194 int szArr,sw,iTypppArr;
1195 std::vector<int> stdvecTyyppArr;
1196 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1197 self->renumberNodes2(tmp,newNbOfNodes);
1200 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1202 int spaceDim=self->getSpaceDimension();
1204 DataArrayDouble *a,*a2;
1205 DataArrayDoubleTuple *aa,*aa2;
1206 std::vector<double> bb,bb2;
1208 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1209 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1210 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1211 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1212 std::vector<int> nodes;
1213 self->findNodesOnLine(p,v,eps,nodes);
1214 DataArrayInt *ret=DataArrayInt::New();
1215 ret->alloc((int)nodes.size(),1);
1216 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1219 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1221 int spaceDim=self->getSpaceDimension();
1223 DataArrayDouble *a,*a2;
1224 DataArrayDoubleTuple *aa,*aa2;
1225 std::vector<double> bb,bb2;
1227 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1228 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1229 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1230 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1231 std::vector<int> nodes;
1232 self->findNodesOnPlane(p,v,eps,nodes);
1233 DataArrayInt *ret=DataArrayInt::New();
1234 ret->alloc((int)nodes.size(),1);
1235 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1236 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1239 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1243 DataArrayDoubleTuple *aa;
1244 std::vector<double> bb;
1246 int spaceDim=self->getSpaceDimension();
1247 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1248 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1249 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1253 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1255 DataArrayInt *c=0,*cI=0;
1259 DataArrayDoubleTuple *aa;
1260 std::vector<double> bb;
1262 int spaceDim=self->getSpaceDimension();
1263 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1264 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1265 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1266 PyObject *ret=PyTuple_New(2);
1267 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1268 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1272 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1274 DataArrayInt *c=0,*cI=0;
1275 int spaceDim=self->getSpaceDimension();
1278 DataArrayDoubleTuple *aa;
1279 std::vector<double> bb;
1282 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1283 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1285 PyObject *ret=PyTuple_New(2);
1286 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1287 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1295 DataArrayDoubleTuple *aa;
1296 std::vector<double> bb;
1298 int spaceDim=self->getSpaceDimension();
1299 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1300 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1302 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1303 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1306 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1310 std::vector<int> multiVal;
1311 std::pair<int, std::pair<int,int> > slic;
1312 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1313 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1317 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1319 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1321 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1323 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1327 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1329 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1330 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1331 self->getReverseNodalConnectivity(d0,d1);
1332 PyObject *ret=PyTuple_New(2);
1333 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1334 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1338 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1340 DataArrayInt *v0=0,*v1=0;
1341 self->findCommonCells(compType,startCellId,v0,v1);
1342 PyObject *res = PyList_New(2);
1343 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1344 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1349 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1352 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1353 if (!SWIG_IsOK(res1))
1356 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1357 self->renumberNodesInConn(tmp);
1361 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1363 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1364 da2->checkAllocated();
1365 self->renumberNodesInConn(da2->getConstPointer());
1369 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1372 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1373 PyObject *ret=PyTuple_New(2);
1374 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1375 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1379 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1381 DataArrayInt *ret=0;
1383 int szArr,sw,iTypppArr;
1384 std::vector<int> stdvecTyyppArr;
1385 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1386 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1390 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1394 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1395 PyObject *res = PyList_New(3);
1396 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1397 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1398 PyList_SetItem(res,2,SWIG_From_int(ret2));
1402 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1406 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1407 PyObject *res = PyList_New(3);
1408 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1409 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1410 PyList_SetItem(res,2,SWIG_From_int(ret2));
1414 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1417 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1418 if (!SWIG_IsOK(res1))
1421 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1422 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1426 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1428 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1429 da2->checkAllocated();
1430 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1434 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1437 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1438 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1439 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1440 for(int i=0;i<sz;i++)
1441 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1444 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1447 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1449 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1450 std::vector<double> val3;
1451 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1452 "Rotate2DAlg",2,true,nbNodes);
1454 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1455 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1458 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1461 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1462 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1463 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1464 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1465 for(int i=0;i<sz;i++)
1466 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1469 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1472 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1474 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1475 std::vector<double> val3;
1476 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1477 "Rotate3DAlg",3,true,nbNodes);
1479 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1480 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1481 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1486 //== MEDCouplingPointSet End
1488 class MEDCouplingUMeshCell
1491 INTERP_KERNEL::NormalizedCellType getType() const;
1494 std::string __str__() const throw(INTERP_KERNEL::Exception)
1496 return self->repr();
1499 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1502 const int *r=self->getAllConn(ret2);
1503 PyObject *ret=PyTuple_New(ret2);
1504 for(int i=0;i<ret2;i++)
1505 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1511 class MEDCouplingUMeshCellIterator
1518 MEDCouplingUMeshCell *ret=self->nextt();
1520 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1523 PyErr_SetString(PyExc_StopIteration,"No more data.");
1530 class MEDCouplingUMeshCellByTypeIterator
1533 ~MEDCouplingUMeshCellByTypeIterator();
1538 MEDCouplingUMeshCellEntry *ret=self->nextt();
1540 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1543 PyErr_SetString(PyExc_StopIteration,"No more data.");
1550 class MEDCouplingUMeshCellByTypeEntry
1553 ~MEDCouplingUMeshCellByTypeEntry();
1556 MEDCouplingUMeshCellByTypeIterator *__iter__()
1558 return self->iterator();
1563 class MEDCouplingUMeshCellEntry
1566 INTERP_KERNEL::NormalizedCellType getType() const;
1567 int getNumberOfElems() const;
1570 MEDCouplingUMeshCellIterator *__iter__()
1572 return self->iterator();
1577 //== MEDCouplingUMesh
1579 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1582 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1583 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1584 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1585 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1586 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1587 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1588 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1589 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1590 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1591 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1592 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1593 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1594 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1595 void computeTypes() throw(INTERP_KERNEL::Exception);
1596 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1597 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1599 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1600 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1601 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1602 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1603 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1604 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1605 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1606 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1607 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1608 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1609 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1610 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1611 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1612 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1613 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1614 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1615 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1616 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1617 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1618 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1619 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1620 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1621 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1622 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1623 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1624 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1625 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1626 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1627 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1628 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1629 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1630 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1631 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1632 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1633 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1634 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1635 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1636 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1638 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1640 return MEDCouplingUMesh::New();
1643 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1645 return MEDCouplingUMesh::New(meshName,meshDim);
1648 std::string __str__() const throw(INTERP_KERNEL::Exception)
1650 return self->simpleRepr();
1653 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1655 std::ostringstream oss;
1656 self->reprQuickOverview(oss);
1660 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1662 return self->cellIterator();
1665 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1669 std::vector<int> multiVal;
1670 std::pair<int, std::pair<int,int> > slic;
1671 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1672 int nbc=self->getNumberOfCells();
1673 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1680 std::ostringstream oss;
1681 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1682 throw INTERP_KERNEL::Exception(oss.str().c_str());
1685 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1690 int tmp=nbc+singleVal;
1691 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1695 std::ostringstream oss;
1696 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1697 throw INTERP_KERNEL::Exception(oss.str().c_str());
1703 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1707 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1712 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1713 daIntTyypp->checkAllocated();
1714 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1717 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1721 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1725 std::vector<int> multiVal;
1726 std::pair<int, std::pair<int,int> > slic;
1727 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1728 int nbc=self->getNumberOfCells();
1729 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1736 std::ostringstream oss;
1737 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1738 throw INTERP_KERNEL::Exception(oss.str().c_str());
1742 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1749 int tmp=nbc+singleVal;
1750 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1755 std::ostringstream oss;
1756 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1757 throw INTERP_KERNEL::Exception(oss.str().c_str());
1763 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1769 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1770 daIntTyypp->checkAllocated();
1771 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1775 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1779 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1783 std::vector<int> multiVal;
1784 std::pair<int, std::pair<int,int> > slic;
1785 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1786 int nbc=self->getNumberOfCells();
1787 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1794 std::ostringstream oss;
1795 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1796 throw INTERP_KERNEL::Exception(oss.str().c_str());
1800 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1807 int tmp=nbc+singleVal;
1808 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1813 std::ostringstream oss;
1814 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1815 throw INTERP_KERNEL::Exception(oss.str().c_str());
1821 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1826 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1832 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1833 daIntTyypp->checkAllocated();
1834 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1838 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1842 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1844 int szArr,sw,iTypppArr;
1845 std::vector<int> stdvecTyyppArr;
1846 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1849 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1850 throw INTERP_KERNEL::Exception(oss.str().c_str());
1852 self->insertNextCell(type,size,tmp);
1855 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1857 int szArr,sw,iTypppArr;
1858 std::vector<int> stdvecTyyppArr;
1859 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1860 self->insertNextCell(type,szArr,tmp);
1863 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1865 DataArrayInt *ret=self->getNodalConnectivity();
1870 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1872 DataArrayInt *ret=self->getNodalConnectivityIndex();
1877 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1879 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1880 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1881 PyObject *res = PyList_New(result.size());
1882 for (int i=0;iL!=result.end(); i++, iL++)
1883 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1887 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1889 int szArr,sw,iTypppArr;
1890 std::vector<int> stdvecTyyppArr;
1891 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1892 int nbOfDepthPeelingPerformed=0;
1893 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1894 PyObject *res=PyTuple_New(2);
1895 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1896 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1900 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1902 DataArrayInt *v0=0,*v1=0;
1903 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1904 PyObject *res = PyList_New(2);
1905 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1906 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1910 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1914 DataArrayDoubleTuple *aa;
1915 std::vector<double> bb;
1917 int nbOfCompo=self->getSpaceDimension();
1918 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1921 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1922 PyObject *ret=PyTuple_New(2);
1923 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1924 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1928 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1930 DataArrayInt *ret1=0;
1931 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1932 PyObject *ret=PyTuple_New(2);
1933 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1934 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1938 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1940 std::vector<int> cells;
1941 self->checkButterflyCells(cells,eps);
1942 DataArrayInt *ret=DataArrayInt::New();
1943 ret->alloc((int)cells.size(),1);
1944 std::copy(cells.begin(),cells.end(),ret->getPointer());
1945 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1948 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1950 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1952 PyObject *ret = PyList_New(sz);
1953 for(int i=0;i<sz;i++)
1954 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1958 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1960 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1961 int sz=retCpp.size();
1962 PyObject *ret=PyList_New(sz);
1963 for(int i=0;i<sz;i++)
1964 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1968 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1971 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1972 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1973 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1976 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1979 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1980 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1984 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1987 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1988 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1992 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1994 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1995 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1996 PyObject *ret=PyTuple_New(3);
1997 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1998 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1999 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2003 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2005 DataArrayInt *tmp0=0,*tmp1=0;
2006 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2007 PyObject *ret=PyTuple_New(2);
2008 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2009 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2013 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2017 std::vector<int> multiVal;
2018 std::pair<int, std::pair<int,int> > slic;
2019 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2020 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2024 return self->duplicateNodes(&singleVal,&singleVal+1);
2026 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2028 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2030 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2034 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2038 std::vector<int> multiVal;
2039 std::pair<int, std::pair<int,int> > slic;
2040 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2041 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2045 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2047 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2049 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2051 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2055 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2058 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2059 DataArrayInt *tmp0,*tmp1=0;
2060 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2061 PyObject *ret=PyTuple_New(2);
2062 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2063 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2067 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2069 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2070 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2071 DataArrayInt *ret1=0,*ret2=0;
2072 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2073 PyObject *ret=PyTuple_New(3);
2074 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2075 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2076 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2080 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2082 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2083 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2084 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2085 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2088 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2091 std::vector<const MEDCouplingUMesh *> meshes;
2092 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2093 std::vector<DataArrayInt *> corr;
2094 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2096 PyObject *ret1=PyList_New(sz);
2097 for(int i=0;i<sz;i++)
2098 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2099 PyObject *ret=PyList_New(2);
2100 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2101 PyList_SetItem(ret,1,ret1);
2105 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2107 std::vector<MEDCouplingUMesh *> meshes;
2108 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2109 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2112 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2114 std::vector<MEDCouplingUMesh *> meshes;
2115 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2116 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2119 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2123 std::vector<int> multiVal;
2124 std::pair<int, std::pair<int,int> > slic;
2125 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2127 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2128 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2132 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2134 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2136 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2138 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2142 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2144 DataArrayInt *arrOut=0,*arrIndexOut=0;
2147 std::vector<int> multiVal;
2148 std::pair<int, std::pair<int,int> > slic;
2149 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2151 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2152 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2157 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2162 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2167 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2171 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2173 PyObject *ret=PyTuple_New(2);
2174 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2175 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2179 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2180 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2181 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2183 DataArrayInt *arrOut=0,*arrIndexOut=0;
2186 std::vector<int> multiVal;
2187 std::pair<int, std::pair<int,int> > slic;
2188 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2190 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2191 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2196 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2201 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2206 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2210 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2212 PyObject *ret=PyTuple_New(2);
2213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2218 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2219 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2223 std::vector<int> multiVal;
2224 std::pair<int, std::pair<int,int> > slic;
2225 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2227 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2228 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2233 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2238 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2243 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2247 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2251 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2255 DataArrayDoubleTuple *aa;
2256 std::vector<double> bb;
2258 int spaceDim=self->getSpaceDimension();
2259 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2260 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2262 std::vector<int> cells;
2263 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2264 DataArrayInt *ret=DataArrayInt::New();
2265 ret->alloc((int)cells.size(),1);
2266 std::copy(cells.begin(),cells.end(),ret->getPointer());
2267 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2270 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2274 DataArrayDoubleTuple *aa;
2275 std::vector<double> bb;
2277 int spaceDim=self->getSpaceDimension();
2278 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2279 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2280 self->orientCorrectly2DCells(v,polyOnly);
2283 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2285 std::vector<int> cells;
2286 self->arePolyhedronsNotCorrectlyOriented(cells);
2287 DataArrayInt *ret=DataArrayInt::New();
2288 ret->alloc((int)cells.size(),1);
2289 std::copy(cells.begin(),cells.end(),ret->getPointer());
2290 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2293 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2297 self->getFastAveragePlaneOfThis(vec,pos);
2299 std::copy(vec,vec+3,vals);
2300 std::copy(pos,pos+3,vals+3);
2301 return convertDblArrToPyListOfTuple(vals,3,2);
2304 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2306 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2307 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2308 return MEDCouplingUMesh::MergeUMeshes(tmp);
2311 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2314 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2315 PyObject *ret=PyTuple_New(2);
2316 PyObject *ret0Py=ret0?Py_True:Py_False;
2318 PyTuple_SetItem(ret,0,ret0Py);
2319 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2326 bool ret0=self->areCellsIncludedIn2(other,ret1);
2327 PyObject *ret=PyTuple_New(2);
2328 PyObject *ret0Py=ret0?Py_True:Py_False;
2330 PyTuple_SetItem(ret,0,ret0Py);
2331 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2335 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2337 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2339 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2340 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2341 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2342 PyObject *ret=PyTuple_New(5);
2343 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2344 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2345 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2351 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2353 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2354 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2355 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2357 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2358 PyObject *ret=PyTuple_New(5);
2359 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2360 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2361 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2362 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2367 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2369 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2370 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2371 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2372 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2373 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2374 PyObject *ret=PyTuple_New(5);
2375 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2376 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2377 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2378 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2385 DataArrayInt *neighbors=0,*neighborsIdx=0;
2386 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2387 PyObject *ret=PyTuple_New(2);
2388 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2395 DataArrayInt *neighbors=0,*neighborsIdx=0;
2396 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2397 PyObject *ret=PyTuple_New(2);
2398 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2399 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2403 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2405 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2406 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2407 DataArrayInt *d2,*d3,*d4,*dd5;
2408 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2409 PyObject *ret=PyTuple_New(7);
2410 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2411 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2413 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2414 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2415 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2416 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2420 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2423 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2424 da->checkAllocated();
2425 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2428 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2431 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2432 da->checkAllocated();
2433 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2436 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2439 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2440 da->checkAllocated();
2441 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2444 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2447 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2448 da->checkAllocated();
2449 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2450 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2451 PyObject *res = PyList_New(result.size());
2452 for (int i=0;iL!=result.end(); i++, iL++)
2453 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2457 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2460 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2461 da->checkAllocated();
2462 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2463 ret->setName(da->getName().c_str());
2467 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2469 DataArrayInt *cellNb1=0,*cellNb2=0;
2470 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2471 PyObject *ret=PyTuple_New(3);
2472 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2473 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2474 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2478 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2480 int spaceDim=self->getSpaceDimension();
2482 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2484 DataArrayDouble *a,*a2;
2485 DataArrayDoubleTuple *aa,*aa2;
2486 std::vector<double> bb,bb2;
2488 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2489 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2490 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2491 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2493 DataArrayInt *cellIds=0;
2494 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2495 PyObject *ret=PyTuple_New(2);
2496 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2497 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2501 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2503 int spaceDim=self->getSpaceDimension();
2505 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2507 DataArrayDouble *a,*a2;
2508 DataArrayDoubleTuple *aa,*aa2;
2509 std::vector<double> bb,bb2;
2511 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2512 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2513 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2514 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2516 DataArrayInt *cellIds=0;
2517 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2518 PyObject *ret=PyTuple_New(2);
2519 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2520 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2524 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2526 int spaceDim=self->getSpaceDimension();
2528 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2530 DataArrayDouble *a,*a2;
2531 DataArrayDoubleTuple *aa,*aa2;
2532 std::vector<double> bb,bb2;
2534 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2535 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2536 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2537 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2538 return self->getCellIdsCrossingPlane(orig,vect,eps);
2541 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2545 std::vector<int> pos2;
2546 DataArrayInt *pos3=0;
2547 DataArrayIntTuple *pos4=0;
2548 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2553 self->convertToPolyTypes(&pos1,&pos1+1);
2560 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2565 self->convertToPolyTypes(pos3->begin(),pos3->end());
2569 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2573 void convertAllToPoly();
2574 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2575 bool unPolyze() throw(INTERP_KERNEL::Exception);
2576 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2577 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2578 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2581 //== MEDCouplingUMesh End
2583 //== MEDCouplingExtrudedMesh
2585 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2588 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2589 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2591 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2593 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2596 std::string __str__() const throw(INTERP_KERNEL::Exception)
2598 return self->simpleRepr();
2601 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2603 std::ostringstream oss;
2604 self->reprQuickOverview(oss);
2608 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2610 MEDCouplingUMesh *ret=self->getMesh2D();
2613 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2615 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2617 MEDCouplingUMesh *ret=self->getMesh1D();
2620 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2622 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2624 DataArrayInt *ret=self->getMesh3DIds();
2627 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2632 //== MEDCouplingExtrudedMesh End
2634 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2637 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2638 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2641 //== MEDCoupling1SGTUMesh
2643 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2646 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2647 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2648 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2649 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2650 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2651 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2652 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2655 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2657 return MEDCoupling1SGTUMesh::New(name,type);
2660 std::string __str__() const throw(INTERP_KERNEL::Exception)
2662 return self->simpleRepr();
2665 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2667 std::ostringstream oss;
2668 self->reprQuickOverview(oss);
2672 DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2674 DataArrayInt *ret=self->getNodalConnectivity();
2675 if(ret) ret->incrRef();
2679 void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2681 int szArr,sw,iTypppArr;
2682 std::vector<int> stdvecTyyppArr;
2683 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2684 self->insertNextCell(tmp,tmp+szArr);
2687 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2689 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2690 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2691 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2694 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2696 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2697 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2698 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2703 //== MEDCoupling1SGTUMesh End
2705 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2708 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2709 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2712 //== MEDCouplingCMesh
2714 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2717 static MEDCouplingCMesh *New();
2718 static MEDCouplingCMesh *New(const char *meshName);
2719 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2720 void setCoords(const DataArrayDouble *coordsX,
2721 const DataArrayDouble *coordsY=0,
2722 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2723 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2727 return MEDCouplingCMesh::New();
2729 MEDCouplingCMesh(const char *meshName)
2731 return MEDCouplingCMesh::New(meshName);
2733 std::string __str__() const throw(INTERP_KERNEL::Exception)
2735 return self->simpleRepr();
2737 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2739 std::ostringstream oss;
2740 self->reprQuickOverview(oss);
2743 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2745 DataArrayDouble *ret=self->getCoordsAt(i);
2753 //== MEDCouplingCMesh End
2755 //== MEDCouplingCurveLinearMesh
2757 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2760 static MEDCouplingCurveLinearMesh *New();
2761 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2762 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2763 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2764 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2766 MEDCouplingCurveLinearMesh()
2768 return MEDCouplingCurveLinearMesh::New();
2770 MEDCouplingCurveLinearMesh(const char *meshName)
2772 return MEDCouplingCurveLinearMesh::New(meshName);
2774 std::string __str__() const throw(INTERP_KERNEL::Exception)
2776 return self->simpleRepr();
2778 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2780 std::ostringstream oss;
2781 self->reprQuickOverview(oss);
2784 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2786 DataArrayDouble *ret=self->getCoords();
2791 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2793 int szArr,sw,iTypppArr;
2794 std::vector<int> stdvecTyyppArr;
2795 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2796 self->setNodeGridStructure(tmp,tmp+szArr);
2801 //== MEDCouplingCurveLinearMesh End
2804 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
2806 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
2808 int sz=0,sw=-1,val1=-1;
2809 std::vector<int> val2;
2810 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
2811 return self->clonePart(inp,inp+sz);
2814 PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const throw(INTERP_KERNEL::Exception)
2816 DataArrayInt *ret1=0;
2818 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,begin,end,step,bb,ee,ss,ret1);
2819 PyObject *res=PyTuple_New(2);
2820 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2822 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2825 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
2826 PyTuple_SetItem(res,1,res1);
2831 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2833 std::vector<int> vVal; int iVal=-1;
2835 const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
2837 throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
2838 DataArrayInt *ret0=0,*ret1=0;
2839 self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
2840 PyObject *pyRet=PyTuple_New(2);
2841 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2842 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2847 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationP0
2849 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2850 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2853 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationOnNodes
2855 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2856 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2859 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGauss
2861 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2862 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2865 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGaussNE
2867 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2868 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2871 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
2873 PyObject *getArrayOfDiscIds() const
2875 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
2878 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2881 PyObject *splitIntoSingleGaussDicrPerCellType() const throw(INTERP_KERNEL::Exception)
2883 std::vector<int> ret1;
2884 std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
2885 std::size_t sz=ret0.size();
2886 PyObject *pyRet=PyTuple_New(2);
2887 PyObject *pyRet0=PyList_New((int)sz);
2888 PyObject *pyRet1=PyList_New((int)sz);
2889 for(std::size_t i=0;i<sz;i++)
2891 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2892 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
2894 PyTuple_SetItem(pyRet,0,pyRet0);
2895 PyTuple_SetItem(pyRet,1,pyRet1);
2900 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2902 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2905 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2906 PyObject *ret=PyTuple_New(2);
2907 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2908 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2913 namespace ParaMEDMEM
2915 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2918 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2919 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2920 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2921 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2922 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2923 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2924 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2925 const char *getDescription() const throw(INTERP_KERNEL::Exception);
2926 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2927 const char *getName() const throw(INTERP_KERNEL::Exception);
2928 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2929 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2930 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2931 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2932 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2933 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2934 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2935 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2936 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2937 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2938 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2939 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2940 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2941 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2942 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2943 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2945 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2947 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2950 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2953 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2955 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2958 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2961 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2963 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2964 return convertIntArrToPyList3(ret);
2967 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2970 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2971 PyObject *ret=PyTuple_New(2);
2972 PyObject *ret0Py=ret0?Py_True:Py_False;
2974 PyTuple_SetItem(ret,0,ret0Py);
2975 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2979 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2981 DataArrayInt *ret1=0;
2982 MEDCouplingMesh *ret0=0;
2984 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2985 if (!SWIG_IsOK(res1))
2988 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2989 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2993 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2995 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2996 da2->checkAllocated();
2997 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2999 PyObject *res = PyList_New(2);
3000 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3001 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3005 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3007 DataArrayInt *ret1=0;
3009 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3010 PyObject *res=PyTuple_New(2);
3011 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3013 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3016 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3017 PyTuple_SetItem(res,1,res1);
3022 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
3026 std::vector<int> pos2;
3027 DataArrayInt *pos3=0;
3028 DataArrayIntTuple *pos4=0;
3029 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
3034 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
3038 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
3042 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
3045 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
3049 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3050 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3053 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3054 if (!SWIG_IsOK(res1))
3057 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3058 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3062 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3064 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3065 da2->checkAllocated();
3066 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3070 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3072 std::vector<int> tmp;
3073 self->getCellIdsHavingGaussLocalization(locId,tmp);
3074 DataArrayInt *ret=DataArrayInt::New();
3075 ret->alloc((int)tmp.size(),1);
3076 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3082 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3085 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3086 static MEDCouplingFieldTemplate *New(TypeOfField type);
3087 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3088 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3091 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3093 return MEDCouplingFieldTemplate::New(f);
3096 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3098 return MEDCouplingFieldTemplate::New(type);
3101 std::string __str__() const throw(INTERP_KERNEL::Exception)
3103 return self->simpleRepr();
3106 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3108 std::ostringstream oss;
3109 self->reprQuickOverview(oss);
3115 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3118 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3119 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3120 void setTimeUnit(const char *unit);
3121 const char *getTimeUnit() const;
3122 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3123 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3124 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3125 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3126 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3127 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
3128 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3129 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3130 MEDCouplingFieldDouble *deepCpy() const;
3131 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3132 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3133 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3134 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3135 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3136 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3137 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3138 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3139 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3140 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3141 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3142 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3143 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3144 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3145 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3146 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3147 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3148 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3149 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3150 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3151 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3152 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3153 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3154 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3155 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3156 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3157 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3158 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3159 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3161 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3162 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3163 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3164 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3165 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3166 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3167 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3168 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3169 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3170 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3171 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3172 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3173 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3174 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3175 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3176 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3177 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3178 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3179 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3180 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3181 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3182 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3183 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3184 double getMinValue() const throw(INTERP_KERNEL::Exception);
3185 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3186 double norm2() const throw(INTERP_KERNEL::Exception);
3187 double normMax() const throw(INTERP_KERNEL::Exception);
3188 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3189 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3190 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3191 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3192 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3193 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3194 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3195 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3198 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3199 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3200 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3201 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3202 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3203 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3204 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3205 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3206 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3207 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3208 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3209 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3211 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3213 return MEDCouplingFieldDouble::New(type,td);
3216 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3218 return MEDCouplingFieldDouble::New(ft,td);
3221 std::string __str__() const throw(INTERP_KERNEL::Exception)
3223 return self->simpleRepr();
3226 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3228 std::ostringstream oss;
3229 self->reprQuickOverview(oss);
3233 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3235 DataArrayDouble *ret=self->getArray();
3241 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3243 std::vector<DataArrayDouble *> arrs=self->getArrays();
3244 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3248 PyObject *ret=PyTuple_New(sz);
3249 for(int i=0;i<sz;i++)
3252 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3254 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3259 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3261 std::vector<const DataArrayDouble *> tmp;
3262 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3264 std::vector<DataArrayDouble *> arrs(sz);
3265 for(int i=0;i<sz;i++)
3266 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3267 self->setArrays(arrs);
3270 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3272 DataArrayDouble *ret=self->getEndArray();
3278 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3282 DataArrayDoubleTuple *aa;
3283 std::vector<double> bb;
3285 const MEDCouplingMesh *mesh=self->getMesh();
3287 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3288 int spaceDim=mesh->getSpaceDimension();
3289 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3290 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3292 int sz=self->getNumberOfComponents();
3293 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3294 self->getValueOn(spaceLoc,res);
3295 return convertDblArrToPyList(res,sz);
3298 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3300 int sz=self->getNumberOfComponents();
3301 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3302 self->getValueOnPos(i,j,k,res);
3303 return convertDblArrToPyList(res,sz);
3306 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
3309 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
3310 if (!SWIG_IsOK(res1))
3313 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(li,&size);
3314 const MEDCouplingMesh *mesh=self->getMesh();
3316 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3317 int spaceDim=mesh->getSpaceDimension();
3318 int nbOfPoints=size/spaceDim;
3319 if(size%spaceDim!=0)
3321 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
3323 return self->getValueOnMulti(tmp,nbOfPoints);
3327 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
3329 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
3330 da2->checkAllocated();
3331 int size=da2->getNumberOfTuples();
3332 int nbOfCompo=da2->getNumberOfComponents();
3333 const MEDCouplingMesh *mesh=self->getMesh();
3335 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3336 if(nbOfCompo!=mesh->getSpaceDimension())
3338 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
3340 return self->getValueOnMulti(da2->getConstPointer(),size);
3344 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3348 DataArrayDoubleTuple *aa;
3349 std::vector<double> bb;
3351 const MEDCouplingMesh *mesh=self->getMesh();
3353 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3354 int spaceDim=mesh->getSpaceDimension();
3355 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3356 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3359 int sz=self->getNumberOfComponents();
3360 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3361 self->getValueOn(spaceLoc,time,res);
3362 return convertDblArrToPyList(res,sz);
3365 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3367 if(self->getArray()!=0)
3368 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3371 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3372 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3373 self->setArray(arr);
3377 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3380 double tmp0=self->getTime(tmp1,tmp2);
3381 PyObject *res = PyList_New(3);
3382 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3383 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3384 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3388 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3391 double tmp0=self->getStartTime(tmp1,tmp2);
3392 PyObject *res = PyList_New(3);
3393 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3394 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3395 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3399 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3402 double tmp0=self->getEndTime(tmp1,tmp2);
3403 PyObject *res = PyList_New(3);
3404 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3405 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3406 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3409 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3411 int sz=self->getNumberOfComponents();
3412 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3413 self->accumulate(tmp);
3414 return convertDblArrToPyList(tmp,sz);
3416 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3418 int sz=self->getNumberOfComponents();
3419 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3420 self->integral(isWAbs,tmp);
3421 return convertDblArrToPyList(tmp,sz);
3423 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3425 int sz=self->getNumberOfComponents();
3426 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3427 self->getWeightedAverageValue(tmp,isWAbs);
3428 return convertDblArrToPyList(tmp,sz);
3430 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3432 int sz=self->getNumberOfComponents();
3433 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3435 return convertDblArrToPyList(tmp,sz);
3437 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3439 int sz=self->getNumberOfComponents();
3440 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3442 return convertDblArrToPyList(tmp,sz);
3444 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3447 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3448 if (!SWIG_IsOK(res1))
3451 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3452 self->renumberCells(tmp,check);
3456 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3458 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3459 da2->checkAllocated();
3460 self->renumberCells(da2->getConstPointer(),check);
3463 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3466 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3467 if (!SWIG_IsOK(res1))
3470 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3471 self->renumberNodes(tmp,eps);
3475 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3477 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3478 da2->checkAllocated();
3479 self->renumberNodes(da2->getConstPointer(),eps);
3483 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3487 std::vector<int> multiVal;
3488 std::pair<int, std::pair<int,int> > slic;
3489 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3490 const MEDCouplingMesh *mesh=self->getMesh();
3492 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3493 int nbc=mesh->getNumberOfCells();
3494 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3501 std::ostringstream oss;
3502 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3503 throw INTERP_KERNEL::Exception(oss.str().c_str());
3506 return self->buildSubPart(&singleVal,&singleVal+1);
3511 int tmp=nbc+singleVal;
3512 return self->buildSubPart(&tmp,&tmp+1);
3516 std::ostringstream oss;
3517 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3518 throw INTERP_KERNEL::Exception(oss.str().c_str());
3524 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3528 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3533 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3534 daIntTyypp->checkAllocated();
3535 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3538 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3542 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3544 const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
3545 if(PyTuple_Check(li))
3547 Py_ssize_t sz=PyTuple_Size(li);
3549 throw INTERP_KERNEL::Exception(msg);
3550 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3553 std::vector<int> multiVal;
3554 std::pair<int, std::pair<int,int> > slic;
3555 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3556 if(!self->getArray())
3557 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3559 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3560 catch(INTERP_KERNEL::Exception& e)
3561 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3562 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3563 DataArrayDouble *ret0Arr=ret0->getArray();
3565 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3570 std::vector<int> v2(1,singleVal);
3571 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3572 ret0->setArray(aarr);
3577 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3578 ret0->setArray(aarr);
3583 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3584 std::vector<int> v2(nbOfComp);
3585 for(int i=0;i<nbOfComp;i++)
3586 v2[i]=slic.first+i*slic.second.second;
3587 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3588 ret0->setArray(aarr);
3592 throw INTERP_KERNEL::Exception(msg);
3597 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3600 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3603 double r1=self->getMaxValue2(tmp);
3604 PyObject *ret=PyTuple_New(2);
3605 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3606 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3610 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3613 double r1=self->getMinValue2(tmp);
3614 PyObject *ret=PyTuple_New(2);
3615 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3616 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3620 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3622 std::vector<int> tmp;
3623 convertPyToNewIntArr3(li,tmp);
3624 return self->keepSelectedComponents(tmp);
3627 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3629 std::vector<int> tmp;
3630 convertPyToNewIntArr3(li,tmp);
3631 self->setSelectedComponents(f,tmp);
3634 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3637 DataArrayDouble *a,*a2;
3638 DataArrayDoubleTuple *aa,*aa2;
3639 std::vector<double> bb,bb2;
3642 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3643 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3644 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3645 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3647 return self->extractSlice3D(orig,vect,eps);
3650 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3652 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3655 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3657 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3660 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3662 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3663 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3666 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3668 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3670 return (*self)-(*other);
3672 throw INTERP_KERNEL::Exception(msg);
3677 DataArrayDoubleTuple *aa;
3678 std::vector<double> bb;
3680 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3685 if(!self->getArray())
3686 throw INTERP_KERNEL::Exception(msg2);
3687 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3688 ret->applyLin(1.,-val);
3689 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3690 ret2->setArray(ret);
3695 if(!self->getArray())
3696 throw INTERP_KERNEL::Exception(msg2);
3697 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3698 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3699 ret2->setArray(ret);
3704 if(!self->getArray())
3705 throw INTERP_KERNEL::Exception(msg2);
3706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3707 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3708 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3709 ret2->setArray(ret);
3714 if(!self->getArray())
3715 throw INTERP_KERNEL::Exception(msg2);
3716 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3717 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3718 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3719 ret2->setArray(ret);
3723 { throw INTERP_KERNEL::Exception(msg); }
3727 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3729 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3732 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3734 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3737 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3739 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3742 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3744 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3745 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3748 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3750 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3752 return (*self)/(*other);
3754 throw INTERP_KERNEL::Exception(msg);
3759 DataArrayDoubleTuple *aa;
3760 std::vector<double> bb;
3762 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3768 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3769 if(!self->getArray())
3770 throw INTERP_KERNEL::Exception(msg2);
3771 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3772 ret->applyLin(1./val,0);
3773 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3774 ret2->setArray(ret);
3779 if(!self->getArray())
3780 throw INTERP_KERNEL::Exception(msg2);
3781 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3782 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3783 ret2->setArray(ret);
3788 if(!self->getArray())
3789 throw INTERP_KERNEL::Exception(msg2);
3790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3791 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3792 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3793 ret2->setArray(ret);
3798 if(!self->getArray())
3799 throw INTERP_KERNEL::Exception(msg2);
3800 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3801 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3802 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3803 ret2->setArray(ret);
3807 { throw INTERP_KERNEL::Exception(msg); }
3811 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3813 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3816 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3818 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3819 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3822 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3824 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3826 return (*self)^(*other);
3828 throw INTERP_KERNEL::Exception(msg);
3833 DataArrayDoubleTuple *aa;
3834 std::vector<double> bb;
3836 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3841 if(!self->getArray())
3842 throw INTERP_KERNEL::Exception(msg2);
3843 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3845 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3846 ret2->setArray(ret);
3851 if(!self->getArray())
3852 throw INTERP_KERNEL::Exception(msg2);
3853 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3854 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3855 ret2->setArray(ret);
3860 if(!self->getArray())
3861 throw INTERP_KERNEL::Exception(msg2);
3862 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3863 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3864 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3865 ret2->setArray(ret);
3870 if(!self->getArray())
3871 throw INTERP_KERNEL::Exception(msg2);
3872 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3873 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3874 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3875 ret2->setArray(ret);
3879 { throw INTERP_KERNEL::Exception(msg); }
3883 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3885 return self->negate();
3888 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3890 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3891 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3894 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3896 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3900 Py_XINCREF(trueSelf);
3904 throw INTERP_KERNEL::Exception(msg);
3909 DataArrayDoubleTuple *aa;
3910 std::vector<double> bb;
3912 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3917 if(!self->getArray())
3918 throw INTERP_KERNEL::Exception(msg2);
3919 self->getArray()->applyLin(1.,val);
3920 Py_XINCREF(trueSelf);
3925 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3928 Py_XINCREF(trueSelf);
3933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3934 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3935 ret2->setArray(aaa);
3937 Py_XINCREF(trueSelf);
3942 if(!self->getArray())
3943 throw INTERP_KERNEL::Exception(msg2);
3944 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3945 self->getArray()->addEqual(aaa);
3946 Py_XINCREF(trueSelf);
3950 { throw INTERP_KERNEL::Exception(msg); }
3954 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3956 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3957 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3960 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3962 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3966 Py_XINCREF(trueSelf);
3970 throw INTERP_KERNEL::Exception(msg);
3975 DataArrayDoubleTuple *aa;
3976 std::vector<double> bb;
3978 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3983 if(!self->getArray())
3984 throw INTERP_KERNEL::Exception(msg2);
3985 self->getArray()->applyLin(1.,-val);
3986 Py_XINCREF(trueSelf);
3991 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3994 Py_XINCREF(trueSelf);
3999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4000 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4001 ret2->setArray(aaa);
4003 Py_XINCREF(trueSelf);
4008 if(!self->getArray())
4009 throw INTERP_KERNEL::Exception(msg2);
4010 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4011 self->getArray()->substractEqual(aaa);
4012 Py_XINCREF(trueSelf);
4016 { throw INTERP_KERNEL::Exception(msg); }
4020 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4022 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4023 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4026 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4028 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4032 Py_XINCREF(trueSelf);
4036 throw INTERP_KERNEL::Exception(msg);
4041 DataArrayDoubleTuple *aa;
4042 std::vector<double> bb;
4044 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4049 if(!self->getArray())
4050 throw INTERP_KERNEL::Exception(msg2);
4051 self->getArray()->applyLin(val,0);
4052 Py_XINCREF(trueSelf);
4057 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4060 Py_XINCREF(trueSelf);
4065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4066 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4067 ret2->setArray(aaa);
4069 Py_XINCREF(trueSelf);
4074 if(!self->getArray())
4075 throw INTERP_KERNEL::Exception(msg2);
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4077 self->getArray()->multiplyEqual(aaa);
4078 Py_XINCREF(trueSelf);
4082 { throw INTERP_KERNEL::Exception(msg); }
4086 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4088 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4089 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4092 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4094 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4098 Py_XINCREF(trueSelf);
4102 throw INTERP_KERNEL::Exception(msg);
4107 DataArrayDoubleTuple *aa;
4108 std::vector<double> bb;
4110 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4116 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4117 if(!self->getArray())
4118 throw INTERP_KERNEL::Exception(msg2);
4119 self->getArray()->applyLin(1./val,0);
4120 Py_XINCREF(trueSelf);
4125 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4128 Py_XINCREF(trueSelf);
4133 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4134 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4135 ret2->setArray(aaa);
4137 Py_XINCREF(trueSelf);
4142 if(!self->getArray())
4143 throw INTERP_KERNEL::Exception(msg2);
4144 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4145 self->getArray()->divideEqual(aaa);
4146 Py_XINCREF(trueSelf);
4150 { throw INTERP_KERNEL::Exception(msg); }
4154 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4156 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4157 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4160 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4162 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4166 Py_XINCREF(trueSelf);
4170 throw INTERP_KERNEL::Exception(msg);
4175 DataArrayDoubleTuple *aa;
4176 std::vector<double> bb;
4178 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4183 if(!self->getArray())
4184 throw INTERP_KERNEL::Exception(msg2);
4185 self->getArray()->applyPow(val);
4186 Py_XINCREF(trueSelf);
4191 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4194 Py_XINCREF(trueSelf);
4199 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4200 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4201 ret2->setArray(aaa);
4203 Py_XINCREF(trueSelf);
4208 if(!self->getArray())
4209 throw INTERP_KERNEL::Exception(msg2);
4210 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4211 self->getArray()->powEqual(aaa);
4212 Py_XINCREF(trueSelf);
4216 { throw INTERP_KERNEL::Exception(msg); }
4220 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4222 std::vector<const MEDCouplingFieldDouble *> tmp;
4223 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4224 return MEDCouplingFieldDouble::MergeFields(tmp);
4227 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
4229 std::vector<const MEDCouplingFieldDouble *> tmp;
4230 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4231 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
4236 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4239 int getNumberOfFields() const;
4240 MEDCouplingMultiFields *deepCpy() const;
4241 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4242 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4243 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4244 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4245 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4248 std::string __str__() const throw(INTERP_KERNEL::Exception)
4250 return self->simpleRepr();
4252 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4254 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4255 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4257 std::vector<MEDCouplingFieldDouble *> fs(sz);
4258 for(int i=0;i<sz;i++)
4259 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4260 return MEDCouplingMultiFields::New(fs);
4262 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4264 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4265 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4267 std::vector<MEDCouplingFieldDouble *> fs(sz);
4268 for(int i=0;i<sz;i++)
4269 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4270 return MEDCouplingMultiFields::New(fs);
4272 PyObject *getFields() const
4274 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4275 int sz=fields.size();
4276 PyObject *res = PyList_New(sz);
4277 for(int i=0;i<sz;i++)
4281 fields[i]->incrRef();
4282 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4286 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4291 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4293 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4297 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4300 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4302 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4304 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4306 PyObject *res = PyList_New(sz);
4307 for(int i=0;i<sz;i++)
4312 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4316 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4321 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4323 std::vector<int> refs;
4324 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4326 PyObject *res = PyList_New(sz);
4327 for(int i=0;i<sz;i++)
4332 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4336 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4340 PyObject *ret=PyTuple_New(2);
4341 PyTuple_SetItem(ret,0,res);
4342 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4345 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4347 std::vector<DataArrayDouble *> ms=self->getArrays();
4349 PyObject *res = PyList_New(sz);
4350 for(int i=0;i<sz;i++)
4355 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4359 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4364 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4366 std::vector< std::vector<int> > refs;
4367 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4369 PyObject *res = PyList_New(sz);
4370 PyObject *res2 = PyList_New(sz);
4371 for(int i=0;i<sz;i++)
4376 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4380 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4382 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4385 PyObject *ret=PyTuple_New(2);
4386 PyTuple_SetItem(ret,0,res);
4387 PyTuple_SetItem(ret,1,res2);
4393 class MEDCouplingDefinitionTime
4396 MEDCouplingDefinitionTime();
4397 void assign(const MEDCouplingDefinitionTime& other);
4398 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4399 double getTimeResolution() const;
4400 std::vector<double> getHotSpotsTime() const;
4403 std::string __str__() const throw(INTERP_KERNEL::Exception)
4405 std::ostringstream oss;
4406 self->appendRepr(oss);
4410 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4412 int meshId,arrId,arrIdInField,fieldId;
4413 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4414 PyObject *res=PyList_New(4);
4415 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4416 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4417 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4418 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4422 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4424 int meshId,arrId,arrIdInField,fieldId;
4425 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4426 PyObject *res=PyList_New(4);
4427 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4428 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4429 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4430 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4436 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4439 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4440 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4444 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4446 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4447 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4449 std::vector<MEDCouplingFieldDouble *> fs(sz);
4450 for(int i=0;i<sz;i++)
4451 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4452 return MEDCouplingFieldOverTime::New(fs);
4454 std::string __str__() const throw(INTERP_KERNEL::Exception)
4456 return self->simpleRepr();
4458 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4460 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4461 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4463 std::vector<MEDCouplingFieldDouble *> fs(sz);
4464 for(int i=0;i<sz;i++)
4465 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4466 return MEDCouplingFieldOverTime::New(fs);
4474 __filename=os.environ.get('PYTHONSTARTUP')
4475 if __filename and os.path.isfile(__filename):
4476 execfile(__filename)