1 // Copyright (C) 2017-2021 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 "MEDCouplingCartesianAMRMesh.hxx"
51 #include "MEDCouplingAMRAttribute.hxx"
52 #include "MEDCouplingMatrix.hxx"
53 #include "MEDCouplingPartDefinition.hxx"
54 #include "MEDCouplingSkyLineArray.hxx"
55 #include "MEDCouplingTypemaps.i"
57 #include "InterpKernelAutoPtr.hxx"
58 #include "BoxSplittingOptions.hxx"
60 using namespace MEDCoupling;
61 using namespace INTERP_KERNEL;
65 %template(dvec) std::vector<double>;
66 %template(svec) std::vector<std::string>;
70 #ifndef MEDCOUPLING_USE_64BIT_IDS
71 //typedef std::int32_t mcIdType;
73 typedef DataArrayInt32 DataArrayIdType;
74 %template(ivec) std::vector<int>;
75 %template(i64vec) std::vector<long>;
77 //typedef std::int64_t mcIdType;
78 typedef DataArrayInt64 DataArrayIdType;
80 %template(ivec) std::vector<long long>;
81 typedef long long mcIdType;
83 %template(ivec) std::vector<long>;
84 typedef long int mcIdType;
86 %template(i32vec) std::vector<int>;
91 %typemap(out) MEDCoupling::MEDCouplingMesh*
93 $result=convertMesh($1,$owner);
96 %typemap(out) MEDCouplingMesh*
98 $result=convertMesh($1,$owner);
103 %typemap(out) MEDCoupling::MEDCouplingPointSet*
105 $result=convertMesh($1,$owner);
108 %typemap(out) MEDCouplingPointSet*
110 $result=convertMesh($1,$owner);
115 %typemap(out) MEDCouplingCartesianAMRPatchGen*
117 $result=convertCartesianAMRPatch($1,$owner);
122 %typemap(out) MEDCouplingCartesianAMRMeshGen*
124 $result=convertCartesianAMRMesh($1,$owner);
129 %typemap(out) MEDCouplingDataForGodFather*
131 $result=convertDataForGodFather($1,$owner);
136 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
138 $result=convertMesh($1,$owner);
141 %typemap(out) MEDCoupling1GTUMesh*
143 $result=convertMesh($1,$owner);
148 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
150 $result=convertMesh($1,$owner);
153 %typemap(out) MEDCouplingStructuredMesh*
155 $result=convertMesh($1,$owner);
160 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
162 $result=convertFieldDiscretization($1,$owner);
165 %typemap(out) MEDCouplingFieldDiscretization*
167 $result=convertFieldDiscretization($1,$owner);
172 %typemap(out) MEDCoupling::MEDCouplingField*
174 $result=convertField($1,$owner);
177 %typemap(out) MEDCouplingField*
179 $result=convertField($1,$owner);
184 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
186 $result=convertMultiFields($1,$owner);
189 %typemap(out) MEDCouplingMultiFields*
191 $result=convertMultiFields($1,$owner);
196 %typemap(out) MEDCoupling::PartDefinition*
198 $result=convertPartDefinition($1,$owner);
201 %typemap(out) PartDefinition*
203 $result=convertPartDefinition($1,$owner);
208 %init %{ import_array(); %}
211 %init %{ initializeMe(); %}
213 %feature("autodoc", "1");
214 %feature("docstring");
216 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
217 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
218 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
251 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
252 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
253 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
254 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
255 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
256 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
257 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
258 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
259 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
260 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
261 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
262 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
263 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
264 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
265 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
266 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
267 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
268 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
269 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
270 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
271 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
272 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
273 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
274 %newobject MEDCoupling::MEDCouplingFieldInt32::New;
275 %newobject MEDCoupling::MEDCouplingFieldInt32::convertToDblField;
276 %newobject MEDCoupling::MEDCouplingFieldInt32::getArray;
277 %newobject MEDCoupling::MEDCouplingFieldInt32::deepCopy;
278 %newobject MEDCoupling::MEDCouplingFieldInt32::clone;
279 %newobject MEDCoupling::MEDCouplingFieldInt32::cloneWithMesh;
280 %newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPart;
281 %newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPartRange;
282 %newobject MEDCoupling::MEDCouplingFieldInt32::__getitem__;
283 %newobject MEDCoupling::MEDCouplingFieldInt64::New;
284 %newobject MEDCoupling::MEDCouplingFieldInt64::convertToDblField;
285 %newobject MEDCoupling::MEDCouplingFieldInt64::getArray;
286 %newobject MEDCoupling::MEDCouplingFieldInt64::deepCopy;
287 %newobject MEDCoupling::MEDCouplingFieldInt64::clone;
288 %newobject MEDCoupling::MEDCouplingFieldInt64::cloneWithMesh;
289 %newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPart;
290 %newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPartRange;
291 %newobject MEDCoupling::MEDCouplingFieldInt64::__getitem__;
292 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
293 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
294 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
295 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
296 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
297 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
298 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
299 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
300 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
301 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
302 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
303 %newobject MEDCoupling::MEDCouplingMesh::clone;
304 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
305 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
306 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
307 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
308 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
309 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
310 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
311 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
312 %newobject MEDCoupling::MEDCouplingMesh::computeMeshCenterOfMass;
313 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
314 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
315 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
316 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
317 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
318 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
319 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
320 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
321 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
322 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
323 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
324 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
325 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
326 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
327 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
328 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
329 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
330 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
331 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
332 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
333 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
334 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
335 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
336 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
337 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
338 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
339 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
340 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
341 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
342 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
343 %newobject MEDCoupling::MEDCouplingUMesh::New;
344 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
345 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
346 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
347 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
348 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
349 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
350 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
351 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
352 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
353 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
354 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
355 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
356 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
357 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
358 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
359 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
360 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
361 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
362 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
363 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
364 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
365 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
366 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
367 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
368 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
369 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
370 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
371 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
372 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
373 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
374 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
375 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
376 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
377 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
378 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
379 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
380 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
381 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
382 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
383 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
384 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
385 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
386 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
387 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
388 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
389 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
390 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
391 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
392 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
393 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
394 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
395 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
396 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
397 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
398 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
399 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
400 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
401 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
402 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
403 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
404 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
405 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
406 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
407 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
408 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
409 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
410 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
411 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
412 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
413 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
414 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
415 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
416 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
417 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
418 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
419 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
420 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
421 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
422 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
423 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
424 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
425 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
426 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
427 %newobject MEDCoupling::MEDCouplingCMesh::New;
428 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
429 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
430 %newobject MEDCoupling::MEDCouplingIMesh::New;
431 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
432 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
433 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
434 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
435 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
436 %newobject MEDCoupling::MEDCouplingMultiFields::New;
437 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
438 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
439 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
440 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
441 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
442 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
443 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
444 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
445 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
446 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
447 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
448 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
449 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
450 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
451 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
452 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
453 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
454 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
455 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
456 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
457 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
458 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
459 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
460 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
461 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
462 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
463 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
464 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
465 %newobject MEDCoupling::DenseMatrix::New;
466 %newobject MEDCoupling::DenseMatrix::deepCopy;
467 %newobject MEDCoupling::DenseMatrix::shallowCpy;
468 %newobject MEDCoupling::DenseMatrix::getData;
469 %newobject MEDCoupling::DenseMatrix::matVecMult;
470 %newobject MEDCoupling::DenseMatrix::MatVecMult;
471 %newobject MEDCoupling::DenseMatrix::__add__;
472 %newobject MEDCoupling::DenseMatrix::__sub__;
473 %newobject MEDCoupling::DenseMatrix::__mul__;
474 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
475 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
476 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
477 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
478 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
479 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
480 %newobject MEDCoupling::MEDCouplingSkyLineArray::groupPacks;
481 %newobject MEDCoupling::MEDCouplingSkyLineArray::uniqueNotSortedByPack;
482 %newobject MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks;
483 %newobject MEDCoupling::MEDCouplingSkyLineArray::deepCopy;
485 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
486 %feature("unref") MEDCouplingMesh "$this->decrRef();"
487 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
488 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
489 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
490 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
491 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
492 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
493 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
494 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
495 %feature("unref") MEDCouplingField "$this->decrRef();"
496 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
497 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
498 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
499 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
500 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
501 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
502 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
503 %feature("unref") MEDCouplingFieldInt32 "$this->decrRef();"
504 %feature("unref") MEDCouplingFieldInt64 "$this->decrRef();"
505 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
506 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
507 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
508 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
509 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
510 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
511 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
512 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
513 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
514 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
515 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
516 %feature("unref") DenseMatrix "$this->decrRef();"
517 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
519 %rename(assign) *::operator=;
520 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
521 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
522 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
523 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
527 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
528 // on the Python side. Must be put BEFORE the %rename clause:
529 %exceptionclass INTERP_KERNEL::Exception;
530 %rename (InterpKernelException) INTERP_KERNEL::Exception;
532 %include "MEDCouplingRefCountObject.i"
533 %include "MEDCouplingMemArray.i"
537 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
538 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
539 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
540 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
541 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
542 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
543 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
544 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
545 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
551 PyObject *med2vtk_cell_types()
553 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
554 PyObject *ret(PyList_New(sz));
555 for(Py_ssize_t i=0;i<sz;i++)
557 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
558 PyList_SetItem(ret,i,PyInt_FromLong(elt));
563 PyObject *vtk2med_cell_types()
565 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
566 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
567 auto szOut(maxElt+1);
568 std::vector< mcIdType > retCpp(szOut,-1);
570 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
572 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
576 PyObject *ret(PyList_New(szOut));
578 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
579 PyList_SetItem(ret,id,PyInt_FromLong(*it));
583 PyObject *AllGeometricTypes()
585 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
586 PyObject *ret(PyList_New(sz));
587 for(Py_ssize_t i=0;i<sz;i++)
588 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
593 namespace INTERP_KERNEL
596 * \class BoxSplittingOptions
597 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
599 class BoxSplittingOptions
602 BoxSplittingOptions();
604 double getEfficiencyGoal() const;
605 void setEfficiencyGoal(double efficiency);
606 double getEfficiencyThreshold() const;
607 void setEfficiencyThreshold(double efficiencyThreshold);
608 int getMinimumPatchLength() const;
609 void setMinimumPatchLength(int minPatchLength);
610 int getMaximumPatchLength() const;
611 void setMaximumPatchLength(int maxPatchLength);
612 int getMaximumNbOfCellsInPatch() const;
613 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
614 void copyOptions(const BoxSplittingOptions & other);
615 std::string printOptions() const;
618 std::string __str__() const
620 return self->printOptions();
626 namespace MEDCoupling
642 CONST_ON_TIME_INTERVAL = 7
643 } TypeOfTimeDiscretization;
651 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
652 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
654 } MEDCouplingMeshType;
656 class DataArrayInt32;
657 class DataArrayInt64;
658 class DataArrayDouble;
659 class MEDCouplingUMesh;
660 class MEDCouplingCMesh;
661 class MEDCouplingFieldDouble;
663 %extend RefCountObject
665 std::string getHiddenCppPointer() const
667 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
672 %extend MEDCouplingGaussLocalization
674 std::string __str__() const
676 return self->getStringRepr();
679 std::string __repr__() const
681 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
682 oss << self->getStringRepr();
689 class MEDCouplingMesh : public RefCountObject, public TimeLabel
692 void setName(const std::string& name);
693 std::string getName() const;
694 void setDescription(const std::string& descr);
695 std::string getDescription() const;
696 void setTime(double val, int iteration, int order);
697 void setTimeUnit(const std::string& unit);
698 std::string getTimeUnit() const;
699 virtual MEDCouplingMeshType getType() const;
700 bool isStructured() const;
701 virtual MEDCouplingMesh *deepCopy() const;
702 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
703 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
704 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
705 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
706 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
707 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
708 virtual void checkConsistencyLight() const;
709 virtual void checkConsistency(double eps=1e-12) const;
710 virtual int getNumberOfCells() const;
711 virtual int getNumberOfNodes() const;
712 virtual int getSpaceDimension() const;
713 virtual int getMeshDimension() const;
714 virtual DataArrayDouble *getCoordinatesAndOwner() const;
715 virtual DataArrayDouble *computeCellCenterOfMass() const;
716 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
717 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
718 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
719 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
720 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
721 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
722 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
723 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
724 virtual std::string simpleRepr() const;
725 virtual std::string advancedRepr() const;
726 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
727 virtual std::string getVTKFileExtension() const;
728 std::string getVTKFileNameOf(const std::string& fileName) const;
730 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
731 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
732 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
733 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
734 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
735 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
736 virtual MEDCouplingUMesh *buildUnstructured() const;
737 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
738 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
739 virtual DataArrayIdType *simplexize(int policy);
740 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
741 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
742 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
743 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
744 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
745 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
746 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
747 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
750 std::string __str__() const
752 return self->simpleRepr();
755 DataArrayDouble *computeMeshCenterOfMass() const
757 MCAuto<DataArrayDouble> ret(self->computeMeshCenterOfMass());
764 double tmp0=self->getTime(tmp1,tmp2);
765 PyObject *res = PyList_New(3);
766 PyList_SetItem(res,0,SWIG_From_double(tmp0));
767 PyList_SetItem(res,1,SWIG_From_int(tmp1));
768 PyList_SetItem(res,2,SWIG_From_int(tmp2));
772 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
774 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
775 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
781 mcIdType getCellContainingPoint(PyObject *p, double eps) const
785 DataArrayDoubleTuple *aa;
786 std::vector<double> bb;
788 int spaceDim=self->getSpaceDimension();
789 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
790 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
791 return self->getCellContainingPoint(pos,eps);
794 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
798 DataArrayDoubleTuple *aa;
799 std::vector<double> bb;
801 int spaceDim=self->getSpaceDimension();
802 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
803 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
804 MCAuto<DataArrayIdType> elts,eltsIndex;
805 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
806 PyObject *ret=PyTuple_New(2);
807 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
808 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
812 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
816 DataArrayDoubleTuple *aa;
817 std::vector<double> bb;
819 int spaceDim=self->getSpaceDimension();
820 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
821 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
822 MCAuto<DataArrayIdType> elts,eltsIndex;
823 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
824 PyObject *ret=PyTuple_New(2);
825 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
826 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
830 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
832 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
833 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
836 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
838 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
839 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
842 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
846 DataArrayDoubleTuple *aa;
847 std::vector<double> bb;
849 int spaceDim=self->getSpaceDimension();
850 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
851 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
852 std::vector<mcIdType> elts;
853 self->getCellsContainingPoint(pos,eps,elts);
854 DataArrayIdType *ret=DataArrayIdType::New();
855 ret->alloc((int)elts.size(),1);
856 std::copy(elts.begin(),elts.end(),ret->getPointer());
857 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
860 virtual PyObject *getReverseNodalConnectivity() const
862 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
863 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
864 self->getReverseNodalConnectivity(d0,d1);
865 PyObject *ret=PyTuple_New(2);
866 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
867 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
871 void renumberCells(PyObject *li, bool check=true)
874 mcIdType v0; std::vector<mcIdType> v1;
875 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
876 self->renumberCells(ids,check);
879 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
881 DataArrayIdType *cellCor, *nodeCor;
882 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
883 PyObject *res = PyList_New(2);
884 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
885 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
889 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
891 DataArrayIdType *cellCor=0,*nodeCor=0;
892 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
893 PyObject *res = PyList_New(2);
894 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
895 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
899 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
901 DataArrayIdType *cellCor=0;
902 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
906 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
909 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
910 if (!SWIG_IsOK(res1))
913 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
914 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
918 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
920 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
921 da2->checkAllocated();
922 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
925 PyObject *getNodeIdsOfCell(int cellId) const
927 std::vector<mcIdType> conn;
928 self->getNodeIdsOfCell(cellId,conn);
929 return convertIntArrToPyList2(conn);
932 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
934 std::vector<double> coo;
935 self->getCoordinatesOfNode(nodeId,coo);
936 return convertDblArrToPyList2(coo);
939 void scale(PyObject *point, double factor)
943 DataArrayDoubleTuple *aa;
944 std::vector<double> bb;
946 int spaceDim=self->getSpaceDimension();
947 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
948 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
949 self->scale(pointPtr,factor);
952 PyObject *getBoundingBox() const
954 int spaceDim=self->getSpaceDimension();
955 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
956 self->getBoundingBox(tmp);
957 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
961 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
964 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
965 PyObject *ret=PyTuple_New(2);
966 PyObject *ret0Py=ret0?Py_True:Py_False;
968 PyTuple_SetItem(ret,0,ret0Py);
969 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
973 PyObject *buildPart(PyObject *li) const
975 mcIdType szArr,sw,iTypppArr;
976 std::vector<mcIdType> stdvecTyyppArr;
977 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
978 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
979 if(sw==3)//DataArrayIdType
981 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
982 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
983 std::string name=argpt->getName();
985 ret->setName(name.c_str());
987 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
990 PyObject *buildPartAndReduceNodes(PyObject *li) const
992 mcIdType szArr,sw,iTypppArr;
993 std::vector<mcIdType> stdvecTyyppArr;
994 DataArrayIdType *arr=0;
995 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
996 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
997 if(sw==3)//DataArrayIdType
999 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1000 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1001 std::string name=argpt->getName();
1003 ret->setName(name.c_str());
1006 PyObject *res = PyList_New(2);
1007 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1008 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1009 PyList_SetItem(res,0,obj0);
1010 PyList_SetItem(res,1,obj1);
1014 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
1017 DataArrayIdType *arr=0;
1018 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
1019 PyObject *res = PyTuple_New(2);
1020 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1023 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1025 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1026 PyTuple_SetItem(res,0,obj0);
1027 PyTuple_SetItem(res,1,obj1);
1031 PyObject *getDistributionOfTypes() const
1033 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1034 if(vals.size()%3!=0)
1035 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1036 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1037 for(std::size_t j=0;j<vals.size()/3;j++)
1039 PyObject *ret1=PyList_New(3);
1040 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1041 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1042 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1043 PyList_SetItem(ret,j,ret1);
1048 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1050 std::vector<mcIdType> code;
1051 std::vector<const DataArrayIdType *> idsPerType;
1052 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1053 convertPyToNewIntArr4(li,1,3,code);
1054 return self->checkTypeConsistencyAndContig(code,idsPerType);
1057 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1059 std::vector<mcIdType> code;
1060 std::vector<DataArrayIdType *> idsInPflPerType;
1061 std::vector<DataArrayIdType *> idsPerType;
1062 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1063 PyObject *ret=PyTuple_New(3);
1065 if(code.size()%3!=0)
1066 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1067 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1068 for(std::size_t j=0;j<code.size()/3;j++)
1070 PyObject *ret00=PyList_New(3);
1071 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1072 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1073 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1074 PyList_SetItem(ret0,j,ret00);
1076 PyTuple_SetItem(ret,0,ret0);
1078 PyObject *ret1=PyList_New(idsInPflPerType.size());
1079 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1080 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1081 PyTuple_SetItem(ret,1,ret1);
1082 std::size_t n=idsPerType.size();
1083 PyObject *ret2=PyList_New(n);
1084 for(std::size_t i=0;i<n;i++)
1085 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1086 PyTuple_SetItem(ret,2,ret2);
1090 void translate(PyObject *vector)
1094 DataArrayDoubleTuple *aa;
1095 std::vector<double> bb;
1097 int spaceDim=self->getSpaceDimension();
1098 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1099 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1100 self->translate(vectorPtr);
1103 void rotate(PyObject *center, double alpha)
1105 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1108 DataArrayDoubleTuple *aa;
1109 std::vector<double> bb;
1111 int spaceDim=self->getSpaceDimension();
1112 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1113 self->rotate(centerPtr,0,alpha);
1116 void rotate(PyObject *center, PyObject *vector, double alpha)
1118 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1120 DataArrayDouble *a,*a2;
1121 DataArrayDoubleTuple *aa,*aa2;
1122 std::vector<double> bb,bb2;
1124 int spaceDim=self->getSpaceDimension();
1125 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1126 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
1127 self->rotate(centerPtr,vectorPtr,alpha);
1130 PyObject *getAllGeoTypes() const
1132 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1133 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1134 PyObject *res=PyList_New(result.size());
1135 for(int i=0;iL!=result.end(); i++, iL++)
1136 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1140 virtual PyObject *getTinySerializationInformation() const
1142 std::vector<double> a0;
1143 std::vector<mcIdType> a1;
1144 std::vector<std::string> a2;
1145 self->getTinySerializationInformation(a0,a1,a2);
1146 PyObject *ret(PyTuple_New(3));
1147 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1148 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1149 std::size_t sz(a2.size());
1150 PyObject *ret2(PyList_New(sz));
1152 for(std::size_t i=0;i<sz;i++)
1153 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1155 PyTuple_SetItem(ret,2,ret2);
1159 virtual PyObject *serialize() const
1161 DataArrayIdType *a0Tmp(0);
1162 DataArrayDouble *a1Tmp(0);
1163 self->serialize(a0Tmp,a1Tmp);
1164 PyObject *ret(PyTuple_New(2));
1165 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1166 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1170 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1172 std::vector<std::string> littleStrings;
1173 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1176 PyObject *__getstate__() const
1178 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1179 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1180 PyObject *ret(PyTuple_New(2));
1181 PyTuple_SetItem(ret,0,ret0);
1182 PyTuple_SetItem(ret,1,ret1);
1186 void __setstate__(PyObject *inp)
1188 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1189 if(!PyTuple_Check(inp))
1190 throw INTERP_KERNEL::Exception(MSG);
1191 std::size_t sz(PyTuple_Size(inp));
1193 throw INTERP_KERNEL::Exception(MSG);
1194 PyObject *elt0(PyTuple_GetItem(inp,0));
1195 PyObject *elt1(PyTuple_GetItem(inp,1));
1196 std::vector<double> a0;
1197 std::vector<mcIdType> a1;
1198 std::vector<std::string> a2;
1199 DataArrayIdType *b0(0);
1200 DataArrayDouble *b1(0);
1202 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1203 throw INTERP_KERNEL::Exception(MSG);
1204 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1206 fillArrayWithPyListDbl3(a0py,tmp,a0);
1207 convertPyToNewIntArr3(a1py,a1);
1208 fillStringVector(a2py,a2);
1211 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1212 throw INTERP_KERNEL::Exception(MSG);
1213 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1215 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1216 if(!SWIG_IsOK(status))
1217 throw INTERP_KERNEL::Exception(MSG);
1218 b0=reinterpret_cast<DataArrayIdType *>(argp);
1219 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1220 if(!SWIG_IsOK(status))
1221 throw INTERP_KERNEL::Exception(MSG);
1222 b1=reinterpret_cast<DataArrayDouble *>(argp);
1224 // useless here to call resizeForUnserialization because arrays are well resized.
1225 self->unserialization(a0,a1,b0,b1,a2);
1228 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1230 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1231 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1232 return MEDCouplingMesh::MergeMeshes(tmp);
1238 //== MEDCouplingMesh End
1240 %include "NormalizedGeometricTypes"
1241 %include "MEDCouplingNatureOfFieldEnum"
1243 namespace MEDCoupling
1245 class MEDCouplingNatureOfField
1248 static const char *GetRepr(NatureOfField nat);
1249 static std::string GetReprNoThrow(NatureOfField nat);
1250 static std::string GetAllPossibilitiesStr();
1254 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1255 // include "MEDCouplingTimeDiscretization.i"
1257 namespace MEDCoupling
1259 class MEDCouplingGaussLocalization
1262 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1263 const std::vector<double>& gsCoo, const std::vector<double>& w);
1264 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1265 INTERP_KERNEL::NormalizedCellType getType() const;
1266 void setType(INTERP_KERNEL::NormalizedCellType typ);
1267 int getNumberOfGaussPt() const;
1268 int getDimension() const;
1269 int getNumberOfPtsInRefCell() const;
1270 std::string getStringRepr() const;
1271 void checkConsistencyLight() const;
1272 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1274 const std::vector<double>& getRefCoords() const;
1275 double getRefCoord(int ptIdInCell, int comp) const;
1276 const std::vector<double>& getGaussCoords() const;
1277 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1278 const std::vector<double>& getWeights() const;
1279 double getWeight(int gaussPtIdInCell, double newVal) const;
1280 void setRefCoord(int ptIdInCell, int comp, double newVal);
1281 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1282 void setWeight(int gaussPtIdInCell, double newVal);
1283 void setRefCoords(const std::vector<double>& refCoo);
1284 void setGaussCoords(const std::vector<double>& gsCoo);
1285 void setWeights(const std::vector<double>& w);
1287 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1291 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1293 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1297 MEDCouplingUMesh *buildRefCell() const
1299 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1305 class MEDCouplingSkyLineArray
1308 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1310 void set( DataArrayIdType* index, DataArrayIdType* value );
1311 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1313 int getSuperNumberOf() const;
1314 int getNumberOf() const;
1315 int getLength() const;
1317 void deletePack(const int i, const int j);
1319 void deleteSimplePack(const int i);
1320 void deleteSimplePacks(const DataArrayIdType* idx);
1322 MEDCouplingSkyLineArray *groupPacks(const DataArrayIdType *indexedPacks) const;
1323 MEDCouplingSkyLineArray *uniqueNotSortedByPack() const;
1325 MEDCouplingSkyLineArray *deepCopy() const;
1329 MEDCouplingSkyLineArray()
1331 return MEDCouplingSkyLineArray::New();
1334 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1336 return MEDCouplingSkyLineArray::New(index, value);
1339 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1341 return MEDCouplingSkyLineArray::New(index, value);
1344 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1346 return MEDCouplingSkyLineArray::New(other);
1349 std::string __str__() const
1351 return self->simpleRepr();
1354 DataArrayIdType *getSuperIndexArray() const
1356 DataArrayIdType *ret(self->getSuperIndexArray());
1362 DataArrayIdType *getIndexArray() const
1364 DataArrayIdType *ret(self->getIndexArray());
1370 DataArrayIdType *getValuesArray() const
1372 DataArrayIdType *ret(self->getValuesArray());
1378 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1380 std::vector<mcIdType> ret;
1381 self->getSimplePackSafe(absolutePackId,ret);
1382 return convertIntArrToPyList2(ret);
1385 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1387 std::vector<mcIdType> vpack, vspIdx, out;
1389 convertPyToNewIntArr3(superPackIndices,vspIdx);
1390 convertPyToNewIntArr3(pack,vpack);
1392 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1393 return convertIntArrToPyList2(out);
1396 void pushBackPack(const mcIdType i, PyObject *pack)
1398 std::vector<mcIdType> vpack;
1399 convertPyToNewIntArr3(pack,vpack);
1400 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1403 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1405 std::vector<mcIdType> vpack;
1406 convertPyToNewIntArr3(pack,vpack);
1407 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1410 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1412 std::vector<const DataArrayIdType*> packs;
1413 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1414 self->replaceSimplePacks(idx, packs);
1417 static MEDCouplingSkyLineArray *AggregatePacks(PyObject *sks)
1419 std::vector<const MEDCouplingSkyLineArray *> sksCpp;
1420 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingSkyLineArray*>(sks,SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray,"MEDCouplingSkyLineArray",sksCpp);
1421 return MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks(sksCpp);
1424 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1426 std::vector<mcIdType> vpack;
1427 convertPyToNewIntArr3(pack,vpack);
1428 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1431 PyObject *convertToPolyhedronConn() const
1433 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1434 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1435 self->convertToPolyhedronConn(d0,d1);
1436 PyObject *ret=PyTuple_New(2);
1437 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1438 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1442 PyObject *thresholdPerPack(mcIdType threshold) const
1444 MCAuto<MEDCouplingSkyLineArray> left, right;
1445 self->thresholdPerPack(threshold,left,right);
1446 PyObject *ret=PyTuple_New(2);
1447 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(left.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1448 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(right.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1455 %include "MEDCouplingFieldDiscretization.i"
1457 //== MEDCouplingPointSet
1459 namespace MEDCoupling
1461 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1464 void setCoords(const DataArrayDouble *coords);
1465 DataArrayDouble *getCoordinatesAndOwner() const;
1466 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1468 double getCaracteristicDimension() const;
1469 void recenterForMaxPrecision(double eps);
1470 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1471 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1472 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1473 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1474 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1475 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1476 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1477 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1478 virtual DataArrayIdType *computeFetchedNodeIds() const;
1479 virtual int getNumberOfNodesInCell(int cellId) const;
1480 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1481 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1482 virtual DataArrayIdType *zipCoordsTraducer();
1483 virtual DataArrayIdType *findBoundaryNodes() const;
1484 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1485 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1486 virtual void checkFullyDefined() const;
1487 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1488 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1489 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1490 virtual void renumberNodesWithOffsetInConn(int offset);
1491 virtual bool areAllNodesFetched() const;
1492 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1493 virtual void invertOrientationOfAllCells();
1496 std::string __str__() const
1498 return self->simpleRepr();
1501 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1503 mcIdType newNbOfNodes;
1504 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1505 PyObject *res = PyList_New(2);
1506 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1507 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1511 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1513 DataArrayIdType *comm, *commIndex;
1514 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1515 PyObject *res = PyList_New(2);
1516 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1517 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1521 PyObject *getCoords()
1523 DataArrayDouble *ret1=self->getCoords();
1526 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1529 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1531 mcIdType szArr,sw,iTypppArr;
1532 std::vector<mcIdType> stdvecTyyppArr;
1533 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1534 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1535 if(sw==3)//DataArrayIdType
1537 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1538 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1539 std::string name=argpt->getName();
1541 ret->setName(name.c_str());
1543 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1546 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1548 mcIdType szArr,sw,iTypppArr;
1549 std::vector<mcIdType> stdvecTyyppArr;
1550 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1551 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1552 if(sw==3)//DataArrayIdType
1554 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1555 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1556 std::string name=argpt->getName();
1558 ret->setName(name.c_str());
1560 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1563 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1565 mcIdType szArr,sw,iTypppArr;
1566 std::vector<mcIdType> stdvecTyyppArr;
1567 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1568 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1569 if(sw==3)//DataArrayIdType
1571 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1572 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1573 std::string name=argpt->getName();
1575 ret->setName(name.c_str());
1577 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1580 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1582 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1583 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1586 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1588 mcIdType szArr,sw,iTypppArr;
1589 std::vector<mcIdType> stdvecTyyppArr;
1590 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1591 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1592 if(sw==3)//DataArrayIdType
1594 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1595 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1596 std::string name=argpt->getName();
1598 ret->setName(name.c_str());
1600 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1603 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1605 mcIdType szArr,sw,iTypppArr;
1606 std::vector<mcIdType> stdvecTyyppArr;
1607 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1608 self->renumberNodes(tmp,newNbOfNodes);
1611 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1613 mcIdType szArr,sw,iTypppArr;
1614 std::vector<mcIdType> stdvecTyyppArr;
1615 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1616 self->renumberNodesCenter(tmp,newNbOfNodes);
1619 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1621 int spaceDim=self->getSpaceDimension();
1623 DataArrayDouble *a,*a2;
1624 DataArrayDoubleTuple *aa,*aa2;
1625 std::vector<double> bb,bb2;
1627 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1628 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1629 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1630 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1631 std::vector<mcIdType> nodes;
1632 self->findNodesOnLine(p,v,eps,nodes);
1633 DataArrayIdType *ret=DataArrayIdType::New();
1634 ret->alloc(nodes.size(),1);
1635 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1636 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1638 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1640 int spaceDim=self->getSpaceDimension();
1642 DataArrayDouble *a,*a2;
1643 DataArrayDoubleTuple *aa,*aa2;
1644 std::vector<double> bb,bb2;
1646 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1647 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1648 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1649 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1650 std::vector<mcIdType> nodes;
1651 self->findNodesOnPlane(p,v,eps,nodes);
1652 DataArrayIdType *ret=DataArrayIdType::New();
1653 ret->alloc(nodes.size(),1);
1654 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1655 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1658 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1662 DataArrayDoubleTuple *aa;
1663 std::vector<double> bb;
1665 int spaceDim=self->getSpaceDimension();
1666 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1667 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1668 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1669 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1672 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1674 DataArrayIdType *c=0,*cI=0;
1678 DataArrayDoubleTuple *aa;
1679 std::vector<double> bb;
1681 int spaceDim=self->getSpaceDimension();
1682 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1683 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1684 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1685 PyObject *ret=PyTuple_New(2);
1686 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1687 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1691 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1693 DataArrayIdType *c=0,*cI=0;
1694 int spaceDim=self->getSpaceDimension();
1697 DataArrayDoubleTuple *aa;
1698 std::vector<double> bb;
1700 mcIdType nbOfTuples=-1;
1701 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1702 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1704 PyObject *ret=PyTuple_New(2);
1705 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1706 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1710 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1714 DataArrayDoubleTuple *aa;
1715 std::vector<double> bb;
1717 int spaceDim=self->getSpaceDimension();
1718 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1719 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1721 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1722 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1725 void duplicateNodesInCoords(PyObject *li)
1729 std::vector<mcIdType> multiVal;
1730 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1731 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1732 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1736 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1738 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1740 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1742 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1746 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1748 DataArrayIdType *v0(nullptr),*v1(nullptr);
1749 self->findCommonCells(compType,startCellId,v0,v1);
1750 PyObject *res = PyList_New(2);
1751 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1752 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1757 virtual void renumberNodesInConn(PyObject *li)
1761 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1764 MapII *da2(reinterpret_cast<MapII *>(da));
1765 self->renumberNodesInConn(da2->data());
1769 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1770 if (!SWIG_IsOK(res1))
1773 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1774 self->renumberNodesInConn(tmp);
1778 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1780 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1781 da2->checkAllocated();
1782 self->renumberNodesInConn(da2->getConstPointer());
1786 virtual PyObject *getNodeIdsInUse() const
1789 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1790 PyObject *ret=PyTuple_New(2);
1791 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1792 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1796 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1798 DataArrayIdType *ret(nullptr);
1800 mcIdType szArr,sw,iTypppArr;
1801 std::vector<mcIdType> stdvecTyyppArr;
1802 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1803 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1807 virtual PyObject *mergeNodes(double precision)
1811 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1812 PyObject *res = PyList_New(3);
1813 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1814 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1815 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1819 virtual PyObject *mergeNodesCenter(double precision)
1823 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1824 PyObject *res = PyList_New(3);
1825 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1826 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1827 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1831 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1834 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1835 if (!SWIG_IsOK(res1))
1838 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1839 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1843 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1845 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1846 da2->checkAllocated();
1847 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1851 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1855 std::vector<mcIdType> multiVal;
1856 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1857 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1858 mcIdType nbc=self->getNumberOfCells();
1859 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1866 std::ostringstream oss;
1867 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1868 throw INTERP_KERNEL::Exception(oss.str().c_str());
1871 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1876 mcIdType tmp=nbc+singleVal;
1877 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1881 std::ostringstream oss;
1882 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1883 throw INTERP_KERNEL::Exception(oss.str().c_str());
1889 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1893 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1898 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1899 daIntTyypp->checkAllocated();
1900 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1903 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1907 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1910 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1911 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1912 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1913 for(mcIdType i=0;i<sz;i++)
1914 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1917 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1920 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1921 mcIdType sw,nbNodes=0;
1922 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1923 std::vector<double> val3;
1924 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1925 "Rotate2DAlg",2,true,nbNodes);
1927 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1928 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1931 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1934 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1935 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1936 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1937 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1938 for(mcIdType i=0;i<sz;i++)
1939 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1942 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1945 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1946 mcIdType sw,nbNodes=0;
1947 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1948 std::vector<double> val3;
1949 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1950 "Rotate3DAlg",3,true,nbNodes);
1952 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1953 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1954 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1959 //== MEDCouplingPointSet End
1961 class MEDCouplingUMeshCell
1964 INTERP_KERNEL::NormalizedCellType getType() const;
1967 std::string __str__() const
1969 return self->repr();
1972 PyObject *getAllConn() const
1975 const mcIdType *r=self->getAllConn(ret2);
1976 PyObject *ret=PyTuple_New(ret2);
1977 for(mcIdType i=0;i<ret2;i++)
1978 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1984 class MEDCouplingUMeshCellIterator
1991 MEDCouplingUMeshCell *ret=self->nextt();
1993 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1996 PyErr_SetString(PyExc_StopIteration,"No more data.");
2003 class MEDCouplingUMeshCellByTypeIterator
2006 ~MEDCouplingUMeshCellByTypeIterator();
2011 MEDCouplingUMeshCellEntry *ret=self->nextt();
2013 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
2016 PyErr_SetString(PyExc_StopIteration,"No more data.");
2023 class MEDCouplingUMeshCellByTypeEntry
2026 ~MEDCouplingUMeshCellByTypeEntry();
2029 MEDCouplingUMeshCellByTypeIterator *__iter__()
2031 return self->iterator();
2036 class MEDCouplingUMeshCellEntry
2039 INTERP_KERNEL::NormalizedCellType getType() const;
2040 int getNumberOfElems() const;
2043 MEDCouplingUMeshCellIterator *__iter__()
2045 return self->iterator();
2050 //== MEDCouplingUMesh
2052 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2055 static MEDCouplingUMesh *New();
2056 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2057 void checkConsistencyLight() const;
2058 void checkGeomConsistency(double eps=1e-12) const;
2059 void setMeshDimension(int meshDim);
2060 void allocateCells(int nbOfCells=0);
2061 void finishInsertingCells();
2062 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2063 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2064 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2065 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2066 int getNodalConnectivityArrayLen() const;
2067 void computeTypes();
2068 std::string reprConnectivityOfThis() const;
2069 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2071 DataArrayIdType *conformize2D(double eps);
2072 DataArrayIdType *conformize3D(double eps);
2073 DataArrayIdType *colinearize2D(double eps);
2074 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2075 void shiftNodeNumbersInConn(int delta);
2076 std::vector<bool> getQuadraticStatus() const;
2077 DataArrayIdType *findCellIdsOnBoundary() const;
2078 MEDCouplingUMesh *computeSkin() const;
2079 bool checkConsecutiveCellTypes() const;
2080 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2081 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2082 DataArrayIdType *sortCellsInMEDFileFrmt();
2083 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2084 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2085 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2086 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2087 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2088 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2089 void orientCorrectlyPolyhedrons();
2090 bool isPresenceOfQuadratic() const;
2091 bool isFullyQuadratic() const;
2092 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2093 bool isContiguous1D() const;
2094 void tessellate2D(double eps);
2095 void convertQuadraticCellsToLinear();
2096 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2097 void convertDegeneratedCells();
2098 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2099 bool removeDegenerated1DCells();
2100 bool areOnlySimplexCells() const;
2101 MEDCouplingFieldDouble *getEdgeRatioField() const;
2102 MEDCouplingFieldDouble *getAspectRatioField() const;
2103 MEDCouplingFieldDouble *getWarpField() const;
2104 MEDCouplingFieldDouble *getSkewField() const;
2105 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2106 DataArrayIdType *convexEnvelop2D();
2107 std::string cppRepr() const;
2108 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2109 DataArrayIdType *findAndCorrectBadOriented3DCells();
2110 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2111 MEDCouplingSkyLineArray *generateGraph() const;
2112 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2113 DataArrayIdType *buildUnionOf2DMesh() const;
2114 DataArrayIdType *buildUnionOf3DMesh() const;
2115 DataArrayIdType *orderConsecutiveCells1D() const;
2116 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2117 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2118 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2119 void changeOrientationOfCells();
2120 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2121 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2122 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2123 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2124 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2125 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2126 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2130 return MEDCouplingUMesh::New();
2133 MEDCouplingUMesh(const char *meshName, int meshDim)
2135 return MEDCouplingUMesh::New(meshName,meshDim);
2138 std::string __str__() const
2140 return self->simpleRepr();
2143 std::string __repr__() const
2145 std::ostringstream oss;
2146 self->reprQuickOverview(oss);
2150 MEDCouplingUMeshCellIterator *__iter__()
2152 return self->cellIterator();
2155 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2157 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2161 PyObject *getAllGeoTypesSorted() const
2163 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2164 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2165 PyObject *res=PyList_New(result.size());
2166 for(int i=0;iL!=result.end(); i++, iL++)
2167 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2171 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2175 std::vector<mcIdType> multiVal;
2176 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2177 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2178 mcIdType nbc=self->getNumberOfCells();
2179 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2186 std::ostringstream oss;
2187 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2188 throw INTERP_KERNEL::Exception(oss.str().c_str());
2192 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2199 mcIdType tmp=nbc+singleVal;
2200 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2205 std::ostringstream oss;
2206 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2207 throw INTERP_KERNEL::Exception(oss.str().c_str());
2213 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2219 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2220 daIntTyypp->checkAllocated();
2221 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2225 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2229 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2233 std::vector<mcIdType> multiVal;
2234 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2235 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2236 mcIdType nbc=self->getNumberOfCells();
2237 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2244 std::ostringstream oss;
2245 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2246 throw INTERP_KERNEL::Exception(oss.str().c_str());
2250 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2257 mcIdType tmp=nbc+singleVal;
2258 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2263 std::ostringstream oss;
2264 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2265 throw INTERP_KERNEL::Exception(oss.str().c_str());
2271 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2276 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2282 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2283 daIntTyypp->checkAllocated();
2284 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2288 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2292 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2294 mcIdType szArr,sw,iTypppArr;
2295 std::vector<mcIdType> stdvecTyyppArr;
2296 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2299 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2300 throw INTERP_KERNEL::Exception(oss.str().c_str());
2302 self->insertNextCell(type,size,tmp);
2305 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2307 mcIdType szArr,sw,iTypppArr;
2308 std::vector<mcIdType> stdvecTyyppArr;
2309 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2310 self->insertNextCell(type,szArr,tmp);
2313 DataArrayIdType *getNodalConnectivity()
2315 DataArrayIdType *ret=self->getNodalConnectivity();
2320 DataArrayIdType *getNodalConnectivityIndex()
2322 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2328 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2330 mcIdType szArr,sw,iTypppArr;
2331 std::vector<mcIdType> stdvecTyyppArr;
2332 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2333 mcIdType nbOfDepthPeelingPerformed=0;
2334 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2335 PyObject *res=PyTuple_New(2);
2336 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2337 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2341 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2343 DataArrayIdType *v0=0,*v1=0;
2344 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2345 PyObject *res = PyList_New(2);
2346 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2347 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2351 PyObject *distanceToPoint(PyObject *point) const
2355 DataArrayDoubleTuple *aa;
2356 std::vector<double> bb;
2358 int nbOfCompo=self->getSpaceDimension();
2359 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2362 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2363 PyObject *ret=PyTuple_New(2);
2364 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2365 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2369 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2371 DataArrayIdType *ret1=0;
2372 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2373 PyObject *ret=PyTuple_New(2);
2374 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2375 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2379 PyObject *tetrahedrize(int policy)
2382 DataArrayIdType *ret1(0);
2383 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2384 PyObject *ret=PyTuple_New(3);
2385 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2386 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2387 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2391 PyObject *checkButterflyCells(double eps=1e-12)
2393 std::vector<mcIdType> cells;
2394 self->checkButterflyCells(cells,eps);
2395 DataArrayIdType *ret=DataArrayIdType::New();
2396 ret->alloc(cells.size(),1);
2397 std::copy(cells.begin(),cells.end(),ret->getPointer());
2398 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2401 PyObject *splitByType() const
2403 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2404 std::size_t sz=ms.size();
2405 PyObject *ret = PyList_New(sz);
2406 for(std::size_t i=0;i<sz;i++)
2407 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2411 PyObject *partitionBySpreadZone() const
2413 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2414 std::size_t sz=retCpp.size();
2415 PyObject *ret=PyList_New(sz);
2416 for(std::size_t i=0;i<sz;i++)
2417 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2421 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2423 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2424 std::size_t sz=retCpp.size();
2425 PyObject *ret=PyList_New(sz);
2426 for(std::size_t i=0;i<sz;i++)
2427 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2431 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2434 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2435 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2436 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2439 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2442 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2443 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2447 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2450 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2451 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2455 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2457 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2458 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2459 PyObject *ret=PyTuple_New(3);
2460 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2461 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2462 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2466 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2468 DataArrayIdType *tmp0=0,*tmp1=0;
2469 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2470 PyObject *ret=PyTuple_New(2);
2471 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2472 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2476 void duplicateNodes(PyObject *li)
2480 std::vector<mcIdType> multiVal;
2481 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2482 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2483 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2487 return self->duplicateNodes(&singleVal,&singleVal+1);
2489 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2491 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2493 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2497 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2501 std::vector<mcIdType> multiVal;
2502 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2503 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2504 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2508 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2510 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2512 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2514 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2518 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2520 mcIdType szArr,sw,iTypppArr;
2521 std::vector<mcIdType> stdvecTyyppArr;
2522 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2523 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2526 PyObject *getLevArrPerCellTypes(PyObject *li) const
2529 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2530 DataArrayIdType *tmp0,*tmp1=0;
2531 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2532 PyObject *ret=PyTuple_New(2);
2533 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2534 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2538 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2540 DataArrayIdType *ret0=0,*ret1=0;
2541 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2542 PyObject *ret=PyTuple_New(2);
2543 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2544 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2548 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2550 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2551 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2552 DataArrayIdType *ret1=0,*ret2=0;
2553 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2554 PyObject *ret=PyTuple_New(3);
2555 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2556 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2557 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2561 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2563 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2564 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2565 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2566 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2569 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2572 std::vector<const MEDCouplingUMesh *> meshes;
2573 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2574 std::vector<DataArrayIdType *> corr;
2575 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2577 PyObject *ret1=PyList_New(sz);
2578 for(std::size_t i=0;i<sz;i++)
2579 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2580 PyObject *ret=PyList_New(2);
2581 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2582 PyList_SetItem(ret,1,ret1);
2586 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2588 std::vector<MEDCouplingUMesh *> meshes;
2589 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2590 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2593 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2595 std::vector<MEDCouplingUMesh *> meshes;
2596 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2597 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2600 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2604 DataArrayDoubleTuple *aa;
2605 std::vector<double> bb;
2607 int spaceDim=self->getSpaceDimension();
2608 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2609 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2611 std::vector<mcIdType> cells;
2612 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2613 DataArrayIdType *ret=DataArrayIdType::New();
2614 ret->alloc(cells.size(),1);
2615 std::copy(cells.begin(),cells.end(),ret->getPointer());
2616 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2619 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2623 DataArrayDoubleTuple *aa;
2624 std::vector<double> bb;
2626 int spaceDim=self->getSpaceDimension();
2627 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2628 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2629 self->orientCorrectly2DCells(v,polyOnly);
2632 PyObject *arePolyhedronsNotCorrectlyOriented() const
2634 std::vector<mcIdType> cells;
2635 self->arePolyhedronsNotCorrectlyOriented(cells);
2636 DataArrayIdType *ret=DataArrayIdType::New();
2637 ret->alloc(cells.size(),1);
2638 std::copy(cells.begin(),cells.end(),ret->getPointer());
2639 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2642 PyObject *getFastAveragePlaneOfThis() const
2646 self->getFastAveragePlaneOfThis(vec,pos);
2648 std::copy(vec,vec+3,vals);
2649 std::copy(pos,pos+3,vals+3);
2650 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2653 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2655 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2656 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2657 return MEDCouplingUMesh::MergeUMeshes(tmp);
2660 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2662 DataArrayIdType *ret1;
2663 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2664 PyObject *ret=PyTuple_New(2);
2665 PyObject *ret0Py=ret0?Py_True:Py_False;
2667 PyTuple_SetItem(ret,0,ret0Py);
2668 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2672 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2674 DataArrayIdType *ret1;
2675 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2676 PyObject *ret=PyTuple_New(2);
2677 PyObject *ret0Py=ret0?Py_True:Py_False;
2679 PyTuple_SetItem(ret,0,ret0Py);
2680 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2684 PyObject *explode3DMeshTo1D() const
2686 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2687 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2688 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2689 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2690 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2691 PyObject *ret=PyTuple_New(5);
2692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2696 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2700 PyObject *explodeIntoEdges() const
2702 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2703 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2704 PyObject *ret=PyTuple_New(5);
2705 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2706 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2707 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2708 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2709 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2713 PyObject *explodeMeshIntoMicroEdges() const
2715 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2716 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2717 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2718 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2719 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2720 PyObject *ret=PyTuple_New(5);
2721 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2722 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2723 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2724 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2725 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2729 PyObject *buildDescendingConnectivity() const
2731 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2732 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2733 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2734 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2735 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2736 PyObject *ret=PyTuple_New(5);
2737 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2738 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2739 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2740 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2745 PyObject *buildDescendingConnectivity2() const
2747 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2748 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2749 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2750 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2751 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2752 PyObject *ret=PyTuple_New(5);
2753 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2754 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2755 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2756 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2757 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyObject *computeNeighborsOfCells() const
2763 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2764 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2765 PyObject *ret=PyTuple_New(2);
2766 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2767 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2771 PyObject *computeNeighborsOfNodes() const
2773 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2774 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2775 PyObject *ret=PyTuple_New(2);
2776 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2777 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2781 PyObject *computeEnlargedNeighborsOfNodes() const
2783 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2784 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2785 PyObject *ret=PyTuple_New(2);
2786 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2787 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2791 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2793 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2794 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2795 PyObject *ret=PyTuple_New(2);
2796 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2797 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2801 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2803 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2804 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2805 PyObject *ret=PyTuple_New(2);
2806 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2807 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2811 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2813 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2814 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2815 DataArrayIdType *d2,*d3,*d4,*dd5;
2816 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2817 PyObject *ret=PyTuple_New(7);
2818 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2819 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2820 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2821 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2822 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2823 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2824 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2828 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2831 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2832 da->checkAllocated();
2833 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2836 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2839 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2840 da->checkAllocated();
2841 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2844 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2847 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2848 da->checkAllocated();
2849 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2852 PyObject *getTypesOfPart(DataArrayIdType *da) const
2855 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2856 da->checkAllocated();
2857 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2858 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2859 PyObject *res = PyList_New(result.size());
2860 for (int i=0;iL!=result.end(); i++, iL++)
2861 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2865 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2868 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2869 da->checkAllocated();
2870 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2871 ret->setName(da->getName().c_str());
2875 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2877 DataArrayIdType *cellNb1=0,*cellNb2=0;
2878 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2879 PyObject *ret=PyTuple_New(3);
2880 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2881 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2882 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2886 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2888 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2889 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2890 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2891 PyObject *ret(PyTuple_New(4));
2892 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2893 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2894 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2895 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2899 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2901 int spaceDim=self->getSpaceDimension();
2903 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2905 DataArrayDouble *a,*a2;
2906 DataArrayDoubleTuple *aa,*aa2;
2907 std::vector<double> bb,bb2;
2909 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2910 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2911 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2912 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2914 DataArrayIdType *cellIds=0;
2915 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2916 PyObject *ret=PyTuple_New(2);
2917 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2918 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2922 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2924 int spaceDim=self->getSpaceDimension();
2926 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2928 DataArrayDouble *a,*a2;
2929 DataArrayDoubleTuple *aa,*aa2;
2930 std::vector<double> bb,bb2;
2932 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2933 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2934 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2935 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2937 DataArrayIdType *cellIds=0;
2938 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2939 PyObject *ret=PyTuple_New(2);
2940 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2941 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2945 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2948 DataArrayDouble *a,*a2;
2949 DataArrayDoubleTuple *aa,*aa2;
2950 std::vector<double> bb,bb2;
2952 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2953 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2954 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2955 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2956 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2960 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2962 int spaceDim=self->getSpaceDimension();
2964 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2966 DataArrayDouble *a,*a2;
2967 DataArrayDoubleTuple *aa,*aa2;
2968 std::vector<double> bb,bb2;
2970 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2971 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2972 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2973 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2974 return self->getCellIdsCrossingPlane(orig,vect,eps);
2977 void convertToPolyTypes(PyObject *li)
2981 std::vector<mcIdType> pos2;
2982 DataArrayIdType *pos3=0;
2983 DataArrayIdTypeTuple *pos4=0;
2984 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2989 self->convertToPolyTypes(&pos1,&pos1+1);
2996 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
3001 self->convertToPolyTypes(pos3->begin(),pos3->end());
3005 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
3009 void convertAllToPoly();
3010 void convertExtrudedPolyhedra();
3012 void simplifyPolyhedra(double eps);
3013 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
3014 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
3017 //== MEDCouplingUMesh End
3019 //== MEDCouplingMappedExtrudedMesh
3021 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
3024 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
3025 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
3026 MEDCouplingUMesh *build3DUnstructuredMesh() const;
3027 int get2DCellIdForExtrusion() const;
3029 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
3031 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3034 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3036 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3039 MEDCouplingMappedExtrudedMesh()
3041 return MEDCouplingMappedExtrudedMesh::New();
3044 std::string __str__() const
3046 return self->simpleRepr();
3049 std::string __repr__() const
3051 std::ostringstream oss;
3052 self->reprQuickOverview(oss);
3056 PyObject *getMesh2D() const
3058 MEDCouplingUMesh *ret=self->getMesh2D();
3061 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3063 PyObject *getMesh1D() const
3065 MEDCouplingUMesh *ret=self->getMesh1D();
3068 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3070 PyObject *getMesh3DIds() const
3072 DataArrayIdType *ret=self->getMesh3DIds();
3075 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3080 //== MEDCouplingMappedExtrudedMesh End
3082 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3085 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3086 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3087 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3088 int getNodalConnectivityLength() const;
3089 virtual void allocateCells(int nbOfCells=0);
3090 virtual void checkConsistencyOfConnectivity() const;
3093 virtual void insertNextCell(PyObject *li)
3095 mcIdType szArr,sw,iTypppArr;
3096 std::vector<mcIdType> stdvecTyyppArr;
3097 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3098 self->insertNextCell(tmp,tmp+szArr);
3101 virtual DataArrayIdType *getNodalConnectivity() const
3103 DataArrayIdType *ret=self->getNodalConnectivity();
3104 if(ret) ret->incrRef();
3108 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3110 std::vector< const MEDCoupling1GTUMesh *> parts;
3111 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3112 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3117 //== MEDCoupling1SGTUMesh
3119 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3122 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3123 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3124 void setNodalConnectivity(DataArrayIdType *nodalConn);
3125 int getNumberOfNodesPerCell() const;
3126 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3127 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3128 MEDCoupling1GTUMesh *computeDualMesh() const;
3129 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3130 DataArrayIdType *sortHexa8EachOther();
3133 MEDCoupling1SGTUMesh()
3135 return MEDCoupling1SGTUMesh::New();
3138 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3140 return MEDCoupling1SGTUMesh::New(name,type);
3143 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3145 return MEDCoupling1SGTUMesh::New(m);
3148 std::string __str__() const
3150 return self->simpleRepr();
3153 std::string __repr__() const
3155 std::ostringstream oss;
3156 self->reprQuickOverview(oss);
3160 PyObject *structurizeMe(double eps=1e-12) const
3162 DataArrayIdType *cellPerm(0),*nodePerm(0);
3163 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3164 PyObject *ret(PyTuple_New(3));
3165 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3166 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3167 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3171 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3173 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3174 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3175 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3178 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3180 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3181 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3182 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3187 //== MEDCoupling1SGTUMesh End
3189 //== MEDCoupling1DGTUMesh
3191 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3194 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3195 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3196 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3197 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3198 bool isPacked() const;
3201 MEDCoupling1DGTUMesh()
3203 return MEDCoupling1DGTUMesh::New();
3205 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3207 return MEDCoupling1DGTUMesh::New(name,type);
3210 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3212 return MEDCoupling1DGTUMesh::New(m);
3215 std::string __str__() const
3217 return self->simpleRepr();
3220 std::string __repr__() const
3222 std::ostringstream oss;
3223 self->reprQuickOverview(oss);
3227 DataArrayIdType *getNodalConnectivityIndex() const
3229 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3230 if(ret) ret->incrRef();
3234 PyObject *retrievePackedNodalConnectivity() const
3236 DataArrayIdType *ret1=0,*ret2=0;
3237 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3238 PyObject *ret0Py=ret0?Py_True:Py_False;
3240 PyObject *ret=PyTuple_New(3);
3241 PyTuple_SetItem(ret,0,ret0Py);
3242 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3243 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3247 PyObject *copyWithNodalConnectivityPacked() const
3250 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3251 PyObject *ret=PyTuple_New(2);
3252 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3253 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3254 PyTuple_SetItem(ret,1,ret1Py);
3258 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3260 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3261 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3262 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3265 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3267 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3268 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3269 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3272 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3274 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3275 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3276 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3281 //== MEDCoupling1DGTUMeshEnd
3283 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3286 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3287 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3288 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3289 int getSpaceDimensionOnNodeStruct() const;
3290 double computeSquareness() const;
3291 virtual std::vector<mcIdType> getNodeGridStructure() const;
3292 std::vector<mcIdType> getCellGridStructure() const;
3293 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3294 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3295 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3296 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3297 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3298 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3299 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3300 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3303 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3305 mcIdType tmpp1=-1,tmpp2=-1;
3306 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3307 std::vector< std::pair<mcIdType,mcIdType> > inp;
3311 for(mcIdType i=0;i<tmpp1;i++)
3312 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3317 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3318 inp.resize(tmpp1/2);
3319 for(mcIdType i=0;i<tmpp1/2;i++)
3320 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3323 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3324 return self->buildStructuredSubPart(inp);
3327 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3329 std::vector< std::pair<mcIdType,mcIdType> > inp;
3330 convertPyToVectorPairInt(part,inp);
3332 mcIdType szArr,sw,iTypppArr;
3333 std::vector<mcIdType> stdvecTyyppArr;
3334 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3335 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3337 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3340 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3342 std::vector< std::pair<mcIdType,mcIdType> > inp;
3343 convertPyToVectorPairInt(part,inp);
3344 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3347 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3349 std::vector< std::pair<mcIdType,mcIdType> > inp;
3350 convertPyToVectorPairInt(part,inp);
3351 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3354 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3356 std::vector< std::pair<mcIdType,mcIdType> > inp;
3357 convertPyToVectorPairInt(part,inp);
3358 std::vector<mcIdType> stWithGhost;
3359 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3360 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3361 PyObject *ret(PyTuple_New(2));
3362 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3363 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3367 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3369 std::vector< std::pair<mcIdType,mcIdType> > inp;
3370 convertPyToVectorPairInt(partCompactFormat,inp);
3371 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3374 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3376 std::vector< std::pair<mcIdType,mcIdType> > inp;
3377 convertPyToVectorPairInt(partCompactFormat,inp);
3378 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3381 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3383 std::vector< std::pair<mcIdType,mcIdType> > inp;
3384 convertPyToVectorPairInt(part,inp);
3385 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3388 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3390 mcIdType szArr,sw,iTypppArr;
3391 std::vector<mcIdType> stdvecTyyppArr;
3392 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3393 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3396 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3398 mcIdType szArr,sw,iTypppArr;
3399 std::vector<mcIdType> stdvecTyyppArr;
3400 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3401 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3404 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3406 std::vector< std::pair<mcIdType,mcIdType> > inp;
3407 convertPyToVectorPairInt(partCompactFormat,inp);
3408 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3411 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3413 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3414 PyObject *retPy=PyList_New(ret.size());
3415 for(std::size_t i=0;i<ret.size();i++)
3417 PyObject *tmp=PyTuple_New(2);
3418 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3419 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3420 PyList_SetItem(retPy,i,tmp);
3425 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3427 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3428 convertPyToVectorPairInt(r1,r1Cpp);
3429 convertPyToVectorPairInt(r2,r2Cpp);
3430 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3431 PyObject *retPy=PyList_New(ret.size());
3432 for(std::size_t i=0;i<ret.size();i++)
3434 PyObject *tmp=PyTuple_New(2);
3435 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3436 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3437 PyList_SetItem(retPy,i,tmp);
3442 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3444 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3445 convertPyToVectorPairInt(r1,r1Cpp);
3446 convertPyToVectorPairInt(r2,r2Cpp);
3447 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3450 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3452 mcIdType szArr,sw,iTypppArr;
3453 std::vector<mcIdType> stdvecTyyppArr;
3454 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3455 mcIdType szArr2,sw2,iTypppArr2;
3456 std::vector<mcIdType> stdvecTyyppArr2;
3457 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3458 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3459 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3460 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3461 PyObject *ret=PyTuple_New(2);
3462 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3463 PyTuple_SetItem(ret,0,ret0Py);
3464 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3465 for(std::size_t i=0;i<partCompactFormat.size();i++)
3467 PyObject *tmp4=PyTuple_New(2);
3468 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3469 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3470 PyList_SetItem(ret1Py,i,tmp4);
3472 PyTuple_SetItem(ret,1,ret1Py);
3476 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3478 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3479 convertPyToVectorPairInt(bigInAbs,param0);
3480 convertPyToVectorPairInt(partOfBigInAbs,param1);
3481 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3482 PyObject *retPy(PyList_New(ret.size()));
3483 for(std::size_t i=0;i<ret.size();i++)
3485 PyObject *tmp(PyTuple_New(2));
3486 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3487 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3488 PyList_SetItem(retPy,i,tmp);
3493 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3495 std::vector< std::pair<mcIdType,mcIdType> > param0;
3496 convertPyToVectorPairInt(part,param0);
3497 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3498 PyObject *retPy(PyList_New(ret.size()));
3499 for(std::size_t i=0;i<ret.size();i++)
3501 PyObject *tmp(PyTuple_New(2));
3502 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3503 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3504 PyList_SetItem(retPy,i,tmp);
3509 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3511 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3512 convertPyToVectorPairInt(startingFrom,param0);
3513 convertPyToVectorPairInt(goingTo,param1);
3514 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3517 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3519 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3520 convertPyToVectorPairInt(bigInAbs,param0);
3521 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3522 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3523 PyObject *retPy(PyList_New(ret.size()));
3524 for(std::size_t i=0;i<ret.size();i++)
3526 PyObject *tmp(PyTuple_New(2));
3527 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3528 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3529 PyList_SetItem(retPy,i,tmp);
3536 class MEDCouplingCurveLinearMesh;
3538 //== MEDCouplingCMesh
3540 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3543 static MEDCouplingCMesh *New();
3544 static MEDCouplingCMesh *New(const std::string& meshName);
3545 void setCoords(const DataArrayDouble *coordsX,
3546 const DataArrayDouble *coordsY=0,
3547 const DataArrayDouble *coordsZ=0);
3548 void setCoordsAt(int i, const DataArrayDouble *arr);
3549 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3553 return MEDCouplingCMesh::New();
3555 MEDCouplingCMesh(const std::string& meshName)
3557 return MEDCouplingCMesh::New(meshName);
3559 std::string __str__() const
3561 return self->simpleRepr();
3563 std::string __repr__() const
3565 std::ostringstream oss;
3566 self->reprQuickOverview(oss);
3569 DataArrayDouble *getCoordsAt(int i)
3571 DataArrayDouble *ret=self->getCoordsAt(i);
3579 //== MEDCouplingCMesh End
3581 //== MEDCouplingCurveLinearMesh
3583 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3586 static MEDCouplingCurveLinearMesh *New();
3587 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3588 void setCoords(const DataArrayDouble *coords);
3590 MEDCouplingCurveLinearMesh()
3592 return MEDCouplingCurveLinearMesh::New();
3594 MEDCouplingCurveLinearMesh(const std::string& meshName)
3596 return MEDCouplingCurveLinearMesh::New(meshName);
3598 std::string __str__() const
3600 return self->simpleRepr();
3602 std::string __repr__() const
3604 std::ostringstream oss;
3605 self->reprQuickOverview(oss);
3608 DataArrayDouble *getCoords()
3610 DataArrayDouble *ret=self->getCoords();
3615 void setNodeGridStructure(PyObject *gridStruct)
3617 mcIdType szArr,sw,iTypppArr;
3618 std::vector<mcIdType> stdvecTyyppArr;
3619 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3620 self->setNodeGridStructure(tmp,tmp+szArr);
3625 //== MEDCouplingCurveLinearMesh End
3627 //== MEDCouplingIMesh
3629 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3632 static MEDCouplingIMesh *New();
3634 void setSpaceDimension(int spaceDim);
3635 std::vector<mcIdType> getNodeStruct() const;
3636 std::vector<double> getOrigin() const;
3637 std::vector<double> getDXYZ() const;
3638 void setAxisUnit(const std::string& unitName);
3639 std::string getAxisUnit() const;
3640 double getMeasureOfAnyCell() const;
3641 MEDCouplingCMesh *convertToCartesian() const;
3642 void refineWithFactor(const std::vector<mcIdType>& factors);
3643 MEDCouplingIMesh *asSingleCell() const;
3644 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3649 return MEDCouplingIMesh::New();
3651 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3653 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3654 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3655 const mcIdType *nodeStrctPtr(0);
3656 const double *originPtr(0),*dxyzPtr(0);
3657 mcIdType sw,sz,val0;
3658 std::vector<mcIdType> bb0;
3659 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3662 std::vector<double> bb,bb2;
3664 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3665 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3667 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3670 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3672 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3675 void setNodeStruct(PyObject *nodeStrct)
3677 mcIdType sw,sz,val0;
3678 std::vector<mcIdType> bb0;
3679 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3680 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3683 void setOrigin(PyObject *origin)
3685 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3687 std::vector<double> bb;
3688 mcIdType sw,nbTuples;
3689 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3690 self->setOrigin(originPtr,originPtr+nbTuples);
3693 void setDXYZ(PyObject *dxyz)
3695 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3697 std::vector<double> bb;
3698 mcIdType sw,nbTuples;
3699 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3700 self->setDXYZ(originPtr,originPtr+nbTuples);
3703 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3705 std::vector< std::pair<mcIdType,mcIdType> > inp;
3706 convertPyToVectorPairInt(fineLocInCoarse,inp);
3707 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3710 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3712 std::vector< std::pair<mcIdType,mcIdType> > inp;
3713 convertPyToVectorPairInt(fineLocInCoarse,inp);
3714 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3717 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3719 std::vector< std::pair<mcIdType,mcIdType> > inp;
3720 convertPyToVectorPairInt(fineLocInCoarse,inp);
3721 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3724 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3726 std::vector< std::pair<mcIdType,mcIdType> > inp;
3727 convertPyToVectorPairInt(fineLocInCoarse,inp);
3728 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3731 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3733 std::vector< std::pair<mcIdType,mcIdType> > inp;
3734 convertPyToVectorPairInt(fineLocInCoarse,inp);
3735 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3738 std::string __str__() const
3740 return self->simpleRepr();
3742 std::string __repr__() const
3744 std::ostringstream oss;
3745 self->reprQuickOverview(oss);
3751 //== MEDCouplingIMesh End
3755 namespace MEDCoupling
3757 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3760 virtual void checkConsistencyLight() const;
3761 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3762 bool areStrictlyCompatible(const MEDCouplingField *other) const;
3763 bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
3764 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3765 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3766 void setName(const char *name);
3767 std::string getDescription() const;
3768 void setDescription(const char *desc);
3769 std::string getName() const;
3770 TypeOfField getTypeOfField() const;
3771 NatureOfField getNature() const;
3772 virtual void setNature(NatureOfField nat);
3773 DataArrayDouble *getLocalizationOfDiscr() const;
3774 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3775 mcIdType getNumberOfTuplesExpected() const;
3776 mcIdType getNumberOfMeshPlacesExpected() const;
3777 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3778 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3779 void clearGaussLocalizations();
3780 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3781 mcIdType getNbOfGaussLocalization() const;
3782 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3783 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3784 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3785 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3787 PyObject *getMesh() const
3789 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3792 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3795 PyObject *getDiscretization()
3797 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3800 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3803 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3805 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3806 return convertIntArrToPyList3(ret);
3809 PyObject *buildSubMeshData(PyObject *li) const
3811 DataArrayIdType *ret1=0;
3812 MEDCouplingMesh *ret0=0;
3814 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3815 if (!SWIG_IsOK(res1))
3818 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3819 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3823 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3825 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3826 da2->checkAllocated();
3827 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3829 PyObject *res = PyList_New(2);
3830 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3831 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3835 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3837 DataArrayIdType *ret1=0;
3839 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3840 PyObject *res=PyTuple_New(2);
3841 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3843 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3846 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3847 PyTuple_SetItem(res,1,res1);
3852 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3855 mcIdType v0; std::vector<mcIdType> v1;
3856 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3857 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3860 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3861 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3864 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3865 if (!SWIG_IsOK(res1))
3868 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3869 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3873 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3875 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3876 da2->checkAllocated();
3877 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3881 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3883 std::vector<mcIdType> tmp;
3884 self->getCellIdsHavingGaussLocalization(locId,tmp);
3885 DataArrayIdType *ret=DataArrayIdType::New();
3886 ret->alloc((mcIdType)tmp.size(),1);
3887 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3888 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3891 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3893 std::vector<mcIdType> inp0;
3894 convertPyToNewIntArr4(code,1,3,inp0);
3895 std::vector<const DataArrayIdType *> inp1;
3896 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3897 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3902 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3905 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3906 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3907 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f);
3908 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f);
3909 static MEDCouplingFieldTemplate *New(TypeOfField type);
3910 std::string simpleRepr() const;
3911 std::string advancedRepr() const;
3912 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3913 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3916 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3918 return MEDCouplingFieldTemplate::New(f);
3921 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3923 return MEDCouplingFieldTemplate::New(f);
3926 MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f)
3928 return MEDCouplingFieldTemplate::New(f);
3931 MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f)
3933 return MEDCouplingFieldTemplate::New(f);
3936 MEDCouplingFieldTemplate(TypeOfField type)
3938 return MEDCouplingFieldTemplate::New(type);
3941 std::string __str__() const
3943 return self->simpleRepr();
3946 std::string __repr__() const
3948 std::ostringstream oss;
3949 self->reprQuickOverview(oss);
3953 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3956 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3957 PyObject *ret=PyTuple_New(2);
3958 PyObject *ret0Py=ret0?Py_True:Py_False;
3960 PyTuple_SetItem(ret,0,ret0Py);
3961 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3968 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3971 TypeOfTimeDiscretization getTimeDiscretization() const;
3973 MEDCouplingFieldT();
3974 ~MEDCouplingFieldT();
3977 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3978 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3979 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3981 class MEDCouplingFieldInt32;
3982 class MEDCouplingFieldInt64;
3983 class MEDCouplingFieldFloat;
3985 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3988 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3989 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3990 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3991 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3992 void setTimeUnit(const std::string& unit);
3993 std::string getTimeUnit() const;
3994 void synchronizeTimeWithSupport();
3995 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3996 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3997 std::string simpleRepr() const;
3998 std::string advancedRepr() const;
3999 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
4000 MEDCouplingFieldInt32 *convertToIntField() const;
4001 MEDCouplingFieldFloat *convertToFloatField() const;
4002 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
4003 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
4004 MEDCouplingFieldDouble *deepCopy() const;
4005 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
4006 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
4007 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
4008 double getIJ(int tupleId, int compoId) const;
4009 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
4010 void synchronizeTimeWithMesh();
4011 void setArray(DataArrayDouble *array);
4012 void setEndArray(DataArrayDouble *array);
4013 void setTime(double val, int iteration, int order);
4014 void setStartTime(double val, int iteration, int order);
4015 void setEndTime(double val, int iteration, int order);
4016 void applyLin(double a, double b, int compoId);
4017 void applyLin(double a, double b);
4018 int getNumberOfComponents() const;
4019 int getNumberOfTuples() const;
4020 int getNumberOfValues() const;
4021 void setTimeTolerance(double val);
4022 double getTimeTolerance() const;
4023 void setIteration(int it);
4024 void setEndIteration(int it);
4025 void setOrder(int order);
4026 void setEndOrder(int order);
4027 void setTimeValue(double val);
4028 void setEndTimeValue(double val);
4029 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
4030 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
4031 bool mergeNodes(double eps, double epsOnVals=1e-15);
4032 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
4033 bool zipCoords(double epsOnVals=1e-15);
4034 bool zipConnectivity(int compType,double epsOnVals=1e-15);
4035 bool simplexize(int policy);
4036 MEDCouplingFieldDouble *doublyContractedProduct() const;
4037 MEDCouplingFieldDouble *determinant() const;
4038 MEDCouplingFieldDouble *eigenValues() const;
4039 MEDCouplingFieldDouble *eigenVectors() const;
4040 MEDCouplingFieldDouble *inverse() const;
4041 MEDCouplingFieldDouble *trace() const;
4042 MEDCouplingFieldDouble *deviator() const;
4043 MEDCouplingFieldDouble *magnitude() const;
4044 MEDCouplingFieldDouble *maxPerTuple() const;
4045 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
4046 void sortPerTuple(bool asc);
4047 MEDCouplingFieldDouble &operator=(double value);
4048 void fillFromAnalytic(int nbOfComp, const std::string& func);
4049 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4050 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4051 void applyFunc(int nbOfComp, const std::string& func);
4052 void applyFuncCompo(int nbOfComp, const std::string& func);
4053 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4054 void applyFunc(int nbOfComp, double val);
4055 void applyFunc(const std::string& func);
4056 void applyFuncFast32(const std::string& func);
4057 void applyFuncFast64(const std::string& func);
4058 double accumulate(int compId) const;
4059 double getMaxValue() const;
4060 double getMinValue() const;
4061 double getAverageValue() const;
4062 double norm2() const;
4063 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4064 double getWeightedAverageValue(int compId, bool isWAbs) const;
4065 double integral(int compId, bool isWAbs) const;
4066 double normL1(int compId) const;
4067 double normL2(int compId) const;
4068 double normMax(int compId) const;
4069 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4070 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4071 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4072 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4073 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4074 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4075 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4076 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4077 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4078 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4079 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4080 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4081 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4082 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4083 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4084 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4085 MEDCouplingFieldDouble *negate() const;
4087 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4089 return MEDCouplingFieldDouble::New(type,td);
4092 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4094 return MEDCouplingFieldDouble::New(ft,td);
4097 std::string __str__() const
4099 return self->simpleRepr();
4102 std::string __repr__() const
4104 std::ostringstream oss;
4105 self->reprQuickOverview(oss);
4109 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4112 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4113 PyObject *ret=PyTuple_New(2);
4114 PyObject *ret0Py=ret0?Py_True:Py_False;
4116 PyTuple_SetItem(ret,0,ret0Py);
4117 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4121 MEDCouplingFieldDouble *voronoize(double eps) const
4123 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4127 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4129 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4133 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4135 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4137 DataArrayDouble *a,*a2;
4138 DataArrayDoubleTuple *aa,*aa2;
4139 std::vector<double> bb,bb2;
4141 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4142 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4143 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4146 DataArrayDouble *getArray()
4148 DataArrayDouble *ret=self->getArray();
4154 PyObject *getArrays() const
4156 std::vector<DataArrayDouble *> arrs=self->getArrays();
4157 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4160 std::size_t sz=arrs.size();
4161 PyObject *ret=PyTuple_New(sz);
4162 for(std::size_t i=0;i<sz;i++)
4165 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4167 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4172 void setArrays(PyObject *ls)
4174 std::vector<const DataArrayDouble *> tmp;
4175 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4176 std::size_t sz=tmp.size();
4177 std::vector<DataArrayDouble *> arrs(sz);
4178 for(std::size_t i=0;i<sz;i++)
4179 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4180 self->setArrays(arrs);
4183 DataArrayDouble *getEndArray()
4185 DataArrayDouble *ret=self->getEndArray();
4191 PyObject *getValueOn(PyObject *sl) const
4195 DataArrayDoubleTuple *aa;
4196 std::vector<double> bb;
4198 const MEDCouplingMesh *mesh=self->getMesh();
4200 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4201 int spaceDim=mesh->getSpaceDimension();
4202 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4203 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4205 mcIdType sz=ToIdType(self->getNumberOfComponents());
4206 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4207 self->getValueOn(spaceLoc,res);
4208 return convertDblArrToPyList<double>(res,sz);
4211 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4213 mcIdType sz=ToIdType(self->getNumberOfComponents());
4214 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4215 self->getValueOnPos(i,j,k,res);
4216 return convertDblArrToPyList<double>(res,sz);
4219 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4221 const MEDCouplingMesh *mesh(self->getMesh());
4223 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4226 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4227 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4228 mesh->getSpaceDimension(),true,nbPts);
4229 return self->getValueOnMulti(inp,(int)nbPts);
4232 PyObject *getValueOn(PyObject *sl, double time) const
4236 DataArrayDoubleTuple *aa;
4237 std::vector<double> bb;
4239 const MEDCouplingMesh *mesh=self->getMesh();
4241 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4242 int spaceDim=mesh->getSpaceDimension();
4243 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4244 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4247 mcIdType sz=ToIdType(self->getNumberOfComponents());
4248 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4249 self->getValueOn(spaceLoc,time,res);
4250 return convertDblArrToPyList<double>(res,sz);
4253 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4255 if(self->getArray()!=0)
4256 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4259 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4260 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4261 self->setArray(arr);
4268 double tmp0=self->getTime(tmp1,tmp2);
4269 PyObject *res = PyList_New(3);
4270 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4271 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4272 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4276 PyObject *getStartTime()
4279 double tmp0=self->getStartTime(tmp1,tmp2);
4280 PyObject *res = PyList_New(3);
4281 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4282 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4283 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4287 PyObject *getEndTime()
4290 double tmp0=self->getEndTime(tmp1,tmp2);
4291 PyObject *res = PyList_New(3);
4292 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4293 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4294 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4297 PyObject *accumulate() const
4299 mcIdType sz=ToIdType(self->getNumberOfComponents());
4300 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4301 self->accumulate(tmp);
4302 return convertDblArrToPyList<double>(tmp,sz);
4304 PyObject *integral(bool isWAbs) const
4306 mcIdType sz=ToIdType(self->getNumberOfComponents());
4307 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4308 self->integral(isWAbs,tmp);
4309 return convertDblArrToPyList<double>(tmp,sz);
4311 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4313 mcIdType sz=ToIdType(self->getNumberOfComponents());
4314 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4315 self->getWeightedAverageValue(tmp,isWAbs);
4316 return convertDblArrToPyList<double>(tmp,sz);
4318 PyObject *normL1() const
4320 mcIdType sz=ToIdType(self->getNumberOfComponents());
4321 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4323 return convertDblArrToPyList<double>(tmp,sz);
4325 PyObject *normL2() const
4327 mcIdType sz=ToIdType(self->getNumberOfComponents());
4328 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4330 return convertDblArrToPyList<double>(tmp,sz);
4332 PyObject *normMax() const
4334 mcIdType sz=ToIdType(self->getNumberOfComponents());
4335 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4337 return convertDblArrToPyList<double>(tmp,sz);
4339 void renumberCells(PyObject *li, bool check=true)
4341 mcIdType szArr,sw,iTypppArr;
4342 std::vector<mcIdType> stdvecTyyppArr;
4343 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4344 self->renumberCells(tmp,check);
4347 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4349 mcIdType szArr,sw,iTypppArr;
4350 std::vector<mcIdType> stdvecTyyppArr;
4351 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4352 self->renumberCellsWithoutMesh(tmp,check);
4355 void renumberNodes(PyObject *li, double eps=1e-15)
4357 mcIdType szArr,sw,iTypppArr;
4358 std::vector<mcIdType> stdvecTyyppArr;
4359 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4360 self->renumberNodes(tmp,eps);
4363 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4365 mcIdType szArr,sw,iTypppArr;
4366 std::vector<mcIdType> stdvecTyyppArr;
4367 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4368 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4371 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4373 return fieldT_buildSubPart(self,li);
4376 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4378 return fieldT__getitem__(self,li);
4381 PyObject *getMaxValue2() const
4383 DataArrayIdType *tmp;
4384 double r1=self->getMaxValue2(tmp);
4385 PyObject *ret=PyTuple_New(2);
4386 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4387 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4391 PyObject *getMinValue2() const
4393 DataArrayIdType *tmp;
4394 double r1=self->getMinValue2(tmp);
4395 PyObject *ret=PyTuple_New(2);
4396 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4397 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4401 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4403 std::vector<std::size_t> tmp;
4404 convertPyToNewIntArr3(li,tmp);
4405 return self->keepSelectedComponents(tmp);
4408 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4410 std::vector<std::size_t> tmp;
4411 convertPyToNewIntArr3(li,tmp);
4412 self->setSelectedComponents(f,tmp);
4415 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4418 DataArrayDouble *a,*a2;
4419 DataArrayDoubleTuple *aa,*aa2;
4420 std::vector<double> bb,bb2;
4423 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4424 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4425 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4426 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4428 return self->extractSlice3D(orig,vect,eps);
4431 MEDCouplingFieldDouble *__add__(PyObject *obj)
4433 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4436 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4438 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4441 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4443 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.";
4444 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4447 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4449 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4451 return (*self)-(*other);
4453 throw INTERP_KERNEL::Exception(msg);
4458 DataArrayDoubleTuple *aa;
4459 std::vector<double> bb;
4461 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4466 if(!self->getArray())
4467 throw INTERP_KERNEL::Exception(msg2);
4468 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4469 ret->applyLin(1.,-val);
4470 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4471 ret2->setArray(ret);
4476 if(!self->getArray())
4477 throw INTERP_KERNEL::Exception(msg2);
4478 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4479 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4480 ret2->setArray(ret);
4485 if(!self->getArray())
4486 throw INTERP_KERNEL::Exception(msg2);
4487 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4488 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4489 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4490 ret2->setArray(ret);
4495 if(!self->getArray())
4496 throw INTERP_KERNEL::Exception(msg2);
4497 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4498 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4499 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4500 ret2->setArray(ret);
4504 { throw INTERP_KERNEL::Exception(msg); }
4508 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4510 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4513 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4515 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4518 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4520 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4523 MEDCouplingFieldDouble *__div__(PyObject *obj)
4525 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.";
4526 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4529 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4531 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4533 return (*self)/(*other);
4535 throw INTERP_KERNEL::Exception(msg);
4540 DataArrayDoubleTuple *aa;
4541 std::vector<double> bb;
4543 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4549 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4550 if(!self->getArray())
4551 throw INTERP_KERNEL::Exception(msg2);
4552 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4553 ret->applyLin(1./val,0);
4554 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4555 ret2->setArray(ret);
4560 if(!self->getArray())
4561 throw INTERP_KERNEL::Exception(msg2);
4562 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4563 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4564 ret2->setArray(ret);
4569 if(!self->getArray())
4570 throw INTERP_KERNEL::Exception(msg2);
4571 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4572 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4573 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4574 ret2->setArray(ret);
4579 if(!self->getArray())
4580 throw INTERP_KERNEL::Exception(msg2);
4581 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4582 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4583 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4584 ret2->setArray(ret);
4588 { throw INTERP_KERNEL::Exception(msg); }
4592 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4594 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4597 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4599 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.";
4600 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4603 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4605 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4607 return (*self)^(*other);
4609 throw INTERP_KERNEL::Exception(msg);
4614 DataArrayDoubleTuple *aa;
4615 std::vector<double> bb;
4617 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4622 if(!self->getArray())
4623 throw INTERP_KERNEL::Exception(msg2);
4624 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4626 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4627 ret2->setArray(ret);
4632 if(!self->getArray())
4633 throw INTERP_KERNEL::Exception(msg2);
4634 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4635 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4636 ret2->setArray(ret);
4641 if(!self->getArray())
4642 throw INTERP_KERNEL::Exception(msg2);
4643 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4644 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4645 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4646 ret2->setArray(ret);
4651 if(!self->getArray())
4652 throw INTERP_KERNEL::Exception(msg2);
4653 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4654 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4655 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4656 ret2->setArray(ret);
4660 { throw INTERP_KERNEL::Exception(msg); }
4664 MEDCouplingFieldDouble *__neg__() const
4666 return self->negate();
4669 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4671 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.";
4672 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4675 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4677 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4681 Py_XINCREF(trueSelf);
4685 throw INTERP_KERNEL::Exception(msg);
4690 DataArrayDoubleTuple *aa;
4691 std::vector<double> bb;
4693 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4698 if(!self->getArray())
4699 throw INTERP_KERNEL::Exception(msg2);
4700 self->getArray()->applyLin(1.,val);
4701 Py_XINCREF(trueSelf);
4706 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4709 Py_XINCREF(trueSelf);
4714 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4715 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4716 ret2->setArray(aaa);
4718 Py_XINCREF(trueSelf);
4723 if(!self->getArray())
4724 throw INTERP_KERNEL::Exception(msg2);
4725 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4726 self->getArray()->addEqual(aaa);
4727 Py_XINCREF(trueSelf);
4731 { throw INTERP_KERNEL::Exception(msg); }
4735 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4737 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.";
4738 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4741 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4743 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4747 Py_XINCREF(trueSelf);
4751 throw INTERP_KERNEL::Exception(msg);
4756 DataArrayDoubleTuple *aa;
4757 std::vector<double> bb;
4759 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4764 if(!self->getArray())
4765 throw INTERP_KERNEL::Exception(msg2);
4766 self->getArray()->applyLin(1.,-val);
4767 Py_XINCREF(trueSelf);
4772 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4775 Py_XINCREF(trueSelf);
4780 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4781 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4782 ret2->setArray(aaa);
4784 Py_XINCREF(trueSelf);
4789 if(!self->getArray())
4790 throw INTERP_KERNEL::Exception(msg2);
4791 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4792 self->getArray()->substractEqual(aaa);
4793 Py_XINCREF(trueSelf);
4797 { throw INTERP_KERNEL::Exception(msg); }
4801 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4803 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.";
4804 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4807 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4809 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4813 Py_XINCREF(trueSelf);
4817 throw INTERP_KERNEL::Exception(msg);
4822 DataArrayDoubleTuple *aa;
4823 std::vector<double> bb;
4825 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4830 if(!self->getArray())
4831 throw INTERP_KERNEL::Exception(msg2);
4832 self->getArray()->applyLin(val,0);
4833 Py_XINCREF(trueSelf);
4838 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4841 Py_XINCREF(trueSelf);
4846 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4847 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4848 ret2->setArray(aaa);
4850 Py_XINCREF(trueSelf);
4855 if(!self->getArray())
4856 throw INTERP_KERNEL::Exception(msg2);
4857 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4858 self->getArray()->multiplyEqual(aaa);
4859 Py_XINCREF(trueSelf);
4863 { throw INTERP_KERNEL::Exception(msg); }
4867 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4869 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.";
4870 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4873 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4875 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4879 Py_XINCREF(trueSelf);
4883 throw INTERP_KERNEL::Exception(msg);
4888 DataArrayDoubleTuple *aa;
4889 std::vector<double> bb;
4891 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4897 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4898 if(!self->getArray())
4899 throw INTERP_KERNEL::Exception(msg2);
4900 self->getArray()->applyLin(1./val,0);
4901 Py_XINCREF(trueSelf);
4906 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4909 Py_XINCREF(trueSelf);
4914 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4915 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4916 ret2->setArray(aaa);
4918 Py_XINCREF(trueSelf);
4923 if(!self->getArray())
4924 throw INTERP_KERNEL::Exception(msg2);
4925 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4926 self->getArray()->divideEqual(aaa);
4927 Py_XINCREF(trueSelf);
4931 { throw INTERP_KERNEL::Exception(msg); }
4935 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4937 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.";
4938 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4941 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4943 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4947 Py_XINCREF(trueSelf);
4951 throw INTERP_KERNEL::Exception(msg);
4956 DataArrayDoubleTuple *aa;
4957 std::vector<double> bb;
4959 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4964 if(!self->getArray())
4965 throw INTERP_KERNEL::Exception(msg2);
4966 self->getArray()->applyPow(val);
4967 Py_XINCREF(trueSelf);
4972 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4975 Py_XINCREF(trueSelf);
4980 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4981 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4982 ret2->setArray(aaa);
4984 Py_XINCREF(trueSelf);
4989 if(!self->getArray())
4990 throw INTERP_KERNEL::Exception(msg2);
4991 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4992 self->getArray()->powEqual(aaa);
4993 Py_XINCREF(trueSelf);
4997 { throw INTERP_KERNEL::Exception(msg); }
5001 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
5003 std::vector<const MEDCouplingFieldDouble *> tmp;
5004 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5005 return MEDCouplingFieldDouble::MergeFields(tmp);
5008 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
5010 std::vector<const MEDCouplingFieldDouble *> tmp;
5011 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5012 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
5015 PyObject *getTinySerializationInformation() const
5017 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
5020 PyObject *serialize() const
5022 return field_serialize<double>(self);
5025 PyObject *__getstate__() const
5027 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
5030 void __setstate__(PyObject *inp)
5032 field__setstate__<double>(self,inp);
5037 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5040 int getNumberOfFields() const;
5041 MEDCouplingMultiFields *deepCopy() const;
5042 virtual std::string simpleRepr() const;
5043 virtual std::string advancedRepr() const;
5044 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5045 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5046 virtual void checkConsistencyLight() const;
5049 std::string __str__() const
5051 return self->simpleRepr();
5053 static MEDCouplingMultiFields *New(PyObject *li)
5055 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5056 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5057 std::size_t sz=tmp.size();
5058 std::vector<MEDCouplingFieldDouble *> fs(sz);
5059 for(std::size_t i=0;i<sz;i++)
5060 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5061 return MEDCouplingMultiFields::New(fs);
5063 MEDCouplingMultiFields(PyObject *li)
5065 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5066 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5067 std::size_t sz=tmp.size();
5068 std::vector<MEDCouplingFieldDouble *> fs(sz);
5069 for(std::size_t i=0;i<sz;i++)
5070 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5071 return MEDCouplingMultiFields::New(fs);
5073 PyObject *getFields() const
5075 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5076 std::size_t sz=fields.size();
5077 PyObject *res = PyList_New(sz);
5078 for(std::size_t i=0;i<sz;i++)
5082 fields[i]->incrRef();
5083 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5087 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5092 PyObject *getFieldAtPos(int id) const
5094 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5098 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5101 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5103 PyObject *getMeshes() const
5105 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5106 std::size_t sz=ms.size();
5107 PyObject *res = PyList_New(sz);
5108 for(std::size_t i=0;i<sz;i++)
5113 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5117 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5122 PyObject *getDifferentMeshes() const
5124 std::vector<int> refs;
5125 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5126 std::size_t sz=ms.size();
5127 PyObject *res = PyList_New(sz);
5128 for(std::size_t i=0;i<sz;i++)
5133 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5137 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5141 PyObject *ret=PyTuple_New(2);
5142 PyTuple_SetItem(ret,0,res);
5143 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5146 PyObject *getArrays() const
5148 std::vector<DataArrayDouble *> ms=self->getArrays();
5149 std::size_t sz=ms.size();
5150 PyObject *res = PyList_New(sz);
5151 for(std::size_t i=0;i<sz;i++)
5156 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5160 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5165 PyObject *getDifferentArrays() const
5167 std::vector< std::vector<int> > refs;
5168 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5169 std::size_t sz=ms.size();
5170 PyObject *res = PyList_New(sz);
5171 PyObject *res2 = PyList_New(sz);
5172 for(std::size_t i=0;i<sz;i++)
5177 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5181 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5183 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5186 PyObject *ret=PyTuple_New(2);
5187 PyTuple_SetItem(ret,0,res);
5188 PyTuple_SetItem(ret,1,res2);
5194 class MEDCouplingFieldInt32 : public MEDCouplingFieldT<int>
5197 static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5198 static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5199 bool isEqual(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5200 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const;
5201 void setTimeUnit(const std::string& unit);
5202 std::string getTimeUnit() const;
5203 void setTime(double val, int iteration, int order);
5204 void setArray(DataArrayInt32 *array);
5205 MEDCouplingFieldInt32 *deepCopy() const;
5206 MEDCouplingFieldInt32 *clone(bool recDeepCpy) const;
5207 MEDCouplingFieldInt32 *cloneWithMesh(bool recDeepCpy) const;
5208 MEDCouplingFieldDouble *convertToDblField() const;
5209 MEDCouplingFieldInt32 *buildSubPartRange(int begin, int end, int step) const;
5211 MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5213 return MEDCouplingFieldInt32::New(type,td);
5216 MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5218 return MEDCouplingFieldInt32::New(ft,td);
5221 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const
5224 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5225 PyObject *ret=PyTuple_New(2);
5226 PyObject *ret0Py=ret0?Py_True:Py_False;
5228 PyTuple_SetItem(ret,0,ret0Py);
5229 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5233 std::string __str__() const
5235 return self->simpleRepr();
5238 std::string __repr__() const
5240 std::ostringstream oss;
5241 self->reprQuickOverview(oss);
5245 MEDCouplingFieldInt32 *buildSubPart(PyObject *li) const
5247 return fieldT_buildSubPart(self,li);
5250 MEDCouplingFieldInt32 *__getitem__(PyObject *li) const
5252 return fieldT__getitem__(self,li);
5255 DataArrayInt32 *getArray()
5257 DataArrayInt32 *ret=self->getArray();
5266 double tmp0=self->getTime(tmp1,tmp2);
5267 PyObject *res = PyList_New(3);
5268 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5269 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5270 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5274 PyObject *getTinySerializationInformation() const
5276 return field_getTinySerializationInformation<MEDCouplingFieldInt32>(self);
5279 PyObject *serialize() const
5281 return field_serialize<int>(self);
5284 PyObject *__getstate__() const
5286 return field__getstate__<MEDCouplingFieldInt32>(self,MEDCoupling_MEDCouplingFieldInt32_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt32_serialize);
5289 void __setstate__(PyObject *inp)
5291 field__setstate__<int>(self,inp);
5296 class MEDCouplingFieldInt64 : public MEDCouplingFieldT<int>
5299 static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5300 static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5301 bool isEqual(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5302 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const;
5303 void setTimeUnit(const std::string& unit);
5304 std::string getTimeUnit() const;
5305 void setTime(double val, int iteration, int order);
5306 void setArray(DataArrayInt64 *array);
5307 MEDCouplingFieldInt64 *deepCopy() const;
5308 MEDCouplingFieldInt64 *clone(bool recDeepCpy) const;
5309 MEDCouplingFieldInt64 *cloneWithMesh(bool recDeepCpy) const;
5310 MEDCouplingFieldDouble *convertToDblField() const;
5311 MEDCouplingFieldInt64 *buildSubPartRange(int begin, int end, int step) const;
5313 MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5315 return MEDCouplingFieldInt64::New(type,td);
5318 MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5320 return MEDCouplingFieldInt64::New(ft,td);
5323 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const
5326 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5327 PyObject *ret=PyTuple_New(2);
5328 PyObject *ret0Py=ret0?Py_True:Py_False;
5330 PyTuple_SetItem(ret,0,ret0Py);
5331 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5335 std::string __str__() const
5337 return self->simpleRepr();
5340 std::string __repr__() const
5342 std::ostringstream oss;
5343 self->reprQuickOverview(oss);
5347 MEDCouplingFieldInt64 *buildSubPart(PyObject *li) const
5349 return fieldT_buildSubPart(self,li);
5352 MEDCouplingFieldInt64 *__getitem__(PyObject *li) const
5354 return fieldT__getitem__(self,li);
5357 DataArrayInt64 *getArray()
5359 DataArrayInt64 *ret=self->getArray();
5368 double tmp0=self->getTime(tmp1,tmp2);
5369 PyObject *res = PyList_New(3);
5370 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5371 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5372 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5376 PyObject *getTinySerializationInformation() const
5378 return field_getTinySerializationInformation<MEDCouplingFieldInt64>(self);
5381 PyObject *serialize() const
5383 return field_serialize<Int64>(self);
5386 PyObject *__getstate__() const
5388 return field__getstate__<MEDCouplingFieldInt64>(self,MEDCoupling_MEDCouplingFieldInt64_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt64_serialize);
5391 void __setstate__(PyObject *inp)
5393 field__setstate__<Int64>(self,inp);
5398 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5401 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5402 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5403 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5404 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5405 void setTimeUnit(const std::string& unit);
5406 std::string getTimeUnit() const;
5407 void setTime(double val, int iteration, int order);
5408 void setArray(DataArrayFloat *array);
5409 MEDCouplingFieldFloat *deepCopy() const;
5410 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5411 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5412 MEDCouplingFieldDouble *convertToDblField() const;
5413 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5415 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5417 return MEDCouplingFieldFloat::New(type,td);
5420 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5422 return MEDCouplingFieldFloat::New(ft,td);
5425 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5428 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5429 PyObject *ret=PyTuple_New(2);
5430 PyObject *ret0Py=ret0?Py_True:Py_False;
5432 PyTuple_SetItem(ret,0,ret0Py);
5433 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5437 std::string __str__() const
5439 return self->simpleRepr();
5442 std::string __repr__() const
5444 std::ostringstream oss;
5445 self->reprQuickOverview(oss);
5449 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5451 return fieldT_buildSubPart(self,li);
5454 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5456 return fieldT__getitem__(self,li);
5459 DataArrayFloat *getArray()
5461 DataArrayFloat *ret=self->getArray();
5470 double tmp0=self->getTime(tmp1,tmp2);
5471 PyObject *res = PyList_New(3);
5472 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5473 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5474 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5478 PyObject *getTinySerializationInformation() const
5480 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5483 PyObject *serialize() const
5485 return field_serialize<float>(self);
5488 PyObject *__getstate__() const
5490 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5493 void __setstate__(PyObject *inp)
5495 field__setstate__<float>(self,inp);
5500 class MEDCouplingDefinitionTime
5503 MEDCouplingDefinitionTime();
5504 void assign(const MEDCouplingDefinitionTime& other);
5505 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5506 double getTimeResolution() const;
5507 std::vector<double> getHotSpotsTime() const;
5510 std::string __str__() const
5512 std::ostringstream oss;
5513 self->appendRepr(oss);
5517 PyObject *getIdsOnTimeRight(double tm) const
5519 int meshId,arrId,arrIdInField,fieldId;
5520 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5521 PyObject *res=PyList_New(4);
5522 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5523 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5524 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5525 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5529 PyObject *getIdsOnTimeLeft(double tm) const
5531 int meshId,arrId,arrIdInField,fieldId;
5532 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5533 PyObject *res=PyList_New(4);
5534 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5535 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5536 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5537 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5543 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5546 double getTimeTolerance() const;
5547 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5551 MEDCouplingFieldOverTime(PyObject *li)
5553 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5554 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5555 std::size_t sz=tmp.size();
5556 std::vector<MEDCouplingFieldDouble *> fs(sz);
5557 for(std::size_t i=0;i<sz;i++)
5558 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5559 return MEDCouplingFieldOverTime::New(fs);
5561 std::string __str__() const
5563 return self->simpleRepr();
5565 static MEDCouplingFieldOverTime *New(PyObject *li)
5567 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5568 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5569 std::size_t sz=tmp.size();
5570 std::vector<MEDCouplingFieldDouble *> fs(sz);
5571 for(std::size_t i=0;i<sz;i++)
5572 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5573 return MEDCouplingFieldOverTime::New(fs);
5578 class MEDCouplingCartesianAMRMesh;
5580 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5583 int getNumberOfCellsRecursiveWithOverlap() const;
5584 int getNumberOfCellsRecursiveWithoutOverlap() const;
5585 int getMaxNumberOfLevelsRelativeToThis() const;
5588 MEDCouplingCartesianAMRMeshGen *getMesh() const
5590 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5598 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5601 int getNumberOfOverlapedCellsForFather() const;
5602 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5603 std::vector<mcIdType> computeCellGridSt() const;
5606 PyObject *getBLTRRange() const
5608 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5609 return convertFromVectorPairInt(ret);
5612 PyObject *getBLTRRangeRelativeToGF() const
5614 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5615 return convertFromVectorPairInt(ret);
5618 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5620 std::vector< std::pair<mcIdType,mcIdType> > inp;
5621 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5622 self->addPatch(inp,factors);
5625 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5627 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5629 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5630 if(patchId==mesh->getNumberOfPatches())
5632 std::ostringstream oss;
5633 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5634 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5637 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5643 void __delitem__(mcIdType patchId)
5645 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5647 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5648 mesh->removePatch(patchId);
5651 mcIdType __len__() const
5653 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5655 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5656 return mesh->getNumberOfPatches();
5661 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5665 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5668 mcIdType getAbsoluteLevel() const;
5669 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5670 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5671 int getSpaceDimension() const;
5672 const std::vector<mcIdType>& getFactors() const;
5673 void setFactors(const std::vector<mcIdType>& newFactors);
5674 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5675 mcIdType getNumberOfCellsAtCurrentLevel() const;
5676 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5677 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5678 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5679 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5680 virtual void detachFromFather();
5682 mcIdType getNumberOfPatches() const;
5683 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5684 MEDCouplingUMesh *buildUnstructured() const;
5685 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5686 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5687 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5688 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5689 void removeAllPatches();
5690 void removePatch(mcIdType patchId);
5691 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5692 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5693 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5694 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5695 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5696 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5697 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5698 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5699 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5700 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5701 std::string buildPythonDumpOfThis() const;
5704 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5706 std::vector< std::pair<mcIdType,mcIdType> > inp;
5707 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5708 self->addPatch(inp,factors);
5711 PyObject *getPatches() const
5713 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5714 std::size_t sz(ps.size());
5715 PyObject *ret = PyList_New(sz);
5716 for(std::size_t i=0;i<sz;i++)
5718 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5721 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5726 // agy : don't know why typemap fails here ??? let it in the extend section
5727 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5729 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5732 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5734 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5735 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5741 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5743 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5744 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5750 virtual PyObject *positionRelativeToGodFather() const
5752 std::vector<mcIdType> out1;
5753 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5754 PyObject *ret(PyTuple_New(2));
5755 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5756 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5760 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5762 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5763 std::size_t sz(ps.size());
5764 PyObject *ret = PyList_New(sz);
5765 for(std::size_t i=0;i<sz;i++)
5766 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5770 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5772 std::vector<const DataArrayDouble *> inp;
5773 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5774 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5777 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5779 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5785 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5787 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5793 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5795 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5801 MEDCouplingIMesh *getImageMesh() const
5803 const MEDCouplingIMesh *ret(self->getImageMesh());
5806 return const_cast<MEDCouplingIMesh *>(ret);
5809 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5811 if(patchId==self->getNumberOfPatches())
5813 std::ostringstream oss;
5814 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5815 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5818 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5824 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5826 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5827 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5828 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5831 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5833 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5834 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5835 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5838 void __delitem__(mcIdType patchId)
5840 self->removePatch(patchId);
5843 mcIdType __len__() const
5845 return self->getNumberOfPatches();
5850 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5854 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5857 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5860 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5862 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5863 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5864 const mcIdType *nodeStrctPtr(0);
5865 const double *originPtr(0),*dxyzPtr(0);
5866 mcIdType sw,sz,val0;
5867 std::vector<mcIdType> bb0;
5868 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5871 std::vector<double> bb,bb2;
5873 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5874 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5876 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5879 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5881 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5882 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5883 std::vector< std::vector<mcIdType> > inp2;
5884 convertPyToVectorOfVectorOfInt(factors,inp2);
5885 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5888 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5890 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5893 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5895 return MEDCouplingCartesianAMRMesh::New(mesh);
5900 class MEDCouplingDataForGodFather : public RefCountObject
5903 virtual void synchronizeFineToCoarse();
5904 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5905 virtual void synchronizeCoarseToFine();
5906 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5907 virtual void synchronizeAllGhostZones();
5908 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5909 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5910 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5911 virtual void alloc();
5912 virtual void dealloc();
5915 MEDCouplingCartesianAMRMesh *getMyGodFather()
5917 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5925 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5928 mcIdType getNumberOfLevels() const;
5929 MEDCouplingAMRAttribute *deepCopy() const;
5930 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5931 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5932 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5933 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5934 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5935 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5936 std::string writeVTHB(const std::string& fileName) const;
5939 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5941 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5942 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5943 MEDCouplingAMRAttribute *ret(0);
5946 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5947 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5949 catch(INTERP_KERNEL::Exception&)
5951 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5952 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5957 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5959 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5962 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5964 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5965 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5971 void spillInfoOnComponents(PyObject *compNames)
5973 std::vector< std::vector<std::string> > compNamesCpp;
5974 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5975 self->spillInfoOnComponents(compNamesCpp);
5978 void spillNatures(PyObject *nfs)
5980 std::vector<mcIdType> inp0;
5981 if(!fillIntVector(nfs,inp0))
5982 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5983 std::size_t sz(inp0.size());
5984 std::vector<NatureOfField> inp00(sz);
5985 for(std::size_t i=0;i<sz;i++)
5986 inp00[i]=(NatureOfField)inp0[i];
5987 self->spillNatures(inp00);
5990 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5992 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5993 std::size_t sz(ret.size());
5994 PyObject *retPy(PyList_New(sz));
5995 for(std::size_t i=0;i<sz;i++)
5996 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
6002 class DenseMatrix : public RefCountObject, public TimeLabel
6005 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
6006 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
6007 DenseMatrix *deepCopy() const;
6008 DenseMatrix *shallowCpy() const;
6010 mcIdType getNumberOfRows() const;
6011 mcIdType getNumberOfCols() const;
6012 mcIdType getNbOfElems() const;
6013 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
6014 void reShape(mcIdType nbRows, mcIdType nbCols);
6017 bool isEqual(const DenseMatrix& other, double eps) const;
6018 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
6019 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
6022 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
6024 return DenseMatrix::New(nbRows,nbCols);
6027 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
6029 return DenseMatrix::New(array,nbRows,nbCols);
6032 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
6035 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
6036 PyObject *ret=PyTuple_New(2);
6037 PyObject *ret0Py=ret0?Py_True:Py_False;
6039 PyTuple_SetItem(ret,0,ret0Py);
6040 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
6044 DataArrayDouble *getData()
6046 DataArrayDouble *ret(self->getData());
6052 DenseMatrix *__add__(const DenseMatrix *other)
6054 return MEDCoupling::DenseMatrix::Add(self,other);
6057 DenseMatrix *__sub__(const DenseMatrix *other)
6059 return MEDCoupling::DenseMatrix::Substract(self,other);
6062 DenseMatrix *__mul__(const DenseMatrix *other)
6064 return MEDCoupling::DenseMatrix::Multiply(self,other);
6067 DenseMatrix *__mul__(const DataArrayDouble *other)
6069 return MEDCoupling::DenseMatrix::Multiply(self,other);
6072 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
6074 self->addEqual(other);
6075 Py_XINCREF(trueSelf);
6079 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
6081 self->substractEqual(other);
6082 Py_XINCREF(trueSelf);
6086 PyObject *toNumPyMatrix() // not const. It is not a bug !
6088 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
6097 def MEDCouplingUMeshReduce(self):
6098 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
6099 def MEDCouplingCMeshReduce(self):
6100 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
6101 def MEDCouplingIMeshReduce(self):
6102 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
6103 def MEDCouplingMappedExtrudedMeshReduce(self):
6104 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
6105 def MEDCouplingCurveLinearMeshReduce(self):
6106 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
6107 def MEDCoupling1SGTUMeshReduce(self):
6108 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
6109 def MEDCoupling1DGTUMeshReduce(self):
6110 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
6111 def MEDCouplingFieldDoubleReduce(self):
6112 self.checkConsistencyLight()
6113 d=(self.getTypeOfField(),self.getTimeDiscretization())
6114 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
6115 def MEDCouplingFieldInt32Reduce(self):
6116 self.checkConsistencyLight()
6117 d=(self.getTypeOfField(),self.getTimeDiscretization())
6118 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt32,(d,(self.__getstate__()),))
6119 def MEDCouplingFieldInt64Reduce(self):
6120 self.checkConsistencyLight()
6121 d=(self.getTypeOfField(),self.getTimeDiscretization())
6122 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),))
6123 def MEDCouplingFieldFloatReduce(self):
6124 self.checkConsistencyLight()
6125 d=(self.getTypeOfField(),self.getTimeDiscretization())
6126 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
6127 def MEDCouplingFTReduceFunct(cls,params):
6129 ret=object.__new__(cls)
6133 def MEDCouplingFieldTemplateReduce(self):
6134 ret = MEDCouplingFieldDouble(self)
6135 nbTuples = self.getNumberOfTuplesExpected()
6136 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
6138 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
6140 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
6142 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
6143 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
6144 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
6145 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
6146 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
6147 MEDCouplingFieldInt = MEDCouplingFieldInt32
6149 if MEDCouplingUse64BitIDs():
6150 MEDCouplingFieldID = MEDCouplingFieldInt64
6152 MEDCouplingFieldID = MEDCouplingFieldInt32
6158 __filename=os.environ.get('PYTHONSTARTUP')
6159 if __filename and os.path.isfile(__filename):
6160 with open(__filename) as __fp: