1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.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 "MEDCouplingCartesianAMRMesh.hxx"
44 #include "MEDCouplingAMRAttribute.hxx"
45 #include "MEDCouplingMatrix.hxx"
46 #include "MEDCouplingTypemaps.i"
48 #include "InterpKernelAutoPtr.hxx"
49 #include "BoxSplittingOptions.hxx"
51 using namespace ParaMEDMEM;
52 using namespace INTERP_KERNEL;
56 %template(ivec) std::vector<int>;
57 %template(dvec) std::vector<double>;
58 %template(svec) std::vector<std::string>;
61 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
66 %typemap(out) MEDCouplingMesh*
68 $result=convertMesh($1,$owner);
73 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
78 %typemap(out) MEDCouplingPointSet*
80 $result=convertMesh($1,$owner);
85 %typemap(out) MEDCouplingCartesianAMRPatchGen*
87 $result=convertCartesianAMRPatch($1,$owner);
92 %typemap(out) MEDCouplingCartesianAMRMeshGen*
94 $result=convertCartesianAMRMesh($1,$owner);
99 %typemap(out) MEDCouplingDataForGodFather*
101 $result=convertDataForGodFather($1,$owner);
106 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
108 $result=convertMesh($1,$owner);
111 %typemap(out) MEDCoupling1GTUMesh*
113 $result=convertMesh($1,$owner);
118 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
120 $result=convertMesh($1,$owner);
123 %typemap(out) MEDCouplingStructuredMesh*
125 $result=convertMesh($1,$owner);
130 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
132 $result=convertFieldDiscretization($1,$owner);
135 %typemap(out) MEDCouplingFieldDiscretization*
137 $result=convertFieldDiscretization($1,$owner);
142 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
144 $result=convertMultiFields($1,$owner);
147 %typemap(out) MEDCouplingMultiFields*
149 $result=convertMultiFields($1,$owner);
154 %init %{ import_array(); %}
157 %feature("autodoc", "1");
158 %feature("docstring");
160 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
161 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
162 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
192 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
193 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
194 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
195 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
196 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
197 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
198 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
199 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
200 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
201 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
202 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
203 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
204 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
205 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
206 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
207 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
208 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
209 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
210 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
211 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
212 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
213 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
214 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
215 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
216 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
217 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
218 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
219 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
220 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
221 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
222 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
223 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
224 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
225 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
226 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
227 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
228 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
229 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
230 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
231 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
232 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
233 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
234 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
235 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
236 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
237 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
238 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
239 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
240 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
241 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
242 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
243 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
244 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
245 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
246 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
247 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
248 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
249 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
293 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
294 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
295 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
296 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
297 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
298 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
301 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
302 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
303 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
304 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
305 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
306 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
307 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
308 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
309 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
310 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
311 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
312 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
313 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
314 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
315 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
316 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
317 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
318 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
319 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
320 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
321 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
322 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
323 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
324 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
325 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
326 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
327 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ComputeCornersGhost;
328 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
329 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
330 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
331 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
332 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
333 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
334 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
335 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
336 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
337 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
338 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
339 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
340 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
341 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
342 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
343 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::deepCpy;
344 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
345 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
346 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
347 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
348 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh;
349 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather;
350 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather;
351 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
352 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
353 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
354 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
355 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
356 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
357 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
358 %newobject ParaMEDMEM::MEDCouplingDataForGodFather::getMyGodFather;
359 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::New;
360 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpy;
361 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
362 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn;
363 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
364 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
365 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
366 %newobject ParaMEDMEM::DenseMatrix::New;
367 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
368 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
369 %newobject ParaMEDMEM::DenseMatrix::getData;
370 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
371 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
372 %newobject ParaMEDMEM::DenseMatrix::__add__;
373 %newobject ParaMEDMEM::DenseMatrix::__sub__;
374 %newobject ParaMEDMEM::DenseMatrix::__mul__;
376 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
377 %feature("unref") MEDCouplingMesh "$this->decrRef();"
378 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
379 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
380 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
381 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
382 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
383 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
384 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
385 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
386 %feature("unref") MEDCouplingField "$this->decrRef();"
387 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
388 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
389 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
390 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
391 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
392 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
393 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
394 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
395 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
396 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
397 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
398 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
399 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
400 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
401 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
402 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
403 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
404 %feature("unref") DenseMatrix "$this->decrRef();"
406 %rename(assign) *::operator=;
407 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
408 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
409 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
410 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
414 %rename (InterpKernelException) INTERP_KERNEL::Exception;
416 %include "MEDCouplingRefCountObject.i"
417 %include "MEDCouplingMemArray.i"
419 namespace INTERP_KERNEL
422 * \class BoxSplittingOptions
423 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
425 class BoxSplittingOptions
428 BoxSplittingOptions();
429 void init() throw(INTERP_KERNEL::Exception);
430 double getEfficiencyGoal() const throw(INTERP_KERNEL::Exception);
431 void setEfficiencyGoal(double efficiency) throw(INTERP_KERNEL::Exception);
432 double getEfficiencyThreshold() const throw(INTERP_KERNEL::Exception);
433 void setEfficiencyThreshold(double efficiencyThreshold) throw(INTERP_KERNEL::Exception);
434 int getMinimumPatchLength() const throw(INTERP_KERNEL::Exception);
435 void setMinimumPatchLength(int minPatchLength) throw(INTERP_KERNEL::Exception);
436 int getMaximumPatchLength() const throw(INTERP_KERNEL::Exception);
437 void setMaximumPatchLength(int maxPatchLength) throw(INTERP_KERNEL::Exception);
438 int getMaximumNbOfCellsInPatch() const throw(INTERP_KERNEL::Exception);
439 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch) throw(INTERP_KERNEL::Exception);
440 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
441 std::string printOptions() const throw(INTERP_KERNEL::Exception);
444 std::string __str__() const throw(INTERP_KERNEL::Exception)
446 return self->printOptions();
468 CONST_ON_TIME_INTERVAL = 7
469 } TypeOfTimeDiscretization;
477 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
478 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
480 } MEDCouplingMeshType;
483 class DataArrayDouble;
484 class MEDCouplingUMesh;
485 class MEDCouplingFieldDouble;
487 %extend RefCountObject
489 std::string getHiddenCppPointer() const
491 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
496 %extend MEDCouplingGaussLocalization
498 std::string __str__() const throw(INTERP_KERNEL::Exception)
500 return self->getStringRepr();
503 std::string __repr__() const throw(INTERP_KERNEL::Exception)
505 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
506 oss << self->getStringRepr();
513 class MEDCouplingMesh : public RefCountObject, public TimeLabel
516 void setName(const std::string& name);
517 std::string getName() const;
518 void setDescription(const std::string& descr);
519 std::string getDescription() const;
520 void setTime(double val, int iteration, int order);
521 void setTimeUnit(const std::string& unit);
522 std::string getTimeUnit() const;
523 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
524 bool isStructured() const throw(INTERP_KERNEL::Exception);
525 virtual MEDCouplingMesh *deepCpy() const;
526 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
527 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
528 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
529 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
530 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
531 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
532 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
533 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
534 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
535 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
536 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
537 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
538 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
539 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
540 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
541 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
542 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
543 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
544 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
545 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
546 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
547 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
548 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
549 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
550 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
552 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
553 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
554 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
555 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
556 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
557 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
558 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
559 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
560 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
561 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
562 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
563 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
564 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
565 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
566 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
567 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
568 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
571 std::string __str__() const throw(INTERP_KERNEL::Exception)
573 return self->simpleRepr();
576 PyObject *getTime() throw(INTERP_KERNEL::Exception)
579 double tmp0=self->getTime(tmp1,tmp2);
580 PyObject *res = PyList_New(3);
581 PyList_SetItem(res,0,SWIG_From_double(tmp0));
582 PyList_SetItem(res,1,SWIG_From_int(tmp1));
583 PyList_SetItem(res,2,SWIG_From_int(tmp2));
587 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
591 DataArrayDoubleTuple *aa;
592 std::vector<double> bb;
594 int spaceDim=self->getSpaceDimension();
595 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
596 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
597 return self->getCellContainingPoint(pos,eps);
600 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
604 DataArrayDoubleTuple *aa;
605 std::vector<double> bb;
607 int spaceDim=self->getSpaceDimension();
608 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
609 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
610 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
611 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
612 PyObject *ret=PyTuple_New(2);
613 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
614 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
618 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
620 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
621 int spaceDim=self->getSpaceDimension();
623 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
624 if (!SWIG_IsOK(res1))
627 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
628 int nbOfPoints=size/spaceDim;
631 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
633 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
637 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
639 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
640 da2->checkAllocated();
641 int size=da2->getNumberOfTuples();
642 int nbOfCompo=da2->getNumberOfComponents();
643 if(nbOfCompo!=spaceDim)
645 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
647 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
649 PyObject *ret=PyTuple_New(2);
650 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
651 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
655 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
659 DataArrayDoubleTuple *aa;
660 std::vector<double> bb;
662 int spaceDim=self->getSpaceDimension();
663 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
664 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
665 std::vector<int> elts;
666 self->getCellsContainingPoint(pos,eps,elts);
667 DataArrayInt *ret=DataArrayInt::New();
668 ret->alloc((int)elts.size(),1);
669 std::copy(elts.begin(),elts.end(),ret->getPointer());
670 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
673 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
675 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
676 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
677 self->getReverseNodalConnectivity(d0,d1);
678 PyObject *ret=PyTuple_New(2);
679 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
680 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
684 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
687 int v0; std::vector<int> v1;
688 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
689 self->renumberCells(ids,check);
692 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
694 DataArrayInt *cellCor, *nodeCor;
695 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
696 PyObject *res = PyList_New(2);
697 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
698 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
702 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
704 DataArrayInt *cellCor=0,*nodeCor=0;
705 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
706 PyObject *res = PyList_New(2);
707 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
708 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
712 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
714 DataArrayInt *cellCor=0;
715 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
719 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
722 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
723 if (!SWIG_IsOK(res1))
726 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
727 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
731 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
733 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
734 da2->checkAllocated();
735 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
738 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
740 std::vector<int> conn;
741 self->getNodeIdsOfCell(cellId,conn);
742 return convertIntArrToPyList2(conn);
745 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
747 std::vector<double> coo;
748 self->getCoordinatesOfNode(nodeId,coo);
749 return convertDblArrToPyList2(coo);
752 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
756 DataArrayDoubleTuple *aa;
757 std::vector<double> bb;
759 int spaceDim=self->getSpaceDimension();
760 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
761 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
762 self->scale(pointPtr,factor);
765 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
767 int spaceDim=self->getSpaceDimension();
768 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
769 self->getBoundingBox(tmp);
770 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
774 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
777 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
778 PyObject *ret=PyTuple_New(2);
779 PyObject *ret0Py=ret0?Py_True:Py_False;
781 PyTuple_SetItem(ret,0,ret0Py);
782 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
786 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
788 int szArr,sw,iTypppArr;
789 std::vector<int> stdvecTyyppArr;
790 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
791 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
792 if(sw==3)//DataArrayInt
794 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
795 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
796 std::string name=argpt->getName();
798 ret->setName(name.c_str());
800 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
803 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
805 int szArr,sw,iTypppArr;
806 std::vector<int> stdvecTyyppArr;
808 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
809 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
810 if(sw==3)//DataArrayInt
812 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
813 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
814 std::string name=argpt->getName();
816 ret->setName(name.c_str());
819 PyObject *res = PyList_New(2);
820 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
821 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
822 PyList_SetItem(res,0,obj0);
823 PyList_SetItem(res,1,obj1);
827 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
831 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
832 PyObject *res = PyTuple_New(2);
833 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
836 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
838 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
839 PyTuple_SetItem(res,0,obj0);
840 PyTuple_SetItem(res,1,obj1);
844 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
846 std::vector<int> vals=self->getDistributionOfTypes();
848 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
849 PyObject *ret=PyList_New((int)vals.size()/3);
850 for(int j=0;j<(int)vals.size()/3;j++)
852 PyObject *ret1=PyList_New(3);
853 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
854 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
855 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
856 PyList_SetItem(ret,j,ret1);
861 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
863 std::vector<int> code;
864 std::vector<const DataArrayInt *> idsPerType;
865 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
866 convertPyToNewIntArr4(li,1,3,code);
867 return self->checkTypeConsistencyAndContig(code,idsPerType);
870 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
872 std::vector<int> code;
873 std::vector<DataArrayInt *> idsInPflPerType;
874 std::vector<DataArrayInt *> idsPerType;
875 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
876 PyObject *ret=PyTuple_New(3);
879 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
880 PyObject *ret0=PyList_New((int)code.size()/3);
881 for(int j=0;j<(int)code.size()/3;j++)
883 PyObject *ret00=PyList_New(3);
884 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
885 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
886 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
887 PyList_SetItem(ret0,j,ret00);
889 PyTuple_SetItem(ret,0,ret0);
891 PyObject *ret1=PyList_New(idsInPflPerType.size());
892 for(std::size_t j=0;j<idsInPflPerType.size();j++)
893 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
894 PyTuple_SetItem(ret,1,ret1);
895 int n=idsPerType.size();
896 PyObject *ret2=PyList_New(n);
898 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
899 PyTuple_SetItem(ret,2,ret2);
903 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
907 DataArrayDoubleTuple *aa;
908 std::vector<double> bb;
910 int spaceDim=self->getSpaceDimension();
911 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
912 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
913 self->translate(vectorPtr);
916 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
918 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
921 DataArrayDoubleTuple *aa;
922 std::vector<double> bb;
924 int spaceDim=self->getSpaceDimension();
925 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
926 self->rotate(centerPtr,0,alpha);
929 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
931 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
933 DataArrayDouble *a,*a2;
934 DataArrayDoubleTuple *aa,*aa2;
935 std::vector<double> bb,bb2;
937 int spaceDim=self->getSpaceDimension();
938 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
939 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
940 self->rotate(centerPtr,vectorPtr,alpha);
943 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
945 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
946 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
947 PyObject *res=PyList_New(result.size());
948 for(int i=0;iL!=result.end(); i++, iL++)
949 PyList_SetItem(res,i,PyInt_FromLong(*iL));
953 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
955 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
956 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
957 return MEDCouplingMesh::MergeMeshes(tmp);
963 //== MEDCouplingMesh End
965 %include "NormalizedGeometricTypes"
966 %include "MEDCouplingNatureOfFieldEnum"
970 class MEDCouplingNatureOfField
973 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
974 static std::string GetReprNoThrow(NatureOfField nat);
975 static std::string GetAllPossibilitiesStr();
979 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
980 // include "MEDCouplingTimeDiscretization.i"
984 class MEDCouplingGaussLocalization
987 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
988 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
989 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
990 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
991 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
992 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
993 int getDimension() const throw(INTERP_KERNEL::Exception);
994 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
995 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
996 void checkCoherency() const throw(INTERP_KERNEL::Exception);
997 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
999 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
1000 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
1001 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
1002 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
1003 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
1004 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
1005 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
1006 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
1007 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
1008 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
1009 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
1010 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
1012 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1016 %include "MEDCouplingFieldDiscretization.i"
1018 //== MEDCouplingPointSet
1020 namespace ParaMEDMEM
1022 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1025 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1026 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1027 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1028 void zipCoords() throw(INTERP_KERNEL::Exception);
1029 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1030 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1031 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1032 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1033 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1034 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1035 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1036 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1037 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1038 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
1039 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1040 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1041 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1042 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1043 virtual DataArrayInt *findBoundaryNodes() const;
1044 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1045 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1046 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1047 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1048 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1049 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1052 std::string __str__() const throw(INTERP_KERNEL::Exception)
1054 return self->simpleRepr();
1057 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1060 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1061 PyObject *res = PyList_New(2);
1062 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1063 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1067 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1069 DataArrayInt *comm, *commIndex;
1070 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1071 PyObject *res = PyList_New(2);
1072 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1073 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1077 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1079 DataArrayDouble *ret1=self->getCoords();
1082 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1085 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1087 int szArr,sw,iTypppArr;
1088 std::vector<int> stdvecTyyppArr;
1089 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1090 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1091 if(sw==3)//DataArrayInt
1093 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1094 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1095 std::string name=argpt->getName();
1097 ret->setName(name.c_str());
1099 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1102 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1104 int szArr,sw,iTypppArr;
1105 std::vector<int> stdvecTyyppArr;
1106 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1107 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1108 if(sw==3)//DataArrayInt
1110 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1111 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1112 std::string name=argpt->getName();
1114 ret->setName(name.c_str());
1116 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1119 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1121 int szArr,sw,iTypppArr;
1122 std::vector<int> stdvecTyyppArr;
1123 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1124 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1125 if(sw==3)//DataArrayInt
1127 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1128 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1129 std::string name=argpt->getName();
1131 ret->setName(name.c_str());
1133 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1136 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1138 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1139 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1142 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1144 int szArr,sw,iTypppArr;
1145 std::vector<int> stdvecTyyppArr;
1146 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1147 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1148 if(sw==3)//DataArrayInt
1150 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1151 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1152 std::string name=argpt->getName();
1154 ret->setName(name.c_str());
1156 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1159 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1161 int szArr,sw,iTypppArr;
1162 std::vector<int> stdvecTyyppArr;
1163 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1164 self->renumberNodes(tmp,newNbOfNodes);
1167 void renumberNodes2(PyObject *li, int newNbOfNodes) 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 self->renumberNodes2(tmp,newNbOfNodes);
1175 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1177 int spaceDim=self->getSpaceDimension();
1179 DataArrayDouble *a,*a2;
1180 DataArrayDoubleTuple *aa,*aa2;
1181 std::vector<double> bb,bb2;
1183 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1184 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1185 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1186 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1187 std::vector<int> nodes;
1188 self->findNodesOnLine(p,v,eps,nodes);
1189 DataArrayInt *ret=DataArrayInt::New();
1190 ret->alloc((int)nodes.size(),1);
1191 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1192 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1194 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1196 int spaceDim=self->getSpaceDimension();
1198 DataArrayDouble *a,*a2;
1199 DataArrayDoubleTuple *aa,*aa2;
1200 std::vector<double> bb,bb2;
1202 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1203 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1204 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1205 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1206 std::vector<int> nodes;
1207 self->findNodesOnPlane(p,v,eps,nodes);
1208 DataArrayInt *ret=DataArrayInt::New();
1209 ret->alloc((int)nodes.size(),1);
1210 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1214 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1218 DataArrayDoubleTuple *aa;
1219 std::vector<double> bb;
1221 int spaceDim=self->getSpaceDimension();
1222 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1223 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1224 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1225 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1228 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1230 DataArrayInt *c=0,*cI=0;
1234 DataArrayDoubleTuple *aa;
1235 std::vector<double> bb;
1237 int spaceDim=self->getSpaceDimension();
1238 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1239 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1240 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1241 PyObject *ret=PyTuple_New(2);
1242 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1243 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1247 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1249 DataArrayInt *c=0,*cI=0;
1250 int spaceDim=self->getSpaceDimension();
1253 DataArrayDoubleTuple *aa;
1254 std::vector<double> bb;
1257 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1258 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1260 PyObject *ret=PyTuple_New(2);
1261 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1262 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1266 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1270 DataArrayDoubleTuple *aa;
1271 std::vector<double> bb;
1273 int spaceDim=self->getSpaceDimension();
1274 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1275 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1277 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1278 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1281 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1285 std::vector<int> multiVal;
1286 std::pair<int, std::pair<int,int> > slic;
1287 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1288 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1292 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1294 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1296 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1298 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1302 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1304 DataArrayInt *v0=0,*v1=0;
1305 self->findCommonCells(compType,startCellId,v0,v1);
1306 PyObject *res = PyList_New(2);
1307 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1308 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1313 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1316 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1317 if (!SWIG_IsOK(res1))
1320 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1321 self->renumberNodesInConn(tmp);
1325 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1327 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1328 da2->checkAllocated();
1329 self->renumberNodesInConn(da2->getConstPointer());
1333 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1336 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1337 PyObject *ret=PyTuple_New(2);
1338 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1339 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1343 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1345 DataArrayInt *ret=0;
1347 int szArr,sw,iTypppArr;
1348 std::vector<int> stdvecTyyppArr;
1349 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1350 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1354 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1358 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1359 PyObject *res = PyList_New(3);
1360 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1361 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1362 PyList_SetItem(res,2,SWIG_From_int(ret2));
1366 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1370 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1371 PyObject *res = PyList_New(3);
1372 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1373 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1374 PyList_SetItem(res,2,SWIG_From_int(ret2));
1378 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1381 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1382 if (!SWIG_IsOK(res1))
1385 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1386 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1390 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1392 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1393 da2->checkAllocated();
1394 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1398 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1402 std::vector<int> multiVal;
1403 std::pair<int, std::pair<int,int> > slic;
1404 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1405 int nbc=self->getNumberOfCells();
1406 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1413 std::ostringstream oss;
1414 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1415 throw INTERP_KERNEL::Exception(oss.str().c_str());
1418 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1423 int tmp=nbc+singleVal;
1424 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1428 std::ostringstream oss;
1429 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1430 throw INTERP_KERNEL::Exception(oss.str().c_str());
1436 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1440 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1445 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1446 daIntTyypp->checkAllocated();
1447 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1450 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1454 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1457 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1458 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1459 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1460 for(int i=0;i<sz;i++)
1461 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1464 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1467 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1469 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1470 std::vector<double> val3;
1471 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1472 "Rotate2DAlg",2,true,nbNodes);
1474 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1475 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1478 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1481 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1482 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1483 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1484 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1485 for(int i=0;i<sz;i++)
1486 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1489 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1492 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1494 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1495 std::vector<double> val3;
1496 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1497 "Rotate3DAlg",3,true,nbNodes);
1499 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1500 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1501 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1506 //== MEDCouplingPointSet End
1508 class MEDCouplingUMeshCell
1511 INTERP_KERNEL::NormalizedCellType getType() const;
1514 std::string __str__() const throw(INTERP_KERNEL::Exception)
1516 return self->repr();
1519 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1522 const int *r=self->getAllConn(ret2);
1523 PyObject *ret=PyTuple_New(ret2);
1524 for(int i=0;i<ret2;i++)
1525 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1531 class MEDCouplingUMeshCellIterator
1538 MEDCouplingUMeshCell *ret=self->nextt();
1540 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1543 PyErr_SetString(PyExc_StopIteration,"No more data.");
1550 class MEDCouplingUMeshCellByTypeIterator
1553 ~MEDCouplingUMeshCellByTypeIterator();
1558 MEDCouplingUMeshCellEntry *ret=self->nextt();
1560 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1563 PyErr_SetString(PyExc_StopIteration,"No more data.");
1570 class MEDCouplingUMeshCellByTypeEntry
1573 ~MEDCouplingUMeshCellByTypeEntry();
1576 MEDCouplingUMeshCellByTypeIterator *__iter__()
1578 return self->iterator();
1583 class MEDCouplingUMeshCellEntry
1586 INTERP_KERNEL::NormalizedCellType getType() const;
1587 int getNumberOfElems() const;
1590 MEDCouplingUMeshCellIterator *__iter__()
1592 return self->iterator();
1597 //== MEDCouplingUMesh
1599 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1602 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1603 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1604 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1605 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1606 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1607 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1608 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1609 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1610 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1611 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1612 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1613 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1614 void computeTypes() throw(INTERP_KERNEL::Exception);
1615 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1616 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1618 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1619 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1620 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1621 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1622 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1623 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1624 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1625 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1626 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1627 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1628 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1629 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1630 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1631 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1632 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1633 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1634 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1635 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1636 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1637 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1638 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1639 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1640 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1641 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1642 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1643 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1644 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1645 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1646 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1647 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1648 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1649 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1650 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1651 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1652 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1653 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1654 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1655 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1656 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1657 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1658 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1659 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1660 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1661 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) throw(INTERP_KERNEL::Exception);
1662 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1663 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1664 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1665 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1666 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1668 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1670 return MEDCouplingUMesh::New();
1673 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1675 return MEDCouplingUMesh::New(meshName,meshDim);
1678 std::string __str__() const throw(INTERP_KERNEL::Exception)
1680 return self->simpleRepr();
1683 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1685 std::ostringstream oss;
1686 self->reprQuickOverview(oss);
1690 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1692 return self->cellIterator();
1695 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1697 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1698 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1699 PyObject *res=PyList_New(result.size());
1700 for(int i=0;iL!=result.end(); i++, iL++)
1701 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1705 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1709 std::vector<int> multiVal;
1710 std::pair<int, std::pair<int,int> > slic;
1711 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1712 int nbc=self->getNumberOfCells();
1713 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1720 std::ostringstream oss;
1721 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1722 throw INTERP_KERNEL::Exception(oss.str().c_str());
1726 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1733 int tmp=nbc+singleVal;
1734 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1739 std::ostringstream oss;
1740 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1741 throw INTERP_KERNEL::Exception(oss.str().c_str());
1747 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1753 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1754 daIntTyypp->checkAllocated();
1755 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1759 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1763 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1767 std::vector<int> multiVal;
1768 std::pair<int, std::pair<int,int> > slic;
1769 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1770 int nbc=self->getNumberOfCells();
1771 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1778 std::ostringstream oss;
1779 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1780 throw INTERP_KERNEL::Exception(oss.str().c_str());
1784 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1791 int tmp=nbc+singleVal;
1792 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1797 std::ostringstream oss;
1798 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1799 throw INTERP_KERNEL::Exception(oss.str().c_str());
1805 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1810 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1816 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1817 daIntTyypp->checkAllocated();
1818 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1822 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1826 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1828 int szArr,sw,iTypppArr;
1829 std::vector<int> stdvecTyyppArr;
1830 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1833 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1834 throw INTERP_KERNEL::Exception(oss.str().c_str());
1836 self->insertNextCell(type,size,tmp);
1839 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1841 int szArr,sw,iTypppArr;
1842 std::vector<int> stdvecTyyppArr;
1843 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1844 self->insertNextCell(type,szArr,tmp);
1847 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1849 DataArrayInt *ret=self->getNodalConnectivity();
1854 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1856 DataArrayInt *ret=self->getNodalConnectivityIndex();
1862 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1864 int szArr,sw,iTypppArr;
1865 std::vector<int> stdvecTyyppArr;
1866 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1867 int nbOfDepthPeelingPerformed=0;
1868 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1869 PyObject *res=PyTuple_New(2);
1870 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1871 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1875 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1877 DataArrayInt *v0=0,*v1=0;
1878 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1879 PyObject *res = PyList_New(2);
1880 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1881 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1885 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1889 DataArrayDoubleTuple *aa;
1890 std::vector<double> bb;
1892 int nbOfCompo=self->getSpaceDimension();
1893 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1896 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1897 PyObject *ret=PyTuple_New(2);
1898 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1899 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1903 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1905 DataArrayInt *ret1=0;
1906 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1907 PyObject *ret=PyTuple_New(2);
1908 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1909 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1913 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1916 DataArrayInt *ret1(0);
1917 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1918 PyObject *ret=PyTuple_New(3);
1919 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1920 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1921 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1925 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1927 std::vector<int> cells;
1928 self->checkButterflyCells(cells,eps);
1929 DataArrayInt *ret=DataArrayInt::New();
1930 ret->alloc((int)cells.size(),1);
1931 std::copy(cells.begin(),cells.end(),ret->getPointer());
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1935 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1937 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1939 PyObject *ret = PyList_New(sz);
1940 for(int i=0;i<sz;i++)
1941 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1945 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1947 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1948 int sz=retCpp.size();
1949 PyObject *ret=PyList_New(sz);
1950 for(int i=0;i<sz;i++)
1951 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1955 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1958 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1959 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1960 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1963 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1966 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1967 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1971 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1974 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1975 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1979 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1981 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1982 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1983 PyObject *ret=PyTuple_New(3);
1984 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1985 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1986 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1990 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1992 DataArrayInt *tmp0=0,*tmp1=0;
1993 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1994 PyObject *ret=PyTuple_New(2);
1995 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1996 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2000 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2004 std::vector<int> multiVal;
2005 std::pair<int, std::pair<int,int> > slic;
2006 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2007 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2011 return self->duplicateNodes(&singleVal,&singleVal+1);
2013 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2015 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2017 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2021 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2025 std::vector<int> multiVal;
2026 std::pair<int, std::pair<int,int> > slic;
2027 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2028 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2032 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2034 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2036 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2038 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2042 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2045 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2046 DataArrayInt *tmp0,*tmp1=0;
2047 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2048 PyObject *ret=PyTuple_New(2);
2049 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2050 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2054 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2056 DataArrayInt *ret0=0,*ret1=0;
2057 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2058 PyObject *ret=PyTuple_New(2);
2059 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2064 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2066 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2067 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2068 DataArrayInt *ret1=0,*ret2=0;
2069 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2070 PyObject *ret=PyTuple_New(3);
2071 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2072 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2073 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2077 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2079 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2080 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2081 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2082 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2085 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2088 std::vector<const MEDCouplingUMesh *> meshes;
2089 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2090 std::vector<DataArrayInt *> corr;
2091 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2093 PyObject *ret1=PyList_New(sz);
2094 for(int i=0;i<sz;i++)
2095 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2096 PyObject *ret=PyList_New(2);
2097 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2098 PyList_SetItem(ret,1,ret1);
2102 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2104 std::vector<MEDCouplingUMesh *> meshes;
2105 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2106 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2109 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2111 std::vector<MEDCouplingUMesh *> meshes;
2112 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2113 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2116 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2120 std::vector<int> multiVal;
2121 std::pair<int, std::pair<int,int> > slic;
2122 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2124 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2125 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2129 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2131 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2133 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2135 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2139 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2141 DataArrayInt *arrOut=0,*arrIndexOut=0;
2144 std::vector<int> multiVal;
2145 std::pair<int, std::pair<int,int> > slic;
2146 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2148 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2149 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2154 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2159 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2164 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2168 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2170 PyObject *ret=PyTuple_New(2);
2171 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2172 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2176 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2178 DataArrayInt *arrOut=0,*arrIndexOut=0;
2179 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2180 PyObject *ret=PyTuple_New(2);
2181 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2182 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2186 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2188 if(!PySlice_Check(slic))
2189 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2190 Py_ssize_t strt=2,stp=2,step=2;
2191 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2193 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2194 arrIndxIn->checkAllocated();
2195 if(arrIndxIn->getNumberOfComponents()!=1)
2196 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2197 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2198 DataArrayInt *arrOut=0,*arrIndexOut=0;
2199 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2200 PyObject *ret=PyTuple_New(2);
2201 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2202 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2206 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2207 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2208 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2210 DataArrayInt *arrOut=0,*arrIndexOut=0;
2213 std::vector<int> multiVal;
2214 std::pair<int, std::pair<int,int> > slic;
2215 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2217 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2218 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2223 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2228 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2233 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2237 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2239 PyObject *ret=PyTuple_New(2);
2240 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2241 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2245 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2246 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2250 std::vector<int> multiVal;
2251 std::pair<int, std::pair<int,int> > slic;
2252 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2254 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2255 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2260 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2265 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2270 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2274 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2278 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2282 DataArrayDoubleTuple *aa;
2283 std::vector<double> bb;
2285 int spaceDim=self->getSpaceDimension();
2286 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2287 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2289 std::vector<int> cells;
2290 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2291 DataArrayInt *ret=DataArrayInt::New();
2292 ret->alloc((int)cells.size(),1);
2293 std::copy(cells.begin(),cells.end(),ret->getPointer());
2294 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2297 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2301 DataArrayDoubleTuple *aa;
2302 std::vector<double> bb;
2304 int spaceDim=self->getSpaceDimension();
2305 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2306 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2307 self->orientCorrectly2DCells(v,polyOnly);
2310 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2312 std::vector<int> cells;
2313 self->arePolyhedronsNotCorrectlyOriented(cells);
2314 DataArrayInt *ret=DataArrayInt::New();
2315 ret->alloc((int)cells.size(),1);
2316 std::copy(cells.begin(),cells.end(),ret->getPointer());
2317 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2320 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2324 self->getFastAveragePlaneOfThis(vec,pos);
2326 std::copy(vec,vec+3,vals);
2327 std::copy(pos,pos+3,vals+3);
2328 return convertDblArrToPyListOfTuple(vals,3,2);
2331 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2333 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2334 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2335 return MEDCouplingUMesh::MergeUMeshes(tmp);
2338 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2341 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2342 PyObject *ret=PyTuple_New(2);
2343 PyObject *ret0Py=ret0?Py_True:Py_False;
2345 PyTuple_SetItem(ret,0,ret0Py);
2346 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2350 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2353 bool ret0=self->areCellsIncludedIn2(other,ret1);
2354 PyObject *ret=PyTuple_New(2);
2355 PyObject *ret0Py=ret0?Py_True:Py_False;
2357 PyTuple_SetItem(ret,0,ret0Py);
2358 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2362 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2364 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2365 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2366 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2367 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2368 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2369 PyObject *ret=PyTuple_New(5);
2370 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2371 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2372 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2374 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2378 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2380 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2381 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2382 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2383 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2384 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2385 PyObject *ret=PyTuple_New(5);
2386 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2387 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2388 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2390 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2396 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2397 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2398 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2399 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2400 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2401 PyObject *ret=PyTuple_New(5);
2402 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2403 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2410 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2412 DataArrayInt *neighbors=0,*neighborsIdx=0;
2413 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2414 PyObject *ret=PyTuple_New(2);
2415 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2416 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2420 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2422 DataArrayInt *neighbors=0,*neighborsIdx=0;
2423 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2424 PyObject *ret=PyTuple_New(2);
2425 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2426 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2430 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2432 DataArrayInt *neighbors=0,*neighborsIdx=0;
2433 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2434 PyObject *ret=PyTuple_New(2);
2435 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2436 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2440 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2442 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2443 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2444 DataArrayInt *d2,*d3,*d4,*dd5;
2445 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2446 PyObject *ret=PyTuple_New(7);
2447 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2448 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2449 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2450 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2451 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2452 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2453 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2457 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2460 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2461 da->checkAllocated();
2462 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2465 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2468 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2469 da->checkAllocated();
2470 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2473 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2476 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2477 da->checkAllocated();
2478 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2481 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2484 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2485 da->checkAllocated();
2486 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2487 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2488 PyObject *res = PyList_New(result.size());
2489 for (int i=0;iL!=result.end(); i++, iL++)
2490 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2494 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2497 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2498 da->checkAllocated();
2499 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2500 ret->setName(da->getName().c_str());
2504 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2506 DataArrayInt *cellNb1=0,*cellNb2=0;
2507 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2508 PyObject *ret=PyTuple_New(3);
2509 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2510 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2511 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2515 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2517 int spaceDim=self->getSpaceDimension();
2519 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2521 DataArrayDouble *a,*a2;
2522 DataArrayDoubleTuple *aa,*aa2;
2523 std::vector<double> bb,bb2;
2525 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2526 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2527 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2528 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2530 DataArrayInt *cellIds=0;
2531 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2532 PyObject *ret=PyTuple_New(2);
2533 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2534 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2538 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2540 int spaceDim=self->getSpaceDimension();
2542 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2544 DataArrayDouble *a,*a2;
2545 DataArrayDoubleTuple *aa,*aa2;
2546 std::vector<double> bb,bb2;
2548 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2549 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2550 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2551 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2553 DataArrayInt *cellIds=0;
2554 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2555 PyObject *ret=PyTuple_New(2);
2556 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2557 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2561 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2563 int spaceDim=self->getSpaceDimension();
2565 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2567 DataArrayDouble *a,*a2;
2568 DataArrayDoubleTuple *aa,*aa2;
2569 std::vector<double> bb,bb2;
2571 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2572 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2573 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2574 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2575 return self->getCellIdsCrossingPlane(orig,vect,eps);
2578 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2582 std::vector<int> pos2;
2583 DataArrayInt *pos3=0;
2584 DataArrayIntTuple *pos4=0;
2585 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2590 self->convertToPolyTypes(&pos1,&pos1+1);
2597 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2602 self->convertToPolyTypes(pos3->begin(),pos3->end());
2606 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2610 void convertAllToPoly();
2611 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2612 bool unPolyze() throw(INTERP_KERNEL::Exception);
2613 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2614 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2615 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2618 //== MEDCouplingUMesh End
2620 //== MEDCouplingExtrudedMesh
2622 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2625 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2626 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2628 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2630 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2633 std::string __str__() const throw(INTERP_KERNEL::Exception)
2635 return self->simpleRepr();
2638 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2640 std::ostringstream oss;
2641 self->reprQuickOverview(oss);
2645 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2647 MEDCouplingUMesh *ret=self->getMesh2D();
2650 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2652 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2654 MEDCouplingUMesh *ret=self->getMesh1D();
2657 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2659 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2661 DataArrayInt *ret=self->getMesh3DIds();
2664 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2669 //== MEDCouplingExtrudedMesh End
2671 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2674 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2675 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2676 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2677 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2678 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2679 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2682 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2684 int szArr,sw,iTypppArr;
2685 std::vector<int> stdvecTyyppArr;
2686 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2687 self->insertNextCell(tmp,tmp+szArr);
2690 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2692 DataArrayInt *ret=self->getNodalConnectivity();
2693 if(ret) ret->incrRef();
2697 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2699 std::vector< const MEDCoupling1GTUMesh *> parts;
2700 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2701 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2706 //== MEDCoupling1SGTUMesh
2708 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2711 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2712 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2713 void setNodalConnectivity(DataArrayInt *nodalConn) 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);
2717 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2718 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2719 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2722 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2724 return MEDCoupling1SGTUMesh::New(name,type);
2727 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2729 return MEDCoupling1SGTUMesh::New(m);
2732 std::string __str__() const throw(INTERP_KERNEL::Exception)
2734 return self->simpleRepr();
2737 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2739 std::ostringstream oss;
2740 self->reprQuickOverview(oss);
2744 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2746 DataArrayInt *cellPerm(0),*nodePerm(0);
2747 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2748 PyObject *ret(PyTuple_New(3));
2749 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2750 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2751 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2755 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2757 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2758 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2759 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2762 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2764 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2765 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2766 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2771 //== MEDCoupling1SGTUMesh End
2773 //== MEDCoupling1DGTUMesh
2775 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2778 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2779 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2780 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2781 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2782 bool isPacked() const throw(INTERP_KERNEL::Exception);
2785 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2787 return MEDCoupling1DGTUMesh::New(name,type);
2790 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2792 return MEDCoupling1DGTUMesh::New(m);
2795 std::string __str__() const throw(INTERP_KERNEL::Exception)
2797 return self->simpleRepr();
2800 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2802 std::ostringstream oss;
2803 self->reprQuickOverview(oss);
2807 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2809 DataArrayInt *ret=self->getNodalConnectivityIndex();
2810 if(ret) ret->incrRef();
2814 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2816 DataArrayInt *ret1=0,*ret2=0;
2817 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2818 PyObject *ret0Py=ret0?Py_True:Py_False;
2820 PyObject *ret=PyTuple_New(3);
2821 PyTuple_SetItem(ret,0,ret0Py);
2822 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2823 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2827 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2830 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2831 PyObject *ret=PyTuple_New(2);
2832 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2833 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2834 PyTuple_SetItem(ret,1,ret1Py);
2838 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2840 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2841 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2842 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2845 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2847 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2848 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2849 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2852 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2854 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2855 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2856 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2861 //== MEDCoupling1DGTUMeshEnd
2863 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2866 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2867 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2868 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2869 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2870 double computeSquareness() const throw(INTERP_KERNEL::Exception);
2871 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2872 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2873 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2874 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2875 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2876 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2877 static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev) throw(INTERP_KERNEL::Exception);
2878 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2881 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2883 int tmpp1=-1,tmpp2=-1;
2884 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2885 std::vector< std::pair<int,int> > inp;
2889 for(int i=0;i<tmpp1;i++)
2890 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2895 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2896 inp.resize(tmpp1/2);
2897 for(int i=0;i<tmpp1/2;i++)
2898 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2901 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2902 return self->buildStructuredSubPart(inp);
2905 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2907 std::vector< std::pair<int,int> > inp;
2908 convertPyToVectorPairInt(part,inp);
2910 int szArr,sw,iTypppArr;
2911 std::vector<int> stdvecTyyppArr;
2912 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2913 std::vector<int> tmp5(tmp4,tmp4+szArr);
2915 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2918 static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2920 std::vector< std::pair<int,int> > inp;
2921 convertPyToVectorPairInt(part,inp);
2922 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
2925 static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2927 std::vector< std::pair<int,int> > inp;
2928 convertPyToVectorPairInt(part,inp);
2929 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
2932 static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part) throw(INTERP_KERNEL::Exception)
2934 std::vector< std::pair<int,int> > inp;
2935 convertPyToVectorPairInt(part,inp);
2936 std::vector<int> stWithGhost;
2937 std::vector< std::pair<int,int> > partWithGhost;
2938 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
2939 PyObject *ret(PyTuple_New(2));
2940 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
2941 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
2945 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2947 std::vector< std::pair<int,int> > inp;
2948 convertPyToVectorPairInt(partCompactFormat,inp);
2949 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2952 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2954 std::vector< std::pair<int,int> > inp;
2955 convertPyToVectorPairInt(part,inp);
2956 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2959 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2961 int szArr,sw,iTypppArr;
2962 std::vector<int> stdvecTyyppArr;
2963 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2964 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2967 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2969 int szArr,sw,iTypppArr;
2970 std::vector<int> stdvecTyyppArr;
2971 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2972 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2975 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2977 std::vector< std::pair<int,int> > inp;
2978 convertPyToVectorPairInt(partCompactFormat,inp);
2979 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2982 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
2984 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
2985 PyObject *retPy=PyList_New(ret.size());
2986 for(std::size_t i=0;i<ret.size();i++)
2988 PyObject *tmp=PyTuple_New(2);
2989 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2990 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2991 PyList_SetItem(retPy,i,tmp);
2996 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
2998 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
2999 convertPyToVectorPairInt(r1,r1Cpp);
3000 convertPyToVectorPairInt(r2,r2Cpp);
3001 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3002 PyObject *retPy=PyList_New(ret.size());
3003 for(std::size_t i=0;i<ret.size();i++)
3005 PyObject *tmp=PyTuple_New(2);
3006 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3007 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3008 PyList_SetItem(retPy,i,tmp);
3013 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
3015 int szArr,sw,iTypppArr;
3016 std::vector<int> stdvecTyyppArr;
3017 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3018 int szArr2,sw2,iTypppArr2;
3019 std::vector<int> stdvecTyyppArr2;
3020 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3021 std::vector<int> tmp3(tmp2,tmp2+szArr2);
3022 std::vector< std::pair<int,int> > partCompactFormat;
3023 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3024 PyObject *ret=PyTuple_New(2);
3025 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3026 PyTuple_SetItem(ret,0,ret0Py);
3027 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3028 for(std::size_t i=0;i<partCompactFormat.size();i++)
3030 PyObject *tmp4=PyTuple_New(2);
3031 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3032 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3033 PyList_SetItem(ret1Py,i,tmp4);
3035 PyTuple_SetItem(ret,1,ret1Py);
3039 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) throw(INTERP_KERNEL::Exception)
3041 std::vector< std::pair<int,int> > param0,param1,ret;
3042 convertPyToVectorPairInt(bigInAbs,param0);
3043 convertPyToVectorPairInt(partOfBigInAbs,param1);
3044 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3045 PyObject *retPy(PyList_New(ret.size()));
3046 for(std::size_t i=0;i<ret.size();i++)
3048 PyObject *tmp(PyTuple_New(2));
3049 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3050 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3051 PyList_SetItem(retPy,i,tmp);
3056 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation) throw(INTERP_KERNEL::Exception)
3058 std::vector< std::pair<int,int> > param0;
3059 convertPyToVectorPairInt(part,param0);
3060 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3061 PyObject *retPy(PyList_New(ret.size()));
3062 for(std::size_t i=0;i<ret.size();i++)
3064 PyObject *tmp(PyTuple_New(2));
3065 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3066 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3067 PyList_SetItem(retPy,i,tmp);
3072 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) throw(INTERP_KERNEL::Exception)
3074 std::vector< std::pair<int,int> > param0,param1;
3075 convertPyToVectorPairInt(startingFrom,param0);
3076 convertPyToVectorPairInt(goingTo,param1);
3077 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3080 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) throw(INTERP_KERNEL::Exception)
3082 std::vector< std::pair<int,int> > param0,param1,ret;
3083 convertPyToVectorPairInt(bigInAbs,param0);
3084 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3085 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3086 PyObject *retPy(PyList_New(ret.size()));
3087 for(std::size_t i=0;i<ret.size();i++)
3089 PyObject *tmp(PyTuple_New(2));
3090 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3091 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3092 PyList_SetItem(retPy,i,tmp);
3099 //== MEDCouplingCMesh
3101 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3104 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3105 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3106 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3107 void setCoords(const DataArrayDouble *coordsX,
3108 const DataArrayDouble *coordsY=0,
3109 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3110 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3112 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3114 return MEDCouplingCMesh::New();
3116 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3118 return MEDCouplingCMesh::New(meshName);
3120 std::string __str__() const throw(INTERP_KERNEL::Exception)
3122 return self->simpleRepr();
3124 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3126 std::ostringstream oss;
3127 self->reprQuickOverview(oss);
3130 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3132 DataArrayDouble *ret=self->getCoordsAt(i);
3140 //== MEDCouplingCMesh End
3142 //== MEDCouplingCurveLinearMesh
3144 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3147 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3148 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3149 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3150 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3152 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3154 return MEDCouplingCurveLinearMesh::New();
3156 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3158 return MEDCouplingCurveLinearMesh::New(meshName);
3160 std::string __str__() const throw(INTERP_KERNEL::Exception)
3162 return self->simpleRepr();
3164 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3166 std::ostringstream oss;
3167 self->reprQuickOverview(oss);
3170 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3172 DataArrayDouble *ret=self->getCoords();
3177 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3179 int szArr,sw,iTypppArr;
3180 std::vector<int> stdvecTyyppArr;
3181 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3182 self->setNodeGridStructure(tmp,tmp+szArr);
3187 //== MEDCouplingCurveLinearMesh End
3189 //== MEDCouplingIMesh
3191 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3194 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3196 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3197 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3198 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3199 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3200 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3201 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3202 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3203 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3204 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3205 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3206 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3211 return MEDCouplingIMesh::New();
3213 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3215 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3216 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3217 const int *nodeStrctPtr(0);
3218 const double *originPtr(0),*dxyzPtr(0);
3220 std::vector<int> bb0;
3221 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3224 std::vector<double> bb,bb2;
3226 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3227 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3229 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3232 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3234 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3237 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3240 std::vector<int> bb0;
3241 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3242 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3245 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3247 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3250 DataArrayDoubleTuple *aa;
3251 std::vector<double> bb;
3253 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3254 self->setOrigin(originPtr,originPtr+nbTuples);
3257 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3259 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3262 DataArrayDoubleTuple *aa;
3263 std::vector<double> bb;
3265 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3266 self->setDXYZ(originPtr,originPtr+nbTuples);
3269 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3271 std::vector< std::pair<int,int> > inp;
3272 convertPyToVectorPairInt(fineLocInCoarse,inp);
3273 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3276 static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize) throw(INTERP_KERNEL::Exception)
3278 std::vector< std::pair<int,int> > inp;
3279 convertPyToVectorPairInt(fineLocInCoarse,inp);
3280 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3283 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3285 std::vector< std::pair<int,int> > inp;
3286 convertPyToVectorPairInt(fineLocInCoarse,inp);
3287 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3290 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize) throw(INTERP_KERNEL::Exception)
3292 std::vector< std::pair<int,int> > inp;
3293 convertPyToVectorPairInt(fineLocInCoarse,inp);
3294 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3297 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize) throw(INTERP_KERNEL::Exception)
3299 std::vector< std::pair<int,int> > inp;
3300 convertPyToVectorPairInt(fineLocInCoarse,inp);
3301 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3304 std::string __str__() const throw(INTERP_KERNEL::Exception)
3306 return self->simpleRepr();
3308 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3310 std::ostringstream oss;
3311 self->reprQuickOverview(oss);
3317 //== MEDCouplingIMesh End
3321 namespace ParaMEDMEM
3323 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3326 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3327 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3328 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3329 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3330 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3331 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3332 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3333 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3334 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3335 std::string getName() const throw(INTERP_KERNEL::Exception);
3336 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3337 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3338 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3339 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3340 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3341 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3342 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3343 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3344 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3345 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3346 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3347 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3348 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3349 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3350 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3351 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3353 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3355 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3358 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3361 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3363 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3366 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3369 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3371 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3372 return convertIntArrToPyList3(ret);
3375 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3378 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3379 PyObject *ret=PyTuple_New(2);
3380 PyObject *ret0Py=ret0?Py_True:Py_False;
3382 PyTuple_SetItem(ret,0,ret0Py);
3383 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3387 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3389 DataArrayInt *ret1=0;
3390 MEDCouplingMesh *ret0=0;
3392 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3393 if (!SWIG_IsOK(res1))
3396 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3397 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3401 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3403 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3404 da2->checkAllocated();
3405 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3407 PyObject *res = PyList_New(2);
3408 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3409 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3413 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3415 DataArrayInt *ret1=0;
3417 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3418 PyObject *res=PyTuple_New(2);
3419 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3421 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3424 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3425 PyTuple_SetItem(res,1,res1);
3430 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3433 int v0; std::vector<int> v1;
3434 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3435 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3438 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3439 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3442 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3443 if (!SWIG_IsOK(res1))
3446 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3447 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3451 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3453 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3454 da2->checkAllocated();
3455 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3459 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3461 std::vector<int> tmp;
3462 self->getCellIdsHavingGaussLocalization(locId,tmp);
3463 DataArrayInt *ret=DataArrayInt::New();
3464 ret->alloc((int)tmp.size(),1);
3465 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3466 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3469 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3471 std::vector<int> inp0;
3472 convertPyToNewIntArr4(code,1,3,inp0);
3473 std::vector<const DataArrayInt *> inp1;
3474 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3475 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3480 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3483 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3484 static MEDCouplingFieldTemplate *New(TypeOfField type);
3485 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3486 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3489 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3491 return MEDCouplingFieldTemplate::New(f);
3494 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3496 return MEDCouplingFieldTemplate::New(type);
3499 std::string __str__() const throw(INTERP_KERNEL::Exception)
3501 return self->simpleRepr();
3504 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3506 std::ostringstream oss;
3507 self->reprQuickOverview(oss);
3513 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3516 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3517 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3518 void setTimeUnit(const std::string& unit);
3519 std::string getTimeUnit() const;
3520 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3521 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3522 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3523 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3524 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3525 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3526 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3527 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3528 MEDCouplingFieldDouble *deepCpy() const;
3529 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3530 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3531 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3532 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3533 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3534 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3535 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3536 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3537 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3538 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3539 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3540 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3541 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3542 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3543 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3544 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3545 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3546 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3547 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3548 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3549 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3550 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3551 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3552 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3553 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3554 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3555 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3556 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3557 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3558 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3559 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3560 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3561 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3562 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3563 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3564 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3565 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3566 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3567 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3568 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3569 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3570 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3571 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3572 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3573 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3574 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3575 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3576 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3577 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3578 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3579 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3580 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3581 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3582 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3583 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3584 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3585 double getMinValue() const throw(INTERP_KERNEL::Exception);
3586 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3587 double norm2() const throw(INTERP_KERNEL::Exception);
3588 double normMax() const throw(INTERP_KERNEL::Exception);
3589 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3590 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3591 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3592 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3593 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3594 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3595 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3596 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3597 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3598 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3599 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3600 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3601 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3602 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3603 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3604 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3605 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3606 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3607 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3608 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3609 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3610 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3612 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3614 return MEDCouplingFieldDouble::New(type,td);
3617 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3619 return MEDCouplingFieldDouble::New(ft,td);
3622 std::string __str__() const throw(INTERP_KERNEL::Exception)
3624 return self->simpleRepr();
3627 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3629 std::ostringstream oss;
3630 self->reprQuickOverview(oss);
3634 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3636 DataArrayDouble *ret=self->getArray();
3642 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3644 std::vector<DataArrayDouble *> arrs=self->getArrays();
3645 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3649 PyObject *ret=PyTuple_New(sz);
3650 for(int i=0;i<sz;i++)
3653 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3655 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3660 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3662 std::vector<const DataArrayDouble *> tmp;
3663 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3665 std::vector<DataArrayDouble *> arrs(sz);
3666 for(int i=0;i<sz;i++)
3667 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3668 self->setArrays(arrs);
3671 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3673 DataArrayDouble *ret=self->getEndArray();
3679 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3683 DataArrayDoubleTuple *aa;
3684 std::vector<double> bb;
3686 const MEDCouplingMesh *mesh=self->getMesh();
3688 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3689 int spaceDim=mesh->getSpaceDimension();
3690 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3691 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3693 int sz=self->getNumberOfComponents();
3694 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3695 self->getValueOn(spaceLoc,res);
3696 return convertDblArrToPyList(res,sz);
3699 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3701 int sz=self->getNumberOfComponents();
3702 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3703 self->getValueOnPos(i,j,k,res);
3704 return convertDblArrToPyList(res,sz);
3707 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3709 const MEDCouplingMesh *mesh(self->getMesh());
3711 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3714 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3715 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3716 mesh->getSpaceDimension(),true,nbPts);
3717 return self->getValueOnMulti(inp,nbPts);
3720 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3724 DataArrayDoubleTuple *aa;
3725 std::vector<double> bb;
3727 const MEDCouplingMesh *mesh=self->getMesh();
3729 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3730 int spaceDim=mesh->getSpaceDimension();
3731 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3732 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3735 int sz=self->getNumberOfComponents();
3736 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3737 self->getValueOn(spaceLoc,time,res);
3738 return convertDblArrToPyList(res,sz);
3741 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3743 if(self->getArray()!=0)
3744 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3748 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3749 self->setArray(arr);
3753 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3756 double tmp0=self->getTime(tmp1,tmp2);
3757 PyObject *res = PyList_New(3);
3758 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3759 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3760 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3764 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3767 double tmp0=self->getStartTime(tmp1,tmp2);
3768 PyObject *res = PyList_New(3);
3769 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3770 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3771 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3775 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3778 double tmp0=self->getEndTime(tmp1,tmp2);
3779 PyObject *res = PyList_New(3);
3780 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3781 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3782 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3785 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3787 int sz=self->getNumberOfComponents();
3788 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3789 self->accumulate(tmp);
3790 return convertDblArrToPyList(tmp,sz);
3792 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3794 int sz=self->getNumberOfComponents();
3795 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3796 self->integral(isWAbs,tmp);
3797 return convertDblArrToPyList(tmp,sz);
3799 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3801 int sz=self->getNumberOfComponents();
3802 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3803 self->getWeightedAverageValue(tmp,isWAbs);
3804 return convertDblArrToPyList(tmp,sz);
3806 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3808 int sz=self->getNumberOfComponents();
3809 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3811 return convertDblArrToPyList(tmp,sz);
3813 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3815 int sz=self->getNumberOfComponents();
3816 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3818 return convertDblArrToPyList(tmp,sz);
3820 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3822 int szArr,sw,iTypppArr;
3823 std::vector<int> stdvecTyyppArr;
3824 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3825 self->renumberCells(tmp,check);
3828 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3830 int szArr,sw,iTypppArr;
3831 std::vector<int> stdvecTyyppArr;
3832 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3833 self->renumberCellsWithoutMesh(tmp,check);
3836 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3838 int szArr,sw,iTypppArr;
3839 std::vector<int> stdvecTyyppArr;
3840 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3841 self->renumberNodes(tmp,eps);
3844 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3846 int szArr,sw,iTypppArr;
3847 std::vector<int> stdvecTyyppArr;
3848 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3849 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3852 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3856 std::vector<int> multiVal;
3857 std::pair<int, std::pair<int,int> > slic;
3858 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3859 const MEDCouplingMesh *mesh=self->getMesh();
3861 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3862 int nbc=mesh->getNumberOfCells();
3863 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3870 std::ostringstream oss;
3871 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3872 throw INTERP_KERNEL::Exception(oss.str().c_str());
3875 return self->buildSubPart(&singleVal,&singleVal+1);
3880 int tmp=nbc+singleVal;
3881 return self->buildSubPart(&tmp,&tmp+1);
3885 std::ostringstream oss;
3886 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3887 throw INTERP_KERNEL::Exception(oss.str().c_str());
3893 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3897 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3902 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3903 daIntTyypp->checkAllocated();
3904 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3907 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3911 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3913 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";
3914 if(PyTuple_Check(li))
3916 Py_ssize_t sz=PyTuple_Size(li);
3918 throw INTERP_KERNEL::Exception(msg);
3919 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3922 std::vector<int> multiVal;
3923 std::pair<int, std::pair<int,int> > slic;
3924 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3925 if(!self->getArray())
3926 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3928 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3929 catch(INTERP_KERNEL::Exception& e)
3930 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3931 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3932 DataArrayDouble *ret0Arr=ret0->getArray();
3934 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3939 std::vector<int> v2(1,singleVal);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3941 ret0->setArray(aarr);
3946 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3947 ret0->setArray(aarr);
3952 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3953 std::vector<int> v2(nbOfComp);
3954 for(int i=0;i<nbOfComp;i++)
3955 v2[i]=slic.first+i*slic.second.second;
3956 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3957 ret0->setArray(aarr);
3961 throw INTERP_KERNEL::Exception(msg);
3966 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3969 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3972 double r1=self->getMaxValue2(tmp);
3973 PyObject *ret=PyTuple_New(2);
3974 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3975 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3979 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3982 double r1=self->getMinValue2(tmp);
3983 PyObject *ret=PyTuple_New(2);
3984 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3985 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3989 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3991 std::vector<int> tmp;
3992 convertPyToNewIntArr3(li,tmp);
3993 return self->keepSelectedComponents(tmp);
3996 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3998 std::vector<int> tmp;
3999 convertPyToNewIntArr3(li,tmp);
4000 self->setSelectedComponents(f,tmp);
4003 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
4006 DataArrayDouble *a,*a2;
4007 DataArrayDoubleTuple *aa,*aa2;
4008 std::vector<double> bb,bb2;
4011 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
4012 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
4013 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4014 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4016 return self->extractSlice3D(orig,vect,eps);
4019 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4021 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
4024 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4026 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
4029 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 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.";
4032 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4035 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4037 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4039 return (*self)-(*other);
4041 throw INTERP_KERNEL::Exception(msg);
4046 DataArrayDoubleTuple *aa;
4047 std::vector<double> bb;
4049 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4054 if(!self->getArray())
4055 throw INTERP_KERNEL::Exception(msg2);
4056 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4057 ret->applyLin(1.,-val);
4058 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4059 ret2->setArray(ret);
4064 if(!self->getArray())
4065 throw INTERP_KERNEL::Exception(msg2);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4067 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4068 ret2->setArray(ret);
4073 if(!self->getArray())
4074 throw INTERP_KERNEL::Exception(msg2);
4075 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4077 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4078 ret2->setArray(ret);
4083 if(!self->getArray())
4084 throw INTERP_KERNEL::Exception(msg2);
4085 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4086 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4087 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4088 ret2->setArray(ret);
4092 { throw INTERP_KERNEL::Exception(msg); }
4096 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4098 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4101 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4103 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4106 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4108 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4111 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4113 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.";
4114 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4117 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4119 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4121 return (*self)/(*other);
4123 throw INTERP_KERNEL::Exception(msg);
4128 DataArrayDoubleTuple *aa;
4129 std::vector<double> bb;
4131 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4137 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4138 if(!self->getArray())
4139 throw INTERP_KERNEL::Exception(msg2);
4140 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4141 ret->applyLin(1./val,0);
4142 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4143 ret2->setArray(ret);
4148 if(!self->getArray())
4149 throw INTERP_KERNEL::Exception(msg2);
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4151 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4152 ret2->setArray(ret);
4157 if(!self->getArray())
4158 throw INTERP_KERNEL::Exception(msg2);
4159 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4161 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4162 ret2->setArray(ret);
4167 if(!self->getArray())
4168 throw INTERP_KERNEL::Exception(msg2);
4169 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4170 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4171 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4172 ret2->setArray(ret);
4176 { throw INTERP_KERNEL::Exception(msg); }
4180 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4182 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4185 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4187 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.";
4188 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4191 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4193 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4195 return (*self)^(*other);
4197 throw INTERP_KERNEL::Exception(msg);
4202 DataArrayDoubleTuple *aa;
4203 std::vector<double> bb;
4205 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4210 if(!self->getArray())
4211 throw INTERP_KERNEL::Exception(msg2);
4212 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4214 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4215 ret2->setArray(ret);
4220 if(!self->getArray())
4221 throw INTERP_KERNEL::Exception(msg2);
4222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4223 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4224 ret2->setArray(ret);
4229 if(!self->getArray())
4230 throw INTERP_KERNEL::Exception(msg2);
4231 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4232 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4233 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4234 ret2->setArray(ret);
4239 if(!self->getArray())
4240 throw INTERP_KERNEL::Exception(msg2);
4241 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4242 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4243 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4244 ret2->setArray(ret);
4248 { throw INTERP_KERNEL::Exception(msg); }
4252 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4254 return self->negate();
4257 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4259 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.";
4260 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4263 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4265 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4269 Py_XINCREF(trueSelf);
4273 throw INTERP_KERNEL::Exception(msg);
4278 DataArrayDoubleTuple *aa;
4279 std::vector<double> bb;
4281 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4286 if(!self->getArray())
4287 throw INTERP_KERNEL::Exception(msg2);
4288 self->getArray()->applyLin(1.,val);
4289 Py_XINCREF(trueSelf);
4294 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4297 Py_XINCREF(trueSelf);
4302 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4303 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4304 ret2->setArray(aaa);
4306 Py_XINCREF(trueSelf);
4311 if(!self->getArray())
4312 throw INTERP_KERNEL::Exception(msg2);
4313 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4314 self->getArray()->addEqual(aaa);
4315 Py_XINCREF(trueSelf);
4319 { throw INTERP_KERNEL::Exception(msg); }
4323 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4325 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.";
4326 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4329 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4331 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4335 Py_XINCREF(trueSelf);
4339 throw INTERP_KERNEL::Exception(msg);
4344 DataArrayDoubleTuple *aa;
4345 std::vector<double> bb;
4347 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4352 if(!self->getArray())
4353 throw INTERP_KERNEL::Exception(msg2);
4354 self->getArray()->applyLin(1.,-val);
4355 Py_XINCREF(trueSelf);
4360 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4363 Py_XINCREF(trueSelf);
4368 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4369 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4370 ret2->setArray(aaa);
4372 Py_XINCREF(trueSelf);
4377 if(!self->getArray())
4378 throw INTERP_KERNEL::Exception(msg2);
4379 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4380 self->getArray()->substractEqual(aaa);
4381 Py_XINCREF(trueSelf);
4385 { throw INTERP_KERNEL::Exception(msg); }
4389 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4391 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.";
4392 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4395 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4397 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4401 Py_XINCREF(trueSelf);
4405 throw INTERP_KERNEL::Exception(msg);
4410 DataArrayDoubleTuple *aa;
4411 std::vector<double> bb;
4413 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4418 if(!self->getArray())
4419 throw INTERP_KERNEL::Exception(msg2);
4420 self->getArray()->applyLin(val,0);
4421 Py_XINCREF(trueSelf);
4426 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4429 Py_XINCREF(trueSelf);
4434 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4435 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4436 ret2->setArray(aaa);
4438 Py_XINCREF(trueSelf);
4443 if(!self->getArray())
4444 throw INTERP_KERNEL::Exception(msg2);
4445 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4446 self->getArray()->multiplyEqual(aaa);
4447 Py_XINCREF(trueSelf);
4451 { throw INTERP_KERNEL::Exception(msg); }
4455 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4457 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.";
4458 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4461 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4463 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4467 Py_XINCREF(trueSelf);
4471 throw INTERP_KERNEL::Exception(msg);
4476 DataArrayDoubleTuple *aa;
4477 std::vector<double> bb;
4479 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4485 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4486 if(!self->getArray())
4487 throw INTERP_KERNEL::Exception(msg2);
4488 self->getArray()->applyLin(1./val,0);
4489 Py_XINCREF(trueSelf);
4494 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4497 Py_XINCREF(trueSelf);
4502 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4503 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4504 ret2->setArray(aaa);
4506 Py_XINCREF(trueSelf);
4511 if(!self->getArray())
4512 throw INTERP_KERNEL::Exception(msg2);
4513 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4514 self->getArray()->divideEqual(aaa);
4515 Py_XINCREF(trueSelf);
4519 { throw INTERP_KERNEL::Exception(msg); }
4523 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4525 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.";
4526 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4529 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4531 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4535 Py_XINCREF(trueSelf);
4539 throw INTERP_KERNEL::Exception(msg);
4544 DataArrayDoubleTuple *aa;
4545 std::vector<double> bb;
4547 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4552 if(!self->getArray())
4553 throw INTERP_KERNEL::Exception(msg2);
4554 self->getArray()->applyPow(val);
4555 Py_XINCREF(trueSelf);
4560 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4563 Py_XINCREF(trueSelf);
4568 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4569 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4570 ret2->setArray(aaa);
4572 Py_XINCREF(trueSelf);
4577 if(!self->getArray())
4578 throw INTERP_KERNEL::Exception(msg2);
4579 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4580 self->getArray()->powEqual(aaa);
4581 Py_XINCREF(trueSelf);
4585 { throw INTERP_KERNEL::Exception(msg); }
4589 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4591 std::vector<const MEDCouplingFieldDouble *> tmp;
4592 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4593 return MEDCouplingFieldDouble::MergeFields(tmp);
4596 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4598 std::vector<const MEDCouplingFieldDouble *> tmp;
4599 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4600 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4605 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4608 int getNumberOfFields() const;
4609 MEDCouplingMultiFields *deepCpy() const;
4610 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4611 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4612 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4613 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4614 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4617 std::string __str__() const throw(INTERP_KERNEL::Exception)
4619 return self->simpleRepr();
4621 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4623 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4624 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4626 std::vector<MEDCouplingFieldDouble *> fs(sz);
4627 for(int i=0;i<sz;i++)
4628 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4629 return MEDCouplingMultiFields::New(fs);
4631 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4633 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4634 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4636 std::vector<MEDCouplingFieldDouble *> fs(sz);
4637 for(int i=0;i<sz;i++)
4638 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4639 return MEDCouplingMultiFields::New(fs);
4641 PyObject *getFields() const
4643 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4644 int sz=fields.size();
4645 PyObject *res = PyList_New(sz);
4646 for(int i=0;i<sz;i++)
4650 fields[i]->incrRef();
4651 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4655 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4660 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4662 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4666 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4669 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4671 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4673 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4675 PyObject *res = PyList_New(sz);
4676 for(int i=0;i<sz;i++)
4681 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4685 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4690 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4692 std::vector<int> refs;
4693 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4695 PyObject *res = PyList_New(sz);
4696 for(int i=0;i<sz;i++)
4701 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4705 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4709 PyObject *ret=PyTuple_New(2);
4710 PyTuple_SetItem(ret,0,res);
4711 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4714 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4716 std::vector<DataArrayDouble *> ms=self->getArrays();
4718 PyObject *res = PyList_New(sz);
4719 for(int i=0;i<sz;i++)
4724 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4728 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4733 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4735 std::vector< std::vector<int> > refs;
4736 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4738 PyObject *res = PyList_New(sz);
4739 PyObject *res2 = PyList_New(sz);
4740 for(int i=0;i<sz;i++)
4745 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4749 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4751 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4754 PyObject *ret=PyTuple_New(2);
4755 PyTuple_SetItem(ret,0,res);
4756 PyTuple_SetItem(ret,1,res2);
4762 class MEDCouplingDefinitionTime
4765 MEDCouplingDefinitionTime();
4766 void assign(const MEDCouplingDefinitionTime& other);
4767 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4768 double getTimeResolution() const;
4769 std::vector<double> getHotSpotsTime() const;
4772 std::string __str__() const throw(INTERP_KERNEL::Exception)
4774 std::ostringstream oss;
4775 self->appendRepr(oss);
4779 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4781 int meshId,arrId,arrIdInField,fieldId;
4782 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4783 PyObject *res=PyList_New(4);
4784 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4785 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4786 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4787 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4791 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4793 int meshId,arrId,arrIdInField,fieldId;
4794 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4795 PyObject *res=PyList_New(4);
4796 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4797 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4798 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4799 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4805 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4808 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4809 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4813 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4815 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4816 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4818 std::vector<MEDCouplingFieldDouble *> fs(sz);
4819 for(int i=0;i<sz;i++)
4820 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4821 return MEDCouplingFieldOverTime::New(fs);
4823 std::string __str__() const throw(INTERP_KERNEL::Exception)
4825 return self->simpleRepr();
4827 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4829 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4830 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4832 std::vector<MEDCouplingFieldDouble *> fs(sz);
4833 for(int i=0;i<sz;i++)
4834 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4835 return MEDCouplingFieldOverTime::New(fs);
4840 class MEDCouplingCartesianAMRMesh;
4842 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
4845 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4846 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4847 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4850 MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception)
4852 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4860 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
4863 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4864 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4865 std::vector<int> computeCellGridSt() const throw(INTERP_KERNEL::Exception);
4868 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4870 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4871 return convertFromVectorPairInt(ret);
4874 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4876 std::vector< std::pair<int,int> > inp;
4877 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4878 self->addPatch(inp,factors);
4881 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4883 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4885 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
4886 if(patchId==mesh->getNumberOfPatches())
4888 std::ostringstream oss;
4889 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4890 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4893 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4899 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4901 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4903 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4904 mesh->removePatch(patchId);
4907 int __len__() const throw(INTERP_KERNEL::Exception)
4909 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4911 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4912 return mesh->getNumberOfPatches();
4917 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
4921 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
4924 virtual MEDCouplingCartesianAMRMeshGen *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception);
4925 int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
4926 int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
4927 std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
4928 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4929 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4930 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4931 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4932 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4933 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
4934 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4935 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4936 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4937 virtual void detachFromFather() throw(INTERP_KERNEL::Exception);
4939 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4940 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception);
4941 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4942 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception);
4943 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4944 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4945 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception);
4946 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4947 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4948 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4949 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps) throw(INTERP_KERNEL::Exception);
4950 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4951 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4952 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4953 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4954 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
4955 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4956 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4957 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4958 std::string buildPythonDumpOfThis() const throw(INTERP_KERNEL::Exception);
4961 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4963 std::vector< std::pair<int,int> > inp;
4964 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4965 self->addPatch(inp,factors);
4968 PyObject *getPatches() const throw(INTERP_KERNEL::Exception)
4970 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
4972 PyObject *ret = PyList_New(sz);
4973 for(int i=0;i<sz;i++)
4975 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
4978 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
4983 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
4985 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
4986 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
4992 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
4994 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
4995 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5001 virtual PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception)
5003 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5005 PyObject *ret = PyList_New(sz);
5006 for(int i=0;i<sz;i++)
5007 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5011 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
5013 std::vector<const DataArrayDouble *> inp;
5014 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",inp);
5015 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5018 virtual MEDCouplingCartesianAMRMeshGen *getFather() const throw(INTERP_KERNEL::Exception)
5020 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5026 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception)
5028 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5034 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
5036 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5042 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
5044 const MEDCouplingIMesh *ret(self->getImageMesh());
5047 return const_cast<MEDCouplingIMesh *>(ret);
5050 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
5052 if(patchId==self->getNumberOfPatches())
5054 std::ostringstream oss;
5055 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5056 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5059 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5065 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const throw(INTERP_KERNEL::Exception)
5067 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5068 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5069 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5072 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5074 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5075 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5076 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5079 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
5081 self->removePatch(patchId);
5084 int __len__() const throw(INTERP_KERNEL::Exception)
5086 return self->getNumberOfPatches();
5091 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5095 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5100 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5102 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5103 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5104 const int *nodeStrctPtr(0);
5105 const double *originPtr(0),*dxyzPtr(0);
5107 std::vector<int> bb0;
5108 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
5111 std::vector<double> bb,bb2;
5113 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5114 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5116 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5119 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps) throw(INTERP_KERNEL::Exception)
5121 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5122 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5123 std::vector< std::vector<int> > inp2;
5124 convertPyToVectorOfVectorOfInt(factors,inp2);
5125 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5128 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5130 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
5135 class MEDCouplingDataForGodFather : public RefCountObject
5138 virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
5139 virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
5140 virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
5141 virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
5142 virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
5143 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) throw(INTERP_KERNEL::Exception);
5144 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level) throw(INTERP_KERNEL::Exception);
5145 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level) throw(INTERP_KERNEL::Exception);
5146 virtual void alloc() throw(INTERP_KERNEL::Exception);
5147 virtual void dealloc() throw(INTERP_KERNEL::Exception);
5150 MEDCouplingCartesianAMRMesh *getMyGodFather() throw(INTERP_KERNEL::Exception)
5152 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5160 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5163 int getNumberOfLevels() const throw(INTERP_KERNEL::Exception);
5164 MEDCouplingAMRAttribute *deepCpy() const throw(INTERP_KERNEL::Exception);
5165 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const throw(INTERP_KERNEL::Exception);
5166 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5167 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5168 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5169 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception);
5172 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5174 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5175 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5176 MEDCouplingAMRAttribute *ret(0);
5179 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5180 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5182 catch(INTERP_KERNEL::Exception&)
5184 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5185 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5190 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5192 return ParaMEDMEM_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5195 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception)
5197 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5198 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5204 void spillInfoOnComponents(PyObject *compNames) throw(INTERP_KERNEL::Exception)
5206 std::vector< std::vector<std::string> > compNamesCpp;
5207 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5208 self->spillInfoOnComponents(compNamesCpp);
5211 void spillNatures(PyObject *nfs) throw(INTERP_KERNEL::Exception)
5213 std::vector<int> inp0;
5214 if(!fillIntVector(nfs,inp0))
5215 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5216 std::size_t sz(inp0.size());
5217 std::vector<NatureOfField> inp00(sz);
5218 for(std::size_t i=0;i<sz;i++)
5219 inp00[i]=(NatureOfField)inp0[i];
5220 self->spillNatures(inp00);
5223 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception)
5225 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5226 int sz((int)ret.size());
5227 PyObject *retPy(PyList_New(sz));
5228 for(int i=0;i<sz;i++)
5229 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5235 class DenseMatrix : public RefCountObject, public TimeLabel
5238 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5239 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5240 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
5241 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
5243 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
5244 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
5245 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
5246 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
5247 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5248 void transpose() throw(INTERP_KERNEL::Exception);
5250 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
5251 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
5252 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
5255 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5257 return DenseMatrix::New(nbRows,nbCols);
5260 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5262 return DenseMatrix::New(array,nbRows,nbCols);
5265 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
5268 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5269 PyObject *ret=PyTuple_New(2);
5270 PyObject *ret0Py=ret0?Py_True:Py_False;
5272 PyTuple_SetItem(ret,0,ret0Py);
5273 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5277 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
5279 DataArrayDouble *ret(self->getData());
5285 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5287 return ParaMEDMEM::DenseMatrix::Add(self,other);
5290 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5292 return ParaMEDMEM::DenseMatrix::Substract(self,other);
5295 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5297 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5300 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
5302 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5305 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5307 self->addEqual(other);
5308 Py_XINCREF(trueSelf);
5312 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5314 self->substractEqual(other);
5315 Py_XINCREF(trueSelf);
5319 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5321 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5331 __filename=os.environ.get('PYTHONSTARTUP')
5332 if __filename and os.path.isfile(__filename):
5333 execfile(__filename)