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::MEDCouplingPointSet::__getitem__;
342 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
343 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
344 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
345 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
346 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
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 int getRCValue() const;
509 virtual std::size_t getHeapMemorySize() const;
515 PyObject *MEDCouplingVersionMajMinRel()
517 int tmp0=0,tmp1=0,tmp2=0;
518 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
519 PyObject *res = PyList_New(3);
520 PyList_SetItem(res,0,SWIG_From_int(tmp0));
521 PyList_SetItem(res,1,SWIG_From_int(tmp1));
522 PyList_SetItem(res,2,SWIG_From_int(tmp2));
526 bool MEDCouplingHasNumPyBindings()
535 std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
537 static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
538 std::ostringstream oss; oss << "MEDCouplingCompletionScript : error when trying to activate completion ! readline not present ?\nScript is :\n" << script;
539 if(PyRun_SimpleString(script)!=0)
540 throw INTERP_KERNEL::Exception(oss.str().c_str());
541 return std::string(script);
545 %include "MEDCouplingMemArray.i"
552 UNSTRUCTURED_DESC = 6,
556 } MEDCouplingMeshType;
559 class DataArrayDouble;
560 class MEDCouplingUMesh;
561 class MEDCouplingFieldDouble;
563 %extend RefCountObject
565 std::string getHiddenCppPointer() const
567 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
572 %extend MEDCouplingGaussLocalization
574 std::string __str__() const throw(INTERP_KERNEL::Exception)
576 return self->getStringRepr();
579 std::string __repr__() const throw(INTERP_KERNEL::Exception)
581 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
582 oss << self->getStringRepr();
589 class MEDCouplingMesh : public RefCountObject, public TimeLabel
592 void setName(const char *name);
593 const char *getName() const;
594 void setDescription(const char *descr);
595 const char *getDescription() const;
596 void setTime(double val, int iteration, int order);
597 void setTimeUnit(const char *unit);
598 const char *getTimeUnit() const;
599 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
600 bool isStructured() const throw(INTERP_KERNEL::Exception);
601 virtual MEDCouplingMesh *deepCpy() const;
602 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
603 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
604 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
605 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
606 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
607 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
608 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
609 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
610 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
611 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
612 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
613 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
614 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
615 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
616 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
617 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
618 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
619 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
620 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
621 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
622 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
623 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
624 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
625 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
627 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
628 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
629 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
630 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
631 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
632 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
633 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
634 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
635 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
636 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
637 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
638 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
639 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
640 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
641 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
642 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
643 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
646 std::string __str__() const throw(INTERP_KERNEL::Exception)
648 return self->simpleRepr();
651 PyObject *getTime() throw(INTERP_KERNEL::Exception)
654 double tmp0=self->getTime(tmp1,tmp2);
655 PyObject *res = PyList_New(3);
656 PyList_SetItem(res,0,SWIG_From_double(tmp0));
657 PyList_SetItem(res,1,SWIG_From_int(tmp1));
658 PyList_SetItem(res,2,SWIG_From_int(tmp2));
662 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
666 DataArrayDoubleTuple *aa;
667 std::vector<double> bb;
669 int spaceDim=self->getSpaceDimension();
670 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
671 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
672 return self->getCellContainingPoint(pos,eps);
675 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
679 DataArrayDoubleTuple *aa;
680 std::vector<double> bb;
682 int spaceDim=self->getSpaceDimension();
683 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
684 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
685 std::vector<int> elts,eltsIndex;
686 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
687 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
689 d0->alloc(elts.size(),1);
690 d1->alloc(eltsIndex.size(),1);
691 std::copy(elts.begin(),elts.end(),d0->getPointer());
692 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
693 PyObject *ret=PyTuple_New(2);
694 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
695 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
699 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
701 std::vector<int> elts,eltsIndex;
702 int spaceDim=self->getSpaceDimension();
704 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
705 if (!SWIG_IsOK(res1))
708 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
709 int nbOfPoints=size/spaceDim;
712 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
714 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
718 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
720 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
721 da2->checkAllocated();
722 int size=da2->getNumberOfTuples();
723 int nbOfCompo=da2->getNumberOfComponents();
724 if(nbOfCompo!=spaceDim)
726 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
728 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
730 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
731 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
732 d0->alloc(elts.size(),1);
733 d1->alloc(eltsIndex.size(),1);
734 std::copy(elts.begin(),elts.end(),d0->getPointer());
735 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
736 PyObject *ret=PyTuple_New(2);
737 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
738 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
742 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
746 DataArrayDoubleTuple *aa;
747 std::vector<double> bb;
749 int spaceDim=self->getSpaceDimension();
750 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
751 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
752 std::vector<int> elts;
753 self->getCellsContainingPoint(pos,eps,elts);
754 DataArrayInt *ret=DataArrayInt::New();
755 ret->alloc((int)elts.size(),1);
756 std::copy(elts.begin(),elts.end(),ret->getPointer());
757 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
760 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
763 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
764 if (!SWIG_IsOK(res1))
767 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
768 self->renumberCells(tmp,check);
772 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
774 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
775 da2->checkAllocated();
776 self->renumberCells(da2->getConstPointer(),check);
780 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
782 DataArrayInt *cellCor, *nodeCor;
783 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
784 PyObject *res = PyList_New(2);
785 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
786 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
790 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
792 DataArrayInt *cellCor=0,*nodeCor=0;
793 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
794 PyObject *res = PyList_New(2);
795 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
796 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
800 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
802 DataArrayInt *cellCor=0;
803 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
807 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
810 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
811 if (!SWIG_IsOK(res1))
814 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
815 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
819 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
821 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
822 da2->checkAllocated();
823 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
826 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
828 std::vector<int> conn;
829 self->getNodeIdsOfCell(cellId,conn);
830 return convertIntArrToPyList2(conn);
833 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
835 std::vector<double> coo;
836 self->getCoordinatesOfNode(nodeId,coo);
837 return convertDblArrToPyList2(coo);
840 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
844 DataArrayDoubleTuple *aa;
845 std::vector<double> bb;
847 int spaceDim=self->getSpaceDimension();
848 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
849 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
850 self->scale(pointPtr,factor);
853 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
855 int spaceDim=self->getSpaceDimension();
856 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
857 self->getBoundingBox(tmp);
858 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
862 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
865 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
866 PyObject *ret=PyTuple_New(2);
867 PyObject *ret0Py=ret0?Py_True:Py_False;
869 PyTuple_SetItem(ret,0,ret0Py);
870 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
874 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
876 int szArr,sw,iTypppArr;
877 std::vector<int> stdvecTyyppArr;
878 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
879 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
880 if(sw==3)//DataArrayInt
882 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
883 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
884 std::string name=argpt->getName();
886 ret->setName(name.c_str());
888 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
891 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
893 int szArr,sw,iTypppArr;
894 std::vector<int> stdvecTyyppArr;
896 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
897 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
898 if(sw==3)//DataArrayInt
900 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
901 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
902 std::string name=argpt->getName();
904 ret->setName(name.c_str());
907 PyObject *res = PyList_New(2);
908 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
909 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
910 PyList_SetItem(res,0,obj0);
911 PyList_SetItem(res,1,obj1);
915 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
919 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
920 PyObject *res = PyTuple_New(2);
921 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
924 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
926 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
927 PyTuple_SetItem(res,0,obj0);
928 PyTuple_SetItem(res,1,obj1);
932 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
934 std::vector<int> vals=self->getDistributionOfTypes();
936 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
937 PyObject *ret=PyList_New((int)vals.size()/3);
938 for(int j=0;j<(int)vals.size()/3;j++)
940 PyObject *ret1=PyList_New(3);
941 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
942 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
943 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
944 PyList_SetItem(ret,j,ret1);
949 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
951 std::vector<int> code;
952 std::vector<const DataArrayInt *> idsPerType;
953 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
954 convertPyToNewIntArr4(li,1,3,code);
955 return self->checkTypeConsistencyAndContig(code,idsPerType);
958 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
960 std::vector<int> code;
961 std::vector<DataArrayInt *> idsInPflPerType;
962 std::vector<DataArrayInt *> idsPerType;
963 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
964 PyObject *ret=PyTuple_New(3);
967 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
968 PyObject *ret0=PyList_New((int)code.size()/3);
969 for(int j=0;j<(int)code.size()/3;j++)
971 PyObject *ret00=PyList_New(3);
972 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
973 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
974 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
975 PyList_SetItem(ret0,j,ret00);
977 PyTuple_SetItem(ret,0,ret0);
979 PyObject *ret1=PyList_New(idsInPflPerType.size());
980 for(std::size_t j=0;j<idsInPflPerType.size();j++)
981 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
982 PyTuple_SetItem(ret,1,ret1);
983 int n=idsPerType.size();
984 PyObject *ret2=PyList_New(n);
986 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
987 PyTuple_SetItem(ret,2,ret2);
991 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
995 DataArrayDoubleTuple *aa;
996 std::vector<double> bb;
998 int spaceDim=self->getSpaceDimension();
999 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1000 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1001 self->translate(vectorPtr);
1004 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
1006 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1009 DataArrayDoubleTuple *aa;
1010 std::vector<double> bb;
1012 int spaceDim=self->getSpaceDimension();
1013 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1014 self->rotate(centerPtr,0,alpha);
1017 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
1019 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1021 DataArrayDouble *a,*a2;
1022 DataArrayDoubleTuple *aa,*aa2;
1023 std::vector<double> bb,bb2;
1025 int spaceDim=self->getSpaceDimension();
1026 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1027 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
1028 self->rotate(centerPtr,vectorPtr,alpha);
1031 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
1033 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1034 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1035 PyObject *res=PyList_New(result.size());
1036 for(int i=0;iL!=result.end(); i++, iL++)
1037 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1041 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
1043 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
1044 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1045 return MEDCouplingMesh::MergeMeshes(tmp);
1051 //== MEDCouplingMesh End
1053 %include "NormalizedUnstructuredMesh.hxx"
1054 %include "MEDCouplingNatureOfField.hxx"
1055 %include "MEDCouplingTimeDiscretization.hxx"
1056 %include "MEDCouplingGaussLocalization.hxx"
1057 %include "MEDCouplingFieldDiscretization.hxx"
1059 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
1060 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshDataRange;
1061 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
1063 //== MEDCouplingPointSet
1065 namespace ParaMEDMEM
1067 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1070 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1071 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1072 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1073 void zipCoords() throw(INTERP_KERNEL::Exception);
1074 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1075 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1076 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1077 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1078 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1079 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1080 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1081 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1082 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1083 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1084 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1085 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1086 virtual DataArrayInt *findBoundaryNodes() const;
1087 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1088 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1089 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1090 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1093 std::string __str__() const throw(INTERP_KERNEL::Exception)
1095 return self->simpleRepr();
1098 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1101 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1102 PyObject *res = PyList_New(2);
1103 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1104 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1108 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1110 DataArrayInt *comm, *commIndex;
1111 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1112 PyObject *res = PyList_New(2);
1113 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1114 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1118 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1120 DataArrayDouble *ret1=self->getCoords();
1123 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1126 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1128 int szArr,sw,iTypppArr;
1129 std::vector<int> stdvecTyyppArr;
1130 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1131 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1132 if(sw==3)//DataArrayInt
1134 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1135 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1136 std::string name=argpt->getName();
1138 ret->setName(name.c_str());
1140 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1143 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1145 int szArr,sw,iTypppArr;
1146 std::vector<int> stdvecTyyppArr;
1147 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1148 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1149 if(sw==3)//DataArrayInt
1151 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1152 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1153 std::string name=argpt->getName();
1155 ret->setName(name.c_str());
1157 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1160 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1162 int szArr,sw,iTypppArr;
1163 std::vector<int> stdvecTyyppArr;
1164 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1165 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1166 if(sw==3)//DataArrayInt
1168 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1169 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1170 std::string name=argpt->getName();
1172 ret->setName(name.c_str());
1174 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1177 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1179 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1180 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1183 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1185 int szArr,sw,iTypppArr;
1186 std::vector<int> stdvecTyyppArr;
1187 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1188 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1189 if(sw==3)//DataArrayInt
1191 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1192 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1193 std::string name=argpt->getName();
1195 ret->setName(name.c_str());
1197 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1200 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1202 int szArr,sw,iTypppArr;
1203 std::vector<int> stdvecTyyppArr;
1204 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1205 self->renumberNodes(tmp,newNbOfNodes);
1208 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1210 int szArr,sw,iTypppArr;
1211 std::vector<int> stdvecTyyppArr;
1212 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1213 self->renumberNodes2(tmp,newNbOfNodes);
1216 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1218 int spaceDim=self->getSpaceDimension();
1220 DataArrayDouble *a,*a2;
1221 DataArrayDoubleTuple *aa,*aa2;
1222 std::vector<double> bb,bb2;
1224 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1225 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1226 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1227 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1228 std::vector<int> nodes;
1229 self->findNodesOnLine(p,v,eps,nodes);
1230 DataArrayInt *ret=DataArrayInt::New();
1231 ret->alloc((int)nodes.size(),1);
1232 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1233 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1235 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1237 int spaceDim=self->getSpaceDimension();
1239 DataArrayDouble *a,*a2;
1240 DataArrayDoubleTuple *aa,*aa2;
1241 std::vector<double> bb,bb2;
1243 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1244 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1245 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1246 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1247 std::vector<int> nodes;
1248 self->findNodesOnPlane(p,v,eps,nodes);
1249 DataArrayInt *ret=DataArrayInt::New();
1250 ret->alloc((int)nodes.size(),1);
1251 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1252 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1255 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1259 DataArrayDoubleTuple *aa;
1260 std::vector<double> bb;
1262 int spaceDim=self->getSpaceDimension();
1263 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1264 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1265 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1266 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1269 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1271 DataArrayInt *c=0,*cI=0;
1275 DataArrayDoubleTuple *aa;
1276 std::vector<double> bb;
1278 int spaceDim=self->getSpaceDimension();
1279 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1280 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1281 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1282 PyObject *ret=PyTuple_New(2);
1283 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1284 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1288 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1290 DataArrayInt *c=0,*cI=0;
1291 int spaceDim=self->getSpaceDimension();
1294 DataArrayDoubleTuple *aa;
1295 std::vector<double> bb;
1298 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1299 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1301 PyObject *ret=PyTuple_New(2);
1302 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1303 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1307 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1311 DataArrayDoubleTuple *aa;
1312 std::vector<double> bb;
1314 int spaceDim=self->getSpaceDimension();
1315 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1316 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1318 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1319 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1322 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1326 std::vector<int> multiVal;
1327 std::pair<int, std::pair<int,int> > slic;
1328 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1329 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1333 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1335 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1337 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1339 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1343 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1346 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1347 self->getReverseNodalConnectivity(d0,d1);
1348 PyObject *ret=PyTuple_New(2);
1349 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1350 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1354 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1356 DataArrayInt *v0=0,*v1=0;
1357 self->findCommonCells(compType,startCellId,v0,v1);
1358 PyObject *res = PyList_New(2);
1359 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1360 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1365 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1368 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1369 if (!SWIG_IsOK(res1))
1372 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1373 self->renumberNodesInConn(tmp);
1377 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1379 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1380 da2->checkAllocated();
1381 self->renumberNodesInConn(da2->getConstPointer());
1385 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1388 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1389 PyObject *ret=PyTuple_New(2);
1390 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1391 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1395 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1397 DataArrayInt *ret=0;
1399 int szArr,sw,iTypppArr;
1400 std::vector<int> stdvecTyyppArr;
1401 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1402 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1406 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1410 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1411 PyObject *res = PyList_New(3);
1412 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1413 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1414 PyList_SetItem(res,2,SWIG_From_int(ret2));
1418 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1422 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1423 PyObject *res = PyList_New(3);
1424 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1425 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1426 PyList_SetItem(res,2,SWIG_From_int(ret2));
1430 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1433 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1434 if (!SWIG_IsOK(res1))
1437 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1438 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1442 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1444 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1445 da2->checkAllocated();
1446 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1450 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1454 std::vector<int> multiVal;
1455 std::pair<int, std::pair<int,int> > slic;
1456 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1457 int nbc=self->getNumberOfCells();
1458 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1465 std::ostringstream oss;
1466 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1467 throw INTERP_KERNEL::Exception(oss.str().c_str());
1470 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1475 int tmp=nbc+singleVal;
1476 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1480 std::ostringstream oss;
1481 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1482 throw INTERP_KERNEL::Exception(oss.str().c_str());
1488 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1492 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1497 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1498 daIntTyypp->checkAllocated();
1499 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1502 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1506 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1509 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1510 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1511 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1512 for(int i=0;i<sz;i++)
1513 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1516 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1519 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1521 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1522 std::vector<double> val3;
1523 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1524 "Rotate2DAlg",2,true,nbNodes);
1526 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1527 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1530 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1533 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1534 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1535 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1536 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1537 for(int i=0;i<sz;i++)
1538 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1541 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1544 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1546 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1547 std::vector<double> val3;
1548 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1549 "Rotate3DAlg",3,true,nbNodes);
1551 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1552 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1553 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1558 //== MEDCouplingPointSet End
1560 class MEDCouplingUMeshCell
1563 INTERP_KERNEL::NormalizedCellType getType() const;
1566 std::string __str__() const throw(INTERP_KERNEL::Exception)
1568 return self->repr();
1571 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1574 const int *r=self->getAllConn(ret2);
1575 PyObject *ret=PyTuple_New(ret2);
1576 for(int i=0;i<ret2;i++)
1577 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1583 class MEDCouplingUMeshCellIterator
1590 MEDCouplingUMeshCell *ret=self->nextt();
1592 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1595 PyErr_SetString(PyExc_StopIteration,"No more data.");
1602 class MEDCouplingUMeshCellByTypeIterator
1605 ~MEDCouplingUMeshCellByTypeIterator();
1610 MEDCouplingUMeshCellEntry *ret=self->nextt();
1612 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1615 PyErr_SetString(PyExc_StopIteration,"No more data.");
1622 class MEDCouplingUMeshCellByTypeEntry
1625 ~MEDCouplingUMeshCellByTypeEntry();
1628 MEDCouplingUMeshCellByTypeIterator *__iter__()
1630 return self->iterator();
1635 class MEDCouplingUMeshCellEntry
1638 INTERP_KERNEL::NormalizedCellType getType() const;
1639 int getNumberOfElems() const;
1642 MEDCouplingUMeshCellIterator *__iter__()
1644 return self->iterator();
1649 //== MEDCouplingUMesh
1651 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1654 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1655 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1656 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1657 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1658 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1659 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1660 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1661 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1662 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1663 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1664 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1665 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1666 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1667 void computeTypes() throw(INTERP_KERNEL::Exception);
1668 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1669 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1671 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1672 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1673 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1674 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1675 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1676 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1677 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1678 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1679 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1680 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1681 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1682 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1683 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1684 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1685 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1686 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1687 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1688 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1689 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1690 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1691 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1692 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1693 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1694 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1695 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1696 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1697 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1698 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1699 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1700 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1701 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1702 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1703 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1704 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1705 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1706 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1707 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1708 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1710 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1712 return MEDCouplingUMesh::New();
1715 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1717 return MEDCouplingUMesh::New(meshName,meshDim);
1720 std::string __str__() const throw(INTERP_KERNEL::Exception)
1722 return self->simpleRepr();
1725 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1727 std::ostringstream oss;
1728 self->reprQuickOverview(oss);
1732 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1734 return self->cellIterator();
1737 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1741 std::vector<int> multiVal;
1742 std::pair<int, std::pair<int,int> > slic;
1743 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1744 int nbc=self->getNumberOfCells();
1745 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1752 std::ostringstream oss;
1753 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1754 throw INTERP_KERNEL::Exception(oss.str().c_str());
1758 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1765 int tmp=nbc+singleVal;
1766 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1771 std::ostringstream oss;
1772 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1773 throw INTERP_KERNEL::Exception(oss.str().c_str());
1779 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1785 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1786 daIntTyypp->checkAllocated();
1787 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1791 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1795 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1799 std::vector<int> multiVal;
1800 std::pair<int, std::pair<int,int> > slic;
1801 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1802 int nbc=self->getNumberOfCells();
1803 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1810 std::ostringstream oss;
1811 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1812 throw INTERP_KERNEL::Exception(oss.str().c_str());
1816 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1823 int tmp=nbc+singleVal;
1824 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1829 std::ostringstream oss;
1830 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1831 throw INTERP_KERNEL::Exception(oss.str().c_str());
1837 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1842 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1848 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1849 daIntTyypp->checkAllocated();
1850 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1854 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1858 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1860 int szArr,sw,iTypppArr;
1861 std::vector<int> stdvecTyyppArr;
1862 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1865 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1866 throw INTERP_KERNEL::Exception(oss.str().c_str());
1868 self->insertNextCell(type,size,tmp);
1871 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1873 int szArr,sw,iTypppArr;
1874 std::vector<int> stdvecTyyppArr;
1875 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1876 self->insertNextCell(type,szArr,tmp);
1879 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1881 DataArrayInt *ret=self->getNodalConnectivity();
1886 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1888 DataArrayInt *ret=self->getNodalConnectivityIndex();
1893 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1895 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1896 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1897 PyObject *res = PyList_New(result.size());
1898 for (int i=0;iL!=result.end(); i++, iL++)
1899 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1903 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1905 int szArr,sw,iTypppArr;
1906 std::vector<int> stdvecTyyppArr;
1907 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1908 int nbOfDepthPeelingPerformed=0;
1909 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1910 PyObject *res=PyTuple_New(2);
1911 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1912 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1916 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1918 DataArrayInt *v0=0,*v1=0;
1919 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1920 PyObject *res = PyList_New(2);
1921 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1922 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1926 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1930 DataArrayDoubleTuple *aa;
1931 std::vector<double> bb;
1933 int nbOfCompo=self->getSpaceDimension();
1934 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1937 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1938 PyObject *ret=PyTuple_New(2);
1939 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1940 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1944 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1946 DataArrayInt *ret1=0;
1947 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1948 PyObject *ret=PyTuple_New(2);
1949 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1950 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1954 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1956 std::vector<int> cells;
1957 self->checkButterflyCells(cells,eps);
1958 DataArrayInt *ret=DataArrayInt::New();
1959 ret->alloc((int)cells.size(),1);
1960 std::copy(cells.begin(),cells.end(),ret->getPointer());
1961 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1964 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1966 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1968 PyObject *ret = PyList_New(sz);
1969 for(int i=0;i<sz;i++)
1970 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1974 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1976 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1977 int sz=retCpp.size();
1978 PyObject *ret=PyList_New(sz);
1979 for(int i=0;i<sz;i++)
1980 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1984 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1987 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1988 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1989 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1992 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1995 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1996 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2000 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
2003 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2004 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2008 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2010 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
2011 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2012 PyObject *ret=PyTuple_New(3);
2013 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2014 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2015 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2019 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2021 DataArrayInt *tmp0=0,*tmp1=0;
2022 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2023 PyObject *ret=PyTuple_New(2);
2024 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2025 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2029 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2033 std::vector<int> multiVal;
2034 std::pair<int, std::pair<int,int> > slic;
2035 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2036 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2040 return self->duplicateNodes(&singleVal,&singleVal+1);
2042 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2044 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2046 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2050 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2054 std::vector<int> multiVal;
2055 std::pair<int, std::pair<int,int> > slic;
2056 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2057 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2061 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2063 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2065 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2067 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2071 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2074 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2075 DataArrayInt *tmp0,*tmp1=0;
2076 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2077 PyObject *ret=PyTuple_New(2);
2078 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2083 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2085 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2086 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2087 DataArrayInt *ret1=0,*ret2=0;
2088 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2089 PyObject *ret=PyTuple_New(3);
2090 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2091 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2092 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2096 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2098 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2099 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2100 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2101 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2104 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2107 std::vector<const MEDCouplingUMesh *> meshes;
2108 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2109 std::vector<DataArrayInt *> corr;
2110 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2112 PyObject *ret1=PyList_New(sz);
2113 for(int i=0;i<sz;i++)
2114 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2115 PyObject *ret=PyList_New(2);
2116 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2117 PyList_SetItem(ret,1,ret1);
2121 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2123 std::vector<MEDCouplingUMesh *> meshes;
2124 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2125 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2128 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2130 std::vector<MEDCouplingUMesh *> meshes;
2131 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2132 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2135 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2139 std::vector<int> multiVal;
2140 std::pair<int, std::pair<int,int> > slic;
2141 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2143 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2144 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2148 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2150 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2152 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2154 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2158 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2160 DataArrayInt *arrOut=0,*arrIndexOut=0;
2163 std::vector<int> multiVal;
2164 std::pair<int, std::pair<int,int> > slic;
2165 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2167 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2168 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2173 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2178 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2183 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2187 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2189 PyObject *ret=PyTuple_New(2);
2190 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2191 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2195 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2196 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2197 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2199 DataArrayInt *arrOut=0,*arrIndexOut=0;
2202 std::vector<int> multiVal;
2203 std::pair<int, std::pair<int,int> > slic;
2204 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2206 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2207 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2212 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2217 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2222 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2226 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2228 PyObject *ret=PyTuple_New(2);
2229 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2230 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2234 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2235 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2239 std::vector<int> multiVal;
2240 std::pair<int, std::pair<int,int> > slic;
2241 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2243 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2244 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2249 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2254 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2259 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2263 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2267 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2271 DataArrayDoubleTuple *aa;
2272 std::vector<double> bb;
2274 int spaceDim=self->getSpaceDimension();
2275 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2276 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2278 std::vector<int> cells;
2279 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2280 DataArrayInt *ret=DataArrayInt::New();
2281 ret->alloc((int)cells.size(),1);
2282 std::copy(cells.begin(),cells.end(),ret->getPointer());
2283 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2286 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2290 DataArrayDoubleTuple *aa;
2291 std::vector<double> bb;
2293 int spaceDim=self->getSpaceDimension();
2294 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2295 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2296 self->orientCorrectly2DCells(v,polyOnly);
2299 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2301 std::vector<int> cells;
2302 self->arePolyhedronsNotCorrectlyOriented(cells);
2303 DataArrayInt *ret=DataArrayInt::New();
2304 ret->alloc((int)cells.size(),1);
2305 std::copy(cells.begin(),cells.end(),ret->getPointer());
2306 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2309 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2313 self->getFastAveragePlaneOfThis(vec,pos);
2315 std::copy(vec,vec+3,vals);
2316 std::copy(pos,pos+3,vals+3);
2317 return convertDblArrToPyListOfTuple(vals,3,2);
2320 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2322 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2323 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2324 return MEDCouplingUMesh::MergeUMeshes(tmp);
2327 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2330 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2331 PyObject *ret=PyTuple_New(2);
2332 PyObject *ret0Py=ret0?Py_True:Py_False;
2334 PyTuple_SetItem(ret,0,ret0Py);
2335 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2339 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2342 bool ret0=self->areCellsIncludedIn2(other,ret1);
2343 PyObject *ret=PyTuple_New(2);
2344 PyObject *ret0Py=ret0?Py_True:Py_False;
2346 PyTuple_SetItem(ret,0,ret0Py);
2347 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2351 PyObject *explode3DMeshTo1D() 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->explode3DMeshTo1D(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 *buildDescendingConnectivity() 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->buildDescendingConnectivity(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 *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2385 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2386 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2387 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2388 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2389 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2390 PyObject *ret=PyTuple_New(5);
2391 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2392 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2399 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2401 DataArrayInt *neighbors=0,*neighborsIdx=0;
2402 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2403 PyObject *ret=PyTuple_New(2);
2404 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2409 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2411 DataArrayInt *neighbors=0,*neighborsIdx=0;
2412 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2413 PyObject *ret=PyTuple_New(2);
2414 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2415 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2419 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2421 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2422 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2423 DataArrayInt *d2,*d3,*d4,*dd5;
2424 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2425 PyObject *ret=PyTuple_New(7);
2426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2428 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2429 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2430 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2432 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2436 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2439 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2440 da->checkAllocated();
2441 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2444 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2447 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2448 da->checkAllocated();
2449 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2452 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2455 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2456 da->checkAllocated();
2457 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2460 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2463 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2464 da->checkAllocated();
2465 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2466 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2467 PyObject *res = PyList_New(result.size());
2468 for (int i=0;iL!=result.end(); i++, iL++)
2469 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2473 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2476 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2477 da->checkAllocated();
2478 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2479 ret->setName(da->getName().c_str());
2483 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2485 DataArrayInt *cellNb1=0,*cellNb2=0;
2486 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2487 PyObject *ret=PyTuple_New(3);
2488 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2489 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2490 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2494 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2496 int spaceDim=self->getSpaceDimension();
2498 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2500 DataArrayDouble *a,*a2;
2501 DataArrayDoubleTuple *aa,*aa2;
2502 std::vector<double> bb,bb2;
2504 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2505 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2506 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2507 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2509 DataArrayInt *cellIds=0;
2510 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2511 PyObject *ret=PyTuple_New(2);
2512 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2513 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2517 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2519 int spaceDim=self->getSpaceDimension();
2521 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2523 DataArrayDouble *a,*a2;
2524 DataArrayDoubleTuple *aa,*aa2;
2525 std::vector<double> bb,bb2;
2527 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2528 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2529 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2530 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2532 DataArrayInt *cellIds=0;
2533 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2534 PyObject *ret=PyTuple_New(2);
2535 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2536 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2540 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2542 int spaceDim=self->getSpaceDimension();
2544 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2546 DataArrayDouble *a,*a2;
2547 DataArrayDoubleTuple *aa,*aa2;
2548 std::vector<double> bb,bb2;
2550 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2551 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2552 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2553 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2554 return self->getCellIdsCrossingPlane(orig,vect,eps);
2557 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2561 std::vector<int> pos2;
2562 DataArrayInt *pos3=0;
2563 DataArrayIntTuple *pos4=0;
2564 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2569 self->convertToPolyTypes(&pos1,&pos1+1);
2576 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2581 self->convertToPolyTypes(pos3->begin(),pos3->end());
2585 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2589 void convertAllToPoly();
2590 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2591 bool unPolyze() throw(INTERP_KERNEL::Exception);
2592 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2593 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2594 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2597 //== MEDCouplingUMesh End
2599 //== MEDCouplingExtrudedMesh
2601 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2604 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2605 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2607 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2609 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2612 std::string __str__() const throw(INTERP_KERNEL::Exception)
2614 return self->simpleRepr();
2617 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2619 std::ostringstream oss;
2620 self->reprQuickOverview(oss);
2624 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2626 MEDCouplingUMesh *ret=self->getMesh2D();
2629 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2631 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2633 MEDCouplingUMesh *ret=self->getMesh1D();
2636 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2638 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2640 DataArrayInt *ret=self->getMesh3DIds();
2643 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2648 //== MEDCouplingExtrudedMesh End
2650 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2653 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2654 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2657 //== MEDCoupling1SGTUMesh
2659 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2662 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2663 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2664 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2665 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2666 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2667 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2668 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2671 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2673 return MEDCoupling1SGTUMesh::New(name,type);
2676 std::string __str__() const throw(INTERP_KERNEL::Exception)
2678 return self->simpleRepr();
2681 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2683 std::ostringstream oss;
2684 self->reprQuickOverview(oss);
2688 DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2690 DataArrayInt *ret=self->getNodalConnectivity();
2691 if(ret) ret->incrRef();
2695 void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2697 int szArr,sw,iTypppArr;
2698 std::vector<int> stdvecTyyppArr;
2699 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2700 self->insertNextCell(tmp,tmp+szArr);
2703 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2705 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2706 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2707 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2710 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2712 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2713 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2714 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2719 //== MEDCoupling1SGTUMesh End
2721 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2724 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2725 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2728 //== MEDCouplingCMesh
2730 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2733 static MEDCouplingCMesh *New();
2734 static MEDCouplingCMesh *New(const char *meshName);
2735 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2736 void setCoords(const DataArrayDouble *coordsX,
2737 const DataArrayDouble *coordsY=0,
2738 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2739 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2743 return MEDCouplingCMesh::New();
2745 MEDCouplingCMesh(const char *meshName)
2747 return MEDCouplingCMesh::New(meshName);
2749 std::string __str__() const throw(INTERP_KERNEL::Exception)
2751 return self->simpleRepr();
2753 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2755 std::ostringstream oss;
2756 self->reprQuickOverview(oss);
2759 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2761 DataArrayDouble *ret=self->getCoordsAt(i);
2769 //== MEDCouplingCMesh End
2771 //== MEDCouplingCurveLinearMesh
2773 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2776 static MEDCouplingCurveLinearMesh *New();
2777 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2778 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2779 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2780 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2782 MEDCouplingCurveLinearMesh()
2784 return MEDCouplingCurveLinearMesh::New();
2786 MEDCouplingCurveLinearMesh(const char *meshName)
2788 return MEDCouplingCurveLinearMesh::New(meshName);
2790 std::string __str__() const throw(INTERP_KERNEL::Exception)
2792 return self->simpleRepr();
2794 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2796 std::ostringstream oss;
2797 self->reprQuickOverview(oss);
2800 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2802 DataArrayDouble *ret=self->getCoords();
2807 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2809 int szArr,sw,iTypppArr;
2810 std::vector<int> stdvecTyyppArr;
2811 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2812 self->setNodeGridStructure(tmp,tmp+szArr);
2817 //== MEDCouplingCurveLinearMesh End
2820 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
2822 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
2824 int sz=0,sw=-1,val1=-1;
2825 std::vector<int> val2;
2826 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
2827 return self->clonePart(inp,inp+sz);
2830 PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const throw(INTERP_KERNEL::Exception)
2832 DataArrayInt *ret1=0;
2834 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,begin,end,step,bb,ee,ss,ret1);
2835 PyObject *res=PyTuple_New(2);
2836 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2838 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2841 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
2842 PyTuple_SetItem(res,1,res1);
2847 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2849 std::vector<int> vVal; int iVal=-1;
2851 const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
2853 throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
2854 DataArrayInt *ret0=0,*ret1=0;
2855 self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
2856 PyObject *pyRet=PyTuple_New(2);
2857 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2858 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2863 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationP0
2865 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2866 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2869 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationOnNodes
2871 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2872 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2875 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGauss
2877 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2878 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2881 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGaussNE
2883 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2884 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2887 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
2889 PyObject *getArrayOfDiscIds() const
2891 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
2894 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2897 PyObject *splitIntoSingleGaussDicrPerCellType() const throw(INTERP_KERNEL::Exception)
2899 std::vector<int> ret1;
2900 std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
2901 std::size_t sz=ret0.size();
2902 PyObject *pyRet=PyTuple_New(2);
2903 PyObject *pyRet0=PyList_New((int)sz);
2904 PyObject *pyRet1=PyList_New((int)sz);
2905 for(std::size_t i=0;i<sz;i++)
2907 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2908 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
2910 PyTuple_SetItem(pyRet,0,pyRet0);
2911 PyTuple_SetItem(pyRet,1,pyRet1);
2916 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2918 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2921 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2922 PyObject *ret=PyTuple_New(2);
2923 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2924 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2929 namespace ParaMEDMEM
2931 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2934 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2935 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2936 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2937 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2938 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2939 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2940 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2941 const char *getDescription() const throw(INTERP_KERNEL::Exception);
2942 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2943 const char *getName() const throw(INTERP_KERNEL::Exception);
2944 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2945 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2946 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2947 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2948 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2949 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2950 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2951 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2952 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2953 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2954 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2955 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2956 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2957 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2958 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2959 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2961 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2963 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2966 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2969 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2971 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2974 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2977 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2979 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2980 return convertIntArrToPyList3(ret);
2983 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2986 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2987 PyObject *ret=PyTuple_New(2);
2988 PyObject *ret0Py=ret0?Py_True:Py_False;
2990 PyTuple_SetItem(ret,0,ret0Py);
2991 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2995 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2997 DataArrayInt *ret1=0;
2998 MEDCouplingMesh *ret0=0;
3000 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3001 if (!SWIG_IsOK(res1))
3004 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3005 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3009 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3011 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3012 da2->checkAllocated();
3013 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3015 PyObject *res = PyList_New(2);
3016 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3017 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3021 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3023 DataArrayInt *ret1=0;
3025 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3026 PyObject *res=PyTuple_New(2);
3027 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3029 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3032 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3033 PyTuple_SetItem(res,1,res1);
3038 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
3042 std::vector<int> pos2;
3043 DataArrayInt *pos3=0;
3044 DataArrayIntTuple *pos4=0;
3045 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
3050 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
3054 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
3058 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
3061 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
3065 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3066 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3069 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3070 if (!SWIG_IsOK(res1))
3073 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3074 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3078 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3080 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3081 da2->checkAllocated();
3082 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3086 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3088 std::vector<int> tmp;
3089 self->getCellIdsHavingGaussLocalization(locId,tmp);
3090 DataArrayInt *ret=DataArrayInt::New();
3091 ret->alloc((int)tmp.size(),1);
3092 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3093 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3098 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3101 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3102 static MEDCouplingFieldTemplate *New(TypeOfField type);
3103 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3104 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3107 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3109 return MEDCouplingFieldTemplate::New(f);
3112 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3114 return MEDCouplingFieldTemplate::New(type);
3117 std::string __str__() const throw(INTERP_KERNEL::Exception)
3119 return self->simpleRepr();
3122 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3124 std::ostringstream oss;
3125 self->reprQuickOverview(oss);
3131 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3134 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3135 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3136 void setTimeUnit(const char *unit);
3137 const char *getTimeUnit() const;
3138 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3139 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3140 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3141 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3142 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3143 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
3144 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3145 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3146 MEDCouplingFieldDouble *deepCpy() const;
3147 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3148 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3149 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3150 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3151 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3152 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3153 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3154 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3155 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3156 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3157 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3158 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3159 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3160 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3161 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3162 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3163 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3164 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3165 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3166 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3167 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3168 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3169 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3170 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3171 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3172 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3173 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3174 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3175 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3176 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3177 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3178 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3179 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3180 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3181 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3182 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3183 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3184 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3185 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3186 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3187 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3188 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3189 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3190 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3191 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3192 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3193 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3194 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3195 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3196 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3197 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3198 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3199 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3200 double getMinValue() const throw(INTERP_KERNEL::Exception);
3201 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3202 double norm2() const throw(INTERP_KERNEL::Exception);
3203 double normMax() const throw(INTERP_KERNEL::Exception);
3204 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3205 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3206 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3207 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3208 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3209 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3210 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3211 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3212 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3213 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3214 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3215 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3216 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3217 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3218 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3219 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3220 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3221 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3222 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3223 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3224 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3225 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3227 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3229 return MEDCouplingFieldDouble::New(type,td);
3232 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3234 return MEDCouplingFieldDouble::New(ft,td);
3237 std::string __str__() const throw(INTERP_KERNEL::Exception)
3239 return self->simpleRepr();
3242 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3244 std::ostringstream oss;
3245 self->reprQuickOverview(oss);
3249 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3251 DataArrayDouble *ret=self->getArray();
3257 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3259 std::vector<DataArrayDouble *> arrs=self->getArrays();
3260 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3264 PyObject *ret=PyTuple_New(sz);
3265 for(int i=0;i<sz;i++)
3268 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3270 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3275 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3277 std::vector<const DataArrayDouble *> tmp;
3278 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3280 std::vector<DataArrayDouble *> arrs(sz);
3281 for(int i=0;i<sz;i++)
3282 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3283 self->setArrays(arrs);
3286 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3288 DataArrayDouble *ret=self->getEndArray();
3294 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3298 DataArrayDoubleTuple *aa;
3299 std::vector<double> bb;
3301 const MEDCouplingMesh *mesh=self->getMesh();
3303 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3304 int spaceDim=mesh->getSpaceDimension();
3305 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3306 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3308 int sz=self->getNumberOfComponents();
3309 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3310 self->getValueOn(spaceLoc,res);
3311 return convertDblArrToPyList(res,sz);
3314 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3316 int sz=self->getNumberOfComponents();
3317 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3318 self->getValueOnPos(i,j,k,res);
3319 return convertDblArrToPyList(res,sz);
3322 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
3325 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
3326 if (!SWIG_IsOK(res1))
3329 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(li,&size);
3330 const MEDCouplingMesh *mesh=self->getMesh();
3332 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3333 int spaceDim=mesh->getSpaceDimension();
3334 int nbOfPoints=size/spaceDim;
3335 if(size%spaceDim!=0)
3337 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
3339 return self->getValueOnMulti(tmp,nbOfPoints);
3343 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
3345 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
3346 da2->checkAllocated();
3347 int size=da2->getNumberOfTuples();
3348 int nbOfCompo=da2->getNumberOfComponents();
3349 const MEDCouplingMesh *mesh=self->getMesh();
3351 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3352 if(nbOfCompo!=mesh->getSpaceDimension())
3354 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
3356 return self->getValueOnMulti(da2->getConstPointer(),size);
3360 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3364 DataArrayDoubleTuple *aa;
3365 std::vector<double> bb;
3367 const MEDCouplingMesh *mesh=self->getMesh();
3369 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3370 int spaceDim=mesh->getSpaceDimension();
3371 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3372 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3375 int sz=self->getNumberOfComponents();
3376 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3377 self->getValueOn(spaceLoc,time,res);
3378 return convertDblArrToPyList(res,sz);
3381 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3383 if(self->getArray()!=0)
3384 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3387 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3388 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3389 self->setArray(arr);
3393 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3396 double tmp0=self->getTime(tmp1,tmp2);
3397 PyObject *res = PyList_New(3);
3398 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3399 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3400 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3404 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3407 double tmp0=self->getStartTime(tmp1,tmp2);
3408 PyObject *res = PyList_New(3);
3409 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3410 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3411 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3415 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3418 double tmp0=self->getEndTime(tmp1,tmp2);
3419 PyObject *res = PyList_New(3);
3420 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3421 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3422 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3425 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3427 int sz=self->getNumberOfComponents();
3428 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3429 self->accumulate(tmp);
3430 return convertDblArrToPyList(tmp,sz);
3432 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3434 int sz=self->getNumberOfComponents();
3435 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3436 self->integral(isWAbs,tmp);
3437 return convertDblArrToPyList(tmp,sz);
3439 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3441 int sz=self->getNumberOfComponents();
3442 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3443 self->getWeightedAverageValue(tmp,isWAbs);
3444 return convertDblArrToPyList(tmp,sz);
3446 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3448 int sz=self->getNumberOfComponents();
3449 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3451 return convertDblArrToPyList(tmp,sz);
3453 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3455 int sz=self->getNumberOfComponents();
3456 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3458 return convertDblArrToPyList(tmp,sz);
3460 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3463 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3464 if (!SWIG_IsOK(res1))
3467 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3468 self->renumberCells(tmp,check);
3472 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3474 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3475 da2->checkAllocated();
3476 self->renumberCells(da2->getConstPointer(),check);
3479 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3482 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3483 if (!SWIG_IsOK(res1))
3486 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3487 self->renumberNodes(tmp,eps);
3491 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3493 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3494 da2->checkAllocated();
3495 self->renumberNodes(da2->getConstPointer(),eps);
3499 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3503 std::vector<int> multiVal;
3504 std::pair<int, std::pair<int,int> > slic;
3505 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3506 const MEDCouplingMesh *mesh=self->getMesh();
3508 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3509 int nbc=mesh->getNumberOfCells();
3510 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3517 std::ostringstream oss;
3518 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3519 throw INTERP_KERNEL::Exception(oss.str().c_str());
3522 return self->buildSubPart(&singleVal,&singleVal+1);
3527 int tmp=nbc+singleVal;
3528 return self->buildSubPart(&tmp,&tmp+1);
3532 std::ostringstream oss;
3533 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3534 throw INTERP_KERNEL::Exception(oss.str().c_str());
3540 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3544 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3549 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3550 daIntTyypp->checkAllocated();
3551 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3554 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3558 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3560 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";
3561 if(PyTuple_Check(li))
3563 Py_ssize_t sz=PyTuple_Size(li);
3565 throw INTERP_KERNEL::Exception(msg);
3566 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3569 std::vector<int> multiVal;
3570 std::pair<int, std::pair<int,int> > slic;
3571 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3572 if(!self->getArray())
3573 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3575 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3576 catch(INTERP_KERNEL::Exception& e)
3577 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3578 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3579 DataArrayDouble *ret0Arr=ret0->getArray();
3581 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3586 std::vector<int> v2(1,singleVal);
3587 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3588 ret0->setArray(aarr);
3593 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3594 ret0->setArray(aarr);
3599 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3600 std::vector<int> v2(nbOfComp);
3601 for(int i=0;i<nbOfComp;i++)
3602 v2[i]=slic.first+i*slic.second.second;
3603 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3604 ret0->setArray(aarr);
3608 throw INTERP_KERNEL::Exception(msg);
3613 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3616 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3619 double r1=self->getMaxValue2(tmp);
3620 PyObject *ret=PyTuple_New(2);
3621 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3622 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3626 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3629 double r1=self->getMinValue2(tmp);
3630 PyObject *ret=PyTuple_New(2);
3631 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3632 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3636 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3638 std::vector<int> tmp;
3639 convertPyToNewIntArr3(li,tmp);
3640 return self->keepSelectedComponents(tmp);
3643 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3645 std::vector<int> tmp;
3646 convertPyToNewIntArr3(li,tmp);
3647 self->setSelectedComponents(f,tmp);
3650 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3653 DataArrayDouble *a,*a2;
3654 DataArrayDoubleTuple *aa,*aa2;
3655 std::vector<double> bb,bb2;
3658 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3659 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3660 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3661 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3663 return self->extractSlice3D(orig,vect,eps);
3666 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3668 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3671 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3673 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3676 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3678 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.";
3679 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3682 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3684 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3686 return (*self)-(*other);
3688 throw INTERP_KERNEL::Exception(msg);
3693 DataArrayDoubleTuple *aa;
3694 std::vector<double> bb;
3696 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3701 if(!self->getArray())
3702 throw INTERP_KERNEL::Exception(msg2);
3703 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3704 ret->applyLin(1.,-val);
3705 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3706 ret2->setArray(ret);
3711 if(!self->getArray())
3712 throw INTERP_KERNEL::Exception(msg2);
3713 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3714 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3715 ret2->setArray(ret);
3720 if(!self->getArray())
3721 throw INTERP_KERNEL::Exception(msg2);
3722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3723 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3724 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3725 ret2->setArray(ret);
3730 if(!self->getArray())
3731 throw INTERP_KERNEL::Exception(msg2);
3732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3734 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3735 ret2->setArray(ret);
3739 { throw INTERP_KERNEL::Exception(msg); }
3743 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3745 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3748 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3750 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3753 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3755 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3758 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3760 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.";
3761 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3764 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3766 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3768 return (*self)/(*other);
3770 throw INTERP_KERNEL::Exception(msg);
3775 DataArrayDoubleTuple *aa;
3776 std::vector<double> bb;
3778 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3784 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3785 if(!self->getArray())
3786 throw INTERP_KERNEL::Exception(msg2);
3787 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3788 ret->applyLin(1./val,0);
3789 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3790 ret2->setArray(ret);
3795 if(!self->getArray())
3796 throw INTERP_KERNEL::Exception(msg2);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3798 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3799 ret2->setArray(ret);
3804 if(!self->getArray())
3805 throw INTERP_KERNEL::Exception(msg2);
3806 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3807 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3808 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3809 ret2->setArray(ret);
3814 if(!self->getArray())
3815 throw INTERP_KERNEL::Exception(msg2);
3816 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3818 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3819 ret2->setArray(ret);
3823 { throw INTERP_KERNEL::Exception(msg); }
3827 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3829 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3832 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3834 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.";
3835 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3838 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3840 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3842 return (*self)^(*other);
3844 throw INTERP_KERNEL::Exception(msg);
3849 DataArrayDoubleTuple *aa;
3850 std::vector<double> bb;
3852 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3857 if(!self->getArray())
3858 throw INTERP_KERNEL::Exception(msg2);
3859 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3861 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3862 ret2->setArray(ret);
3867 if(!self->getArray())
3868 throw INTERP_KERNEL::Exception(msg2);
3869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3870 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3871 ret2->setArray(ret);
3876 if(!self->getArray())
3877 throw INTERP_KERNEL::Exception(msg2);
3878 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3879 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3880 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3881 ret2->setArray(ret);
3886 if(!self->getArray())
3887 throw INTERP_KERNEL::Exception(msg2);
3888 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3890 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3891 ret2->setArray(ret);
3895 { throw INTERP_KERNEL::Exception(msg); }
3899 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3901 return self->negate();
3904 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3906 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.";
3907 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3910 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3912 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3916 Py_XINCREF(trueSelf);
3920 throw INTERP_KERNEL::Exception(msg);
3925 DataArrayDoubleTuple *aa;
3926 std::vector<double> bb;
3928 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3933 if(!self->getArray())
3934 throw INTERP_KERNEL::Exception(msg2);
3935 self->getArray()->applyLin(1.,val);
3936 Py_XINCREF(trueSelf);
3941 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3944 Py_XINCREF(trueSelf);
3949 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3950 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3951 ret2->setArray(aaa);
3953 Py_XINCREF(trueSelf);
3958 if(!self->getArray())
3959 throw INTERP_KERNEL::Exception(msg2);
3960 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3961 self->getArray()->addEqual(aaa);
3962 Py_XINCREF(trueSelf);
3966 { throw INTERP_KERNEL::Exception(msg); }
3970 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3972 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.";
3973 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3976 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3978 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3982 Py_XINCREF(trueSelf);
3986 throw INTERP_KERNEL::Exception(msg);
3991 DataArrayDoubleTuple *aa;
3992 std::vector<double> bb;
3994 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3999 if(!self->getArray())
4000 throw INTERP_KERNEL::Exception(msg2);
4001 self->getArray()->applyLin(1.,-val);
4002 Py_XINCREF(trueSelf);
4007 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4010 Py_XINCREF(trueSelf);
4015 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4016 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4017 ret2->setArray(aaa);
4019 Py_XINCREF(trueSelf);
4024 if(!self->getArray())
4025 throw INTERP_KERNEL::Exception(msg2);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4027 self->getArray()->substractEqual(aaa);
4028 Py_XINCREF(trueSelf);
4032 { throw INTERP_KERNEL::Exception(msg); }
4036 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4038 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.";
4039 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4042 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4044 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4048 Py_XINCREF(trueSelf);
4052 throw INTERP_KERNEL::Exception(msg);
4057 DataArrayDoubleTuple *aa;
4058 std::vector<double> bb;
4060 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4065 if(!self->getArray())
4066 throw INTERP_KERNEL::Exception(msg2);
4067 self->getArray()->applyLin(val,0);
4068 Py_XINCREF(trueSelf);
4073 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4076 Py_XINCREF(trueSelf);
4081 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4082 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4083 ret2->setArray(aaa);
4085 Py_XINCREF(trueSelf);
4090 if(!self->getArray())
4091 throw INTERP_KERNEL::Exception(msg2);
4092 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4093 self->getArray()->multiplyEqual(aaa);
4094 Py_XINCREF(trueSelf);
4098 { throw INTERP_KERNEL::Exception(msg); }
4102 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4104 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.";
4105 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4108 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4110 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4114 Py_XINCREF(trueSelf);
4118 throw INTERP_KERNEL::Exception(msg);
4123 DataArrayDoubleTuple *aa;
4124 std::vector<double> bb;
4126 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4132 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4133 if(!self->getArray())
4134 throw INTERP_KERNEL::Exception(msg2);
4135 self->getArray()->applyLin(1./val,0);
4136 Py_XINCREF(trueSelf);
4141 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4144 Py_XINCREF(trueSelf);
4149 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4150 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4151 ret2->setArray(aaa);
4153 Py_XINCREF(trueSelf);
4158 if(!self->getArray())
4159 throw INTERP_KERNEL::Exception(msg2);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4161 self->getArray()->divideEqual(aaa);
4162 Py_XINCREF(trueSelf);
4166 { throw INTERP_KERNEL::Exception(msg); }
4170 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4172 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.";
4173 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4176 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4178 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4182 Py_XINCREF(trueSelf);
4186 throw INTERP_KERNEL::Exception(msg);
4191 DataArrayDoubleTuple *aa;
4192 std::vector<double> bb;
4194 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4199 if(!self->getArray())
4200 throw INTERP_KERNEL::Exception(msg2);
4201 self->getArray()->applyPow(val);
4202 Py_XINCREF(trueSelf);
4207 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4210 Py_XINCREF(trueSelf);
4215 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4216 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4217 ret2->setArray(aaa);
4219 Py_XINCREF(trueSelf);
4224 if(!self->getArray())
4225 throw INTERP_KERNEL::Exception(msg2);
4226 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4227 self->getArray()->powEqual(aaa);
4228 Py_XINCREF(trueSelf);
4232 { throw INTERP_KERNEL::Exception(msg); }
4236 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4238 std::vector<const MEDCouplingFieldDouble *> tmp;
4239 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4240 return MEDCouplingFieldDouble::MergeFields(tmp);
4243 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
4245 std::vector<const MEDCouplingFieldDouble *> tmp;
4246 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4247 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
4252 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4255 int getNumberOfFields() const;
4256 MEDCouplingMultiFields *deepCpy() const;
4257 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4258 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4259 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4260 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4261 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4264 std::string __str__() const throw(INTERP_KERNEL::Exception)
4266 return self->simpleRepr();
4268 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4270 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4271 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4273 std::vector<MEDCouplingFieldDouble *> fs(sz);
4274 for(int i=0;i<sz;i++)
4275 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4276 return MEDCouplingMultiFields::New(fs);
4278 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4280 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4281 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4283 std::vector<MEDCouplingFieldDouble *> fs(sz);
4284 for(int i=0;i<sz;i++)
4285 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4286 return MEDCouplingMultiFields::New(fs);
4288 PyObject *getFields() const
4290 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4291 int sz=fields.size();
4292 PyObject *res = PyList_New(sz);
4293 for(int i=0;i<sz;i++)
4297 fields[i]->incrRef();
4298 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4302 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4307 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4309 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4313 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4316 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4318 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4320 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4322 PyObject *res = PyList_New(sz);
4323 for(int i=0;i<sz;i++)
4328 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4332 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4337 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4339 std::vector<int> refs;
4340 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4342 PyObject *res = PyList_New(sz);
4343 for(int i=0;i<sz;i++)
4348 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4352 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4356 PyObject *ret=PyTuple_New(2);
4357 PyTuple_SetItem(ret,0,res);
4358 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4361 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4363 std::vector<DataArrayDouble *> ms=self->getArrays();
4365 PyObject *res = PyList_New(sz);
4366 for(int i=0;i<sz;i++)
4371 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4375 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4380 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4382 std::vector< std::vector<int> > refs;
4383 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4385 PyObject *res = PyList_New(sz);
4386 PyObject *res2 = PyList_New(sz);
4387 for(int i=0;i<sz;i++)
4392 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4396 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4398 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4401 PyObject *ret=PyTuple_New(2);
4402 PyTuple_SetItem(ret,0,res);
4403 PyTuple_SetItem(ret,1,res2);
4409 class MEDCouplingDefinitionTime
4412 MEDCouplingDefinitionTime();
4413 void assign(const MEDCouplingDefinitionTime& other);
4414 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4415 double getTimeResolution() const;
4416 std::vector<double> getHotSpotsTime() const;
4419 std::string __str__() const throw(INTERP_KERNEL::Exception)
4421 std::ostringstream oss;
4422 self->appendRepr(oss);
4426 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4428 int meshId,arrId,arrIdInField,fieldId;
4429 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4430 PyObject *res=PyList_New(4);
4431 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4432 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4433 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4434 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4438 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4440 int meshId,arrId,arrIdInField,fieldId;
4441 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4442 PyObject *res=PyList_New(4);
4443 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4444 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4445 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4446 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4452 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4455 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4456 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4460 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4462 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4463 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4465 std::vector<MEDCouplingFieldDouble *> fs(sz);
4466 for(int i=0;i<sz;i++)
4467 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4468 return MEDCouplingFieldOverTime::New(fs);
4470 std::string __str__() const throw(INTERP_KERNEL::Exception)
4472 return self->simpleRepr();
4474 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4476 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4477 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4479 std::vector<MEDCouplingFieldDouble *> fs(sz);
4480 for(int i=0;i<sz;i++)
4481 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4482 return MEDCouplingFieldOverTime::New(fs);
4490 __filename=os.environ.get('PYTHONSTARTUP')
4491 if __filename and os.path.isfile(__filename):
4492 execfile(__filename)