1 // Copyright (C) 2017-2023 CEA, EDF
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 "MEDCouplingMemArray.txx"
31 #include "MEDCouplingUMesh.hxx"
32 #include "MEDCouplingMappedExtrudedMesh.hxx"
33 #include "MEDCouplingCMesh.hxx"
34 #include "MEDCouplingIMesh.hxx"
35 #include "MEDCouplingMap.txx"
36 #include "MEDCouplingCurveLinearMesh.hxx"
37 #include "MEDCoupling1GTUMesh.hxx"
38 #include "MEDCouplingField.hxx"
39 #include "MEDCouplingFieldDouble.hxx"
40 #include "MEDCouplingFieldInt32.hxx"
41 #include "MEDCouplingFieldInt64.hxx"
42 #include "MEDCouplingFieldFloat.hxx"
43 #include "MEDCouplingFieldTemplate.hxx"
44 #include "MEDCouplingGaussLocalization.hxx"
46 #include "MEDCouplingMultiFields.hxx"
47 #include "MEDCouplingFieldOverTime.hxx"
48 #include "MEDCouplingDefinitionTime.hxx"
49 #include "MEDCouplingFieldDiscretization.hxx"
50 #include "MEDCouplingFieldDiscretizationOnNodesFE.hxx"
51 #include "MEDCouplingCartesianAMRMesh.hxx"
52 #include "MEDCouplingAMRAttribute.hxx"
53 #include "MEDCouplingMatrix.hxx"
54 #include "MEDCouplingPartDefinition.hxx"
55 #include "MEDCouplingSkyLineArray.hxx"
56 #include "MEDCouplingTypemaps.i"
58 #include "InterpKernelAutoPtr.hxx"
59 #include "BoxSplittingOptions.hxx"
61 using namespace MEDCoupling;
62 using namespace INTERP_KERNEL;
66 %template(dvec) std::vector<double>;
67 %template(svec) std::vector<std::string>;
71 #ifndef MEDCOUPLING_USE_64BIT_IDS
72 //typedef std::int32_t mcIdType;
74 typedef DataArrayInt32 DataArrayIdType;
75 %template(ivec) std::vector<int>;
76 %template(i64vec) std::vector<int64_t>;
78 //typedef std::int64_t mcIdType;
79 typedef DataArrayInt64 DataArrayIdType;
81 %template(ivec) std::vector<long long>;
82 typedef long long mcIdType;
84 %template(ivec) std::vector<long>;
85 typedef long int mcIdType;
87 %template(i32vec) std::vector<int>;
90 typedef long long mcPyPtrType;
92 typedef long mcPyPtrType;
96 %typemap(out) MEDCoupling::MEDCouplingMesh*
98 $result=convertMesh($1,$owner);
101 %typemap(out) MEDCouplingMesh*
103 $result=convertMesh($1,$owner);
108 %typemap(out) MEDCoupling::MEDCouplingPointSet*
110 $result=convertMesh($1,$owner);
113 %typemap(out) MEDCouplingPointSet*
115 $result=convertMesh($1,$owner);
120 %typemap(out) MEDCouplingCartesianAMRPatchGen*
122 $result=convertCartesianAMRPatch($1,$owner);
127 %typemap(out) MEDCouplingCartesianAMRMeshGen*
129 $result=convertCartesianAMRMesh($1,$owner);
134 %typemap(out) MEDCouplingDataForGodFather*
136 $result=convertDataForGodFather($1,$owner);
141 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
143 $result=convertMesh($1,$owner);
146 %typemap(out) MEDCoupling1GTUMesh*
148 $result=convertMesh($1,$owner);
153 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
155 $result=convertMesh($1,$owner);
158 %typemap(out) MEDCouplingStructuredMesh*
160 $result=convertMesh($1,$owner);
165 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
167 $result=convertFieldDiscretization($1,$owner);
170 %typemap(out) MEDCouplingFieldDiscretization*
172 $result=convertFieldDiscretization($1,$owner);
177 %typemap(out) MEDCoupling::MEDCouplingField*
179 $result=convertField($1,$owner);
182 %typemap(out) MEDCouplingField*
184 $result=convertField($1,$owner);
189 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
191 $result=convertMultiFields($1,$owner);
194 %typemap(out) MEDCouplingMultiFields*
196 $result=convertMultiFields($1,$owner);
201 %typemap(out) MEDCoupling::PartDefinition*
203 $result=convertPartDefinition($1,$owner);
206 %typemap(out) PartDefinition*
208 $result=convertPartDefinition($1,$owner);
213 %init %{ import_array(); %}
216 %init %{ initializeMe(); %}
218 %feature("autodoc", "1");
219 %feature("docstring");
221 %newobject MEDCoupling::MEDCouplingFieldDiscretizationOnNodesFE::getCooInRefElement;
222 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
223 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
224 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
251 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
252 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
253 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
254 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
255 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
256 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
257 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
258 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
259 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
260 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
261 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
262 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
263 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
264 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
265 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
266 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
267 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
268 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
269 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
270 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
271 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
272 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
273 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
274 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
275 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
276 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
277 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
278 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
279 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
280 %newobject MEDCoupling::MEDCouplingFieldInt32::New;
281 %newobject MEDCoupling::MEDCouplingFieldInt32::convertToDblField;
282 %newobject MEDCoupling::MEDCouplingFieldInt32::getArray;
283 %newobject MEDCoupling::MEDCouplingFieldInt32::deepCopy;
284 %newobject MEDCoupling::MEDCouplingFieldInt32::clone;
285 %newobject MEDCoupling::MEDCouplingFieldInt32::cloneWithMesh;
286 %newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPart;
287 %newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPartRange;
288 %newobject MEDCoupling::MEDCouplingFieldInt32::__getitem__;
289 %newobject MEDCoupling::MEDCouplingFieldInt64::New;
290 %newobject MEDCoupling::MEDCouplingFieldInt64::convertToDblField;
291 %newobject MEDCoupling::MEDCouplingFieldInt64::getArray;
292 %newobject MEDCoupling::MEDCouplingFieldInt64::deepCopy;
293 %newobject MEDCoupling::MEDCouplingFieldInt64::clone;
294 %newobject MEDCoupling::MEDCouplingFieldInt64::cloneWithMesh;
295 %newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPart;
296 %newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPartRange;
297 %newobject MEDCoupling::MEDCouplingFieldInt64::__getitem__;
298 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
299 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
300 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
301 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
302 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
303 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
304 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
305 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
306 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
307 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
308 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
309 %newobject MEDCoupling::MEDCouplingMesh::clone;
310 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
311 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
312 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
313 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
314 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
315 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
316 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
317 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
318 %newobject MEDCoupling::MEDCouplingMesh::computeMeshCenterOfMass;
319 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
320 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
321 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
322 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
323 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
324 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
325 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
326 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
327 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
328 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
329 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
330 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
331 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
332 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
333 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
334 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
335 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
336 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
337 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
338 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
339 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
340 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
341 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
342 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
343 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
344 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
345 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
346 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
347 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
348 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
349 %newobject MEDCoupling::MEDCouplingUMesh::New;
350 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
351 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
352 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
353 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
354 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
355 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
356 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
357 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
358 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
359 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
360 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
361 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
362 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
363 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
364 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
365 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
366 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
367 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
368 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
369 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
370 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
371 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
372 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
373 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
374 %newobject MEDCoupling::MEDCouplingUMesh::findNodesToDuplicate;
375 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
376 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
377 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
378 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
379 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
380 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
381 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
382 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
383 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
384 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
385 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
386 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
387 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
388 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
389 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
390 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
391 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
392 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
393 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
394 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
395 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
396 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
397 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
398 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
399 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
400 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
401 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
402 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
403 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
404 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
405 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
406 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
407 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
408 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
409 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
410 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
411 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
412 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
413 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
414 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
415 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
416 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeTriangleHeight;
417 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
418 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
419 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
420 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
421 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
422 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
423 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
424 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
425 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
426 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
427 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
428 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
429 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
430 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
431 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
432 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
433 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
434 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
435 %newobject MEDCoupling::MEDCouplingCMesh::New;
436 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
437 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
438 %newobject MEDCoupling::MEDCouplingIMesh::New;
439 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
440 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
441 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
442 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
443 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
444 %newobject MEDCoupling::MEDCouplingMultiFields::New;
445 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
446 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
447 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
448 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
449 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
450 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
451 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
452 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
453 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
454 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
455 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
456 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
457 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
458 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
459 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
460 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
461 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
462 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
463 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
464 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
465 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
466 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
467 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
468 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
469 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
470 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
471 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
472 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
473 %newobject MEDCoupling::DenseMatrix::New;
474 %newobject MEDCoupling::DenseMatrix::deepCopy;
475 %newobject MEDCoupling::DenseMatrix::shallowCpy;
476 %newobject MEDCoupling::DenseMatrix::getData;
477 %newobject MEDCoupling::DenseMatrix::matVecMult;
478 %newobject MEDCoupling::DenseMatrix::MatVecMult;
479 %newobject MEDCoupling::DenseMatrix::__add__;
480 %newobject MEDCoupling::DenseMatrix::__sub__;
481 %newobject MEDCoupling::DenseMatrix::__mul__;
482 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
483 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
484 %newobject MEDCoupling::MEDCouplingGaussLocalization::getShapeFunctionValues;
485 %newobject MEDCoupling::MEDCouplingGaussLocalization::getDerivativeOfShapeFunctionValues;
486 %newobject MEDCoupling::MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf;
487 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
488 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
489 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
490 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
491 %newobject MEDCoupling::MEDCouplingSkyLineArray::groupPacks;
492 %newobject MEDCoupling::MEDCouplingSkyLineArray::uniqueNotSortedByPack;
493 %newobject MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks;
494 %newobject MEDCoupling::MEDCouplingSkyLineArray::deepCopy;
496 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
497 %feature("unref") MEDCouplingMesh "$this->decrRef();"
498 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
499 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
500 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
501 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
502 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
503 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
504 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
505 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
506 %feature("unref") MEDCouplingField "$this->decrRef();"
507 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
508 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
509 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
510 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
511 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
512 %feature("unref") MEDCouplingFieldDiscretizationOnNodesFE "$this->decrRef();"
513 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
514 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
515 %feature("unref") MEDCouplingFieldInt32 "$this->decrRef();"
516 %feature("unref") MEDCouplingFieldInt64 "$this->decrRef();"
517 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
518 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
519 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
520 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
521 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
522 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
523 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
524 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
525 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
526 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
527 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
528 %feature("unref") DenseMatrix "$this->decrRef();"
529 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
531 %rename(assign) *::operator=;
532 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
533 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
534 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
535 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
539 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
540 // on the Python side. Must be put BEFORE the %rename clause:
541 %exceptionclass INTERP_KERNEL::Exception;
542 %rename (InterpKernelException) INTERP_KERNEL::Exception;
544 %include "MEDCouplingRefCountObject.i"
545 %include "MEDCouplingMemArray.i"
549 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
550 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
551 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
552 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
553 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
554 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
555 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
556 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
557 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
563 PyObject *med2vtk_cell_types()
565 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
566 PyObject *ret(PyList_New(sz));
567 for(Py_ssize_t i=0;i<sz;i++)
569 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
570 PyList_SetItem(ret,i,PyInt_FromLong(elt));
575 PyObject *vtk2med_cell_types()
577 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
578 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
579 auto szOut(maxElt+1);
580 std::vector< mcIdType > retCpp(szOut,-1);
582 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
584 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
588 PyObject *ret(PyList_New(szOut));
590 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
591 PyList_SetItem(ret,id,PyInt_FromLong(*it));
595 PyObject *AllGeometricTypes()
597 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
598 PyObject *ret(PyList_New(sz));
599 for(Py_ssize_t i=0;i<sz;i++)
600 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
605 namespace INTERP_KERNEL
608 * \class BoxSplittingOptions
609 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
611 class BoxSplittingOptions
614 BoxSplittingOptions();
616 double getEfficiencyGoal() const;
617 void setEfficiencyGoal(double efficiency);
618 double getEfficiencyThreshold() const;
619 void setEfficiencyThreshold(double efficiencyThreshold);
620 int getMinimumPatchLength() const;
621 void setMinimumPatchLength(int minPatchLength);
622 int getMaximumPatchLength() const;
623 void setMaximumPatchLength(int maxPatchLength);
624 int getMaximumNbOfCellsInPatch() const;
625 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
626 void copyOptions(const BoxSplittingOptions & other);
627 std::string printOptions() const;
630 std::string __str__() const
632 return self->printOptions();
638 namespace MEDCoupling
655 CONST_ON_TIME_INTERVAL = 7
656 } TypeOfTimeDiscretization;
664 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
665 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
667 } MEDCouplingMeshType;
669 class DataArrayInt32;
670 class DataArrayInt64;
671 class DataArrayDouble;
672 class MEDCouplingUMesh;
673 class MEDCouplingCMesh;
674 class MEDCouplingFieldDouble;
676 %extend RefCountObject
678 std::string getHiddenCppPointer() const
680 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
685 %extend MEDCouplingGaussLocalization
687 std::string __str__() const
689 return self->getStringRepr();
692 std::string __repr__() const
694 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
695 oss << self->getStringRepr();
702 class MEDCouplingMesh : public RefCountObject, public TimeLabel
705 void setName(const std::string& name);
706 std::string getName() const;
707 void setDescription(const std::string& descr);
708 std::string getDescription() const;
709 void setTime(double val, int iteration, int order);
710 void setTimeUnit(const std::string& unit);
711 std::string getTimeUnit() const;
712 virtual MEDCouplingMeshType getType() const;
713 bool isStructured() const;
714 virtual MEDCouplingMesh *deepCopy() const;
715 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
716 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
717 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
718 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
719 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
720 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
721 virtual void checkConsistencyLight() const;
722 virtual void checkConsistency(double eps=1e-12) const;
723 virtual int getNumberOfCells() const;
724 virtual int getNumberOfNodes() const;
725 virtual int getSpaceDimension() const;
726 virtual int getMeshDimension() const;
727 virtual DataArrayDouble *getCoordinatesAndOwner() const;
728 virtual DataArrayDouble *computeCellCenterOfMass() const;
729 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
730 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
731 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
732 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
733 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
734 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
735 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
736 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
737 virtual std::string simpleRepr() const;
738 virtual std::string advancedRepr() const;
739 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
740 virtual std::string getVTKFileExtension() const;
741 std::string getVTKFileNameOf(const std::string& fileName) const;
743 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
744 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
745 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
746 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
747 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
748 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
749 virtual MEDCouplingUMesh *buildUnstructured() const;
750 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
751 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
752 virtual DataArrayIdType *simplexize(int policy);
753 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
754 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
755 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
756 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
757 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
758 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
759 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
760 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
763 std::string __str__() const
765 return self->simpleRepr();
768 DataArrayDouble *computeMeshCenterOfMass() const
770 MCAuto<DataArrayDouble> ret(self->computeMeshCenterOfMass());
777 double tmp0=self->getTime(tmp1,tmp2);
778 PyObject *res = PyList_New(3);
779 PyList_SetItem(res,0,SWIG_From_double(tmp0));
780 PyList_SetItem(res,1,SWIG_From_int(tmp1));
781 PyList_SetItem(res,2,SWIG_From_int(tmp2));
785 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
787 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
788 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
794 mcIdType getCellContainingPoint(PyObject *p, double eps) const
798 DataArrayDoubleTuple *aa;
799 std::vector<double> bb;
801 int spaceDim=self->getSpaceDimension();
802 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
803 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
804 return self->getCellContainingPoint(pos,eps);
807 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
811 DataArrayDoubleTuple *aa;
812 std::vector<double> bb;
814 int spaceDim=self->getSpaceDimension();
815 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
816 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
817 MCAuto<DataArrayIdType> elts,eltsIndex;
818 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
819 PyObject *ret=PyTuple_New(2);
820 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
821 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
825 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
829 DataArrayDoubleTuple *aa;
830 std::vector<double> bb;
832 int spaceDim=self->getSpaceDimension();
833 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
834 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
835 MCAuto<DataArrayIdType> elts,eltsIndex;
836 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
837 PyObject *ret=PyTuple_New(2);
838 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
839 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
843 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
845 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
846 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
849 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
851 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
852 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
855 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
859 DataArrayDoubleTuple *aa;
860 std::vector<double> bb;
862 int spaceDim=self->getSpaceDimension();
863 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
864 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
865 std::vector<mcIdType> elts;
866 self->getCellsContainingPoint(pos,eps,elts);
867 DataArrayIdType *ret=DataArrayIdType::New();
868 ret->alloc((int)elts.size(),1);
869 std::copy(elts.begin(),elts.end(),ret->getPointer());
870 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
873 virtual PyObject *getReverseNodalConnectivity() const
875 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
876 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
877 self->getReverseNodalConnectivity(d0,d1);
878 PyObject *ret=PyTuple_New(2);
879 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
880 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
884 void renumberCells(PyObject *li, bool check=true)
887 mcIdType v0; std::vector<mcIdType> v1;
888 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
889 self->renumberCells(ids,check);
892 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
894 DataArrayIdType *cellCor, *nodeCor;
895 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
896 PyObject *res = PyList_New(2);
897 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
898 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
902 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
904 DataArrayIdType *cellCor=0,*nodeCor=0;
905 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
906 PyObject *res = PyList_New(2);
907 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
908 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
912 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
914 DataArrayIdType *cellCor=0;
915 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
919 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
922 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
923 if (!SWIG_IsOK(res1))
926 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
927 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
931 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
933 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
934 da2->checkAllocated();
935 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
938 PyObject *getNodeIdsOfCell(int cellId) const
940 std::vector<mcIdType> conn;
941 self->getNodeIdsOfCell(cellId,conn);
942 return convertIntArrToPyList2(conn);
945 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
947 std::vector<double> coo;
948 self->getCoordinatesOfNode(nodeId,coo);
949 return convertDblArrToPyList2(coo);
952 void scale(PyObject *point, double factor)
956 DataArrayDoubleTuple *aa;
957 std::vector<double> bb;
959 int spaceDim=self->getSpaceDimension();
960 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
961 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
962 self->scale(pointPtr,factor);
965 PyObject *getBoundingBox() const
967 int spaceDim=self->getSpaceDimension();
968 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
969 self->getBoundingBox(tmp);
970 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
974 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
977 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
978 PyObject *ret=PyTuple_New(2);
979 PyObject *ret0Py=ret0?Py_True:Py_False;
981 PyTuple_SetItem(ret,0,ret0Py);
982 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
986 PyObject *buildPart(PyObject *li) const
988 mcIdType szArr,sw,iTypppArr;
989 std::vector<mcIdType> stdvecTyyppArr;
990 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
991 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
992 if(sw==3)//DataArrayIdType
994 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
995 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
996 std::string name=argpt->getName();
998 ret->setName(name.c_str());
1000 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1003 PyObject *buildPartAndReduceNodes(PyObject *li) const
1005 mcIdType szArr,sw,iTypppArr;
1006 std::vector<mcIdType> stdvecTyyppArr;
1007 DataArrayIdType *arr=0;
1008 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1009 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
1010 if(sw==3)//DataArrayIdType
1012 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1013 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1014 std::string name=argpt->getName();
1016 ret->setName(name.c_str());
1019 PyObject *res = PyList_New(2);
1020 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1021 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1022 PyList_SetItem(res,0,obj0);
1023 PyList_SetItem(res,1,obj1);
1027 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
1030 DataArrayIdType *arr=0;
1031 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
1032 PyObject *res = PyTuple_New(2);
1033 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1036 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1038 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1039 PyTuple_SetItem(res,0,obj0);
1040 PyTuple_SetItem(res,1,obj1);
1044 PyObject *getDistributionOfTypes() const
1046 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1047 if(vals.size()%3!=0)
1048 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1049 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1050 for(std::size_t j=0;j<vals.size()/3;j++)
1052 PyObject *ret1=PyList_New(3);
1053 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1054 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1055 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1056 PyList_SetItem(ret,j,ret1);
1061 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1063 std::vector<mcIdType> code;
1064 std::vector<const DataArrayIdType *> idsPerType;
1065 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1066 convertPyToNewIntArr4(li,1,3,code);
1067 return self->checkTypeConsistencyAndContig(code,idsPerType);
1070 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1072 std::vector<mcIdType> code;
1073 std::vector<DataArrayIdType *> idsInPflPerType;
1074 std::vector<DataArrayIdType *> idsPerType;
1075 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1076 PyObject *ret=PyTuple_New(3);
1078 if(code.size()%3!=0)
1079 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1080 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1081 for(std::size_t j=0;j<code.size()/3;j++)
1083 PyObject *ret00=PyList_New(3);
1084 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1085 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1086 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1087 PyList_SetItem(ret0,j,ret00);
1089 PyTuple_SetItem(ret,0,ret0);
1091 PyObject *ret1=PyList_New(idsInPflPerType.size());
1092 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1093 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1094 PyTuple_SetItem(ret,1,ret1);
1095 std::size_t n=idsPerType.size();
1096 PyObject *ret2=PyList_New(n);
1097 for(std::size_t i=0;i<n;i++)
1098 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1099 PyTuple_SetItem(ret,2,ret2);
1103 void translate(PyObject *vector)
1107 DataArrayDoubleTuple *aa;
1108 std::vector<double> bb;
1110 int spaceDim=self->getSpaceDimension();
1111 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1112 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1113 self->translate(vectorPtr);
1116 void rotate(PyObject *center, double alpha)
1118 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1121 DataArrayDoubleTuple *aa;
1122 std::vector<double> bb;
1124 int spaceDim=self->getSpaceDimension();
1125 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1126 self->rotate(centerPtr,0,alpha);
1129 void rotate(PyObject *center, PyObject *vector, double alpha)
1131 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1133 DataArrayDouble *a,*a2;
1134 DataArrayDoubleTuple *aa,*aa2;
1135 std::vector<double> bb,bb2;
1137 int spaceDim=self->getSpaceDimension();
1138 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1139 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
1140 self->rotate(centerPtr,vectorPtr,alpha);
1143 PyObject *getAllGeoTypes() const
1145 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1146 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1147 PyObject *res=PyList_New(result.size());
1148 for(int i=0;iL!=result.end(); i++, iL++)
1149 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1153 virtual PyObject *getTinySerializationInformation() const
1155 std::vector<double> a0;
1156 std::vector<mcIdType> a1;
1157 std::vector<std::string> a2;
1158 self->getTinySerializationInformation(a0,a1,a2);
1159 PyObject *ret(PyTuple_New(3));
1160 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1161 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1162 std::size_t sz(a2.size());
1163 PyObject *ret2(PyList_New(sz));
1165 for(std::size_t i=0;i<sz;i++)
1166 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1168 PyTuple_SetItem(ret,2,ret2);
1172 virtual PyObject *serialize() const
1174 DataArrayIdType *a0Tmp(0);
1175 DataArrayDouble *a1Tmp(0);
1176 self->serialize(a0Tmp,a1Tmp);
1177 PyObject *ret(PyTuple_New(2));
1178 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1179 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1183 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1185 std::vector<std::string> littleStrings;
1186 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1189 PyObject *__getstate__() const
1191 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1192 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1193 PyObject *ret(PyTuple_New(2));
1194 PyTuple_SetItem(ret,0,ret0);
1195 PyTuple_SetItem(ret,1,ret1);
1199 void __setstate__(PyObject *inp)
1201 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1202 if(!PyTuple_Check(inp))
1203 throw INTERP_KERNEL::Exception(MSG);
1204 std::size_t sz(PyTuple_Size(inp));
1206 throw INTERP_KERNEL::Exception(MSG);
1207 PyObject *elt0(PyTuple_GetItem(inp,0));
1208 PyObject *elt1(PyTuple_GetItem(inp,1));
1209 std::vector<double> a0;
1210 std::vector<mcIdType> a1;
1211 std::vector<std::string> a2;
1212 DataArrayIdType *b0(0);
1213 DataArrayDouble *b1(0);
1215 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1216 throw INTERP_KERNEL::Exception(MSG);
1217 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1219 fillArrayWithPyListDbl3(a0py,tmp,a0);
1220 convertPyToNewIntArr3(a1py,a1);
1221 fillStringVector(a2py,a2);
1224 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1225 throw INTERP_KERNEL::Exception(MSG);
1226 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1228 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1229 if(!SWIG_IsOK(status))
1230 throw INTERP_KERNEL::Exception(MSG);
1231 b0=reinterpret_cast<DataArrayIdType *>(argp);
1232 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1233 if(!SWIG_IsOK(status))
1234 throw INTERP_KERNEL::Exception(MSG);
1235 b1=reinterpret_cast<DataArrayDouble *>(argp);
1237 // useless here to call resizeForUnserialization because arrays are well resized.
1238 self->unserialization(a0,a1,b0,b1,a2);
1241 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1243 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1244 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1245 return MEDCouplingMesh::MergeMeshes(tmp);
1251 //== MEDCouplingMesh End
1253 %include "NormalizedGeometricTypes"
1254 %include "MEDCouplingNatureOfFieldEnum"
1256 namespace MEDCoupling
1258 class MEDCouplingNatureOfField
1261 static const char *GetRepr(NatureOfField nat);
1262 static std::string GetReprNoThrow(NatureOfField nat);
1263 static std::string GetAllPossibilitiesStr();
1267 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1268 // include "MEDCouplingTimeDiscretization.i"
1270 namespace MEDCoupling
1272 class MEDCouplingGaussLocalization
1275 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1276 const std::vector<double>& gsCoo, const std::vector<double>& w);
1277 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1278 INTERP_KERNEL::NormalizedCellType getType() const;
1279 void setType(INTERP_KERNEL::NormalizedCellType typ);
1280 int getNumberOfGaussPt() const;
1281 int getDimension() const;
1282 int getNumberOfPtsInRefCell() const;
1283 std::string getStringRepr() const;
1284 void checkConsistencyLight() const;
1285 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1287 const std::vector<double>& getRefCoords() const;
1288 double getRefCoord(int ptIdInCell, int comp) const;
1289 const std::vector<double>& getGaussCoords() const;
1290 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1291 const std::vector<double>& getWeights() const;
1292 double getWeight(int gaussPtIdInCell) const;
1293 void setRefCoord(int ptIdInCell, int comp, double newVal);
1294 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1295 void setWeight(int gaussPtIdInCell, double newVal);
1296 void setRefCoords(const std::vector<double>& refCoo);
1297 void setGaussCoords(const std::vector<double>& gsCoo);
1298 void setWeights(const std::vector<double>& w);
1300 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1304 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1306 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1310 MEDCouplingUMesh *buildRefCell() const
1312 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1316 DataArrayDouble *getShapeFunctionValues() const
1318 MCAuto<DataArrayDouble> ret(self->getShapeFunctionValues());
1322 DataArrayDouble *getDerivativeOfShapeFunctionValues() const
1324 MCAuto<DataArrayDouble> ret(self->getDerivativeOfShapeFunctionValues());
1328 static DataArrayDouble *GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type)
1330 MCAuto<DataArrayDouble> ret(MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(type));
1336 class MEDCouplingSkyLineArray
1339 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1341 void set( DataArrayIdType* index, DataArrayIdType* value );
1342 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1344 int getSuperNumberOf() const;
1345 int getNumberOf() const;
1346 int getLength() const;
1348 void deletePack(const int i, const int j);
1350 void deleteSimplePack(const int i);
1351 void deleteSimplePacks(const DataArrayIdType* idx);
1353 MEDCouplingSkyLineArray *groupPacks(const DataArrayIdType *indexedPacks) const;
1354 MEDCouplingSkyLineArray *uniqueNotSortedByPack() const;
1356 MEDCouplingSkyLineArray *deepCopy() const;
1360 MEDCouplingSkyLineArray()
1362 return MEDCouplingSkyLineArray::New();
1365 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1367 return MEDCouplingSkyLineArray::New(index, value);
1370 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1372 return MEDCouplingSkyLineArray::New(index, value);
1375 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1377 return MEDCouplingSkyLineArray::New(other);
1380 std::string __str__() const
1382 return self->simpleRepr();
1385 DataArrayIdType *getSuperIndexArray() const
1387 DataArrayIdType *ret(self->getSuperIndexArray());
1393 DataArrayIdType *getIndexArray() const
1395 DataArrayIdType *ret(self->getIndexArray());
1401 DataArrayIdType *getValuesArray() const
1403 DataArrayIdType *ret(self->getValuesArray());
1409 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1411 std::vector<mcIdType> ret;
1412 self->getSimplePackSafe(absolutePackId,ret);
1413 return convertIntArrToPyList2(ret);
1416 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1418 std::vector<mcIdType> vpack, vspIdx, out;
1420 convertPyToNewIntArr3(superPackIndices,vspIdx);
1421 convertPyToNewIntArr3(pack,vpack);
1423 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1424 return convertIntArrToPyList2(out);
1427 void pushBackPack(const mcIdType i, PyObject *pack)
1429 std::vector<mcIdType> vpack;
1430 convertPyToNewIntArr3(pack,vpack);
1431 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1434 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1436 std::vector<mcIdType> vpack;
1437 convertPyToNewIntArr3(pack,vpack);
1438 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1441 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1443 std::vector<const DataArrayIdType*> packs;
1444 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1445 self->replaceSimplePacks(idx, packs);
1448 static MEDCouplingSkyLineArray *AggregatePacks(PyObject *sks)
1450 std::vector<const MEDCouplingSkyLineArray *> sksCpp;
1451 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingSkyLineArray*>(sks,SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray,"MEDCouplingSkyLineArray",sksCpp);
1452 return MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks(sksCpp);
1455 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1457 std::vector<mcIdType> vpack;
1458 convertPyToNewIntArr3(pack,vpack);
1459 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1462 PyObject *convertToPolyhedronConn() const
1464 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1465 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1466 self->convertToPolyhedronConn(d0,d1);
1467 PyObject *ret=PyTuple_New(2);
1468 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1469 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1473 PyObject *thresholdPerPack(mcIdType threshold) const
1475 MCAuto<MEDCouplingSkyLineArray> left, right;
1476 self->thresholdPerPack(threshold,left,right);
1477 PyObject *ret=PyTuple_New(2);
1478 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(left.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1479 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(right.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1486 %include "MEDCouplingFieldDiscretization.i"
1488 //== MEDCouplingPointSet
1490 namespace MEDCoupling
1492 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1495 void setCoords(const DataArrayDouble *coords);
1496 DataArrayDouble *getCoordinatesAndOwner() const;
1497 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1499 double getCaracteristicDimension() const;
1500 void recenterForMaxPrecision(double eps);
1501 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1502 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1503 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1504 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1505 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1506 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1507 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1508 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1509 virtual DataArrayIdType *computeFetchedNodeIds() const;
1510 virtual int getNumberOfNodesInCell(int cellId) const;
1511 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1512 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1513 virtual DataArrayIdType *zipCoordsTraducer();
1514 virtual DataArrayIdType *findBoundaryNodes() const;
1515 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1516 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1517 virtual void checkFullyDefined() const;
1518 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1519 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1520 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1521 virtual void renumberNodesWithOffsetInConn(int offset);
1522 virtual bool areAllNodesFetched() const;
1523 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1524 virtual void invertOrientationOfAllCells();
1527 std::string __str__() const
1529 return self->simpleRepr();
1532 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1534 mcIdType newNbOfNodes;
1535 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1536 PyObject *res = PyList_New(2);
1537 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1538 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1542 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1544 DataArrayIdType *comm, *commIndex;
1545 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1546 PyObject *res = PyList_New(2);
1547 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1548 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1552 PyObject *getCoords()
1554 DataArrayDouble *ret1=self->getCoords();
1557 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1560 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1562 mcIdType szArr,sw,iTypppArr;
1563 std::vector<mcIdType> stdvecTyyppArr;
1564 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1565 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1566 if(sw==3)//DataArrayIdType
1568 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1569 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1570 std::string name=argpt->getName();
1572 ret->setName(name.c_str());
1574 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1577 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1579 mcIdType szArr,sw,iTypppArr;
1580 std::vector<mcIdType> stdvecTyyppArr;
1581 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1582 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1583 if(sw==3)//DataArrayIdType
1585 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1586 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1587 std::string name=argpt->getName();
1589 ret->setName(name.c_str());
1591 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1594 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1596 mcIdType szArr,sw,iTypppArr;
1597 std::vector<mcIdType> stdvecTyyppArr;
1598 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1599 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1600 if(sw==3)//DataArrayIdType
1602 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1603 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1604 std::string name=argpt->getName();
1606 ret->setName(name.c_str());
1608 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1611 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1613 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1614 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1617 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1619 mcIdType szArr,sw,iTypppArr;
1620 std::vector<mcIdType> stdvecTyyppArr;
1621 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1622 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1623 if(sw==3)//DataArrayIdType
1625 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1626 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1627 std::string name=argpt->getName();
1629 ret->setName(name.c_str());
1631 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1634 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1636 mcIdType szArr,sw,iTypppArr;
1637 std::vector<mcIdType> stdvecTyyppArr;
1638 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1639 self->renumberNodes(tmp,newNbOfNodes);
1642 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1644 mcIdType szArr,sw,iTypppArr;
1645 std::vector<mcIdType> stdvecTyyppArr;
1646 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1647 self->renumberNodesCenter(tmp,newNbOfNodes);
1650 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1652 int spaceDim=self->getSpaceDimension();
1654 DataArrayDouble *a,*a2;
1655 DataArrayDoubleTuple *aa,*aa2;
1656 std::vector<double> bb,bb2;
1658 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1659 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1660 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1661 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1662 std::vector<mcIdType> nodes;
1663 self->findNodesOnLine(p,v,eps,nodes);
1664 DataArrayIdType *ret=DataArrayIdType::New();
1665 ret->alloc(nodes.size(),1);
1666 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1667 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1669 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1671 int spaceDim=self->getSpaceDimension();
1673 DataArrayDouble *a,*a2;
1674 DataArrayDoubleTuple *aa,*aa2;
1675 std::vector<double> bb,bb2;
1677 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1678 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1679 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1680 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1681 std::vector<mcIdType> nodes;
1682 self->findNodesOnPlane(p,v,eps,nodes);
1683 DataArrayIdType *ret=DataArrayIdType::New();
1684 ret->alloc(nodes.size(),1);
1685 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1686 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1689 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1693 DataArrayDoubleTuple *aa;
1694 std::vector<double> bb;
1696 int spaceDim=self->getSpaceDimension();
1697 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1698 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1699 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1700 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1703 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1705 DataArrayIdType *c=0,*cI=0;
1709 DataArrayDoubleTuple *aa;
1710 std::vector<double> bb;
1712 int spaceDim=self->getSpaceDimension();
1713 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1714 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1715 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1716 PyObject *ret=PyTuple_New(2);
1717 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1718 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1722 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1724 DataArrayIdType *c=0,*cI=0;
1725 int spaceDim=self->getSpaceDimension();
1728 DataArrayDoubleTuple *aa;
1729 std::vector<double> bb;
1731 mcIdType nbOfTuples=-1;
1732 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1733 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1735 PyObject *ret=PyTuple_New(2);
1736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1741 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1745 DataArrayDoubleTuple *aa;
1746 std::vector<double> bb;
1748 int spaceDim=self->getSpaceDimension();
1749 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1750 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1752 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1756 void duplicateNodesInCoords(PyObject *li)
1760 std::vector<mcIdType> multiVal;
1761 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1762 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1763 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1767 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1769 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1771 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1773 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1777 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1779 DataArrayIdType *v0(nullptr),*v1(nullptr);
1780 self->findCommonCells(compType,startCellId,v0,v1);
1781 PyObject *res = PyList_New(2);
1782 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1783 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1788 virtual void renumberNodesInConn(PyObject *li)
1792 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1795 MapII *da2(reinterpret_cast<MapII *>(da));
1796 self->renumberNodesInConn(da2->data());
1800 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1801 if (!SWIG_IsOK(res1))
1804 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1805 self->renumberNodesInConn(tmp);
1809 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1811 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1812 da2->checkAllocated();
1813 self->renumberNodesInConn(da2->getConstPointer());
1817 virtual PyObject *getNodeIdsInUse() const
1820 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1821 PyObject *ret=PyTuple_New(2);
1822 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1823 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1827 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1829 DataArrayIdType *ret(nullptr);
1831 mcIdType szArr,sw,iTypppArr;
1832 std::vector<mcIdType> stdvecTyyppArr;
1833 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1834 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1838 virtual PyObject *mergeNodes(double precision)
1842 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1843 PyObject *res = PyList_New(3);
1844 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1845 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1846 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1850 virtual PyObject *mergeNodesCenter(double precision)
1854 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1855 PyObject *res = PyList_New(3);
1856 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1857 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1858 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1862 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1865 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1866 if (!SWIG_IsOK(res1))
1869 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1870 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1874 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1876 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1877 da2->checkAllocated();
1878 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1882 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1886 std::vector<mcIdType> multiVal;
1887 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1888 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1889 mcIdType nbc=self->getNumberOfCells();
1890 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1897 std::ostringstream oss;
1898 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1899 throw INTERP_KERNEL::Exception(oss.str().c_str());
1902 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1907 mcIdType tmp=nbc+singleVal;
1908 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1912 std::ostringstream oss;
1913 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1914 throw INTERP_KERNEL::Exception(oss.str().c_str());
1920 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1924 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1929 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1930 daIntTyypp->checkAllocated();
1931 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1934 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1938 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1941 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1942 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1943 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1944 for(mcIdType i=0;i<sz;i++)
1945 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1948 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1951 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1952 mcIdType sw,nbNodes=0;
1953 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1954 std::vector<double> val3;
1955 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1956 "Rotate2DAlg",2,true,nbNodes);
1958 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1959 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1962 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1965 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1966 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1967 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1968 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1969 for(mcIdType i=0;i<sz;i++)
1970 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1973 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1976 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1977 mcIdType sw,nbNodes=0;
1978 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1979 std::vector<double> val3;
1980 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1981 "Rotate3DAlg",3,true,nbNodes);
1983 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1984 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1985 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1990 //== MEDCouplingPointSet End
1992 class MEDCouplingUMeshCell
1995 INTERP_KERNEL::NormalizedCellType getType() const;
1998 std::string __str__() const
2000 return self->repr();
2003 PyObject *getAllConn() const
2006 const mcIdType *r=self->getAllConn(ret2);
2007 PyObject *ret=PyTuple_New(ret2);
2008 for(mcIdType i=0;i<ret2;i++)
2009 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
2015 class MEDCouplingUMeshCellIterator
2022 MEDCouplingUMeshCell *ret=self->nextt();
2024 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
2027 PyErr_SetString(PyExc_StopIteration,"No more data.");
2034 class MEDCouplingUMeshCellByTypeIterator
2037 ~MEDCouplingUMeshCellByTypeIterator();
2042 MEDCouplingUMeshCellEntry *ret=self->nextt();
2044 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
2047 PyErr_SetString(PyExc_StopIteration,"No more data.");
2054 class MEDCouplingUMeshCellByTypeEntry
2057 ~MEDCouplingUMeshCellByTypeEntry();
2060 MEDCouplingUMeshCellByTypeIterator *__iter__()
2062 return self->iterator();
2067 class MEDCouplingUMeshCellEntry
2070 INTERP_KERNEL::NormalizedCellType getType() const;
2071 int getNumberOfElems() const;
2074 MEDCouplingUMeshCellIterator *__iter__()
2076 return self->iterator();
2081 //== MEDCouplingUMesh
2083 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2086 static MEDCouplingUMesh *New();
2087 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2088 void checkConsistencyLight() const;
2089 void checkGeomConsistency(double eps=1e-12) const;
2090 void setMeshDimension(int meshDim);
2091 void allocateCells(int nbOfCells=0);
2092 void finishInsertingCells();
2093 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2094 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2095 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2096 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2097 int getNodalConnectivityArrayLen() const;
2098 void computeTypes();
2099 std::string reprConnectivityOfThis() const;
2100 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2102 DataArrayIdType *conformize2D(double eps);
2103 DataArrayIdType *conformize3D(double eps);
2104 DataArrayIdType *colinearize2D(double eps);
2105 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2106 void shiftNodeNumbersInConn(int delta);
2107 std::vector<bool> getQuadraticStatus() const;
2108 DataArrayIdType *findCellIdsOnBoundary() const;
2109 MEDCouplingUMesh *computeSkin() const;
2110 bool checkConsecutiveCellTypes() const;
2111 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2112 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2113 DataArrayIdType *sortCellsInMEDFileFrmt();
2114 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2115 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2116 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2117 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2118 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2119 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2120 void orientCorrectlyPolyhedrons();
2121 bool isPresenceOfQuadratic() const;
2122 bool isFullyQuadratic() const;
2123 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2124 bool isContiguous1D() const;
2125 void tessellate2D(double eps);
2126 void convertQuadraticCellsToLinear();
2127 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2128 void convertDegeneratedCells();
2129 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2130 bool removeDegenerated1DCells();
2131 bool areOnlySimplexCells() const;
2132 MEDCouplingFieldDouble *getEdgeRatioField() const;
2133 MEDCouplingFieldDouble *getAspectRatioField() const;
2134 MEDCouplingFieldDouble *getWarpField() const;
2135 MEDCouplingFieldDouble *getSkewField() const;
2136 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2137 DataArrayIdType *convexEnvelop2D();
2138 std::string cppRepr() const;
2139 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2140 DataArrayIdType *findAndCorrectBadOriented3DCells();
2141 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2142 MEDCouplingSkyLineArray *generateGraph() const;
2143 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2144 DataArrayIdType *buildUnionOf2DMesh() const;
2145 DataArrayIdType *buildUnionOf3DMesh() const;
2146 DataArrayIdType *orderConsecutiveCells1D() const;
2147 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2148 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2149 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2150 void changeOrientationOfCells();
2151 void orientCorrectly2DCells(const MEDCouplingUMesh *refFaces);
2152 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2153 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2154 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2155 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2156 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2157 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2158 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2162 return MEDCouplingUMesh::New();
2165 MEDCouplingUMesh(const char *meshName, int meshDim)
2167 return MEDCouplingUMesh::New(meshName,meshDim);
2170 std::string __str__() const
2172 return self->simpleRepr();
2175 std::string __repr__() const
2177 std::ostringstream oss;
2178 self->reprQuickOverview(oss);
2182 MEDCouplingUMeshCellIterator *__iter__()
2184 return self->cellIterator();
2187 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2189 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2193 PyObject *getAllGeoTypesSorted() const
2195 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2196 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2197 PyObject *res=PyList_New(result.size());
2198 for(int i=0;iL!=result.end(); i++, iL++)
2199 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2203 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2207 std::vector<mcIdType> multiVal;
2208 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2209 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2210 mcIdType nbc=self->getNumberOfCells();
2211 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2218 std::ostringstream oss;
2219 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2220 throw INTERP_KERNEL::Exception(oss.str().c_str());
2224 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2231 mcIdType tmp=nbc+singleVal;
2232 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2237 std::ostringstream oss;
2238 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2239 throw INTERP_KERNEL::Exception(oss.str().c_str());
2245 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2251 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2252 daIntTyypp->checkAllocated();
2253 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2257 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2261 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2265 std::vector<mcIdType> multiVal;
2266 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2267 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2268 mcIdType nbc=self->getNumberOfCells();
2269 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2276 std::ostringstream oss;
2277 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2278 throw INTERP_KERNEL::Exception(oss.str().c_str());
2282 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2289 mcIdType tmp=nbc+singleVal;
2290 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2295 std::ostringstream oss;
2296 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2297 throw INTERP_KERNEL::Exception(oss.str().c_str());
2303 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2308 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2314 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2315 daIntTyypp->checkAllocated();
2316 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2320 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2324 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2326 mcIdType szArr,sw,iTypppArr;
2327 std::vector<mcIdType> stdvecTyyppArr;
2328 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2331 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2332 throw INTERP_KERNEL::Exception(oss.str().c_str());
2334 self->insertNextCell(type,size,tmp);
2337 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2339 mcIdType szArr,sw,iTypppArr;
2340 std::vector<mcIdType> stdvecTyyppArr;
2341 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2342 self->insertNextCell(type,szArr,tmp);
2345 DataArrayIdType *getNodalConnectivity()
2347 DataArrayIdType *ret=self->getNodalConnectivity();
2352 DataArrayIdType *getNodalConnectivityIndex()
2354 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2360 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2362 mcIdType szArr,sw,iTypppArr;
2363 std::vector<mcIdType> stdvecTyyppArr;
2364 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2365 mcIdType nbOfDepthPeelingPerformed=0;
2366 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2367 PyObject *res=PyTuple_New(2);
2368 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2373 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2375 DataArrayIdType *v0=0,*v1=0;
2376 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2377 PyObject *res = PyList_New(2);
2378 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2379 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2383 PyObject *distanceToPoint(PyObject *point) const
2387 DataArrayDoubleTuple *aa;
2388 std::vector<double> bb;
2390 int nbOfCompo=self->getSpaceDimension();
2391 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2394 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2395 PyObject *ret=PyTuple_New(2);
2396 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2397 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2401 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2403 DataArrayIdType *ret1=0;
2404 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2405 PyObject *ret=PyTuple_New(2);
2406 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2407 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2411 PyObject *tetrahedrize(int policy)
2414 DataArrayIdType *ret1(0);
2415 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2416 PyObject *ret=PyTuple_New(3);
2417 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2419 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2423 PyObject *checkButterflyCells(double eps=1e-12)
2425 std::vector<mcIdType> cells;
2426 self->checkButterflyCells(cells,eps);
2427 DataArrayIdType *ret=DataArrayIdType::New();
2428 ret->alloc(cells.size(),1);
2429 std::copy(cells.begin(),cells.end(),ret->getPointer());
2430 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2433 PyObject *splitByType() const
2435 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2436 std::size_t sz=ms.size();
2437 PyObject *ret = PyList_New(sz);
2438 for(std::size_t i=0;i<sz;i++)
2439 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2443 PyObject *partitionBySpreadZone() const
2445 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2446 std::size_t sz=retCpp.size();
2447 PyObject *ret=PyList_New(sz);
2448 for(std::size_t i=0;i<sz;i++)
2449 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2453 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2455 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2456 std::size_t sz=retCpp.size();
2457 PyObject *ret=PyList_New(sz);
2458 for(std::size_t i=0;i<sz;i++)
2459 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2463 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2466 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2467 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2468 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2471 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2474 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2475 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2479 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2482 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2483 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2487 DataArrayIdType *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2489 DataArrayIdType *ret=self->findNodesToDuplicate(otherDimM1OnSameCoords);
2493 PyObject *findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const DataArrayIdType *dupNodes) const
2495 DataArrayIdType *tmp0=0,*tmp1=0;
2496 self->findCellsToRenumber(otherDimM1OnSameCoords,dupNodes->begin(), dupNodes->end(), tmp0,tmp1);
2497 PyObject *ret=PyTuple_New(2);
2498 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2499 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2503 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2505 DataArrayIdType *tmp0=0,*tmp1=0;
2506 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2507 PyObject *ret=PyTuple_New(2);
2508 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2509 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2513 void duplicateNodes(PyObject *li)
2517 std::vector<mcIdType> multiVal;
2518 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2519 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2520 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2524 return self->duplicateNodes(&singleVal,&singleVal+1);
2526 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2528 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2530 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2534 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2538 std::vector<mcIdType> multiVal;
2539 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2540 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2541 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2545 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2547 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2549 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2551 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2555 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2557 mcIdType szArr,sw,iTypppArr;
2558 std::vector<mcIdType> stdvecTyyppArr;
2559 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2560 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2563 PyObject *getLevArrPerCellTypes(PyObject *li) const
2566 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2567 DataArrayIdType *tmp0,*tmp1=0;
2568 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2569 PyObject *ret=PyTuple_New(2);
2570 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2571 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2575 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2577 DataArrayIdType *ret0=0,*ret1=0;
2578 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2579 PyObject *ret=PyTuple_New(2);
2580 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2581 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2585 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2587 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2588 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2589 DataArrayIdType *ret1=0,*ret2=0;
2590 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2591 PyObject *ret=PyTuple_New(3);
2592 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2593 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2594 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2598 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2600 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2601 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2602 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2603 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2606 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2609 std::vector<const MEDCouplingUMesh *> meshes;
2610 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2611 std::vector<DataArrayIdType *> corr;
2612 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2614 PyObject *ret1=PyList_New(sz);
2615 for(std::size_t i=0;i<sz;i++)
2616 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2617 PyObject *ret=PyList_New(2);
2618 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2619 PyList_SetItem(ret,1,ret1);
2623 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2625 std::vector<MEDCouplingUMesh *> meshes;
2626 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2627 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2630 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2632 std::vector<MEDCouplingUMesh *> meshes;
2633 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2634 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2637 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2641 DataArrayDoubleTuple *aa;
2642 std::vector<double> bb;
2644 int spaceDim=self->getSpaceDimension();
2645 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2646 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2648 std::vector<mcIdType> cells;
2649 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2650 DataArrayIdType *ret=DataArrayIdType::New();
2651 ret->alloc(cells.size(),1);
2652 std::copy(cells.begin(),cells.end(),ret->getPointer());
2653 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2656 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2660 DataArrayDoubleTuple *aa;
2661 std::vector<double> bb;
2663 int spaceDim=self->getSpaceDimension();
2664 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2665 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2666 self->orientCorrectly2DCells(v,polyOnly);
2669 PyObject *arePolyhedronsNotCorrectlyOriented() const
2671 std::vector<mcIdType> cells;
2672 self->arePolyhedronsNotCorrectlyOriented(cells);
2673 DataArrayIdType *ret=DataArrayIdType::New();
2674 ret->alloc(cells.size(),1);
2675 std::copy(cells.begin(),cells.end(),ret->getPointer());
2676 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2679 PyObject *getFastAveragePlaneOfThis() const
2683 self->getFastAveragePlaneOfThis(vec,pos);
2685 std::copy(vec,vec+3,vals);
2686 std::copy(pos,pos+3,vals+3);
2687 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2690 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2692 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2693 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2694 return MEDCouplingUMesh::MergeUMeshes(tmp);
2697 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2699 DataArrayIdType *ret1;
2700 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2701 PyObject *ret=PyTuple_New(2);
2702 PyObject *ret0Py=ret0?Py_True:Py_False;
2704 PyTuple_SetItem(ret,0,ret0Py);
2705 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2709 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2711 DataArrayIdType *ret1;
2712 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2713 PyObject *ret=PyTuple_New(2);
2714 PyObject *ret0Py=ret0?Py_True:Py_False;
2716 PyTuple_SetItem(ret,0,ret0Py);
2717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2721 PyObject *explode3DMeshTo1D() const
2723 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2724 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2725 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2726 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2727 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2728 PyObject *ret=PyTuple_New(5);
2729 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2730 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2731 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2732 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2733 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2737 PyObject *explodeIntoEdges() const
2739 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2740 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2741 PyObject *ret=PyTuple_New(5);
2742 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2743 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2744 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2745 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2746 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2750 PyObject *explodeMeshIntoMicroEdges() const
2752 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2753 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2754 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2755 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2756 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2757 PyObject *ret=PyTuple_New(5);
2758 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2759 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2760 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2766 PyObject *buildDescendingConnectivity() const
2768 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2769 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2770 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2771 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2772 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2773 PyObject *ret=PyTuple_New(5);
2774 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2775 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2776 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2777 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2778 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2782 PyObject *buildDescendingConnectivity2() const
2784 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2785 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2786 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2787 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2788 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2789 PyObject *ret=PyTuple_New(5);
2790 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2791 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2792 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2793 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2794 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2798 PyObject *computeNeighborsOfCells() const
2800 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2801 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2802 PyObject *ret=PyTuple_New(2);
2803 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2804 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2808 PyObject *computeNeighborsOfNodes() const
2810 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2811 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2812 PyObject *ret=PyTuple_New(2);
2813 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2814 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2818 PyObject *computeEnlargedNeighborsOfNodes() const
2820 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2821 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2822 PyObject *ret=PyTuple_New(2);
2823 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2824 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2828 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2830 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2831 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2832 PyObject *ret=PyTuple_New(2);
2833 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2834 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2838 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2840 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2841 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2842 PyObject *ret=PyTuple_New(2);
2843 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2844 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2848 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2850 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2851 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2852 DataArrayIdType *d2,*d3,*d4,*dd5;
2853 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2854 PyObject *ret=PyTuple_New(7);
2855 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2856 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2857 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2858 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2859 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2860 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2861 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2865 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2868 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2869 da->checkAllocated();
2870 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2873 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2876 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2877 da->checkAllocated();
2878 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2881 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2884 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2885 da->checkAllocated();
2886 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2889 PyObject *getTypesOfPart(DataArrayIdType *da) const
2892 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2893 da->checkAllocated();
2894 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2895 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2896 PyObject *res = PyList_New(result.size());
2897 for (int i=0;iL!=result.end(); i++, iL++)
2898 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2902 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2905 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2906 da->checkAllocated();
2907 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2908 ret->setName(da->getName().c_str());
2912 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2914 DataArrayIdType *cellNb1=0,*cellNb2=0;
2915 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2916 PyObject *ret=PyTuple_New(3);
2917 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2918 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2919 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2923 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2925 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2926 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2927 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2928 PyObject *ret(PyTuple_New(4));
2929 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2930 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2931 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2932 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2936 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2938 int spaceDim=self->getSpaceDimension();
2940 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2942 DataArrayDouble *a,*a2;
2943 DataArrayDoubleTuple *aa,*aa2;
2944 std::vector<double> bb,bb2;
2946 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2947 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2948 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2949 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2951 DataArrayIdType *cellIds=0;
2952 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2953 PyObject *ret=PyTuple_New(2);
2954 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2955 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2959 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2961 int spaceDim=self->getSpaceDimension();
2963 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2965 DataArrayDouble *a,*a2;
2966 DataArrayDoubleTuple *aa,*aa2;
2967 std::vector<double> bb,bb2;
2969 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2970 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2971 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2972 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2974 DataArrayIdType *cellIds=0;
2975 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2976 PyObject *ret=PyTuple_New(2);
2977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2982 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2985 DataArrayDouble *a,*a2;
2986 DataArrayDoubleTuple *aa,*aa2;
2987 std::vector<double> bb,bb2;
2989 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2990 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2991 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2992 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2993 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2997 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2999 int spaceDim=self->getSpaceDimension();
3001 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
3003 DataArrayDouble *a,*a2;
3004 DataArrayDoubleTuple *aa,*aa2;
3005 std::vector<double> bb,bb2;
3007 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
3008 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
3009 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3010 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3011 return self->getCellIdsCrossingPlane(orig,vect,eps);
3014 void convertToPolyTypes(PyObject *li)
3018 std::vector<mcIdType> pos2;
3019 DataArrayIdType *pos3=0;
3020 DataArrayIdTypeTuple *pos4=0;
3021 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
3026 self->convertToPolyTypes(&pos1,&pos1+1);
3033 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
3038 self->convertToPolyTypes(pos3->begin(),pos3->end());
3042 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
3046 void convertAllToPoly();
3047 void convertExtrudedPolyhedra();
3049 void simplifyPolyhedra(double eps);
3050 void colinearizeEdges(double eps);
3051 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
3052 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
3055 //== MEDCouplingUMesh End
3057 //== MEDCouplingMappedExtrudedMesh
3059 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
3062 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
3063 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
3064 MEDCouplingUMesh *build3DUnstructuredMesh() const;
3065 int get2DCellIdForExtrusion() const;
3067 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
3069 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3072 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3074 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3077 MEDCouplingMappedExtrudedMesh()
3079 return MEDCouplingMappedExtrudedMesh::New();
3082 std::string __str__() const
3084 return self->simpleRepr();
3087 std::string __repr__() const
3089 std::ostringstream oss;
3090 self->reprQuickOverview(oss);
3094 PyObject *getMesh2D() const
3096 MEDCouplingUMesh *ret=self->getMesh2D();
3099 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3101 PyObject *getMesh1D() const
3103 MEDCouplingUMesh *ret=self->getMesh1D();
3106 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3108 PyObject *getMesh3DIds() const
3110 DataArrayIdType *ret=self->getMesh3DIds();
3113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3118 //== MEDCouplingMappedExtrudedMesh End
3120 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3123 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3124 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3125 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3126 int getNodalConnectivityLength() const;
3127 virtual void allocateCells(int nbOfCells=0);
3128 virtual void checkConsistencyOfConnectivity() const;
3131 virtual void insertNextCell(PyObject *li)
3133 mcIdType szArr,sw,iTypppArr;
3134 std::vector<mcIdType> stdvecTyyppArr;
3135 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3136 self->insertNextCell(tmp,tmp+szArr);
3139 virtual DataArrayIdType *getNodalConnectivity() const
3141 DataArrayIdType *ret=self->getNodalConnectivity();
3142 if(ret) ret->incrRef();
3146 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3148 std::vector< const MEDCoupling1GTUMesh *> parts;
3149 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3150 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3155 //== MEDCoupling1SGTUMesh
3157 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3160 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3161 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3162 void setNodalConnectivity(DataArrayIdType *nodalConn);
3163 int getNumberOfNodesPerCell() const;
3164 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3165 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3166 MEDCoupling1GTUMesh *computeDualMesh() const;
3167 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3168 DataArrayIdType *sortHexa8EachOther();
3171 MEDCoupling1SGTUMesh()
3173 return MEDCoupling1SGTUMesh::New();
3176 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3178 return MEDCoupling1SGTUMesh::New(name,type);
3181 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3183 return MEDCoupling1SGTUMesh::New(m);
3186 std::string __str__() const
3188 return self->simpleRepr();
3191 std::string __repr__() const
3193 std::ostringstream oss;
3194 self->reprQuickOverview(oss);
3198 PyObject *structurizeMe(double eps=1e-12) const
3200 DataArrayIdType *cellPerm(0),*nodePerm(0);
3201 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3202 PyObject *ret(PyTuple_New(3));
3203 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3204 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3205 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3209 DataArrayDouble *MEDCoupling1SGTUMesh::computeTriangleHeight() const
3211 MCAuto<DataArrayDouble> ret = self->computeTriangleHeight();
3215 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3217 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3218 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3219 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3222 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3224 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3225 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3226 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3231 //== MEDCoupling1SGTUMesh End
3233 //== MEDCoupling1DGTUMesh
3235 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3238 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3239 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3240 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3241 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3242 bool isPacked() const;
3245 MEDCoupling1DGTUMesh()
3247 return MEDCoupling1DGTUMesh::New();
3249 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3251 return MEDCoupling1DGTUMesh::New(name,type);
3254 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3256 return MEDCoupling1DGTUMesh::New(m);
3259 std::string __str__() const
3261 return self->simpleRepr();
3264 std::string __repr__() const
3266 std::ostringstream oss;
3267 self->reprQuickOverview(oss);
3271 DataArrayIdType *getNodalConnectivityIndex() const
3273 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3274 if(ret) ret->incrRef();
3278 PyObject *retrievePackedNodalConnectivity() const
3280 DataArrayIdType *ret1=0,*ret2=0;
3281 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3282 PyObject *ret0Py=ret0?Py_True:Py_False;
3284 PyObject *ret=PyTuple_New(3);
3285 PyTuple_SetItem(ret,0,ret0Py);
3286 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3287 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3291 PyObject *copyWithNodalConnectivityPacked() const
3294 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3295 PyObject *ret=PyTuple_New(2);
3296 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3297 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3298 PyTuple_SetItem(ret,1,ret1Py);
3302 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3304 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3305 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3306 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3309 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3311 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3312 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3313 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3316 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3318 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3319 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3320 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3325 //== MEDCoupling1DGTUMeshEnd
3327 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3330 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3331 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3332 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3333 int getSpaceDimensionOnNodeStruct() const;
3334 double computeSquareness() const;
3335 virtual std::vector<mcIdType> getNodeGridStructure() const;
3336 std::vector<mcIdType> getCellGridStructure() const;
3337 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3338 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3339 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3340 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3341 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3342 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3343 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3344 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3347 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3349 mcIdType tmpp1=-1,tmpp2=-1;
3350 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3351 std::vector< std::pair<mcIdType,mcIdType> > inp;
3355 for(mcIdType i=0;i<tmpp1;i++)
3356 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3361 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3362 inp.resize(tmpp1/2);
3363 for(mcIdType i=0;i<tmpp1/2;i++)
3364 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3367 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3368 return self->buildStructuredSubPart(inp);
3371 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3373 std::vector< std::pair<mcIdType,mcIdType> > inp;
3374 convertPyToVectorPairInt(part,inp);
3376 mcIdType szArr,sw,iTypppArr;
3377 std::vector<mcIdType> stdvecTyyppArr;
3378 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3379 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3381 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3384 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3386 std::vector< std::pair<mcIdType,mcIdType> > inp;
3387 convertPyToVectorPairInt(part,inp);
3388 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3391 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3393 std::vector< std::pair<mcIdType,mcIdType> > inp;
3394 convertPyToVectorPairInt(part,inp);
3395 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3398 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3400 std::vector< std::pair<mcIdType,mcIdType> > inp;
3401 convertPyToVectorPairInt(part,inp);
3402 std::vector<mcIdType> stWithGhost;
3403 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3404 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3405 PyObject *ret(PyTuple_New(2));
3406 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3407 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3411 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3413 std::vector< std::pair<mcIdType,mcIdType> > inp;
3414 convertPyToVectorPairInt(partCompactFormat,inp);
3415 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3418 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3420 std::vector< std::pair<mcIdType,mcIdType> > inp;
3421 convertPyToVectorPairInt(partCompactFormat,inp);
3422 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3425 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3427 std::vector< std::pair<mcIdType,mcIdType> > inp;
3428 convertPyToVectorPairInt(part,inp);
3429 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3432 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3434 mcIdType szArr,sw,iTypppArr;
3435 std::vector<mcIdType> stdvecTyyppArr;
3436 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3437 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3440 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3442 mcIdType szArr,sw,iTypppArr;
3443 std::vector<mcIdType> stdvecTyyppArr;
3444 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3445 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3448 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3450 std::vector< std::pair<mcIdType,mcIdType> > inp;
3451 convertPyToVectorPairInt(partCompactFormat,inp);
3452 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3455 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3457 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3458 PyObject *retPy=PyList_New(ret.size());
3459 for(std::size_t i=0;i<ret.size();i++)
3461 PyObject *tmp=PyTuple_New(2);
3462 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3463 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3464 PyList_SetItem(retPy,i,tmp);
3469 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3471 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3472 convertPyToVectorPairInt(r1,r1Cpp);
3473 convertPyToVectorPairInt(r2,r2Cpp);
3474 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3475 PyObject *retPy=PyList_New(ret.size());
3476 for(std::size_t i=0;i<ret.size();i++)
3478 PyObject *tmp=PyTuple_New(2);
3479 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3480 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3481 PyList_SetItem(retPy,i,tmp);
3486 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3488 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3489 convertPyToVectorPairInt(r1,r1Cpp);
3490 convertPyToVectorPairInt(r2,r2Cpp);
3491 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3494 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3496 mcIdType szArr,sw,iTypppArr;
3497 std::vector<mcIdType> stdvecTyyppArr;
3498 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3499 mcIdType szArr2,sw2,iTypppArr2;
3500 std::vector<mcIdType> stdvecTyyppArr2;
3501 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3502 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3503 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3504 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3505 PyObject *ret=PyTuple_New(2);
3506 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3507 PyTuple_SetItem(ret,0,ret0Py);
3508 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3509 for(std::size_t i=0;i<partCompactFormat.size();i++)
3511 PyObject *tmp4=PyTuple_New(2);
3512 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3513 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3514 PyList_SetItem(ret1Py,i,tmp4);
3516 PyTuple_SetItem(ret,1,ret1Py);
3520 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3522 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3523 convertPyToVectorPairInt(bigInAbs,param0);
3524 convertPyToVectorPairInt(partOfBigInAbs,param1);
3525 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3526 PyObject *retPy(PyList_New(ret.size()));
3527 for(std::size_t i=0;i<ret.size();i++)
3529 PyObject *tmp(PyTuple_New(2));
3530 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3531 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3532 PyList_SetItem(retPy,i,tmp);
3537 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3539 std::vector< std::pair<mcIdType,mcIdType> > param0;
3540 convertPyToVectorPairInt(part,param0);
3541 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3542 PyObject *retPy(PyList_New(ret.size()));
3543 for(std::size_t i=0;i<ret.size();i++)
3545 PyObject *tmp(PyTuple_New(2));
3546 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3547 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3548 PyList_SetItem(retPy,i,tmp);
3553 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3555 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3556 convertPyToVectorPairInt(startingFrom,param0);
3557 convertPyToVectorPairInt(goingTo,param1);
3558 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3561 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3563 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3564 convertPyToVectorPairInt(bigInAbs,param0);
3565 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3566 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3567 PyObject *retPy(PyList_New(ret.size()));
3568 for(std::size_t i=0;i<ret.size();i++)
3570 PyObject *tmp(PyTuple_New(2));
3571 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3572 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3573 PyList_SetItem(retPy,i,tmp);
3580 class MEDCouplingCurveLinearMesh;
3582 //== MEDCouplingCMesh
3584 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3587 static MEDCouplingCMesh *New();
3588 static MEDCouplingCMesh *New(const std::string& meshName);
3589 void setCoords(const DataArrayDouble *coordsX,
3590 const DataArrayDouble *coordsY=0,
3591 const DataArrayDouble *coordsZ=0);
3592 void setCoordsAt(int i, const DataArrayDouble *arr);
3593 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3597 return MEDCouplingCMesh::New();
3599 MEDCouplingCMesh(const std::string& meshName)
3601 return MEDCouplingCMesh::New(meshName);
3603 std::string __str__() const
3605 return self->simpleRepr();
3607 std::string __repr__() const
3609 std::ostringstream oss;
3610 self->reprQuickOverview(oss);
3613 DataArrayDouble *getCoordsAt(int i)
3615 DataArrayDouble *ret=self->getCoordsAt(i);
3623 //== MEDCouplingCMesh End
3625 //== MEDCouplingCurveLinearMesh
3627 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3630 static MEDCouplingCurveLinearMesh *New();
3631 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3632 void setCoords(const DataArrayDouble *coords);
3634 MEDCouplingCurveLinearMesh()
3636 return MEDCouplingCurveLinearMesh::New();
3638 MEDCouplingCurveLinearMesh(const std::string& meshName)
3640 return MEDCouplingCurveLinearMesh::New(meshName);
3642 std::string __str__() const
3644 return self->simpleRepr();
3646 std::string __repr__() const
3648 std::ostringstream oss;
3649 self->reprQuickOverview(oss);
3652 DataArrayDouble *getCoords()
3654 DataArrayDouble *ret=self->getCoords();
3659 void setNodeGridStructure(PyObject *gridStruct)
3661 mcIdType szArr,sw,iTypppArr;
3662 std::vector<mcIdType> stdvecTyyppArr;
3663 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3664 self->setNodeGridStructure(tmp,tmp+szArr);
3669 //== MEDCouplingCurveLinearMesh End
3671 //== MEDCouplingIMesh
3673 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3676 static MEDCouplingIMesh *New();
3678 void setSpaceDimension(int spaceDim);
3679 std::vector<mcIdType> getNodeStruct() const;
3680 std::vector<double> getOrigin() const;
3681 std::vector<double> getDXYZ() const;
3682 void setAxisUnit(const std::string& unitName);
3683 std::string getAxisUnit() const;
3684 double getMeasureOfAnyCell() const;
3685 MEDCouplingCMesh *convertToCartesian() const;
3686 void refineWithFactor(const std::vector<mcIdType>& factors);
3687 MEDCouplingIMesh *asSingleCell() const;
3688 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3693 return MEDCouplingIMesh::New();
3695 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3697 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3698 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3699 const mcIdType *nodeStrctPtr(0);
3700 const double *originPtr(0),*dxyzPtr(0);
3701 mcIdType sw,sz,val0;
3702 std::vector<mcIdType> bb0;
3703 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3706 std::vector<double> bb,bb2;
3708 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3709 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3711 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3714 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3716 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3719 void setNodeStruct(PyObject *nodeStrct)
3721 mcIdType sw,sz,val0;
3722 std::vector<mcIdType> bb0;
3723 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3724 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3727 void setOrigin(PyObject *origin)
3729 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3731 std::vector<double> bb;
3732 mcIdType sw,nbTuples;
3733 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3734 self->setOrigin(originPtr,originPtr+nbTuples);
3737 void setDXYZ(PyObject *dxyz)
3739 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3741 std::vector<double> bb;
3742 mcIdType sw,nbTuples;
3743 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3744 self->setDXYZ(originPtr,originPtr+nbTuples);
3747 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3749 std::vector< std::pair<mcIdType,mcIdType> > inp;
3750 convertPyToVectorPairInt(fineLocInCoarse,inp);
3751 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3754 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3756 std::vector< std::pair<mcIdType,mcIdType> > inp;
3757 convertPyToVectorPairInt(fineLocInCoarse,inp);
3758 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3761 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3763 std::vector< std::pair<mcIdType,mcIdType> > inp;
3764 convertPyToVectorPairInt(fineLocInCoarse,inp);
3765 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3768 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3770 std::vector< std::pair<mcIdType,mcIdType> > inp;
3771 convertPyToVectorPairInt(fineLocInCoarse,inp);
3772 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3775 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3777 std::vector< std::pair<mcIdType,mcIdType> > inp;
3778 convertPyToVectorPairInt(fineLocInCoarse,inp);
3779 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3782 std::string __str__() const
3784 return self->simpleRepr();
3786 std::string __repr__() const
3788 std::ostringstream oss;
3789 self->reprQuickOverview(oss);
3795 //== MEDCouplingIMesh End
3799 namespace MEDCoupling
3801 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3804 virtual void checkConsistencyLight() const;
3805 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3806 bool areStrictlyCompatible(const MEDCouplingField *other) const;
3807 bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
3808 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3809 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3810 void setName(const char *name);
3811 std::string getDescription() const;
3812 void setDescription(const char *desc);
3813 std::string getName() const;
3814 TypeOfField getTypeOfField() const;
3815 NatureOfField getNature() const;
3816 virtual void setNature(NatureOfField nat);
3817 DataArrayDouble *getLocalizationOfDiscr() const;
3818 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3819 mcIdType getNumberOfTuplesExpected() const;
3820 mcIdType getNumberOfMeshPlacesExpected() const;
3821 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3822 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3823 void clearGaussLocalizations();
3824 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3825 mcIdType getNbOfGaussLocalization() const;
3826 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3827 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3828 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3829 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3831 PyObject *getMesh() const
3833 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3836 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3839 PyObject *getDiscretization()
3841 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3844 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3847 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3849 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3850 return convertIntArrToPyList3(ret);
3853 PyObject *buildSubMeshData(PyObject *li) const
3855 DataArrayIdType *ret1=0;
3856 MEDCouplingMesh *ret0=0;
3858 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3859 if (!SWIG_IsOK(res1))
3862 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3863 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3867 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3869 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3870 da2->checkAllocated();
3871 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3873 PyObject *res = PyList_New(2);
3874 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3875 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3879 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3881 DataArrayIdType *ret1=0;
3883 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3884 PyObject *res=PyTuple_New(2);
3885 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3887 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3890 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3891 PyTuple_SetItem(res,1,res1);
3896 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3899 mcIdType v0; std::vector<mcIdType> v1;
3900 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3901 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3904 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3905 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3908 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3909 if (!SWIG_IsOK(res1))
3912 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3913 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3917 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3919 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3920 da2->checkAllocated();
3921 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3925 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3927 std::vector<mcIdType> tmp;
3928 self->getCellIdsHavingGaussLocalization(locId,tmp);
3929 DataArrayIdType *ret=DataArrayIdType::New();
3930 ret->alloc((mcIdType)tmp.size(),1);
3931 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3935 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3937 std::vector<mcIdType> inp0;
3938 convertPyToNewIntArr4(code,1,3,inp0);
3939 std::vector<const DataArrayIdType *> inp1;
3940 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3941 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3946 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3949 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3950 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3951 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f);
3952 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f);
3953 static MEDCouplingFieldTemplate *New(TypeOfField type);
3954 std::string simpleRepr() const;
3955 std::string advancedRepr() const;
3956 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3957 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3960 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3962 return MEDCouplingFieldTemplate::New(f);
3965 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3967 return MEDCouplingFieldTemplate::New(f);
3970 MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f)
3972 return MEDCouplingFieldTemplate::New(f);
3975 MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f)
3977 return MEDCouplingFieldTemplate::New(f);
3980 MEDCouplingFieldTemplate(TypeOfField type)
3982 return MEDCouplingFieldTemplate::New(type);
3985 std::string __str__() const
3987 return self->simpleRepr();
3990 std::string __repr__() const
3992 std::ostringstream oss;
3993 self->reprQuickOverview(oss);
3997 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
4000 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
4001 PyObject *ret=PyTuple_New(2);
4002 PyObject *ret0Py=ret0?Py_True:Py_False;
4004 PyTuple_SetItem(ret,0,ret0Py);
4005 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4012 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
4015 TypeOfTimeDiscretization getTimeDiscretization() const;
4017 MEDCouplingFieldT();
4018 ~MEDCouplingFieldT();
4021 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
4022 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
4023 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
4025 class MEDCouplingFieldInt32;
4026 class MEDCouplingFieldInt64;
4027 class MEDCouplingFieldFloat;
4029 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
4032 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
4033 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
4034 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4035 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4036 void setTimeUnit(const std::string& unit);
4037 std::string getTimeUnit() const;
4038 void synchronizeTimeWithSupport();
4039 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
4040 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
4041 std::string simpleRepr() const;
4042 std::string advancedRepr() const;
4043 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
4044 MEDCouplingFieldInt32 *convertToIntField() const;
4045 MEDCouplingFieldFloat *convertToFloatField() const;
4046 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
4047 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
4048 MEDCouplingFieldDouble *deepCopy() const;
4049 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
4050 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
4051 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
4052 double getIJ(int tupleId, int compoId) const;
4053 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
4054 void synchronizeTimeWithMesh();
4055 void setArray(DataArrayDouble *array);
4056 void setEndArray(DataArrayDouble *array);
4057 void setTime(double val, int iteration, int order);
4058 void setStartTime(double val, int iteration, int order);
4059 void setEndTime(double val, int iteration, int order);
4060 void applyLin(double a, double b, int compoId);
4061 void applyLin(double a, double b);
4062 int getNumberOfComponents() const;
4063 int getNumberOfTuples() const;
4064 int getNumberOfValues() const;
4065 void setTimeTolerance(double val);
4066 double getTimeTolerance() const;
4067 void setIteration(int it);
4068 void setEndIteration(int it);
4069 void setOrder(int order);
4070 void setEndOrder(int order);
4071 void setTimeValue(double val);
4072 void setEndTimeValue(double val);
4073 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
4074 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
4075 bool mergeNodes(double eps, double epsOnVals=1e-15);
4076 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
4077 bool zipCoords(double epsOnVals=1e-15);
4078 bool zipConnectivity(int compType,double epsOnVals=1e-15);
4079 bool simplexize(int policy);
4080 MEDCouplingFieldDouble *doublyContractedProduct() const;
4081 MEDCouplingFieldDouble *determinant() const;
4082 MEDCouplingFieldDouble *eigenValues() const;
4083 MEDCouplingFieldDouble *eigenVectors() const;
4084 MEDCouplingFieldDouble *inverse() const;
4085 MEDCouplingFieldDouble *trace() const;
4086 MEDCouplingFieldDouble *deviator() const;
4087 MEDCouplingFieldDouble *magnitude() const;
4088 MEDCouplingFieldDouble *maxPerTuple() const;
4089 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
4090 void sortPerTuple(bool asc);
4091 MEDCouplingFieldDouble &operator=(double value);
4092 void fillFromAnalytic(int nbOfComp, const std::string& func);
4093 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4094 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4095 void applyFunc(int nbOfComp, const std::string& func);
4096 void applyFuncCompo(int nbOfComp, const std::string& func);
4097 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4098 void applyFunc(int nbOfComp, double val);
4099 void applyFunc(const std::string& func);
4100 void applyFuncFast32(const std::string& func);
4101 void applyFuncFast64(const std::string& func);
4102 double accumulate(int compId) const;
4103 double getMaxValue() const;
4104 double getMinValue() const;
4105 double getAverageValue() const;
4106 double norm2() const;
4107 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4108 double getWeightedAverageValue(int compId, bool isWAbs) const;
4109 double integral(int compId, bool isWAbs) const;
4110 double normL1(int compId) const;
4111 double normL2(int compId) const;
4112 double normMax(int compId) const;
4113 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4114 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4115 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4116 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4117 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4118 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4119 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4120 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4121 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4122 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4123 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4124 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4125 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4126 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4127 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4128 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4129 MEDCouplingFieldDouble *negate() const;
4131 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4133 return MEDCouplingFieldDouble::New(type,td);
4136 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4138 return MEDCouplingFieldDouble::New(ft,td);
4141 std::string __str__() const
4143 return self->simpleRepr();
4146 std::string __repr__() const
4148 std::ostringstream oss;
4149 self->reprQuickOverview(oss);
4153 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4156 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4157 PyObject *ret=PyTuple_New(2);
4158 PyObject *ret0Py=ret0?Py_True:Py_False;
4160 PyTuple_SetItem(ret,0,ret0Py);
4161 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4165 MEDCouplingFieldDouble *voronoize(double eps) const
4167 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4171 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4173 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4177 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4179 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4181 DataArrayDouble *a,*a2;
4182 DataArrayDoubleTuple *aa,*aa2;
4183 std::vector<double> bb,bb2;
4185 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4186 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4187 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4190 DataArrayDouble *getArray()
4192 DataArrayDouble *ret=self->getArray();
4198 PyObject *getArrays() const
4200 std::vector<DataArrayDouble *> arrs=self->getArrays();
4201 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4204 std::size_t sz=arrs.size();
4205 PyObject *ret=PyTuple_New(sz);
4206 for(std::size_t i=0;i<sz;i++)
4209 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4211 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4216 void setArrays(PyObject *ls)
4218 std::vector<const DataArrayDouble *> tmp;
4219 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4220 std::size_t sz=tmp.size();
4221 std::vector<DataArrayDouble *> arrs(sz);
4222 for(std::size_t i=0;i<sz;i++)
4223 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4224 self->setArrays(arrs);
4227 DataArrayDouble *getEndArray()
4229 DataArrayDouble *ret=self->getEndArray();
4235 PyObject *getValueOn(PyObject *sl) const
4239 DataArrayDoubleTuple *aa;
4240 std::vector<double> bb;
4242 const MEDCouplingMesh *mesh=self->getMesh();
4244 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4245 int spaceDim=mesh->getSpaceDimension();
4246 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4247 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4249 mcIdType sz=ToIdType(self->getNumberOfComponents());
4250 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4251 self->getValueOn(spaceLoc,res);
4252 return convertDblArrToPyList<double>(res,sz);
4255 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4257 mcIdType sz=ToIdType(self->getNumberOfComponents());
4258 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4259 self->getValueOnPos(i,j,k,res);
4260 return convertDblArrToPyList<double>(res,sz);
4263 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4265 const MEDCouplingMesh *mesh(self->getMesh());
4267 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4270 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4271 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4272 mesh->getSpaceDimension(),true,nbPts);
4273 return self->getValueOnMulti(inp,(int)nbPts);
4276 PyObject *getValueOn(PyObject *sl, double time) const
4280 DataArrayDoubleTuple *aa;
4281 std::vector<double> bb;
4283 const MEDCouplingMesh *mesh=self->getMesh();
4285 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4286 int spaceDim=mesh->getSpaceDimension();
4287 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4288 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4291 mcIdType sz=ToIdType(self->getNumberOfComponents());
4292 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4293 self->getValueOn(spaceLoc,time,res);
4294 return convertDblArrToPyList<double>(res,sz);
4297 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4299 if(self->getArray()!=0)
4300 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4303 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4304 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4305 self->setArray(arr);
4312 double tmp0=self->getTime(tmp1,tmp2);
4313 PyObject *res = PyList_New(3);
4314 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4315 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4316 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4320 PyObject *getStartTime()
4323 double tmp0=self->getStartTime(tmp1,tmp2);
4324 PyObject *res = PyList_New(3);
4325 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4326 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4327 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4331 PyObject *getEndTime()
4334 double tmp0=self->getEndTime(tmp1,tmp2);
4335 PyObject *res = PyList_New(3);
4336 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4337 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4338 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4341 PyObject *accumulate() const
4343 mcIdType sz=ToIdType(self->getNumberOfComponents());
4344 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4345 self->accumulate(tmp);
4346 return convertDblArrToPyList<double>(tmp,sz);
4348 PyObject *integral(bool isWAbs) const
4350 mcIdType sz=ToIdType(self->getNumberOfComponents());
4351 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4352 self->integral(isWAbs,tmp);
4353 return convertDblArrToPyList<double>(tmp,sz);
4355 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4357 mcIdType sz=ToIdType(self->getNumberOfComponents());
4358 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4359 self->getWeightedAverageValue(tmp,isWAbs);
4360 return convertDblArrToPyList<double>(tmp,sz);
4362 PyObject *normL1() const
4364 mcIdType sz=ToIdType(self->getNumberOfComponents());
4365 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4367 return convertDblArrToPyList<double>(tmp,sz);
4369 PyObject *normL2() const
4371 mcIdType sz=ToIdType(self->getNumberOfComponents());
4372 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4374 return convertDblArrToPyList<double>(tmp,sz);
4376 PyObject *normMax() const
4378 mcIdType sz=ToIdType(self->getNumberOfComponents());
4379 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4381 return convertDblArrToPyList<double>(tmp,sz);
4383 void renumberCells(PyObject *li, bool check=true)
4385 mcIdType szArr,sw,iTypppArr;
4386 std::vector<mcIdType> stdvecTyyppArr;
4387 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4388 self->renumberCells(tmp,check);
4391 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4393 mcIdType szArr,sw,iTypppArr;
4394 std::vector<mcIdType> stdvecTyyppArr;
4395 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4396 self->renumberCellsWithoutMesh(tmp,check);
4399 void renumberNodes(PyObject *li, double eps=1e-15)
4401 mcIdType szArr,sw,iTypppArr;
4402 std::vector<mcIdType> stdvecTyyppArr;
4403 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4404 self->renumberNodes(tmp,eps);
4407 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4409 mcIdType szArr,sw,iTypppArr;
4410 std::vector<mcIdType> stdvecTyyppArr;
4411 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4412 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4415 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4417 return fieldT_buildSubPart(self,li);
4420 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4422 return fieldT__getitem__(self,li);
4425 PyObject *getMaxValue2() const
4427 DataArrayIdType *tmp;
4428 double r1=self->getMaxValue2(tmp);
4429 PyObject *ret=PyTuple_New(2);
4430 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4435 PyObject *getMinValue2() const
4437 DataArrayIdType *tmp;
4438 double r1=self->getMinValue2(tmp);
4439 PyObject *ret=PyTuple_New(2);
4440 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4445 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4447 std::vector<std::size_t> tmp;
4448 convertPyToNewIntArr3(li,tmp);
4449 return self->keepSelectedComponents(tmp);
4452 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4454 std::vector<std::size_t> tmp;
4455 convertPyToNewIntArr3(li,tmp);
4456 self->setSelectedComponents(f,tmp);
4459 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4462 DataArrayDouble *a,*a2;
4463 DataArrayDoubleTuple *aa,*aa2;
4464 std::vector<double> bb,bb2;
4467 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4468 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4469 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4470 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4472 return self->extractSlice3D(orig,vect,eps);
4475 MEDCouplingFieldDouble *__add__(PyObject *obj)
4477 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4480 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4482 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4485 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4487 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.";
4488 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4491 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4493 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4495 return (*self)-(*other);
4497 throw INTERP_KERNEL::Exception(msg);
4502 DataArrayDoubleTuple *aa;
4503 std::vector<double> bb;
4505 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4510 if(!self->getArray())
4511 throw INTERP_KERNEL::Exception(msg2);
4512 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4513 ret->applyLin(1.,-val);
4514 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4515 ret2->setArray(ret);
4520 if(!self->getArray())
4521 throw INTERP_KERNEL::Exception(msg2);
4522 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4523 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4524 ret2->setArray(ret);
4529 if(!self->getArray())
4530 throw INTERP_KERNEL::Exception(msg2);
4531 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4532 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4533 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4534 ret2->setArray(ret);
4539 if(!self->getArray())
4540 throw INTERP_KERNEL::Exception(msg2);
4541 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4542 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4543 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4544 ret2->setArray(ret);
4548 { throw INTERP_KERNEL::Exception(msg); }
4552 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4554 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4557 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4559 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4562 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4564 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4567 MEDCouplingFieldDouble *__div__(PyObject *obj)
4569 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.";
4570 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4573 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4575 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4577 return (*self)/(*other);
4579 throw INTERP_KERNEL::Exception(msg);
4584 DataArrayDoubleTuple *aa;
4585 std::vector<double> bb;
4587 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4593 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4594 if(!self->getArray())
4595 throw INTERP_KERNEL::Exception(msg2);
4596 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4597 ret->applyLin(1./val,0);
4598 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4599 ret2->setArray(ret);
4604 if(!self->getArray())
4605 throw INTERP_KERNEL::Exception(msg2);
4606 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4607 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4608 ret2->setArray(ret);
4613 if(!self->getArray())
4614 throw INTERP_KERNEL::Exception(msg2);
4615 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4616 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4617 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4618 ret2->setArray(ret);
4623 if(!self->getArray())
4624 throw INTERP_KERNEL::Exception(msg2);
4625 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4626 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4627 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4628 ret2->setArray(ret);
4632 { throw INTERP_KERNEL::Exception(msg); }
4636 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4638 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4641 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4643 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.";
4644 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4647 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4649 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4651 return (*self)^(*other);
4653 throw INTERP_KERNEL::Exception(msg);
4658 DataArrayDoubleTuple *aa;
4659 std::vector<double> bb;
4661 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4666 if(!self->getArray())
4667 throw INTERP_KERNEL::Exception(msg2);
4668 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4670 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4671 ret2->setArray(ret);
4676 if(!self->getArray())
4677 throw INTERP_KERNEL::Exception(msg2);
4678 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4679 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4680 ret2->setArray(ret);
4685 if(!self->getArray())
4686 throw INTERP_KERNEL::Exception(msg2);
4687 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4688 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4689 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4690 ret2->setArray(ret);
4695 if(!self->getArray())
4696 throw INTERP_KERNEL::Exception(msg2);
4697 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4698 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4699 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4700 ret2->setArray(ret);
4704 { throw INTERP_KERNEL::Exception(msg); }
4708 MEDCouplingFieldDouble *__neg__() const
4710 return self->negate();
4713 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4715 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.";
4716 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4719 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4721 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4725 Py_XINCREF(trueSelf);
4729 throw INTERP_KERNEL::Exception(msg);
4734 DataArrayDoubleTuple *aa;
4735 std::vector<double> bb;
4737 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4742 if(!self->getArray())
4743 throw INTERP_KERNEL::Exception(msg2);
4744 self->getArray()->applyLin(1.,val);
4745 Py_XINCREF(trueSelf);
4750 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4753 Py_XINCREF(trueSelf);
4758 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4759 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4760 ret2->setArray(aaa);
4762 Py_XINCREF(trueSelf);
4767 if(!self->getArray())
4768 throw INTERP_KERNEL::Exception(msg2);
4769 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4770 self->getArray()->addEqual(aaa);
4771 Py_XINCREF(trueSelf);
4775 { throw INTERP_KERNEL::Exception(msg); }
4779 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4781 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.";
4782 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4785 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4787 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4791 Py_XINCREF(trueSelf);
4795 throw INTERP_KERNEL::Exception(msg);
4800 DataArrayDoubleTuple *aa;
4801 std::vector<double> bb;
4803 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4808 if(!self->getArray())
4809 throw INTERP_KERNEL::Exception(msg2);
4810 self->getArray()->applyLin(1.,-val);
4811 Py_XINCREF(trueSelf);
4816 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4819 Py_XINCREF(trueSelf);
4824 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4825 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4826 ret2->setArray(aaa);
4828 Py_XINCREF(trueSelf);
4833 if(!self->getArray())
4834 throw INTERP_KERNEL::Exception(msg2);
4835 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4836 self->getArray()->substractEqual(aaa);
4837 Py_XINCREF(trueSelf);
4841 { throw INTERP_KERNEL::Exception(msg); }
4845 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4847 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.";
4848 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4851 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4853 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4857 Py_XINCREF(trueSelf);
4861 throw INTERP_KERNEL::Exception(msg);
4866 DataArrayDoubleTuple *aa;
4867 std::vector<double> bb;
4869 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4874 if(!self->getArray())
4875 throw INTERP_KERNEL::Exception(msg2);
4876 self->getArray()->applyLin(val,0);
4877 Py_XINCREF(trueSelf);
4882 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4885 Py_XINCREF(trueSelf);
4890 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4891 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4892 ret2->setArray(aaa);
4894 Py_XINCREF(trueSelf);
4899 if(!self->getArray())
4900 throw INTERP_KERNEL::Exception(msg2);
4901 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4902 self->getArray()->multiplyEqual(aaa);
4903 Py_XINCREF(trueSelf);
4907 { throw INTERP_KERNEL::Exception(msg); }
4911 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4913 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.";
4914 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4917 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4919 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4923 Py_XINCREF(trueSelf);
4927 throw INTERP_KERNEL::Exception(msg);
4932 DataArrayDoubleTuple *aa;
4933 std::vector<double> bb;
4935 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4941 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4942 if(!self->getArray())
4943 throw INTERP_KERNEL::Exception(msg2);
4944 self->getArray()->applyLin(1./val,0);
4945 Py_XINCREF(trueSelf);
4950 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4953 Py_XINCREF(trueSelf);
4958 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4959 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4960 ret2->setArray(aaa);
4962 Py_XINCREF(trueSelf);
4967 if(!self->getArray())
4968 throw INTERP_KERNEL::Exception(msg2);
4969 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4970 self->getArray()->divideEqual(aaa);
4971 Py_XINCREF(trueSelf);
4975 { throw INTERP_KERNEL::Exception(msg); }
4979 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4981 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.";
4982 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4985 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4987 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4991 Py_XINCREF(trueSelf);
4995 throw INTERP_KERNEL::Exception(msg);
5000 DataArrayDoubleTuple *aa;
5001 std::vector<double> bb;
5003 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
5008 if(!self->getArray())
5009 throw INTERP_KERNEL::Exception(msg2);
5010 self->getArray()->applyPow(val);
5011 Py_XINCREF(trueSelf);
5016 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5019 Py_XINCREF(trueSelf);
5024 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5025 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5026 ret2->setArray(aaa);
5028 Py_XINCREF(trueSelf);
5033 if(!self->getArray())
5034 throw INTERP_KERNEL::Exception(msg2);
5035 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
5036 self->getArray()->powEqual(aaa);
5037 Py_XINCREF(trueSelf);
5041 { throw INTERP_KERNEL::Exception(msg); }
5045 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
5047 std::vector<const MEDCouplingFieldDouble *> tmp;
5048 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5049 return MEDCouplingFieldDouble::MergeFields(tmp);
5052 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
5054 std::vector<const MEDCouplingFieldDouble *> tmp;
5055 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5056 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
5059 PyObject *getTinySerializationInformation() const
5061 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
5064 PyObject *serialize() const
5066 return field_serialize<double>(self);
5069 PyObject *__getstate__() const
5071 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
5074 void __setstate__(PyObject *inp)
5076 field__setstate__<double>(self,inp);
5081 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5084 int getNumberOfFields() const;
5085 MEDCouplingMultiFields *deepCopy() const;
5086 virtual std::string simpleRepr() const;
5087 virtual std::string advancedRepr() const;
5088 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5089 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5090 virtual void checkConsistencyLight() const;
5093 std::string __str__() const
5095 return self->simpleRepr();
5097 static MEDCouplingMultiFields *New(PyObject *li)
5099 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5100 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5101 std::size_t sz=tmp.size();
5102 std::vector<MEDCouplingFieldDouble *> fs(sz);
5103 for(std::size_t i=0;i<sz;i++)
5104 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5105 return MEDCouplingMultiFields::New(fs);
5107 MEDCouplingMultiFields(PyObject *li)
5109 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5110 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5111 std::size_t sz=tmp.size();
5112 std::vector<MEDCouplingFieldDouble *> fs(sz);
5113 for(std::size_t i=0;i<sz;i++)
5114 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5115 return MEDCouplingMultiFields::New(fs);
5117 PyObject *getFields() const
5119 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5120 std::size_t sz=fields.size();
5121 PyObject *res = PyList_New(sz);
5122 for(std::size_t i=0;i<sz;i++)
5126 fields[i]->incrRef();
5127 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5131 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5136 PyObject *getFieldAtPos(int id) const
5138 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5145 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5147 PyObject *getMeshes() const
5149 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5150 std::size_t sz=ms.size();
5151 PyObject *res = PyList_New(sz);
5152 for(std::size_t i=0;i<sz;i++)
5157 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5161 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5166 PyObject *getDifferentMeshes() const
5168 std::vector<int> refs;
5169 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5170 std::size_t sz=ms.size();
5171 PyObject *res = PyList_New(sz);
5172 for(std::size_t i=0;i<sz;i++)
5177 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5181 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5185 PyObject *ret=PyTuple_New(2);
5186 PyTuple_SetItem(ret,0,res);
5187 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5190 PyObject *getArrays() const
5192 std::vector<DataArrayDouble *> ms=self->getArrays();
5193 std::size_t sz=ms.size();
5194 PyObject *res = PyList_New(sz);
5195 for(std::size_t i=0;i<sz;i++)
5200 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5204 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5209 PyObject *getDifferentArrays() const
5211 std::vector< std::vector<int> > refs;
5212 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5213 std::size_t sz=ms.size();
5214 PyObject *res = PyList_New(sz);
5215 PyObject *res2 = PyList_New(sz);
5216 for(std::size_t i=0;i<sz;i++)
5221 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5225 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5227 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5230 PyObject *ret=PyTuple_New(2);
5231 PyTuple_SetItem(ret,0,res);
5232 PyTuple_SetItem(ret,1,res2);
5238 class MEDCouplingFieldInt32 : public MEDCouplingFieldT<int>
5241 static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5242 static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5243 bool isEqual(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5244 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5245 void setTimeUnit(const std::string& unit);
5246 std::string getTimeUnit() const;
5247 void setTime(double val, int iteration, int order);
5248 void setArray(DataArrayInt32 *array);
5249 MEDCouplingFieldInt32 *deepCopy() const;
5250 MEDCouplingFieldInt32 *clone(bool recDeepCpy) const;
5251 MEDCouplingFieldInt32 *cloneWithMesh(bool recDeepCpy) const;
5252 MEDCouplingFieldDouble *convertToDblField() const;
5253 MEDCouplingFieldInt32 *buildSubPartRange(int begin, int end, int step) const;
5255 MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5257 return MEDCouplingFieldInt32::New(type,td);
5260 MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5262 return MEDCouplingFieldInt32::New(ft,td);
5265 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const
5268 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5269 PyObject *ret=PyTuple_New(2);
5270 PyObject *ret0Py=ret0?Py_True:Py_False;
5272 PyTuple_SetItem(ret,0,ret0Py);
5273 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5277 std::string __str__() const
5279 return self->simpleRepr();
5282 std::string __repr__() const
5284 std::ostringstream oss;
5285 self->reprQuickOverview(oss);
5289 MEDCouplingFieldInt32 *buildSubPart(PyObject *li) const
5291 return fieldT_buildSubPart(self,li);
5294 MEDCouplingFieldInt32 *__getitem__(PyObject *li) const
5296 return fieldT__getitem__(self,li);
5299 DataArrayInt32 *getArray()
5301 DataArrayInt32 *ret=self->getArray();
5310 double tmp0=self->getTime(tmp1,tmp2);
5311 PyObject *res = PyList_New(3);
5312 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5313 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5314 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5318 PyObject *getTinySerializationInformation() const
5320 return field_getTinySerializationInformation<MEDCouplingFieldInt32>(self);
5323 PyObject *serialize() const
5325 return field_serialize<int>(self);
5328 PyObject *__getstate__() const
5330 return field__getstate__<MEDCouplingFieldInt32>(self,MEDCoupling_MEDCouplingFieldInt32_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt32_serialize);
5333 void __setstate__(PyObject *inp)
5335 field__setstate__<int>(self,inp);
5340 class MEDCouplingFieldInt64 : public MEDCouplingFieldT<int>
5343 static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5344 static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5345 bool isEqual(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5346 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5347 void setTimeUnit(const std::string& unit);
5348 std::string getTimeUnit() const;
5349 void setTime(double val, int iteration, int order);
5350 void setArray(DataArrayInt64 *array);
5351 MEDCouplingFieldInt64 *deepCopy() const;
5352 MEDCouplingFieldInt64 *clone(bool recDeepCpy) const;
5353 MEDCouplingFieldInt64 *cloneWithMesh(bool recDeepCpy) const;
5354 MEDCouplingFieldDouble *convertToDblField() const;
5355 MEDCouplingFieldInt64 *buildSubPartRange(int begin, int end, int step) const;
5357 MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5359 return MEDCouplingFieldInt64::New(type,td);
5362 MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5364 return MEDCouplingFieldInt64::New(ft,td);
5367 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const
5370 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5371 PyObject *ret=PyTuple_New(2);
5372 PyObject *ret0Py=ret0?Py_True:Py_False;
5374 PyTuple_SetItem(ret,0,ret0Py);
5375 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5379 std::string __str__() const
5381 return self->simpleRepr();
5384 std::string __repr__() const
5386 std::ostringstream oss;
5387 self->reprQuickOverview(oss);
5391 MEDCouplingFieldInt64 *buildSubPart(PyObject *li) const
5393 return fieldT_buildSubPart(self,li);
5396 MEDCouplingFieldInt64 *__getitem__(PyObject *li) const
5398 return fieldT__getitem__(self,li);
5401 DataArrayInt64 *getArray()
5403 DataArrayInt64 *ret=self->getArray();
5412 double tmp0=self->getTime(tmp1,tmp2);
5413 PyObject *res = PyList_New(3);
5414 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5415 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5416 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5420 PyObject *getTinySerializationInformation() const
5422 return field_getTinySerializationInformation<MEDCouplingFieldInt64>(self);
5425 PyObject *serialize() const
5427 return field_serialize<Int64>(self);
5430 PyObject *__getstate__() const
5432 return field__getstate__<MEDCouplingFieldInt64>(self,MEDCoupling_MEDCouplingFieldInt64_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt64_serialize);
5435 void __setstate__(PyObject *inp)
5437 field__setstate__<Int64>(self,inp);
5442 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5445 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5446 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5447 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5448 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5449 void setTimeUnit(const std::string& unit);
5450 std::string getTimeUnit() const;
5451 void setTime(double val, int iteration, int order);
5452 void setArray(DataArrayFloat *array);
5453 MEDCouplingFieldFloat *deepCopy() const;
5454 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5455 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5456 MEDCouplingFieldDouble *convertToDblField() const;
5457 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5459 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5461 return MEDCouplingFieldFloat::New(type,td);
5464 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5466 return MEDCouplingFieldFloat::New(ft,td);
5469 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5472 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5473 PyObject *ret=PyTuple_New(2);
5474 PyObject *ret0Py=ret0?Py_True:Py_False;
5476 PyTuple_SetItem(ret,0,ret0Py);
5477 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5481 std::string __str__() const
5483 return self->simpleRepr();
5486 std::string __repr__() const
5488 std::ostringstream oss;
5489 self->reprQuickOverview(oss);
5493 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5495 return fieldT_buildSubPart(self,li);
5498 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5500 return fieldT__getitem__(self,li);
5503 DataArrayFloat *getArray()
5505 DataArrayFloat *ret=self->getArray();
5514 double tmp0=self->getTime(tmp1,tmp2);
5515 PyObject *res = PyList_New(3);
5516 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5517 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5518 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5522 PyObject *getTinySerializationInformation() const
5524 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5527 PyObject *serialize() const
5529 return field_serialize<float>(self);
5532 PyObject *__getstate__() const
5534 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5537 void __setstate__(PyObject *inp)
5539 field__setstate__<float>(self,inp);
5544 class MEDCouplingDefinitionTime
5547 MEDCouplingDefinitionTime();
5548 void assign(const MEDCouplingDefinitionTime& other);
5549 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5550 double getTimeResolution() const;
5551 std::vector<double> getHotSpotsTime() const;
5554 std::string __str__() const
5556 std::ostringstream oss;
5557 self->appendRepr(oss);
5561 PyObject *getIdsOnTimeRight(double tm) const
5563 int meshId,arrId,arrIdInField,fieldId;
5564 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5565 PyObject *res=PyList_New(4);
5566 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5567 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5568 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5569 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5573 PyObject *getIdsOnTimeLeft(double tm) const
5575 int meshId,arrId,arrIdInField,fieldId;
5576 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5577 PyObject *res=PyList_New(4);
5578 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5579 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5580 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5581 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5587 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5590 double getTimeTolerance() const;
5591 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5595 MEDCouplingFieldOverTime(PyObject *li)
5597 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5598 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5599 std::size_t sz=tmp.size();
5600 std::vector<MEDCouplingFieldDouble *> fs(sz);
5601 for(std::size_t i=0;i<sz;i++)
5602 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5603 return MEDCouplingFieldOverTime::New(fs);
5605 std::string __str__() const
5607 return self->simpleRepr();
5609 static MEDCouplingFieldOverTime *New(PyObject *li)
5611 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5612 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5613 std::size_t sz=tmp.size();
5614 std::vector<MEDCouplingFieldDouble *> fs(sz);
5615 for(std::size_t i=0;i<sz;i++)
5616 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5617 return MEDCouplingFieldOverTime::New(fs);
5622 class MEDCouplingCartesianAMRMesh;
5624 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5627 int getNumberOfCellsRecursiveWithOverlap() const;
5628 int getNumberOfCellsRecursiveWithoutOverlap() const;
5629 int getMaxNumberOfLevelsRelativeToThis() const;
5632 MEDCouplingCartesianAMRMeshGen *getMesh() const
5634 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5642 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5645 int getNumberOfOverlapedCellsForFather() const;
5646 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5647 std::vector<mcIdType> computeCellGridSt() const;
5650 PyObject *getBLTRRange() const
5652 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5653 return convertFromVectorPairInt(ret);
5656 PyObject *getBLTRRangeRelativeToGF() const
5658 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5659 return convertFromVectorPairInt(ret);
5662 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5664 std::vector< std::pair<mcIdType,mcIdType> > inp;
5665 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5666 self->addPatch(inp,factors);
5669 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5671 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5673 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5674 if(patchId==mesh->getNumberOfPatches())
5676 std::ostringstream oss;
5677 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5678 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5681 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5687 void __delitem__(mcIdType patchId)
5689 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5691 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5692 mesh->removePatch(patchId);
5695 mcIdType __len__() const
5697 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5699 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5700 return mesh->getNumberOfPatches();
5705 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5709 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5712 mcIdType getAbsoluteLevel() const;
5713 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5714 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5715 int getSpaceDimension() const;
5716 const std::vector<mcIdType>& getFactors() const;
5717 void setFactors(const std::vector<mcIdType>& newFactors);
5718 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5719 mcIdType getNumberOfCellsAtCurrentLevel() const;
5720 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5721 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5722 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5723 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5724 virtual void detachFromFather();
5726 mcIdType getNumberOfPatches() const;
5727 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5728 MEDCouplingUMesh *buildUnstructured() const;
5729 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5730 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5731 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5732 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5733 void removeAllPatches();
5734 void removePatch(mcIdType patchId);
5735 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5736 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5737 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5738 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5739 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5740 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5741 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5742 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5743 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5744 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5745 std::string buildPythonDumpOfThis() const;
5748 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5750 std::vector< std::pair<mcIdType,mcIdType> > inp;
5751 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5752 self->addPatch(inp,factors);
5755 PyObject *getPatches() const
5757 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5758 std::size_t sz(ps.size());
5759 PyObject *ret = PyList_New(sz);
5760 for(std::size_t i=0;i<sz;i++)
5762 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5765 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5770 // agy : don't know why typemap fails here ??? let it in the extend section
5771 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5773 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5776 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5778 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5779 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5785 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5787 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5788 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5794 virtual PyObject *positionRelativeToGodFather() const
5796 std::vector<mcIdType> out1;
5797 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5798 PyObject *ret(PyTuple_New(2));
5799 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5800 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5804 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5806 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5807 std::size_t sz(ps.size());
5808 PyObject *ret = PyList_New(sz);
5809 for(std::size_t i=0;i<sz;i++)
5810 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5814 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5816 std::vector<const DataArrayDouble *> inp;
5817 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5818 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5821 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5823 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5829 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5831 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5837 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5839 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5845 MEDCouplingIMesh *getImageMesh() const
5847 const MEDCouplingIMesh *ret(self->getImageMesh());
5850 return const_cast<MEDCouplingIMesh *>(ret);
5853 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5855 if(patchId==self->getNumberOfPatches())
5857 std::ostringstream oss;
5858 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5859 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5862 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5868 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5870 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5871 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5872 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5875 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5877 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5878 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5879 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5882 void __delitem__(mcIdType patchId)
5884 self->removePatch(patchId);
5887 mcIdType __len__() const
5889 return self->getNumberOfPatches();
5894 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5898 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5901 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5904 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5906 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5907 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5908 const mcIdType *nodeStrctPtr(0);
5909 const double *originPtr(0),*dxyzPtr(0);
5910 mcIdType sw,sz,val0;
5911 std::vector<mcIdType> bb0;
5912 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5915 std::vector<double> bb,bb2;
5917 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5918 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5920 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5923 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5925 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5926 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5927 std::vector< std::vector<mcIdType> > inp2;
5928 convertPyToVectorOfVectorOfInt(factors,inp2);
5929 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5932 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5934 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5937 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5939 return MEDCouplingCartesianAMRMesh::New(mesh);
5944 class MEDCouplingDataForGodFather : public RefCountObject
5947 virtual void synchronizeFineToCoarse();
5948 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5949 virtual void synchronizeCoarseToFine();
5950 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5951 virtual void synchronizeAllGhostZones();
5952 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5953 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5954 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5955 virtual void alloc();
5956 virtual void dealloc();
5959 MEDCouplingCartesianAMRMesh *getMyGodFather()
5961 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5969 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5972 mcIdType getNumberOfLevels() const;
5973 MEDCouplingAMRAttribute *deepCopy() const;
5974 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5975 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5976 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5977 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5978 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5979 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5980 std::string writeVTHB(const std::string& fileName) const;
5983 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5985 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5986 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5987 MEDCouplingAMRAttribute *ret(0);
5990 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5991 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5993 catch(INTERP_KERNEL::Exception&)
5995 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5996 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
6001 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
6003 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
6006 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
6008 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
6009 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
6015 void spillInfoOnComponents(PyObject *compNames)
6017 std::vector< std::vector<std::string> > compNamesCpp;
6018 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
6019 self->spillInfoOnComponents(compNamesCpp);
6022 void spillNatures(PyObject *nfs)
6024 std::vector<mcIdType> inp0;
6025 if(!fillIntVector(nfs,inp0))
6026 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
6027 std::size_t sz(inp0.size());
6028 std::vector<NatureOfField> inp00(sz);
6029 for(std::size_t i=0;i<sz;i++)
6030 inp00[i]=(NatureOfField)inp0[i];
6031 self->spillNatures(inp00);
6034 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
6036 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
6037 std::size_t sz(ret.size());
6038 PyObject *retPy(PyList_New(sz));
6039 for(std::size_t i=0;i<sz;i++)
6040 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6046 class DenseMatrix : public RefCountObject, public TimeLabel
6049 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
6050 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
6051 DenseMatrix *deepCopy() const;
6052 DenseMatrix *shallowCpy() const;
6054 mcIdType getNumberOfRows() const;
6055 mcIdType getNumberOfCols() const;
6056 mcIdType getNbOfElems() const;
6057 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
6058 void reShape(mcIdType nbRows, mcIdType nbCols);
6061 bool isEqual(const DenseMatrix& other, double eps) const;
6062 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
6063 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
6066 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
6068 return DenseMatrix::New(nbRows,nbCols);
6071 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
6073 return DenseMatrix::New(array,nbRows,nbCols);
6076 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
6079 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
6080 PyObject *ret=PyTuple_New(2);
6081 PyObject *ret0Py=ret0?Py_True:Py_False;
6083 PyTuple_SetItem(ret,0,ret0Py);
6084 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6088 DataArrayDouble *getData()
6090 DataArrayDouble *ret(self->getData());
6096 DenseMatrix *__add__(const DenseMatrix *other)
6098 return MEDCoupling::DenseMatrix::Add(self,other);
6101 DenseMatrix *__sub__(const DenseMatrix *other)
6103 return MEDCoupling::DenseMatrix::Substract(self,other);
6106 DenseMatrix *__mul__(const DenseMatrix *other)
6108 return MEDCoupling::DenseMatrix::Multiply(self,other);
6111 DenseMatrix *__mul__(const DataArrayDouble *other)
6113 return MEDCoupling::DenseMatrix::Multiply(self,other);
6116 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
6118 self->addEqual(other);
6119 Py_XINCREF(trueSelf);
6123 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
6125 self->substractEqual(other);
6126 Py_XINCREF(trueSelf);
6130 PyObject *toNumPyMatrix() // not const. It is not a bug !
6132 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
6141 def MEDCouplingUMeshReduce(self):
6142 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
6143 def MEDCouplingCMeshReduce(self):
6144 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
6145 def MEDCouplingIMeshReduce(self):
6146 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
6147 def MEDCouplingMappedExtrudedMeshReduce(self):
6148 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
6149 def MEDCouplingCurveLinearMeshReduce(self):
6150 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
6151 def MEDCoupling1SGTUMeshReduce(self):
6152 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
6153 def MEDCoupling1DGTUMeshReduce(self):
6154 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
6155 def MEDCouplingFieldDoubleReduce(self):
6156 self.checkConsistencyLight()
6157 d=(self.getTypeOfField(),self.getTimeDiscretization())
6158 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
6159 def MEDCouplingFieldInt32Reduce(self):
6160 self.checkConsistencyLight()
6161 d=(self.getTypeOfField(),self.getTimeDiscretization())
6162 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt32,(d,(self.__getstate__()),))
6163 def MEDCouplingFieldInt64Reduce(self):
6164 self.checkConsistencyLight()
6165 d=(self.getTypeOfField(),self.getTimeDiscretization())
6166 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),))
6167 def MEDCouplingFieldFloatReduce(self):
6168 self.checkConsistencyLight()
6169 d=(self.getTypeOfField(),self.getTimeDiscretization())
6170 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
6171 def MEDCouplingFTReduceFunct(cls,params):
6173 ret=object.__new__(cls)
6177 def MEDCouplingFieldTemplateReduce(self):
6178 ret = MEDCouplingFieldDouble(self)
6179 nbTuples = self.getNumberOfTuplesExpected()
6180 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
6182 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
6184 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
6186 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
6187 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
6188 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
6189 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
6190 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
6191 MEDCouplingFieldInt = MEDCouplingFieldInt32
6193 if MEDCouplingUse64BitIDs():
6194 MEDCouplingFieldID = MEDCouplingFieldInt64
6196 MEDCouplingFieldID = MEDCouplingFieldInt32
6202 __filename=os.environ.get('PYTHONSTARTUP')
6203 if __filename and os.path.isfile(__filename):
6204 with open(__filename) as __fp: