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::MEDCouplingUMesh::New;
341 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
342 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
343 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
344 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
345 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
346 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
347 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
348 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
349 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
350 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
351 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
352 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
353 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
354 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
355 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
356 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
357 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
358 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
359 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
360 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
361 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
362 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
363 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
364 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
365 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
366 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
367 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
368 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
369 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
370 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
371 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
372 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
373 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
374 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
375 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
376 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
377 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
378 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
379 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
380 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
381 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
382 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
383 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
384 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
385 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
386 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
387 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
388 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::getNodalConnectivity;
389 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
390 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
391 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
392 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
393 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
394 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
395 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
396 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
397 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
398 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
399 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
400 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
401 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
402 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
404 %feature("unref") DataArray "$this->decrRef();"
405 %feature("unref") DataArrayDouble "$this->decrRef();"
406 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
407 %feature("unref") MEDCouplingMesh "$this->decrRef();"
408 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
409 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
410 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
411 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
412 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
413 %feature("unref") DataArrayInt "$this->decrRef();"
414 %feature("unref") DataArrayChar "$this->decrRef();"
415 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
416 %feature("unref") DataArrayByte "$this->decrRef();"
417 %feature("unref") MEDCouplingField "$this->decrRef();"
418 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
419 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
420 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
421 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
422 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
423 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
424 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
425 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
426 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
428 %rename(assign) *::operator=;
429 %ignore ParaMEDMEM::RefCountObject::decrRef;
430 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
431 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
432 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
433 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
437 %rename (InterpKernelException) INTERP_KERNEL::Exception;
439 namespace INTERP_KERNEL
444 Exception(const char* what);
445 ~Exception() throw ();
446 const char *what() const throw ();
449 std::string __str__() const
451 return std::string(self->what());
462 void declareAsNew() const;
463 virtual void updateTime() const;
464 unsigned int getTimeOfThis() const;
492 CONST_ON_TIME_INTERVAL = 7
493 } TypeOfTimeDiscretization;
495 const char *MEDCouplingVersionStr();
496 int MEDCouplingVersion();
497 int MEDCouplingSizeOfVoidStar();
503 RefCountObject(const RefCountObject& other);
506 bool decrRef() const;
507 void incrRef() const;
508 virtual std::size_t getHeapMemorySize() const;
514 PyObject *MEDCouplingVersionMajMinRel()
516 int tmp0=0,tmp1=0,tmp2=0;
517 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
518 PyObject *res = PyList_New(3);
519 PyList_SetItem(res,0,SWIG_From_int(tmp0));
520 PyList_SetItem(res,1,SWIG_From_int(tmp1));
521 PyList_SetItem(res,2,SWIG_From_int(tmp2));
525 bool MEDCouplingHasNumPyBindings()
534 std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
536 static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
537 std::ostringstream oss; oss << "MEDCouplingCompletionScript : error when trying to activate completion ! readline not present ?\nScript is :\n" << script;
538 if(PyRun_SimpleString(script)!=0)
539 throw INTERP_KERNEL::Exception(oss.str().c_str());
540 return std::string(script);
544 %include "MEDCouplingMemArray.i"
551 UNSTRUCTURED_DESC = 6,
555 } MEDCouplingMeshType;
558 class DataArrayDouble;
559 class MEDCouplingUMesh;
560 class MEDCouplingFieldDouble;
562 %extend RefCountObject
564 std::string getHiddenCppPointer() const
566 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
571 %extend MEDCouplingGaussLocalization
573 std::string __str__() const throw(INTERP_KERNEL::Exception)
575 return self->getStringRepr();
578 std::string __repr__() const throw(INTERP_KERNEL::Exception)
580 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
581 oss << self->getStringRepr();
588 class MEDCouplingMesh : public RefCountObject, public TimeLabel
591 void setName(const char *name);
592 const char *getName() const;
593 void setDescription(const char *descr);
594 const char *getDescription() const;
595 void setTime(double val, int iteration, int order);
596 void setTimeUnit(const char *unit);
597 const char *getTimeUnit() const;
598 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
599 bool isStructured() const throw(INTERP_KERNEL::Exception);
600 virtual MEDCouplingMesh *deepCpy() const;
601 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
602 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
603 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
604 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
605 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
606 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
607 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
608 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
609 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
610 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
611 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
612 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
613 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
614 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
615 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
616 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
617 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
618 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
619 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
620 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
621 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
622 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
623 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
624 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
626 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
627 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
628 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
629 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
630 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
631 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
632 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
633 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
634 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
635 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
636 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
637 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
638 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
639 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
640 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
641 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
642 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
645 std::string __str__() const throw(INTERP_KERNEL::Exception)
647 return self->simpleRepr();
650 PyObject *getTime() throw(INTERP_KERNEL::Exception)
653 double tmp0=self->getTime(tmp1,tmp2);
654 PyObject *res = PyList_New(3);
655 PyList_SetItem(res,0,SWIG_From_double(tmp0));
656 PyList_SetItem(res,1,SWIG_From_int(tmp1));
657 PyList_SetItem(res,2,SWIG_From_int(tmp2));
661 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
665 DataArrayDoubleTuple *aa;
666 std::vector<double> bb;
668 int spaceDim=self->getSpaceDimension();
669 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
670 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
671 return self->getCellContainingPoint(pos,eps);
674 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
678 DataArrayDoubleTuple *aa;
679 std::vector<double> bb;
681 int spaceDim=self->getSpaceDimension();
682 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
683 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
684 std::vector<int> elts,eltsIndex;
685 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
686 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
687 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
688 d0->alloc(elts.size(),1);
689 d1->alloc(eltsIndex.size(),1);
690 std::copy(elts.begin(),elts.end(),d0->getPointer());
691 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
692 PyObject *ret=PyTuple_New(2);
693 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
694 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
698 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
700 std::vector<int> elts,eltsIndex;
701 int spaceDim=self->getSpaceDimension();
703 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
704 if (!SWIG_IsOK(res1))
707 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
708 int nbOfPoints=size/spaceDim;
711 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
713 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
717 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
719 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
720 da2->checkAllocated();
721 int size=da2->getNumberOfTuples();
722 int nbOfCompo=da2->getNumberOfComponents();
723 if(nbOfCompo!=spaceDim)
725 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
727 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
729 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
730 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
731 d0->alloc(elts.size(),1);
732 d1->alloc(eltsIndex.size(),1);
733 std::copy(elts.begin(),elts.end(),d0->getPointer());
734 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
735 PyObject *ret=PyTuple_New(2);
736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
741 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
745 DataArrayDoubleTuple *aa;
746 std::vector<double> bb;
748 int spaceDim=self->getSpaceDimension();
749 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
750 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
751 std::vector<int> elts;
752 self->getCellsContainingPoint(pos,eps,elts);
753 DataArrayInt *ret=DataArrayInt::New();
754 ret->alloc((int)elts.size(),1);
755 std::copy(elts.begin(),elts.end(),ret->getPointer());
756 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
759 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
762 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
763 if (!SWIG_IsOK(res1))
766 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
767 self->renumberCells(tmp,check);
771 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
773 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
774 da2->checkAllocated();
775 self->renumberCells(da2->getConstPointer(),check);
779 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
781 DataArrayInt *cellCor, *nodeCor;
782 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
783 PyObject *res = PyList_New(2);
784 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
785 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
789 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
791 DataArrayInt *cellCor=0,*nodeCor=0;
792 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
793 PyObject *res = PyList_New(2);
794 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
795 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
799 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
801 DataArrayInt *cellCor=0;
802 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
806 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
809 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
810 if (!SWIG_IsOK(res1))
813 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
814 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
818 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
820 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
821 da2->checkAllocated();
822 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
825 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
827 std::vector<int> conn;
828 self->getNodeIdsOfCell(cellId,conn);
829 return convertIntArrToPyList2(conn);
832 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
834 std::vector<double> coo;
835 self->getCoordinatesOfNode(nodeId,coo);
836 return convertDblArrToPyList2(coo);
839 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
843 DataArrayDoubleTuple *aa;
844 std::vector<double> bb;
846 int spaceDim=self->getSpaceDimension();
847 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
848 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
849 self->scale(pointPtr,factor);
852 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
854 int spaceDim=self->getSpaceDimension();
855 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
856 self->getBoundingBox(tmp);
857 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
861 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
864 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
865 PyObject *ret=PyTuple_New(2);
866 PyObject *ret0Py=ret0?Py_True:Py_False;
868 PyTuple_SetItem(ret,0,ret0Py);
869 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
873 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
875 int szArr,sw,iTypppArr;
876 std::vector<int> stdvecTyyppArr;
877 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
878 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
879 if(sw==3)//DataArrayInt
881 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
882 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
883 std::string name=argpt->getName();
885 ret->setName(name.c_str());
887 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
890 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
892 int szArr,sw,iTypppArr;
893 std::vector<int> stdvecTyyppArr;
895 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
896 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
897 if(sw==3)//DataArrayInt
899 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
900 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
901 std::string name=argpt->getName();
903 ret->setName(name.c_str());
906 PyObject *res = PyList_New(2);
907 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
908 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
909 PyList_SetItem(res,0,obj0);
910 PyList_SetItem(res,1,obj1);
914 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
918 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
919 PyObject *res = PyTuple_New(2);
920 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
923 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
925 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
926 PyTuple_SetItem(res,0,obj0);
927 PyTuple_SetItem(res,1,obj1);
931 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
933 std::vector<int> vals=self->getDistributionOfTypes();
934 PyObject *ret=PyList_New((int)vals.size()/3);
935 for(int j=0;j<(int)vals.size()/3;j++)
937 PyObject *ret1=PyList_New(3);
938 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
939 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
940 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
941 PyList_SetItem(ret,j,ret1);
946 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
948 std::vector<int> code;
949 std::vector<const DataArrayInt *> idsPerType;
950 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
951 convertPyToNewIntArr4(li,1,3,code);
952 return self->checkTypeConsistencyAndContig(code,idsPerType);
955 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
957 std::vector<int> code;
958 std::vector<DataArrayInt *> idsInPflPerType;
959 std::vector<DataArrayInt *> idsPerType;
960 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
961 PyObject *ret=PyTuple_New(3);
962 PyTuple_SetItem(ret,0,convertIntArrToPyList2(code));
963 PyObject *ret1=PyList_New(idsInPflPerType.size());
964 for(std::size_t j=0;j<idsInPflPerType.size();j++)
965 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
966 PyTuple_SetItem(ret,1,ret1);
967 int n=idsPerType.size();
968 PyObject *ret2=PyList_New(n);
970 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
971 PyTuple_SetItem(ret,2,ret2);
975 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
979 DataArrayDoubleTuple *aa;
980 std::vector<double> bb;
982 int spaceDim=self->getSpaceDimension();
983 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
984 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
985 self->translate(vectorPtr);
988 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
990 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
993 DataArrayDoubleTuple *aa;
994 std::vector<double> bb;
996 int spaceDim=self->getSpaceDimension();
997 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
998 self->rotate(centerPtr,0,alpha);
1001 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
1003 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1005 DataArrayDouble *a,*a2;
1006 DataArrayDoubleTuple *aa,*aa2;
1007 std::vector<double> bb,bb2;
1009 int spaceDim=self->getSpaceDimension();
1010 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1011 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
1012 self->rotate(centerPtr,vectorPtr,alpha);
1015 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
1017 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1018 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1019 PyObject *res=PyList_New(result.size());
1020 for(int i=0;iL!=result.end(); i++, iL++)
1021 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1025 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
1027 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
1028 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1029 return MEDCouplingMesh::MergeMeshes(tmp);
1035 //== MEDCouplingMesh End
1037 %include "NormalizedUnstructuredMesh.hxx"
1038 %include "MEDCouplingNatureOfField.hxx"
1039 %include "MEDCouplingTimeDiscretization.hxx"
1040 %include "MEDCouplingGaussLocalization.hxx"
1041 %include "MEDCouplingFieldDiscretization.hxx"
1043 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
1044 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshDataRange;
1045 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
1047 //== MEDCouplingPointSet
1049 namespace ParaMEDMEM
1051 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1054 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1055 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1056 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1057 void zipCoords() throw(INTERP_KERNEL::Exception);
1058 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1059 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1060 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1061 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1062 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1063 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1064 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1065 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1066 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1067 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1068 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1069 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1070 virtual DataArrayInt *findBoundaryNodes() const;
1071 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1072 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1073 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1074 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1077 std::string __str__() const throw(INTERP_KERNEL::Exception)
1079 return self->simpleRepr();
1082 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1085 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1086 PyObject *res = PyList_New(2);
1087 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1088 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1092 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1094 DataArrayInt *comm, *commIndex;
1095 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1096 PyObject *res = PyList_New(2);
1097 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1098 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1102 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1104 DataArrayDouble *ret1=self->getCoords();
1107 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1110 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1112 int szArr,sw,iTypppArr;
1113 std::vector<int> stdvecTyyppArr;
1114 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1115 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1116 if(sw==3)//DataArrayInt
1118 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1119 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1120 std::string name=argpt->getName();
1122 ret->setName(name.c_str());
1124 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1127 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1129 int szArr,sw,iTypppArr;
1130 std::vector<int> stdvecTyyppArr;
1131 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1132 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1133 if(sw==3)//DataArrayInt
1135 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1136 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1137 std::string name=argpt->getName();
1139 ret->setName(name.c_str());
1141 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1144 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1146 int szArr,sw,iTypppArr;
1147 std::vector<int> stdvecTyyppArr;
1148 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1149 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1150 if(sw==3)//DataArrayInt
1152 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1153 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1154 std::string name=argpt->getName();
1156 ret->setName(name.c_str());
1158 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1161 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1163 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1164 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1167 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1169 int szArr,sw,iTypppArr;
1170 std::vector<int> stdvecTyyppArr;
1171 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1172 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1173 if(sw==3)//DataArrayInt
1175 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1176 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1177 std::string name=argpt->getName();
1179 ret->setName(name.c_str());
1181 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1184 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1186 int szArr,sw,iTypppArr;
1187 std::vector<int> stdvecTyyppArr;
1188 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1189 self->renumberNodes(tmp,newNbOfNodes);
1192 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1194 int szArr,sw,iTypppArr;
1195 std::vector<int> stdvecTyyppArr;
1196 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1197 self->renumberNodes2(tmp,newNbOfNodes);
1200 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1202 int spaceDim=self->getSpaceDimension();
1204 DataArrayDouble *a,*a2;
1205 DataArrayDoubleTuple *aa,*aa2;
1206 std::vector<double> bb,bb2;
1208 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1209 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1210 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1211 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1212 std::vector<int> nodes;
1213 self->findNodesOnLine(p,v,eps,nodes);
1214 DataArrayInt *ret=DataArrayInt::New();
1215 ret->alloc((int)nodes.size(),1);
1216 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1219 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1221 int spaceDim=self->getSpaceDimension();
1223 DataArrayDouble *a,*a2;
1224 DataArrayDoubleTuple *aa,*aa2;
1225 std::vector<double> bb,bb2;
1227 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1228 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1229 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1230 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1231 std::vector<int> nodes;
1232 self->findNodesOnPlane(p,v,eps,nodes);
1233 DataArrayInt *ret=DataArrayInt::New();
1234 ret->alloc((int)nodes.size(),1);
1235 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1236 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1239 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1243 DataArrayDoubleTuple *aa;
1244 std::vector<double> bb;
1246 int spaceDim=self->getSpaceDimension();
1247 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1248 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1249 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1253 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1255 DataArrayInt *c=0,*cI=0;
1259 DataArrayDoubleTuple *aa;
1260 std::vector<double> bb;
1262 int spaceDim=self->getSpaceDimension();
1263 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1264 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1265 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1266 PyObject *ret=PyTuple_New(2);
1267 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1268 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1272 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1274 DataArrayInt *c=0,*cI=0;
1275 int spaceDim=self->getSpaceDimension();
1278 DataArrayDoubleTuple *aa;
1279 std::vector<double> bb;
1282 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1283 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1285 PyObject *ret=PyTuple_New(2);
1286 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1287 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1295 DataArrayDoubleTuple *aa;
1296 std::vector<double> bb;
1298 int spaceDim=self->getSpaceDimension();
1299 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1300 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1302 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1303 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1306 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1310 std::vector<int> multiVal;
1311 std::pair<int, std::pair<int,int> > slic;
1312 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1313 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1317 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1319 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1321 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1323 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1327 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1329 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1330 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1331 self->getReverseNodalConnectivity(d0,d1);
1332 PyObject *ret=PyTuple_New(2);
1333 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1334 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1338 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1340 DataArrayInt *v0=0,*v1=0;
1341 self->findCommonCells(compType,startCellId,v0,v1);
1342 PyObject *res = PyList_New(2);
1343 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1344 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1349 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1352 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1353 if (!SWIG_IsOK(res1))
1356 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1357 self->renumberNodesInConn(tmp);
1361 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1363 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1364 da2->checkAllocated();
1365 self->renumberNodesInConn(da2->getConstPointer());
1369 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1372 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1373 PyObject *ret=PyTuple_New(2);
1374 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1375 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1379 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1381 DataArrayInt *ret=0;
1383 int szArr,sw,iTypppArr;
1384 std::vector<int> stdvecTyyppArr;
1385 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1386 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1390 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1394 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1395 PyObject *res = PyList_New(3);
1396 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1397 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1398 PyList_SetItem(res,2,SWIG_From_int(ret2));
1402 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1406 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1407 PyObject *res = PyList_New(3);
1408 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1409 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1410 PyList_SetItem(res,2,SWIG_From_int(ret2));
1414 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1417 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1418 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1419 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1420 for(int i=0;i<sz;i++)
1421 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1424 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1427 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1429 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1430 std::vector<double> val3;
1431 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1432 "Rotate2DAlg",2,true,nbNodes);
1434 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1435 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1438 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1441 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1442 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1443 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1444 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1445 for(int i=0;i<sz;i++)
1446 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1449 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1452 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1454 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1455 std::vector<double> val3;
1456 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1457 "Rotate3DAlg",3,true,nbNodes);
1459 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1460 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1461 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1466 //== MEDCouplingPointSet End
1468 class MEDCouplingUMeshCell
1471 INTERP_KERNEL::NormalizedCellType getType() const;
1474 std::string __str__() const throw(INTERP_KERNEL::Exception)
1476 return self->repr();
1479 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1482 const int *r=self->getAllConn(ret2);
1483 PyObject *ret=PyTuple_New(ret2);
1484 for(int i=0;i<ret2;i++)
1485 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1491 class MEDCouplingUMeshCellIterator
1498 MEDCouplingUMeshCell *ret=self->nextt();
1500 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1503 PyErr_SetString(PyExc_StopIteration,"No more data.");
1510 class MEDCouplingUMeshCellByTypeIterator
1513 ~MEDCouplingUMeshCellByTypeIterator();
1518 MEDCouplingUMeshCellEntry *ret=self->nextt();
1520 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1523 PyErr_SetString(PyExc_StopIteration,"No more data.");
1530 class MEDCouplingUMeshCellByTypeEntry
1533 ~MEDCouplingUMeshCellByTypeEntry();
1536 MEDCouplingUMeshCellByTypeIterator *__iter__()
1538 return self->iterator();
1543 class MEDCouplingUMeshCellEntry
1546 INTERP_KERNEL::NormalizedCellType getType() const;
1547 int getNumberOfElems() const;
1550 MEDCouplingUMeshCellIterator *__iter__()
1552 return self->iterator();
1557 //== MEDCouplingUMesh
1559 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1562 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1563 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1564 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1565 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1566 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1567 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1568 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1569 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1570 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1571 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1572 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1573 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1574 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1575 void computeTypes() throw(INTERP_KERNEL::Exception);
1576 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1577 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1579 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1580 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1581 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1582 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1583 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1584 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1585 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1586 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1587 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1588 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1589 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1590 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1591 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1592 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1593 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1594 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1595 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1596 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1597 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1598 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1599 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1600 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1601 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1602 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1603 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1604 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1605 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1606 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1607 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1608 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1609 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1611 MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1612 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1613 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1614 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1615 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1616 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1618 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1620 return MEDCouplingUMesh::New();
1623 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1625 return MEDCouplingUMesh::New(meshName,meshDim);
1628 std::string __str__() const throw(INTERP_KERNEL::Exception)
1630 return self->simpleRepr();
1633 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1635 std::ostringstream oss;
1636 self->reprQuickOverview(oss);
1640 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1642 return self->cellIterator();
1645 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1649 std::vector<int> multiVal;
1650 std::pair<int, std::pair<int,int> > slic;
1651 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1652 int nbc=self->getNumberOfCells();
1653 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1660 std::ostringstream oss;
1661 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1662 throw INTERP_KERNEL::Exception(oss.str().c_str());
1665 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1670 int tmp=nbc+singleVal;
1671 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1675 std::ostringstream oss;
1676 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1677 throw INTERP_KERNEL::Exception(oss.str().c_str());
1683 return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1687 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1692 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1693 daIntTyypp->checkAllocated();
1694 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1697 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1701 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1705 std::vector<int> multiVal;
1706 std::pair<int, std::pair<int,int> > slic;
1707 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1708 int nbc=self->getNumberOfCells();
1709 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1716 std::ostringstream oss;
1717 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1718 throw INTERP_KERNEL::Exception(oss.str().c_str());
1722 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1729 int tmp=nbc+singleVal;
1730 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1735 std::ostringstream oss;
1736 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1737 throw INTERP_KERNEL::Exception(oss.str().c_str());
1743 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1749 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1750 daIntTyypp->checkAllocated();
1751 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1755 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1759 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1763 std::vector<int> multiVal;
1764 std::pair<int, std::pair<int,int> > slic;
1765 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1766 int nbc=self->getNumberOfCells();
1767 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1774 std::ostringstream oss;
1775 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1776 throw INTERP_KERNEL::Exception(oss.str().c_str());
1780 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1787 int tmp=nbc+singleVal;
1788 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1793 std::ostringstream oss;
1794 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1795 throw INTERP_KERNEL::Exception(oss.str().c_str());
1801 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1806 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1812 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1813 daIntTyypp->checkAllocated();
1814 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1818 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1822 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1824 int szArr,sw,iTypppArr;
1825 std::vector<int> stdvecTyyppArr;
1826 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1829 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1830 throw INTERP_KERNEL::Exception(oss.str().c_str());
1832 self->insertNextCell(type,size,tmp);
1835 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1837 int szArr,sw,iTypppArr;
1838 std::vector<int> stdvecTyyppArr;
1839 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1840 self->insertNextCell(type,szArr,tmp);
1843 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1845 DataArrayInt *ret=self->getNodalConnectivity();
1850 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1852 DataArrayInt *ret=self->getNodalConnectivityIndex();
1857 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1859 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1860 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1861 PyObject *res = PyList_New(result.size());
1862 for (int i=0;iL!=result.end(); i++, iL++)
1863 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1867 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1869 int szArr,sw,iTypppArr;
1870 std::vector<int> stdvecTyyppArr;
1871 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1872 int nbOfDepthPeelingPerformed=0;
1873 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1874 PyObject *res=PyTuple_New(2);
1875 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1880 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1882 DataArrayInt *v0=0,*v1=0;
1883 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1884 PyObject *res = PyList_New(2);
1885 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1886 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1890 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1894 DataArrayDoubleTuple *aa;
1895 std::vector<double> bb;
1897 int nbOfCompo=self->getSpaceDimension();
1898 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1901 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1902 PyObject *ret=PyTuple_New(2);
1903 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1904 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1908 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1910 DataArrayInt *ret1=0;
1911 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1912 PyObject *ret=PyTuple_New(2);
1913 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1914 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1920 std::vector<int> cells;
1921 self->checkButterflyCells(cells,eps);
1922 DataArrayInt *ret=DataArrayInt::New();
1923 ret->alloc((int)cells.size(),1);
1924 std::copy(cells.begin(),cells.end(),ret->getPointer());
1925 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1928 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1930 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1932 PyObject *ret = PyList_New(sz);
1933 for(int i=0;i<sz;i++)
1934 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1938 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1940 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1941 int sz=retCpp.size();
1942 PyObject *ret=PyList_New(sz);
1943 for(int i=0;i<sz;i++)
1944 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1948 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1951 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1952 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1953 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1956 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1959 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1960 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1964 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1967 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1968 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1972 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1974 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1975 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1976 PyObject *ret=PyTuple_New(3);
1977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1979 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1983 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1985 DataArrayInt *tmp0=0,*tmp1=0;
1986 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1987 PyObject *ret=PyTuple_New(2);
1988 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1989 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1993 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1997 std::vector<int> multiVal;
1998 std::pair<int, std::pair<int,int> > slic;
1999 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2000 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2004 return self->duplicateNodes(&singleVal,&singleVal+1);
2006 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2008 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2010 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2014 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2018 std::vector<int> multiVal;
2019 std::pair<int, std::pair<int,int> > slic;
2020 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2021 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2025 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2027 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2029 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2031 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2035 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2038 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2039 DataArrayInt *tmp0,*tmp1=0;
2040 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2041 PyObject *ret=PyTuple_New(2);
2042 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2043 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2047 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2049 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2050 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2051 DataArrayInt *ret1=0,*ret2=0;
2052 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2053 PyObject *ret=PyTuple_New(3);
2054 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2055 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2056 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2062 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2063 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2064 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2065 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2068 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2071 std::vector<const MEDCouplingUMesh *> meshes;
2072 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2073 std::vector<DataArrayInt *> corr;
2074 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2076 PyObject *ret1=PyList_New(sz);
2077 for(int i=0;i<sz;i++)
2078 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 PyObject *ret=PyList_New(2);
2080 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2081 PyList_SetItem(ret,1,ret1);
2085 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2087 std::vector<MEDCouplingUMesh *> meshes;
2088 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2089 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2092 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2094 std::vector<MEDCouplingUMesh *> meshes;
2095 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2096 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2099 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2103 std::vector<int> multiVal;
2104 std::pair<int, std::pair<int,int> > slic;
2105 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2107 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2108 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2112 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2114 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2116 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2118 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2122 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2124 DataArrayInt *arrOut=0,*arrIndexOut=0;
2127 std::vector<int> multiVal;
2128 std::pair<int, std::pair<int,int> > slic;
2129 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2131 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2132 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2137 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2142 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2147 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2151 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2153 PyObject *ret=PyTuple_New(2);
2154 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2155 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2160 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2161 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2163 DataArrayInt *arrOut=0,*arrIndexOut=0;
2166 std::vector<int> multiVal;
2167 std::pair<int, std::pair<int,int> > slic;
2168 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2170 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2171 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2176 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2181 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2186 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2190 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2192 PyObject *ret=PyTuple_New(2);
2193 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2194 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2199 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2203 std::vector<int> multiVal;
2204 std::pair<int, std::pair<int,int> > slic;
2205 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2207 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2208 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2213 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2218 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2223 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2227 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2231 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2235 DataArrayDoubleTuple *aa;
2236 std::vector<double> bb;
2238 int spaceDim=self->getSpaceDimension();
2239 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2240 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2242 std::vector<int> cells;
2243 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2244 DataArrayInt *ret=DataArrayInt::New();
2245 ret->alloc((int)cells.size(),1);
2246 std::copy(cells.begin(),cells.end(),ret->getPointer());
2247 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2250 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2254 DataArrayDoubleTuple *aa;
2255 std::vector<double> bb;
2257 int spaceDim=self->getSpaceDimension();
2258 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2259 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2260 self->orientCorrectly2DCells(v,polyOnly);
2263 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2265 std::vector<int> cells;
2266 self->arePolyhedronsNotCorrectlyOriented(cells);
2267 DataArrayInt *ret=DataArrayInt::New();
2268 ret->alloc((int)cells.size(),1);
2269 std::copy(cells.begin(),cells.end(),ret->getPointer());
2270 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2273 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2277 self->getFastAveragePlaneOfThis(vec,pos);
2279 std::copy(vec,vec+3,vals);
2280 std::copy(pos,pos+3,vals+3);
2281 return convertDblArrToPyListOfTuple(vals,3,2);
2284 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2286 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2287 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2288 return MEDCouplingUMesh::MergeUMeshes(tmp);
2291 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2294 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2295 PyObject *ret=PyTuple_New(2);
2296 PyObject *ret0Py=ret0?Py_True:Py_False;
2298 PyTuple_SetItem(ret,0,ret0Py);
2299 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2303 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2306 bool ret0=self->areCellsIncludedIn2(other,ret1);
2307 PyObject *ret=PyTuple_New(2);
2308 PyObject *ret0Py=ret0?Py_True:Py_False;
2310 PyTuple_SetItem(ret,0,ret0Py);
2311 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2315 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2318 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2319 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2321 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2322 PyObject *ret=PyTuple_New(5);
2323 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2325 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2333 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2336 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2337 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2338 PyObject *ret=PyTuple_New(5);
2339 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2340 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2341 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2349 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2350 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2351 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2353 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2354 PyObject *ret=PyTuple_New(5);
2355 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2356 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2357 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2359 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2365 DataArrayInt *neighbors=0,*neighborsIdx=0;
2366 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2367 PyObject *ret=PyTuple_New(2);
2368 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2375 DataArrayInt *neighbors=0,*neighborsIdx=0;
2376 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2377 PyObject *ret=PyTuple_New(2);
2378 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2385 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2386 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2387 DataArrayInt *d2,*d3,*d4,*dd5;
2388 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2389 PyObject *ret=PyTuple_New(7);
2390 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2391 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2392 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2396 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2400 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2403 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2404 da->checkAllocated();
2405 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2408 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2411 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2412 da->checkAllocated();
2413 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2416 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2419 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2420 da->checkAllocated();
2421 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2424 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2427 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2428 da->checkAllocated();
2429 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2430 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2431 PyObject *res = PyList_New(result.size());
2432 for (int i=0;iL!=result.end(); i++, iL++)
2433 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2437 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2440 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2441 da->checkAllocated();
2442 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2443 ret->setName(da->getName().c_str());
2447 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
2450 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2451 if (!SWIG_IsOK(res1))
2454 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2455 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
2459 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2461 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2462 da2->checkAllocated();
2463 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
2467 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2469 DataArrayInt *cellNb1=0,*cellNb2=0;
2470 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2471 PyObject *ret=PyTuple_New(3);
2472 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2473 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2474 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2478 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2480 int spaceDim=self->getSpaceDimension();
2482 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2484 DataArrayDouble *a,*a2;
2485 DataArrayDoubleTuple *aa,*aa2;
2486 std::vector<double> bb,bb2;
2488 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2489 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2490 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2491 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2493 DataArrayInt *cellIds=0;
2494 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2495 PyObject *ret=PyTuple_New(2);
2496 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2497 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2501 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2503 int spaceDim=self->getSpaceDimension();
2505 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2507 DataArrayDouble *a,*a2;
2508 DataArrayDoubleTuple *aa,*aa2;
2509 std::vector<double> bb,bb2;
2511 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2512 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2513 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2514 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2516 DataArrayInt *cellIds=0;
2517 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2518 PyObject *ret=PyTuple_New(2);
2519 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2520 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2524 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2526 int spaceDim=self->getSpaceDimension();
2528 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2530 DataArrayDouble *a,*a2;
2531 DataArrayDoubleTuple *aa,*aa2;
2532 std::vector<double> bb,bb2;
2534 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2535 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2536 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2537 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2538 return self->getCellIdsCrossingPlane(orig,vect,eps);
2541 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2545 std::vector<int> pos2;
2546 DataArrayInt *pos3=0;
2547 DataArrayIntTuple *pos4=0;
2548 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2553 self->convertToPolyTypes(&pos1,&pos1+1);
2560 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2565 self->convertToPolyTypes(pos3->begin(),pos3->end());
2569 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2573 void convertAllToPoly();
2574 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2575 bool unPolyze() throw(INTERP_KERNEL::Exception);
2576 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2577 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2578 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2581 //== MEDCouplingUMesh End
2583 //== MEDCouplingExtrudedMesh
2585 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2588 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2589 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2591 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2593 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2596 std::string __str__() const throw(INTERP_KERNEL::Exception)
2598 return self->simpleRepr();
2601 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2603 std::ostringstream oss;
2604 self->reprQuickOverview(oss);
2608 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2610 MEDCouplingUMesh *ret=self->getMesh2D();
2613 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2615 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2617 MEDCouplingUMesh *ret=self->getMesh1D();
2620 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2622 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2624 DataArrayInt *ret=self->getMesh3DIds();
2627 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2632 //== MEDCouplingExtrudedMesh End
2634 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2637 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2640 //== MEDCoupling1SGTUMesh
2642 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2645 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2646 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2647 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2648 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2649 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2650 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2651 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2654 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2656 return MEDCoupling1SGTUMesh::New(name,type);
2659 std::string __str__() const throw(INTERP_KERNEL::Exception)
2661 return self->simpleRepr();
2664 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2666 std::ostringstream oss;
2667 self->reprQuickOverview(oss);
2671 DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2673 DataArrayInt *ret=self->getNodalConnectivity();
2674 if(ret) ret->incrRef();
2678 void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2680 int szArr,sw,iTypppArr;
2681 std::vector<int> stdvecTyyppArr;
2682 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2683 self->insertNextCell(tmp,tmp+szArr);
2686 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2688 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2689 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2690 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2693 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2695 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2696 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2697 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2702 //== MEDCoupling1SGTUMesh End
2704 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2707 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2708 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2711 //== MEDCouplingCMesh
2713 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2716 static MEDCouplingCMesh *New();
2717 static MEDCouplingCMesh *New(const char *meshName);
2718 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2719 void setCoords(const DataArrayDouble *coordsX,
2720 const DataArrayDouble *coordsY=0,
2721 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2722 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2726 return MEDCouplingCMesh::New();
2728 MEDCouplingCMesh(const char *meshName)
2730 return MEDCouplingCMesh::New(meshName);
2732 std::string __str__() const throw(INTERP_KERNEL::Exception)
2734 return self->simpleRepr();
2736 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2738 std::ostringstream oss;
2739 self->reprQuickOverview(oss);
2742 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2744 DataArrayDouble *ret=self->getCoordsAt(i);
2752 //== MEDCouplingCMesh End
2754 //== MEDCouplingCurveLinearMesh
2756 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2759 static MEDCouplingCurveLinearMesh *New();
2760 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2761 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2762 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2763 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2765 MEDCouplingCurveLinearMesh()
2767 return MEDCouplingCurveLinearMesh::New();
2769 MEDCouplingCurveLinearMesh(const char *meshName)
2771 return MEDCouplingCurveLinearMesh::New(meshName);
2773 std::string __str__() const throw(INTERP_KERNEL::Exception)
2775 return self->simpleRepr();
2777 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2779 std::ostringstream oss;
2780 self->reprQuickOverview(oss);
2783 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2785 DataArrayDouble *ret=self->getCoords();
2790 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2792 int szArr,sw,iTypppArr;
2793 std::vector<int> stdvecTyyppArr;
2794 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2795 self->setNodeGridStructure(tmp,tmp+szArr);
2800 //== MEDCouplingCurveLinearMesh End
2803 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
2805 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
2807 int sz=0,sw=-1,val1=-1;
2808 std::vector<int> val2;
2809 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
2810 return self->clonePart(inp,inp+sz);
2813 PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const throw(INTERP_KERNEL::Exception)
2815 DataArrayInt *ret1=0;
2817 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,begin,end,step,bb,ee,ss,ret1);
2818 PyObject *res=PyTuple_New(2);
2819 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2821 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2824 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
2825 PyTuple_SetItem(res,1,res1);
2830 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2832 std::vector<int> vVal; int iVal=-1;
2834 const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
2836 throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
2837 DataArrayInt *ret0=0,*ret1=0;
2838 self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
2839 PyObject *pyRet=PyTuple_New(2);
2840 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2841 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2846 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationP0
2848 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2849 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2852 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationOnNodes
2854 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2855 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2858 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGauss
2860 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2861 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2864 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGaussNE
2866 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2867 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2870 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
2872 PyObject *getArrayOfDiscIds() const
2874 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
2877 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2880 PyObject *splitIntoSingleGaussDicrPerCellType() const throw(INTERP_KERNEL::Exception)
2882 std::vector<int> ret1;
2883 std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
2884 std::size_t sz=ret0.size();
2885 PyObject *pyRet=PyTuple_New(2);
2886 PyObject *pyRet0=PyList_New((int)sz);
2887 PyObject *pyRet1=PyList_New((int)sz);
2888 for(std::size_t i=0;i<sz;i++)
2890 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2891 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
2893 PyTuple_SetItem(pyRet,0,pyRet0);
2894 PyTuple_SetItem(pyRet,1,pyRet1);
2899 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
2901 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
2904 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
2905 PyObject *ret=PyTuple_New(2);
2906 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2907 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
2912 namespace ParaMEDMEM
2914 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2917 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2918 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2919 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2920 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2921 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2922 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2923 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2924 const char *getDescription() const throw(INTERP_KERNEL::Exception);
2925 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2926 const char *getName() const throw(INTERP_KERNEL::Exception);
2927 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2928 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2929 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2930 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2931 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2932 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2933 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2934 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2935 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2936 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2937 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2938 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2939 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2940 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2941 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2942 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2944 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2946 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2949 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2952 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2954 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2957 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2960 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2962 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2963 return convertIntArrToPyList3(ret);
2966 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2969 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2970 PyObject *ret=PyTuple_New(2);
2971 PyObject *ret0Py=ret0?Py_True:Py_False;
2973 PyTuple_SetItem(ret,0,ret0Py);
2974 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2978 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2980 DataArrayInt *ret1=0;
2981 MEDCouplingMesh *ret0=0;
2983 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2984 if (!SWIG_IsOK(res1))
2987 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2988 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2992 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2994 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2995 da2->checkAllocated();
2996 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2998 PyObject *res = PyList_New(2);
2999 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3000 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3004 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3006 DataArrayInt *ret1=0;
3008 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3009 PyObject *res=PyTuple_New(2);
3010 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3012 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3015 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3016 PyTuple_SetItem(res,1,res1);
3021 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
3025 std::vector<int> pos2;
3026 DataArrayInt *pos3=0;
3027 DataArrayIntTuple *pos4=0;
3028 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
3033 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
3037 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
3041 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
3044 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
3048 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3049 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3052 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3053 if (!SWIG_IsOK(res1))
3056 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3057 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3061 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3063 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3064 da2->checkAllocated();
3065 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3069 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3071 std::vector<int> tmp;
3072 self->getCellIdsHavingGaussLocalization(locId,tmp);
3073 DataArrayInt *ret=DataArrayInt::New();
3074 ret->alloc((int)tmp.size(),1);
3075 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3076 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3081 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3084 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3085 static MEDCouplingFieldTemplate *New(TypeOfField type);
3086 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3087 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3090 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3092 return MEDCouplingFieldTemplate::New(f);
3095 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3097 return MEDCouplingFieldTemplate::New(type);
3100 std::string __str__() const throw(INTERP_KERNEL::Exception)
3102 return self->simpleRepr();
3105 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3107 std::ostringstream oss;
3108 self->reprQuickOverview(oss);
3114 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3117 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3118 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3119 void setTimeUnit(const char *unit);
3120 const char *getTimeUnit() const;
3121 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3122 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3123 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3124 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3125 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3126 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
3127 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3128 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3129 MEDCouplingFieldDouble *deepCpy() const;
3130 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3131 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3132 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3133 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3134 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3135 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3136 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3137 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3138 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3139 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3140 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3141 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3142 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3143 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3144 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3145 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3146 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3147 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3148 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3149 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3150 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3151 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3152 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3153 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3154 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3155 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3156 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3157 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3158 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3161 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3162 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3163 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3164 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3165 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3166 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3167 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3168 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3169 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3170 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3171 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3172 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3173 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3174 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3175 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3176 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3177 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3178 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3179 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3180 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3181 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3182 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3183 double getMinValue() const throw(INTERP_KERNEL::Exception);
3184 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3185 double norm2() const throw(INTERP_KERNEL::Exception);
3186 double normMax() const throw(INTERP_KERNEL::Exception);
3187 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3188 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3189 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3190 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3191 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3192 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3193 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3194 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3195 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3198 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3200 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3201 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3202 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3203 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3204 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3205 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3206 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3207 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3208 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3210 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3212 return MEDCouplingFieldDouble::New(type,td);
3215 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3217 return MEDCouplingFieldDouble::New(ft,td);
3220 std::string __str__() const throw(INTERP_KERNEL::Exception)
3222 return self->simpleRepr();
3225 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3227 std::ostringstream oss;
3228 self->reprQuickOverview(oss);
3232 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3234 DataArrayDouble *ret=self->getArray();
3240 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3242 std::vector<DataArrayDouble *> arrs=self->getArrays();
3243 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3247 PyObject *ret=PyTuple_New(sz);
3248 for(int i=0;i<sz;i++)
3251 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3253 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3258 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3260 std::vector<const DataArrayDouble *> tmp;
3261 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3263 std::vector<DataArrayDouble *> arrs(sz);
3264 for(int i=0;i<sz;i++)
3265 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3266 self->setArrays(arrs);
3269 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3271 DataArrayDouble *ret=self->getEndArray();
3277 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3281 DataArrayDoubleTuple *aa;
3282 std::vector<double> bb;
3284 const MEDCouplingMesh *mesh=self->getMesh();
3286 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3287 int spaceDim=mesh->getSpaceDimension();
3288 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3289 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3291 int sz=self->getNumberOfComponents();
3292 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3293 self->getValueOn(spaceLoc,res);
3294 return convertDblArrToPyList(res,sz);
3297 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3299 int sz=self->getNumberOfComponents();
3300 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3301 self->getValueOnPos(i,j,k,res);
3302 return convertDblArrToPyList(res,sz);
3305 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
3308 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
3309 if (!SWIG_IsOK(res1))
3312 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(li,&size);
3313 const MEDCouplingMesh *mesh=self->getMesh();
3315 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3316 int spaceDim=mesh->getSpaceDimension();
3317 int nbOfPoints=size/spaceDim;
3318 if(size%spaceDim!=0)
3320 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
3322 return self->getValueOnMulti(tmp,nbOfPoints);
3326 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
3328 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
3329 da2->checkAllocated();
3330 int size=da2->getNumberOfTuples();
3331 int nbOfCompo=da2->getNumberOfComponents();
3332 const MEDCouplingMesh *mesh=self->getMesh();
3334 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3335 if(nbOfCompo!=mesh->getSpaceDimension())
3337 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
3339 return self->getValueOnMulti(da2->getConstPointer(),size);
3343 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3347 DataArrayDoubleTuple *aa;
3348 std::vector<double> bb;
3350 const MEDCouplingMesh *mesh=self->getMesh();
3352 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3353 int spaceDim=mesh->getSpaceDimension();
3354 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3355 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3358 int sz=self->getNumberOfComponents();
3359 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3360 self->getValueOn(spaceLoc,time,res);
3361 return convertDblArrToPyList(res,sz);
3364 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3366 if(self->getArray()!=0)
3367 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3370 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3371 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3372 self->setArray(arr);
3376 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3379 double tmp0=self->getTime(tmp1,tmp2);
3380 PyObject *res = PyList_New(3);
3381 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3382 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3383 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3387 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3390 double tmp0=self->getStartTime(tmp1,tmp2);
3391 PyObject *res = PyList_New(3);
3392 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3393 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3394 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3398 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3401 double tmp0=self->getEndTime(tmp1,tmp2);
3402 PyObject *res = PyList_New(3);
3403 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3404 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3405 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3408 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3410 int sz=self->getNumberOfComponents();
3411 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3412 self->accumulate(tmp);
3413 return convertDblArrToPyList(tmp,sz);
3415 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3417 int sz=self->getNumberOfComponents();
3418 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3419 self->integral(isWAbs,tmp);
3420 return convertDblArrToPyList(tmp,sz);
3422 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3424 int sz=self->getNumberOfComponents();
3425 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3426 self->getWeightedAverageValue(tmp,isWAbs);
3427 return convertDblArrToPyList(tmp,sz);
3429 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3431 int sz=self->getNumberOfComponents();
3432 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3434 return convertDblArrToPyList(tmp,sz);
3436 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3438 int sz=self->getNumberOfComponents();
3439 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3441 return convertDblArrToPyList(tmp,sz);
3443 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3446 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3447 if (!SWIG_IsOK(res1))
3450 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3451 self->renumberCells(tmp,check);
3455 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3457 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3458 da2->checkAllocated();
3459 self->renumberCells(da2->getConstPointer(),check);
3462 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3465 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3466 if (!SWIG_IsOK(res1))
3469 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3470 self->renumberNodes(tmp,eps);
3474 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3476 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3477 da2->checkAllocated();
3478 self->renumberNodes(da2->getConstPointer(),eps);
3482 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3486 std::vector<int> multiVal;
3487 std::pair<int, std::pair<int,int> > slic;
3488 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3489 const MEDCouplingMesh *mesh=self->getMesh();
3491 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3492 int nbc=mesh->getNumberOfCells();
3493 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3500 std::ostringstream oss;
3501 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3502 throw INTERP_KERNEL::Exception(oss.str().c_str());
3505 return self->buildSubPart(&singleVal,&singleVal+1);
3510 int tmp=nbc+singleVal;
3511 return self->buildSubPart(&tmp,&tmp+1);
3515 std::ostringstream oss;
3516 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3517 throw INTERP_KERNEL::Exception(oss.str().c_str());
3523 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3527 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3532 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3533 daIntTyypp->checkAllocated();
3534 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3537 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3541 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3543 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";
3544 if(PyTuple_Check(li))
3546 Py_ssize_t sz=PyTuple_Size(li);
3548 throw INTERP_KERNEL::Exception(msg);
3549 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3552 std::vector<int> multiVal;
3553 std::pair<int, std::pair<int,int> > slic;
3554 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3555 if(!self->getArray())
3556 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3558 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3559 catch(INTERP_KERNEL::Exception& e)
3560 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3561 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3562 DataArrayDouble *ret0Arr=ret0->getArray();
3564 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3569 std::vector<int> v2(1,singleVal);
3570 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3571 ret0->setArray(aarr);
3576 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3577 ret0->setArray(aarr);
3582 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3583 std::vector<int> v2(nbOfComp);
3584 for(int i=0;i<nbOfComp;i++)
3585 v2[i]=slic.first+i*slic.second.second;
3586 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3587 ret0->setArray(aarr);
3591 throw INTERP_KERNEL::Exception(msg);
3596 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3599 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3602 double r1=self->getMaxValue2(tmp);
3603 PyObject *ret=PyTuple_New(2);
3604 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3605 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3609 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3612 double r1=self->getMinValue2(tmp);
3613 PyObject *ret=PyTuple_New(2);
3614 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3615 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3619 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3621 std::vector<int> tmp;
3622 convertPyToNewIntArr3(li,tmp);
3623 return self->keepSelectedComponents(tmp);
3626 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3628 std::vector<int> tmp;
3629 convertPyToNewIntArr3(li,tmp);
3630 self->setSelectedComponents(f,tmp);
3633 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3636 DataArrayDouble *a,*a2;
3637 DataArrayDoubleTuple *aa,*aa2;
3638 std::vector<double> bb,bb2;
3641 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3642 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3643 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3644 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3646 return self->extractSlice3D(orig,vect,eps);
3649 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3651 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3654 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3656 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3659 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3661 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.";
3662 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3665 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3667 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3669 return (*self)-(*other);
3671 throw INTERP_KERNEL::Exception(msg);
3676 DataArrayDoubleTuple *aa;
3677 std::vector<double> bb;
3679 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3684 if(!self->getArray())
3685 throw INTERP_KERNEL::Exception(msg2);
3686 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3687 ret->applyLin(1.,-val);
3688 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3689 ret2->setArray(ret);
3694 if(!self->getArray())
3695 throw INTERP_KERNEL::Exception(msg2);
3696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3697 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3698 ret2->setArray(ret);
3703 if(!self->getArray())
3704 throw INTERP_KERNEL::Exception(msg2);
3705 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3707 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3708 ret2->setArray(ret);
3713 if(!self->getArray())
3714 throw INTERP_KERNEL::Exception(msg2);
3715 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3716 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3717 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3718 ret2->setArray(ret);
3722 { throw INTERP_KERNEL::Exception(msg); }
3726 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3728 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3731 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3733 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3736 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3738 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3741 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3743 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.";
3744 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3747 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3749 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3751 return (*self)/(*other);
3753 throw INTERP_KERNEL::Exception(msg);
3758 DataArrayDoubleTuple *aa;
3759 std::vector<double> bb;
3761 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3767 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3768 if(!self->getArray())
3769 throw INTERP_KERNEL::Exception(msg2);
3770 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3771 ret->applyLin(1./val,0);
3772 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3773 ret2->setArray(ret);
3778 if(!self->getArray())
3779 throw INTERP_KERNEL::Exception(msg2);
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3781 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3782 ret2->setArray(ret);
3787 if(!self->getArray())
3788 throw INTERP_KERNEL::Exception(msg2);
3789 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3791 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3792 ret2->setArray(ret);
3797 if(!self->getArray())
3798 throw INTERP_KERNEL::Exception(msg2);
3799 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3800 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3801 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3802 ret2->setArray(ret);
3806 { throw INTERP_KERNEL::Exception(msg); }
3810 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3812 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3815 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3817 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.";
3818 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3821 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3823 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3825 return (*self)^(*other);
3827 throw INTERP_KERNEL::Exception(msg);
3832 DataArrayDoubleTuple *aa;
3833 std::vector<double> bb;
3835 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3840 if(!self->getArray())
3841 throw INTERP_KERNEL::Exception(msg2);
3842 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3844 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3845 ret2->setArray(ret);
3850 if(!self->getArray())
3851 throw INTERP_KERNEL::Exception(msg2);
3852 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3853 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3854 ret2->setArray(ret);
3859 if(!self->getArray())
3860 throw INTERP_KERNEL::Exception(msg2);
3861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3862 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3863 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3864 ret2->setArray(ret);
3869 if(!self->getArray())
3870 throw INTERP_KERNEL::Exception(msg2);
3871 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3872 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3873 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3874 ret2->setArray(ret);
3878 { throw INTERP_KERNEL::Exception(msg); }
3882 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3884 return self->negate();
3887 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3889 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.";
3890 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3893 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3895 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3899 Py_XINCREF(trueSelf);
3903 throw INTERP_KERNEL::Exception(msg);
3908 DataArrayDoubleTuple *aa;
3909 std::vector<double> bb;
3911 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3916 if(!self->getArray())
3917 throw INTERP_KERNEL::Exception(msg2);
3918 self->getArray()->applyLin(1.,val);
3919 Py_XINCREF(trueSelf);
3924 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3927 Py_XINCREF(trueSelf);
3932 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3933 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3934 ret2->setArray(aaa);
3936 Py_XINCREF(trueSelf);
3941 if(!self->getArray())
3942 throw INTERP_KERNEL::Exception(msg2);
3943 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3944 self->getArray()->addEqual(aaa);
3945 Py_XINCREF(trueSelf);
3949 { throw INTERP_KERNEL::Exception(msg); }
3953 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3955 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.";
3956 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3959 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3961 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3965 Py_XINCREF(trueSelf);
3969 throw INTERP_KERNEL::Exception(msg);
3974 DataArrayDoubleTuple *aa;
3975 std::vector<double> bb;
3977 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3982 if(!self->getArray())
3983 throw INTERP_KERNEL::Exception(msg2);
3984 self->getArray()->applyLin(1.,-val);
3985 Py_XINCREF(trueSelf);
3990 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3993 Py_XINCREF(trueSelf);
3998 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3999 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4000 ret2->setArray(aaa);
4002 Py_XINCREF(trueSelf);
4007 if(!self->getArray())
4008 throw INTERP_KERNEL::Exception(msg2);
4009 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4010 self->getArray()->substractEqual(aaa);
4011 Py_XINCREF(trueSelf);
4015 { throw INTERP_KERNEL::Exception(msg); }
4019 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4021 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.";
4022 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4025 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4027 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4031 Py_XINCREF(trueSelf);
4035 throw INTERP_KERNEL::Exception(msg);
4040 DataArrayDoubleTuple *aa;
4041 std::vector<double> bb;
4043 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4048 if(!self->getArray())
4049 throw INTERP_KERNEL::Exception(msg2);
4050 self->getArray()->applyLin(val,0);
4051 Py_XINCREF(trueSelf);
4056 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4059 Py_XINCREF(trueSelf);
4064 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4065 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4066 ret2->setArray(aaa);
4068 Py_XINCREF(trueSelf);
4073 if(!self->getArray())
4074 throw INTERP_KERNEL::Exception(msg2);
4075 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4076 self->getArray()->multiplyEqual(aaa);
4077 Py_XINCREF(trueSelf);
4081 { throw INTERP_KERNEL::Exception(msg); }
4085 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4087 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.";
4088 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4091 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4093 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4097 Py_XINCREF(trueSelf);
4101 throw INTERP_KERNEL::Exception(msg);
4106 DataArrayDoubleTuple *aa;
4107 std::vector<double> bb;
4109 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4115 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4116 if(!self->getArray())
4117 throw INTERP_KERNEL::Exception(msg2);
4118 self->getArray()->applyLin(1./val,0);
4119 Py_XINCREF(trueSelf);
4124 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4127 Py_XINCREF(trueSelf);
4132 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4133 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4134 ret2->setArray(aaa);
4136 Py_XINCREF(trueSelf);
4141 if(!self->getArray())
4142 throw INTERP_KERNEL::Exception(msg2);
4143 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4144 self->getArray()->divideEqual(aaa);
4145 Py_XINCREF(trueSelf);
4149 { throw INTERP_KERNEL::Exception(msg); }
4153 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4155 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.";
4156 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4159 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4161 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4165 Py_XINCREF(trueSelf);
4169 throw INTERP_KERNEL::Exception(msg);
4174 DataArrayDoubleTuple *aa;
4175 std::vector<double> bb;
4177 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4182 if(!self->getArray())
4183 throw INTERP_KERNEL::Exception(msg2);
4184 self->getArray()->applyPow(val);
4185 Py_XINCREF(trueSelf);
4190 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4193 Py_XINCREF(trueSelf);
4198 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4199 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4200 ret2->setArray(aaa);
4202 Py_XINCREF(trueSelf);
4207 if(!self->getArray())
4208 throw INTERP_KERNEL::Exception(msg2);
4209 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4210 self->getArray()->powEqual(aaa);
4211 Py_XINCREF(trueSelf);
4215 { throw INTERP_KERNEL::Exception(msg); }
4219 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4221 std::vector<const MEDCouplingFieldDouble *> tmp;
4222 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4223 return MEDCouplingFieldDouble::MergeFields(tmp);
4226 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
4228 std::vector<const MEDCouplingFieldDouble *> tmp;
4229 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4230 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
4235 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4238 int getNumberOfFields() const;
4239 MEDCouplingMultiFields *deepCpy() const;
4240 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4241 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4242 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4243 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4244 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4247 std::string __str__() const throw(INTERP_KERNEL::Exception)
4249 return self->simpleRepr();
4251 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4253 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4254 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4256 std::vector<MEDCouplingFieldDouble *> fs(sz);
4257 for(int i=0;i<sz;i++)
4258 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4259 return MEDCouplingMultiFields::New(fs);
4261 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4263 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4264 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4266 std::vector<MEDCouplingFieldDouble *> fs(sz);
4267 for(int i=0;i<sz;i++)
4268 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4269 return MEDCouplingMultiFields::New(fs);
4271 PyObject *getFields() const
4273 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4274 int sz=fields.size();
4275 PyObject *res = PyList_New(sz);
4276 for(int i=0;i<sz;i++)
4280 fields[i]->incrRef();
4281 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4285 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4290 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4292 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4296 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4299 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4301 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4303 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4305 PyObject *res = PyList_New(sz);
4306 for(int i=0;i<sz;i++)
4311 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4315 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4320 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4322 std::vector<int> refs;
4323 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4325 PyObject *res = PyList_New(sz);
4326 for(int i=0;i<sz;i++)
4331 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4335 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4339 PyObject *ret=PyTuple_New(2);
4340 PyTuple_SetItem(ret,0,res);
4341 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4344 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4346 std::vector<DataArrayDouble *> ms=self->getArrays();
4348 PyObject *res = PyList_New(sz);
4349 for(int i=0;i<sz;i++)
4354 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4358 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4363 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4365 std::vector< std::vector<int> > refs;
4366 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4368 PyObject *res = PyList_New(sz);
4369 PyObject *res2 = PyList_New(sz);
4370 for(int i=0;i<sz;i++)
4375 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4379 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4381 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4384 PyObject *ret=PyTuple_New(2);
4385 PyTuple_SetItem(ret,0,res);
4386 PyTuple_SetItem(ret,1,res2);
4392 class MEDCouplingDefinitionTime
4395 MEDCouplingDefinitionTime();
4396 void assign(const MEDCouplingDefinitionTime& other);
4397 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4398 double getTimeResolution() const;
4399 std::vector<double> getHotSpotsTime() const;
4402 std::string __str__() const throw(INTERP_KERNEL::Exception)
4404 std::ostringstream oss;
4405 self->appendRepr(oss);
4409 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4411 int meshId,arrId,arrIdInField,fieldId;
4412 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4413 PyObject *res=PyList_New(4);
4414 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4415 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4416 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4417 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4421 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4423 int meshId,arrId,arrIdInField,fieldId;
4424 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4425 PyObject *res=PyList_New(4);
4426 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4427 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4428 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4429 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4435 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4438 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4439 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4443 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4445 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4446 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4448 std::vector<MEDCouplingFieldDouble *> fs(sz);
4449 for(int i=0;i<sz;i++)
4450 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4451 return MEDCouplingFieldOverTime::New(fs);
4453 std::string __str__() const throw(INTERP_KERNEL::Exception)
4455 return self->simpleRepr();
4457 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4459 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4460 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4462 std::vector<MEDCouplingFieldDouble *> fs(sz);
4463 for(int i=0;i<sz;i++)
4464 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4465 return MEDCouplingFieldOverTime::New(fs);
4473 __filename=os.environ.get('PYTHONSTARTUP')
4474 if __filename and os.path.isfile(__filename):
4475 execfile(__filename)