1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #define MEDCOUPLING_EXPORT
28 #include "MEDCouplingMemArray.hxx"
29 #include "MEDCouplingUMesh.hxx"
30 #include "MEDCouplingExtrudedMesh.hxx"
31 #include "MEDCouplingCMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingTypemaps.i"
45 #include "InterpKernelAutoPtr.hxx"
47 using namespace ParaMEDMEM;
48 using namespace INTERP_KERNEL;
52 %template(ivec) std::vector<int>;
53 %template(dvec) std::vector<double>;
54 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
63 $result=convertMesh($1,$owner);
66 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
68 $result=convertMesh($1,$owner);
71 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
73 $result=convertMesh($1,$owner);
76 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
78 $result=convertFieldDiscretization($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
83 $result=convertMultiFields($1,$owner);
86 %typemap(out) ParaMEDMEM::DataArray*
88 $result=convertDataArray($1,$owner);
91 %typemap(out) ParaMEDMEM::DataArrayChar*
93 $result=convertDataArrayChar($1,$owner);
97 %init %{ import_array(); %}
100 %feature("autodoc", "1");
101 %feature("docstring");
103 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::New;
104 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
105 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::deepCpy;
106 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone;
107 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
108 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePartRange;
109 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getMeasureField;
110 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
111 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getLocalizationOfDiscValues;
112 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getValueOnMulti;
113 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::computeTupleIdsToSelectFromCellIds;
114 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshData;
115 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
116 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
117 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
118 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
119 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
120 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
121 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
122 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
123 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
124 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
125 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
126 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
127 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
128 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
129 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
130 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
131 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
132 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
133 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
134 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
135 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
136 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
137 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
166 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
167 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
168 %newobject ParaMEDMEM::DataArrayInt::New;
169 %newobject ParaMEDMEM::DataArrayInt::__iter__;
170 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
171 %newobject ParaMEDMEM::DataArrayInt::deepCpy;
172 %newobject ParaMEDMEM::DataArrayInt::performCpy;
173 %newobject ParaMEDMEM::DataArrayInt::substr;
174 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
175 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
176 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
177 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
178 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
179 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
180 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
181 %newobject ParaMEDMEM::DataArrayInt::renumber;
182 %newobject ParaMEDMEM::DataArrayInt::renumberR;
183 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
184 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
185 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
186 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
187 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
188 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
189 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
190 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
191 %newobject ParaMEDMEM::DataArrayInt::negate;
192 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
193 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
194 %newobject ParaMEDMEM::DataArrayInt::Meld;
195 %newobject ParaMEDMEM::DataArrayInt::Add;
196 %newobject ParaMEDMEM::DataArrayInt::Substract;
197 %newobject ParaMEDMEM::DataArrayInt::Multiply;
198 %newobject ParaMEDMEM::DataArrayInt::Divide;
199 %newobject ParaMEDMEM::DataArrayInt::Pow;
200 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
201 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
202 %newobject ParaMEDMEM::DataArrayInt::Range;
203 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
204 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
205 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
206 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
207 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
208 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
209 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
210 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
211 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
212 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
213 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
214 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
215 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
216 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
217 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
218 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
219 %newobject ParaMEDMEM::DataArrayInt::__neg__;
220 %newobject ParaMEDMEM::DataArrayInt::__add__;
221 %newobject ParaMEDMEM::DataArrayInt::__radd__;
222 %newobject ParaMEDMEM::DataArrayInt::__sub__;
223 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
224 %newobject ParaMEDMEM::DataArrayInt::__mul__;
225 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
226 %newobject ParaMEDMEM::DataArrayInt::__div__;
227 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
228 %newobject ParaMEDMEM::DataArrayInt::__mod__;
229 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
230 %newobject ParaMEDMEM::DataArrayInt::__pow__;
231 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
232 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
233 %newobject ParaMEDMEM::DataArrayChar::deepCpy;
234 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
235 %newobject ParaMEDMEM::DataArrayChar::renumber;
236 %newobject ParaMEDMEM::DataArrayChar::renumberR;
237 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
238 %newobject ParaMEDMEM::DataArrayChar::selectByTupleIdSafe;
239 %newobject ParaMEDMEM::DataArrayChar::selectByTupleId2;
240 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
241 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
242 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
243 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
244 %newobject ParaMEDMEM::DataArrayChar::Meld;
245 %newobject ParaMEDMEM::DataArrayByte::New;
246 %newobject ParaMEDMEM::DataArrayByte::__iter__;
247 %newobject ParaMEDMEM::DataArrayByte::performCpy;
248 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
249 %newobject ParaMEDMEM::DataArrayChar::substr;
250 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
251 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
252 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
253 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
254 %newobject ParaMEDMEM::DataArrayDouble::New;
255 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
256 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
257 %newobject ParaMEDMEM::DataArrayDouble::deepCpy;
258 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
259 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
260 %newobject ParaMEDMEM::DataArrayDouble::Meld;
261 %newobject ParaMEDMEM::DataArrayDouble::Dot;
262 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
263 %newobject ParaMEDMEM::DataArrayDouble::Add;
264 %newobject ParaMEDMEM::DataArrayDouble::Substract;
265 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
266 %newobject ParaMEDMEM::DataArrayDouble::Divide;
267 %newobject ParaMEDMEM::DataArrayDouble::Pow;
268 %newobject ParaMEDMEM::DataArrayDouble::substr;
269 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
270 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
271 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
272 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
273 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
274 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
275 %newobject ParaMEDMEM::DataArrayDouble::negate;
276 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
277 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
278 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
279 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
280 %newobject ParaMEDMEM::DataArrayDouble::determinant;
281 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
282 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
283 %newobject ParaMEDMEM::DataArrayDouble::inverse;
284 %newobject ParaMEDMEM::DataArrayDouble::trace;
285 %newobject ParaMEDMEM::DataArrayDouble::deviator;
286 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
287 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
288 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
289 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
290 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
291 %newobject ParaMEDMEM::DataArrayDouble::renumber;
292 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
293 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
294 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
295 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
296 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
297 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
298 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
299 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
300 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
301 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
302 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
303 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
304 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
305 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
306 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
307 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
308 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
309 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
310 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
311 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
312 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
313 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
314 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
315 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
316 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
317 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
318 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
319 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
320 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
321 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
322 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
323 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
324 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
325 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
326 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
327 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
328 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
329 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
330 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
331 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
332 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
333 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
334 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
335 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
336 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
337 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
338 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
339 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
340 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
341 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
342 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
343 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
344 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
345 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
346 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
347 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
348 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
349 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
350 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
351 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
352 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
353 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
354 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
355 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
356 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
357 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
358 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
359 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
360 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
361 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
362 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
363 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
364 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
365 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
366 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
367 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
368 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
369 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
370 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
371 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
372 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
373 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
374 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
375 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
376 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
377 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
378 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
379 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
380 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
381 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
382 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
383 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
384 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
385 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
386 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
387 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
388 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::getNodalConnectivity;
389 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
390 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
391 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
392 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
393 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivity;
394 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
395 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
396 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
397 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
398 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
399 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
400 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
401 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
402 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
403 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
404 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
405 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
406 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
407 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
408 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
410 %feature("unref") DataArray "$this->decrRef();"
411 %feature("unref") DataArrayDouble "$this->decrRef();"
412 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
413 %feature("unref") MEDCouplingMesh "$this->decrRef();"
414 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
415 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
416 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
417 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
418 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
419 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
420 %feature("unref") DataArrayInt "$this->decrRef();"
421 %feature("unref") DataArrayChar "$this->decrRef();"
422 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
423 %feature("unref") DataArrayByte "$this->decrRef();"
424 %feature("unref") MEDCouplingField "$this->decrRef();"
425 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
426 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
427 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
428 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
429 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
430 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
431 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
432 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
433 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
435 %rename(assign) *::operator=;
436 %ignore ParaMEDMEM::RefCountObject::decrRef;
437 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
438 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
439 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
440 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
444 %rename (InterpKernelException) INTERP_KERNEL::Exception;
446 namespace INTERP_KERNEL
451 Exception(const char* what);
452 ~Exception() throw ();
453 const char *what() const throw ();
456 std::string __str__() const
458 return std::string(self->what());
469 void declareAsNew() const;
470 virtual void updateTime() const;
471 unsigned int getTimeOfThis() const;
499 CONST_ON_TIME_INTERVAL = 7
500 } TypeOfTimeDiscretization;
502 const char *MEDCouplingVersionStr();
503 int MEDCouplingVersion();
504 int MEDCouplingSizeOfVoidStar();
510 RefCountObject(const RefCountObject& other);
513 bool decrRef() const;
514 void incrRef() const;
515 int getRCValue() const;
516 virtual std::size_t getHeapMemorySize() const;
522 PyObject *MEDCouplingVersionMajMinRel()
524 int tmp0=0,tmp1=0,tmp2=0;
525 MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
526 PyObject *res = PyList_New(3);
527 PyList_SetItem(res,0,SWIG_From_int(tmp0));
528 PyList_SetItem(res,1,SWIG_From_int(tmp1));
529 PyList_SetItem(res,2,SWIG_From_int(tmp2));
533 bool MEDCouplingHasNumPyBindings()
542 std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
544 static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
545 std::ostringstream oss; oss << "MEDCouplingCompletionScript : error when trying to activate completion ! readline not present ?\nScript is :\n" << script;
546 if(PyRun_SimpleString(script)!=0)
547 throw INTERP_KERNEL::Exception(oss.str().c_str());
548 return std::string(script);
552 %include "MEDCouplingMemArray.i"
559 UNSTRUCTURED_DESC = 6,
563 } MEDCouplingMeshType;
566 class DataArrayDouble;
567 class MEDCouplingUMesh;
568 class MEDCouplingFieldDouble;
570 %extend RefCountObject
572 std::string getHiddenCppPointer() const
574 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
579 %extend MEDCouplingGaussLocalization
581 std::string __str__() const throw(INTERP_KERNEL::Exception)
583 return self->getStringRepr();
586 std::string __repr__() const throw(INTERP_KERNEL::Exception)
588 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
589 oss << self->getStringRepr();
596 class MEDCouplingMesh : public RefCountObject, public TimeLabel
599 void setName(const char *name);
600 const char *getName() const;
601 void setDescription(const char *descr);
602 const char *getDescription() const;
603 void setTime(double val, int iteration, int order);
604 void setTimeUnit(const char *unit);
605 const char *getTimeUnit() const;
606 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
607 bool isStructured() const throw(INTERP_KERNEL::Exception);
608 virtual MEDCouplingMesh *deepCpy() const;
609 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
610 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
611 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
612 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
613 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
614 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
615 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
616 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
617 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
618 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
619 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
620 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
621 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
622 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
623 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
624 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
625 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
626 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
627 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
628 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
629 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
630 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
631 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
632 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
634 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
635 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
636 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
637 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
638 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
639 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
640 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
641 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
642 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
643 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
644 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
645 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
646 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
647 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
648 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
649 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
650 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
653 std::string __str__() const throw(INTERP_KERNEL::Exception)
655 return self->simpleRepr();
658 PyObject *getTime() throw(INTERP_KERNEL::Exception)
661 double tmp0=self->getTime(tmp1,tmp2);
662 PyObject *res = PyList_New(3);
663 PyList_SetItem(res,0,SWIG_From_double(tmp0));
664 PyList_SetItem(res,1,SWIG_From_int(tmp1));
665 PyList_SetItem(res,2,SWIG_From_int(tmp2));
669 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
673 DataArrayDoubleTuple *aa;
674 std::vector<double> bb;
676 int spaceDim=self->getSpaceDimension();
677 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
678 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
679 return self->getCellContainingPoint(pos,eps);
682 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
686 DataArrayDoubleTuple *aa;
687 std::vector<double> bb;
689 int spaceDim=self->getSpaceDimension();
690 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
691 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
692 std::vector<int> elts,eltsIndex;
693 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
694 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
695 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
696 d0->alloc(elts.size(),1);
697 d1->alloc(eltsIndex.size(),1);
698 std::copy(elts.begin(),elts.end(),d0->getPointer());
699 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
700 PyObject *ret=PyTuple_New(2);
701 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
702 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
706 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
708 std::vector<int> elts,eltsIndex;
709 int spaceDim=self->getSpaceDimension();
711 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
712 if (!SWIG_IsOK(res1))
715 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
716 int nbOfPoints=size/spaceDim;
719 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
721 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
725 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
727 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
728 da2->checkAllocated();
729 int size=da2->getNumberOfTuples();
730 int nbOfCompo=da2->getNumberOfComponents();
731 if(nbOfCompo!=spaceDim)
733 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
735 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
737 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
738 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
739 d0->alloc(elts.size(),1);
740 d1->alloc(eltsIndex.size(),1);
741 std::copy(elts.begin(),elts.end(),d0->getPointer());
742 std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
743 PyObject *ret=PyTuple_New(2);
744 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
745 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
749 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
753 DataArrayDoubleTuple *aa;
754 std::vector<double> bb;
756 int spaceDim=self->getSpaceDimension();
757 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
758 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
759 std::vector<int> elts;
760 self->getCellsContainingPoint(pos,eps,elts);
761 DataArrayInt *ret=DataArrayInt::New();
762 ret->alloc((int)elts.size(),1);
763 std::copy(elts.begin(),elts.end(),ret->getPointer());
764 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
767 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
770 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
771 if (!SWIG_IsOK(res1))
774 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
775 self->renumberCells(tmp,check);
779 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
781 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
782 da2->checkAllocated();
783 self->renumberCells(da2->getConstPointer(),check);
787 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
789 DataArrayInt *cellCor, *nodeCor;
790 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
791 PyObject *res = PyList_New(2);
792 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
793 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
797 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
799 DataArrayInt *cellCor=0,*nodeCor=0;
800 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
801 PyObject *res = PyList_New(2);
802 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
803 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
807 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
809 DataArrayInt *cellCor=0;
810 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
814 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
817 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
818 if (!SWIG_IsOK(res1))
821 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
822 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
826 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
828 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
829 da2->checkAllocated();
830 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
833 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
835 std::vector<int> conn;
836 self->getNodeIdsOfCell(cellId,conn);
837 return convertIntArrToPyList2(conn);
840 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
842 std::vector<double> coo;
843 self->getCoordinatesOfNode(nodeId,coo);
844 return convertDblArrToPyList2(coo);
847 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
851 DataArrayDoubleTuple *aa;
852 std::vector<double> bb;
854 int spaceDim=self->getSpaceDimension();
855 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
856 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
857 self->scale(pointPtr,factor);
860 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
862 int spaceDim=self->getSpaceDimension();
863 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
864 self->getBoundingBox(tmp);
865 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
869 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
872 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
873 PyObject *ret=PyTuple_New(2);
874 PyObject *ret0Py=ret0?Py_True:Py_False;
876 PyTuple_SetItem(ret,0,ret0Py);
877 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
881 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
883 int szArr,sw,iTypppArr;
884 std::vector<int> stdvecTyyppArr;
885 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
886 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
887 if(sw==3)//DataArrayInt
889 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
890 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
891 std::string name=argpt->getName();
893 ret->setName(name.c_str());
895 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
898 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
900 int szArr,sw,iTypppArr;
901 std::vector<int> stdvecTyyppArr;
903 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
904 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
905 if(sw==3)//DataArrayInt
907 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
908 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
909 std::string name=argpt->getName();
911 ret->setName(name.c_str());
914 PyObject *res = PyList_New(2);
915 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
916 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
917 PyList_SetItem(res,0,obj0);
918 PyList_SetItem(res,1,obj1);
922 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
926 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
927 PyObject *res = PyTuple_New(2);
928 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
931 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
933 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
934 PyTuple_SetItem(res,0,obj0);
935 PyTuple_SetItem(res,1,obj1);
939 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
941 std::vector<int> vals=self->getDistributionOfTypes();
943 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
944 PyObject *ret=PyList_New((int)vals.size()/3);
945 for(int j=0;j<(int)vals.size()/3;j++)
947 PyObject *ret1=PyList_New(3);
948 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
949 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
950 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
951 PyList_SetItem(ret,j,ret1);
956 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
958 std::vector<int> code;
959 std::vector<const DataArrayInt *> idsPerType;
960 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
961 convertPyToNewIntArr4(li,1,3,code);
962 return self->checkTypeConsistencyAndContig(code,idsPerType);
965 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
967 std::vector<int> code;
968 std::vector<DataArrayInt *> idsInPflPerType;
969 std::vector<DataArrayInt *> idsPerType;
970 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
971 PyObject *ret=PyTuple_New(3);
974 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
975 PyObject *ret0=PyList_New((int)code.size()/3);
976 for(int j=0;j<(int)code.size()/3;j++)
978 PyObject *ret00=PyList_New(3);
979 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
980 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
981 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
982 PyList_SetItem(ret0,j,ret00);
984 PyTuple_SetItem(ret,0,ret0);
986 PyObject *ret1=PyList_New(idsInPflPerType.size());
987 for(std::size_t j=0;j<idsInPflPerType.size();j++)
988 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
989 PyTuple_SetItem(ret,1,ret1);
990 int n=idsPerType.size();
991 PyObject *ret2=PyList_New(n);
993 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
994 PyTuple_SetItem(ret,2,ret2);
998 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
1002 DataArrayDoubleTuple *aa;
1003 std::vector<double> bb;
1005 int spaceDim=self->getSpaceDimension();
1006 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1007 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1008 self->translate(vectorPtr);
1011 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
1013 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1016 DataArrayDoubleTuple *aa;
1017 std::vector<double> bb;
1019 int spaceDim=self->getSpaceDimension();
1020 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1021 self->rotate(centerPtr,0,alpha);
1024 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
1026 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1028 DataArrayDouble *a,*a2;
1029 DataArrayDoubleTuple *aa,*aa2;
1030 std::vector<double> bb,bb2;
1032 int spaceDim=self->getSpaceDimension();
1033 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1034 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
1035 self->rotate(centerPtr,vectorPtr,alpha);
1038 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
1040 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1041 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1042 PyObject *res=PyList_New(result.size());
1043 for(int i=0;iL!=result.end(); i++, iL++)
1044 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1048 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
1050 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
1051 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1052 return MEDCouplingMesh::MergeMeshes(tmp);
1058 //== MEDCouplingMesh End
1060 %include "NormalizedUnstructuredMesh.hxx"
1061 %include "MEDCouplingNatureOfField.hxx"
1062 %include "MEDCouplingTimeDiscretization.hxx"
1063 %include "MEDCouplingGaussLocalization.hxx"
1064 %include "MEDCouplingFieldDiscretization.hxx"
1066 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
1067 %ignore ParaMEDMEM::MEDCouplingFieldDiscretization::buildSubMeshDataRange;
1068 %ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
1070 //== MEDCouplingPointSet
1072 namespace ParaMEDMEM
1074 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1077 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1078 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1079 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1080 void zipCoords() throw(INTERP_KERNEL::Exception);
1081 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1082 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1083 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1084 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1085 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1086 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1087 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1088 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1089 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1090 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1091 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1092 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1093 virtual DataArrayInt *findBoundaryNodes() const;
1094 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1095 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1096 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1097 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1100 std::string __str__() const throw(INTERP_KERNEL::Exception)
1102 return self->simpleRepr();
1105 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1108 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1109 PyObject *res = PyList_New(2);
1110 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1111 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1115 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1117 DataArrayInt *comm, *commIndex;
1118 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1119 PyObject *res = PyList_New(2);
1120 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1121 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1125 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1127 DataArrayDouble *ret1=self->getCoords();
1130 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1133 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1135 int szArr,sw,iTypppArr;
1136 std::vector<int> stdvecTyyppArr;
1137 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1138 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1139 if(sw==3)//DataArrayInt
1141 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1142 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1143 std::string name=argpt->getName();
1145 ret->setName(name.c_str());
1147 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1150 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1152 int szArr,sw,iTypppArr;
1153 std::vector<int> stdvecTyyppArr;
1154 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1155 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1156 if(sw==3)//DataArrayInt
1158 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1159 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1160 std::string name=argpt->getName();
1162 ret->setName(name.c_str());
1164 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1167 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) 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->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
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 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1186 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1187 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1190 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1192 int szArr,sw,iTypppArr;
1193 std::vector<int> stdvecTyyppArr;
1194 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1195 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1196 if(sw==3)//DataArrayInt
1198 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1199 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1200 std::string name=argpt->getName();
1202 ret->setName(name.c_str());
1204 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1207 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1209 int szArr,sw,iTypppArr;
1210 std::vector<int> stdvecTyyppArr;
1211 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1212 self->renumberNodes(tmp,newNbOfNodes);
1215 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1217 int szArr,sw,iTypppArr;
1218 std::vector<int> stdvecTyyppArr;
1219 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1220 self->renumberNodes2(tmp,newNbOfNodes);
1223 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1225 int spaceDim=self->getSpaceDimension();
1227 DataArrayDouble *a,*a2;
1228 DataArrayDoubleTuple *aa,*aa2;
1229 std::vector<double> bb,bb2;
1231 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1232 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1233 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1234 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1235 std::vector<int> nodes;
1236 self->findNodesOnLine(p,v,eps,nodes);
1237 DataArrayInt *ret=DataArrayInt::New();
1238 ret->alloc((int)nodes.size(),1);
1239 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1240 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1242 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1244 int spaceDim=self->getSpaceDimension();
1246 DataArrayDouble *a,*a2;
1247 DataArrayDoubleTuple *aa,*aa2;
1248 std::vector<double> bb,bb2;
1250 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1251 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1252 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1253 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1254 std::vector<int> nodes;
1255 self->findNodesOnPlane(p,v,eps,nodes);
1256 DataArrayInt *ret=DataArrayInt::New();
1257 ret->alloc((int)nodes.size(),1);
1258 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1262 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1266 DataArrayDoubleTuple *aa;
1267 std::vector<double> bb;
1269 int spaceDim=self->getSpaceDimension();
1270 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1271 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1272 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1273 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1276 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1278 DataArrayInt *c=0,*cI=0;
1282 DataArrayDoubleTuple *aa;
1283 std::vector<double> bb;
1285 int spaceDim=self->getSpaceDimension();
1286 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1287 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1288 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1289 PyObject *ret=PyTuple_New(2);
1290 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1295 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1297 DataArrayInt *c=0,*cI=0;
1298 int spaceDim=self->getSpaceDimension();
1301 DataArrayDoubleTuple *aa;
1302 std::vector<double> bb;
1305 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1306 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1308 PyObject *ret=PyTuple_New(2);
1309 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1310 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1314 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1318 DataArrayDoubleTuple *aa;
1319 std::vector<double> bb;
1321 int spaceDim=self->getSpaceDimension();
1322 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1323 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1325 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1326 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1329 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1333 std::vector<int> multiVal;
1334 std::pair<int, std::pair<int,int> > slic;
1335 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1336 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1340 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1342 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1344 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1346 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1350 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1353 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1354 self->getReverseNodalConnectivity(d0,d1);
1355 PyObject *ret=PyTuple_New(2);
1356 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1357 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1361 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1363 DataArrayInt *v0=0,*v1=0;
1364 self->findCommonCells(compType,startCellId,v0,v1);
1365 PyObject *res = PyList_New(2);
1366 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1367 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1372 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1375 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1376 if (!SWIG_IsOK(res1))
1379 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1380 self->renumberNodesInConn(tmp);
1384 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1386 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1387 da2->checkAllocated();
1388 self->renumberNodesInConn(da2->getConstPointer());
1392 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1395 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1396 PyObject *ret=PyTuple_New(2);
1397 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1398 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1402 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1404 DataArrayInt *ret=0;
1406 int szArr,sw,iTypppArr;
1407 std::vector<int> stdvecTyyppArr;
1408 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1409 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1413 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1417 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1418 PyObject *res = PyList_New(3);
1419 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1420 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1421 PyList_SetItem(res,2,SWIG_From_int(ret2));
1425 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1429 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1430 PyObject *res = PyList_New(3);
1431 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1432 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1433 PyList_SetItem(res,2,SWIG_From_int(ret2));
1437 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1440 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1441 if (!SWIG_IsOK(res1))
1444 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1445 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1449 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1451 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1452 da2->checkAllocated();
1453 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1457 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1461 std::vector<int> multiVal;
1462 std::pair<int, std::pair<int,int> > slic;
1463 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1464 int nbc=self->getNumberOfCells();
1465 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1472 std::ostringstream oss;
1473 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1474 throw INTERP_KERNEL::Exception(oss.str().c_str());
1477 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1482 int tmp=nbc+singleVal;
1483 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1487 std::ostringstream oss;
1488 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1489 throw INTERP_KERNEL::Exception(oss.str().c_str());
1495 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1499 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1504 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1505 daIntTyypp->checkAllocated();
1506 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1509 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1513 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1516 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1517 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1518 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1519 for(int i=0;i<sz;i++)
1520 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1523 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1526 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1528 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1529 std::vector<double> val3;
1530 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1531 "Rotate2DAlg",2,true,nbNodes);
1533 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1534 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1537 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1540 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1541 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1542 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1543 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1544 for(int i=0;i<sz;i++)
1545 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1548 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1551 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1553 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1554 std::vector<double> val3;
1555 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1556 "Rotate3DAlg",3,true,nbNodes);
1558 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1559 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1560 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1565 //== MEDCouplingPointSet End
1567 class MEDCouplingUMeshCell
1570 INTERP_KERNEL::NormalizedCellType getType() const;
1573 std::string __str__() const throw(INTERP_KERNEL::Exception)
1575 return self->repr();
1578 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1581 const int *r=self->getAllConn(ret2);
1582 PyObject *ret=PyTuple_New(ret2);
1583 for(int i=0;i<ret2;i++)
1584 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1590 class MEDCouplingUMeshCellIterator
1597 MEDCouplingUMeshCell *ret=self->nextt();
1599 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1602 PyErr_SetString(PyExc_StopIteration,"No more data.");
1609 class MEDCouplingUMeshCellByTypeIterator
1612 ~MEDCouplingUMeshCellByTypeIterator();
1617 MEDCouplingUMeshCellEntry *ret=self->nextt();
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1622 PyErr_SetString(PyExc_StopIteration,"No more data.");
1629 class MEDCouplingUMeshCellByTypeEntry
1632 ~MEDCouplingUMeshCellByTypeEntry();
1635 MEDCouplingUMeshCellByTypeIterator *__iter__()
1637 return self->iterator();
1642 class MEDCouplingUMeshCellEntry
1645 INTERP_KERNEL::NormalizedCellType getType() const;
1646 int getNumberOfElems() const;
1649 MEDCouplingUMeshCellIterator *__iter__()
1651 return self->iterator();
1656 //== MEDCouplingUMesh
1658 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1661 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1662 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1663 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1664 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1665 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1666 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1667 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1668 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1669 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1670 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1671 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1672 int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1673 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1674 void computeTypes() throw(INTERP_KERNEL::Exception);
1675 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1676 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1678 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1679 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1680 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1681 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1682 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1683 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1684 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1685 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1686 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1687 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1688 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1689 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1690 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1691 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1692 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1693 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1694 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1695 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1696 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1697 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1698 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1699 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1700 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1701 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1702 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1703 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1704 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1705 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1706 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1707 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1708 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1709 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1710 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1711 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1712 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1713 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1714 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1715 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1717 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1719 return MEDCouplingUMesh::New();
1722 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1724 return MEDCouplingUMesh::New(meshName,meshDim);
1727 std::string __str__() const throw(INTERP_KERNEL::Exception)
1729 return self->simpleRepr();
1732 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1734 std::ostringstream oss;
1735 self->reprQuickOverview(oss);
1739 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1741 return self->cellIterator();
1744 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1748 std::vector<int> multiVal;
1749 std::pair<int, std::pair<int,int> > slic;
1750 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1751 int nbc=self->getNumberOfCells();
1752 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1759 std::ostringstream oss;
1760 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1761 throw INTERP_KERNEL::Exception(oss.str().c_str());
1765 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1772 int tmp=nbc+singleVal;
1773 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1778 std::ostringstream oss;
1779 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1780 throw INTERP_KERNEL::Exception(oss.str().c_str());
1786 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1792 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1793 daIntTyypp->checkAllocated();
1794 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1798 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1802 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1806 std::vector<int> multiVal;
1807 std::pair<int, std::pair<int,int> > slic;
1808 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1809 int nbc=self->getNumberOfCells();
1810 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1817 std::ostringstream oss;
1818 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1819 throw INTERP_KERNEL::Exception(oss.str().c_str());
1823 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1830 int tmp=nbc+singleVal;
1831 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1836 std::ostringstream oss;
1837 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1838 throw INTERP_KERNEL::Exception(oss.str().c_str());
1844 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1849 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1855 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1856 daIntTyypp->checkAllocated();
1857 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1861 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1865 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1867 int szArr,sw,iTypppArr;
1868 std::vector<int> stdvecTyyppArr;
1869 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1872 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1873 throw INTERP_KERNEL::Exception(oss.str().c_str());
1875 self->insertNextCell(type,size,tmp);
1878 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1880 int szArr,sw,iTypppArr;
1881 std::vector<int> stdvecTyyppArr;
1882 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1883 self->insertNextCell(type,szArr,tmp);
1886 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1888 DataArrayInt *ret=self->getNodalConnectivity();
1893 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1895 DataArrayInt *ret=self->getNodalConnectivityIndex();
1900 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1902 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1903 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1904 PyObject *res = PyList_New(result.size());
1905 for (int i=0;iL!=result.end(); i++, iL++)
1906 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1910 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1912 int szArr,sw,iTypppArr;
1913 std::vector<int> stdvecTyyppArr;
1914 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1915 int nbOfDepthPeelingPerformed=0;
1916 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1917 PyObject *res=PyTuple_New(2);
1918 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1919 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1923 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1925 DataArrayInt *v0=0,*v1=0;
1926 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1927 PyObject *res = PyList_New(2);
1928 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1937 DataArrayDoubleTuple *aa;
1938 std::vector<double> bb;
1940 int nbOfCompo=self->getSpaceDimension();
1941 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1944 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1945 PyObject *ret=PyTuple_New(2);
1946 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1947 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1951 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1953 DataArrayInt *ret1=0;
1954 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1955 PyObject *ret=PyTuple_New(2);
1956 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1957 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1961 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1963 std::vector<int> cells;
1964 self->checkButterflyCells(cells,eps);
1965 DataArrayInt *ret=DataArrayInt::New();
1966 ret->alloc((int)cells.size(),1);
1967 std::copy(cells.begin(),cells.end(),ret->getPointer());
1968 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1971 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1973 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1975 PyObject *ret = PyList_New(sz);
1976 for(int i=0;i<sz;i++)
1977 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1981 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1983 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1984 int sz=retCpp.size();
1985 PyObject *ret=PyList_New(sz);
1986 for(int i=0;i<sz;i++)
1987 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1991 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1994 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1995 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1996 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1999 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
2002 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2003 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2007 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
2010 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2011 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2015 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2017 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
2018 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2019 PyObject *ret=PyTuple_New(3);
2020 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2021 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2022 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2026 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
2028 DataArrayInt *tmp0=0,*tmp1=0;
2029 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2030 PyObject *ret=PyTuple_New(2);
2031 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2032 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2036 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2040 std::vector<int> multiVal;
2041 std::pair<int, std::pair<int,int> > slic;
2042 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2043 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2047 return self->duplicateNodes(&singleVal,&singleVal+1);
2049 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2051 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2053 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2057 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2061 std::vector<int> multiVal;
2062 std::pair<int, std::pair<int,int> > slic;
2063 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2064 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2068 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2070 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2072 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2074 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2078 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2081 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2082 DataArrayInt *tmp0,*tmp1=0;
2083 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2084 PyObject *ret=PyTuple_New(2);
2085 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2086 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2090 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2092 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2093 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2094 DataArrayInt *ret1=0,*ret2=0;
2095 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2096 PyObject *ret=PyTuple_New(3);
2097 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2098 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2099 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2103 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2105 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2106 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2107 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2108 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2111 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2114 std::vector<const MEDCouplingUMesh *> meshes;
2115 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2116 std::vector<DataArrayInt *> corr;
2117 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2119 PyObject *ret1=PyList_New(sz);
2120 for(int i=0;i<sz;i++)
2121 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2122 PyObject *ret=PyList_New(2);
2123 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2124 PyList_SetItem(ret,1,ret1);
2128 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2130 std::vector<MEDCouplingUMesh *> meshes;
2131 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2132 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2135 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2137 std::vector<MEDCouplingUMesh *> meshes;
2138 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2139 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2142 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2146 std::vector<int> multiVal;
2147 std::pair<int, std::pair<int,int> > slic;
2148 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2150 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2151 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2155 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2157 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2159 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2161 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2165 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2167 DataArrayInt *arrOut=0,*arrIndexOut=0;
2170 std::vector<int> multiVal;
2171 std::pair<int, std::pair<int,int> > slic;
2172 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2174 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2175 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2180 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2185 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2190 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2194 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2196 PyObject *ret=PyTuple_New(2);
2197 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2202 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2204 DataArrayInt *arrOut=0,*arrIndexOut=0;
2205 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2206 PyObject *ret=PyTuple_New(2);
2207 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2208 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2212 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2214 if(!PySlice_Check(slic))
2215 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2216 Py_ssize_t strt=2,stp=2,step=2;
2217 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2219 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2220 arrIndxIn->checkAllocated();
2221 if(arrIndxIn->getNumberOfComponents()!=1)
2222 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2223 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2224 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2225 DataArrayInt *arrOut=0,*arrIndexOut=0;
2226 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2227 PyObject *ret=PyTuple_New(2);
2228 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2229 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2233 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2234 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2235 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2237 DataArrayInt *arrOut=0,*arrIndexOut=0;
2240 std::vector<int> multiVal;
2241 std::pair<int, std::pair<int,int> > slic;
2242 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2244 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2245 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2250 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2255 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2260 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2264 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2266 PyObject *ret=PyTuple_New(2);
2267 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2268 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2272 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2273 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2277 std::vector<int> multiVal;
2278 std::pair<int, std::pair<int,int> > slic;
2279 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2281 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2282 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2287 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2292 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2297 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2301 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2305 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2309 DataArrayDoubleTuple *aa;
2310 std::vector<double> bb;
2312 int spaceDim=self->getSpaceDimension();
2313 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2314 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2316 std::vector<int> cells;
2317 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2318 DataArrayInt *ret=DataArrayInt::New();
2319 ret->alloc((int)cells.size(),1);
2320 std::copy(cells.begin(),cells.end(),ret->getPointer());
2321 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2324 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2328 DataArrayDoubleTuple *aa;
2329 std::vector<double> bb;
2331 int spaceDim=self->getSpaceDimension();
2332 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2333 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2334 self->orientCorrectly2DCells(v,polyOnly);
2337 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2339 std::vector<int> cells;
2340 self->arePolyhedronsNotCorrectlyOriented(cells);
2341 DataArrayInt *ret=DataArrayInt::New();
2342 ret->alloc((int)cells.size(),1);
2343 std::copy(cells.begin(),cells.end(),ret->getPointer());
2344 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2347 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2351 self->getFastAveragePlaneOfThis(vec,pos);
2353 std::copy(vec,vec+3,vals);
2354 std::copy(pos,pos+3,vals+3);
2355 return convertDblArrToPyListOfTuple(vals,3,2);
2358 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2360 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2361 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2362 return MEDCouplingUMesh::MergeUMeshes(tmp);
2365 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2368 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2369 PyObject *ret=PyTuple_New(2);
2370 PyObject *ret0Py=ret0?Py_True:Py_False;
2372 PyTuple_SetItem(ret,0,ret0Py);
2373 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2377 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2380 bool ret0=self->areCellsIncludedIn2(other,ret1);
2381 PyObject *ret=PyTuple_New(2);
2382 PyObject *ret0Py=ret0?Py_True:Py_False;
2384 PyTuple_SetItem(ret,0,ret0Py);
2385 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2391 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2392 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2393 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2394 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2395 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2396 PyObject *ret=PyTuple_New(5);
2397 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2398 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2399 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2400 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2401 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2407 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2408 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2409 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2410 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2411 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2412 PyObject *ret=PyTuple_New(5);
2413 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2414 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2415 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2416 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2417 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2421 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2423 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2424 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2425 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2426 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2427 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2428 PyObject *ret=PyTuple_New(5);
2429 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2430 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2432 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2433 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2437 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2439 DataArrayInt *neighbors=0,*neighborsIdx=0;
2440 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2441 PyObject *ret=PyTuple_New(2);
2442 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2447 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2449 DataArrayInt *neighbors=0,*neighborsIdx=0;
2450 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2451 PyObject *ret=PyTuple_New(2);
2452 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2457 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2459 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2460 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2461 DataArrayInt *d2,*d3,*d4,*dd5;
2462 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2463 PyObject *ret=PyTuple_New(7);
2464 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2465 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2466 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2467 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2468 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2469 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2470 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2474 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2477 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2478 da->checkAllocated();
2479 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2482 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2485 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2486 da->checkAllocated();
2487 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2490 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2493 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2494 da->checkAllocated();
2495 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2498 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2501 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2502 da->checkAllocated();
2503 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2504 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2505 PyObject *res = PyList_New(result.size());
2506 for (int i=0;iL!=result.end(); i++, iL++)
2507 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2511 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2514 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2515 da->checkAllocated();
2516 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2517 ret->setName(da->getName().c_str());
2521 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2523 DataArrayInt *cellNb1=0,*cellNb2=0;
2524 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2525 PyObject *ret=PyTuple_New(3);
2526 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2527 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2528 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2532 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2534 int spaceDim=self->getSpaceDimension();
2536 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2538 DataArrayDouble *a,*a2;
2539 DataArrayDoubleTuple *aa,*aa2;
2540 std::vector<double> bb,bb2;
2542 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2543 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2544 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2545 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2547 DataArrayInt *cellIds=0;
2548 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2549 PyObject *ret=PyTuple_New(2);
2550 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2551 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2555 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2557 int spaceDim=self->getSpaceDimension();
2559 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2561 DataArrayDouble *a,*a2;
2562 DataArrayDoubleTuple *aa,*aa2;
2563 std::vector<double> bb,bb2;
2565 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2566 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2567 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2568 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2570 DataArrayInt *cellIds=0;
2571 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2572 PyObject *ret=PyTuple_New(2);
2573 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2574 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2578 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2580 int spaceDim=self->getSpaceDimension();
2582 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2584 DataArrayDouble *a,*a2;
2585 DataArrayDoubleTuple *aa,*aa2;
2586 std::vector<double> bb,bb2;
2588 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2589 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2590 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2591 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2592 return self->getCellIdsCrossingPlane(orig,vect,eps);
2595 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2599 std::vector<int> pos2;
2600 DataArrayInt *pos3=0;
2601 DataArrayIntTuple *pos4=0;
2602 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2607 self->convertToPolyTypes(&pos1,&pos1+1);
2614 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2619 self->convertToPolyTypes(pos3->begin(),pos3->end());
2623 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2627 void convertAllToPoly();
2628 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2629 bool unPolyze() throw(INTERP_KERNEL::Exception);
2630 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2631 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2632 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2635 //== MEDCouplingUMesh End
2637 //== MEDCouplingExtrudedMesh
2639 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2642 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2643 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2645 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2647 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2650 std::string __str__() const throw(INTERP_KERNEL::Exception)
2652 return self->simpleRepr();
2655 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2657 std::ostringstream oss;
2658 self->reprQuickOverview(oss);
2662 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2664 MEDCouplingUMesh *ret=self->getMesh2D();
2667 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2669 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2671 MEDCouplingUMesh *ret=self->getMesh1D();
2674 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2676 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2678 DataArrayInt *ret=self->getMesh3DIds();
2681 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2686 //== MEDCouplingExtrudedMesh End
2688 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2691 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2692 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2693 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2696 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2698 int szArr,sw,iTypppArr;
2699 std::vector<int> stdvecTyyppArr;
2700 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2701 self->insertNextCell(tmp,tmp+szArr);
2706 //== MEDCoupling1SGTUMesh
2708 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2711 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2712 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2713 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2714 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2715 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2716 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2719 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2721 return MEDCoupling1SGTUMesh::New(name,type);
2724 std::string __str__() const throw(INTERP_KERNEL::Exception)
2726 return self->simpleRepr();
2729 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2731 std::ostringstream oss;
2732 self->reprQuickOverview(oss);
2736 DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2738 DataArrayInt *ret=self->getNodalConnectivity();
2739 if(ret) ret->incrRef();
2743 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2745 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2746 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2747 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2750 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2752 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2753 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2754 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2759 //== MEDCoupling1SGTUMesh End
2761 //== MEDCoupling1DGTUMesh
2763 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2766 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2767 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2768 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2769 bool isPacked() const throw(INTERP_KERNEL::Exception);
2772 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2774 return MEDCoupling1DGTUMesh::New(name,type);
2777 std::string __str__() const throw(INTERP_KERNEL::Exception)
2779 return self->simpleRepr();
2782 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2784 std::ostringstream oss;
2785 self->reprQuickOverview(oss);
2789 DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2791 DataArrayInt *ret=self->getNodalConnectivity();
2792 if(ret) ret->incrRef();
2796 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2798 DataArrayInt *ret=self->getNodalConnectivityIndex();
2799 if(ret) ret->incrRef();
2803 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2805 DataArrayInt *ret1=0,*ret2=0;
2806 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2807 PyObject *ret0Py=ret0?Py_True:Py_False;
2809 PyObject *ret=PyTuple_New(3);
2810 PyTuple_SetItem(ret,0,ret0Py);
2811 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2812 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2816 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2819 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2820 PyObject *ret=PyTuple_New(2);
2821 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2822 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2823 PyTuple_SetItem(ret,1,ret1Py);
2827 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2829 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2830 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2831 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2834 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2836 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2837 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2838 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2843 //== MEDCoupling1DGTUMeshEnd
2845 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2848 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2849 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2852 //== MEDCouplingCMesh
2854 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2857 static MEDCouplingCMesh *New();
2858 static MEDCouplingCMesh *New(const char *meshName);
2859 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2860 void setCoords(const DataArrayDouble *coordsX,
2861 const DataArrayDouble *coordsY=0,
2862 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2863 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2867 return MEDCouplingCMesh::New();
2869 MEDCouplingCMesh(const char *meshName)
2871 return MEDCouplingCMesh::New(meshName);
2873 std::string __str__() const throw(INTERP_KERNEL::Exception)
2875 return self->simpleRepr();
2877 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2879 std::ostringstream oss;
2880 self->reprQuickOverview(oss);
2883 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2885 DataArrayDouble *ret=self->getCoordsAt(i);
2893 //== MEDCouplingCMesh End
2895 //== MEDCouplingCurveLinearMesh
2897 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2900 static MEDCouplingCurveLinearMesh *New();
2901 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2902 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2903 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2904 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2906 MEDCouplingCurveLinearMesh()
2908 return MEDCouplingCurveLinearMesh::New();
2910 MEDCouplingCurveLinearMesh(const char *meshName)
2912 return MEDCouplingCurveLinearMesh::New(meshName);
2914 std::string __str__() const throw(INTERP_KERNEL::Exception)
2916 return self->simpleRepr();
2918 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2920 std::ostringstream oss;
2921 self->reprQuickOverview(oss);
2924 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2926 DataArrayDouble *ret=self->getCoords();
2931 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2933 int szArr,sw,iTypppArr;
2934 std::vector<int> stdvecTyyppArr;
2935 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2936 self->setNodeGridStructure(tmp,tmp+szArr);
2941 //== MEDCouplingCurveLinearMesh End
2944 %extend ParaMEDMEM::MEDCouplingFieldDiscretization
2946 MEDCouplingFieldDiscretization *clonePart(PyObject *li)
2948 int sz=0,sw=-1,val1=-1;
2949 std::vector<int> val2;
2950 const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
2951 return self->clonePart(inp,inp+sz);
2954 PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const throw(INTERP_KERNEL::Exception)
2956 DataArrayInt *ret1=0;
2958 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,begin,end,step,bb,ee,ss,ret1);
2959 PyObject *res=PyTuple_New(2);
2960 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2962 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2965 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
2966 PyTuple_SetItem(res,1,res1);
2971 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2973 std::vector<int> vVal; int iVal=-1;
2975 const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
2977 throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
2978 DataArrayInt *ret0=0,*ret1=0;
2979 self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1);
2980 PyObject *pyRet=PyTuple_New(2);
2981 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2982 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2987 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationP0
2989 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2990 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2993 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationOnNodes
2995 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
2996 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
2999 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGauss
3001 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3002 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3005 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationGaussNE
3007 PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const throw(INTERP_KERNEL::Exception)
3008 { return ParaMEDMEM_MEDCouplingFieldDiscretization_computeMeshRestrictionFromTupleIds__SWIG_1(self,mesh,tupleIds); }
3011 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
3013 PyObject *getArrayOfDiscIds() const
3015 DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
3018 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3021 PyObject *splitIntoSingleGaussDicrPerCellType() const throw(INTERP_KERNEL::Exception)
3023 std::vector<int> ret1;
3024 std::vector<DataArrayInt *> ret0=self->splitIntoSingleGaussDicrPerCellType(ret1);
3025 std::size_t sz=ret0.size();
3026 PyObject *pyRet=PyTuple_New(2);
3027 PyObject *pyRet0=PyList_New((int)sz);
3028 PyObject *pyRet1=PyList_New((int)sz);
3029 for(std::size_t i=0;i<sz;i++)
3031 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3032 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
3034 PyTuple_SetItem(pyRet,0,pyRet0);
3035 PyTuple_SetItem(pyRet,1,pyRet1);
3040 %extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
3042 PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const
3045 DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1);
3046 PyObject *ret=PyTuple_New(2);
3047 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3048 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
3053 namespace ParaMEDMEM
3055 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3058 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3059 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3060 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3061 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3062 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3063 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3064 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3065 const char *getDescription() const throw(INTERP_KERNEL::Exception);
3066 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3067 const char *getName() const throw(INTERP_KERNEL::Exception);
3068 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3069 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3070 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3071 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3072 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3073 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3074 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3075 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3076 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3077 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3078 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3079 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3080 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3081 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3082 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3083 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3085 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3087 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3090 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3093 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3095 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3098 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3101 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3103 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3104 return convertIntArrToPyList3(ret);
3107 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3110 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3111 PyObject *ret=PyTuple_New(2);
3112 PyObject *ret0Py=ret0?Py_True:Py_False;
3114 PyTuple_SetItem(ret,0,ret0Py);
3115 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3119 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3121 DataArrayInt *ret1=0;
3122 MEDCouplingMesh *ret0=0;
3124 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3125 if (!SWIG_IsOK(res1))
3128 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3129 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3133 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3135 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3136 da2->checkAllocated();
3137 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3139 PyObject *res = PyList_New(2);
3140 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3141 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3145 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3147 DataArrayInt *ret1=0;
3149 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3150 PyObject *res=PyTuple_New(2);
3151 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3153 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3156 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3157 PyTuple_SetItem(res,1,res1);
3162 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *li) const
3166 std::vector<int> pos2;
3167 DataArrayInt *pos3=0;
3168 DataArrayIntTuple *pos4=0;
3169 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
3174 return self->computeTupleIdsToSelectFromCellIds(&pos1,&pos1+1);
3178 return self->computeTupleIdsToSelectFromCellIds(&pos2[0],&pos2[0]+pos2.size());
3182 return self->computeTupleIdsToSelectFromCellIds(pos3->begin(),pos3->end());
3185 throw INTERP_KERNEL::Exception("MEDCouplingField::computeTupleIdsToSelectFromCellIds : unexpected input array type recognized !");
3189 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3190 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3193 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3194 if (!SWIG_IsOK(res1))
3197 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3198 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3202 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3204 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3205 da2->checkAllocated();
3206 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3210 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3212 std::vector<int> tmp;
3213 self->getCellIdsHavingGaussLocalization(locId,tmp);
3214 DataArrayInt *ret=DataArrayInt::New();
3215 ret->alloc((int)tmp.size(),1);
3216 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3222 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3225 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3226 static MEDCouplingFieldTemplate *New(TypeOfField type);
3227 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3228 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3231 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3233 return MEDCouplingFieldTemplate::New(f);
3236 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3238 return MEDCouplingFieldTemplate::New(type);
3241 std::string __str__() const throw(INTERP_KERNEL::Exception)
3243 return self->simpleRepr();
3246 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3248 std::ostringstream oss;
3249 self->reprQuickOverview(oss);
3255 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3258 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3259 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3260 void setTimeUnit(const char *unit);
3261 const char *getTimeUnit() const;
3262 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3263 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3264 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3265 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3266 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3267 void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
3268 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3269 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3270 MEDCouplingFieldDouble *deepCpy() const;
3271 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3272 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3273 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3274 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3275 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3276 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3277 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3278 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3279 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3280 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3281 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3282 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3283 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3284 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3285 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3286 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3287 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3288 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3289 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3290 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3291 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3292 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3293 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3294 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3295 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3296 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3297 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3298 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3299 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3300 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3301 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3302 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3303 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3304 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3305 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3306 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3307 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3308 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3309 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3310 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3311 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3312 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3313 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3314 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3315 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3316 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3317 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3318 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3319 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3320 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3321 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3322 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3323 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3324 double getMinValue() const throw(INTERP_KERNEL::Exception);
3325 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3326 double norm2() const throw(INTERP_KERNEL::Exception);
3327 double normMax() const throw(INTERP_KERNEL::Exception);
3328 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3329 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3330 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3331 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3332 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3333 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3334 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3335 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3336 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3337 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3338 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3339 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3340 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3341 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3342 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3343 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3344 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3345 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3346 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3347 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3348 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3349 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3351 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3353 return MEDCouplingFieldDouble::New(type,td);
3356 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3358 return MEDCouplingFieldDouble::New(ft,td);
3361 std::string __str__() const throw(INTERP_KERNEL::Exception)
3363 return self->simpleRepr();
3366 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3368 std::ostringstream oss;
3369 self->reprQuickOverview(oss);
3373 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3375 DataArrayDouble *ret=self->getArray();
3381 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3383 std::vector<DataArrayDouble *> arrs=self->getArrays();
3384 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3388 PyObject *ret=PyTuple_New(sz);
3389 for(int i=0;i<sz;i++)
3392 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3394 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3399 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3401 std::vector<const DataArrayDouble *> tmp;
3402 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3404 std::vector<DataArrayDouble *> arrs(sz);
3405 for(int i=0;i<sz;i++)
3406 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3407 self->setArrays(arrs);
3410 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3412 DataArrayDouble *ret=self->getEndArray();
3418 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3422 DataArrayDoubleTuple *aa;
3423 std::vector<double> bb;
3425 const MEDCouplingMesh *mesh=self->getMesh();
3427 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3428 int spaceDim=mesh->getSpaceDimension();
3429 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3430 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3432 int sz=self->getNumberOfComponents();
3433 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3434 self->getValueOn(spaceLoc,res);
3435 return convertDblArrToPyList(res,sz);
3438 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3440 int sz=self->getNumberOfComponents();
3441 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3442 self->getValueOnPos(i,j,k,res);
3443 return convertDblArrToPyList(res,sz);
3446 DataArrayDouble *getValueOnMulti(PyObject *li) const throw(INTERP_KERNEL::Exception)
3449 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
3450 if (!SWIG_IsOK(res1))
3453 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(li,&size);
3454 const MEDCouplingMesh *mesh=self->getMesh();
3456 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3457 int spaceDim=mesh->getSpaceDimension();
3458 int nbOfPoints=size/spaceDim;
3459 if(size%spaceDim!=0)
3461 throw INTERP_KERNEL::Exception("Invalid list length ! Must be a multiple of self.getMesh().getSpaceDimension() !");
3463 return self->getValueOnMulti(tmp,nbOfPoints);
3467 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
3469 throw INTERP_KERNEL::Exception("Not null DataArrayDouble instance expected !");
3470 da2->checkAllocated();
3471 int size=da2->getNumberOfTuples();
3472 int nbOfCompo=da2->getNumberOfComponents();
3473 const MEDCouplingMesh *mesh=self->getMesh();
3475 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3476 if(nbOfCompo!=mesh->getSpaceDimension())
3478 throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
3480 return self->getValueOnMulti(da2->getConstPointer(),size);
3484 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3488 DataArrayDoubleTuple *aa;
3489 std::vector<double> bb;
3491 const MEDCouplingMesh *mesh=self->getMesh();
3493 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3494 int spaceDim=mesh->getSpaceDimension();
3495 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3496 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3499 int sz=self->getNumberOfComponents();
3500 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3501 self->getValueOn(spaceLoc,time,res);
3502 return convertDblArrToPyList(res,sz);
3505 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3507 if(self->getArray()!=0)
3508 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3511 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3512 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3513 self->setArray(arr);
3517 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3520 double tmp0=self->getTime(tmp1,tmp2);
3521 PyObject *res = PyList_New(3);
3522 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3523 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3524 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3528 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3531 double tmp0=self->getStartTime(tmp1,tmp2);
3532 PyObject *res = PyList_New(3);
3533 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3534 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3535 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3539 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3542 double tmp0=self->getEndTime(tmp1,tmp2);
3543 PyObject *res = PyList_New(3);
3544 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3545 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3546 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3549 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3551 int sz=self->getNumberOfComponents();
3552 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3553 self->accumulate(tmp);
3554 return convertDblArrToPyList(tmp,sz);
3556 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3558 int sz=self->getNumberOfComponents();
3559 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3560 self->integral(isWAbs,tmp);
3561 return convertDblArrToPyList(tmp,sz);
3563 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3565 int sz=self->getNumberOfComponents();
3566 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3567 self->getWeightedAverageValue(tmp,isWAbs);
3568 return convertDblArrToPyList(tmp,sz);
3570 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3572 int sz=self->getNumberOfComponents();
3573 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3575 return convertDblArrToPyList(tmp,sz);
3577 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3579 int sz=self->getNumberOfComponents();
3580 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3582 return convertDblArrToPyList(tmp,sz);
3584 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3587 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3588 if (!SWIG_IsOK(res1))
3591 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3592 self->renumberCells(tmp,check);
3596 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3598 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3599 da2->checkAllocated();
3600 self->renumberCells(da2->getConstPointer(),check);
3603 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3606 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3607 if (!SWIG_IsOK(res1))
3610 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3611 self->renumberNodes(tmp,eps);
3615 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3617 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3618 da2->checkAllocated();
3619 self->renumberNodes(da2->getConstPointer(),eps);
3623 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3627 std::vector<int> multiVal;
3628 std::pair<int, std::pair<int,int> > slic;
3629 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3630 const MEDCouplingMesh *mesh=self->getMesh();
3632 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3633 int nbc=mesh->getNumberOfCells();
3634 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3641 std::ostringstream oss;
3642 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3643 throw INTERP_KERNEL::Exception(oss.str().c_str());
3646 return self->buildSubPart(&singleVal,&singleVal+1);
3651 int tmp=nbc+singleVal;
3652 return self->buildSubPart(&tmp,&tmp+1);
3656 std::ostringstream oss;
3657 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3658 throw INTERP_KERNEL::Exception(oss.str().c_str());
3664 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3668 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3673 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3674 daIntTyypp->checkAllocated();
3675 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3678 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3682 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3684 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";
3685 if(PyTuple_Check(li))
3687 Py_ssize_t sz=PyTuple_Size(li);
3689 throw INTERP_KERNEL::Exception(msg);
3690 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3693 std::vector<int> multiVal;
3694 std::pair<int, std::pair<int,int> > slic;
3695 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3696 if(!self->getArray())
3697 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3699 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3700 catch(INTERP_KERNEL::Exception& e)
3701 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3702 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3703 DataArrayDouble *ret0Arr=ret0->getArray();
3705 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3710 std::vector<int> v2(1,singleVal);
3711 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3712 ret0->setArray(aarr);
3717 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3718 ret0->setArray(aarr);
3723 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3724 std::vector<int> v2(nbOfComp);
3725 for(int i=0;i<nbOfComp;i++)
3726 v2[i]=slic.first+i*slic.second.second;
3727 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3728 ret0->setArray(aarr);
3732 throw INTERP_KERNEL::Exception(msg);
3737 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3740 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3743 double r1=self->getMaxValue2(tmp);
3744 PyObject *ret=PyTuple_New(2);
3745 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3746 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3750 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3753 double r1=self->getMinValue2(tmp);
3754 PyObject *ret=PyTuple_New(2);
3755 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3756 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3760 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3762 std::vector<int> tmp;
3763 convertPyToNewIntArr3(li,tmp);
3764 return self->keepSelectedComponents(tmp);
3767 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3769 std::vector<int> tmp;
3770 convertPyToNewIntArr3(li,tmp);
3771 self->setSelectedComponents(f,tmp);
3774 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3777 DataArrayDouble *a,*a2;
3778 DataArrayDoubleTuple *aa,*aa2;
3779 std::vector<double> bb,bb2;
3782 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3783 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3784 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3785 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3787 return self->extractSlice3D(orig,vect,eps);
3790 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3792 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3795 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3797 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3800 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3802 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.";
3803 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3806 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3808 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3810 return (*self)-(*other);
3812 throw INTERP_KERNEL::Exception(msg);
3817 DataArrayDoubleTuple *aa;
3818 std::vector<double> bb;
3820 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3825 if(!self->getArray())
3826 throw INTERP_KERNEL::Exception(msg2);
3827 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3828 ret->applyLin(1.,-val);
3829 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3830 ret2->setArray(ret);
3835 if(!self->getArray())
3836 throw INTERP_KERNEL::Exception(msg2);
3837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3838 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3839 ret2->setArray(ret);
3844 if(!self->getArray())
3845 throw INTERP_KERNEL::Exception(msg2);
3846 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3847 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3848 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3849 ret2->setArray(ret);
3854 if(!self->getArray())
3855 throw INTERP_KERNEL::Exception(msg2);
3856 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3857 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3858 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3859 ret2->setArray(ret);
3863 { throw INTERP_KERNEL::Exception(msg); }
3867 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3869 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3872 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3874 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3877 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3879 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3882 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3884 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.";
3885 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3888 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3890 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3892 return (*self)/(*other);
3894 throw INTERP_KERNEL::Exception(msg);
3899 DataArrayDoubleTuple *aa;
3900 std::vector<double> bb;
3902 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3908 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3909 if(!self->getArray())
3910 throw INTERP_KERNEL::Exception(msg2);
3911 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3912 ret->applyLin(1./val,0);
3913 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3914 ret2->setArray(ret);
3919 if(!self->getArray())
3920 throw INTERP_KERNEL::Exception(msg2);
3921 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3922 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3923 ret2->setArray(ret);
3928 if(!self->getArray())
3929 throw INTERP_KERNEL::Exception(msg2);
3930 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3931 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3932 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3933 ret2->setArray(ret);
3938 if(!self->getArray())
3939 throw INTERP_KERNEL::Exception(msg2);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3942 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3943 ret2->setArray(ret);
3947 { throw INTERP_KERNEL::Exception(msg); }
3951 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3953 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3956 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3958 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.";
3959 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3962 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3964 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3966 return (*self)^(*other);
3968 throw INTERP_KERNEL::Exception(msg);
3973 DataArrayDoubleTuple *aa;
3974 std::vector<double> bb;
3976 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3981 if(!self->getArray())
3982 throw INTERP_KERNEL::Exception(msg2);
3983 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3985 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3986 ret2->setArray(ret);
3991 if(!self->getArray())
3992 throw INTERP_KERNEL::Exception(msg2);
3993 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3994 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3995 ret2->setArray(ret);
4000 if(!self->getArray())
4001 throw INTERP_KERNEL::Exception(msg2);
4002 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4003 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4004 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4005 ret2->setArray(ret);
4010 if(!self->getArray())
4011 throw INTERP_KERNEL::Exception(msg2);
4012 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4013 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4014 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4015 ret2->setArray(ret);
4019 { throw INTERP_KERNEL::Exception(msg); }
4023 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4025 return self->negate();
4028 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4030 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.";
4031 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4034 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4036 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4040 Py_XINCREF(trueSelf);
4044 throw INTERP_KERNEL::Exception(msg);
4049 DataArrayDoubleTuple *aa;
4050 std::vector<double> bb;
4052 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4057 if(!self->getArray())
4058 throw INTERP_KERNEL::Exception(msg2);
4059 self->getArray()->applyLin(1.,val);
4060 Py_XINCREF(trueSelf);
4065 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4068 Py_XINCREF(trueSelf);
4073 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4074 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4075 ret2->setArray(aaa);
4077 Py_XINCREF(trueSelf);
4082 if(!self->getArray())
4083 throw INTERP_KERNEL::Exception(msg2);
4084 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4085 self->getArray()->addEqual(aaa);
4086 Py_XINCREF(trueSelf);
4090 { throw INTERP_KERNEL::Exception(msg); }
4094 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4096 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.";
4097 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4100 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4102 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4106 Py_XINCREF(trueSelf);
4110 throw INTERP_KERNEL::Exception(msg);
4115 DataArrayDoubleTuple *aa;
4116 std::vector<double> bb;
4118 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4123 if(!self->getArray())
4124 throw INTERP_KERNEL::Exception(msg2);
4125 self->getArray()->applyLin(1.,-val);
4126 Py_XINCREF(trueSelf);
4131 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4134 Py_XINCREF(trueSelf);
4139 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4140 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4141 ret2->setArray(aaa);
4143 Py_XINCREF(trueSelf);
4148 if(!self->getArray())
4149 throw INTERP_KERNEL::Exception(msg2);
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4151 self->getArray()->substractEqual(aaa);
4152 Py_XINCREF(trueSelf);
4156 { throw INTERP_KERNEL::Exception(msg); }
4160 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4162 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.";
4163 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4166 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4168 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4172 Py_XINCREF(trueSelf);
4176 throw INTERP_KERNEL::Exception(msg);
4181 DataArrayDoubleTuple *aa;
4182 std::vector<double> bb;
4184 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4189 if(!self->getArray())
4190 throw INTERP_KERNEL::Exception(msg2);
4191 self->getArray()->applyLin(val,0);
4192 Py_XINCREF(trueSelf);
4197 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4200 Py_XINCREF(trueSelf);
4205 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4206 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4207 ret2->setArray(aaa);
4209 Py_XINCREF(trueSelf);
4214 if(!self->getArray())
4215 throw INTERP_KERNEL::Exception(msg2);
4216 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4217 self->getArray()->multiplyEqual(aaa);
4218 Py_XINCREF(trueSelf);
4222 { throw INTERP_KERNEL::Exception(msg); }
4226 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4228 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.";
4229 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4232 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4234 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4238 Py_XINCREF(trueSelf);
4242 throw INTERP_KERNEL::Exception(msg);
4247 DataArrayDoubleTuple *aa;
4248 std::vector<double> bb;
4250 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4256 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4257 if(!self->getArray())
4258 throw INTERP_KERNEL::Exception(msg2);
4259 self->getArray()->applyLin(1./val,0);
4260 Py_XINCREF(trueSelf);
4265 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4268 Py_XINCREF(trueSelf);
4273 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4274 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4275 ret2->setArray(aaa);
4277 Py_XINCREF(trueSelf);
4282 if(!self->getArray())
4283 throw INTERP_KERNEL::Exception(msg2);
4284 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4285 self->getArray()->divideEqual(aaa);
4286 Py_XINCREF(trueSelf);
4290 { throw INTERP_KERNEL::Exception(msg); }
4294 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4296 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.";
4297 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4300 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4302 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4306 Py_XINCREF(trueSelf);
4310 throw INTERP_KERNEL::Exception(msg);
4315 DataArrayDoubleTuple *aa;
4316 std::vector<double> bb;
4318 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4323 if(!self->getArray())
4324 throw INTERP_KERNEL::Exception(msg2);
4325 self->getArray()->applyPow(val);
4326 Py_XINCREF(trueSelf);
4331 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4334 Py_XINCREF(trueSelf);
4339 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4340 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4341 ret2->setArray(aaa);
4343 Py_XINCREF(trueSelf);
4348 if(!self->getArray())
4349 throw INTERP_KERNEL::Exception(msg2);
4350 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4351 self->getArray()->powEqual(aaa);
4352 Py_XINCREF(trueSelf);
4356 { throw INTERP_KERNEL::Exception(msg); }
4360 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4362 std::vector<const MEDCouplingFieldDouble *> tmp;
4363 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4364 return MEDCouplingFieldDouble::MergeFields(tmp);
4367 static void WriteVTK(const char *fileName, PyObject *li) throw(INTERP_KERNEL::Exception)
4369 std::vector<const MEDCouplingFieldDouble *> tmp;
4370 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4371 MEDCouplingFieldDouble::WriteVTK(fileName,tmp);
4376 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4379 int getNumberOfFields() const;
4380 MEDCouplingMultiFields *deepCpy() const;
4381 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4382 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4383 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4384 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4385 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4388 std::string __str__() const throw(INTERP_KERNEL::Exception)
4390 return self->simpleRepr();
4392 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4394 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4395 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4397 std::vector<MEDCouplingFieldDouble *> fs(sz);
4398 for(int i=0;i<sz;i++)
4399 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4400 return MEDCouplingMultiFields::New(fs);
4402 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4404 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4405 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4407 std::vector<MEDCouplingFieldDouble *> fs(sz);
4408 for(int i=0;i<sz;i++)
4409 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4410 return MEDCouplingMultiFields::New(fs);
4412 PyObject *getFields() const
4414 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4415 int sz=fields.size();
4416 PyObject *res = PyList_New(sz);
4417 for(int i=0;i<sz;i++)
4421 fields[i]->incrRef();
4422 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4426 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4431 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4433 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4437 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4440 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4442 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4444 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4446 PyObject *res = PyList_New(sz);
4447 for(int i=0;i<sz;i++)
4452 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4456 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4461 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4463 std::vector<int> refs;
4464 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4466 PyObject *res = PyList_New(sz);
4467 for(int i=0;i<sz;i++)
4472 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4476 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4480 PyObject *ret=PyTuple_New(2);
4481 PyTuple_SetItem(ret,0,res);
4482 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4485 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4487 std::vector<DataArrayDouble *> ms=self->getArrays();
4489 PyObject *res = PyList_New(sz);
4490 for(int i=0;i<sz;i++)
4495 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4499 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4504 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4506 std::vector< std::vector<int> > refs;
4507 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4509 PyObject *res = PyList_New(sz);
4510 PyObject *res2 = PyList_New(sz);
4511 for(int i=0;i<sz;i++)
4516 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4520 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4522 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4525 PyObject *ret=PyTuple_New(2);
4526 PyTuple_SetItem(ret,0,res);
4527 PyTuple_SetItem(ret,1,res2);
4533 class MEDCouplingDefinitionTime
4536 MEDCouplingDefinitionTime();
4537 void assign(const MEDCouplingDefinitionTime& other);
4538 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4539 double getTimeResolution() const;
4540 std::vector<double> getHotSpotsTime() const;
4543 std::string __str__() const throw(INTERP_KERNEL::Exception)
4545 std::ostringstream oss;
4546 self->appendRepr(oss);
4550 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4552 int meshId,arrId,arrIdInField,fieldId;
4553 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4554 PyObject *res=PyList_New(4);
4555 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4556 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4557 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4558 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4562 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4564 int meshId,arrId,arrIdInField,fieldId;
4565 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4566 PyObject *res=PyList_New(4);
4567 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4568 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4569 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4570 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4576 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4579 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4580 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4584 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4586 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4587 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4589 std::vector<MEDCouplingFieldDouble *> fs(sz);
4590 for(int i=0;i<sz;i++)
4591 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4592 return MEDCouplingFieldOverTime::New(fs);
4594 std::string __str__() const throw(INTERP_KERNEL::Exception)
4596 return self->simpleRepr();
4598 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4600 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4601 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4603 std::vector<MEDCouplingFieldDouble *> fs(sz);
4604 for(int i=0;i<sz;i++)
4605 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4606 return MEDCouplingFieldOverTime::New(fs);
4614 __filename=os.environ.get('PYTHONSTARTUP')
4615 if __filename and os.path.isfile(__filename):
4616 execfile(__filename)