1 // Copyright (C) 2017-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifdef WITH_DOCSTRINGS
22 %include MEDCoupling_doc.i
29 #include "MEDCouplingMemArray.hxx"
30 #include "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<long>;
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::sortHexa8EachOther;
417 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
418 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
419 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
420 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
421 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
422 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
423 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
424 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
425 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
426 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
427 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
428 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
429 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
430 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
431 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
432 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
433 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
434 %newobject MEDCoupling::MEDCouplingCMesh::New;
435 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
436 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
437 %newobject MEDCoupling::MEDCouplingIMesh::New;
438 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
439 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
440 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
441 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
442 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
443 %newobject MEDCoupling::MEDCouplingMultiFields::New;
444 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
445 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
446 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
447 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
448 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
449 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
450 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
451 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
452 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
453 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
454 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
455 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
456 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
457 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
458 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
459 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
460 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
461 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
462 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
463 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
464 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
465 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
466 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
467 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
468 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
469 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
470 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
471 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
472 %newobject MEDCoupling::DenseMatrix::New;
473 %newobject MEDCoupling::DenseMatrix::deepCopy;
474 %newobject MEDCoupling::DenseMatrix::shallowCpy;
475 %newobject MEDCoupling::DenseMatrix::getData;
476 %newobject MEDCoupling::DenseMatrix::matVecMult;
477 %newobject MEDCoupling::DenseMatrix::MatVecMult;
478 %newobject MEDCoupling::DenseMatrix::__add__;
479 %newobject MEDCoupling::DenseMatrix::__sub__;
480 %newobject MEDCoupling::DenseMatrix::__mul__;
481 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
482 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
483 %newobject MEDCoupling::MEDCouplingGaussLocalization::getShapeFunctionValues;
484 %newobject MEDCoupling::MEDCouplingGaussLocalization::getDerivativeOfShapeFunctionValues;
485 %newobject MEDCoupling::MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf;
486 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
487 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
488 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
489 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
490 %newobject MEDCoupling::MEDCouplingSkyLineArray::groupPacks;
491 %newobject MEDCoupling::MEDCouplingSkyLineArray::uniqueNotSortedByPack;
492 %newobject MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks;
493 %newobject MEDCoupling::MEDCouplingSkyLineArray::deepCopy;
495 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
496 %feature("unref") MEDCouplingMesh "$this->decrRef();"
497 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
498 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
499 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
500 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
501 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
502 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
503 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
504 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
505 %feature("unref") MEDCouplingField "$this->decrRef();"
506 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
507 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
508 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
509 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
510 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
511 %feature("unref") MEDCouplingFieldDiscretizationOnNodesFE "$this->decrRef();"
512 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
513 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
514 %feature("unref") MEDCouplingFieldInt32 "$this->decrRef();"
515 %feature("unref") MEDCouplingFieldInt64 "$this->decrRef();"
516 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
517 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
518 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
519 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
520 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
521 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
522 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
523 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
524 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
525 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
526 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
527 %feature("unref") DenseMatrix "$this->decrRef();"
528 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
530 %rename(assign) *::operator=;
531 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
532 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
533 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
534 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
538 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
539 // on the Python side. Must be put BEFORE the %rename clause:
540 %exceptionclass INTERP_KERNEL::Exception;
541 %rename (InterpKernelException) INTERP_KERNEL::Exception;
543 %include "MEDCouplingRefCountObject.i"
544 %include "MEDCouplingMemArray.i"
548 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
549 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
550 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
551 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
552 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
553 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
554 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
555 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
556 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
562 PyObject *med2vtk_cell_types()
564 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
565 PyObject *ret(PyList_New(sz));
566 for(Py_ssize_t i=0;i<sz;i++)
568 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
569 PyList_SetItem(ret,i,PyInt_FromLong(elt));
574 PyObject *vtk2med_cell_types()
576 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
577 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
578 auto szOut(maxElt+1);
579 std::vector< mcIdType > retCpp(szOut,-1);
581 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
583 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
587 PyObject *ret(PyList_New(szOut));
589 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
590 PyList_SetItem(ret,id,PyInt_FromLong(*it));
594 PyObject *AllGeometricTypes()
596 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
597 PyObject *ret(PyList_New(sz));
598 for(Py_ssize_t i=0;i<sz;i++)
599 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
604 namespace INTERP_KERNEL
607 * \class BoxSplittingOptions
608 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
610 class BoxSplittingOptions
613 BoxSplittingOptions();
615 double getEfficiencyGoal() const;
616 void setEfficiencyGoal(double efficiency);
617 double getEfficiencyThreshold() const;
618 void setEfficiencyThreshold(double efficiencyThreshold);
619 int getMinimumPatchLength() const;
620 void setMinimumPatchLength(int minPatchLength);
621 int getMaximumPatchLength() const;
622 void setMaximumPatchLength(int maxPatchLength);
623 int getMaximumNbOfCellsInPatch() const;
624 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
625 void copyOptions(const BoxSplittingOptions & other);
626 std::string printOptions() const;
629 std::string __str__() const
631 return self->printOptions();
637 namespace MEDCoupling
654 CONST_ON_TIME_INTERVAL = 7
655 } TypeOfTimeDiscretization;
663 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
664 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
666 } MEDCouplingMeshType;
668 class DataArrayInt32;
669 class DataArrayInt64;
670 class DataArrayDouble;
671 class MEDCouplingUMesh;
672 class MEDCouplingCMesh;
673 class MEDCouplingFieldDouble;
675 %extend RefCountObject
677 std::string getHiddenCppPointer() const
679 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
684 %extend MEDCouplingGaussLocalization
686 std::string __str__() const
688 return self->getStringRepr();
691 std::string __repr__() const
693 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
694 oss << self->getStringRepr();
701 class MEDCouplingMesh : public RefCountObject, public TimeLabel
704 void setName(const std::string& name);
705 std::string getName() const;
706 void setDescription(const std::string& descr);
707 std::string getDescription() const;
708 void setTime(double val, int iteration, int order);
709 void setTimeUnit(const std::string& unit);
710 std::string getTimeUnit() const;
711 virtual MEDCouplingMeshType getType() const;
712 bool isStructured() const;
713 virtual MEDCouplingMesh *deepCopy() const;
714 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
715 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
716 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
717 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
718 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
719 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
720 virtual void checkConsistencyLight() const;
721 virtual void checkConsistency(double eps=1e-12) const;
722 virtual int getNumberOfCells() const;
723 virtual int getNumberOfNodes() const;
724 virtual int getSpaceDimension() const;
725 virtual int getMeshDimension() const;
726 virtual DataArrayDouble *getCoordinatesAndOwner() const;
727 virtual DataArrayDouble *computeCellCenterOfMass() const;
728 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
729 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
730 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
731 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
732 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
733 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
734 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
735 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
736 virtual std::string simpleRepr() const;
737 virtual std::string advancedRepr() const;
738 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
739 virtual std::string getVTKFileExtension() const;
740 std::string getVTKFileNameOf(const std::string& fileName) const;
742 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
743 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
744 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
745 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
746 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
747 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
748 virtual MEDCouplingUMesh *buildUnstructured() const;
749 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
750 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
751 virtual DataArrayIdType *simplexize(int policy);
752 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
753 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
754 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
755 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
756 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
757 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
758 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
759 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
762 std::string __str__() const
764 return self->simpleRepr();
767 DataArrayDouble *computeMeshCenterOfMass() const
769 MCAuto<DataArrayDouble> ret(self->computeMeshCenterOfMass());
776 double tmp0=self->getTime(tmp1,tmp2);
777 PyObject *res = PyList_New(3);
778 PyList_SetItem(res,0,SWIG_From_double(tmp0));
779 PyList_SetItem(res,1,SWIG_From_int(tmp1));
780 PyList_SetItem(res,2,SWIG_From_int(tmp2));
784 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
786 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
787 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
793 mcIdType getCellContainingPoint(PyObject *p, double eps) const
797 DataArrayDoubleTuple *aa;
798 std::vector<double> bb;
800 int spaceDim=self->getSpaceDimension();
801 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
802 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
803 return self->getCellContainingPoint(pos,eps);
806 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
810 DataArrayDoubleTuple *aa;
811 std::vector<double> bb;
813 int spaceDim=self->getSpaceDimension();
814 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
815 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
816 MCAuto<DataArrayIdType> elts,eltsIndex;
817 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
818 PyObject *ret=PyTuple_New(2);
819 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
820 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
824 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
828 DataArrayDoubleTuple *aa;
829 std::vector<double> bb;
831 int spaceDim=self->getSpaceDimension();
832 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
833 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
834 MCAuto<DataArrayIdType> elts,eltsIndex;
835 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
836 PyObject *ret=PyTuple_New(2);
837 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
838 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
842 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
844 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
845 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
848 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
850 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
851 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
854 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
858 DataArrayDoubleTuple *aa;
859 std::vector<double> bb;
861 int spaceDim=self->getSpaceDimension();
862 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
863 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
864 std::vector<mcIdType> elts;
865 self->getCellsContainingPoint(pos,eps,elts);
866 DataArrayIdType *ret=DataArrayIdType::New();
867 ret->alloc((int)elts.size(),1);
868 std::copy(elts.begin(),elts.end(),ret->getPointer());
869 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
872 virtual PyObject *getReverseNodalConnectivity() const
874 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
875 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
876 self->getReverseNodalConnectivity(d0,d1);
877 PyObject *ret=PyTuple_New(2);
878 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
879 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
883 void renumberCells(PyObject *li, bool check=true)
886 mcIdType v0; std::vector<mcIdType> v1;
887 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
888 self->renumberCells(ids,check);
891 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
893 DataArrayIdType *cellCor, *nodeCor;
894 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
895 PyObject *res = PyList_New(2);
896 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
897 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
901 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
903 DataArrayIdType *cellCor=0,*nodeCor=0;
904 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
905 PyObject *res = PyList_New(2);
906 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
907 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
911 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
913 DataArrayIdType *cellCor=0;
914 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
918 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
921 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
922 if (!SWIG_IsOK(res1))
925 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
926 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
930 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
932 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
933 da2->checkAllocated();
934 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
937 PyObject *getNodeIdsOfCell(int cellId) const
939 std::vector<mcIdType> conn;
940 self->getNodeIdsOfCell(cellId,conn);
941 return convertIntArrToPyList2(conn);
944 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
946 std::vector<double> coo;
947 self->getCoordinatesOfNode(nodeId,coo);
948 return convertDblArrToPyList2(coo);
951 void scale(PyObject *point, double factor)
955 DataArrayDoubleTuple *aa;
956 std::vector<double> bb;
958 int spaceDim=self->getSpaceDimension();
959 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
960 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
961 self->scale(pointPtr,factor);
964 PyObject *getBoundingBox() const
966 int spaceDim=self->getSpaceDimension();
967 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
968 self->getBoundingBox(tmp);
969 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
973 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
976 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
977 PyObject *ret=PyTuple_New(2);
978 PyObject *ret0Py=ret0?Py_True:Py_False;
980 PyTuple_SetItem(ret,0,ret0Py);
981 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
985 PyObject *buildPart(PyObject *li) const
987 mcIdType szArr,sw,iTypppArr;
988 std::vector<mcIdType> stdvecTyyppArr;
989 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
990 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
991 if(sw==3)//DataArrayIdType
993 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
994 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
995 std::string name=argpt->getName();
997 ret->setName(name.c_str());
999 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1002 PyObject *buildPartAndReduceNodes(PyObject *li) const
1004 mcIdType szArr,sw,iTypppArr;
1005 std::vector<mcIdType> stdvecTyyppArr;
1006 DataArrayIdType *arr=0;
1007 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1008 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
1009 if(sw==3)//DataArrayIdType
1011 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1012 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1013 std::string name=argpt->getName();
1015 ret->setName(name.c_str());
1018 PyObject *res = PyList_New(2);
1019 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1020 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1021 PyList_SetItem(res,0,obj0);
1022 PyList_SetItem(res,1,obj1);
1026 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
1029 DataArrayIdType *arr=0;
1030 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
1031 PyObject *res = PyTuple_New(2);
1032 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1035 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1037 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1038 PyTuple_SetItem(res,0,obj0);
1039 PyTuple_SetItem(res,1,obj1);
1043 PyObject *getDistributionOfTypes() const
1045 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1046 if(vals.size()%3!=0)
1047 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1048 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1049 for(std::size_t j=0;j<vals.size()/3;j++)
1051 PyObject *ret1=PyList_New(3);
1052 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1053 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1054 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1055 PyList_SetItem(ret,j,ret1);
1060 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1062 std::vector<mcIdType> code;
1063 std::vector<const DataArrayIdType *> idsPerType;
1064 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1065 convertPyToNewIntArr4(li,1,3,code);
1066 return self->checkTypeConsistencyAndContig(code,idsPerType);
1069 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1071 std::vector<mcIdType> code;
1072 std::vector<DataArrayIdType *> idsInPflPerType;
1073 std::vector<DataArrayIdType *> idsPerType;
1074 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1075 PyObject *ret=PyTuple_New(3);
1077 if(code.size()%3!=0)
1078 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1079 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1080 for(std::size_t j=0;j<code.size()/3;j++)
1082 PyObject *ret00=PyList_New(3);
1083 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1084 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1085 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1086 PyList_SetItem(ret0,j,ret00);
1088 PyTuple_SetItem(ret,0,ret0);
1090 PyObject *ret1=PyList_New(idsInPflPerType.size());
1091 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1092 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1093 PyTuple_SetItem(ret,1,ret1);
1094 std::size_t n=idsPerType.size();
1095 PyObject *ret2=PyList_New(n);
1096 for(std::size_t i=0;i<n;i++)
1097 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1098 PyTuple_SetItem(ret,2,ret2);
1102 void translate(PyObject *vector)
1106 DataArrayDoubleTuple *aa;
1107 std::vector<double> bb;
1109 int spaceDim=self->getSpaceDimension();
1110 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1111 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1112 self->translate(vectorPtr);
1115 void rotate(PyObject *center, double alpha)
1117 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1120 DataArrayDoubleTuple *aa;
1121 std::vector<double> bb;
1123 int spaceDim=self->getSpaceDimension();
1124 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1125 self->rotate(centerPtr,0,alpha);
1128 void rotate(PyObject *center, PyObject *vector, double alpha)
1130 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1132 DataArrayDouble *a,*a2;
1133 DataArrayDoubleTuple *aa,*aa2;
1134 std::vector<double> bb,bb2;
1136 int spaceDim=self->getSpaceDimension();
1137 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1138 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
1139 self->rotate(centerPtr,vectorPtr,alpha);
1142 PyObject *getAllGeoTypes() const
1144 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1145 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1146 PyObject *res=PyList_New(result.size());
1147 for(int i=0;iL!=result.end(); i++, iL++)
1148 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1152 virtual PyObject *getTinySerializationInformation() const
1154 std::vector<double> a0;
1155 std::vector<mcIdType> a1;
1156 std::vector<std::string> a2;
1157 self->getTinySerializationInformation(a0,a1,a2);
1158 PyObject *ret(PyTuple_New(3));
1159 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1160 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1161 std::size_t sz(a2.size());
1162 PyObject *ret2(PyList_New(sz));
1164 for(std::size_t i=0;i<sz;i++)
1165 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1167 PyTuple_SetItem(ret,2,ret2);
1171 virtual PyObject *serialize() const
1173 DataArrayIdType *a0Tmp(0);
1174 DataArrayDouble *a1Tmp(0);
1175 self->serialize(a0Tmp,a1Tmp);
1176 PyObject *ret(PyTuple_New(2));
1177 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1178 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1182 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1184 std::vector<std::string> littleStrings;
1185 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1188 PyObject *__getstate__() const
1190 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1191 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1192 PyObject *ret(PyTuple_New(2));
1193 PyTuple_SetItem(ret,0,ret0);
1194 PyTuple_SetItem(ret,1,ret1);
1198 void __setstate__(PyObject *inp)
1200 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1201 if(!PyTuple_Check(inp))
1202 throw INTERP_KERNEL::Exception(MSG);
1203 std::size_t sz(PyTuple_Size(inp));
1205 throw INTERP_KERNEL::Exception(MSG);
1206 PyObject *elt0(PyTuple_GetItem(inp,0));
1207 PyObject *elt1(PyTuple_GetItem(inp,1));
1208 std::vector<double> a0;
1209 std::vector<mcIdType> a1;
1210 std::vector<std::string> a2;
1211 DataArrayIdType *b0(0);
1212 DataArrayDouble *b1(0);
1214 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1215 throw INTERP_KERNEL::Exception(MSG);
1216 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1218 fillArrayWithPyListDbl3(a0py,tmp,a0);
1219 convertPyToNewIntArr3(a1py,a1);
1220 fillStringVector(a2py,a2);
1223 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1224 throw INTERP_KERNEL::Exception(MSG);
1225 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1227 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1228 if(!SWIG_IsOK(status))
1229 throw INTERP_KERNEL::Exception(MSG);
1230 b0=reinterpret_cast<DataArrayIdType *>(argp);
1231 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1232 if(!SWIG_IsOK(status))
1233 throw INTERP_KERNEL::Exception(MSG);
1234 b1=reinterpret_cast<DataArrayDouble *>(argp);
1236 // useless here to call resizeForUnserialization because arrays are well resized.
1237 self->unserialization(a0,a1,b0,b1,a2);
1240 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1242 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1243 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1244 return MEDCouplingMesh::MergeMeshes(tmp);
1250 //== MEDCouplingMesh End
1252 %include "NormalizedGeometricTypes"
1253 %include "MEDCouplingNatureOfFieldEnum"
1255 namespace MEDCoupling
1257 class MEDCouplingNatureOfField
1260 static const char *GetRepr(NatureOfField nat);
1261 static std::string GetReprNoThrow(NatureOfField nat);
1262 static std::string GetAllPossibilitiesStr();
1266 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1267 // include "MEDCouplingTimeDiscretization.i"
1269 namespace MEDCoupling
1271 class MEDCouplingGaussLocalization
1274 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1275 const std::vector<double>& gsCoo, const std::vector<double>& w);
1276 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1277 INTERP_KERNEL::NormalizedCellType getType() const;
1278 void setType(INTERP_KERNEL::NormalizedCellType typ);
1279 int getNumberOfGaussPt() const;
1280 int getDimension() const;
1281 int getNumberOfPtsInRefCell() const;
1282 std::string getStringRepr() const;
1283 void checkConsistencyLight() const;
1284 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1286 const std::vector<double>& getRefCoords() const;
1287 double getRefCoord(int ptIdInCell, int comp) const;
1288 const std::vector<double>& getGaussCoords() const;
1289 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1290 const std::vector<double>& getWeights() const;
1291 double getWeight(int gaussPtIdInCell, double newVal) const;
1292 void setRefCoord(int ptIdInCell, int comp, double newVal);
1293 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1294 void setWeight(int gaussPtIdInCell, double newVal);
1295 void setRefCoords(const std::vector<double>& refCoo);
1296 void setGaussCoords(const std::vector<double>& gsCoo);
1297 void setWeights(const std::vector<double>& w);
1299 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1303 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1305 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1309 MEDCouplingUMesh *buildRefCell() const
1311 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1315 DataArrayDouble *getShapeFunctionValues() const
1317 MCAuto<DataArrayDouble> ret(self->getShapeFunctionValues());
1321 DataArrayDouble *getDerivativeOfShapeFunctionValues() const
1323 MCAuto<DataArrayDouble> ret(self->getDerivativeOfShapeFunctionValues());
1327 static DataArrayDouble *GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type)
1329 MCAuto<DataArrayDouble> ret(MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(type));
1335 class MEDCouplingSkyLineArray
1338 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1340 void set( DataArrayIdType* index, DataArrayIdType* value );
1341 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1343 int getSuperNumberOf() const;
1344 int getNumberOf() const;
1345 int getLength() const;
1347 void deletePack(const int i, const int j);
1349 void deleteSimplePack(const int i);
1350 void deleteSimplePacks(const DataArrayIdType* idx);
1352 MEDCouplingSkyLineArray *groupPacks(const DataArrayIdType *indexedPacks) const;
1353 MEDCouplingSkyLineArray *uniqueNotSortedByPack() const;
1355 MEDCouplingSkyLineArray *deepCopy() const;
1359 MEDCouplingSkyLineArray()
1361 return MEDCouplingSkyLineArray::New();
1364 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1366 return MEDCouplingSkyLineArray::New(index, value);
1369 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1371 return MEDCouplingSkyLineArray::New(index, value);
1374 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1376 return MEDCouplingSkyLineArray::New(other);
1379 std::string __str__() const
1381 return self->simpleRepr();
1384 DataArrayIdType *getSuperIndexArray() const
1386 DataArrayIdType *ret(self->getSuperIndexArray());
1392 DataArrayIdType *getIndexArray() const
1394 DataArrayIdType *ret(self->getIndexArray());
1400 DataArrayIdType *getValuesArray() const
1402 DataArrayIdType *ret(self->getValuesArray());
1408 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1410 std::vector<mcIdType> ret;
1411 self->getSimplePackSafe(absolutePackId,ret);
1412 return convertIntArrToPyList2(ret);
1415 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1417 std::vector<mcIdType> vpack, vspIdx, out;
1419 convertPyToNewIntArr3(superPackIndices,vspIdx);
1420 convertPyToNewIntArr3(pack,vpack);
1422 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1423 return convertIntArrToPyList2(out);
1426 void pushBackPack(const mcIdType i, PyObject *pack)
1428 std::vector<mcIdType> vpack;
1429 convertPyToNewIntArr3(pack,vpack);
1430 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1433 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1435 std::vector<mcIdType> vpack;
1436 convertPyToNewIntArr3(pack,vpack);
1437 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1440 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1442 std::vector<const DataArrayIdType*> packs;
1443 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1444 self->replaceSimplePacks(idx, packs);
1447 static MEDCouplingSkyLineArray *AggregatePacks(PyObject *sks)
1449 std::vector<const MEDCouplingSkyLineArray *> sksCpp;
1450 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingSkyLineArray*>(sks,SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray,"MEDCouplingSkyLineArray",sksCpp);
1451 return MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks(sksCpp);
1454 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1456 std::vector<mcIdType> vpack;
1457 convertPyToNewIntArr3(pack,vpack);
1458 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1461 PyObject *convertToPolyhedronConn() const
1463 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1464 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1465 self->convertToPolyhedronConn(d0,d1);
1466 PyObject *ret=PyTuple_New(2);
1467 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1468 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1472 PyObject *thresholdPerPack(mcIdType threshold) const
1474 MCAuto<MEDCouplingSkyLineArray> left, right;
1475 self->thresholdPerPack(threshold,left,right);
1476 PyObject *ret=PyTuple_New(2);
1477 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(left.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1478 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(right.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1485 %include "MEDCouplingFieldDiscretization.i"
1487 //== MEDCouplingPointSet
1489 namespace MEDCoupling
1491 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1494 void setCoords(const DataArrayDouble *coords);
1495 DataArrayDouble *getCoordinatesAndOwner() const;
1496 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1498 double getCaracteristicDimension() const;
1499 void recenterForMaxPrecision(double eps);
1500 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1501 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1502 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1503 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1504 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1505 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1506 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1507 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1508 virtual DataArrayIdType *computeFetchedNodeIds() const;
1509 virtual int getNumberOfNodesInCell(int cellId) const;
1510 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1511 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1512 virtual DataArrayIdType *zipCoordsTraducer();
1513 virtual DataArrayIdType *findBoundaryNodes() const;
1514 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1515 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1516 virtual void checkFullyDefined() const;
1517 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1518 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1519 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1520 virtual void renumberNodesWithOffsetInConn(int offset);
1521 virtual bool areAllNodesFetched() const;
1522 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1523 virtual void invertOrientationOfAllCells();
1526 std::string __str__() const
1528 return self->simpleRepr();
1531 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1533 mcIdType newNbOfNodes;
1534 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1535 PyObject *res = PyList_New(2);
1536 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1537 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1541 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1543 DataArrayIdType *comm, *commIndex;
1544 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1545 PyObject *res = PyList_New(2);
1546 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1547 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1551 PyObject *getCoords()
1553 DataArrayDouble *ret1=self->getCoords();
1556 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1559 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1561 mcIdType szArr,sw,iTypppArr;
1562 std::vector<mcIdType> stdvecTyyppArr;
1563 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1564 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1565 if(sw==3)//DataArrayIdType
1567 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1568 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1569 std::string name=argpt->getName();
1571 ret->setName(name.c_str());
1573 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1576 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1578 mcIdType szArr,sw,iTypppArr;
1579 std::vector<mcIdType> stdvecTyyppArr;
1580 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1581 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1582 if(sw==3)//DataArrayIdType
1584 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1585 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1586 std::string name=argpt->getName();
1588 ret->setName(name.c_str());
1590 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1593 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1595 mcIdType szArr,sw,iTypppArr;
1596 std::vector<mcIdType> stdvecTyyppArr;
1597 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1598 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1599 if(sw==3)//DataArrayIdType
1601 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1602 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1603 std::string name=argpt->getName();
1605 ret->setName(name.c_str());
1607 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1610 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1612 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1613 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1616 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1618 mcIdType szArr,sw,iTypppArr;
1619 std::vector<mcIdType> stdvecTyyppArr;
1620 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1621 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1622 if(sw==3)//DataArrayIdType
1624 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1625 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1626 std::string name=argpt->getName();
1628 ret->setName(name.c_str());
1630 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1633 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1635 mcIdType szArr,sw,iTypppArr;
1636 std::vector<mcIdType> stdvecTyyppArr;
1637 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1638 self->renumberNodes(tmp,newNbOfNodes);
1641 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1643 mcIdType szArr,sw,iTypppArr;
1644 std::vector<mcIdType> stdvecTyyppArr;
1645 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1646 self->renumberNodesCenter(tmp,newNbOfNodes);
1649 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1651 int spaceDim=self->getSpaceDimension();
1653 DataArrayDouble *a,*a2;
1654 DataArrayDoubleTuple *aa,*aa2;
1655 std::vector<double> bb,bb2;
1657 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1658 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1659 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1660 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1661 std::vector<mcIdType> nodes;
1662 self->findNodesOnLine(p,v,eps,nodes);
1663 DataArrayIdType *ret=DataArrayIdType::New();
1664 ret->alloc(nodes.size(),1);
1665 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1666 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1668 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1670 int spaceDim=self->getSpaceDimension();
1672 DataArrayDouble *a,*a2;
1673 DataArrayDoubleTuple *aa,*aa2;
1674 std::vector<double> bb,bb2;
1676 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1677 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1678 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1679 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1680 std::vector<mcIdType> nodes;
1681 self->findNodesOnPlane(p,v,eps,nodes);
1682 DataArrayIdType *ret=DataArrayIdType::New();
1683 ret->alloc(nodes.size(),1);
1684 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1685 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1688 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1692 DataArrayDoubleTuple *aa;
1693 std::vector<double> bb;
1695 int spaceDim=self->getSpaceDimension();
1696 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1697 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1698 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1699 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1702 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1704 DataArrayIdType *c=0,*cI=0;
1708 DataArrayDoubleTuple *aa;
1709 std::vector<double> bb;
1711 int spaceDim=self->getSpaceDimension();
1712 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1713 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1714 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1715 PyObject *ret=PyTuple_New(2);
1716 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1721 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1723 DataArrayIdType *c=0,*cI=0;
1724 int spaceDim=self->getSpaceDimension();
1727 DataArrayDoubleTuple *aa;
1728 std::vector<double> bb;
1730 mcIdType nbOfTuples=-1;
1731 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1732 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1734 PyObject *ret=PyTuple_New(2);
1735 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1736 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1740 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1744 DataArrayDoubleTuple *aa;
1745 std::vector<double> bb;
1747 int spaceDim=self->getSpaceDimension();
1748 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1749 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1751 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1752 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1755 void duplicateNodesInCoords(PyObject *li)
1759 std::vector<mcIdType> multiVal;
1760 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1761 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1762 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1766 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1768 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1770 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1772 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1776 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1778 DataArrayIdType *v0(nullptr),*v1(nullptr);
1779 self->findCommonCells(compType,startCellId,v0,v1);
1780 PyObject *res = PyList_New(2);
1781 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1782 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1787 virtual void renumberNodesInConn(PyObject *li)
1791 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1794 MapII *da2(reinterpret_cast<MapII *>(da));
1795 self->renumberNodesInConn(da2->data());
1799 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1800 if (!SWIG_IsOK(res1))
1803 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1804 self->renumberNodesInConn(tmp);
1808 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1810 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1811 da2->checkAllocated();
1812 self->renumberNodesInConn(da2->getConstPointer());
1816 virtual PyObject *getNodeIdsInUse() const
1819 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1820 PyObject *ret=PyTuple_New(2);
1821 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1822 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1826 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1828 DataArrayIdType *ret(nullptr);
1830 mcIdType szArr,sw,iTypppArr;
1831 std::vector<mcIdType> stdvecTyyppArr;
1832 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1833 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1837 virtual PyObject *mergeNodes(double precision)
1841 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1842 PyObject *res = PyList_New(3);
1843 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1844 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1845 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1849 virtual PyObject *mergeNodesCenter(double precision)
1853 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1854 PyObject *res = PyList_New(3);
1855 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1856 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1857 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1861 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1864 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1865 if (!SWIG_IsOK(res1))
1868 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1869 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1873 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1875 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1876 da2->checkAllocated();
1877 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1881 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1885 std::vector<mcIdType> multiVal;
1886 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1887 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1888 mcIdType nbc=self->getNumberOfCells();
1889 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1896 std::ostringstream oss;
1897 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1898 throw INTERP_KERNEL::Exception(oss.str().c_str());
1901 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1906 mcIdType tmp=nbc+singleVal;
1907 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1911 std::ostringstream oss;
1912 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1913 throw INTERP_KERNEL::Exception(oss.str().c_str());
1919 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1923 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1928 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1929 daIntTyypp->checkAllocated();
1930 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1933 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1937 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1940 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1941 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1942 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1943 for(mcIdType i=0;i<sz;i++)
1944 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1947 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1950 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1951 mcIdType sw,nbNodes=0;
1952 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1953 std::vector<double> val3;
1954 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1955 "Rotate2DAlg",2,true,nbNodes);
1957 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1958 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1961 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1964 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1965 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1966 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1967 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1968 for(mcIdType i=0;i<sz;i++)
1969 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1972 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1975 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1976 mcIdType sw,nbNodes=0;
1977 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1978 std::vector<double> val3;
1979 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1980 "Rotate3DAlg",3,true,nbNodes);
1982 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1983 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1984 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1989 //== MEDCouplingPointSet End
1991 class MEDCouplingUMeshCell
1994 INTERP_KERNEL::NormalizedCellType getType() const;
1997 std::string __str__() const
1999 return self->repr();
2002 PyObject *getAllConn() const
2005 const mcIdType *r=self->getAllConn(ret2);
2006 PyObject *ret=PyTuple_New(ret2);
2007 for(mcIdType i=0;i<ret2;i++)
2008 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
2014 class MEDCouplingUMeshCellIterator
2021 MEDCouplingUMeshCell *ret=self->nextt();
2023 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
2026 PyErr_SetString(PyExc_StopIteration,"No more data.");
2033 class MEDCouplingUMeshCellByTypeIterator
2036 ~MEDCouplingUMeshCellByTypeIterator();
2041 MEDCouplingUMeshCellEntry *ret=self->nextt();
2043 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
2046 PyErr_SetString(PyExc_StopIteration,"No more data.");
2053 class MEDCouplingUMeshCellByTypeEntry
2056 ~MEDCouplingUMeshCellByTypeEntry();
2059 MEDCouplingUMeshCellByTypeIterator *__iter__()
2061 return self->iterator();
2066 class MEDCouplingUMeshCellEntry
2069 INTERP_KERNEL::NormalizedCellType getType() const;
2070 int getNumberOfElems() const;
2073 MEDCouplingUMeshCellIterator *__iter__()
2075 return self->iterator();
2080 //== MEDCouplingUMesh
2082 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2085 static MEDCouplingUMesh *New();
2086 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2087 void checkConsistencyLight() const;
2088 void checkGeomConsistency(double eps=1e-12) const;
2089 void setMeshDimension(int meshDim);
2090 void allocateCells(int nbOfCells=0);
2091 void finishInsertingCells();
2092 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2093 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2094 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2095 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2096 int getNodalConnectivityArrayLen() const;
2097 void computeTypes();
2098 std::string reprConnectivityOfThis() const;
2099 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2101 DataArrayIdType *conformize2D(double eps);
2102 DataArrayIdType *conformize3D(double eps);
2103 DataArrayIdType *colinearize2D(double eps);
2104 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2105 void shiftNodeNumbersInConn(int delta);
2106 std::vector<bool> getQuadraticStatus() const;
2107 DataArrayIdType *findCellIdsOnBoundary() const;
2108 MEDCouplingUMesh *computeSkin() const;
2109 bool checkConsecutiveCellTypes() const;
2110 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2111 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2112 DataArrayIdType *sortCellsInMEDFileFrmt();
2113 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2114 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2115 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2116 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2117 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2118 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2119 void orientCorrectlyPolyhedrons();
2120 bool isPresenceOfQuadratic() const;
2121 bool isFullyQuadratic() const;
2122 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2123 bool isContiguous1D() const;
2124 void tessellate2D(double eps);
2125 void convertQuadraticCellsToLinear();
2126 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2127 void convertDegeneratedCells();
2128 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2129 bool removeDegenerated1DCells();
2130 bool areOnlySimplexCells() const;
2131 MEDCouplingFieldDouble *getEdgeRatioField() const;
2132 MEDCouplingFieldDouble *getAspectRatioField() const;
2133 MEDCouplingFieldDouble *getWarpField() const;
2134 MEDCouplingFieldDouble *getSkewField() const;
2135 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2136 DataArrayIdType *convexEnvelop2D();
2137 std::string cppRepr() const;
2138 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2139 DataArrayIdType *findAndCorrectBadOriented3DCells();
2140 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2141 MEDCouplingSkyLineArray *generateGraph() const;
2142 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2143 DataArrayIdType *buildUnionOf2DMesh() const;
2144 DataArrayIdType *buildUnionOf3DMesh() const;
2145 DataArrayIdType *orderConsecutiveCells1D() const;
2146 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2147 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2148 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2149 void changeOrientationOfCells();
2150 void orientCorrectly2DCells(const MEDCouplingUMesh *refFaces);
2151 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2152 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2153 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2154 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2155 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2156 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2157 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2161 return MEDCouplingUMesh::New();
2164 MEDCouplingUMesh(const char *meshName, int meshDim)
2166 return MEDCouplingUMesh::New(meshName,meshDim);
2169 std::string __str__() const
2171 return self->simpleRepr();
2174 std::string __repr__() const
2176 std::ostringstream oss;
2177 self->reprQuickOverview(oss);
2181 MEDCouplingUMeshCellIterator *__iter__()
2183 return self->cellIterator();
2186 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2188 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2192 PyObject *getAllGeoTypesSorted() const
2194 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2195 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2196 PyObject *res=PyList_New(result.size());
2197 for(int i=0;iL!=result.end(); i++, iL++)
2198 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2202 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2206 std::vector<mcIdType> multiVal;
2207 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2208 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2209 mcIdType nbc=self->getNumberOfCells();
2210 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2217 std::ostringstream oss;
2218 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2219 throw INTERP_KERNEL::Exception(oss.str().c_str());
2223 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2230 mcIdType tmp=nbc+singleVal;
2231 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2236 std::ostringstream oss;
2237 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2238 throw INTERP_KERNEL::Exception(oss.str().c_str());
2244 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2250 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2251 daIntTyypp->checkAllocated();
2252 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2256 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2260 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2264 std::vector<mcIdType> multiVal;
2265 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2266 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2267 mcIdType nbc=self->getNumberOfCells();
2268 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2275 std::ostringstream oss;
2276 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2277 throw INTERP_KERNEL::Exception(oss.str().c_str());
2281 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2288 mcIdType tmp=nbc+singleVal;
2289 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2294 std::ostringstream oss;
2295 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2296 throw INTERP_KERNEL::Exception(oss.str().c_str());
2302 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2307 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2313 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2314 daIntTyypp->checkAllocated();
2315 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2319 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2323 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2325 mcIdType szArr,sw,iTypppArr;
2326 std::vector<mcIdType> stdvecTyyppArr;
2327 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2330 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2331 throw INTERP_KERNEL::Exception(oss.str().c_str());
2333 self->insertNextCell(type,size,tmp);
2336 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2338 mcIdType szArr,sw,iTypppArr;
2339 std::vector<mcIdType> stdvecTyyppArr;
2340 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2341 self->insertNextCell(type,szArr,tmp);
2344 DataArrayIdType *getNodalConnectivity()
2346 DataArrayIdType *ret=self->getNodalConnectivity();
2351 DataArrayIdType *getNodalConnectivityIndex()
2353 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2359 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2361 mcIdType szArr,sw,iTypppArr;
2362 std::vector<mcIdType> stdvecTyyppArr;
2363 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2364 mcIdType nbOfDepthPeelingPerformed=0;
2365 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2366 PyObject *res=PyTuple_New(2);
2367 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2368 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2372 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2374 DataArrayIdType *v0=0,*v1=0;
2375 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2376 PyObject *res = PyList_New(2);
2377 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2378 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2382 PyObject *distanceToPoint(PyObject *point) const
2386 DataArrayDoubleTuple *aa;
2387 std::vector<double> bb;
2389 int nbOfCompo=self->getSpaceDimension();
2390 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2393 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2394 PyObject *ret=PyTuple_New(2);
2395 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2396 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2400 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2402 DataArrayIdType *ret1=0;
2403 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2404 PyObject *ret=PyTuple_New(2);
2405 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2410 PyObject *tetrahedrize(int policy)
2413 DataArrayIdType *ret1(0);
2414 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2415 PyObject *ret=PyTuple_New(3);
2416 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2417 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2422 PyObject *checkButterflyCells(double eps=1e-12)
2424 std::vector<mcIdType> cells;
2425 self->checkButterflyCells(cells,eps);
2426 DataArrayIdType *ret=DataArrayIdType::New();
2427 ret->alloc(cells.size(),1);
2428 std::copy(cells.begin(),cells.end(),ret->getPointer());
2429 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2432 PyObject *splitByType() const
2434 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2435 std::size_t sz=ms.size();
2436 PyObject *ret = PyList_New(sz);
2437 for(std::size_t i=0;i<sz;i++)
2438 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2442 PyObject *partitionBySpreadZone() const
2444 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2445 std::size_t sz=retCpp.size();
2446 PyObject *ret=PyList_New(sz);
2447 for(std::size_t i=0;i<sz;i++)
2448 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2452 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2454 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2455 std::size_t sz=retCpp.size();
2456 PyObject *ret=PyList_New(sz);
2457 for(std::size_t i=0;i<sz;i++)
2458 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2462 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2465 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2466 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2467 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2470 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2473 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2474 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2478 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2481 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2482 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2486 DataArrayIdType *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2488 DataArrayIdType *ret=self->findNodesToDuplicate(otherDimM1OnSameCoords);
2492 PyObject *findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const DataArrayIdType *dupNodes) const
2494 DataArrayIdType *tmp0=0,*tmp1=0;
2495 self->findCellsToRenumber(otherDimM1OnSameCoords,dupNodes->begin(), dupNodes->end(), tmp0,tmp1);
2496 PyObject *ret=PyTuple_New(2);
2497 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2498 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2502 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2504 DataArrayIdType *tmp0=0,*tmp1=0;
2505 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2506 PyObject *ret=PyTuple_New(2);
2507 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2508 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2512 void duplicateNodes(PyObject *li)
2516 std::vector<mcIdType> multiVal;
2517 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2518 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2519 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2523 return self->duplicateNodes(&singleVal,&singleVal+1);
2525 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2527 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2529 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2533 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2537 std::vector<mcIdType> multiVal;
2538 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2539 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2540 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2544 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2546 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2548 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2550 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2554 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2556 mcIdType szArr,sw,iTypppArr;
2557 std::vector<mcIdType> stdvecTyyppArr;
2558 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2559 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2562 PyObject *getLevArrPerCellTypes(PyObject *li) const
2565 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2566 DataArrayIdType *tmp0,*tmp1=0;
2567 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2568 PyObject *ret=PyTuple_New(2);
2569 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2570 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2574 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2576 DataArrayIdType *ret0=0,*ret1=0;
2577 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2578 PyObject *ret=PyTuple_New(2);
2579 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2580 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2584 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2586 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2587 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2588 DataArrayIdType *ret1=0,*ret2=0;
2589 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2590 PyObject *ret=PyTuple_New(3);
2591 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2592 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2593 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2597 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2599 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2600 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2601 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2602 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2605 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2608 std::vector<const MEDCouplingUMesh *> meshes;
2609 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2610 std::vector<DataArrayIdType *> corr;
2611 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2613 PyObject *ret1=PyList_New(sz);
2614 for(std::size_t i=0;i<sz;i++)
2615 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2616 PyObject *ret=PyList_New(2);
2617 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2618 PyList_SetItem(ret,1,ret1);
2622 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2624 std::vector<MEDCouplingUMesh *> meshes;
2625 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2626 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2629 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2631 std::vector<MEDCouplingUMesh *> meshes;
2632 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2633 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2636 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2640 DataArrayDoubleTuple *aa;
2641 std::vector<double> bb;
2643 int spaceDim=self->getSpaceDimension();
2644 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2645 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2647 std::vector<mcIdType> cells;
2648 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2649 DataArrayIdType *ret=DataArrayIdType::New();
2650 ret->alloc(cells.size(),1);
2651 std::copy(cells.begin(),cells.end(),ret->getPointer());
2652 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2655 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2659 DataArrayDoubleTuple *aa;
2660 std::vector<double> bb;
2662 int spaceDim=self->getSpaceDimension();
2663 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2664 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2665 self->orientCorrectly2DCells(v,polyOnly);
2668 PyObject *arePolyhedronsNotCorrectlyOriented() const
2670 std::vector<mcIdType> cells;
2671 self->arePolyhedronsNotCorrectlyOriented(cells);
2672 DataArrayIdType *ret=DataArrayIdType::New();
2673 ret->alloc(cells.size(),1);
2674 std::copy(cells.begin(),cells.end(),ret->getPointer());
2675 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2678 PyObject *getFastAveragePlaneOfThis() const
2682 self->getFastAveragePlaneOfThis(vec,pos);
2684 std::copy(vec,vec+3,vals);
2685 std::copy(pos,pos+3,vals+3);
2686 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2689 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2691 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2692 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2693 return MEDCouplingUMesh::MergeUMeshes(tmp);
2696 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2698 DataArrayIdType *ret1;
2699 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2700 PyObject *ret=PyTuple_New(2);
2701 PyObject *ret0Py=ret0?Py_True:Py_False;
2703 PyTuple_SetItem(ret,0,ret0Py);
2704 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2708 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2710 DataArrayIdType *ret1;
2711 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2712 PyObject *ret=PyTuple_New(2);
2713 PyObject *ret0Py=ret0?Py_True:Py_False;
2715 PyTuple_SetItem(ret,0,ret0Py);
2716 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2720 PyObject *explode3DMeshTo1D() const
2722 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2723 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2724 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2725 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2726 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2727 PyObject *ret=PyTuple_New(5);
2728 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2729 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2730 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2731 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2732 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2736 PyObject *explodeIntoEdges() const
2738 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2739 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2740 PyObject *ret=PyTuple_New(5);
2741 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2743 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2744 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2745 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2749 PyObject *explodeMeshIntoMicroEdges() const
2751 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2752 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2753 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2754 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2755 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2756 PyObject *ret=PyTuple_New(5);
2757 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2758 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2759 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2760 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2765 PyObject *buildDescendingConnectivity() const
2767 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2768 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2769 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2770 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2771 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2772 PyObject *ret=PyTuple_New(5);
2773 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2774 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2775 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2776 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2777 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2781 PyObject *buildDescendingConnectivity2() const
2783 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2784 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2785 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2786 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2787 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2788 PyObject *ret=PyTuple_New(5);
2789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2791 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2792 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2793 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2797 PyObject *computeNeighborsOfCells() const
2799 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2800 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2801 PyObject *ret=PyTuple_New(2);
2802 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2803 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2807 PyObject *computeNeighborsOfNodes() const
2809 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2810 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2811 PyObject *ret=PyTuple_New(2);
2812 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2813 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2817 PyObject *computeEnlargedNeighborsOfNodes() const
2819 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2820 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2821 PyObject *ret=PyTuple_New(2);
2822 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2823 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2827 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2829 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2830 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2831 PyObject *ret=PyTuple_New(2);
2832 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2833 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2837 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2839 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2840 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2841 PyObject *ret=PyTuple_New(2);
2842 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2843 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2847 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2849 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2850 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2851 DataArrayIdType *d2,*d3,*d4,*dd5;
2852 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2853 PyObject *ret=PyTuple_New(7);
2854 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2855 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2856 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2857 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2858 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2859 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2860 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2864 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2867 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2868 da->checkAllocated();
2869 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2872 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2875 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2876 da->checkAllocated();
2877 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2880 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2883 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2884 da->checkAllocated();
2885 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2888 PyObject *getTypesOfPart(DataArrayIdType *da) const
2891 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2892 da->checkAllocated();
2893 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2894 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2895 PyObject *res = PyList_New(result.size());
2896 for (int i=0;iL!=result.end(); i++, iL++)
2897 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2901 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2904 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2905 da->checkAllocated();
2906 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2907 ret->setName(da->getName().c_str());
2911 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2913 DataArrayIdType *cellNb1=0,*cellNb2=0;
2914 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2915 PyObject *ret=PyTuple_New(3);
2916 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2917 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2918 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2922 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2924 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2925 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2926 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2927 PyObject *ret(PyTuple_New(4));
2928 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2929 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2930 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2931 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2935 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2937 int spaceDim=self->getSpaceDimension();
2939 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2941 DataArrayDouble *a,*a2;
2942 DataArrayDoubleTuple *aa,*aa2;
2943 std::vector<double> bb,bb2;
2945 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2946 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2947 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2948 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2950 DataArrayIdType *cellIds=0;
2951 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2952 PyObject *ret=PyTuple_New(2);
2953 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2954 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2958 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2960 int spaceDim=self->getSpaceDimension();
2962 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2964 DataArrayDouble *a,*a2;
2965 DataArrayDoubleTuple *aa,*aa2;
2966 std::vector<double> bb,bb2;
2968 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2969 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2970 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2971 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2973 DataArrayIdType *cellIds=0;
2974 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2975 PyObject *ret=PyTuple_New(2);
2976 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2977 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2981 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2984 DataArrayDouble *a,*a2;
2985 DataArrayDoubleTuple *aa,*aa2;
2986 std::vector<double> bb,bb2;
2988 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2989 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2990 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2991 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2992 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2996 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2998 int spaceDim=self->getSpaceDimension();
3000 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
3002 DataArrayDouble *a,*a2;
3003 DataArrayDoubleTuple *aa,*aa2;
3004 std::vector<double> bb,bb2;
3006 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
3007 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
3008 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3009 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3010 return self->getCellIdsCrossingPlane(orig,vect,eps);
3013 void convertToPolyTypes(PyObject *li)
3017 std::vector<mcIdType> pos2;
3018 DataArrayIdType *pos3=0;
3019 DataArrayIdTypeTuple *pos4=0;
3020 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
3025 self->convertToPolyTypes(&pos1,&pos1+1);
3032 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
3037 self->convertToPolyTypes(pos3->begin(),pos3->end());
3041 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
3045 void convertAllToPoly();
3046 void convertExtrudedPolyhedra();
3048 void simplifyPolyhedra(double eps);
3049 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
3050 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
3053 //== MEDCouplingUMesh End
3055 //== MEDCouplingMappedExtrudedMesh
3057 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
3060 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
3061 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
3062 MEDCouplingUMesh *build3DUnstructuredMesh() const;
3063 int get2DCellIdForExtrusion() const;
3065 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
3067 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3070 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3072 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3075 MEDCouplingMappedExtrudedMesh()
3077 return MEDCouplingMappedExtrudedMesh::New();
3080 std::string __str__() const
3082 return self->simpleRepr();
3085 std::string __repr__() const
3087 std::ostringstream oss;
3088 self->reprQuickOverview(oss);
3092 PyObject *getMesh2D() const
3094 MEDCouplingUMesh *ret=self->getMesh2D();
3097 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3099 PyObject *getMesh1D() const
3101 MEDCouplingUMesh *ret=self->getMesh1D();
3104 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3106 PyObject *getMesh3DIds() const
3108 DataArrayIdType *ret=self->getMesh3DIds();
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3116 //== MEDCouplingMappedExtrudedMesh End
3118 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3121 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3122 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3123 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3124 int getNodalConnectivityLength() const;
3125 virtual void allocateCells(int nbOfCells=0);
3126 virtual void checkConsistencyOfConnectivity() const;
3129 virtual void insertNextCell(PyObject *li)
3131 mcIdType szArr,sw,iTypppArr;
3132 std::vector<mcIdType> stdvecTyyppArr;
3133 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3134 self->insertNextCell(tmp,tmp+szArr);
3137 virtual DataArrayIdType *getNodalConnectivity() const
3139 DataArrayIdType *ret=self->getNodalConnectivity();
3140 if(ret) ret->incrRef();
3144 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3146 std::vector< const MEDCoupling1GTUMesh *> parts;
3147 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3148 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3153 //== MEDCoupling1SGTUMesh
3155 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3158 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3159 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3160 void setNodalConnectivity(DataArrayIdType *nodalConn);
3161 int getNumberOfNodesPerCell() const;
3162 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3163 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3164 MEDCoupling1GTUMesh *computeDualMesh() const;
3165 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3166 DataArrayIdType *sortHexa8EachOther();
3169 MEDCoupling1SGTUMesh()
3171 return MEDCoupling1SGTUMesh::New();
3174 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3176 return MEDCoupling1SGTUMesh::New(name,type);
3179 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3181 return MEDCoupling1SGTUMesh::New(m);
3184 std::string __str__() const
3186 return self->simpleRepr();
3189 std::string __repr__() const
3191 std::ostringstream oss;
3192 self->reprQuickOverview(oss);
3196 PyObject *structurizeMe(double eps=1e-12) const
3198 DataArrayIdType *cellPerm(0),*nodePerm(0);
3199 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3200 PyObject *ret(PyTuple_New(3));
3201 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3202 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3203 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3207 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3209 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3210 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3211 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3214 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3216 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3217 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3218 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3223 //== MEDCoupling1SGTUMesh End
3225 //== MEDCoupling1DGTUMesh
3227 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3230 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3231 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3232 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3233 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3234 bool isPacked() const;
3237 MEDCoupling1DGTUMesh()
3239 return MEDCoupling1DGTUMesh::New();
3241 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3243 return MEDCoupling1DGTUMesh::New(name,type);
3246 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3248 return MEDCoupling1DGTUMesh::New(m);
3251 std::string __str__() const
3253 return self->simpleRepr();
3256 std::string __repr__() const
3258 std::ostringstream oss;
3259 self->reprQuickOverview(oss);
3263 DataArrayIdType *getNodalConnectivityIndex() const
3265 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3266 if(ret) ret->incrRef();
3270 PyObject *retrievePackedNodalConnectivity() const
3272 DataArrayIdType *ret1=0,*ret2=0;
3273 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3274 PyObject *ret0Py=ret0?Py_True:Py_False;
3276 PyObject *ret=PyTuple_New(3);
3277 PyTuple_SetItem(ret,0,ret0Py);
3278 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3279 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3283 PyObject *copyWithNodalConnectivityPacked() const
3286 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3287 PyObject *ret=PyTuple_New(2);
3288 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3289 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3290 PyTuple_SetItem(ret,1,ret1Py);
3294 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3296 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3297 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3298 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3301 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3303 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3304 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3305 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3308 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3310 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3311 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3312 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3317 //== MEDCoupling1DGTUMeshEnd
3319 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3322 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3323 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3324 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3325 int getSpaceDimensionOnNodeStruct() const;
3326 double computeSquareness() const;
3327 virtual std::vector<mcIdType> getNodeGridStructure() const;
3328 std::vector<mcIdType> getCellGridStructure() const;
3329 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3330 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3331 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3332 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3333 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3334 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3335 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3336 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3339 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3341 mcIdType tmpp1=-1,tmpp2=-1;
3342 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3343 std::vector< std::pair<mcIdType,mcIdType> > inp;
3347 for(mcIdType i=0;i<tmpp1;i++)
3348 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3353 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3354 inp.resize(tmpp1/2);
3355 for(mcIdType i=0;i<tmpp1/2;i++)
3356 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3359 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3360 return self->buildStructuredSubPart(inp);
3363 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3365 std::vector< std::pair<mcIdType,mcIdType> > inp;
3366 convertPyToVectorPairInt(part,inp);
3368 mcIdType szArr,sw,iTypppArr;
3369 std::vector<mcIdType> stdvecTyyppArr;
3370 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3371 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3373 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3376 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3378 std::vector< std::pair<mcIdType,mcIdType> > inp;
3379 convertPyToVectorPairInt(part,inp);
3380 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3383 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3385 std::vector< std::pair<mcIdType,mcIdType> > inp;
3386 convertPyToVectorPairInt(part,inp);
3387 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3390 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3392 std::vector< std::pair<mcIdType,mcIdType> > inp;
3393 convertPyToVectorPairInt(part,inp);
3394 std::vector<mcIdType> stWithGhost;
3395 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3396 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3397 PyObject *ret(PyTuple_New(2));
3398 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3399 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3403 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3405 std::vector< std::pair<mcIdType,mcIdType> > inp;
3406 convertPyToVectorPairInt(partCompactFormat,inp);
3407 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3410 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3412 std::vector< std::pair<mcIdType,mcIdType> > inp;
3413 convertPyToVectorPairInt(partCompactFormat,inp);
3414 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3417 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3419 std::vector< std::pair<mcIdType,mcIdType> > inp;
3420 convertPyToVectorPairInt(part,inp);
3421 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3424 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3426 mcIdType szArr,sw,iTypppArr;
3427 std::vector<mcIdType> stdvecTyyppArr;
3428 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3429 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3432 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(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::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3440 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3442 std::vector< std::pair<mcIdType,mcIdType> > inp;
3443 convertPyToVectorPairInt(partCompactFormat,inp);
3444 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3447 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3449 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3450 PyObject *retPy=PyList_New(ret.size());
3451 for(std::size_t i=0;i<ret.size();i++)
3453 PyObject *tmp=PyTuple_New(2);
3454 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3455 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3456 PyList_SetItem(retPy,i,tmp);
3461 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3463 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3464 convertPyToVectorPairInt(r1,r1Cpp);
3465 convertPyToVectorPairInt(r2,r2Cpp);
3466 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3467 PyObject *retPy=PyList_New(ret.size());
3468 for(std::size_t i=0;i<ret.size();i++)
3470 PyObject *tmp=PyTuple_New(2);
3471 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3472 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3473 PyList_SetItem(retPy,i,tmp);
3478 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3480 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3481 convertPyToVectorPairInt(r1,r1Cpp);
3482 convertPyToVectorPairInt(r2,r2Cpp);
3483 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3486 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3488 mcIdType szArr,sw,iTypppArr;
3489 std::vector<mcIdType> stdvecTyyppArr;
3490 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3491 mcIdType szArr2,sw2,iTypppArr2;
3492 std::vector<mcIdType> stdvecTyyppArr2;
3493 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3494 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3495 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3496 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3497 PyObject *ret=PyTuple_New(2);
3498 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3499 PyTuple_SetItem(ret,0,ret0Py);
3500 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3501 for(std::size_t i=0;i<partCompactFormat.size();i++)
3503 PyObject *tmp4=PyTuple_New(2);
3504 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3505 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3506 PyList_SetItem(ret1Py,i,tmp4);
3508 PyTuple_SetItem(ret,1,ret1Py);
3512 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3514 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3515 convertPyToVectorPairInt(bigInAbs,param0);
3516 convertPyToVectorPairInt(partOfBigInAbs,param1);
3517 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3518 PyObject *retPy(PyList_New(ret.size()));
3519 for(std::size_t i=0;i<ret.size();i++)
3521 PyObject *tmp(PyTuple_New(2));
3522 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3523 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3524 PyList_SetItem(retPy,i,tmp);
3529 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3531 std::vector< std::pair<mcIdType,mcIdType> > param0;
3532 convertPyToVectorPairInt(part,param0);
3533 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3534 PyObject *retPy(PyList_New(ret.size()));
3535 for(std::size_t i=0;i<ret.size();i++)
3537 PyObject *tmp(PyTuple_New(2));
3538 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3539 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3540 PyList_SetItem(retPy,i,tmp);
3545 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3547 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3548 convertPyToVectorPairInt(startingFrom,param0);
3549 convertPyToVectorPairInt(goingTo,param1);
3550 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3553 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3555 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3556 convertPyToVectorPairInt(bigInAbs,param0);
3557 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3558 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3559 PyObject *retPy(PyList_New(ret.size()));
3560 for(std::size_t i=0;i<ret.size();i++)
3562 PyObject *tmp(PyTuple_New(2));
3563 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3564 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3565 PyList_SetItem(retPy,i,tmp);
3572 class MEDCouplingCurveLinearMesh;
3574 //== MEDCouplingCMesh
3576 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3579 static MEDCouplingCMesh *New();
3580 static MEDCouplingCMesh *New(const std::string& meshName);
3581 void setCoords(const DataArrayDouble *coordsX,
3582 const DataArrayDouble *coordsY=0,
3583 const DataArrayDouble *coordsZ=0);
3584 void setCoordsAt(int i, const DataArrayDouble *arr);
3585 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3589 return MEDCouplingCMesh::New();
3591 MEDCouplingCMesh(const std::string& meshName)
3593 return MEDCouplingCMesh::New(meshName);
3595 std::string __str__() const
3597 return self->simpleRepr();
3599 std::string __repr__() const
3601 std::ostringstream oss;
3602 self->reprQuickOverview(oss);
3605 DataArrayDouble *getCoordsAt(int i)
3607 DataArrayDouble *ret=self->getCoordsAt(i);
3615 //== MEDCouplingCMesh End
3617 //== MEDCouplingCurveLinearMesh
3619 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3622 static MEDCouplingCurveLinearMesh *New();
3623 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3624 void setCoords(const DataArrayDouble *coords);
3626 MEDCouplingCurveLinearMesh()
3628 return MEDCouplingCurveLinearMesh::New();
3630 MEDCouplingCurveLinearMesh(const std::string& meshName)
3632 return MEDCouplingCurveLinearMesh::New(meshName);
3634 std::string __str__() const
3636 return self->simpleRepr();
3638 std::string __repr__() const
3640 std::ostringstream oss;
3641 self->reprQuickOverview(oss);
3644 DataArrayDouble *getCoords()
3646 DataArrayDouble *ret=self->getCoords();
3651 void setNodeGridStructure(PyObject *gridStruct)
3653 mcIdType szArr,sw,iTypppArr;
3654 std::vector<mcIdType> stdvecTyyppArr;
3655 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3656 self->setNodeGridStructure(tmp,tmp+szArr);
3661 //== MEDCouplingCurveLinearMesh End
3663 //== MEDCouplingIMesh
3665 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3668 static MEDCouplingIMesh *New();
3670 void setSpaceDimension(int spaceDim);
3671 std::vector<mcIdType> getNodeStruct() const;
3672 std::vector<double> getOrigin() const;
3673 std::vector<double> getDXYZ() const;
3674 void setAxisUnit(const std::string& unitName);
3675 std::string getAxisUnit() const;
3676 double getMeasureOfAnyCell() const;
3677 MEDCouplingCMesh *convertToCartesian() const;
3678 void refineWithFactor(const std::vector<mcIdType>& factors);
3679 MEDCouplingIMesh *asSingleCell() const;
3680 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3685 return MEDCouplingIMesh::New();
3687 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3689 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3690 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3691 const mcIdType *nodeStrctPtr(0);
3692 const double *originPtr(0),*dxyzPtr(0);
3693 mcIdType sw,sz,val0;
3694 std::vector<mcIdType> bb0;
3695 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3698 std::vector<double> bb,bb2;
3700 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3701 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3703 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3706 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3708 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3711 void setNodeStruct(PyObject *nodeStrct)
3713 mcIdType sw,sz,val0;
3714 std::vector<mcIdType> bb0;
3715 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3716 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3719 void setOrigin(PyObject *origin)
3721 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3723 std::vector<double> bb;
3724 mcIdType sw,nbTuples;
3725 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3726 self->setOrigin(originPtr,originPtr+nbTuples);
3729 void setDXYZ(PyObject *dxyz)
3731 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3733 std::vector<double> bb;
3734 mcIdType sw,nbTuples;
3735 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3736 self->setDXYZ(originPtr,originPtr+nbTuples);
3739 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3741 std::vector< std::pair<mcIdType,mcIdType> > inp;
3742 convertPyToVectorPairInt(fineLocInCoarse,inp);
3743 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3746 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3748 std::vector< std::pair<mcIdType,mcIdType> > inp;
3749 convertPyToVectorPairInt(fineLocInCoarse,inp);
3750 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3753 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3755 std::vector< std::pair<mcIdType,mcIdType> > inp;
3756 convertPyToVectorPairInt(fineLocInCoarse,inp);
3757 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3760 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3762 std::vector< std::pair<mcIdType,mcIdType> > inp;
3763 convertPyToVectorPairInt(fineLocInCoarse,inp);
3764 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3767 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3769 std::vector< std::pair<mcIdType,mcIdType> > inp;
3770 convertPyToVectorPairInt(fineLocInCoarse,inp);
3771 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3774 std::string __str__() const
3776 return self->simpleRepr();
3778 std::string __repr__() const
3780 std::ostringstream oss;
3781 self->reprQuickOverview(oss);
3787 //== MEDCouplingIMesh End
3791 namespace MEDCoupling
3793 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3796 virtual void checkConsistencyLight() const;
3797 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3798 bool areStrictlyCompatible(const MEDCouplingField *other) const;
3799 bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
3800 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3801 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3802 void setName(const char *name);
3803 std::string getDescription() const;
3804 void setDescription(const char *desc);
3805 std::string getName() const;
3806 TypeOfField getTypeOfField() const;
3807 NatureOfField getNature() const;
3808 virtual void setNature(NatureOfField nat);
3809 DataArrayDouble *getLocalizationOfDiscr() const;
3810 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3811 mcIdType getNumberOfTuplesExpected() const;
3812 mcIdType getNumberOfMeshPlacesExpected() const;
3813 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3814 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3815 void clearGaussLocalizations();
3816 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3817 mcIdType getNbOfGaussLocalization() const;
3818 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3819 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3820 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3821 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3823 PyObject *getMesh() const
3825 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3828 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3831 PyObject *getDiscretization()
3833 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3836 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3839 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3841 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3842 return convertIntArrToPyList3(ret);
3845 PyObject *buildSubMeshData(PyObject *li) const
3847 DataArrayIdType *ret1=0;
3848 MEDCouplingMesh *ret0=0;
3850 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3851 if (!SWIG_IsOK(res1))
3854 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3855 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3859 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3861 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3862 da2->checkAllocated();
3863 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3865 PyObject *res = PyList_New(2);
3866 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3867 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3871 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3873 DataArrayIdType *ret1=0;
3875 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3876 PyObject *res=PyTuple_New(2);
3877 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3879 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3882 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3883 PyTuple_SetItem(res,1,res1);
3888 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3891 mcIdType v0; std::vector<mcIdType> v1;
3892 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3893 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3896 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3897 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3900 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3901 if (!SWIG_IsOK(res1))
3904 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3905 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3909 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3911 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3912 da2->checkAllocated();
3913 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3917 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3919 std::vector<mcIdType> tmp;
3920 self->getCellIdsHavingGaussLocalization(locId,tmp);
3921 DataArrayIdType *ret=DataArrayIdType::New();
3922 ret->alloc((mcIdType)tmp.size(),1);
3923 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3924 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3927 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3929 std::vector<mcIdType> inp0;
3930 convertPyToNewIntArr4(code,1,3,inp0);
3931 std::vector<const DataArrayIdType *> inp1;
3932 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3933 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3938 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3941 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3942 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3943 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f);
3944 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f);
3945 static MEDCouplingFieldTemplate *New(TypeOfField type);
3946 std::string simpleRepr() const;
3947 std::string advancedRepr() const;
3948 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3949 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3952 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3954 return MEDCouplingFieldTemplate::New(f);
3957 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3959 return MEDCouplingFieldTemplate::New(f);
3962 MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f)
3964 return MEDCouplingFieldTemplate::New(f);
3967 MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f)
3969 return MEDCouplingFieldTemplate::New(f);
3972 MEDCouplingFieldTemplate(TypeOfField type)
3974 return MEDCouplingFieldTemplate::New(type);
3977 std::string __str__() const
3979 return self->simpleRepr();
3982 std::string __repr__() const
3984 std::ostringstream oss;
3985 self->reprQuickOverview(oss);
3989 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3992 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3993 PyObject *ret=PyTuple_New(2);
3994 PyObject *ret0Py=ret0?Py_True:Py_False;
3996 PyTuple_SetItem(ret,0,ret0Py);
3997 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4004 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
4007 TypeOfTimeDiscretization getTimeDiscretization() const;
4009 MEDCouplingFieldT();
4010 ~MEDCouplingFieldT();
4013 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
4014 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
4015 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
4017 class MEDCouplingFieldInt32;
4018 class MEDCouplingFieldInt64;
4019 class MEDCouplingFieldFloat;
4021 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
4024 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
4025 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
4026 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4027 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
4028 void setTimeUnit(const std::string& unit);
4029 std::string getTimeUnit() const;
4030 void synchronizeTimeWithSupport();
4031 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
4032 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
4033 std::string simpleRepr() const;
4034 std::string advancedRepr() const;
4035 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
4036 MEDCouplingFieldInt32 *convertToIntField() const;
4037 MEDCouplingFieldFloat *convertToFloatField() const;
4038 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
4039 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
4040 MEDCouplingFieldDouble *deepCopy() const;
4041 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
4042 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
4043 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
4044 double getIJ(int tupleId, int compoId) const;
4045 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
4046 void synchronizeTimeWithMesh();
4047 void setArray(DataArrayDouble *array);
4048 void setEndArray(DataArrayDouble *array);
4049 void setTime(double val, int iteration, int order);
4050 void setStartTime(double val, int iteration, int order);
4051 void setEndTime(double val, int iteration, int order);
4052 void applyLin(double a, double b, int compoId);
4053 void applyLin(double a, double b);
4054 int getNumberOfComponents() const;
4055 int getNumberOfTuples() const;
4056 int getNumberOfValues() const;
4057 void setTimeTolerance(double val);
4058 double getTimeTolerance() const;
4059 void setIteration(int it);
4060 void setEndIteration(int it);
4061 void setOrder(int order);
4062 void setEndOrder(int order);
4063 void setTimeValue(double val);
4064 void setEndTimeValue(double val);
4065 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
4066 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
4067 bool mergeNodes(double eps, double epsOnVals=1e-15);
4068 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
4069 bool zipCoords(double epsOnVals=1e-15);
4070 bool zipConnectivity(int compType,double epsOnVals=1e-15);
4071 bool simplexize(int policy);
4072 MEDCouplingFieldDouble *doublyContractedProduct() const;
4073 MEDCouplingFieldDouble *determinant() const;
4074 MEDCouplingFieldDouble *eigenValues() const;
4075 MEDCouplingFieldDouble *eigenVectors() const;
4076 MEDCouplingFieldDouble *inverse() const;
4077 MEDCouplingFieldDouble *trace() const;
4078 MEDCouplingFieldDouble *deviator() const;
4079 MEDCouplingFieldDouble *magnitude() const;
4080 MEDCouplingFieldDouble *maxPerTuple() const;
4081 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
4082 void sortPerTuple(bool asc);
4083 MEDCouplingFieldDouble &operator=(double value);
4084 void fillFromAnalytic(int nbOfComp, const std::string& func);
4085 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4086 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4087 void applyFunc(int nbOfComp, const std::string& func);
4088 void applyFuncCompo(int nbOfComp, const std::string& func);
4089 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4090 void applyFunc(int nbOfComp, double val);
4091 void applyFunc(const std::string& func);
4092 void applyFuncFast32(const std::string& func);
4093 void applyFuncFast64(const std::string& func);
4094 double accumulate(int compId) const;
4095 double getMaxValue() const;
4096 double getMinValue() const;
4097 double getAverageValue() const;
4098 double norm2() const;
4099 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4100 double getWeightedAverageValue(int compId, bool isWAbs) const;
4101 double integral(int compId, bool isWAbs) const;
4102 double normL1(int compId) const;
4103 double normL2(int compId) const;
4104 double normMax(int compId) const;
4105 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4106 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4107 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4108 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4109 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4110 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4111 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4112 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4113 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4114 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4115 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4116 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4117 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4118 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4119 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4120 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4121 MEDCouplingFieldDouble *negate() const;
4123 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4125 return MEDCouplingFieldDouble::New(type,td);
4128 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4130 return MEDCouplingFieldDouble::New(ft,td);
4133 std::string __str__() const
4135 return self->simpleRepr();
4138 std::string __repr__() const
4140 std::ostringstream oss;
4141 self->reprQuickOverview(oss);
4145 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4148 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4149 PyObject *ret=PyTuple_New(2);
4150 PyObject *ret0Py=ret0?Py_True:Py_False;
4152 PyTuple_SetItem(ret,0,ret0Py);
4153 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4157 MEDCouplingFieldDouble *voronoize(double eps) const
4159 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4163 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4165 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4169 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4171 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4173 DataArrayDouble *a,*a2;
4174 DataArrayDoubleTuple *aa,*aa2;
4175 std::vector<double> bb,bb2;
4177 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4178 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4179 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4182 DataArrayDouble *getArray()
4184 DataArrayDouble *ret=self->getArray();
4190 PyObject *getArrays() const
4192 std::vector<DataArrayDouble *> arrs=self->getArrays();
4193 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4196 std::size_t sz=arrs.size();
4197 PyObject *ret=PyTuple_New(sz);
4198 for(std::size_t i=0;i<sz;i++)
4201 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4203 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4208 void setArrays(PyObject *ls)
4210 std::vector<const DataArrayDouble *> tmp;
4211 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4212 std::size_t sz=tmp.size();
4213 std::vector<DataArrayDouble *> arrs(sz);
4214 for(std::size_t i=0;i<sz;i++)
4215 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4216 self->setArrays(arrs);
4219 DataArrayDouble *getEndArray()
4221 DataArrayDouble *ret=self->getEndArray();
4227 PyObject *getValueOn(PyObject *sl) const
4231 DataArrayDoubleTuple *aa;
4232 std::vector<double> bb;
4234 const MEDCouplingMesh *mesh=self->getMesh();
4236 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4237 int spaceDim=mesh->getSpaceDimension();
4238 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4239 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4241 mcIdType sz=ToIdType(self->getNumberOfComponents());
4242 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4243 self->getValueOn(spaceLoc,res);
4244 return convertDblArrToPyList<double>(res,sz);
4247 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4249 mcIdType sz=ToIdType(self->getNumberOfComponents());
4250 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4251 self->getValueOnPos(i,j,k,res);
4252 return convertDblArrToPyList<double>(res,sz);
4255 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4257 const MEDCouplingMesh *mesh(self->getMesh());
4259 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4262 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4263 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4264 mesh->getSpaceDimension(),true,nbPts);
4265 return self->getValueOnMulti(inp,(int)nbPts);
4268 PyObject *getValueOn(PyObject *sl, double time) const
4272 DataArrayDoubleTuple *aa;
4273 std::vector<double> bb;
4275 const MEDCouplingMesh *mesh=self->getMesh();
4277 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4278 int spaceDim=mesh->getSpaceDimension();
4279 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4280 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4283 mcIdType sz=ToIdType(self->getNumberOfComponents());
4284 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4285 self->getValueOn(spaceLoc,time,res);
4286 return convertDblArrToPyList<double>(res,sz);
4289 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4291 if(self->getArray()!=0)
4292 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4295 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4296 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4297 self->setArray(arr);
4304 double tmp0=self->getTime(tmp1,tmp2);
4305 PyObject *res = PyList_New(3);
4306 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4307 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4308 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4312 PyObject *getStartTime()
4315 double tmp0=self->getStartTime(tmp1,tmp2);
4316 PyObject *res = PyList_New(3);
4317 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4318 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4319 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4323 PyObject *getEndTime()
4326 double tmp0=self->getEndTime(tmp1,tmp2);
4327 PyObject *res = PyList_New(3);
4328 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4329 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4330 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4333 PyObject *accumulate() const
4335 mcIdType sz=ToIdType(self->getNumberOfComponents());
4336 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4337 self->accumulate(tmp);
4338 return convertDblArrToPyList<double>(tmp,sz);
4340 PyObject *integral(bool isWAbs) const
4342 mcIdType sz=ToIdType(self->getNumberOfComponents());
4343 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4344 self->integral(isWAbs,tmp);
4345 return convertDblArrToPyList<double>(tmp,sz);
4347 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4349 mcIdType sz=ToIdType(self->getNumberOfComponents());
4350 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4351 self->getWeightedAverageValue(tmp,isWAbs);
4352 return convertDblArrToPyList<double>(tmp,sz);
4354 PyObject *normL1() const
4356 mcIdType sz=ToIdType(self->getNumberOfComponents());
4357 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4359 return convertDblArrToPyList<double>(tmp,sz);
4361 PyObject *normL2() const
4363 mcIdType sz=ToIdType(self->getNumberOfComponents());
4364 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4366 return convertDblArrToPyList<double>(tmp,sz);
4368 PyObject *normMax() const
4370 mcIdType sz=ToIdType(self->getNumberOfComponents());
4371 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4373 return convertDblArrToPyList<double>(tmp,sz);
4375 void renumberCells(PyObject *li, bool check=true)
4377 mcIdType szArr,sw,iTypppArr;
4378 std::vector<mcIdType> stdvecTyyppArr;
4379 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4380 self->renumberCells(tmp,check);
4383 void renumberCellsWithoutMesh(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->renumberCellsWithoutMesh(tmp,check);
4391 void renumberNodes(PyObject *li, double eps=1e-15)
4393 mcIdType szArr,sw,iTypppArr;
4394 std::vector<mcIdType> stdvecTyyppArr;
4395 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4396 self->renumberNodes(tmp,eps);
4399 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, 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->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4407 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4409 return fieldT_buildSubPart(self,li);
4412 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4414 return fieldT__getitem__(self,li);
4417 PyObject *getMaxValue2() const
4419 DataArrayIdType *tmp;
4420 double r1=self->getMaxValue2(tmp);
4421 PyObject *ret=PyTuple_New(2);
4422 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4423 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4427 PyObject *getMinValue2() const
4429 DataArrayIdType *tmp;
4430 double r1=self->getMinValue2(tmp);
4431 PyObject *ret=PyTuple_New(2);
4432 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4433 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4437 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4439 std::vector<std::size_t> tmp;
4440 convertPyToNewIntArr3(li,tmp);
4441 return self->keepSelectedComponents(tmp);
4444 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4446 std::vector<std::size_t> tmp;
4447 convertPyToNewIntArr3(li,tmp);
4448 self->setSelectedComponents(f,tmp);
4451 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4454 DataArrayDouble *a,*a2;
4455 DataArrayDoubleTuple *aa,*aa2;
4456 std::vector<double> bb,bb2;
4459 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4460 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4461 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4462 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4464 return self->extractSlice3D(orig,vect,eps);
4467 MEDCouplingFieldDouble *__add__(PyObject *obj)
4469 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4472 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4474 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4477 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4479 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.";
4480 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4483 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4485 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4487 return (*self)-(*other);
4489 throw INTERP_KERNEL::Exception(msg);
4494 DataArrayDoubleTuple *aa;
4495 std::vector<double> bb;
4497 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4502 if(!self->getArray())
4503 throw INTERP_KERNEL::Exception(msg2);
4504 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4505 ret->applyLin(1.,-val);
4506 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4507 ret2->setArray(ret);
4512 if(!self->getArray())
4513 throw INTERP_KERNEL::Exception(msg2);
4514 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4515 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4516 ret2->setArray(ret);
4521 if(!self->getArray())
4522 throw INTERP_KERNEL::Exception(msg2);
4523 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4524 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4525 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4526 ret2->setArray(ret);
4531 if(!self->getArray())
4532 throw INTERP_KERNEL::Exception(msg2);
4533 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4534 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4535 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4536 ret2->setArray(ret);
4540 { throw INTERP_KERNEL::Exception(msg); }
4544 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4546 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4549 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4551 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4554 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4556 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4559 MEDCouplingFieldDouble *__div__(PyObject *obj)
4561 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.";
4562 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4565 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4567 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4569 return (*self)/(*other);
4571 throw INTERP_KERNEL::Exception(msg);
4576 DataArrayDoubleTuple *aa;
4577 std::vector<double> bb;
4579 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4585 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4586 if(!self->getArray())
4587 throw INTERP_KERNEL::Exception(msg2);
4588 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4589 ret->applyLin(1./val,0);
4590 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4591 ret2->setArray(ret);
4596 if(!self->getArray())
4597 throw INTERP_KERNEL::Exception(msg2);
4598 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4599 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4600 ret2->setArray(ret);
4605 if(!self->getArray())
4606 throw INTERP_KERNEL::Exception(msg2);
4607 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4608 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4609 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4610 ret2->setArray(ret);
4615 if(!self->getArray())
4616 throw INTERP_KERNEL::Exception(msg2);
4617 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4618 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4619 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4620 ret2->setArray(ret);
4624 { throw INTERP_KERNEL::Exception(msg); }
4628 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4630 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4633 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4635 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.";
4636 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4639 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4641 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4643 return (*self)^(*other);
4645 throw INTERP_KERNEL::Exception(msg);
4650 DataArrayDoubleTuple *aa;
4651 std::vector<double> bb;
4653 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4658 if(!self->getArray())
4659 throw INTERP_KERNEL::Exception(msg2);
4660 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4662 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4663 ret2->setArray(ret);
4668 if(!self->getArray())
4669 throw INTERP_KERNEL::Exception(msg2);
4670 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4671 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4672 ret2->setArray(ret);
4677 if(!self->getArray())
4678 throw INTERP_KERNEL::Exception(msg2);
4679 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4680 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4681 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4682 ret2->setArray(ret);
4687 if(!self->getArray())
4688 throw INTERP_KERNEL::Exception(msg2);
4689 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4690 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4691 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4692 ret2->setArray(ret);
4696 { throw INTERP_KERNEL::Exception(msg); }
4700 MEDCouplingFieldDouble *__neg__() const
4702 return self->negate();
4705 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4707 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.";
4708 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4711 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4713 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4717 Py_XINCREF(trueSelf);
4721 throw INTERP_KERNEL::Exception(msg);
4726 DataArrayDoubleTuple *aa;
4727 std::vector<double> bb;
4729 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4734 if(!self->getArray())
4735 throw INTERP_KERNEL::Exception(msg2);
4736 self->getArray()->applyLin(1.,val);
4737 Py_XINCREF(trueSelf);
4742 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4745 Py_XINCREF(trueSelf);
4750 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4751 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4752 ret2->setArray(aaa);
4754 Py_XINCREF(trueSelf);
4759 if(!self->getArray())
4760 throw INTERP_KERNEL::Exception(msg2);
4761 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4762 self->getArray()->addEqual(aaa);
4763 Py_XINCREF(trueSelf);
4767 { throw INTERP_KERNEL::Exception(msg); }
4771 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4773 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.";
4774 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4777 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4779 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4783 Py_XINCREF(trueSelf);
4787 throw INTERP_KERNEL::Exception(msg);
4792 DataArrayDoubleTuple *aa;
4793 std::vector<double> bb;
4795 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4800 if(!self->getArray())
4801 throw INTERP_KERNEL::Exception(msg2);
4802 self->getArray()->applyLin(1.,-val);
4803 Py_XINCREF(trueSelf);
4808 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4811 Py_XINCREF(trueSelf);
4816 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4817 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4818 ret2->setArray(aaa);
4820 Py_XINCREF(trueSelf);
4825 if(!self->getArray())
4826 throw INTERP_KERNEL::Exception(msg2);
4827 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4828 self->getArray()->substractEqual(aaa);
4829 Py_XINCREF(trueSelf);
4833 { throw INTERP_KERNEL::Exception(msg); }
4837 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4839 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.";
4840 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4843 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4845 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4849 Py_XINCREF(trueSelf);
4853 throw INTERP_KERNEL::Exception(msg);
4858 DataArrayDoubleTuple *aa;
4859 std::vector<double> bb;
4861 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4866 if(!self->getArray())
4867 throw INTERP_KERNEL::Exception(msg2);
4868 self->getArray()->applyLin(val,0);
4869 Py_XINCREF(trueSelf);
4874 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4877 Py_XINCREF(trueSelf);
4882 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4883 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4884 ret2->setArray(aaa);
4886 Py_XINCREF(trueSelf);
4891 if(!self->getArray())
4892 throw INTERP_KERNEL::Exception(msg2);
4893 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4894 self->getArray()->multiplyEqual(aaa);
4895 Py_XINCREF(trueSelf);
4899 { throw INTERP_KERNEL::Exception(msg); }
4903 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4905 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.";
4906 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4909 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4911 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4915 Py_XINCREF(trueSelf);
4919 throw INTERP_KERNEL::Exception(msg);
4924 DataArrayDoubleTuple *aa;
4925 std::vector<double> bb;
4927 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4933 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4934 if(!self->getArray())
4935 throw INTERP_KERNEL::Exception(msg2);
4936 self->getArray()->applyLin(1./val,0);
4937 Py_XINCREF(trueSelf);
4942 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4945 Py_XINCREF(trueSelf);
4950 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4951 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4952 ret2->setArray(aaa);
4954 Py_XINCREF(trueSelf);
4959 if(!self->getArray())
4960 throw INTERP_KERNEL::Exception(msg2);
4961 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4962 self->getArray()->divideEqual(aaa);
4963 Py_XINCREF(trueSelf);
4967 { throw INTERP_KERNEL::Exception(msg); }
4971 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4973 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.";
4974 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4977 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4979 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4983 Py_XINCREF(trueSelf);
4987 throw INTERP_KERNEL::Exception(msg);
4992 DataArrayDoubleTuple *aa;
4993 std::vector<double> bb;
4995 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
5000 if(!self->getArray())
5001 throw INTERP_KERNEL::Exception(msg2);
5002 self->getArray()->applyPow(val);
5003 Py_XINCREF(trueSelf);
5008 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5011 Py_XINCREF(trueSelf);
5016 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
5017 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
5018 ret2->setArray(aaa);
5020 Py_XINCREF(trueSelf);
5025 if(!self->getArray())
5026 throw INTERP_KERNEL::Exception(msg2);
5027 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
5028 self->getArray()->powEqual(aaa);
5029 Py_XINCREF(trueSelf);
5033 { throw INTERP_KERNEL::Exception(msg); }
5037 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
5039 std::vector<const MEDCouplingFieldDouble *> tmp;
5040 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5041 return MEDCouplingFieldDouble::MergeFields(tmp);
5044 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
5046 std::vector<const MEDCouplingFieldDouble *> tmp;
5047 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5048 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
5051 PyObject *getTinySerializationInformation() const
5053 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
5056 PyObject *serialize() const
5058 return field_serialize<double>(self);
5061 PyObject *__getstate__() const
5063 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
5066 void __setstate__(PyObject *inp)
5068 field__setstate__<double>(self,inp);
5073 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5076 int getNumberOfFields() const;
5077 MEDCouplingMultiFields *deepCopy() const;
5078 virtual std::string simpleRepr() const;
5079 virtual std::string advancedRepr() const;
5080 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5081 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5082 virtual void checkConsistencyLight() const;
5085 std::string __str__() const
5087 return self->simpleRepr();
5089 static MEDCouplingMultiFields *New(PyObject *li)
5091 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5092 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5093 std::size_t sz=tmp.size();
5094 std::vector<MEDCouplingFieldDouble *> fs(sz);
5095 for(std::size_t i=0;i<sz;i++)
5096 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5097 return MEDCouplingMultiFields::New(fs);
5099 MEDCouplingMultiFields(PyObject *li)
5101 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5102 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5103 std::size_t sz=tmp.size();
5104 std::vector<MEDCouplingFieldDouble *> fs(sz);
5105 for(std::size_t i=0;i<sz;i++)
5106 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5107 return MEDCouplingMultiFields::New(fs);
5109 PyObject *getFields() const
5111 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5112 std::size_t sz=fields.size();
5113 PyObject *res = PyList_New(sz);
5114 for(std::size_t i=0;i<sz;i++)
5118 fields[i]->incrRef();
5119 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5123 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5128 PyObject *getFieldAtPos(int id) const
5130 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5134 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5137 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5139 PyObject *getMeshes() const
5141 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5142 std::size_t sz=ms.size();
5143 PyObject *res = PyList_New(sz);
5144 for(std::size_t i=0;i<sz;i++)
5149 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5153 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5158 PyObject *getDifferentMeshes() const
5160 std::vector<int> refs;
5161 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5162 std::size_t sz=ms.size();
5163 PyObject *res = PyList_New(sz);
5164 for(std::size_t i=0;i<sz;i++)
5169 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5173 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5177 PyObject *ret=PyTuple_New(2);
5178 PyTuple_SetItem(ret,0,res);
5179 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5182 PyObject *getArrays() const
5184 std::vector<DataArrayDouble *> ms=self->getArrays();
5185 std::size_t sz=ms.size();
5186 PyObject *res = PyList_New(sz);
5187 for(std::size_t i=0;i<sz;i++)
5192 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5196 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5201 PyObject *getDifferentArrays() const
5203 std::vector< std::vector<int> > refs;
5204 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5205 std::size_t sz=ms.size();
5206 PyObject *res = PyList_New(sz);
5207 PyObject *res2 = PyList_New(sz);
5208 for(std::size_t i=0;i<sz;i++)
5213 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5217 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5219 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5222 PyObject *ret=PyTuple_New(2);
5223 PyTuple_SetItem(ret,0,res);
5224 PyTuple_SetItem(ret,1,res2);
5230 class MEDCouplingFieldInt32 : public MEDCouplingFieldT<int>
5233 static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5234 static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5235 bool isEqual(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5236 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5237 void setTimeUnit(const std::string& unit);
5238 std::string getTimeUnit() const;
5239 void setTime(double val, int iteration, int order);
5240 void setArray(DataArrayInt32 *array);
5241 MEDCouplingFieldInt32 *deepCopy() const;
5242 MEDCouplingFieldInt32 *clone(bool recDeepCpy) const;
5243 MEDCouplingFieldInt32 *cloneWithMesh(bool recDeepCpy) const;
5244 MEDCouplingFieldDouble *convertToDblField() const;
5245 MEDCouplingFieldInt32 *buildSubPartRange(int begin, int end, int step) const;
5247 MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5249 return MEDCouplingFieldInt32::New(type,td);
5252 MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5254 return MEDCouplingFieldInt32::New(ft,td);
5257 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const
5260 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5261 PyObject *ret=PyTuple_New(2);
5262 PyObject *ret0Py=ret0?Py_True:Py_False;
5264 PyTuple_SetItem(ret,0,ret0Py);
5265 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5269 std::string __str__() const
5271 return self->simpleRepr();
5274 std::string __repr__() const
5276 std::ostringstream oss;
5277 self->reprQuickOverview(oss);
5281 MEDCouplingFieldInt32 *buildSubPart(PyObject *li) const
5283 return fieldT_buildSubPart(self,li);
5286 MEDCouplingFieldInt32 *__getitem__(PyObject *li) const
5288 return fieldT__getitem__(self,li);
5291 DataArrayInt32 *getArray()
5293 DataArrayInt32 *ret=self->getArray();
5302 double tmp0=self->getTime(tmp1,tmp2);
5303 PyObject *res = PyList_New(3);
5304 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5305 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5306 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5310 PyObject *getTinySerializationInformation() const
5312 return field_getTinySerializationInformation<MEDCouplingFieldInt32>(self);
5315 PyObject *serialize() const
5317 return field_serialize<int>(self);
5320 PyObject *__getstate__() const
5322 return field__getstate__<MEDCouplingFieldInt32>(self,MEDCoupling_MEDCouplingFieldInt32_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt32_serialize);
5325 void __setstate__(PyObject *inp)
5327 field__setstate__<int>(self,inp);
5332 class MEDCouplingFieldInt64 : public MEDCouplingFieldT<int>
5335 static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5336 static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5337 bool isEqual(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5338 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5339 void setTimeUnit(const std::string& unit);
5340 std::string getTimeUnit() const;
5341 void setTime(double val, int iteration, int order);
5342 void setArray(DataArrayInt64 *array);
5343 MEDCouplingFieldInt64 *deepCopy() const;
5344 MEDCouplingFieldInt64 *clone(bool recDeepCpy) const;
5345 MEDCouplingFieldInt64 *cloneWithMesh(bool recDeepCpy) const;
5346 MEDCouplingFieldDouble *convertToDblField() const;
5347 MEDCouplingFieldInt64 *buildSubPartRange(int begin, int end, int step) const;
5349 MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5351 return MEDCouplingFieldInt64::New(type,td);
5354 MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5356 return MEDCouplingFieldInt64::New(ft,td);
5359 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const
5362 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5363 PyObject *ret=PyTuple_New(2);
5364 PyObject *ret0Py=ret0?Py_True:Py_False;
5366 PyTuple_SetItem(ret,0,ret0Py);
5367 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5371 std::string __str__() const
5373 return self->simpleRepr();
5376 std::string __repr__() const
5378 std::ostringstream oss;
5379 self->reprQuickOverview(oss);
5383 MEDCouplingFieldInt64 *buildSubPart(PyObject *li) const
5385 return fieldT_buildSubPart(self,li);
5388 MEDCouplingFieldInt64 *__getitem__(PyObject *li) const
5390 return fieldT__getitem__(self,li);
5393 DataArrayInt64 *getArray()
5395 DataArrayInt64 *ret=self->getArray();
5404 double tmp0=self->getTime(tmp1,tmp2);
5405 PyObject *res = PyList_New(3);
5406 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5407 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5408 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5412 PyObject *getTinySerializationInformation() const
5414 return field_getTinySerializationInformation<MEDCouplingFieldInt64>(self);
5417 PyObject *serialize() const
5419 return field_serialize<Int64>(self);
5422 PyObject *__getstate__() const
5424 return field__getstate__<MEDCouplingFieldInt64>(self,MEDCoupling_MEDCouplingFieldInt64_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt64_serialize);
5427 void __setstate__(PyObject *inp)
5429 field__setstate__<Int64>(self,inp);
5434 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5437 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5438 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5439 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5440 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5441 void setTimeUnit(const std::string& unit);
5442 std::string getTimeUnit() const;
5443 void setTime(double val, int iteration, int order);
5444 void setArray(DataArrayFloat *array);
5445 MEDCouplingFieldFloat *deepCopy() const;
5446 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5447 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5448 MEDCouplingFieldDouble *convertToDblField() const;
5449 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5451 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5453 return MEDCouplingFieldFloat::New(type,td);
5456 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5458 return MEDCouplingFieldFloat::New(ft,td);
5461 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5464 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5465 PyObject *ret=PyTuple_New(2);
5466 PyObject *ret0Py=ret0?Py_True:Py_False;
5468 PyTuple_SetItem(ret,0,ret0Py);
5469 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5473 std::string __str__() const
5475 return self->simpleRepr();
5478 std::string __repr__() const
5480 std::ostringstream oss;
5481 self->reprQuickOverview(oss);
5485 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5487 return fieldT_buildSubPart(self,li);
5490 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5492 return fieldT__getitem__(self,li);
5495 DataArrayFloat *getArray()
5497 DataArrayFloat *ret=self->getArray();
5506 double tmp0=self->getTime(tmp1,tmp2);
5507 PyObject *res = PyList_New(3);
5508 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5509 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5510 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5514 PyObject *getTinySerializationInformation() const
5516 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5519 PyObject *serialize() const
5521 return field_serialize<float>(self);
5524 PyObject *__getstate__() const
5526 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5529 void __setstate__(PyObject *inp)
5531 field__setstate__<float>(self,inp);
5536 class MEDCouplingDefinitionTime
5539 MEDCouplingDefinitionTime();
5540 void assign(const MEDCouplingDefinitionTime& other);
5541 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5542 double getTimeResolution() const;
5543 std::vector<double> getHotSpotsTime() const;
5546 std::string __str__() const
5548 std::ostringstream oss;
5549 self->appendRepr(oss);
5553 PyObject *getIdsOnTimeRight(double tm) const
5555 int meshId,arrId,arrIdInField,fieldId;
5556 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5557 PyObject *res=PyList_New(4);
5558 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5559 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5560 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5561 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5565 PyObject *getIdsOnTimeLeft(double tm) const
5567 int meshId,arrId,arrIdInField,fieldId;
5568 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5569 PyObject *res=PyList_New(4);
5570 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5571 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5572 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5573 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5579 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5582 double getTimeTolerance() const;
5583 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5587 MEDCouplingFieldOverTime(PyObject *li)
5589 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5590 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5591 std::size_t sz=tmp.size();
5592 std::vector<MEDCouplingFieldDouble *> fs(sz);
5593 for(std::size_t i=0;i<sz;i++)
5594 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5595 return MEDCouplingFieldOverTime::New(fs);
5597 std::string __str__() const
5599 return self->simpleRepr();
5601 static MEDCouplingFieldOverTime *New(PyObject *li)
5603 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5604 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5605 std::size_t sz=tmp.size();
5606 std::vector<MEDCouplingFieldDouble *> fs(sz);
5607 for(std::size_t i=0;i<sz;i++)
5608 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5609 return MEDCouplingFieldOverTime::New(fs);
5614 class MEDCouplingCartesianAMRMesh;
5616 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5619 int getNumberOfCellsRecursiveWithOverlap() const;
5620 int getNumberOfCellsRecursiveWithoutOverlap() const;
5621 int getMaxNumberOfLevelsRelativeToThis() const;
5624 MEDCouplingCartesianAMRMeshGen *getMesh() const
5626 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5634 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5637 int getNumberOfOverlapedCellsForFather() const;
5638 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5639 std::vector<mcIdType> computeCellGridSt() const;
5642 PyObject *getBLTRRange() const
5644 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5645 return convertFromVectorPairInt(ret);
5648 PyObject *getBLTRRangeRelativeToGF() const
5650 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5651 return convertFromVectorPairInt(ret);
5654 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5656 std::vector< std::pair<mcIdType,mcIdType> > inp;
5657 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5658 self->addPatch(inp,factors);
5661 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5663 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5665 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5666 if(patchId==mesh->getNumberOfPatches())
5668 std::ostringstream oss;
5669 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5670 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5673 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5679 void __delitem__(mcIdType patchId)
5681 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5683 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5684 mesh->removePatch(patchId);
5687 mcIdType __len__() const
5689 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5691 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5692 return mesh->getNumberOfPatches();
5697 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5701 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5704 mcIdType getAbsoluteLevel() const;
5705 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5706 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5707 int getSpaceDimension() const;
5708 const std::vector<mcIdType>& getFactors() const;
5709 void setFactors(const std::vector<mcIdType>& newFactors);
5710 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5711 mcIdType getNumberOfCellsAtCurrentLevel() const;
5712 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5713 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5714 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5715 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5716 virtual void detachFromFather();
5718 mcIdType getNumberOfPatches() const;
5719 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5720 MEDCouplingUMesh *buildUnstructured() const;
5721 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5722 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5723 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5724 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5725 void removeAllPatches();
5726 void removePatch(mcIdType patchId);
5727 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5728 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5729 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5730 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5731 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5732 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5733 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5734 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5735 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5736 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5737 std::string buildPythonDumpOfThis() const;
5740 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5742 std::vector< std::pair<mcIdType,mcIdType> > inp;
5743 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5744 self->addPatch(inp,factors);
5747 PyObject *getPatches() const
5749 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5750 std::size_t sz(ps.size());
5751 PyObject *ret = PyList_New(sz);
5752 for(std::size_t i=0;i<sz;i++)
5754 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5757 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5762 // agy : don't know why typemap fails here ??? let it in the extend section
5763 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5765 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5768 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5770 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5771 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5777 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5779 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5780 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5786 virtual PyObject *positionRelativeToGodFather() const
5788 std::vector<mcIdType> out1;
5789 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5790 PyObject *ret(PyTuple_New(2));
5791 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5792 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5796 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5798 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5799 std::size_t sz(ps.size());
5800 PyObject *ret = PyList_New(sz);
5801 for(std::size_t i=0;i<sz;i++)
5802 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5806 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5808 std::vector<const DataArrayDouble *> inp;
5809 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5810 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5813 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5815 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5821 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5823 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5829 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5831 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5837 MEDCouplingIMesh *getImageMesh() const
5839 const MEDCouplingIMesh *ret(self->getImageMesh());
5842 return const_cast<MEDCouplingIMesh *>(ret);
5845 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5847 if(patchId==self->getNumberOfPatches())
5849 std::ostringstream oss;
5850 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5851 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5854 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5860 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5862 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5863 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5864 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5867 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5869 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5870 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5871 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5874 void __delitem__(mcIdType patchId)
5876 self->removePatch(patchId);
5879 mcIdType __len__() const
5881 return self->getNumberOfPatches();
5886 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5890 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5893 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5896 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5898 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5899 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5900 const mcIdType *nodeStrctPtr(0);
5901 const double *originPtr(0),*dxyzPtr(0);
5902 mcIdType sw,sz,val0;
5903 std::vector<mcIdType> bb0;
5904 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5907 std::vector<double> bb,bb2;
5909 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5910 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5912 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5915 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5917 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5918 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5919 std::vector< std::vector<mcIdType> > inp2;
5920 convertPyToVectorOfVectorOfInt(factors,inp2);
5921 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5924 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5926 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5929 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5931 return MEDCouplingCartesianAMRMesh::New(mesh);
5936 class MEDCouplingDataForGodFather : public RefCountObject
5939 virtual void synchronizeFineToCoarse();
5940 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5941 virtual void synchronizeCoarseToFine();
5942 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5943 virtual void synchronizeAllGhostZones();
5944 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5945 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5946 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5947 virtual void alloc();
5948 virtual void dealloc();
5951 MEDCouplingCartesianAMRMesh *getMyGodFather()
5953 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5961 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5964 mcIdType getNumberOfLevels() const;
5965 MEDCouplingAMRAttribute *deepCopy() const;
5966 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5967 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5968 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5969 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5970 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5971 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5972 std::string writeVTHB(const std::string& fileName) const;
5975 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5977 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5978 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5979 MEDCouplingAMRAttribute *ret(0);
5982 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5983 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5985 catch(INTERP_KERNEL::Exception&)
5987 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5988 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5993 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5995 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5998 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
6000 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
6001 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
6007 void spillInfoOnComponents(PyObject *compNames)
6009 std::vector< std::vector<std::string> > compNamesCpp;
6010 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
6011 self->spillInfoOnComponents(compNamesCpp);
6014 void spillNatures(PyObject *nfs)
6016 std::vector<mcIdType> inp0;
6017 if(!fillIntVector(nfs,inp0))
6018 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
6019 std::size_t sz(inp0.size());
6020 std::vector<NatureOfField> inp00(sz);
6021 for(std::size_t i=0;i<sz;i++)
6022 inp00[i]=(NatureOfField)inp0[i];
6023 self->spillNatures(inp00);
6026 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
6028 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
6029 std::size_t sz(ret.size());
6030 PyObject *retPy(PyList_New(sz));
6031 for(std::size_t i=0;i<sz;i++)
6032 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6038 class DenseMatrix : public RefCountObject, public TimeLabel
6041 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
6042 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
6043 DenseMatrix *deepCopy() const;
6044 DenseMatrix *shallowCpy() const;
6046 mcIdType getNumberOfRows() const;
6047 mcIdType getNumberOfCols() const;
6048 mcIdType getNbOfElems() const;
6049 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
6050 void reShape(mcIdType nbRows, mcIdType nbCols);
6053 bool isEqual(const DenseMatrix& other, double eps) const;
6054 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
6055 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
6058 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
6060 return DenseMatrix::New(nbRows,nbCols);
6063 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
6065 return DenseMatrix::New(array,nbRows,nbCols);
6068 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
6071 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
6072 PyObject *ret=PyTuple_New(2);
6073 PyObject *ret0Py=ret0?Py_True:Py_False;
6075 PyTuple_SetItem(ret,0,ret0Py);
6076 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6080 DataArrayDouble *getData()
6082 DataArrayDouble *ret(self->getData());
6088 DenseMatrix *__add__(const DenseMatrix *other)
6090 return MEDCoupling::DenseMatrix::Add(self,other);
6093 DenseMatrix *__sub__(const DenseMatrix *other)
6095 return MEDCoupling::DenseMatrix::Substract(self,other);
6098 DenseMatrix *__mul__(const DenseMatrix *other)
6100 return MEDCoupling::DenseMatrix::Multiply(self,other);
6103 DenseMatrix *__mul__(const DataArrayDouble *other)
6105 return MEDCoupling::DenseMatrix::Multiply(self,other);
6108 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
6110 self->addEqual(other);
6111 Py_XINCREF(trueSelf);
6115 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
6117 self->substractEqual(other);
6118 Py_XINCREF(trueSelf);
6122 PyObject *toNumPyMatrix() // not const. It is not a bug !
6124 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
6133 def MEDCouplingUMeshReduce(self):
6134 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
6135 def MEDCouplingCMeshReduce(self):
6136 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
6137 def MEDCouplingIMeshReduce(self):
6138 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
6139 def MEDCouplingMappedExtrudedMeshReduce(self):
6140 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
6141 def MEDCouplingCurveLinearMeshReduce(self):
6142 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
6143 def MEDCoupling1SGTUMeshReduce(self):
6144 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
6145 def MEDCoupling1DGTUMeshReduce(self):
6146 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
6147 def MEDCouplingFieldDoubleReduce(self):
6148 self.checkConsistencyLight()
6149 d=(self.getTypeOfField(),self.getTimeDiscretization())
6150 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
6151 def MEDCouplingFieldInt32Reduce(self):
6152 self.checkConsistencyLight()
6153 d=(self.getTypeOfField(),self.getTimeDiscretization())
6154 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt32,(d,(self.__getstate__()),))
6155 def MEDCouplingFieldInt64Reduce(self):
6156 self.checkConsistencyLight()
6157 d=(self.getTypeOfField(),self.getTimeDiscretization())
6158 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),))
6159 def MEDCouplingFieldFloatReduce(self):
6160 self.checkConsistencyLight()
6161 d=(self.getTypeOfField(),self.getTimeDiscretization())
6162 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
6163 def MEDCouplingFTReduceFunct(cls,params):
6165 ret=object.__new__(cls)
6169 def MEDCouplingFieldTemplateReduce(self):
6170 ret = MEDCouplingFieldDouble(self)
6171 nbTuples = self.getNumberOfTuplesExpected()
6172 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
6174 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
6176 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
6178 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
6179 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
6180 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
6181 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
6182 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
6183 MEDCouplingFieldInt = MEDCouplingFieldInt32
6185 if MEDCouplingUse64BitIDs():
6186 MEDCouplingFieldID = MEDCouplingFieldInt64
6188 MEDCouplingFieldID = MEDCouplingFieldInt32
6194 __filename=os.environ.get('PYTHONSTARTUP')
6195 if __filename and os.path.isfile(__filename):
6196 with open(__filename) as __fp: