1 // Copyright (C) 2017-2019 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 (EDF R&D)
21 #ifdef WITH_DOCSTRINGS
22 %include MEDCoupling_doc.i
29 #include "MEDCouplingMemArray.hxx"
30 #include "MEDCouplingUMesh.hxx"
31 #include "MEDCouplingMappedExtrudedMesh.hxx"
32 #include "MEDCouplingCMesh.hxx"
33 #include "MEDCouplingIMesh.hxx"
34 #include "MEDCouplingMap.txx"
35 #include "MEDCouplingCurveLinearMesh.hxx"
36 #include "MEDCoupling1GTUMesh.hxx"
37 #include "MEDCouplingField.hxx"
38 #include "MEDCouplingFieldDouble.hxx"
39 #include "MEDCouplingFieldInt.hxx"
40 #include "MEDCouplingFieldFloat.hxx"
41 #include "MEDCouplingFieldTemplate.hxx"
42 #include "MEDCouplingGaussLocalization.hxx"
44 #include "MEDCouplingMultiFields.hxx"
45 #include "MEDCouplingFieldOverTime.hxx"
46 #include "MEDCouplingDefinitionTime.hxx"
47 #include "MEDCouplingFieldDiscretization.hxx"
48 #include "MEDCouplingCartesianAMRMesh.hxx"
49 #include "MEDCouplingAMRAttribute.hxx"
50 #include "MEDCouplingMatrix.hxx"
51 #include "MEDCouplingPartDefinition.hxx"
52 #include "MEDCouplingSkyLineArray.hxx"
53 #include "MEDCouplingTypemaps.i"
55 #include "InterpKernelAutoPtr.hxx"
56 #include "BoxSplittingOptions.hxx"
58 using namespace MEDCoupling;
59 using namespace INTERP_KERNEL;
63 %template(ivec) std::vector<int>;
64 %template(dvec) std::vector<double>;
65 %template(svec) std::vector<std::string>;
68 %typemap(out) MEDCoupling::MEDCouplingMesh*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingMesh*
75 $result=convertMesh($1,$owner);
80 %typemap(out) MEDCoupling::MEDCouplingPointSet*
82 $result=convertMesh($1,$owner);
85 %typemap(out) MEDCouplingPointSet*
87 $result=convertMesh($1,$owner);
92 %typemap(out) MEDCouplingCartesianAMRPatchGen*
94 $result=convertCartesianAMRPatch($1,$owner);
99 %typemap(out) MEDCouplingCartesianAMRMeshGen*
101 $result=convertCartesianAMRMesh($1,$owner);
106 %typemap(out) MEDCouplingDataForGodFather*
108 $result=convertDataForGodFather($1,$owner);
113 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
115 $result=convertMesh($1,$owner);
118 %typemap(out) MEDCoupling1GTUMesh*
120 $result=convertMesh($1,$owner);
125 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
127 $result=convertMesh($1,$owner);
130 %typemap(out) MEDCouplingStructuredMesh*
132 $result=convertMesh($1,$owner);
137 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
139 $result=convertFieldDiscretization($1,$owner);
142 %typemap(out) MEDCouplingFieldDiscretization*
144 $result=convertFieldDiscretization($1,$owner);
149 %typemap(out) MEDCoupling::MEDCouplingField*
151 $result=convertField($1,$owner);
154 %typemap(out) MEDCouplingField*
156 $result=convertField($1,$owner);
161 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
163 $result=convertMultiFields($1,$owner);
166 %typemap(out) MEDCouplingMultiFields*
168 $result=convertMultiFields($1,$owner);
173 %typemap(out) MEDCoupling::PartDefinition*
175 $result=convertPartDefinition($1,$owner);
178 %typemap(out) PartDefinition*
180 $result=convertPartDefinition($1,$owner);
185 %init %{ import_array(); %}
188 %init %{ initializeMe(); %}
190 %feature("autodoc", "1");
191 %feature("docstring");
193 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
194 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
195 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
196 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
197 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
198 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
199 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
200 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
201 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
202 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
203 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
204 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
205 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
206 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
207 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
208 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
209 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
210 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
211 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
212 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
213 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
214 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
215 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
216 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
217 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
218 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
251 %newobject MEDCoupling::MEDCouplingFieldInt::New;
252 %newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField;
253 %newobject MEDCoupling::MEDCouplingFieldInt::getArray;
254 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
255 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
256 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
257 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
258 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
259 %newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
260 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
261 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
262 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
263 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
264 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
265 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
266 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
267 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
268 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
269 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
270 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
271 %newobject MEDCoupling::MEDCouplingMesh::clone;
272 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
273 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
274 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
275 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
276 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
277 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
278 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
279 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
280 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
281 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
282 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
283 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
284 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
285 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
286 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
287 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
288 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
289 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
290 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
291 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
292 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
293 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
294 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
295 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
296 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
297 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
298 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
299 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
300 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
301 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
302 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
303 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
304 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
305 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
306 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
307 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
308 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
309 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
310 %newobject MEDCoupling::MEDCouplingUMesh::New;
311 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
312 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
313 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
314 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
315 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
316 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
317 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
318 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
319 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
320 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
321 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
322 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
323 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
324 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
325 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
326 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
327 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
328 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
329 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
330 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
331 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
332 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
333 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
334 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
335 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
336 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
337 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
338 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
339 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
340 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
341 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
342 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
343 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
344 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
345 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
346 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
347 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
348 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
349 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
350 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
351 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
352 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
353 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
354 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
355 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
356 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
357 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
358 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
359 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
360 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
361 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
362 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
363 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
364 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
365 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
366 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
367 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
368 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
369 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
370 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
371 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
372 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
373 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
374 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
375 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
376 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
377 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
378 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
379 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
380 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
381 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
382 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
383 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
384 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
385 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
386 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
387 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
388 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
389 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
390 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
391 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
392 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
393 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
394 %newobject MEDCoupling::MEDCouplingCMesh::New;
395 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
396 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
397 %newobject MEDCoupling::MEDCouplingIMesh::New;
398 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
399 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
400 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
401 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
402 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
403 %newobject MEDCoupling::MEDCouplingMultiFields::New;
404 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
405 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
406 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
407 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
408 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
409 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
410 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
411 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
412 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
413 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
414 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
415 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
416 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
417 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
418 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
419 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
420 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
421 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
422 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
423 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
424 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
425 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
426 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
427 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
428 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
429 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
430 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
431 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
432 %newobject MEDCoupling::DenseMatrix::New;
433 %newobject MEDCoupling::DenseMatrix::deepCopy;
434 %newobject MEDCoupling::DenseMatrix::shallowCpy;
435 %newobject MEDCoupling::DenseMatrix::getData;
436 %newobject MEDCoupling::DenseMatrix::matVecMult;
437 %newobject MEDCoupling::DenseMatrix::MatVecMult;
438 %newobject MEDCoupling::DenseMatrix::__add__;
439 %newobject MEDCoupling::DenseMatrix::__sub__;
440 %newobject MEDCoupling::DenseMatrix::__mul__;
441 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
442 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
443 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
444 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
445 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
446 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
448 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
449 %feature("unref") MEDCouplingMesh "$this->decrRef();"
450 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
451 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
452 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
453 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
454 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
455 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
456 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
457 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
458 %feature("unref") MEDCouplingField "$this->decrRef();"
459 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
460 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
461 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
462 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
463 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
464 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
465 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
466 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
467 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
468 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
469 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
470 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
471 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
472 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
473 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
474 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
475 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
476 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
477 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
478 %feature("unref") DenseMatrix "$this->decrRef();"
479 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
481 %rename(assign) *::operator=;
482 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
483 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
484 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
485 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
489 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
490 // on the Python side. Must be put BEFORE the %rename clause:
491 %exceptionclass INTERP_KERNEL::Exception;
492 %rename (InterpKernelException) INTERP_KERNEL::Exception;
494 %include "MEDCouplingRefCountObject.i"
495 %include "MEDCouplingMemArray.i"
499 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
500 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
501 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
502 SWIGTITraits<int>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt;
503 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
504 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
505 SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
509 namespace INTERP_KERNEL
512 * \class BoxSplittingOptions
513 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
515 class BoxSplittingOptions
518 BoxSplittingOptions();
520 double getEfficiencyGoal() const;
521 void setEfficiencyGoal(double efficiency);
522 double getEfficiencyThreshold() const;
523 void setEfficiencyThreshold(double efficiencyThreshold);
524 int getMinimumPatchLength() const;
525 void setMinimumPatchLength(int minPatchLength);
526 int getMaximumPatchLength() const;
527 void setMaximumPatchLength(int maxPatchLength);
528 int getMaximumNbOfCellsInPatch() const;
529 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
530 void copyOptions(const BoxSplittingOptions & other);
531 std::string printOptions() const;
534 std::string __str__() const
536 return self->printOptions();
542 namespace MEDCoupling
558 CONST_ON_TIME_INTERVAL = 7
559 } TypeOfTimeDiscretization;
567 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
568 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
570 } MEDCouplingMeshType;
573 class DataArrayDouble;
574 class MEDCouplingUMesh;
575 class MEDCouplingCMesh;
576 class MEDCouplingFieldDouble;
578 %extend RefCountObject
580 std::string getHiddenCppPointer() const
582 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
587 %extend MEDCouplingGaussLocalization
589 std::string __str__() const
591 return self->getStringRepr();
594 std::string __repr__() const
596 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
597 oss << self->getStringRepr();
604 class MEDCouplingMesh : public RefCountObject, public TimeLabel
607 void setName(const std::string& name);
608 std::string getName() const;
609 void setDescription(const std::string& descr);
610 std::string getDescription() const;
611 void setTime(double val, int iteration, int order);
612 void setTimeUnit(const std::string& unit);
613 std::string getTimeUnit() const;
614 virtual MEDCouplingMeshType getType() const;
615 bool isStructured() const;
616 virtual MEDCouplingMesh *deepCopy() const;
617 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
618 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
619 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
620 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
621 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
622 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
623 virtual void checkConsistencyLight() const;
624 virtual void checkConsistency(double eps=1e-12) const;
625 virtual int getNumberOfCells() const;
626 virtual int getNumberOfNodes() const;
627 virtual int getSpaceDimension() const;
628 virtual int getMeshDimension() const;
629 virtual DataArrayDouble *getCoordinatesAndOwner() const;
630 virtual DataArrayDouble *computeCellCenterOfMass() const;
631 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
632 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
633 virtual DataArrayInt *computeNbOfNodesPerCell() const;
634 virtual DataArrayInt *computeNbOfFacesPerCell() const;
635 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
636 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
637 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
638 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
639 virtual std::string simpleRepr() const;
640 virtual std::string advancedRepr() const;
641 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
642 virtual std::string getVTKFileExtension() const;
643 std::string getVTKFileNameOf(const std::string& fileName) const;
645 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
646 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
647 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
648 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
649 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
650 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
651 virtual MEDCouplingUMesh *buildUnstructured() const;
652 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
653 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
654 virtual DataArrayInt *simplexize(int policy);
655 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
656 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
657 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
658 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
659 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
660 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
661 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
662 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
665 std::string __str__() const
667 return self->simpleRepr();
673 double tmp0=self->getTime(tmp1,tmp2);
674 PyObject *res = PyList_New(3);
675 PyList_SetItem(res,0,SWIG_From_double(tmp0));
676 PyList_SetItem(res,1,SWIG_From_int(tmp1));
677 PyList_SetItem(res,2,SWIG_From_int(tmp2));
681 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
683 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
684 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
690 int getCellContainingPoint(PyObject *p, double eps) const
694 DataArrayDoubleTuple *aa;
695 std::vector<double> bb;
697 int spaceDim=self->getSpaceDimension();
698 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
699 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
700 return self->getCellContainingPoint(pos,eps);
703 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
707 DataArrayDoubleTuple *aa;
708 std::vector<double> bb;
710 int spaceDim=self->getSpaceDimension();
711 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
712 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
713 MCAuto<DataArrayInt> elts,eltsIndex;
714 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
715 PyObject *ret=PyTuple_New(2);
716 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
721 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
725 DataArrayDoubleTuple *aa;
726 std::vector<double> bb;
728 int spaceDim=self->getSpaceDimension();
729 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
730 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
731 MCAuto<DataArrayInt> elts,eltsIndex;
732 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
733 PyObject *ret=PyTuple_New(2);
734 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
735 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
739 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
741 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
742 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
745 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
747 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
748 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
751 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
755 DataArrayDoubleTuple *aa;
756 std::vector<double> bb;
758 int spaceDim=self->getSpaceDimension();
759 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
760 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
761 std::vector<int> elts;
762 self->getCellsContainingPoint(pos,eps,elts);
763 DataArrayInt *ret=DataArrayInt::New();
764 ret->alloc((int)elts.size(),1);
765 std::copy(elts.begin(),elts.end(),ret->getPointer());
766 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
769 virtual PyObject *getReverseNodalConnectivity() const
771 MCAuto<DataArrayInt> d0=DataArrayInt::New();
772 MCAuto<DataArrayInt> d1=DataArrayInt::New();
773 self->getReverseNodalConnectivity(d0,d1);
774 PyObject *ret=PyTuple_New(2);
775 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
776 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
780 void renumberCells(PyObject *li, bool check=true)
783 int v0; std::vector<int> v1;
784 const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
785 self->renumberCells(ids,check);
788 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
790 DataArrayInt *cellCor, *nodeCor;
791 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
792 PyObject *res = PyList_New(2);
793 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
794 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
798 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
800 DataArrayInt *cellCor=0,*nodeCor=0;
801 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
802 PyObject *res = PyList_New(2);
803 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
804 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
808 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
810 DataArrayInt *cellCor=0;
811 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
815 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
818 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
819 if (!SWIG_IsOK(res1))
822 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
823 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
827 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
829 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
830 da2->checkAllocated();
831 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
834 PyObject *getNodeIdsOfCell(int cellId) const
836 std::vector<int> conn;
837 self->getNodeIdsOfCell(cellId,conn);
838 return convertIntArrToPyList2(conn);
841 PyObject *getCoordinatesOfNode(int nodeId) const
843 std::vector<double> coo;
844 self->getCoordinatesOfNode(nodeId,coo);
845 return convertDblArrToPyList2(coo);
848 void scale(PyObject *point, double factor)
852 DataArrayDoubleTuple *aa;
853 std::vector<double> bb;
855 int spaceDim=self->getSpaceDimension();
856 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
857 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
858 self->scale(pointPtr,factor);
861 PyObject *getBoundingBox() const
863 int spaceDim=self->getSpaceDimension();
864 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
865 self->getBoundingBox(tmp);
866 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
870 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
873 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
874 PyObject *ret=PyTuple_New(2);
875 PyObject *ret0Py=ret0?Py_True:Py_False;
877 PyTuple_SetItem(ret,0,ret0Py);
878 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
882 PyObject *buildPart(PyObject *li) const
884 int szArr,sw,iTypppArr;
885 std::vector<int> stdvecTyyppArr;
886 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
887 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
888 if(sw==3)//DataArrayInt
890 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
891 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
892 std::string name=argpt->getName();
894 ret->setName(name.c_str());
896 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
899 PyObject *buildPartAndReduceNodes(PyObject *li) const
901 int szArr,sw,iTypppArr;
902 std::vector<int> stdvecTyyppArr;
904 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
905 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
906 if(sw==3)//DataArrayInt
908 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
909 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
910 std::string name=argpt->getName();
912 ret->setName(name.c_str());
915 PyObject *res = PyList_New(2);
916 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
917 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
918 PyList_SetItem(res,0,obj0);
919 PyList_SetItem(res,1,obj1);
923 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const
927 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
928 PyObject *res = PyTuple_New(2);
929 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
932 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
934 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
935 PyTuple_SetItem(res,0,obj0);
936 PyTuple_SetItem(res,1,obj1);
940 PyObject *getDistributionOfTypes() const
942 std::vector<int> vals=self->getDistributionOfTypes();
944 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
945 PyObject *ret=PyList_New((int)vals.size()/3);
946 for(int j=0;j<(int)vals.size()/3;j++)
948 PyObject *ret1=PyList_New(3);
949 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
950 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
951 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
952 PyList_SetItem(ret,j,ret1);
957 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
959 std::vector<int> code;
960 std::vector<const DataArrayInt *> idsPerType;
961 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li2,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",idsPerType);
962 convertPyToNewIntArr4(li,1,3,code);
963 return self->checkTypeConsistencyAndContig(code,idsPerType);
966 PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const
968 std::vector<int> code;
969 std::vector<DataArrayInt *> idsInPflPerType;
970 std::vector<DataArrayInt *> idsPerType;
971 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
972 PyObject *ret=PyTuple_New(3);
975 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
976 PyObject *ret0=PyList_New((int)code.size()/3);
977 for(int j=0;j<(int)code.size()/3;j++)
979 PyObject *ret00=PyList_New(3);
980 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
981 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
982 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
983 PyList_SetItem(ret0,j,ret00);
985 PyTuple_SetItem(ret,0,ret0);
987 PyObject *ret1=PyList_New(idsInPflPerType.size());
988 for(std::size_t j=0;j<idsInPflPerType.size();j++)
989 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
990 PyTuple_SetItem(ret,1,ret1);
991 int n=idsPerType.size();
992 PyObject *ret2=PyList_New(n);
994 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
995 PyTuple_SetItem(ret,2,ret2);
999 void translate(PyObject *vector)
1003 DataArrayDoubleTuple *aa;
1004 std::vector<double> bb;
1006 int spaceDim=self->getSpaceDimension();
1007 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1008 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1009 self->translate(vectorPtr);
1012 void rotate(PyObject *center, double alpha)
1014 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1017 DataArrayDoubleTuple *aa;
1018 std::vector<double> bb;
1020 int spaceDim=self->getSpaceDimension();
1021 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1022 self->rotate(centerPtr,0,alpha);
1025 void rotate(PyObject *center, PyObject *vector, double alpha)
1027 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1029 DataArrayDouble *a,*a2;
1030 DataArrayDoubleTuple *aa,*aa2;
1031 std::vector<double> bb,bb2;
1033 int spaceDim=self->getSpaceDimension();
1034 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1035 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
1036 self->rotate(centerPtr,vectorPtr,alpha);
1039 PyObject *getAllGeoTypes() const
1041 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1042 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1043 PyObject *res=PyList_New(result.size());
1044 for(int i=0;iL!=result.end(); i++, iL++)
1045 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1049 virtual PyObject *getTinySerializationInformation() const
1051 std::vector<double> a0;
1052 std::vector<int> a1;
1053 std::vector<std::string> a2;
1054 self->getTinySerializationInformation(a0,a1,a2);
1055 PyObject *ret(PyTuple_New(3));
1056 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1057 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1059 PyObject *ret2(PyList_New(sz));
1061 for(int i=0;i<sz;i++)
1062 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1064 PyTuple_SetItem(ret,2,ret2);
1068 virtual PyObject *serialize() const
1070 DataArrayInt *a0Tmp(0);
1071 DataArrayDouble *a1Tmp(0);
1072 self->serialize(a0Tmp,a1Tmp);
1073 PyObject *ret(PyTuple_New(2));
1074 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1075 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1079 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2) const
1081 std::vector<std::string> littleStrings;
1082 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1085 PyObject *__getstate__() const
1087 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1088 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1089 PyObject *ret(PyTuple_New(2));
1090 PyTuple_SetItem(ret,0,ret0);
1091 PyTuple_SetItem(ret,1,ret1);
1095 void __setstate__(PyObject *inp)
1097 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1098 if(!PyTuple_Check(inp))
1099 throw INTERP_KERNEL::Exception(MSG);
1100 int sz(PyTuple_Size(inp));
1102 throw INTERP_KERNEL::Exception(MSG);
1103 PyObject *elt0(PyTuple_GetItem(inp,0));
1104 PyObject *elt1(PyTuple_GetItem(inp,1));
1105 std::vector<double> a0;
1106 std::vector<int> a1;
1107 std::vector<std::string> a2;
1108 DataArrayInt *b0(0);
1109 DataArrayDouble *b1(0);
1111 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1112 throw INTERP_KERNEL::Exception(MSG);
1113 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1115 fillArrayWithPyListDbl3(a0py,tmp,a0);
1116 convertPyToNewIntArr3(a1py,a1);
1117 fillStringVector(a2py,a2);
1120 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1121 throw INTERP_KERNEL::Exception(MSG);
1122 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1124 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
1125 if(!SWIG_IsOK(status))
1126 throw INTERP_KERNEL::Exception(MSG);
1127 b0=reinterpret_cast<DataArrayInt *>(argp);
1128 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1129 if(!SWIG_IsOK(status))
1130 throw INTERP_KERNEL::Exception(MSG);
1131 b1=reinterpret_cast<DataArrayDouble *>(argp);
1133 // useless here to call resizeForUnserialization because arrays are well resized.
1134 self->unserialization(a0,a1,b0,b1,a2);
1137 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1139 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1140 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1141 return MEDCouplingMesh::MergeMeshes(tmp);
1147 //== MEDCouplingMesh End
1149 %include "NormalizedGeometricTypes"
1150 %include "MEDCouplingNatureOfFieldEnum"
1152 namespace MEDCoupling
1154 class MEDCouplingNatureOfField
1157 static const char *GetRepr(NatureOfField nat);
1158 static std::string GetReprNoThrow(NatureOfField nat);
1159 static std::string GetAllPossibilitiesStr();
1163 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1164 // include "MEDCouplingTimeDiscretization.i"
1166 namespace MEDCoupling
1168 class MEDCouplingGaussLocalization
1171 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1172 const std::vector<double>& gsCoo, const std::vector<double>& w);
1173 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1174 INTERP_KERNEL::NormalizedCellType getType() const;
1175 void setType(INTERP_KERNEL::NormalizedCellType typ);
1176 int getNumberOfGaussPt() const;
1177 int getDimension() const;
1178 int getNumberOfPtsInRefCell() const;
1179 std::string getStringRepr() const;
1180 void checkConsistencyLight() const;
1181 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1183 const std::vector<double>& getRefCoords() const;
1184 double getRefCoord(int ptIdInCell, int comp) const;
1185 const std::vector<double>& getGaussCoords() const;
1186 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1187 const std::vector<double>& getWeights() const;
1188 double getWeight(int gaussPtIdInCell, double newVal) const;
1189 void setRefCoord(int ptIdInCell, int comp, double newVal);
1190 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1191 void setWeight(int gaussPtIdInCell, double newVal);
1192 void setRefCoords(const std::vector<double>& refCoo);
1193 void setGaussCoords(const std::vector<double>& gsCoo);
1194 void setWeights(const std::vector<double>& w);
1196 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1200 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1202 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1206 MEDCouplingUMesh *buildRefCell() const
1208 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1214 class MEDCouplingSkyLineArray
1217 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI );
1219 void set( DataArrayInt* index, DataArrayInt* value );
1220 void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value );
1222 int getSuperNumberOf() const;
1223 int getNumberOf() const;
1224 int getLength() const;
1226 void deletePack(const int i, const int j);
1228 void deleteSimplePack(const int i);
1229 void deleteSimplePacks(const DataArrayInt* idx);
1233 MEDCouplingSkyLineArray()
1235 return MEDCouplingSkyLineArray::New();
1238 MEDCouplingSkyLineArray( const std::vector<int>& index, const std::vector<int>& value)
1240 return MEDCouplingSkyLineArray::New(index, value);
1243 MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value )
1245 return MEDCouplingSkyLineArray::New(index, value);
1248 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1250 return MEDCouplingSkyLineArray::New(other);
1253 std::string __str__() const
1255 return self->simpleRepr();
1258 DataArrayInt *getSuperIndexArray() const
1260 DataArrayInt *ret(self->getSuperIndexArray());
1266 DataArrayInt *getIndexArray() const
1268 DataArrayInt *ret(self->getIndexArray());
1274 DataArrayInt *getValuesArray() const
1276 DataArrayInt *ret(self->getValuesArray());
1282 PyObject *getSimplePackSafe(int absolutePackId) const
1284 std::vector<int> ret;
1285 self->getSimplePackSafe(absolutePackId,ret);
1286 return convertIntArrToPyList2(ret);
1289 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1291 std::vector<int> vpack, vspIdx, out;
1293 convertPyToNewIntArr3(superPackIndices,vspIdx);
1294 convertPyToNewIntArr3(pack,vpack);
1296 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1297 return convertIntArrToPyList2(out);
1300 void pushBackPack(const int i, PyObject *pack)
1302 std::vector<int> vpack;
1303 convertPyToNewIntArr3(pack,vpack);
1304 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1307 void replaceSimplePack(const int idx, PyObject *pack)
1309 std::vector<int> vpack;
1310 convertPyToNewIntArr3(pack,vpack);
1311 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1314 void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks)
1316 std::vector<const DataArrayInt*> packs;
1317 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt*>(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs);
1318 self->replaceSimplePacks(idx, packs);
1321 void replacePack(const int superIdx, const int idx, PyObject *pack)
1323 std::vector<int> vpack;
1324 convertPyToNewIntArr3(pack,vpack);
1325 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1328 PyObject *convertToPolyhedronConn() const
1330 MCAuto<DataArrayInt> d0=DataArrayInt::New();
1331 MCAuto<DataArrayInt> d1=DataArrayInt::New();
1332 self->convertToPolyhedronConn(d0,d1);
1333 PyObject *ret=PyTuple_New(2);
1334 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1335 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1342 %include "MEDCouplingFieldDiscretization.i"
1344 //== MEDCouplingPointSet
1346 namespace MEDCoupling
1348 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1351 void setCoords(const DataArrayDouble *coords);
1352 DataArrayDouble *getCoordinatesAndOwner() const;
1353 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1355 double getCaracteristicDimension() const;
1356 void recenterForMaxPrecision(double eps);
1357 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1358 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1359 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1360 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1361 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1362 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1363 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1364 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1365 virtual DataArrayInt *computeFetchedNodeIds() const;
1366 virtual int getNumberOfNodesInCell(int cellId) const;
1367 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1368 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1369 virtual DataArrayInt *zipCoordsTraducer();
1370 virtual DataArrayInt *findBoundaryNodes() const;
1371 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
1372 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1373 virtual void checkFullyDefined() const;
1374 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
1375 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1376 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1377 virtual void renumberNodesWithOffsetInConn(int offset);
1378 virtual bool areAllNodesFetched() const;
1379 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1380 virtual void invertOrientationOfAllCells();
1383 std::string __str__() const
1385 return self->simpleRepr();
1388 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const
1391 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1392 PyObject *res = PyList_New(2);
1393 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1394 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1398 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const
1400 DataArrayInt *comm, *commIndex;
1401 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1402 PyObject *res = PyList_New(2);
1403 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1404 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1408 PyObject *getCoords()
1410 DataArrayDouble *ret1=self->getCoords();
1413 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1416 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1418 int szArr,sw,iTypppArr;
1419 std::vector<int> stdvecTyyppArr;
1420 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1421 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1422 if(sw==3)//DataArrayInt
1424 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1425 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1426 std::string name=argpt->getName();
1428 ret->setName(name.c_str());
1430 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1433 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1435 int szArr,sw,iTypppArr;
1436 std::vector<int> stdvecTyyppArr;
1437 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1438 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1439 if(sw==3)//DataArrayInt
1441 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1442 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1443 std::string name=argpt->getName();
1445 ret->setName(name.c_str());
1447 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1450 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1452 int szArr,sw,iTypppArr;
1453 std::vector<int> stdvecTyyppArr;
1454 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1455 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1456 if(sw==3)//DataArrayInt
1458 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1459 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1460 std::string name=argpt->getName();
1462 ret->setName(name.c_str());
1464 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1467 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
1469 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1470 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1473 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1475 int szArr,sw,iTypppArr;
1476 std::vector<int> stdvecTyyppArr;
1477 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1478 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1479 if(sw==3)//DataArrayInt
1481 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1482 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1483 std::string name=argpt->getName();
1485 ret->setName(name.c_str());
1487 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1490 void renumberNodes(PyObject *li, int newNbOfNodes)
1492 int szArr,sw,iTypppArr;
1493 std::vector<int> stdvecTyyppArr;
1494 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1495 self->renumberNodes(tmp,newNbOfNodes);
1498 void renumberNodesCenter(PyObject *li, int newNbOfNodes)
1500 int szArr,sw,iTypppArr;
1501 std::vector<int> stdvecTyyppArr;
1502 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1503 self->renumberNodesCenter(tmp,newNbOfNodes);
1506 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1508 int spaceDim=self->getSpaceDimension();
1510 DataArrayDouble *a,*a2;
1511 DataArrayDoubleTuple *aa,*aa2;
1512 std::vector<double> bb,bb2;
1514 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1515 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1516 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1517 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1518 std::vector<int> nodes;
1519 self->findNodesOnLine(p,v,eps,nodes);
1520 DataArrayInt *ret=DataArrayInt::New();
1521 ret->alloc((int)nodes.size(),1);
1522 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1523 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1525 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1527 int spaceDim=self->getSpaceDimension();
1529 DataArrayDouble *a,*a2;
1530 DataArrayDoubleTuple *aa,*aa2;
1531 std::vector<double> bb,bb2;
1533 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1534 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1535 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1536 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1537 std::vector<int> nodes;
1538 self->findNodesOnPlane(p,v,eps,nodes);
1539 DataArrayInt *ret=DataArrayInt::New();
1540 ret->alloc((int)nodes.size(),1);
1541 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1542 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1545 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1549 DataArrayDoubleTuple *aa;
1550 std::vector<double> bb;
1552 int spaceDim=self->getSpaceDimension();
1553 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1554 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1555 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1556 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1559 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const
1561 DataArrayInt *c=0,*cI=0;
1565 DataArrayDoubleTuple *aa;
1566 std::vector<double> bb;
1568 int spaceDim=self->getSpaceDimension();
1569 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1570 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1571 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1572 PyObject *ret=PyTuple_New(2);
1573 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1574 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1578 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1580 DataArrayInt *c=0,*cI=0;
1581 int spaceDim=self->getSpaceDimension();
1584 DataArrayDoubleTuple *aa;
1585 std::vector<double> bb;
1588 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1589 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1591 PyObject *ret=PyTuple_New(2);
1592 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1593 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1597 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1601 DataArrayDoubleTuple *aa;
1602 std::vector<double> bb;
1604 int spaceDim=self->getSpaceDimension();
1605 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1606 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1608 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1609 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1612 void duplicateNodesInCoords(PyObject *li)
1616 std::vector<int> multiVal;
1617 std::pair<int, std::pair<int,int> > slic;
1618 MEDCoupling::DataArrayInt *daIntTyypp=0;
1619 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1623 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1625 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1627 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1629 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1633 virtual PyObject *findCommonCells(int compType, int startCellId=0) const
1635 DataArrayInt *v0(nullptr),*v1(nullptr);
1636 self->findCommonCells(compType,startCellId,v0,v1);
1637 PyObject *res = PyList_New(2);
1638 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1639 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1644 virtual void renumberNodesInConn(PyObject *li)
1648 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1651 MapII *da2(reinterpret_cast<MapII *>(da));
1652 self->renumberNodesInConn(da2->data());
1656 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
1657 if (!SWIG_IsOK(res1))
1660 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1661 self->renumberNodesInConn(tmp);
1665 DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da));
1667 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1668 da2->checkAllocated();
1669 self->renumberNodesInConn(da2->getConstPointer());
1673 virtual PyObject *getNodeIdsInUse() const
1676 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1677 PyObject *ret=PyTuple_New(2);
1678 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1679 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1683 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1685 DataArrayInt *ret(nullptr);
1687 int szArr,sw,iTypppArr;
1688 std::vector<int> stdvecTyyppArr;
1689 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1690 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1694 virtual PyObject *mergeNodes(double precision)
1698 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1699 PyObject *res = PyList_New(3);
1700 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1701 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1702 PyList_SetItem(res,2,SWIG_From_int(ret2));
1706 virtual PyObject *mergeNodesCenter(double precision)
1710 DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1711 PyObject *res = PyList_New(3);
1712 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1713 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1714 PyList_SetItem(res,2,SWIG_From_int(ret2));
1718 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1721 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1722 if (!SWIG_IsOK(res1))
1725 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1726 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1730 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1732 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1733 da2->checkAllocated();
1734 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1738 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1742 std::vector<int> multiVal;
1743 std::pair<int, std::pair<int,int> > slic;
1744 MEDCoupling::DataArrayInt *daIntTyypp=0;
1745 int nbc=self->getNumberOfCells();
1746 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1753 std::ostringstream oss;
1754 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1755 throw INTERP_KERNEL::Exception(oss.str().c_str());
1758 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1763 int tmp=nbc+singleVal;
1764 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1768 std::ostringstream oss;
1769 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1770 throw INTERP_KERNEL::Exception(oss.str().c_str());
1776 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1780 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1785 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1786 daIntTyypp->checkAllocated();
1787 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1790 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1794 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords)
1797 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1798 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1799 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1800 for(int i=0;i<sz;i++)
1801 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1804 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1807 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1809 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1810 std::vector<double> val3;
1811 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1812 "Rotate2DAlg",2,true,nbNodes);
1814 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1815 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1818 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords)
1821 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1822 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1823 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1824 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1825 for(int i=0;i<sz;i++)
1826 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1829 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1832 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1834 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1835 std::vector<double> val3;
1836 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1837 "Rotate3DAlg",3,true,nbNodes);
1839 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1840 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1841 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1846 //== MEDCouplingPointSet End
1848 class MEDCouplingUMeshCell
1851 INTERP_KERNEL::NormalizedCellType getType() const;
1854 std::string __str__() const
1856 return self->repr();
1859 PyObject *getAllConn() const
1862 const int *r=self->getAllConn(ret2);
1863 PyObject *ret=PyTuple_New(ret2);
1864 for(int i=0;i<ret2;i++)
1865 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1871 class MEDCouplingUMeshCellIterator
1878 MEDCouplingUMeshCell *ret=self->nextt();
1880 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1883 PyErr_SetString(PyExc_StopIteration,"No more data.");
1890 class MEDCouplingUMeshCellByTypeIterator
1893 ~MEDCouplingUMeshCellByTypeIterator();
1898 MEDCouplingUMeshCellEntry *ret=self->nextt();
1900 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1903 PyErr_SetString(PyExc_StopIteration,"No more data.");
1910 class MEDCouplingUMeshCellByTypeEntry
1913 ~MEDCouplingUMeshCellByTypeEntry();
1916 MEDCouplingUMeshCellByTypeIterator *__iter__()
1918 return self->iterator();
1923 class MEDCouplingUMeshCellEntry
1926 INTERP_KERNEL::NormalizedCellType getType() const;
1927 int getNumberOfElems() const;
1930 MEDCouplingUMeshCellIterator *__iter__()
1932 return self->iterator();
1937 //== MEDCouplingUMesh
1939 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
1942 static MEDCouplingUMesh *New();
1943 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
1944 void checkConsistencyLight() const;
1945 void setMeshDimension(int meshDim);
1946 void allocateCells(int nbOfCells=0);
1947 void finishInsertingCells();
1948 MEDCouplingUMeshCellByTypeEntry *cellsByType();
1949 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
1950 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
1951 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
1952 int getNodalConnectivityArrayLen() const;
1953 void computeTypes();
1954 std::string reprConnectivityOfThis() const;
1955 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
1957 DataArrayInt *conformize2D(double eps);
1958 DataArrayInt *conformize3D(double eps);
1959 DataArrayInt *colinearize2D(double eps);
1960 DataArrayInt *colinearizeKeepingConform2D(double eps);
1961 void shiftNodeNumbersInConn(int delta);
1962 std::vector<bool> getQuadraticStatus() const;
1963 DataArrayInt *findCellIdsOnBoundary() const;
1964 MEDCouplingUMesh *computeSkin() const;
1965 bool checkConsecutiveCellTypes() const;
1966 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
1967 DataArrayInt *rearrange2ConsecutiveCellTypes();
1968 DataArrayInt *sortCellsInMEDFileFrmt();
1969 DataArrayInt *getRenumArrForMEDFileFrmt() const;
1970 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const;
1971 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
1972 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
1973 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
1974 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
1975 void orientCorrectlyPolyhedrons();
1976 bool isPresenceOfQuadratic() const;
1977 bool isFullyQuadratic() const;
1978 MEDCouplingFieldDouble *buildDirectionVectorField() const;
1979 bool isContiguous1D() const;
1980 void tessellate2D(double eps);
1981 void convertQuadraticCellsToLinear();
1982 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0);
1983 void convertDegeneratedCells();
1984 DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes();
1985 bool removeDegenerated1DCells();
1986 bool areOnlySimplexCells() const;
1987 MEDCouplingFieldDouble *getEdgeRatioField() const;
1988 MEDCouplingFieldDouble *getAspectRatioField() const;
1989 MEDCouplingFieldDouble *getWarpField() const;
1990 MEDCouplingFieldDouble *getSkewField() const;
1991 DataArrayDouble *computePlaneEquationOf3DFaces() const;
1992 DataArrayInt *convexEnvelop2D();
1993 std::string cppRepr() const;
1994 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells();
1995 DataArrayInt *findAndCorrectBadOriented3DCells();
1996 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
1997 MEDCouplingSkyLineArray *generateGraph() const;
1998 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const;
1999 DataArrayInt *buildUnionOf2DMesh() const;
2000 DataArrayInt *buildUnionOf3DMesh() const;
2001 DataArrayInt *orderConsecutiveCells1D() const;
2002 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2003 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2004 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2005 void changeOrientationOfCells();
2006 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2007 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0);
2008 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2009 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2010 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2011 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn);
2012 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code);
2016 return MEDCouplingUMesh::New();
2019 MEDCouplingUMesh(const char *meshName, int meshDim)
2021 return MEDCouplingUMesh::New(meshName,meshDim);
2024 std::string __str__() const
2026 return self->simpleRepr();
2029 std::string __repr__() const
2031 std::ostringstream oss;
2032 self->reprQuickOverview(oss);
2036 MEDCouplingUMeshCellIterator *__iter__()
2038 return self->cellIterator();
2041 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2043 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2047 PyObject *getAllGeoTypesSorted() const
2049 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2050 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2051 PyObject *res=PyList_New(result.size());
2052 for(int i=0;iL!=result.end(); i++, iL++)
2053 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2057 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2061 std::vector<int> multiVal;
2062 std::pair<int, std::pair<int,int> > slic;
2063 MEDCoupling::DataArrayInt *daIntTyypp=0;
2064 int nbc=self->getNumberOfCells();
2065 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2072 std::ostringstream oss;
2073 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2074 throw INTERP_KERNEL::Exception(oss.str().c_str());
2078 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2085 int tmp=nbc+singleVal;
2086 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2091 std::ostringstream oss;
2092 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2093 throw INTERP_KERNEL::Exception(oss.str().c_str());
2099 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2105 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2106 daIntTyypp->checkAllocated();
2107 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2111 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
2115 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2119 std::vector<int> multiVal;
2120 std::pair<int, std::pair<int,int> > slic;
2121 MEDCoupling::DataArrayInt *daIntTyypp=0;
2122 int nbc=self->getNumberOfCells();
2123 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2130 std::ostringstream oss;
2131 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2132 throw INTERP_KERNEL::Exception(oss.str().c_str());
2136 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2143 int tmp=nbc+singleVal;
2144 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2149 std::ostringstream oss;
2150 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2151 throw INTERP_KERNEL::Exception(oss.str().c_str());
2157 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2162 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2168 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2169 daIntTyypp->checkAllocated();
2170 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2174 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
2178 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li)
2180 int szArr,sw,iTypppArr;
2181 std::vector<int> stdvecTyyppArr;
2182 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2185 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2186 throw INTERP_KERNEL::Exception(oss.str().c_str());
2188 self->insertNextCell(type,size,tmp);
2191 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2193 int szArr,sw,iTypppArr;
2194 std::vector<int> stdvecTyyppArr;
2195 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2196 self->insertNextCell(type,szArr,tmp);
2199 DataArrayInt *getNodalConnectivity()
2201 DataArrayInt *ret=self->getNodalConnectivity();
2206 DataArrayInt *getNodalConnectivityIndex()
2208 DataArrayInt *ret=self->getNodalConnectivityIndex();
2214 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1)
2216 int szArr,sw,iTypppArr;
2217 std::vector<int> stdvecTyyppArr;
2218 const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2219 int nbOfDepthPeelingPerformed=0;
2220 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2221 PyObject *res=PyTuple_New(2);
2222 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2223 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2227 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI)
2229 DataArrayInt *v0=0,*v1=0;
2230 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2231 PyObject *res = PyList_New(2);
2232 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2233 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2237 PyObject *distanceToPoint(PyObject *point) const
2241 DataArrayDoubleTuple *aa;
2242 std::vector<double> bb;
2244 int nbOfCompo=self->getSpaceDimension();
2245 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2248 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2249 PyObject *ret=PyTuple_New(2);
2250 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2251 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2255 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2257 DataArrayInt *ret1=0;
2258 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2259 PyObject *ret=PyTuple_New(2);
2260 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2261 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2265 PyObject *tetrahedrize(int policy)
2268 DataArrayInt *ret1(0);
2269 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2270 PyObject *ret=PyTuple_New(3);
2271 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2273 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2277 PyObject *checkButterflyCells(double eps=1e-12)
2279 std::vector<int> cells;
2280 self->checkButterflyCells(cells,eps);
2281 DataArrayInt *ret=DataArrayInt::New();
2282 ret->alloc((int)cells.size(),1);
2283 std::copy(cells.begin(),cells.end(),ret->getPointer());
2284 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2287 PyObject *splitByType() const
2289 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2291 PyObject *ret = PyList_New(sz);
2292 for(int i=0;i<sz;i++)
2293 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2297 PyObject *partitionBySpreadZone() const
2299 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
2300 int sz=retCpp.size();
2301 PyObject *ret=PyList_New(sz);
2302 for(int i=0;i<sz;i++)
2303 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
2309 std::vector<DataArrayInt *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2310 int sz=retCpp.size();
2311 PyObject *ret=PyList_New(sz);
2312 for(int i=0;i<sz;i++)
2313 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2317 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2320 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
2321 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2322 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2325 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2328 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2329 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2333 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2336 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2337 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2341 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2343 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
2344 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2345 PyObject *ret=PyTuple_New(3);
2346 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2348 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2352 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2354 DataArrayInt *tmp0=0,*tmp1=0;
2355 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2356 PyObject *ret=PyTuple_New(2);
2357 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2362 void duplicateNodes(PyObject *li)
2366 std::vector<int> multiVal;
2367 std::pair<int, std::pair<int,int> > slic;
2368 MEDCoupling::DataArrayInt *daIntTyypp=0;
2369 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2373 return self->duplicateNodes(&singleVal,&singleVal+1);
2375 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2377 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2379 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2383 void duplicateNodesInConn(PyObject *li, int offset)
2387 std::vector<int> multiVal;
2388 std::pair<int, std::pair<int,int> > slic;
2389 MEDCoupling::DataArrayInt *daIntTyypp=0;
2390 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2394 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2396 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2398 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2400 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2404 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2406 int szArr,sw,iTypppArr;
2407 std::vector<int> stdvecTyyppArr;
2408 const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2409 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2412 PyObject *getLevArrPerCellTypes(PyObject *li) const
2415 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2416 DataArrayInt *tmp0,*tmp1=0;
2417 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2418 PyObject *ret=PyTuple_New(2);
2419 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2420 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2424 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2426 DataArrayInt *ret0=0,*ret1=0;
2427 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2428 PyObject *ret=PyTuple_New(2);
2429 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2430 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2434 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2436 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2437 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2438 DataArrayInt *ret1=0,*ret2=0;
2439 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2440 PyObject *ret=PyTuple_New(3);
2441 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2442 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2447 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2449 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2450 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2451 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2452 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2455 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2458 std::vector<const MEDCouplingUMesh *> meshes;
2459 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2460 std::vector<DataArrayInt *> corr;
2461 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2463 PyObject *ret1=PyList_New(sz);
2464 for(int i=0;i<sz;i++)
2465 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2466 PyObject *ret=PyList_New(2);
2467 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2468 PyList_SetItem(ret,1,ret1);
2472 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2474 std::vector<MEDCouplingUMesh *> meshes;
2475 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2476 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2479 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2481 std::vector<MEDCouplingUMesh *> meshes;
2482 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2483 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2486 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0)
2490 std::vector<int> multiVal;
2491 std::pair<int, std::pair<int,int> > slic;
2492 MEDCoupling::DataArrayInt *daIntTyypp=0;
2494 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2495 convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2499 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2501 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2503 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2505 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2509 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
2511 DataArrayInt *arrOut=0,*arrIndexOut=0;
2514 std::vector<int> multiVal;
2515 std::pair<int, std::pair<int,int> > slic;
2516 MEDCoupling::DataArrayInt *daIntTyypp=0;
2518 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2519 convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2524 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2529 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2534 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2538 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2540 PyObject *ret=PyTuple_New(2);
2541 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2542 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2546 static PyObject *ExtractFromIndexedArraysSlice(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
2548 DataArrayInt *arrOut=0,*arrIndexOut=0;
2549 MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2550 PyObject *ret=PyTuple_New(2);
2551 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2552 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2556 static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
2558 if(!PySlice_Check(slic))
2559 throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !");
2560 Py_ssize_t strt=2,stp=2,step=2;
2562 throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !");
2563 arrIndxIn->checkAllocated();
2564 if(arrIndxIn->getNumberOfComponents()!=1)
2565 throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !");
2566 GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
2567 DataArrayInt *arrOut=0,*arrIndexOut=0;
2568 MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2569 PyObject *ret=PyTuple_New(2);
2570 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2571 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2575 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2576 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2577 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex)
2579 DataArrayInt *arrOut=0,*arrIndexOut=0;
2582 std::vector<int> multiVal;
2583 std::pair<int, std::pair<int,int> > slic;
2584 MEDCoupling::DataArrayInt *daIntTyypp=0;
2586 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2587 convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2592 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2597 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2602 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2606 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2608 PyObject *ret=PyTuple_New(2);
2609 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2610 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2614 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2615 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex)
2619 std::vector<int> multiVal;
2620 std::pair<int, std::pair<int,int> > slic;
2621 MEDCoupling::DataArrayInt *daIntTyypp=0;
2623 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2624 convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2629 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2634 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2639 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2643 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2647 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2651 DataArrayDoubleTuple *aa;
2652 std::vector<double> bb;
2654 int spaceDim=self->getSpaceDimension();
2655 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2656 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2658 std::vector<int> cells;
2659 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2660 DataArrayInt *ret=DataArrayInt::New();
2661 ret->alloc((int)cells.size(),1);
2662 std::copy(cells.begin(),cells.end(),ret->getPointer());
2663 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2666 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2670 DataArrayDoubleTuple *aa;
2671 std::vector<double> bb;
2673 int spaceDim=self->getSpaceDimension();
2674 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2675 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2676 self->orientCorrectly2DCells(v,polyOnly);
2679 PyObject *arePolyhedronsNotCorrectlyOriented() const
2681 std::vector<int> cells;
2682 self->arePolyhedronsNotCorrectlyOriented(cells);
2683 DataArrayInt *ret=DataArrayInt::New();
2684 ret->alloc((int)cells.size(),1);
2685 std::copy(cells.begin(),cells.end(),ret->getPointer());
2686 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2689 PyObject *getFastAveragePlaneOfThis() const
2693 self->getFastAveragePlaneOfThis(vec,pos);
2695 std::copy(vec,vec+3,vals);
2696 std::copy(pos,pos+3,vals+3);
2697 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2700 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2702 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2703 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2704 return MEDCouplingUMesh::MergeUMeshes(tmp);
2707 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2710 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2711 PyObject *ret=PyTuple_New(2);
2712 PyObject *ret0Py=ret0?Py_True:Py_False;
2714 PyTuple_SetItem(ret,0,ret0Py);
2715 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2719 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2722 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2723 PyObject *ret=PyTuple_New(2);
2724 PyObject *ret0Py=ret0?Py_True:Py_False;
2726 PyTuple_SetItem(ret,0,ret0Py);
2727 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2731 PyObject *explode3DMeshTo1D() const
2733 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2734 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2735 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2736 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2737 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2738 PyObject *ret=PyTuple_New(5);
2739 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2740 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2743 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2747 PyObject *explodeIntoEdges() const
2749 MCAuto<DataArrayInt> desc,descIndex,revDesc,revDescIndx;
2750 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2751 PyObject *ret=PyTuple_New(5);
2752 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2753 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2754 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2755 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2756 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2760 PyObject *explodeMeshIntoMicroEdges() const
2762 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2763 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2764 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2765 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2766 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2767 PyObject *ret=PyTuple_New(5);
2768 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2769 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2770 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2771 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2772 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2776 PyObject *buildDescendingConnectivity() const
2778 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2779 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2780 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2781 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2782 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2783 PyObject *ret=PyTuple_New(5);
2784 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2785 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2786 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2787 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2788 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2792 PyObject *buildDescendingConnectivity2() const
2794 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2795 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2796 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2797 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2798 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2799 PyObject *ret=PyTuple_New(5);
2800 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2801 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2802 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2803 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2804 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2808 PyObject *computeNeighborsOfCells() const
2810 DataArrayInt *neighbors=0,*neighborsIdx=0;
2811 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2812 PyObject *ret=PyTuple_New(2);
2813 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2814 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2818 PyObject *computeNeighborsOfNodes() const
2820 DataArrayInt *neighbors=0,*neighborsIdx=0;
2821 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2822 PyObject *ret=PyTuple_New(2);
2823 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2824 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2828 PyObject *computeEnlargedNeighborsOfNodes() const
2830 MCAuto<DataArrayInt> neighbors,neighborsIdx;
2831 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2832 PyObject *ret=PyTuple_New(2);
2833 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2834 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2838 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const
2840 MCAuto<DataArrayInt> cellNeigh,cellNeighIndex;
2841 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2842 PyObject *ret=PyTuple_New(2);
2843 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2844 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2848 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI)
2850 DataArrayInt *neighbors=0,*neighborsIdx=0;
2851 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2852 PyObject *ret=PyTuple_New(2);
2853 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2854 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2858 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2860 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2861 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2862 DataArrayInt *d2,*d3,*d4,*dd5;
2863 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2864 PyObject *ret=PyTuple_New(7);
2865 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2866 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2867 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2868 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2869 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2870 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2871 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2875 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const
2878 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2879 da->checkAllocated();
2880 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2883 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const
2886 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2887 da->checkAllocated();
2888 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2891 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const
2894 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2895 da->checkAllocated();
2896 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2899 PyObject *getTypesOfPart(DataArrayInt *da) const
2902 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2903 da->checkAllocated();
2904 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2905 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2906 PyObject *res = PyList_New(result.size());
2907 for (int i=0;iL!=result.end(); i++, iL++)
2908 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2912 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const
2915 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2916 da->checkAllocated();
2917 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2918 ret->setName(da->getName().c_str());
2922 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2924 DataArrayInt *cellNb1=0,*cellNb2=0;
2925 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2926 PyObject *ret=PyTuple_New(3);
2927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2929 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2933 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2935 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2936 DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2937 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2938 PyObject *ret(PyTuple_New(4));
2939 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2940 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2941 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2942 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2946 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2948 int spaceDim=self->getSpaceDimension();
2950 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2952 DataArrayDouble *a,*a2;
2953 DataArrayDoubleTuple *aa,*aa2;
2954 std::vector<double> bb,bb2;
2956 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2957 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2958 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2959 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2961 DataArrayInt *cellIds=0;
2962 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2963 PyObject *ret=PyTuple_New(2);
2964 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2965 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2969 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2971 int spaceDim=self->getSpaceDimension();
2973 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2975 DataArrayDouble *a,*a2;
2976 DataArrayDoubleTuple *aa,*aa2;
2977 std::vector<double> bb,bb2;
2979 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2980 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2981 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2982 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2984 DataArrayInt *cellIds=0;
2985 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2986 PyObject *ret=PyTuple_New(2);
2987 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2988 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2992 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2995 DataArrayDouble *a,*a2;
2996 DataArrayDoubleTuple *aa,*aa2;
2997 std::vector<double> bb,bb2;
2999 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
3000 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
3001 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
3002 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
3003 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
3007 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
3009 int spaceDim=self->getSpaceDimension();
3011 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
3013 DataArrayDouble *a,*a2;
3014 DataArrayDoubleTuple *aa,*aa2;
3015 std::vector<double> bb,bb2;
3017 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
3018 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
3019 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3020 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3021 return self->getCellIdsCrossingPlane(orig,vect,eps);
3024 void convertToPolyTypes(PyObject *li)
3028 std::vector<int> pos2;
3029 DataArrayInt *pos3=0;
3030 DataArrayIntTuple *pos4=0;
3031 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
3036 self->convertToPolyTypes(&pos1,&pos1+1);
3043 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
3048 self->convertToPolyTypes(pos3->begin(),pos3->end());
3052 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
3056 void convertAllToPoly();
3057 void convertExtrudedPolyhedra();
3059 void simplifyPolyhedra(double eps);
3060 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
3061 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
3064 //== MEDCouplingUMesh End
3066 //== MEDCouplingMappedExtrudedMesh
3068 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
3071 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
3072 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
3073 MEDCouplingUMesh *build3DUnstructuredMesh() const;
3074 int get2DCellIdForExtrusion() const;
3076 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId)
3078 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3081 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3083 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3086 MEDCouplingMappedExtrudedMesh()
3088 return MEDCouplingMappedExtrudedMesh::New();
3091 std::string __str__() const
3093 return self->simpleRepr();
3096 std::string __repr__() const
3098 std::ostringstream oss;
3099 self->reprQuickOverview(oss);
3103 PyObject *getMesh2D() const
3105 MEDCouplingUMesh *ret=self->getMesh2D();
3108 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3110 PyObject *getMesh1D() const
3112 MEDCouplingUMesh *ret=self->getMesh1D();
3115 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3117 PyObject *getMesh3DIds() const
3119 DataArrayInt *ret=self->getMesh3DIds();
3122 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3127 //== MEDCouplingMappedExtrudedMesh End
3129 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3132 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3133 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3134 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3135 int getNodalConnectivityLength() const;
3136 virtual void allocateCells(int nbOfCells=0);
3137 virtual void checkConsistencyOfConnectivity() const;
3140 virtual void insertNextCell(PyObject *li)
3142 int szArr,sw,iTypppArr;
3143 std::vector<int> stdvecTyyppArr;
3144 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3145 self->insertNextCell(tmp,tmp+szArr);
3148 virtual DataArrayInt *getNodalConnectivity() const
3150 DataArrayInt *ret=self->getNodalConnectivity();
3151 if(ret) ret->incrRef();
3155 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3157 std::vector< const MEDCoupling1GTUMesh *> parts;
3158 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3159 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3164 //== MEDCoupling1SGTUMesh
3166 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3169 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3170 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3171 void setNodalConnectivity(DataArrayInt *nodalConn);
3172 int getNumberOfNodesPerCell() const;
3173 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3174 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3175 MEDCoupling1GTUMesh *computeDualMesh() const;
3176 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3177 DataArrayInt *sortHexa8EachOther();
3180 MEDCoupling1SGTUMesh()
3182 return MEDCoupling1SGTUMesh::New();
3185 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3187 return MEDCoupling1SGTUMesh::New(name,type);
3190 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3192 return MEDCoupling1SGTUMesh::New(m);
3195 std::string __str__() const
3197 return self->simpleRepr();
3200 std::string __repr__() const
3202 std::ostringstream oss;
3203 self->reprQuickOverview(oss);
3207 PyObject *structurizeMe(double eps=1e-12) const
3209 DataArrayInt *cellPerm(0),*nodePerm(0);
3210 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3211 PyObject *ret(PyTuple_New(3));
3212 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3213 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3214 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3218 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3220 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3221 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3222 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3225 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3227 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3228 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3229 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3234 //== MEDCoupling1SGTUMesh End
3236 //== MEDCoupling1DGTUMesh
3238 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3241 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3242 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3243 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex);
3244 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3245 bool isPacked() const;
3248 MEDCoupling1DGTUMesh()
3250 return MEDCoupling1DGTUMesh::New();
3252 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3254 return MEDCoupling1DGTUMesh::New(name,type);
3257 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3259 return MEDCoupling1DGTUMesh::New(m);
3262 std::string __str__() const
3264 return self->simpleRepr();
3267 std::string __repr__() const
3269 std::ostringstream oss;
3270 self->reprQuickOverview(oss);
3274 DataArrayInt *getNodalConnectivityIndex() const
3276 DataArrayInt *ret=self->getNodalConnectivityIndex();
3277 if(ret) ret->incrRef();
3281 PyObject *retrievePackedNodalConnectivity() const
3283 DataArrayInt *ret1=0,*ret2=0;
3284 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3285 PyObject *ret0Py=ret0?Py_True:Py_False;
3287 PyObject *ret=PyTuple_New(3);
3288 PyTuple_SetItem(ret,0,ret0Py);
3289 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3290 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3294 PyObject *copyWithNodalConnectivityPacked() const
3297 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3298 PyObject *ret=PyTuple_New(2);
3299 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3300 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3301 PyTuple_SetItem(ret,1,ret1Py);
3305 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3307 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3308 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3309 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3312 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3314 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3315 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3316 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3319 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt)
3321 std::vector<const MEDCoupling::DataArrayInt *> tmp;
3322 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3323 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3328 //== MEDCoupling1DGTUMeshEnd
3330 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3333 int getCellIdFromPos(int i, int j, int k) const;
3334 int getNodeIdFromPos(int i, int j, int k) const;
3335 int getNumberOfCellsOfSubLevelMesh() const;
3336 int getSpaceDimensionOnNodeStruct() const;
3337 double computeSquareness() const;
3338 virtual std::vector<int> getNodeGridStructure() const;
3339 std::vector<int> getCellGridStructure() const;
3340 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3341 std::vector<int> getLocationFromCellId(int cellId) const;
3342 std::vector<int> getLocationFromNodeId(int cellId) const;
3343 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3344 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3345 static int DeduceNumberOfGivenStructure(const std::vector<int>& st);
3346 static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev);
3347 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct);
3350 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3352 int tmpp1=-1,tmpp2=-1;
3353 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3354 std::vector< std::pair<int,int> > inp;
3358 for(int i=0;i<tmpp1;i++)
3359 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3364 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3365 inp.resize(tmpp1/2);
3366 for(int i=0;i<tmpp1/2;i++)
3367 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3370 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3371 return self->buildStructuredSubPart(inp);
3374 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3376 std::vector< std::pair<int,int> > inp;
3377 convertPyToVectorPairInt(part,inp);
3379 int szArr,sw,iTypppArr;
3380 std::vector<int> stdvecTyyppArr;
3381 const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3382 std::vector<int> tmp5(tmp4,tmp4+szArr);
3384 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3387 static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da)
3389 std::vector< std::pair<int,int> > inp;
3390 convertPyToVectorPairInt(part,inp);
3391 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3394 static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da)
3396 std::vector< std::pair<int,int> > inp;
3397 convertPyToVectorPairInt(part,inp);
3398 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3401 static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part)
3403 std::vector< std::pair<int,int> > inp;
3404 convertPyToVectorPairInt(part,inp);
3405 std::vector<int> stWithGhost;
3406 std::vector< std::pair<int,int> > partWithGhost;
3407 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3408 PyObject *ret(PyTuple_New(2));
3409 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3410 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3414 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3416 std::vector< std::pair<int,int> > inp;
3417 convertPyToVectorPairInt(partCompactFormat,inp);
3418 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3421 static void AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3423 std::vector< std::pair<int,int> > inp;
3424 convertPyToVectorPairInt(partCompactFormat,inp);
3425 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3428 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3430 std::vector< std::pair<int,int> > inp;
3431 convertPyToVectorPairInt(part,inp);
3432 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3435 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li)
3437 int szArr,sw,iTypppArr;
3438 std::vector<int> stdvecTyyppArr;
3439 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3440 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3443 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3445 int szArr,sw,iTypppArr;
3446 std::vector<int> stdvecTyyppArr;
3447 const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3448 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3451 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3453 std::vector< std::pair<int,int> > inp;
3454 convertPyToVectorPairInt(partCompactFormat,inp);
3455 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3458 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims)
3460 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3461 PyObject *retPy=PyList_New(ret.size());
3462 for(std::size_t i=0;i<ret.size();i++)
3464 PyObject *tmp=PyTuple_New(2);
3465 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3466 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3467 PyList_SetItem(retPy,i,tmp);
3472 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3474 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3475 convertPyToVectorPairInt(r1,r1Cpp);
3476 convertPyToVectorPairInt(r2,r2Cpp);
3477 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3478 PyObject *retPy=PyList_New(ret.size());
3479 for(std::size_t i=0;i<ret.size();i++)
3481 PyObject *tmp=PyTuple_New(2);
3482 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3483 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3484 PyList_SetItem(retPy,i,tmp);
3489 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3491 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3492 convertPyToVectorPairInt(r1,r1Cpp);
3493 convertPyToVectorPairInt(r2,r2Cpp);
3494 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3497 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3499 int szArr,sw,iTypppArr;
3500 std::vector<int> stdvecTyyppArr;
3501 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3502 int szArr2,sw2,iTypppArr2;
3503 std::vector<int> stdvecTyyppArr2;
3504 const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3505 std::vector<int> tmp3(tmp2,tmp2+szArr2);
3506 std::vector< std::pair<int,int> > partCompactFormat;
3507 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3508 PyObject *ret=PyTuple_New(2);
3509 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3510 PyTuple_SetItem(ret,0,ret0Py);
3511 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3512 for(std::size_t i=0;i<partCompactFormat.size();i++)
3514 PyObject *tmp4=PyTuple_New(2);
3515 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3516 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3517 PyList_SetItem(ret1Py,i,tmp4);
3519 PyTuple_SetItem(ret,1,ret1Py);
3523 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3525 std::vector< std::pair<int,int> > param0,param1,ret;
3526 convertPyToVectorPairInt(bigInAbs,param0);
3527 convertPyToVectorPairInt(partOfBigInAbs,param1);
3528 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3529 PyObject *retPy(PyList_New(ret.size()));
3530 for(std::size_t i=0;i<ret.size();i++)
3532 PyObject *tmp(PyTuple_New(2));
3533 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3534 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3535 PyList_SetItem(retPy,i,tmp);
3540 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation)
3542 std::vector< std::pair<int,int> > param0;
3543 convertPyToVectorPairInt(part,param0);
3544 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3545 PyObject *retPy(PyList_New(ret.size()));
3546 for(std::size_t i=0;i<ret.size();i++)
3548 PyObject *tmp(PyTuple_New(2));
3549 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3550 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3551 PyList_SetItem(retPy,i,tmp);
3556 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3558 std::vector< std::pair<int,int> > param0,param1;
3559 convertPyToVectorPairInt(startingFrom,param0);
3560 convertPyToVectorPairInt(goingTo,param1);
3561 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3564 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3566 std::vector< std::pair<int,int> > param0,param1,ret;
3567 convertPyToVectorPairInt(bigInAbs,param0);
3568 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3569 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3570 PyObject *retPy(PyList_New(ret.size()));
3571 for(std::size_t i=0;i<ret.size();i++)
3573 PyObject *tmp(PyTuple_New(2));
3574 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3575 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3576 PyList_SetItem(retPy,i,tmp);
3583 class MEDCouplingCurveLinearMesh;
3585 //== MEDCouplingCMesh
3587 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3590 static MEDCouplingCMesh *New();
3591 static MEDCouplingCMesh *New(const std::string& meshName);
3592 void setCoords(const DataArrayDouble *coordsX,
3593 const DataArrayDouble *coordsY=0,
3594 const DataArrayDouble *coordsZ=0);
3595 void setCoordsAt(int i, const DataArrayDouble *arr);
3596 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3600 return MEDCouplingCMesh::New();
3602 MEDCouplingCMesh(const std::string& meshName)
3604 return MEDCouplingCMesh::New(meshName);
3606 std::string __str__() const
3608 return self->simpleRepr();
3610 std::string __repr__() const
3612 std::ostringstream oss;
3613 self->reprQuickOverview(oss);
3616 DataArrayDouble *getCoordsAt(int i)
3618 DataArrayDouble *ret=self->getCoordsAt(i);
3626 //== MEDCouplingCMesh End
3628 //== MEDCouplingCurveLinearMesh
3630 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3633 static MEDCouplingCurveLinearMesh *New();
3634 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3635 void setCoords(const DataArrayDouble *coords);
3637 MEDCouplingCurveLinearMesh()
3639 return MEDCouplingCurveLinearMesh::New();
3641 MEDCouplingCurveLinearMesh(const std::string& meshName)
3643 return MEDCouplingCurveLinearMesh::New(meshName);
3645 std::string __str__() const
3647 return self->simpleRepr();
3649 std::string __repr__() const
3651 std::ostringstream oss;
3652 self->reprQuickOverview(oss);
3655 DataArrayDouble *getCoords()
3657 DataArrayDouble *ret=self->getCoords();
3662 void setNodeGridStructure(PyObject *gridStruct)
3664 int szArr,sw,iTypppArr;
3665 std::vector<int> stdvecTyyppArr;
3666 const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3667 self->setNodeGridStructure(tmp,tmp+szArr);
3672 //== MEDCouplingCurveLinearMesh End
3674 //== MEDCouplingIMesh
3676 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3679 static MEDCouplingIMesh *New();
3681 void setSpaceDimension(int spaceDim);
3682 std::vector<int> getNodeStruct() const;
3683 std::vector<double> getOrigin() const;
3684 std::vector<double> getDXYZ() const;
3685 void setAxisUnit(const std::string& unitName);
3686 std::string getAxisUnit() const;
3687 double getMeasureOfAnyCell() const;
3688 MEDCouplingCMesh *convertToCartesian() const;
3689 void refineWithFactor(const std::vector<int>& factors);
3690 MEDCouplingIMesh *asSingleCell() const;
3691 MEDCouplingIMesh *buildWithGhost(int ghostLev) const;
3696 return MEDCouplingIMesh::New();
3698 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3700 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3701 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3702 const int *nodeStrctPtr(0);
3703 const double *originPtr(0),*dxyzPtr(0);
3705 std::vector<int> bb0;
3706 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3709 std::vector<double> bb,bb2;
3711 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3712 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3714 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3717 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3719 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3722 void setNodeStruct(PyObject *nodeStrct)
3725 std::vector<int> bb0;
3726 const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3727 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3730 void setOrigin(PyObject *origin)
3732 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3735 DataArrayDoubleTuple *aa;
3736 std::vector<double> bb;
3738 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3739 self->setOrigin(originPtr,originPtr+nbTuples);
3742 void setDXYZ(PyObject *dxyz)
3744 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3747 DataArrayDoubleTuple *aa;
3748 std::vector<double> bb;
3750 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3751 self->setDXYZ(originPtr,originPtr+nbTuples);
3754 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA)
3756 std::vector< std::pair<int,int> > inp;
3757 convertPyToVectorPairInt(fineLocInCoarse,inp);
3758 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3761 static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize)
3763 std::vector< std::pair<int,int> > inp;
3764 convertPyToVectorPairInt(fineLocInCoarse,inp);
3765 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3768 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts)
3770 std::vector< std::pair<int,int> > inp;
3771 convertPyToVectorPairInt(fineLocInCoarse,inp);
3772 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3775 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
3777 std::vector< std::pair<int,int> > inp;
3778 convertPyToVectorPairInt(fineLocInCoarse,inp);
3779 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3782 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
3784 std::vector< std::pair<int,int> > inp;
3785 convertPyToVectorPairInt(fineLocInCoarse,inp);
3786 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3789 std::string __str__() const
3791 return self->simpleRepr();
3793 std::string __repr__() const
3795 std::ostringstream oss;
3796 self->reprQuickOverview(oss);
3802 //== MEDCouplingIMesh End
3806 namespace MEDCoupling
3808 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3811 virtual void checkConsistencyLight() const;
3812 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3813 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3814 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3815 void setName(const char *name);
3816 std::string getDescription() const;
3817 void setDescription(const char *desc);
3818 std::string getName() const;
3819 TypeOfField getTypeOfField() const;
3820 NatureOfField getNature() const;
3821 virtual void setNature(NatureOfField nat);
3822 DataArrayDouble *getLocalizationOfDiscr() const;
3823 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3824 int getNumberOfTuplesExpected() const;
3825 int getNumberOfMeshPlacesExpected() const;
3826 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3827 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3828 void clearGaussLocalizations();
3829 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3830 int getNbOfGaussLocalization() const;
3831 int getGaussLocalizationIdOfOneCell(int cellId) const;
3832 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3833 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3834 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3836 PyObject *getMesh() const
3838 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3841 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3844 PyObject *getDiscretization()
3846 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3849 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3852 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3854 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3855 return convertIntArrToPyList3(ret);
3858 PyObject *buildSubMeshData(PyObject *li) const
3860 DataArrayInt *ret1=0;
3861 MEDCouplingMesh *ret0=0;
3863 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3864 if (!SWIG_IsOK(res1))
3867 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3868 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3872 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3874 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3875 da2->checkAllocated();
3876 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3878 PyObject *res = PyList_New(2);
3879 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3880 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3884 PyObject *buildSubMeshDataRange(int begin, int end, int step) const
3886 DataArrayInt *ret1=0;
3888 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3889 PyObject *res=PyTuple_New(2);
3890 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3892 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3895 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3896 PyTuple_SetItem(res,1,res1);
3901 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3904 int v0; std::vector<int> v1;
3905 const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3906 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3909 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3910 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3913 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3914 if (!SWIG_IsOK(res1))
3917 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3918 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3922 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3924 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3925 da2->checkAllocated();
3926 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3930 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3932 std::vector<int> tmp;
3933 self->getCellIdsHavingGaussLocalization(locId,tmp);
3934 DataArrayInt *ret=DataArrayInt::New();
3935 ret->alloc((int)tmp.size(),1);
3936 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3937 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3940 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3942 std::vector<int> inp0;
3943 convertPyToNewIntArr4(code,1,3,inp0);
3944 std::vector<const DataArrayInt *> inp1;
3945 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
3946 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3951 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3954 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3955 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3956 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3957 static MEDCouplingFieldTemplate *New(TypeOfField type);
3958 std::string simpleRepr() const;
3959 std::string advancedRepr() const;
3960 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3961 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3964 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3966 return MEDCouplingFieldTemplate::New(f);
3969 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3971 return MEDCouplingFieldTemplate::New(f);
3974 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3976 return MEDCouplingFieldTemplate::New(f);
3979 MEDCouplingFieldTemplate(TypeOfField type)
3981 return MEDCouplingFieldTemplate::New(type);
3984 std::string __str__() const
3986 return self->simpleRepr();
3989 std::string __repr__() const
3991 std::ostringstream oss;
3992 self->reprQuickOverview(oss);
3996 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3999 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
4000 PyObject *ret=PyTuple_New(2);
4001 PyObject *ret0Py=ret0?Py_True:Py_False;
4003 PyTuple_SetItem(ret,0,ret0Py);
4004 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4011 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
4014 TypeOfTimeDiscretization getTimeDiscretization() const;
4016 MEDCouplingFieldT();
4017 ~MEDCouplingFieldT();
4020 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
4021 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
4022 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
4024 class MEDCouplingFieldInt;
4025 class MEDCouplingFieldFloat;
4027 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
4030 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
4031 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
4032 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4033 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4034 void setTimeUnit(const std::string& unit);
4035 std::string getTimeUnit() const;
4036 void synchronizeTimeWithSupport();
4037 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
4038 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
4039 std::string simpleRepr() const;
4040 std::string advancedRepr() const;
4041 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
4042 MEDCouplingFieldInt *convertToIntField() const;
4043 MEDCouplingFieldFloat *convertToFloatField() const;
4044 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
4045 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
4046 MEDCouplingFieldDouble *deepCopy() const;
4047 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
4048 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
4049 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
4050 double getIJ(int tupleId, int compoId) const;
4051 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
4052 void synchronizeTimeWithMesh();
4053 void setArray(DataArrayDouble *array);
4054 void setEndArray(DataArrayDouble *array);
4055 void setTime(double val, int iteration, int order);
4056 void setStartTime(double val, int iteration, int order);
4057 void setEndTime(double val, int iteration, int order);
4058 void applyLin(double a, double b, int compoId);
4059 void applyLin(double a, double b);
4060 int getNumberOfComponents() const;
4061 int getNumberOfTuples() const;
4062 int getNumberOfValues() const;
4063 void setTimeTolerance(double val);
4064 double getTimeTolerance() const;
4065 void setIteration(int it);
4066 void setEndIteration(int it);
4067 void setOrder(int order);
4068 void setEndOrder(int order);
4069 void setTimeValue(double val);
4070 void setEndTimeValue(double val);
4071 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
4072 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
4073 bool mergeNodes(double eps, double epsOnVals=1e-15);
4074 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
4075 bool zipCoords(double epsOnVals=1e-15);
4076 bool zipConnectivity(int compType,double epsOnVals=1e-15);
4077 bool simplexize(int policy);
4078 MEDCouplingFieldDouble *doublyContractedProduct() const;
4079 MEDCouplingFieldDouble *determinant() const;
4080 MEDCouplingFieldDouble *eigenValues() const;
4081 MEDCouplingFieldDouble *eigenVectors() const;
4082 MEDCouplingFieldDouble *inverse() const;
4083 MEDCouplingFieldDouble *trace() const;
4084 MEDCouplingFieldDouble *deviator() const;
4085 MEDCouplingFieldDouble *magnitude() const;
4086 MEDCouplingFieldDouble *maxPerTuple() const;
4087 void changeNbOfComponents(int newNbOfComp, double dftValue=0.);
4088 void sortPerTuple(bool asc);
4089 MEDCouplingFieldDouble &operator=(double value);
4090 void fillFromAnalytic(int nbOfComp, const std::string& func);
4091 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4092 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4093 void applyFunc(int nbOfComp, const std::string& func);
4094 void applyFuncCompo(int nbOfComp, const std::string& func);
4095 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4096 void applyFunc(int nbOfComp, double val);
4097 void applyFunc(const std::string& func);
4098 void applyFuncFast32(const std::string& func);
4099 void applyFuncFast64(const std::string& func);
4100 double accumulate(int compId) const;
4101 double getMaxValue() const;
4102 double getMinValue() const;
4103 double getAverageValue() const;
4104 double norm2() const;
4105 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4106 double getWeightedAverageValue(int compId, bool isWAbs) const;
4107 double integral(int compId, bool isWAbs) const;
4108 double normL1(int compId) const;
4109 double normL2(int compId) const;
4110 double normMax(int compId) const;
4111 DataArrayInt *findIdsInRange(double vmin, double vmax) const;
4112 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4113 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4114 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4115 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4116 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4117 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4118 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4119 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4120 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4121 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4122 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4123 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4124 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4125 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4126 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4127 MEDCouplingFieldDouble *negate() const;
4129 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4131 return MEDCouplingFieldDouble::New(type,td);
4134 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4136 return MEDCouplingFieldDouble::New(ft,td);
4139 std::string __str__() const
4141 return self->simpleRepr();
4144 std::string __repr__() const
4146 std::ostringstream oss;
4147 self->reprQuickOverview(oss);
4151 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4154 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4155 PyObject *ret=PyTuple_New(2);
4156 PyObject *ret0Py=ret0?Py_True:Py_False;
4158 PyTuple_SetItem(ret,0,ret0Py);
4159 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4163 MEDCouplingFieldDouble *voronoize(double eps) const
4165 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4169 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4171 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4175 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4177 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4179 DataArrayDouble *a,*a2;
4180 DataArrayDoubleTuple *aa,*aa2;
4181 std::vector<double> bb,bb2;
4183 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4184 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4185 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4188 DataArrayDouble *getArray()
4190 DataArrayDouble *ret=self->getArray();
4196 PyObject *getArrays() const
4198 std::vector<DataArrayDouble *> arrs=self->getArrays();
4199 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4203 PyObject *ret=PyTuple_New(sz);
4204 for(int i=0;i<sz;i++)
4207 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4209 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4214 void setArrays(PyObject *ls)
4216 std::vector<const DataArrayDouble *> tmp;
4217 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4219 std::vector<DataArrayDouble *> arrs(sz);
4220 for(int i=0;i<sz;i++)
4221 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4222 self->setArrays(arrs);
4225 DataArrayDouble *getEndArray()
4227 DataArrayDouble *ret=self->getEndArray();
4233 PyObject *getValueOn(PyObject *sl) const
4237 DataArrayDoubleTuple *aa;
4238 std::vector<double> bb;
4240 const MEDCouplingMesh *mesh=self->getMesh();
4242 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4243 int spaceDim=mesh->getSpaceDimension();
4244 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4245 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4247 int sz=self->getNumberOfComponents();
4248 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4249 self->getValueOn(spaceLoc,res);
4250 return convertDblArrToPyList<double>(res,sz);
4253 PyObject *getValueOnPos(int i, int j, int k) const
4255 int sz=self->getNumberOfComponents();
4256 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4257 self->getValueOnPos(i,j,k,res);
4258 return convertDblArrToPyList<double>(res,sz);
4261 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4263 const MEDCouplingMesh *mesh(self->getMesh());
4265 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4268 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4269 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4270 mesh->getSpaceDimension(),true,nbPts);
4271 return self->getValueOnMulti(inp,nbPts);
4274 PyObject *getValueOn(PyObject *sl, double time) const
4278 DataArrayDoubleTuple *aa;
4279 std::vector<double> bb;
4281 const MEDCouplingMesh *mesh=self->getMesh();
4283 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4284 int spaceDim=mesh->getSpaceDimension();
4285 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4286 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4289 int sz=self->getNumberOfComponents();
4290 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4291 self->getValueOn(spaceLoc,time,res);
4292 return convertDblArrToPyList<double>(res,sz);
4295 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4297 if(self->getArray()!=0)
4298 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4301 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4302 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4303 self->setArray(arr);
4310 double tmp0=self->getTime(tmp1,tmp2);
4311 PyObject *res = PyList_New(3);
4312 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4313 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4314 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4318 PyObject *getStartTime()
4321 double tmp0=self->getStartTime(tmp1,tmp2);
4322 PyObject *res = PyList_New(3);
4323 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4324 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4325 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4329 PyObject *getEndTime()
4332 double tmp0=self->getEndTime(tmp1,tmp2);
4333 PyObject *res = PyList_New(3);
4334 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4335 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4336 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4339 PyObject *accumulate() const
4341 int sz=self->getNumberOfComponents();
4342 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4343 self->accumulate(tmp);
4344 return convertDblArrToPyList<double>(tmp,sz);
4346 PyObject *integral(bool isWAbs) const
4348 int sz=self->getNumberOfComponents();
4349 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4350 self->integral(isWAbs,tmp);
4351 return convertDblArrToPyList<double>(tmp,sz);
4353 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4355 int sz=self->getNumberOfComponents();
4356 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4357 self->getWeightedAverageValue(tmp,isWAbs);
4358 return convertDblArrToPyList<double>(tmp,sz);
4360 PyObject *normL1() const
4362 int sz=self->getNumberOfComponents();
4363 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4365 return convertDblArrToPyList<double>(tmp,sz);
4367 PyObject *normL2() const
4369 int sz=self->getNumberOfComponents();
4370 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4372 return convertDblArrToPyList<double>(tmp,sz);
4374 PyObject *normMax() const
4376 int sz=self->getNumberOfComponents();
4377 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4379 return convertDblArrToPyList<double>(tmp,sz);
4381 void renumberCells(PyObject *li, bool check=true)
4383 int szArr,sw,iTypppArr;
4384 std::vector<int> stdvecTyyppArr;
4385 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4386 self->renumberCells(tmp,check);
4389 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4391 int szArr,sw,iTypppArr;
4392 std::vector<int> stdvecTyyppArr;
4393 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4394 self->renumberCellsWithoutMesh(tmp,check);
4397 void renumberNodes(PyObject *li, double eps=1e-15)
4399 int szArr,sw,iTypppArr;
4400 std::vector<int> stdvecTyyppArr;
4401 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4402 self->renumberNodes(tmp,eps);
4405 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15)
4407 int szArr,sw,iTypppArr;
4408 std::vector<int> stdvecTyyppArr;
4409 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4410 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4413 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4415 return fieldT_buildSubPart(self,li);
4418 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4420 return fieldT__getitem__(self,li);
4423 PyObject *getMaxValue2() const
4426 double r1=self->getMaxValue2(tmp);
4427 PyObject *ret=PyTuple_New(2);
4428 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4429 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4433 PyObject *getMinValue2() const
4436 double r1=self->getMinValue2(tmp);
4437 PyObject *ret=PyTuple_New(2);
4438 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4439 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4443 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4445 std::vector<int> tmp;
4446 convertPyToNewIntArr3(li,tmp);
4447 return self->keepSelectedComponents(tmp);
4450 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4452 std::vector<int> tmp;
4453 convertPyToNewIntArr3(li,tmp);
4454 self->setSelectedComponents(f,tmp);
4457 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4460 DataArrayDouble *a,*a2;
4461 DataArrayDoubleTuple *aa,*aa2;
4462 std::vector<double> bb,bb2;
4465 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4466 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4467 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4468 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4470 return self->extractSlice3D(orig,vect,eps);
4473 MEDCouplingFieldDouble *__add__(PyObject *obj)
4475 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4478 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4480 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4483 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4485 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.";
4486 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4489 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4491 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4493 return (*self)-(*other);
4495 throw INTERP_KERNEL::Exception(msg);
4500 DataArrayDoubleTuple *aa;
4501 std::vector<double> bb;
4503 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4508 if(!self->getArray())
4509 throw INTERP_KERNEL::Exception(msg2);
4510 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4511 ret->applyLin(1.,-val);
4512 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4513 ret2->setArray(ret);
4518 if(!self->getArray())
4519 throw INTERP_KERNEL::Exception(msg2);
4520 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4521 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4522 ret2->setArray(ret);
4527 if(!self->getArray())
4528 throw INTERP_KERNEL::Exception(msg2);
4529 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4530 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4531 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4532 ret2->setArray(ret);
4537 if(!self->getArray())
4538 throw INTERP_KERNEL::Exception(msg2);
4539 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4540 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4541 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4542 ret2->setArray(ret);
4546 { throw INTERP_KERNEL::Exception(msg); }
4550 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4552 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4555 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4557 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4560 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4562 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4565 MEDCouplingFieldDouble *__div__(PyObject *obj)
4567 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.";
4568 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4571 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4573 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4575 return (*self)/(*other);
4577 throw INTERP_KERNEL::Exception(msg);
4582 DataArrayDoubleTuple *aa;
4583 std::vector<double> bb;
4585 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4591 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4592 if(!self->getArray())
4593 throw INTERP_KERNEL::Exception(msg2);
4594 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4595 ret->applyLin(1./val,0);
4596 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4597 ret2->setArray(ret);
4602 if(!self->getArray())
4603 throw INTERP_KERNEL::Exception(msg2);
4604 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4605 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4606 ret2->setArray(ret);
4611 if(!self->getArray())
4612 throw INTERP_KERNEL::Exception(msg2);
4613 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4614 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4615 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4616 ret2->setArray(ret);
4621 if(!self->getArray())
4622 throw INTERP_KERNEL::Exception(msg2);
4623 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4624 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4625 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4626 ret2->setArray(ret);
4630 { throw INTERP_KERNEL::Exception(msg); }
4634 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4636 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4639 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4641 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.";
4642 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4645 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4647 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4649 return (*self)^(*other);
4651 throw INTERP_KERNEL::Exception(msg);
4656 DataArrayDoubleTuple *aa;
4657 std::vector<double> bb;
4659 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4664 if(!self->getArray())
4665 throw INTERP_KERNEL::Exception(msg2);
4666 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4668 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4669 ret2->setArray(ret);
4674 if(!self->getArray())
4675 throw INTERP_KERNEL::Exception(msg2);
4676 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4677 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4678 ret2->setArray(ret);
4683 if(!self->getArray())
4684 throw INTERP_KERNEL::Exception(msg2);
4685 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4686 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4687 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4688 ret2->setArray(ret);
4693 if(!self->getArray())
4694 throw INTERP_KERNEL::Exception(msg2);
4695 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4696 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4697 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4698 ret2->setArray(ret);
4702 { throw INTERP_KERNEL::Exception(msg); }
4706 MEDCouplingFieldDouble *__neg__() const
4708 return self->negate();
4711 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4713 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.";
4714 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4717 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4719 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4723 Py_XINCREF(trueSelf);
4727 throw INTERP_KERNEL::Exception(msg);
4732 DataArrayDoubleTuple *aa;
4733 std::vector<double> bb;
4735 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4740 if(!self->getArray())
4741 throw INTERP_KERNEL::Exception(msg2);
4742 self->getArray()->applyLin(1.,val);
4743 Py_XINCREF(trueSelf);
4748 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4751 Py_XINCREF(trueSelf);
4756 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4757 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4758 ret2->setArray(aaa);
4760 Py_XINCREF(trueSelf);
4765 if(!self->getArray())
4766 throw INTERP_KERNEL::Exception(msg2);
4767 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4768 self->getArray()->addEqual(aaa);
4769 Py_XINCREF(trueSelf);
4773 { throw INTERP_KERNEL::Exception(msg); }
4777 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4779 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.";
4780 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4783 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4785 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4789 Py_XINCREF(trueSelf);
4793 throw INTERP_KERNEL::Exception(msg);
4798 DataArrayDoubleTuple *aa;
4799 std::vector<double> bb;
4801 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4806 if(!self->getArray())
4807 throw INTERP_KERNEL::Exception(msg2);
4808 self->getArray()->applyLin(1.,-val);
4809 Py_XINCREF(trueSelf);
4814 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4817 Py_XINCREF(trueSelf);
4822 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4823 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4824 ret2->setArray(aaa);
4826 Py_XINCREF(trueSelf);
4831 if(!self->getArray())
4832 throw INTERP_KERNEL::Exception(msg2);
4833 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4834 self->getArray()->substractEqual(aaa);
4835 Py_XINCREF(trueSelf);
4839 { throw INTERP_KERNEL::Exception(msg); }
4843 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4845 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.";
4846 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4849 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4851 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4855 Py_XINCREF(trueSelf);
4859 throw INTERP_KERNEL::Exception(msg);
4864 DataArrayDoubleTuple *aa;
4865 std::vector<double> bb;
4867 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4872 if(!self->getArray())
4873 throw INTERP_KERNEL::Exception(msg2);
4874 self->getArray()->applyLin(val,0);
4875 Py_XINCREF(trueSelf);
4880 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4883 Py_XINCREF(trueSelf);
4888 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4889 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4890 ret2->setArray(aaa);
4892 Py_XINCREF(trueSelf);
4897 if(!self->getArray())
4898 throw INTERP_KERNEL::Exception(msg2);
4899 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4900 self->getArray()->multiplyEqual(aaa);
4901 Py_XINCREF(trueSelf);
4905 { throw INTERP_KERNEL::Exception(msg); }
4909 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4911 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.";
4912 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4915 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4917 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4921 Py_XINCREF(trueSelf);
4925 throw INTERP_KERNEL::Exception(msg);
4930 DataArrayDoubleTuple *aa;
4931 std::vector<double> bb;
4933 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4939 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4940 if(!self->getArray())
4941 throw INTERP_KERNEL::Exception(msg2);
4942 self->getArray()->applyLin(1./val,0);
4943 Py_XINCREF(trueSelf);
4948 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4951 Py_XINCREF(trueSelf);
4956 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4957 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4958 ret2->setArray(aaa);
4960 Py_XINCREF(trueSelf);
4965 if(!self->getArray())
4966 throw INTERP_KERNEL::Exception(msg2);
4967 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4968 self->getArray()->divideEqual(aaa);
4969 Py_XINCREF(trueSelf);
4973 { throw INTERP_KERNEL::Exception(msg); }
4977 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4979 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.";
4980 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4983 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4985 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4989 Py_XINCREF(trueSelf);
4993 throw INTERP_KERNEL::Exception(msg);
4998 DataArrayDoubleTuple *aa;
4999 std::vector<double> bb;
5001 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
5006 if(!self->getArray())
5007 throw INTERP_KERNEL::Exception(msg2);
5008 self->getArray()->applyPow(val);
5009 Py_XINCREF(trueSelf);
5014 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5017 Py_XINCREF(trueSelf);
5022 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5023 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5024 ret2->setArray(aaa);
5026 Py_XINCREF(trueSelf);
5031 if(!self->getArray())
5032 throw INTERP_KERNEL::Exception(msg2);
5033 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
5034 self->getArray()->powEqual(aaa);
5035 Py_XINCREF(trueSelf);
5039 { throw INTERP_KERNEL::Exception(msg); }
5043 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
5045 std::vector<const MEDCouplingFieldDouble *> tmp;
5046 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5047 return MEDCouplingFieldDouble::MergeFields(tmp);
5050 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
5052 std::vector<const MEDCouplingFieldDouble *> tmp;
5053 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5054 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
5057 PyObject *getTinySerializationInformation() const
5059 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
5062 PyObject *serialize() const
5064 return field_serialize<double>(self);
5067 PyObject *__getstate__() const
5069 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
5072 void __setstate__(PyObject *inp)
5074 field__setstate__<double>(self,inp);
5079 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5082 int getNumberOfFields() const;
5083 MEDCouplingMultiFields *deepCopy() const;
5084 virtual std::string simpleRepr() const;
5085 virtual std::string advancedRepr() const;
5086 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5087 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5088 virtual void checkConsistencyLight() const;
5091 std::string __str__() const
5093 return self->simpleRepr();
5095 static MEDCouplingMultiFields *New(PyObject *li)
5097 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5098 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5100 std::vector<MEDCouplingFieldDouble *> fs(sz);
5101 for(int i=0;i<sz;i++)
5102 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5103 return MEDCouplingMultiFields::New(fs);
5105 MEDCouplingMultiFields(PyObject *li)
5107 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5108 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5110 std::vector<MEDCouplingFieldDouble *> fs(sz);
5111 for(int i=0;i<sz;i++)
5112 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5113 return MEDCouplingMultiFields::New(fs);
5115 PyObject *getFields() const
5117 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5118 int sz=fields.size();
5119 PyObject *res = PyList_New(sz);
5120 for(int i=0;i<sz;i++)
5124 fields[i]->incrRef();
5125 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5129 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5134 PyObject *getFieldAtPos(int id) const
5136 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5140 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5143 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5145 PyObject *getMeshes() const
5147 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5149 PyObject *res = PyList_New(sz);
5150 for(int i=0;i<sz;i++)
5155 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5159 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5164 PyObject *getDifferentMeshes() const
5166 std::vector<int> refs;
5167 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5169 PyObject *res = PyList_New(sz);
5170 for(int i=0;i<sz;i++)
5175 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5179 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5183 PyObject *ret=PyTuple_New(2);
5184 PyTuple_SetItem(ret,0,res);
5185 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5188 PyObject *getArrays() const
5190 std::vector<DataArrayDouble *> ms=self->getArrays();
5192 PyObject *res = PyList_New(sz);
5193 for(int i=0;i<sz;i++)
5198 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5202 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5207 PyObject *getDifferentArrays() const
5209 std::vector< std::vector<int> > refs;
5210 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5212 PyObject *res = PyList_New(sz);
5213 PyObject *res2 = PyList_New(sz);
5214 for(int i=0;i<sz;i++)
5219 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5223 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5225 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5228 PyObject *ret=PyTuple_New(2);
5229 PyTuple_SetItem(ret,0,res);
5230 PyTuple_SetItem(ret,1,res2);
5236 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5239 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5240 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5241 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5242 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5243 void setTimeUnit(const std::string& unit);
5244 std::string getTimeUnit() const;
5245 void setTime(double val, int iteration, int order);
5246 void setArray(DataArrayInt *array);
5247 MEDCouplingFieldInt *deepCopy() const;
5248 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5249 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5250 MEDCouplingFieldDouble *convertToDblField() const;
5251 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5253 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5255 return MEDCouplingFieldInt::New(type,td);
5258 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5260 return MEDCouplingFieldInt::New(ft,td);
5263 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5266 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5267 PyObject *ret=PyTuple_New(2);
5268 PyObject *ret0Py=ret0?Py_True:Py_False;
5270 PyTuple_SetItem(ret,0,ret0Py);
5271 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5275 std::string __str__() const
5277 return self->simpleRepr();
5280 std::string __repr__() const
5282 std::ostringstream oss;
5283 self->reprQuickOverview(oss);
5287 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5289 return fieldT_buildSubPart(self,li);
5292 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5294 return fieldT__getitem__(self,li);
5297 DataArrayInt *getArray()
5299 DataArrayInt *ret=self->getArray();
5308 double tmp0=self->getTime(tmp1,tmp2);
5309 PyObject *res = PyList_New(3);
5310 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5311 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5312 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5316 PyObject *getTinySerializationInformation() const
5318 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5321 PyObject *serialize() const
5323 return field_serialize<int>(self);
5326 PyObject *__getstate__() const
5328 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5331 void __setstate__(PyObject *inp)
5333 field__setstate__<int>(self,inp);
5338 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5341 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5342 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5343 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5344 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5345 void setTimeUnit(const std::string& unit);
5346 std::string getTimeUnit() const;
5347 void setTime(double val, int iteration, int order);
5348 void setArray(DataArrayFloat *array);
5349 MEDCouplingFieldFloat *deepCopy() const;
5350 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5351 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5352 MEDCouplingFieldDouble *convertToDblField() const;
5353 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5355 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5357 return MEDCouplingFieldFloat::New(type,td);
5360 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5362 return MEDCouplingFieldFloat::New(ft,td);
5365 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5368 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5369 PyObject *ret=PyTuple_New(2);
5370 PyObject *ret0Py=ret0?Py_True:Py_False;
5372 PyTuple_SetItem(ret,0,ret0Py);
5373 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5377 std::string __str__() const
5379 return self->simpleRepr();
5382 std::string __repr__() const
5384 std::ostringstream oss;
5385 self->reprQuickOverview(oss);
5389 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5391 return fieldT_buildSubPart(self,li);
5394 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5396 return fieldT__getitem__(self,li);
5399 DataArrayFloat *getArray()
5401 DataArrayFloat *ret=self->getArray();
5410 double tmp0=self->getTime(tmp1,tmp2);
5411 PyObject *res = PyList_New(3);
5412 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5413 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5414 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5418 PyObject *getTinySerializationInformation() const
5420 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5423 PyObject *serialize() const
5425 return field_serialize<float>(self);
5428 PyObject *__getstate__() const
5430 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5433 void __setstate__(PyObject *inp)
5435 field__setstate__<float>(self,inp);
5440 class MEDCouplingDefinitionTime
5443 MEDCouplingDefinitionTime();
5444 void assign(const MEDCouplingDefinitionTime& other);
5445 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5446 double getTimeResolution() const;
5447 std::vector<double> getHotSpotsTime() const;
5450 std::string __str__() const
5452 std::ostringstream oss;
5453 self->appendRepr(oss);
5457 PyObject *getIdsOnTimeRight(double tm) const
5459 int meshId,arrId,arrIdInField,fieldId;
5460 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5461 PyObject *res=PyList_New(4);
5462 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5463 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5464 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5465 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5469 PyObject *getIdsOnTimeLeft(double tm) const
5471 int meshId,arrId,arrIdInField,fieldId;
5472 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5473 PyObject *res=PyList_New(4);
5474 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5475 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5476 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5477 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5483 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5486 double getTimeTolerance() const;
5487 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5491 MEDCouplingFieldOverTime(PyObject *li)
5493 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5494 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5496 std::vector<MEDCouplingFieldDouble *> fs(sz);
5497 for(int i=0;i<sz;i++)
5498 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5499 return MEDCouplingFieldOverTime::New(fs);
5501 std::string __str__() const
5503 return self->simpleRepr();
5505 static MEDCouplingFieldOverTime *New(PyObject *li)
5507 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5508 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5510 std::vector<MEDCouplingFieldDouble *> fs(sz);
5511 for(int i=0;i<sz;i++)
5512 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5513 return MEDCouplingFieldOverTime::New(fs);
5518 class MEDCouplingCartesianAMRMesh;
5520 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5523 int getNumberOfCellsRecursiveWithOverlap() const;
5524 int getNumberOfCellsRecursiveWithoutOverlap() const;
5525 int getMaxNumberOfLevelsRelativeToThis() const;
5528 MEDCouplingCartesianAMRMeshGen *getMesh() const
5530 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5538 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5541 int getNumberOfOverlapedCellsForFather() const;
5542 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5543 std::vector<int> computeCellGridSt() const;
5546 PyObject *getBLTRRange() const
5548 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
5549 return convertFromVectorPairInt(ret);
5552 PyObject *getBLTRRangeRelativeToGF() const
5554 std::vector< std::pair<int,int> > ret(self->getBLTRRangeRelativeToGF());
5555 return convertFromVectorPairInt(ret);
5558 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
5560 std::vector< std::pair<int,int> > inp;
5561 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5562 self->addPatch(inp,factors);
5565 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
5567 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5569 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5570 if(patchId==mesh->getNumberOfPatches())
5572 std::ostringstream oss;
5573 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5574 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5577 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5583 void __delitem__(int patchId)
5585 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5587 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5588 mesh->removePatch(patchId);
5593 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5595 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5596 return mesh->getNumberOfPatches();
5601 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5605 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5608 int getAbsoluteLevel() const;
5609 int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5610 std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5611 int getSpaceDimension() const;
5612 const std::vector<int>& getFactors() const;
5613 void setFactors(const std::vector<int>& newFactors);
5614 int getMaxNumberOfLevelsRelativeToThis() const;
5615 int getNumberOfCellsAtCurrentLevel() const;
5616 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const;
5617 int getNumberOfCellsRecursiveWithOverlap() const;
5618 int getNumberOfCellsRecursiveWithoutOverlap() const;
5619 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const;
5620 virtual void detachFromFather();
5622 int getNumberOfPatches() const;
5623 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5624 MEDCouplingUMesh *buildUnstructured() const;
5625 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const;
5626 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const;
5627 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5628 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5629 void removeAllPatches();
5630 void removePatch(int patchId);
5631 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors);
5632 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps);
5633 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const;
5634 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5635 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const;
5636 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const;
5637 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5638 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5639 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const;
5640 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const;
5641 std::string buildPythonDumpOfThis() const;
5644 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
5646 std::vector< std::pair<int,int> > inp;
5647 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5648 self->addPatch(inp,factors);
5651 PyObject *getPatches() const
5653 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5655 PyObject *ret = PyList_New(sz);
5656 for(int i=0;i<sz;i++)
5658 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5661 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5666 // agy : don't know why typemap fails here ??? let it in the extend section
5667 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5669 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5672 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const
5674 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5675 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5681 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const
5683 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5684 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5690 virtual PyObject *positionRelativeToGodFather() const
5692 std::vector<int> out1;
5693 std::vector< std::pair<int,int> > out0(self->positionRelativeToGodFather(out1));
5694 PyObject *ret(PyTuple_New(2));
5695 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5696 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5700 virtual PyObject *retrieveGridsAt(int absoluteLev) const
5702 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5704 PyObject *ret = PyList_New(sz);
5705 for(int i=0;i<sz;i++)
5706 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5710 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
5712 std::vector<const DataArrayDouble *> inp;
5713 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5714 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5717 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5719 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5725 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5727 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5733 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const
5735 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5741 MEDCouplingIMesh *getImageMesh() const
5743 const MEDCouplingIMesh *ret(self->getImageMesh());
5746 return const_cast<MEDCouplingIMesh *>(ret);
5749 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
5751 if(patchId==self->getNumberOfPatches())
5753 std::ostringstream oss;
5754 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5755 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5758 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5764 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5766 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5767 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5768 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5771 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5773 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5774 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5775 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5778 void __delitem__(int patchId)
5780 self->removePatch(patchId);
5785 return self->getNumberOfPatches();
5790 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5794 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5797 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5800 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5802 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5803 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5804 const int *nodeStrctPtr(0);
5805 const double *originPtr(0),*dxyzPtr(0);
5807 std::vector<int> bb0;
5808 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5811 std::vector<double> bb,bb2;
5813 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5814 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5816 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5819 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5821 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5822 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5823 std::vector< std::vector<int> > inp2;
5824 convertPyToVectorOfVectorOfInt(factors,inp2);
5825 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5828 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5830 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5833 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5835 return MEDCouplingCartesianAMRMesh::New(mesh);
5840 class MEDCouplingDataForGodFather : public RefCountObject
5843 virtual void synchronizeFineToCoarse();
5844 virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev);
5845 virtual void synchronizeCoarseToFine();
5846 virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev);
5847 virtual void synchronizeAllGhostZones();
5848 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5849 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level);
5850 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level);
5851 virtual void alloc();
5852 virtual void dealloc();
5855 MEDCouplingCartesianAMRMesh *getMyGodFather()
5857 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5865 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5868 int getNumberOfLevels() const;
5869 MEDCouplingAMRAttribute *deepCopy() const;
5870 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5871 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5872 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5873 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5874 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5875 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5876 std::string writeVTHB(const std::string& fileName) const;
5879 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
5881 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5882 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5883 MEDCouplingAMRAttribute *ret(0);
5886 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5887 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5889 catch(INTERP_KERNEL::Exception&)
5891 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5892 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5897 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
5899 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5902 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5904 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5905 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5911 void spillInfoOnComponents(PyObject *compNames)
5913 std::vector< std::vector<std::string> > compNamesCpp;
5914 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5915 self->spillInfoOnComponents(compNamesCpp);
5918 void spillNatures(PyObject *nfs)
5920 std::vector<int> inp0;
5921 if(!fillIntVector(nfs,inp0))
5922 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5923 std::size_t sz(inp0.size());
5924 std::vector<NatureOfField> inp00(sz);
5925 for(std::size_t i=0;i<sz;i++)
5926 inp00[i]=(NatureOfField)inp0[i];
5927 self->spillNatures(inp00);
5930 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5932 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5933 int sz((int)ret.size());
5934 PyObject *retPy(PyList_New(sz));
5935 for(int i=0;i<sz;i++)
5936 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5942 class DenseMatrix : public RefCountObject, public TimeLabel
5945 static DenseMatrix *New(int nbRows, int nbCols);
5946 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols);
5947 DenseMatrix *deepCopy() const;
5948 DenseMatrix *shallowCpy() const;
5950 int getNumberOfRows() const;
5951 int getNumberOfCols() const;
5952 int getNbOfElems() const;
5953 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1);
5954 void reShape(int nbRows, int nbCols);
5957 bool isEqual(const DenseMatrix& other, double eps) const;
5958 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5959 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5962 DenseMatrix(int nbRows, int nbCols)
5964 return DenseMatrix::New(nbRows,nbCols);
5967 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols)
5969 return DenseMatrix::New(array,nbRows,nbCols);
5972 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5975 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5976 PyObject *ret=PyTuple_New(2);
5977 PyObject *ret0Py=ret0?Py_True:Py_False;
5979 PyTuple_SetItem(ret,0,ret0Py);
5980 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5984 DataArrayDouble *getData()
5986 DataArrayDouble *ret(self->getData());
5992 DenseMatrix *__add__(const DenseMatrix *other)
5994 return MEDCoupling::DenseMatrix::Add(self,other);
5997 DenseMatrix *__sub__(const DenseMatrix *other)
5999 return MEDCoupling::DenseMatrix::Substract(self,other);
6002 DenseMatrix *__mul__(const DenseMatrix *other)
6004 return MEDCoupling::DenseMatrix::Multiply(self,other);
6007 DenseMatrix *__mul__(const DataArrayDouble *other)
6009 return MEDCoupling::DenseMatrix::Multiply(self,other);
6012 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
6014 self->addEqual(other);
6015 Py_XINCREF(trueSelf);
6019 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
6021 self->substractEqual(other);
6022 Py_XINCREF(trueSelf);
6026 PyObject *toNumPyMatrix() // not const. It is not a bug !
6028 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
6037 def MEDCouplingUMeshReduce(self):
6038 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
6039 def MEDCouplingCMeshReduce(self):
6040 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
6041 def MEDCouplingIMeshReduce(self):
6042 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
6043 def MEDCouplingMappedExtrudedMeshReduce(self):
6044 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
6045 def MEDCouplingCurveLinearMeshReduce(self):
6046 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
6047 def MEDCoupling1SGTUMeshReduce(self):
6048 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
6049 def MEDCoupling1DGTUMeshReduce(self):
6050 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
6051 def MEDCouplingFieldDoubleReduce(self):
6052 self.checkConsistencyLight()
6053 d=(self.getTypeOfField(),self.getTimeDiscretization())
6054 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
6055 def MEDCouplingFieldIntReduce(self):
6056 self.checkConsistencyLight()
6057 d=(self.getTypeOfField(),self.getTimeDiscretization())
6058 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
6059 def MEDCouplingFieldFloatReduce(self):
6060 self.checkConsistencyLight()
6061 d=(self.getTypeOfField(),self.getTimeDiscretization())
6062 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
6067 __filename=os.environ.get('PYTHONSTARTUP')
6068 if __filename and os.path.isfile(__filename):
6069 exec(open(__filename).read())