1 // Copyright (C) 2017-2020 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 "MEDCouplingFieldInt.hxx"
41 #include "MEDCouplingFieldFloat.hxx"
42 #include "MEDCouplingFieldTemplate.hxx"
43 #include "MEDCouplingGaussLocalization.hxx"
45 #include "MEDCouplingMultiFields.hxx"
46 #include "MEDCouplingFieldOverTime.hxx"
47 #include "MEDCouplingDefinitionTime.hxx"
48 #include "MEDCouplingFieldDiscretization.hxx"
49 #include "MEDCouplingCartesianAMRMesh.hxx"
50 #include "MEDCouplingAMRAttribute.hxx"
51 #include "MEDCouplingMatrix.hxx"
52 #include "MEDCouplingPartDefinition.hxx"
53 #include "MEDCouplingSkyLineArray.hxx"
54 #include "MEDCouplingTypemaps.i"
56 #include "InterpKernelAutoPtr.hxx"
57 #include "BoxSplittingOptions.hxx"
59 using namespace MEDCoupling;
60 using namespace INTERP_KERNEL;
64 %template(dvec) std::vector<double>;
65 %template(svec) std::vector<std::string>;
69 #ifndef MEDCOUPLING_USE_64BIT_IDS
70 //typedef std::int32_t mcIdType;
72 typedef DataArrayInt32 DataArrayIdType;
73 %template(ivec) std::vector<int>;
74 %template(i64vec) std::vector<long>;
76 //typedef std::int64_t mcIdType;
77 typedef DataArrayInt64 DataArrayIdType;
79 %template(ivec) std::vector<long long>;
80 typedef long long mcIdType;
82 %template(ivec) std::vector<long>;
83 typedef long int mcIdType;
85 %template(i32vec) std::vector<int>;
90 %typemap(out) MEDCoupling::MEDCouplingMesh*
92 $result=convertMesh($1,$owner);
95 %typemap(out) MEDCouplingMesh*
97 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCoupling::MEDCouplingPointSet*
104 $result=convertMesh($1,$owner);
107 %typemap(out) MEDCouplingPointSet*
109 $result=convertMesh($1,$owner);
114 %typemap(out) MEDCouplingCartesianAMRPatchGen*
116 $result=convertCartesianAMRPatch($1,$owner);
121 %typemap(out) MEDCouplingCartesianAMRMeshGen*
123 $result=convertCartesianAMRMesh($1,$owner);
128 %typemap(out) MEDCouplingDataForGodFather*
130 $result=convertDataForGodFather($1,$owner);
135 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
137 $result=convertMesh($1,$owner);
140 %typemap(out) MEDCoupling1GTUMesh*
142 $result=convertMesh($1,$owner);
147 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
149 $result=convertMesh($1,$owner);
152 %typemap(out) MEDCouplingStructuredMesh*
154 $result=convertMesh($1,$owner);
159 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
161 $result=convertFieldDiscretization($1,$owner);
164 %typemap(out) MEDCouplingFieldDiscretization*
166 $result=convertFieldDiscretization($1,$owner);
171 %typemap(out) MEDCoupling::MEDCouplingField*
173 $result=convertField($1,$owner);
176 %typemap(out) MEDCouplingField*
178 $result=convertField($1,$owner);
183 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
185 $result=convertMultiFields($1,$owner);
188 %typemap(out) MEDCouplingMultiFields*
190 $result=convertMultiFields($1,$owner);
195 %typemap(out) MEDCoupling::PartDefinition*
197 $result=convertPartDefinition($1,$owner);
200 %typemap(out) PartDefinition*
202 $result=convertPartDefinition($1,$owner);
207 %init %{ import_array(); %}
210 %init %{ initializeMe(); %}
212 %feature("autodoc", "1");
213 %feature("docstring");
215 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
216 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
217 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
218 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
251 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
252 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
253 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
254 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
255 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
256 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
257 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
258 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
259 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
260 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
261 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
262 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
263 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
264 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
265 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
266 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
267 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
268 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
269 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
270 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
271 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
272 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
273 %newobject MEDCoupling::MEDCouplingFieldInt::New;
274 %newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField;
275 %newobject MEDCoupling::MEDCouplingFieldInt::getArray;
276 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
277 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
278 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
279 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
280 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
281 %newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
282 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
283 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
284 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
285 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
286 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
287 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
288 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
289 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
290 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
291 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
292 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
293 %newobject MEDCoupling::MEDCouplingMesh::clone;
294 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
295 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
296 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
297 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
298 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
299 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
300 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
301 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
302 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
303 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
304 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
305 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
306 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
307 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
308 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
309 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
310 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
311 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
312 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
313 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
314 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
315 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
316 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
317 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
318 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
319 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
320 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
321 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
322 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
323 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
324 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
325 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
326 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
327 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
328 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
329 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
330 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
331 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
332 %newobject MEDCoupling::MEDCouplingUMesh::New;
333 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
334 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
335 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
336 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
337 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
338 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
339 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
340 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
341 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
342 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
343 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
344 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
345 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
346 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
347 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
348 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
349 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
350 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
351 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
352 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
353 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
354 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
355 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
356 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
357 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
358 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
359 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
360 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
361 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
362 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
363 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
364 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
365 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
366 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
367 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
368 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
369 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
370 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
371 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
372 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
373 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
374 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
375 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
376 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
377 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
378 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
379 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
380 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
381 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
382 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
383 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
384 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
385 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
386 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
387 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
388 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
389 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
390 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
391 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
392 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
393 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
394 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
395 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
396 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
397 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
398 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
399 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
400 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
401 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
402 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
403 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
404 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
405 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
406 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
407 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
408 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
409 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
410 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
411 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
412 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
413 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
414 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
415 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
416 %newobject MEDCoupling::MEDCouplingCMesh::New;
417 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
418 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
419 %newobject MEDCoupling::MEDCouplingIMesh::New;
420 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
421 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
422 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
423 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
424 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
425 %newobject MEDCoupling::MEDCouplingMultiFields::New;
426 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
427 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
428 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
429 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
430 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
431 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
432 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
433 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
434 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
435 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
436 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
437 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
438 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
439 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
440 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
441 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
442 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
443 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
444 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
445 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
446 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
447 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
448 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
449 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
450 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
451 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
452 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
453 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
454 %newobject MEDCoupling::DenseMatrix::New;
455 %newobject MEDCoupling::DenseMatrix::deepCopy;
456 %newobject MEDCoupling::DenseMatrix::shallowCpy;
457 %newobject MEDCoupling::DenseMatrix::getData;
458 %newobject MEDCoupling::DenseMatrix::matVecMult;
459 %newobject MEDCoupling::DenseMatrix::MatVecMult;
460 %newobject MEDCoupling::DenseMatrix::__add__;
461 %newobject MEDCoupling::DenseMatrix::__sub__;
462 %newobject MEDCoupling::DenseMatrix::__mul__;
463 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
464 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
465 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
466 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
467 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
468 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
469 %newobject MEDCoupling::MEDCouplingSkyLineArray::groupPacks;
470 %newobject MEDCoupling::MEDCouplingSkyLineArray::uniqueNotSortedByPack;
472 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
473 %feature("unref") MEDCouplingMesh "$this->decrRef();"
474 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
475 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
476 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
477 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
478 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
479 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
480 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
481 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
482 %feature("unref") MEDCouplingField "$this->decrRef();"
483 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
484 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
485 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
486 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
487 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
488 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
489 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
490 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
491 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
492 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
493 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
494 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
495 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
496 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
497 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
498 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
499 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
500 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
501 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
502 %feature("unref") DenseMatrix "$this->decrRef();"
503 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
505 %rename(assign) *::operator=;
506 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
507 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
508 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
509 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
513 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
514 // on the Python side. Must be put BEFORE the %rename clause:
515 %exceptionclass INTERP_KERNEL::Exception;
516 %rename (InterpKernelException) INTERP_KERNEL::Exception;
518 %include "MEDCouplingRefCountObject.i"
519 %include "MEDCouplingMemArray.i"
523 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
524 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
525 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
526 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
527 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
528 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
529 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
530 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
531 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
537 PyObject *med2vtk_cell_types()
539 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
540 PyObject *ret(PyList_New(sz));
541 for(Py_ssize_t i=0;i<sz;i++)
543 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
544 PyList_SetItem(ret,i,PyInt_FromLong(elt));
549 PyObject *vtk2med_cell_types()
551 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
552 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
553 auto szOut(maxElt+1);
554 std::vector< mcIdType > retCpp(szOut,-1);
556 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
558 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
562 PyObject *ret(PyList_New(szOut));
564 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
565 PyList_SetItem(ret,id,PyInt_FromLong(*it));
569 PyObject *AllGeometricTypes()
571 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
572 PyObject *ret(PyList_New(sz));
573 for(Py_ssize_t i=0;i<sz;i++)
574 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
579 namespace INTERP_KERNEL
582 * \class BoxSplittingOptions
583 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
585 class BoxSplittingOptions
588 BoxSplittingOptions();
590 double getEfficiencyGoal() const;
591 void setEfficiencyGoal(double efficiency);
592 double getEfficiencyThreshold() const;
593 void setEfficiencyThreshold(double efficiencyThreshold);
594 int getMinimumPatchLength() const;
595 void setMinimumPatchLength(int minPatchLength);
596 int getMaximumPatchLength() const;
597 void setMaximumPatchLength(int maxPatchLength);
598 int getMaximumNbOfCellsInPatch() const;
599 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
600 void copyOptions(const BoxSplittingOptions & other);
601 std::string printOptions() const;
604 std::string __str__() const
606 return self->printOptions();
612 namespace MEDCoupling
628 CONST_ON_TIME_INTERVAL = 7
629 } TypeOfTimeDiscretization;
637 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
638 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
640 } MEDCouplingMeshType;
642 class DataArrayInt32;
643 class DataArrayInt64;
644 class DataArrayDouble;
645 class MEDCouplingUMesh;
646 class MEDCouplingCMesh;
647 class MEDCouplingFieldDouble;
649 %extend RefCountObject
651 std::string getHiddenCppPointer() const
653 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
658 %extend MEDCouplingGaussLocalization
660 std::string __str__() const
662 return self->getStringRepr();
665 std::string __repr__() const
667 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
668 oss << self->getStringRepr();
675 class MEDCouplingMesh : public RefCountObject, public TimeLabel
678 void setName(const std::string& name);
679 std::string getName() const;
680 void setDescription(const std::string& descr);
681 std::string getDescription() const;
682 void setTime(double val, int iteration, int order);
683 void setTimeUnit(const std::string& unit);
684 std::string getTimeUnit() const;
685 virtual MEDCouplingMeshType getType() const;
686 bool isStructured() const;
687 virtual MEDCouplingMesh *deepCopy() const;
688 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
689 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
690 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
691 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
692 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
693 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
694 virtual void checkConsistencyLight() const;
695 virtual void checkConsistency(double eps=1e-12) const;
696 virtual int getNumberOfCells() const;
697 virtual int getNumberOfNodes() const;
698 virtual int getSpaceDimension() const;
699 virtual int getMeshDimension() const;
700 virtual DataArrayDouble *getCoordinatesAndOwner() const;
701 virtual DataArrayDouble *computeCellCenterOfMass() const;
702 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
703 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
704 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
705 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
706 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
707 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
708 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
709 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
710 virtual std::string simpleRepr() const;
711 virtual std::string advancedRepr() const;
712 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
713 virtual std::string getVTKFileExtension() const;
714 std::string getVTKFileNameOf(const std::string& fileName) const;
716 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
717 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
718 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
719 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
720 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
721 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
722 virtual MEDCouplingUMesh *buildUnstructured() const;
723 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
724 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
725 virtual DataArrayIdType *simplexize(int policy);
726 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
727 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
728 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
729 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
730 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
731 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
732 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
733 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
736 std::string __str__() const
738 return self->simpleRepr();
744 double tmp0=self->getTime(tmp1,tmp2);
745 PyObject *res = PyList_New(3);
746 PyList_SetItem(res,0,SWIG_From_double(tmp0));
747 PyList_SetItem(res,1,SWIG_From_int(tmp1));
748 PyList_SetItem(res,2,SWIG_From_int(tmp2));
752 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
754 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
755 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
761 mcIdType getCellContainingPoint(PyObject *p, double eps) const
765 DataArrayDoubleTuple *aa;
766 std::vector<double> bb;
768 int spaceDim=self->getSpaceDimension();
769 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
770 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
771 return self->getCellContainingPoint(pos,eps);
774 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
778 DataArrayDoubleTuple *aa;
779 std::vector<double> bb;
781 int spaceDim=self->getSpaceDimension();
782 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
783 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
784 MCAuto<DataArrayIdType> elts,eltsIndex;
785 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
786 PyObject *ret=PyTuple_New(2);
787 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
788 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
792 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
796 DataArrayDoubleTuple *aa;
797 std::vector<double> bb;
799 int spaceDim=self->getSpaceDimension();
800 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
801 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
802 MCAuto<DataArrayIdType> elts,eltsIndex;
803 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
804 PyObject *ret=PyTuple_New(2);
805 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
806 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
810 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
812 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
813 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
816 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
818 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
819 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
822 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
826 DataArrayDoubleTuple *aa;
827 std::vector<double> bb;
829 int spaceDim=self->getSpaceDimension();
830 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
831 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
832 std::vector<mcIdType> elts;
833 self->getCellsContainingPoint(pos,eps,elts);
834 DataArrayIdType *ret=DataArrayIdType::New();
835 ret->alloc((int)elts.size(),1);
836 std::copy(elts.begin(),elts.end(),ret->getPointer());
837 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
840 virtual PyObject *getReverseNodalConnectivity() const
842 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
843 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
844 self->getReverseNodalConnectivity(d0,d1);
845 PyObject *ret=PyTuple_New(2);
846 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
847 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
851 void renumberCells(PyObject *li, bool check=true)
854 mcIdType v0; std::vector<mcIdType> v1;
855 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
856 self->renumberCells(ids,check);
859 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
861 DataArrayIdType *cellCor, *nodeCor;
862 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
863 PyObject *res = PyList_New(2);
864 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
865 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
869 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
871 DataArrayIdType *cellCor=0,*nodeCor=0;
872 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
873 PyObject *res = PyList_New(2);
874 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
875 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
879 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
881 DataArrayIdType *cellCor=0;
882 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
886 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
889 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
890 if (!SWIG_IsOK(res1))
893 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
894 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
898 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
900 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
901 da2->checkAllocated();
902 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
905 PyObject *getNodeIdsOfCell(int cellId) const
907 std::vector<mcIdType> conn;
908 self->getNodeIdsOfCell(cellId,conn);
909 return convertIntArrToPyList2(conn);
912 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
914 std::vector<double> coo;
915 self->getCoordinatesOfNode(nodeId,coo);
916 return convertDblArrToPyList2(coo);
919 void scale(PyObject *point, double factor)
923 DataArrayDoubleTuple *aa;
924 std::vector<double> bb;
926 int spaceDim=self->getSpaceDimension();
927 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
928 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
929 self->scale(pointPtr,factor);
932 PyObject *getBoundingBox() const
934 int spaceDim=self->getSpaceDimension();
935 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
936 self->getBoundingBox(tmp);
937 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
941 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
944 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
945 PyObject *ret=PyTuple_New(2);
946 PyObject *ret0Py=ret0?Py_True:Py_False;
948 PyTuple_SetItem(ret,0,ret0Py);
949 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
953 PyObject *buildPart(PyObject *li) const
955 mcIdType szArr,sw,iTypppArr;
956 std::vector<mcIdType> stdvecTyyppArr;
957 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
958 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
959 if(sw==3)//DataArrayIdType
961 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
962 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
963 std::string name=argpt->getName();
965 ret->setName(name.c_str());
967 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
970 PyObject *buildPartAndReduceNodes(PyObject *li) const
972 mcIdType szArr,sw,iTypppArr;
973 std::vector<mcIdType> stdvecTyyppArr;
974 DataArrayIdType *arr=0;
975 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
976 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
977 if(sw==3)//DataArrayIdType
979 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
980 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
981 std::string name=argpt->getName();
983 ret->setName(name.c_str());
986 PyObject *res = PyList_New(2);
987 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
988 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
989 PyList_SetItem(res,0,obj0);
990 PyList_SetItem(res,1,obj1);
994 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
997 DataArrayIdType *arr=0;
998 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
999 PyObject *res = PyTuple_New(2);
1000 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1003 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1005 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1006 PyTuple_SetItem(res,0,obj0);
1007 PyTuple_SetItem(res,1,obj1);
1011 PyObject *getDistributionOfTypes() const
1013 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1014 if(vals.size()%3!=0)
1015 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1016 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1017 for(std::size_t j=0;j<vals.size()/3;j++)
1019 PyObject *ret1=PyList_New(3);
1020 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1021 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1022 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1023 PyList_SetItem(ret,j,ret1);
1028 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1030 std::vector<mcIdType> code;
1031 std::vector<const DataArrayIdType *> idsPerType;
1032 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1033 convertPyToNewIntArr4(li,1,3,code);
1034 return self->checkTypeConsistencyAndContig(code,idsPerType);
1037 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1039 std::vector<mcIdType> code;
1040 std::vector<DataArrayIdType *> idsInPflPerType;
1041 std::vector<DataArrayIdType *> idsPerType;
1042 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1043 PyObject *ret=PyTuple_New(3);
1045 if(code.size()%3!=0)
1046 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1047 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1048 for(std::size_t j=0;j<code.size()/3;j++)
1050 PyObject *ret00=PyList_New(3);
1051 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1052 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1053 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1054 PyList_SetItem(ret0,j,ret00);
1056 PyTuple_SetItem(ret,0,ret0);
1058 PyObject *ret1=PyList_New(idsInPflPerType.size());
1059 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1060 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1061 PyTuple_SetItem(ret,1,ret1);
1062 std::size_t n=idsPerType.size();
1063 PyObject *ret2=PyList_New(n);
1064 for(std::size_t i=0;i<n;i++)
1065 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1066 PyTuple_SetItem(ret,2,ret2);
1070 void translate(PyObject *vector)
1074 DataArrayDoubleTuple *aa;
1075 std::vector<double> bb;
1077 int spaceDim=self->getSpaceDimension();
1078 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1079 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1080 self->translate(vectorPtr);
1083 void rotate(PyObject *center, double alpha)
1085 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1088 DataArrayDoubleTuple *aa;
1089 std::vector<double> bb;
1091 int spaceDim=self->getSpaceDimension();
1092 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1093 self->rotate(centerPtr,0,alpha);
1096 void rotate(PyObject *center, PyObject *vector, double alpha)
1098 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1100 DataArrayDouble *a,*a2;
1101 DataArrayDoubleTuple *aa,*aa2;
1102 std::vector<double> bb,bb2;
1104 int spaceDim=self->getSpaceDimension();
1105 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1106 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
1107 self->rotate(centerPtr,vectorPtr,alpha);
1110 PyObject *getAllGeoTypes() const
1112 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1113 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1114 PyObject *res=PyList_New(result.size());
1115 for(int i=0;iL!=result.end(); i++, iL++)
1116 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1120 virtual PyObject *getTinySerializationInformation() const
1122 std::vector<double> a0;
1123 std::vector<mcIdType> a1;
1124 std::vector<std::string> a2;
1125 self->getTinySerializationInformation(a0,a1,a2);
1126 PyObject *ret(PyTuple_New(3));
1127 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1128 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1129 std::size_t sz(a2.size());
1130 PyObject *ret2(PyList_New(sz));
1132 for(std::size_t i=0;i<sz;i++)
1133 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1135 PyTuple_SetItem(ret,2,ret2);
1139 virtual PyObject *serialize() const
1141 DataArrayIdType *a0Tmp(0);
1142 DataArrayDouble *a1Tmp(0);
1143 self->serialize(a0Tmp,a1Tmp);
1144 PyObject *ret(PyTuple_New(2));
1145 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1146 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1150 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1152 std::vector<std::string> littleStrings;
1153 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1156 PyObject *__getstate__() const
1158 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1159 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1160 PyObject *ret(PyTuple_New(2));
1161 PyTuple_SetItem(ret,0,ret0);
1162 PyTuple_SetItem(ret,1,ret1);
1166 void __setstate__(PyObject *inp)
1168 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1169 if(!PyTuple_Check(inp))
1170 throw INTERP_KERNEL::Exception(MSG);
1171 std::size_t sz(PyTuple_Size(inp));
1173 throw INTERP_KERNEL::Exception(MSG);
1174 PyObject *elt0(PyTuple_GetItem(inp,0));
1175 PyObject *elt1(PyTuple_GetItem(inp,1));
1176 std::vector<double> a0;
1177 std::vector<mcIdType> a1;
1178 std::vector<std::string> a2;
1179 DataArrayIdType *b0(0);
1180 DataArrayDouble *b1(0);
1182 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1183 throw INTERP_KERNEL::Exception(MSG);
1184 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1186 fillArrayWithPyListDbl3(a0py,tmp,a0);
1187 convertPyToNewIntArr3(a1py,a1);
1188 fillStringVector(a2py,a2);
1191 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1192 throw INTERP_KERNEL::Exception(MSG);
1193 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1195 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1196 if(!SWIG_IsOK(status))
1197 throw INTERP_KERNEL::Exception(MSG);
1198 b0=reinterpret_cast<DataArrayIdType *>(argp);
1199 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1200 if(!SWIG_IsOK(status))
1201 throw INTERP_KERNEL::Exception(MSG);
1202 b1=reinterpret_cast<DataArrayDouble *>(argp);
1204 // useless here to call resizeForUnserialization because arrays are well resized.
1205 self->unserialization(a0,a1,b0,b1,a2);
1208 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1210 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1211 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1212 return MEDCouplingMesh::MergeMeshes(tmp);
1218 //== MEDCouplingMesh End
1220 %include "NormalizedGeometricTypes"
1221 %include "MEDCouplingNatureOfFieldEnum"
1223 namespace MEDCoupling
1225 class MEDCouplingNatureOfField
1228 static const char *GetRepr(NatureOfField nat);
1229 static std::string GetReprNoThrow(NatureOfField nat);
1230 static std::string GetAllPossibilitiesStr();
1234 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1235 // include "MEDCouplingTimeDiscretization.i"
1237 namespace MEDCoupling
1239 class MEDCouplingGaussLocalization
1242 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1243 const std::vector<double>& gsCoo, const std::vector<double>& w);
1244 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1245 INTERP_KERNEL::NormalizedCellType getType() const;
1246 void setType(INTERP_KERNEL::NormalizedCellType typ);
1247 int getNumberOfGaussPt() const;
1248 int getDimension() const;
1249 int getNumberOfPtsInRefCell() const;
1250 std::string getStringRepr() const;
1251 void checkConsistencyLight() const;
1252 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1254 const std::vector<double>& getRefCoords() const;
1255 double getRefCoord(int ptIdInCell, int comp) const;
1256 const std::vector<double>& getGaussCoords() const;
1257 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1258 const std::vector<double>& getWeights() const;
1259 double getWeight(int gaussPtIdInCell, double newVal) const;
1260 void setRefCoord(int ptIdInCell, int comp, double newVal);
1261 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1262 void setWeight(int gaussPtIdInCell, double newVal);
1263 void setRefCoords(const std::vector<double>& refCoo);
1264 void setGaussCoords(const std::vector<double>& gsCoo);
1265 void setWeights(const std::vector<double>& w);
1267 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1271 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1273 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1277 MEDCouplingUMesh *buildRefCell() const
1279 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1285 class MEDCouplingSkyLineArray
1288 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1290 void set( DataArrayIdType* index, DataArrayIdType* value );
1291 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1293 int getSuperNumberOf() const;
1294 int getNumberOf() const;
1295 int getLength() const;
1297 void deletePack(const int i, const int j);
1299 void deleteSimplePack(const int i);
1300 void deleteSimplePacks(const DataArrayIdType* idx);
1302 MEDCouplingSkyLineArray *groupPacks(const DataArrayIdType *indexedPacks) const;
1303 MEDCouplingSkyLineArray *uniqueNotSortedByPack() const;
1307 MEDCouplingSkyLineArray()
1309 return MEDCouplingSkyLineArray::New();
1312 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1314 return MEDCouplingSkyLineArray::New(index, value);
1317 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1319 return MEDCouplingSkyLineArray::New(index, value);
1322 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1324 return MEDCouplingSkyLineArray::New(other);
1327 std::string __str__() const
1329 return self->simpleRepr();
1332 DataArrayIdType *getSuperIndexArray() const
1334 DataArrayIdType *ret(self->getSuperIndexArray());
1340 DataArrayIdType *getIndexArray() const
1342 DataArrayIdType *ret(self->getIndexArray());
1348 DataArrayIdType *getValuesArray() const
1350 DataArrayIdType *ret(self->getValuesArray());
1356 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1358 std::vector<mcIdType> ret;
1359 self->getSimplePackSafe(absolutePackId,ret);
1360 return convertIntArrToPyList2(ret);
1363 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1365 std::vector<mcIdType> vpack, vspIdx, out;
1367 convertPyToNewIntArr3(superPackIndices,vspIdx);
1368 convertPyToNewIntArr3(pack,vpack);
1370 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1371 return convertIntArrToPyList2(out);
1374 void pushBackPack(const mcIdType i, PyObject *pack)
1376 std::vector<mcIdType> vpack;
1377 convertPyToNewIntArr3(pack,vpack);
1378 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1381 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1383 std::vector<mcIdType> vpack;
1384 convertPyToNewIntArr3(pack,vpack);
1385 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1388 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1390 std::vector<const DataArrayIdType*> packs;
1391 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1392 self->replaceSimplePacks(idx, packs);
1395 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1397 std::vector<mcIdType> vpack;
1398 convertPyToNewIntArr3(pack,vpack);
1399 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1402 PyObject *convertToPolyhedronConn() const
1404 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1405 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1406 self->convertToPolyhedronConn(d0,d1);
1407 PyObject *ret=PyTuple_New(2);
1408 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1409 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1416 %include "MEDCouplingFieldDiscretization.i"
1418 //== MEDCouplingPointSet
1420 namespace MEDCoupling
1422 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1425 void setCoords(const DataArrayDouble *coords);
1426 DataArrayDouble *getCoordinatesAndOwner() const;
1427 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1429 double getCaracteristicDimension() const;
1430 void recenterForMaxPrecision(double eps);
1431 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1432 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1433 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1434 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1435 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1436 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1437 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1438 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1439 virtual DataArrayIdType *computeFetchedNodeIds() const;
1440 virtual int getNumberOfNodesInCell(int cellId) const;
1441 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1442 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1443 virtual DataArrayIdType *zipCoordsTraducer();
1444 virtual DataArrayIdType *findBoundaryNodes() const;
1445 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1446 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1447 virtual void checkFullyDefined() const;
1448 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1449 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1450 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1451 virtual void renumberNodesWithOffsetInConn(int offset);
1452 virtual bool areAllNodesFetched() const;
1453 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1454 virtual void invertOrientationOfAllCells();
1457 std::string __str__() const
1459 return self->simpleRepr();
1462 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1464 mcIdType newNbOfNodes;
1465 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1466 PyObject *res = PyList_New(2);
1467 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1468 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1472 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1474 DataArrayIdType *comm, *commIndex;
1475 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1476 PyObject *res = PyList_New(2);
1477 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1478 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1482 PyObject *getCoords()
1484 DataArrayDouble *ret1=self->getCoords();
1487 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1490 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1492 mcIdType szArr,sw,iTypppArr;
1493 std::vector<mcIdType> stdvecTyyppArr;
1494 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1495 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1496 if(sw==3)//DataArrayIdType
1498 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1499 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1500 std::string name=argpt->getName();
1502 ret->setName(name.c_str());
1504 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1507 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1509 mcIdType szArr,sw,iTypppArr;
1510 std::vector<mcIdType> stdvecTyyppArr;
1511 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1512 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1513 if(sw==3)//DataArrayIdType
1515 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1516 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1517 std::string name=argpt->getName();
1519 ret->setName(name.c_str());
1521 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1524 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1526 mcIdType szArr,sw,iTypppArr;
1527 std::vector<mcIdType> stdvecTyyppArr;
1528 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1529 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1530 if(sw==3)//DataArrayIdType
1532 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1533 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1534 std::string name=argpt->getName();
1536 ret->setName(name.c_str());
1538 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1541 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1543 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1544 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1547 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1549 mcIdType szArr,sw,iTypppArr;
1550 std::vector<mcIdType> stdvecTyyppArr;
1551 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1552 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1553 if(sw==3)//DataArrayIdType
1555 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1556 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1557 std::string name=argpt->getName();
1559 ret->setName(name.c_str());
1561 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1564 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1566 mcIdType szArr,sw,iTypppArr;
1567 std::vector<mcIdType> stdvecTyyppArr;
1568 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1569 self->renumberNodes(tmp,newNbOfNodes);
1572 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1574 mcIdType szArr,sw,iTypppArr;
1575 std::vector<mcIdType> stdvecTyyppArr;
1576 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1577 self->renumberNodesCenter(tmp,newNbOfNodes);
1580 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1582 int spaceDim=self->getSpaceDimension();
1584 DataArrayDouble *a,*a2;
1585 DataArrayDoubleTuple *aa,*aa2;
1586 std::vector<double> bb,bb2;
1588 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1589 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1590 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1591 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1592 std::vector<mcIdType> nodes;
1593 self->findNodesOnLine(p,v,eps,nodes);
1594 DataArrayIdType *ret=DataArrayIdType::New();
1595 ret->alloc(nodes.size(),1);
1596 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1599 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1601 int spaceDim=self->getSpaceDimension();
1603 DataArrayDouble *a,*a2;
1604 DataArrayDoubleTuple *aa,*aa2;
1605 std::vector<double> bb,bb2;
1607 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1608 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1609 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1610 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1611 std::vector<mcIdType> nodes;
1612 self->findNodesOnPlane(p,v,eps,nodes);
1613 DataArrayIdType *ret=DataArrayIdType::New();
1614 ret->alloc(nodes.size(),1);
1615 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1616 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1619 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1623 DataArrayDoubleTuple *aa;
1624 std::vector<double> bb;
1626 int spaceDim=self->getSpaceDimension();
1627 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1628 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1629 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1630 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1633 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1635 DataArrayIdType *c=0,*cI=0;
1639 DataArrayDoubleTuple *aa;
1640 std::vector<double> bb;
1642 int spaceDim=self->getSpaceDimension();
1643 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1644 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1645 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1646 PyObject *ret=PyTuple_New(2);
1647 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1648 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1652 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1654 DataArrayIdType *c=0,*cI=0;
1655 int spaceDim=self->getSpaceDimension();
1658 DataArrayDoubleTuple *aa;
1659 std::vector<double> bb;
1661 mcIdType nbOfTuples=-1;
1662 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1663 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1665 PyObject *ret=PyTuple_New(2);
1666 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1667 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1671 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1675 DataArrayDoubleTuple *aa;
1676 std::vector<double> bb;
1678 int spaceDim=self->getSpaceDimension();
1679 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1680 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1682 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1683 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1686 void duplicateNodesInCoords(PyObject *li)
1690 std::vector<mcIdType> multiVal;
1691 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1692 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1693 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1697 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1699 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1701 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1703 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1707 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1709 DataArrayIdType *v0(nullptr),*v1(nullptr);
1710 self->findCommonCells(compType,startCellId,v0,v1);
1711 PyObject *res = PyList_New(2);
1712 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1713 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1718 virtual void renumberNodesInConn(PyObject *li)
1722 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1725 MapII *da2(reinterpret_cast<MapII *>(da));
1726 self->renumberNodesInConn(da2->data());
1730 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1731 if (!SWIG_IsOK(res1))
1734 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1735 self->renumberNodesInConn(tmp);
1739 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1741 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1742 da2->checkAllocated();
1743 self->renumberNodesInConn(da2->getConstPointer());
1747 virtual PyObject *getNodeIdsInUse() const
1750 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1751 PyObject *ret=PyTuple_New(2);
1752 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1753 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1757 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1759 DataArrayIdType *ret(nullptr);
1761 mcIdType szArr,sw,iTypppArr;
1762 std::vector<mcIdType> stdvecTyyppArr;
1763 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1764 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1768 virtual PyObject *mergeNodes(double precision)
1772 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1773 PyObject *res = PyList_New(3);
1774 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1775 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1776 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1780 virtual PyObject *mergeNodesCenter(double precision)
1784 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1785 PyObject *res = PyList_New(3);
1786 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1787 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1788 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1792 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1795 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1796 if (!SWIG_IsOK(res1))
1799 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1800 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1804 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1806 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1807 da2->checkAllocated();
1808 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1812 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1816 std::vector<mcIdType> multiVal;
1817 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1818 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1819 mcIdType nbc=self->getNumberOfCells();
1820 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1827 std::ostringstream oss;
1828 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1829 throw INTERP_KERNEL::Exception(oss.str().c_str());
1832 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1837 mcIdType tmp=nbc+singleVal;
1838 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1842 std::ostringstream oss;
1843 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1844 throw INTERP_KERNEL::Exception(oss.str().c_str());
1850 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1854 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1859 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1860 daIntTyypp->checkAllocated();
1861 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1864 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1868 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1871 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1872 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1873 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1874 for(mcIdType i=0;i<sz;i++)
1875 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1878 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1881 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1882 mcIdType sw,nbNodes=0;
1883 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1884 std::vector<double> val3;
1885 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1886 "Rotate2DAlg",2,true,nbNodes);
1888 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1889 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1892 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1895 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1896 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1897 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1898 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1899 for(mcIdType i=0;i<sz;i++)
1900 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1903 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1906 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1907 mcIdType sw,nbNodes=0;
1908 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1909 std::vector<double> val3;
1910 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1911 "Rotate3DAlg",3,true,nbNodes);
1913 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1914 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1915 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1920 //== MEDCouplingPointSet End
1922 class MEDCouplingUMeshCell
1925 INTERP_KERNEL::NormalizedCellType getType() const;
1928 std::string __str__() const
1930 return self->repr();
1933 PyObject *getAllConn() const
1936 const mcIdType *r=self->getAllConn(ret2);
1937 PyObject *ret=PyTuple_New(ret2);
1938 for(mcIdType i=0;i<ret2;i++)
1939 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1945 class MEDCouplingUMeshCellIterator
1952 MEDCouplingUMeshCell *ret=self->nextt();
1954 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1957 PyErr_SetString(PyExc_StopIteration,"No more data.");
1964 class MEDCouplingUMeshCellByTypeIterator
1967 ~MEDCouplingUMeshCellByTypeIterator();
1972 MEDCouplingUMeshCellEntry *ret=self->nextt();
1974 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1977 PyErr_SetString(PyExc_StopIteration,"No more data.");
1984 class MEDCouplingUMeshCellByTypeEntry
1987 ~MEDCouplingUMeshCellByTypeEntry();
1990 MEDCouplingUMeshCellByTypeIterator *__iter__()
1992 return self->iterator();
1997 class MEDCouplingUMeshCellEntry
2000 INTERP_KERNEL::NormalizedCellType getType() const;
2001 int getNumberOfElems() const;
2004 MEDCouplingUMeshCellIterator *__iter__()
2006 return self->iterator();
2011 //== MEDCouplingUMesh
2013 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2016 static MEDCouplingUMesh *New();
2017 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2018 void checkConsistencyLight() const;
2019 void setMeshDimension(int meshDim);
2020 void allocateCells(int nbOfCells=0);
2021 void finishInsertingCells();
2022 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2023 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2024 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2025 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2026 int getNodalConnectivityArrayLen() const;
2027 void computeTypes();
2028 std::string reprConnectivityOfThis() const;
2029 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2031 DataArrayIdType *conformize2D(double eps);
2032 DataArrayIdType *conformize3D(double eps);
2033 DataArrayIdType *colinearize2D(double eps);
2034 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2035 void shiftNodeNumbersInConn(int delta);
2036 std::vector<bool> getQuadraticStatus() const;
2037 DataArrayIdType *findCellIdsOnBoundary() const;
2038 MEDCouplingUMesh *computeSkin() const;
2039 bool checkConsecutiveCellTypes() const;
2040 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2041 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2042 DataArrayIdType *sortCellsInMEDFileFrmt();
2043 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2044 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2045 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2046 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2047 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2048 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2049 void orientCorrectlyPolyhedrons();
2050 bool isPresenceOfQuadratic() const;
2051 bool isFullyQuadratic() const;
2052 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2053 bool isContiguous1D() const;
2054 void tessellate2D(double eps);
2055 void convertQuadraticCellsToLinear();
2056 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2057 void convertDegeneratedCells();
2058 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2059 bool removeDegenerated1DCells();
2060 bool areOnlySimplexCells() const;
2061 MEDCouplingFieldDouble *getEdgeRatioField() const;
2062 MEDCouplingFieldDouble *getAspectRatioField() const;
2063 MEDCouplingFieldDouble *getWarpField() const;
2064 MEDCouplingFieldDouble *getSkewField() const;
2065 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2066 DataArrayIdType *convexEnvelop2D();
2067 std::string cppRepr() const;
2068 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2069 DataArrayIdType *findAndCorrectBadOriented3DCells();
2070 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2071 MEDCouplingSkyLineArray *generateGraph() const;
2072 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2073 DataArrayIdType *buildUnionOf2DMesh() const;
2074 DataArrayIdType *buildUnionOf3DMesh() const;
2075 DataArrayIdType *orderConsecutiveCells1D() const;
2076 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2077 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2078 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2079 void changeOrientationOfCells();
2080 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2081 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2082 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2083 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2084 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2085 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2086 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2090 return MEDCouplingUMesh::New();
2093 MEDCouplingUMesh(const char *meshName, int meshDim)
2095 return MEDCouplingUMesh::New(meshName,meshDim);
2098 std::string __str__() const
2100 return self->simpleRepr();
2103 std::string __repr__() const
2105 std::ostringstream oss;
2106 self->reprQuickOverview(oss);
2110 MEDCouplingUMeshCellIterator *__iter__()
2112 return self->cellIterator();
2115 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2117 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2121 PyObject *getAllGeoTypesSorted() const
2123 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2124 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2125 PyObject *res=PyList_New(result.size());
2126 for(int i=0;iL!=result.end(); i++, iL++)
2127 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2131 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2135 std::vector<mcIdType> multiVal;
2136 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2137 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2138 mcIdType nbc=self->getNumberOfCells();
2139 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2146 std::ostringstream oss;
2147 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2148 throw INTERP_KERNEL::Exception(oss.str().c_str());
2152 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2159 mcIdType tmp=nbc+singleVal;
2160 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2165 std::ostringstream oss;
2166 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2167 throw INTERP_KERNEL::Exception(oss.str().c_str());
2173 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2179 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2180 daIntTyypp->checkAllocated();
2181 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2185 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2189 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2193 std::vector<mcIdType> multiVal;
2194 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2195 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2196 mcIdType nbc=self->getNumberOfCells();
2197 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2204 std::ostringstream oss;
2205 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2206 throw INTERP_KERNEL::Exception(oss.str().c_str());
2210 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2217 mcIdType tmp=nbc+singleVal;
2218 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2223 std::ostringstream oss;
2224 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2225 throw INTERP_KERNEL::Exception(oss.str().c_str());
2231 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2236 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2242 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2243 daIntTyypp->checkAllocated();
2244 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2248 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2252 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2254 mcIdType szArr,sw,iTypppArr;
2255 std::vector<mcIdType> stdvecTyyppArr;
2256 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2259 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2260 throw INTERP_KERNEL::Exception(oss.str().c_str());
2262 self->insertNextCell(type,size,tmp);
2265 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2267 mcIdType szArr,sw,iTypppArr;
2268 std::vector<mcIdType> stdvecTyyppArr;
2269 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2270 self->insertNextCell(type,szArr,tmp);
2273 DataArrayIdType *getNodalConnectivity()
2275 DataArrayIdType *ret=self->getNodalConnectivity();
2280 DataArrayIdType *getNodalConnectivityIndex()
2282 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2288 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2290 mcIdType szArr,sw,iTypppArr;
2291 std::vector<mcIdType> stdvecTyyppArr;
2292 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2293 mcIdType nbOfDepthPeelingPerformed=0;
2294 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2295 PyObject *res=PyTuple_New(2);
2296 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2297 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2301 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2303 DataArrayIdType *v0=0,*v1=0;
2304 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2305 PyObject *res = PyList_New(2);
2306 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2307 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2311 PyObject *distanceToPoint(PyObject *point) const
2315 DataArrayDoubleTuple *aa;
2316 std::vector<double> bb;
2318 int nbOfCompo=self->getSpaceDimension();
2319 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2322 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2323 PyObject *ret=PyTuple_New(2);
2324 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2325 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2329 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2331 DataArrayIdType *ret1=0;
2332 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2333 PyObject *ret=PyTuple_New(2);
2334 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2335 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2339 PyObject *tetrahedrize(int policy)
2342 DataArrayIdType *ret1(0);
2343 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2344 PyObject *ret=PyTuple_New(3);
2345 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2347 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2351 PyObject *checkButterflyCells(double eps=1e-12)
2353 std::vector<mcIdType> cells;
2354 self->checkButterflyCells(cells,eps);
2355 DataArrayIdType *ret=DataArrayIdType::New();
2356 ret->alloc(cells.size(),1);
2357 std::copy(cells.begin(),cells.end(),ret->getPointer());
2358 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2361 PyObject *splitByType() const
2363 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2364 std::size_t sz=ms.size();
2365 PyObject *ret = PyList_New(sz);
2366 for(std::size_t i=0;i<sz;i++)
2367 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2371 PyObject *partitionBySpreadZone() const
2373 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2374 std::size_t sz=retCpp.size();
2375 PyObject *ret=PyList_New(sz);
2376 for(std::size_t i=0;i<sz;i++)
2377 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2381 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2383 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2384 std::size_t sz=retCpp.size();
2385 PyObject *ret=PyList_New(sz);
2386 for(std::size_t i=0;i<sz;i++)
2387 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2391 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2394 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2395 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2396 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2399 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2402 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2403 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2407 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2410 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2411 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2415 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2417 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2418 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2419 PyObject *ret=PyTuple_New(3);
2420 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2421 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2422 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2426 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2428 DataArrayIdType *tmp0=0,*tmp1=0;
2429 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2430 PyObject *ret=PyTuple_New(2);
2431 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2432 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2436 void duplicateNodes(PyObject *li)
2440 std::vector<mcIdType> multiVal;
2441 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2442 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2443 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2447 return self->duplicateNodes(&singleVal,&singleVal+1);
2449 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2451 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2453 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2457 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2461 std::vector<mcIdType> multiVal;
2462 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2463 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2464 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2468 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2470 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2472 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2474 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2478 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2480 mcIdType szArr,sw,iTypppArr;
2481 std::vector<mcIdType> stdvecTyyppArr;
2482 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2483 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2486 PyObject *getLevArrPerCellTypes(PyObject *li) const
2489 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2490 DataArrayIdType *tmp0,*tmp1=0;
2491 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2492 PyObject *ret=PyTuple_New(2);
2493 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2494 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2498 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2500 DataArrayIdType *ret0=0,*ret1=0;
2501 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2502 PyObject *ret=PyTuple_New(2);
2503 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2504 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2508 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2510 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2511 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2512 DataArrayIdType *ret1=0,*ret2=0;
2513 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2514 PyObject *ret=PyTuple_New(3);
2515 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2516 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2517 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2521 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2523 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2524 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2525 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2526 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2529 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2532 std::vector<const MEDCouplingUMesh *> meshes;
2533 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2534 std::vector<DataArrayIdType *> corr;
2535 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2537 PyObject *ret1=PyList_New(sz);
2538 for(std::size_t i=0;i<sz;i++)
2539 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2540 PyObject *ret=PyList_New(2);
2541 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2542 PyList_SetItem(ret,1,ret1);
2546 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2548 std::vector<MEDCouplingUMesh *> meshes;
2549 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2550 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2553 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2555 std::vector<MEDCouplingUMesh *> meshes;
2556 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2557 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2560 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2564 DataArrayDoubleTuple *aa;
2565 std::vector<double> bb;
2567 int spaceDim=self->getSpaceDimension();
2568 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2569 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2571 std::vector<mcIdType> cells;
2572 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2573 DataArrayIdType *ret=DataArrayIdType::New();
2574 ret->alloc(cells.size(),1);
2575 std::copy(cells.begin(),cells.end(),ret->getPointer());
2576 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2579 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2583 DataArrayDoubleTuple *aa;
2584 std::vector<double> bb;
2586 int spaceDim=self->getSpaceDimension();
2587 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2588 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2589 self->orientCorrectly2DCells(v,polyOnly);
2592 PyObject *arePolyhedronsNotCorrectlyOriented() const
2594 std::vector<mcIdType> cells;
2595 self->arePolyhedronsNotCorrectlyOriented(cells);
2596 DataArrayIdType *ret=DataArrayIdType::New();
2597 ret->alloc(cells.size(),1);
2598 std::copy(cells.begin(),cells.end(),ret->getPointer());
2599 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2602 PyObject *getFastAveragePlaneOfThis() const
2606 self->getFastAveragePlaneOfThis(vec,pos);
2608 std::copy(vec,vec+3,vals);
2609 std::copy(pos,pos+3,vals+3);
2610 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2613 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2615 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2616 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2617 return MEDCouplingUMesh::MergeUMeshes(tmp);
2620 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2622 DataArrayIdType *ret1;
2623 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2624 PyObject *ret=PyTuple_New(2);
2625 PyObject *ret0Py=ret0?Py_True:Py_False;
2627 PyTuple_SetItem(ret,0,ret0Py);
2628 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2632 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2634 DataArrayIdType *ret1;
2635 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2636 PyObject *ret=PyTuple_New(2);
2637 PyObject *ret0Py=ret0?Py_True:Py_False;
2639 PyTuple_SetItem(ret,0,ret0Py);
2640 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2644 PyObject *explode3DMeshTo1D() const
2646 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2647 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2648 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2649 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2650 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2651 PyObject *ret=PyTuple_New(5);
2652 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2653 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2654 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2655 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2656 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2660 PyObject *explodeIntoEdges() const
2662 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2663 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2664 PyObject *ret=PyTuple_New(5);
2665 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2666 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2667 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2668 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2669 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2673 PyObject *explodeMeshIntoMicroEdges() const
2675 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2676 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2677 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2678 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2679 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2680 PyObject *ret=PyTuple_New(5);
2681 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2682 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2683 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2684 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2685 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2689 PyObject *buildDescendingConnectivity() const
2691 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2692 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2693 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2694 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2695 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2696 PyObject *ret=PyTuple_New(5);
2697 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2698 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2699 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2700 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2701 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2705 PyObject *buildDescendingConnectivity2() const
2707 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2708 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2709 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2710 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2711 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2712 PyObject *ret=PyTuple_New(5);
2713 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2714 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2715 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2716 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2717 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2721 PyObject *computeNeighborsOfCells() const
2723 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2724 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2725 PyObject *ret=PyTuple_New(2);
2726 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2727 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2731 PyObject *computeNeighborsOfNodes() const
2733 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2734 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2735 PyObject *ret=PyTuple_New(2);
2736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2741 PyObject *computeEnlargedNeighborsOfNodes() const
2743 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2744 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2745 PyObject *ret=PyTuple_New(2);
2746 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2747 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2751 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2753 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2754 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2755 PyObject *ret=PyTuple_New(2);
2756 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2757 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2763 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2764 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,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 *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2773 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2774 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2775 DataArrayIdType *d2,*d3,*d4,*dd5;
2776 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2777 PyObject *ret=PyTuple_New(7);
2778 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2779 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2780 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2781 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2782 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2783 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2784 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2788 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2791 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2792 da->checkAllocated();
2793 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2796 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2799 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2800 da->checkAllocated();
2801 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2804 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2807 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2808 da->checkAllocated();
2809 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2812 PyObject *getTypesOfPart(DataArrayIdType *da) const
2815 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2816 da->checkAllocated();
2817 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2818 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2819 PyObject *res = PyList_New(result.size());
2820 for (int i=0;iL!=result.end(); i++, iL++)
2821 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2825 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2828 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2829 da->checkAllocated();
2830 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2831 ret->setName(da->getName().c_str());
2835 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2837 DataArrayIdType *cellNb1=0,*cellNb2=0;
2838 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2839 PyObject *ret=PyTuple_New(3);
2840 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2841 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2842 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2846 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2848 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2849 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2850 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2851 PyObject *ret(PyTuple_New(4));
2852 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2853 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2854 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2855 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2859 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2861 int spaceDim=self->getSpaceDimension();
2863 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2865 DataArrayDouble *a,*a2;
2866 DataArrayDoubleTuple *aa,*aa2;
2867 std::vector<double> bb,bb2;
2869 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2870 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2871 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2872 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2874 DataArrayIdType *cellIds=0;
2875 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2876 PyObject *ret=PyTuple_New(2);
2877 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2878 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2882 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2884 int spaceDim=self->getSpaceDimension();
2886 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2888 DataArrayDouble *a,*a2;
2889 DataArrayDoubleTuple *aa,*aa2;
2890 std::vector<double> bb,bb2;
2892 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2893 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2894 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2895 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2897 DataArrayIdType *cellIds=0;
2898 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2899 PyObject *ret=PyTuple_New(2);
2900 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2901 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2905 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2908 DataArrayDouble *a,*a2;
2909 DataArrayDoubleTuple *aa,*aa2;
2910 std::vector<double> bb,bb2;
2912 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2913 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2914 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2915 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2916 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2920 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2922 int spaceDim=self->getSpaceDimension();
2924 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2926 DataArrayDouble *a,*a2;
2927 DataArrayDoubleTuple *aa,*aa2;
2928 std::vector<double> bb,bb2;
2930 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2931 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2932 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2933 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2934 return self->getCellIdsCrossingPlane(orig,vect,eps);
2937 void convertToPolyTypes(PyObject *li)
2941 std::vector<mcIdType> pos2;
2942 DataArrayIdType *pos3=0;
2943 DataArrayIdTypeTuple *pos4=0;
2944 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2949 self->convertToPolyTypes(&pos1,&pos1+1);
2956 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2961 self->convertToPolyTypes(pos3->begin(),pos3->end());
2965 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2969 void convertAllToPoly();
2970 void convertExtrudedPolyhedra();
2972 void simplifyPolyhedra(double eps);
2973 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2974 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2977 //== MEDCouplingUMesh End
2979 //== MEDCouplingMappedExtrudedMesh
2981 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2984 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2985 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2986 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2987 int get2DCellIdForExtrusion() const;
2989 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
2991 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2994 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2996 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2999 MEDCouplingMappedExtrudedMesh()
3001 return MEDCouplingMappedExtrudedMesh::New();
3004 std::string __str__() const
3006 return self->simpleRepr();
3009 std::string __repr__() const
3011 std::ostringstream oss;
3012 self->reprQuickOverview(oss);
3016 PyObject *getMesh2D() const
3018 MEDCouplingUMesh *ret=self->getMesh2D();
3021 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3023 PyObject *getMesh1D() const
3025 MEDCouplingUMesh *ret=self->getMesh1D();
3028 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3030 PyObject *getMesh3DIds() const
3032 DataArrayIdType *ret=self->getMesh3DIds();
3035 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3040 //== MEDCouplingMappedExtrudedMesh End
3042 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3045 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3046 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3047 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3048 int getNodalConnectivityLength() const;
3049 virtual void allocateCells(int nbOfCells=0);
3050 virtual void checkConsistencyOfConnectivity() const;
3053 virtual void insertNextCell(PyObject *li)
3055 mcIdType szArr,sw,iTypppArr;
3056 std::vector<mcIdType> stdvecTyyppArr;
3057 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3058 self->insertNextCell(tmp,tmp+szArr);
3061 virtual DataArrayIdType *getNodalConnectivity() const
3063 DataArrayIdType *ret=self->getNodalConnectivity();
3064 if(ret) ret->incrRef();
3068 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3070 std::vector< const MEDCoupling1GTUMesh *> parts;
3071 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3072 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3077 //== MEDCoupling1SGTUMesh
3079 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3082 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3083 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3084 void setNodalConnectivity(DataArrayIdType *nodalConn);
3085 int getNumberOfNodesPerCell() const;
3086 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3087 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3088 MEDCoupling1GTUMesh *computeDualMesh() const;
3089 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3090 DataArrayIdType *sortHexa8EachOther();
3093 MEDCoupling1SGTUMesh()
3095 return MEDCoupling1SGTUMesh::New();
3098 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3100 return MEDCoupling1SGTUMesh::New(name,type);
3103 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3105 return MEDCoupling1SGTUMesh::New(m);
3108 std::string __str__() const
3110 return self->simpleRepr();
3113 std::string __repr__() const
3115 std::ostringstream oss;
3116 self->reprQuickOverview(oss);
3120 PyObject *structurizeMe(double eps=1e-12) const
3122 DataArrayIdType *cellPerm(0),*nodePerm(0);
3123 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3124 PyObject *ret(PyTuple_New(3));
3125 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3126 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3127 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3131 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3133 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3134 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3135 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3138 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3140 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3141 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3142 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3147 //== MEDCoupling1SGTUMesh End
3149 //== MEDCoupling1DGTUMesh
3151 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3154 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3155 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3156 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3157 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3158 bool isPacked() const;
3161 MEDCoupling1DGTUMesh()
3163 return MEDCoupling1DGTUMesh::New();
3165 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3167 return MEDCoupling1DGTUMesh::New(name,type);
3170 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3172 return MEDCoupling1DGTUMesh::New(m);
3175 std::string __str__() const
3177 return self->simpleRepr();
3180 std::string __repr__() const
3182 std::ostringstream oss;
3183 self->reprQuickOverview(oss);
3187 DataArrayIdType *getNodalConnectivityIndex() const
3189 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3190 if(ret) ret->incrRef();
3194 PyObject *retrievePackedNodalConnectivity() const
3196 DataArrayIdType *ret1=0,*ret2=0;
3197 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3198 PyObject *ret0Py=ret0?Py_True:Py_False;
3200 PyObject *ret=PyTuple_New(3);
3201 PyTuple_SetItem(ret,0,ret0Py);
3202 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3203 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3207 PyObject *copyWithNodalConnectivityPacked() const
3210 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3211 PyObject *ret=PyTuple_New(2);
3212 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3213 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3214 PyTuple_SetItem(ret,1,ret1Py);
3218 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3220 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3221 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3222 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3225 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3227 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3228 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3229 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3232 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3234 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3235 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3236 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3241 //== MEDCoupling1DGTUMeshEnd
3243 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3246 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3247 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3248 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3249 int getSpaceDimensionOnNodeStruct() const;
3250 double computeSquareness() const;
3251 virtual std::vector<mcIdType> getNodeGridStructure() const;
3252 std::vector<mcIdType> getCellGridStructure() const;
3253 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3254 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3255 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3256 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3257 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3258 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3259 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3260 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3263 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3265 mcIdType tmpp1=-1,tmpp2=-1;
3266 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3267 std::vector< std::pair<mcIdType,mcIdType> > inp;
3271 for(mcIdType i=0;i<tmpp1;i++)
3272 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3277 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3278 inp.resize(tmpp1/2);
3279 for(mcIdType i=0;i<tmpp1/2;i++)
3280 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3283 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3284 return self->buildStructuredSubPart(inp);
3287 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3289 std::vector< std::pair<mcIdType,mcIdType> > inp;
3290 convertPyToVectorPairInt(part,inp);
3292 mcIdType szArr,sw,iTypppArr;
3293 std::vector<mcIdType> stdvecTyyppArr;
3294 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3295 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3297 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3300 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3302 std::vector< std::pair<mcIdType,mcIdType> > inp;
3303 convertPyToVectorPairInt(part,inp);
3304 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3307 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3309 std::vector< std::pair<mcIdType,mcIdType> > inp;
3310 convertPyToVectorPairInt(part,inp);
3311 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3314 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3316 std::vector< std::pair<mcIdType,mcIdType> > inp;
3317 convertPyToVectorPairInt(part,inp);
3318 std::vector<mcIdType> stWithGhost;
3319 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3320 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3321 PyObject *ret(PyTuple_New(2));
3322 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3323 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3327 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3329 std::vector< std::pair<mcIdType,mcIdType> > inp;
3330 convertPyToVectorPairInt(partCompactFormat,inp);
3331 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3334 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3336 std::vector< std::pair<mcIdType,mcIdType> > inp;
3337 convertPyToVectorPairInt(partCompactFormat,inp);
3338 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3341 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3343 std::vector< std::pair<mcIdType,mcIdType> > inp;
3344 convertPyToVectorPairInt(part,inp);
3345 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3348 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3350 mcIdType szArr,sw,iTypppArr;
3351 std::vector<mcIdType> stdvecTyyppArr;
3352 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3353 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3356 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3358 mcIdType szArr,sw,iTypppArr;
3359 std::vector<mcIdType> stdvecTyyppArr;
3360 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3361 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3364 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3366 std::vector< std::pair<mcIdType,mcIdType> > inp;
3367 convertPyToVectorPairInt(partCompactFormat,inp);
3368 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3371 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3373 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3374 PyObject *retPy=PyList_New(ret.size());
3375 for(std::size_t i=0;i<ret.size();i++)
3377 PyObject *tmp=PyTuple_New(2);
3378 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3379 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3380 PyList_SetItem(retPy,i,tmp);
3385 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3387 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3388 convertPyToVectorPairInt(r1,r1Cpp);
3389 convertPyToVectorPairInt(r2,r2Cpp);
3390 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3391 PyObject *retPy=PyList_New(ret.size());
3392 for(std::size_t i=0;i<ret.size();i++)
3394 PyObject *tmp=PyTuple_New(2);
3395 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3396 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3397 PyList_SetItem(retPy,i,tmp);
3402 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3404 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3405 convertPyToVectorPairInt(r1,r1Cpp);
3406 convertPyToVectorPairInt(r2,r2Cpp);
3407 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3410 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3412 mcIdType szArr,sw,iTypppArr;
3413 std::vector<mcIdType> stdvecTyyppArr;
3414 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3415 mcIdType szArr2,sw2,iTypppArr2;
3416 std::vector<mcIdType> stdvecTyyppArr2;
3417 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3418 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3419 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3420 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3421 PyObject *ret=PyTuple_New(2);
3422 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3423 PyTuple_SetItem(ret,0,ret0Py);
3424 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3425 for(std::size_t i=0;i<partCompactFormat.size();i++)
3427 PyObject *tmp4=PyTuple_New(2);
3428 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3429 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3430 PyList_SetItem(ret1Py,i,tmp4);
3432 PyTuple_SetItem(ret,1,ret1Py);
3436 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3438 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3439 convertPyToVectorPairInt(bigInAbs,param0);
3440 convertPyToVectorPairInt(partOfBigInAbs,param1);
3441 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3442 PyObject *retPy(PyList_New(ret.size()));
3443 for(std::size_t i=0;i<ret.size();i++)
3445 PyObject *tmp(PyTuple_New(2));
3446 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3447 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3448 PyList_SetItem(retPy,i,tmp);
3453 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3455 std::vector< std::pair<mcIdType,mcIdType> > param0;
3456 convertPyToVectorPairInt(part,param0);
3457 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3458 PyObject *retPy(PyList_New(ret.size()));
3459 for(std::size_t i=0;i<ret.size();i++)
3461 PyObject *tmp(PyTuple_New(2));
3462 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3463 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3464 PyList_SetItem(retPy,i,tmp);
3469 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3471 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3472 convertPyToVectorPairInt(startingFrom,param0);
3473 convertPyToVectorPairInt(goingTo,param1);
3474 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3477 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3479 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3480 convertPyToVectorPairInt(bigInAbs,param0);
3481 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3482 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3483 PyObject *retPy(PyList_New(ret.size()));
3484 for(std::size_t i=0;i<ret.size();i++)
3486 PyObject *tmp(PyTuple_New(2));
3487 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3488 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3489 PyList_SetItem(retPy,i,tmp);
3496 class MEDCouplingCurveLinearMesh;
3498 //== MEDCouplingCMesh
3500 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3503 static MEDCouplingCMesh *New();
3504 static MEDCouplingCMesh *New(const std::string& meshName);
3505 void setCoords(const DataArrayDouble *coordsX,
3506 const DataArrayDouble *coordsY=0,
3507 const DataArrayDouble *coordsZ=0);
3508 void setCoordsAt(int i, const DataArrayDouble *arr);
3509 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3513 return MEDCouplingCMesh::New();
3515 MEDCouplingCMesh(const std::string& meshName)
3517 return MEDCouplingCMesh::New(meshName);
3519 std::string __str__() const
3521 return self->simpleRepr();
3523 std::string __repr__() const
3525 std::ostringstream oss;
3526 self->reprQuickOverview(oss);
3529 DataArrayDouble *getCoordsAt(int i)
3531 DataArrayDouble *ret=self->getCoordsAt(i);
3539 //== MEDCouplingCMesh End
3541 //== MEDCouplingCurveLinearMesh
3543 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3546 static MEDCouplingCurveLinearMesh *New();
3547 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3548 void setCoords(const DataArrayDouble *coords);
3550 MEDCouplingCurveLinearMesh()
3552 return MEDCouplingCurveLinearMesh::New();
3554 MEDCouplingCurveLinearMesh(const std::string& meshName)
3556 return MEDCouplingCurveLinearMesh::New(meshName);
3558 std::string __str__() const
3560 return self->simpleRepr();
3562 std::string __repr__() const
3564 std::ostringstream oss;
3565 self->reprQuickOverview(oss);
3568 DataArrayDouble *getCoords()
3570 DataArrayDouble *ret=self->getCoords();
3575 void setNodeGridStructure(PyObject *gridStruct)
3577 mcIdType szArr,sw,iTypppArr;
3578 std::vector<mcIdType> stdvecTyyppArr;
3579 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3580 self->setNodeGridStructure(tmp,tmp+szArr);
3585 //== MEDCouplingCurveLinearMesh End
3587 //== MEDCouplingIMesh
3589 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3592 static MEDCouplingIMesh *New();
3594 void setSpaceDimension(int spaceDim);
3595 std::vector<mcIdType> getNodeStruct() const;
3596 std::vector<double> getOrigin() const;
3597 std::vector<double> getDXYZ() const;
3598 void setAxisUnit(const std::string& unitName);
3599 std::string getAxisUnit() const;
3600 double getMeasureOfAnyCell() const;
3601 MEDCouplingCMesh *convertToCartesian() const;
3602 void refineWithFactor(const std::vector<mcIdType>& factors);
3603 MEDCouplingIMesh *asSingleCell() const;
3604 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3609 return MEDCouplingIMesh::New();
3611 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3613 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3614 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3615 const mcIdType *nodeStrctPtr(0);
3616 const double *originPtr(0),*dxyzPtr(0);
3617 mcIdType sw,sz,val0;
3618 std::vector<mcIdType> bb0;
3619 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3622 std::vector<double> bb,bb2;
3624 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3625 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3627 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3630 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3632 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3635 void setNodeStruct(PyObject *nodeStrct)
3637 mcIdType sw,sz,val0;
3638 std::vector<mcIdType> bb0;
3639 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3640 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3643 void setOrigin(PyObject *origin)
3645 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3647 std::vector<double> bb;
3648 mcIdType sw,nbTuples;
3649 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3650 self->setOrigin(originPtr,originPtr+nbTuples);
3653 void setDXYZ(PyObject *dxyz)
3655 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3657 std::vector<double> bb;
3658 mcIdType sw,nbTuples;
3659 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3660 self->setDXYZ(originPtr,originPtr+nbTuples);
3663 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3665 std::vector< std::pair<mcIdType,mcIdType> > inp;
3666 convertPyToVectorPairInt(fineLocInCoarse,inp);
3667 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3670 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3672 std::vector< std::pair<mcIdType,mcIdType> > inp;
3673 convertPyToVectorPairInt(fineLocInCoarse,inp);
3674 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3677 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3679 std::vector< std::pair<mcIdType,mcIdType> > inp;
3680 convertPyToVectorPairInt(fineLocInCoarse,inp);
3681 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3684 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3686 std::vector< std::pair<mcIdType,mcIdType> > inp;
3687 convertPyToVectorPairInt(fineLocInCoarse,inp);
3688 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3691 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3693 std::vector< std::pair<mcIdType,mcIdType> > inp;
3694 convertPyToVectorPairInt(fineLocInCoarse,inp);
3695 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3698 std::string __str__() const
3700 return self->simpleRepr();
3702 std::string __repr__() const
3704 std::ostringstream oss;
3705 self->reprQuickOverview(oss);
3711 //== MEDCouplingIMesh End
3715 namespace MEDCoupling
3717 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3720 virtual void checkConsistencyLight() const;
3721 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3722 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3723 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3724 void setName(const char *name);
3725 std::string getDescription() const;
3726 void setDescription(const char *desc);
3727 std::string getName() const;
3728 TypeOfField getTypeOfField() const;
3729 NatureOfField getNature() const;
3730 virtual void setNature(NatureOfField nat);
3731 DataArrayDouble *getLocalizationOfDiscr() const;
3732 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3733 mcIdType getNumberOfTuplesExpected() const;
3734 mcIdType getNumberOfMeshPlacesExpected() const;
3735 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3736 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3737 void clearGaussLocalizations();
3738 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3739 mcIdType getNbOfGaussLocalization() const;
3740 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3741 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3742 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3743 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3745 PyObject *getMesh() const
3747 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3750 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3753 PyObject *getDiscretization()
3755 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3758 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3761 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3763 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3764 return convertIntArrToPyList3(ret);
3767 PyObject *buildSubMeshData(PyObject *li) const
3769 DataArrayIdType *ret1=0;
3770 MEDCouplingMesh *ret0=0;
3772 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3773 if (!SWIG_IsOK(res1))
3776 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3777 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3781 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3783 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3784 da2->checkAllocated();
3785 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3787 PyObject *res = PyList_New(2);
3788 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3789 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3793 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3795 DataArrayIdType *ret1=0;
3797 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3798 PyObject *res=PyTuple_New(2);
3799 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3801 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3804 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3805 PyTuple_SetItem(res,1,res1);
3810 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3813 mcIdType v0; std::vector<mcIdType> v1;
3814 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3815 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3818 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3819 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3822 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3823 if (!SWIG_IsOK(res1))
3826 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3827 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3831 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3833 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3834 da2->checkAllocated();
3835 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3839 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3841 std::vector<mcIdType> tmp;
3842 self->getCellIdsHavingGaussLocalization(locId,tmp);
3843 DataArrayIdType *ret=DataArrayIdType::New();
3844 ret->alloc((mcIdType)tmp.size(),1);
3845 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3846 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3849 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3851 std::vector<mcIdType> inp0;
3852 convertPyToNewIntArr4(code,1,3,inp0);
3853 std::vector<const DataArrayIdType *> inp1;
3854 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3855 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3860 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3863 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3864 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3865 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3866 static MEDCouplingFieldTemplate *New(TypeOfField type);
3867 std::string simpleRepr() const;
3868 std::string advancedRepr() const;
3869 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3870 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3873 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3875 return MEDCouplingFieldTemplate::New(f);
3878 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3880 return MEDCouplingFieldTemplate::New(f);
3883 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3885 return MEDCouplingFieldTemplate::New(f);
3888 MEDCouplingFieldTemplate(TypeOfField type)
3890 return MEDCouplingFieldTemplate::New(type);
3893 std::string __str__() const
3895 return self->simpleRepr();
3898 std::string __repr__() const
3900 std::ostringstream oss;
3901 self->reprQuickOverview(oss);
3905 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3908 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3909 PyObject *ret=PyTuple_New(2);
3910 PyObject *ret0Py=ret0?Py_True:Py_False;
3912 PyTuple_SetItem(ret,0,ret0Py);
3913 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3920 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3923 TypeOfTimeDiscretization getTimeDiscretization() const;
3925 MEDCouplingFieldT();
3926 ~MEDCouplingFieldT();
3929 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3930 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3931 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3933 class MEDCouplingFieldInt;
3934 class MEDCouplingFieldFloat;
3936 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3939 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3940 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3941 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3942 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3943 void setTimeUnit(const std::string& unit);
3944 std::string getTimeUnit() const;
3945 void synchronizeTimeWithSupport();
3946 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3947 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3948 std::string simpleRepr() const;
3949 std::string advancedRepr() const;
3950 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3951 MEDCouplingFieldInt *convertToIntField() const;
3952 MEDCouplingFieldFloat *convertToFloatField() const;
3953 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3954 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3955 MEDCouplingFieldDouble *deepCopy() const;
3956 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3957 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3958 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3959 double getIJ(int tupleId, int compoId) const;
3960 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3961 void synchronizeTimeWithMesh();
3962 void setArray(DataArrayDouble *array);
3963 void setEndArray(DataArrayDouble *array);
3964 void setTime(double val, int iteration, int order);
3965 void setStartTime(double val, int iteration, int order);
3966 void setEndTime(double val, int iteration, int order);
3967 void applyLin(double a, double b, int compoId);
3968 void applyLin(double a, double b);
3969 int getNumberOfComponents() const;
3970 int getNumberOfTuples() const;
3971 int getNumberOfValues() const;
3972 void setTimeTolerance(double val);
3973 double getTimeTolerance() const;
3974 void setIteration(int it);
3975 void setEndIteration(int it);
3976 void setOrder(int order);
3977 void setEndOrder(int order);
3978 void setTimeValue(double val);
3979 void setEndTimeValue(double val);
3980 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3981 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3982 bool mergeNodes(double eps, double epsOnVals=1e-15);
3983 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3984 bool zipCoords(double epsOnVals=1e-15);
3985 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3986 bool simplexize(int policy);
3987 MEDCouplingFieldDouble *doublyContractedProduct() const;
3988 MEDCouplingFieldDouble *determinant() const;
3989 MEDCouplingFieldDouble *eigenValues() const;
3990 MEDCouplingFieldDouble *eigenVectors() const;
3991 MEDCouplingFieldDouble *inverse() const;
3992 MEDCouplingFieldDouble *trace() const;
3993 MEDCouplingFieldDouble *deviator() const;
3994 MEDCouplingFieldDouble *magnitude() const;
3995 MEDCouplingFieldDouble *maxPerTuple() const;
3996 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
3997 void sortPerTuple(bool asc);
3998 MEDCouplingFieldDouble &operator=(double value);
3999 void fillFromAnalytic(int nbOfComp, const std::string& func);
4000 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4001 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4002 void applyFunc(int nbOfComp, const std::string& func);
4003 void applyFuncCompo(int nbOfComp, const std::string& func);
4004 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4005 void applyFunc(int nbOfComp, double val);
4006 void applyFunc(const std::string& func);
4007 void applyFuncFast32(const std::string& func);
4008 void applyFuncFast64(const std::string& func);
4009 double accumulate(int compId) const;
4010 double getMaxValue() const;
4011 double getMinValue() const;
4012 double getAverageValue() const;
4013 double norm2() const;
4014 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4015 double getWeightedAverageValue(int compId, bool isWAbs) const;
4016 double integral(int compId, bool isWAbs) const;
4017 double normL1(int compId) const;
4018 double normL2(int compId) const;
4019 double normMax(int compId) const;
4020 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4021 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4022 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4023 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4024 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4025 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4026 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4027 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4028 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4029 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4030 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4031 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4032 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4033 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4034 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4035 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4036 MEDCouplingFieldDouble *negate() const;
4038 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4040 return MEDCouplingFieldDouble::New(type,td);
4043 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4045 return MEDCouplingFieldDouble::New(ft,td);
4048 std::string __str__() const
4050 return self->simpleRepr();
4053 std::string __repr__() const
4055 std::ostringstream oss;
4056 self->reprQuickOverview(oss);
4060 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4063 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4064 PyObject *ret=PyTuple_New(2);
4065 PyObject *ret0Py=ret0?Py_True:Py_False;
4067 PyTuple_SetItem(ret,0,ret0Py);
4068 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4072 MEDCouplingFieldDouble *voronoize(double eps) const
4074 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4078 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4080 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4084 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4086 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4088 DataArrayDouble *a,*a2;
4089 DataArrayDoubleTuple *aa,*aa2;
4090 std::vector<double> bb,bb2;
4092 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4093 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4094 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4097 DataArrayDouble *getArray()
4099 DataArrayDouble *ret=self->getArray();
4105 PyObject *getArrays() const
4107 std::vector<DataArrayDouble *> arrs=self->getArrays();
4108 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4111 std::size_t sz=arrs.size();
4112 PyObject *ret=PyTuple_New(sz);
4113 for(std::size_t i=0;i<sz;i++)
4116 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4118 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4123 void setArrays(PyObject *ls)
4125 std::vector<const DataArrayDouble *> tmp;
4126 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4127 std::size_t sz=tmp.size();
4128 std::vector<DataArrayDouble *> arrs(sz);
4129 for(std::size_t i=0;i<sz;i++)
4130 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4131 self->setArrays(arrs);
4134 DataArrayDouble *getEndArray()
4136 DataArrayDouble *ret=self->getEndArray();
4142 PyObject *getValueOn(PyObject *sl) const
4146 DataArrayDoubleTuple *aa;
4147 std::vector<double> bb;
4149 const MEDCouplingMesh *mesh=self->getMesh();
4151 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4152 int spaceDim=mesh->getSpaceDimension();
4153 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4154 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4156 mcIdType sz=ToIdType(self->getNumberOfComponents());
4157 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4158 self->getValueOn(spaceLoc,res);
4159 return convertDblArrToPyList<double>(res,sz);
4162 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4164 mcIdType sz=ToIdType(self->getNumberOfComponents());
4165 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4166 self->getValueOnPos(i,j,k,res);
4167 return convertDblArrToPyList<double>(res,sz);
4170 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4172 const MEDCouplingMesh *mesh(self->getMesh());
4174 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4177 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4178 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4179 mesh->getSpaceDimension(),true,nbPts);
4180 return self->getValueOnMulti(inp,(int)nbPts);
4183 PyObject *getValueOn(PyObject *sl, double time) const
4187 DataArrayDoubleTuple *aa;
4188 std::vector<double> bb;
4190 const MEDCouplingMesh *mesh=self->getMesh();
4192 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4193 int spaceDim=mesh->getSpaceDimension();
4194 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4195 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4198 mcIdType sz=ToIdType(self->getNumberOfComponents());
4199 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4200 self->getValueOn(spaceLoc,time,res);
4201 return convertDblArrToPyList<double>(res,sz);
4204 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4206 if(self->getArray()!=0)
4207 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4210 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4211 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4212 self->setArray(arr);
4219 double tmp0=self->getTime(tmp1,tmp2);
4220 PyObject *res = PyList_New(3);
4221 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4222 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4223 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4227 PyObject *getStartTime()
4230 double tmp0=self->getStartTime(tmp1,tmp2);
4231 PyObject *res = PyList_New(3);
4232 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4233 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4234 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4238 PyObject *getEndTime()
4241 double tmp0=self->getEndTime(tmp1,tmp2);
4242 PyObject *res = PyList_New(3);
4243 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4244 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4245 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4248 PyObject *accumulate() const
4250 mcIdType sz=ToIdType(self->getNumberOfComponents());
4251 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4252 self->accumulate(tmp);
4253 return convertDblArrToPyList<double>(tmp,sz);
4255 PyObject *integral(bool isWAbs) const
4257 mcIdType sz=ToIdType(self->getNumberOfComponents());
4258 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4259 self->integral(isWAbs,tmp);
4260 return convertDblArrToPyList<double>(tmp,sz);
4262 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4264 mcIdType sz=ToIdType(self->getNumberOfComponents());
4265 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4266 self->getWeightedAverageValue(tmp,isWAbs);
4267 return convertDblArrToPyList<double>(tmp,sz);
4269 PyObject *normL1() const
4271 mcIdType sz=ToIdType(self->getNumberOfComponents());
4272 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4274 return convertDblArrToPyList<double>(tmp,sz);
4276 PyObject *normL2() const
4278 mcIdType sz=ToIdType(self->getNumberOfComponents());
4279 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4281 return convertDblArrToPyList<double>(tmp,sz);
4283 PyObject *normMax() const
4285 mcIdType sz=ToIdType(self->getNumberOfComponents());
4286 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4288 return convertDblArrToPyList<double>(tmp,sz);
4290 void renumberCells(PyObject *li, bool check=true)
4292 mcIdType szArr,sw,iTypppArr;
4293 std::vector<mcIdType> stdvecTyyppArr;
4294 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4295 self->renumberCells(tmp,check);
4298 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4300 mcIdType szArr,sw,iTypppArr;
4301 std::vector<mcIdType> stdvecTyyppArr;
4302 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4303 self->renumberCellsWithoutMesh(tmp,check);
4306 void renumberNodes(PyObject *li, double eps=1e-15)
4308 mcIdType szArr,sw,iTypppArr;
4309 std::vector<mcIdType> stdvecTyyppArr;
4310 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4311 self->renumberNodes(tmp,eps);
4314 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4316 mcIdType szArr,sw,iTypppArr;
4317 std::vector<mcIdType> stdvecTyyppArr;
4318 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4319 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4322 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4324 return fieldT_buildSubPart(self,li);
4327 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4329 return fieldT__getitem__(self,li);
4332 PyObject *getMaxValue2() const
4334 DataArrayIdType *tmp;
4335 double r1=self->getMaxValue2(tmp);
4336 PyObject *ret=PyTuple_New(2);
4337 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4338 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4342 PyObject *getMinValue2() const
4344 DataArrayIdType *tmp;
4345 double r1=self->getMinValue2(tmp);
4346 PyObject *ret=PyTuple_New(2);
4347 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4348 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4352 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4354 std::vector<std::size_t> tmp;
4355 convertPyToNewIntArr3(li,tmp);
4356 return self->keepSelectedComponents(tmp);
4359 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4361 std::vector<std::size_t> tmp;
4362 convertPyToNewIntArr3(li,tmp);
4363 self->setSelectedComponents(f,tmp);
4366 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4369 DataArrayDouble *a,*a2;
4370 DataArrayDoubleTuple *aa,*aa2;
4371 std::vector<double> bb,bb2;
4374 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4375 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4376 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4377 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4379 return self->extractSlice3D(orig,vect,eps);
4382 MEDCouplingFieldDouble *__add__(PyObject *obj)
4384 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4387 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4389 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4392 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4394 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.";
4395 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4398 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4400 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4402 return (*self)-(*other);
4404 throw INTERP_KERNEL::Exception(msg);
4409 DataArrayDoubleTuple *aa;
4410 std::vector<double> bb;
4412 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4417 if(!self->getArray())
4418 throw INTERP_KERNEL::Exception(msg2);
4419 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4420 ret->applyLin(1.,-val);
4421 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4422 ret2->setArray(ret);
4427 if(!self->getArray())
4428 throw INTERP_KERNEL::Exception(msg2);
4429 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4430 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4431 ret2->setArray(ret);
4436 if(!self->getArray())
4437 throw INTERP_KERNEL::Exception(msg2);
4438 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4439 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4440 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4441 ret2->setArray(ret);
4446 if(!self->getArray())
4447 throw INTERP_KERNEL::Exception(msg2);
4448 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4449 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4450 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4451 ret2->setArray(ret);
4455 { throw INTERP_KERNEL::Exception(msg); }
4459 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4461 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4464 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4466 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4469 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4471 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4474 MEDCouplingFieldDouble *__div__(PyObject *obj)
4476 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.";
4477 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4480 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4482 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4484 return (*self)/(*other);
4486 throw INTERP_KERNEL::Exception(msg);
4491 DataArrayDoubleTuple *aa;
4492 std::vector<double> bb;
4494 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4500 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4501 if(!self->getArray())
4502 throw INTERP_KERNEL::Exception(msg2);
4503 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4504 ret->applyLin(1./val,0);
4505 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4506 ret2->setArray(ret);
4511 if(!self->getArray())
4512 throw INTERP_KERNEL::Exception(msg2);
4513 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4514 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4515 ret2->setArray(ret);
4520 if(!self->getArray())
4521 throw INTERP_KERNEL::Exception(msg2);
4522 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4523 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4524 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4525 ret2->setArray(ret);
4530 if(!self->getArray())
4531 throw INTERP_KERNEL::Exception(msg2);
4532 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4533 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4534 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4535 ret2->setArray(ret);
4539 { throw INTERP_KERNEL::Exception(msg); }
4543 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4545 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4548 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4550 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.";
4551 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4554 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4556 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4558 return (*self)^(*other);
4560 throw INTERP_KERNEL::Exception(msg);
4565 DataArrayDoubleTuple *aa;
4566 std::vector<double> bb;
4568 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4573 if(!self->getArray())
4574 throw INTERP_KERNEL::Exception(msg2);
4575 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4577 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4578 ret2->setArray(ret);
4583 if(!self->getArray())
4584 throw INTERP_KERNEL::Exception(msg2);
4585 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4586 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4587 ret2->setArray(ret);
4592 if(!self->getArray())
4593 throw INTERP_KERNEL::Exception(msg2);
4594 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4595 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4596 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4597 ret2->setArray(ret);
4602 if(!self->getArray())
4603 throw INTERP_KERNEL::Exception(msg2);
4604 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4605 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4606 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4607 ret2->setArray(ret);
4611 { throw INTERP_KERNEL::Exception(msg); }
4615 MEDCouplingFieldDouble *__neg__() const
4617 return self->negate();
4620 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4622 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.";
4623 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4626 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4628 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4632 Py_XINCREF(trueSelf);
4636 throw INTERP_KERNEL::Exception(msg);
4641 DataArrayDoubleTuple *aa;
4642 std::vector<double> bb;
4644 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4649 if(!self->getArray())
4650 throw INTERP_KERNEL::Exception(msg2);
4651 self->getArray()->applyLin(1.,val);
4652 Py_XINCREF(trueSelf);
4657 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4660 Py_XINCREF(trueSelf);
4665 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4666 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4667 ret2->setArray(aaa);
4669 Py_XINCREF(trueSelf);
4674 if(!self->getArray())
4675 throw INTERP_KERNEL::Exception(msg2);
4676 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4677 self->getArray()->addEqual(aaa);
4678 Py_XINCREF(trueSelf);
4682 { throw INTERP_KERNEL::Exception(msg); }
4686 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4688 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.";
4689 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4692 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4694 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4698 Py_XINCREF(trueSelf);
4702 throw INTERP_KERNEL::Exception(msg);
4707 DataArrayDoubleTuple *aa;
4708 std::vector<double> bb;
4710 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4715 if(!self->getArray())
4716 throw INTERP_KERNEL::Exception(msg2);
4717 self->getArray()->applyLin(1.,-val);
4718 Py_XINCREF(trueSelf);
4723 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4726 Py_XINCREF(trueSelf);
4731 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4732 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4733 ret2->setArray(aaa);
4735 Py_XINCREF(trueSelf);
4740 if(!self->getArray())
4741 throw INTERP_KERNEL::Exception(msg2);
4742 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4743 self->getArray()->substractEqual(aaa);
4744 Py_XINCREF(trueSelf);
4748 { throw INTERP_KERNEL::Exception(msg); }
4752 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4754 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.";
4755 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4758 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4760 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4764 Py_XINCREF(trueSelf);
4768 throw INTERP_KERNEL::Exception(msg);
4773 DataArrayDoubleTuple *aa;
4774 std::vector<double> bb;
4776 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4781 if(!self->getArray())
4782 throw INTERP_KERNEL::Exception(msg2);
4783 self->getArray()->applyLin(val,0);
4784 Py_XINCREF(trueSelf);
4789 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4792 Py_XINCREF(trueSelf);
4797 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4798 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4799 ret2->setArray(aaa);
4801 Py_XINCREF(trueSelf);
4806 if(!self->getArray())
4807 throw INTERP_KERNEL::Exception(msg2);
4808 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4809 self->getArray()->multiplyEqual(aaa);
4810 Py_XINCREF(trueSelf);
4814 { throw INTERP_KERNEL::Exception(msg); }
4818 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4820 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.";
4821 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4824 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4826 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4830 Py_XINCREF(trueSelf);
4834 throw INTERP_KERNEL::Exception(msg);
4839 DataArrayDoubleTuple *aa;
4840 std::vector<double> bb;
4842 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4848 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4849 if(!self->getArray())
4850 throw INTERP_KERNEL::Exception(msg2);
4851 self->getArray()->applyLin(1./val,0);
4852 Py_XINCREF(trueSelf);
4857 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4860 Py_XINCREF(trueSelf);
4865 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4866 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4867 ret2->setArray(aaa);
4869 Py_XINCREF(trueSelf);
4874 if(!self->getArray())
4875 throw INTERP_KERNEL::Exception(msg2);
4876 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4877 self->getArray()->divideEqual(aaa);
4878 Py_XINCREF(trueSelf);
4882 { throw INTERP_KERNEL::Exception(msg); }
4886 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4888 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.";
4889 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4892 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4894 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4898 Py_XINCREF(trueSelf);
4902 throw INTERP_KERNEL::Exception(msg);
4907 DataArrayDoubleTuple *aa;
4908 std::vector<double> bb;
4910 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4915 if(!self->getArray())
4916 throw INTERP_KERNEL::Exception(msg2);
4917 self->getArray()->applyPow(val);
4918 Py_XINCREF(trueSelf);
4923 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4926 Py_XINCREF(trueSelf);
4931 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4932 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4933 ret2->setArray(aaa);
4935 Py_XINCREF(trueSelf);
4940 if(!self->getArray())
4941 throw INTERP_KERNEL::Exception(msg2);
4942 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4943 self->getArray()->powEqual(aaa);
4944 Py_XINCREF(trueSelf);
4948 { throw INTERP_KERNEL::Exception(msg); }
4952 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4954 std::vector<const MEDCouplingFieldDouble *> tmp;
4955 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4956 return MEDCouplingFieldDouble::MergeFields(tmp);
4959 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4961 std::vector<const MEDCouplingFieldDouble *> tmp;
4962 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4963 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4966 PyObject *getTinySerializationInformation() const
4968 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4971 PyObject *serialize() const
4973 return field_serialize<double>(self);
4976 PyObject *__getstate__() const
4978 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4981 void __setstate__(PyObject *inp)
4983 field__setstate__<double>(self,inp);
4988 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4991 int getNumberOfFields() const;
4992 MEDCouplingMultiFields *deepCopy() const;
4993 virtual std::string simpleRepr() const;
4994 virtual std::string advancedRepr() const;
4995 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4996 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4997 virtual void checkConsistencyLight() const;
5000 std::string __str__() const
5002 return self->simpleRepr();
5004 static MEDCouplingMultiFields *New(PyObject *li)
5006 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5007 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5008 std::size_t sz=tmp.size();
5009 std::vector<MEDCouplingFieldDouble *> fs(sz);
5010 for(std::size_t i=0;i<sz;i++)
5011 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5012 return MEDCouplingMultiFields::New(fs);
5014 MEDCouplingMultiFields(PyObject *li)
5016 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5017 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5018 std::size_t sz=tmp.size();
5019 std::vector<MEDCouplingFieldDouble *> fs(sz);
5020 for(std::size_t i=0;i<sz;i++)
5021 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5022 return MEDCouplingMultiFields::New(fs);
5024 PyObject *getFields() const
5026 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5027 std::size_t sz=fields.size();
5028 PyObject *res = PyList_New(sz);
5029 for(std::size_t i=0;i<sz;i++)
5033 fields[i]->incrRef();
5034 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5038 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5043 PyObject *getFieldAtPos(int id) const
5045 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5049 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5052 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5054 PyObject *getMeshes() const
5056 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5057 std::size_t sz=ms.size();
5058 PyObject *res = PyList_New(sz);
5059 for(std::size_t i=0;i<sz;i++)
5064 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5068 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5073 PyObject *getDifferentMeshes() const
5075 std::vector<int> refs;
5076 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5077 std::size_t sz=ms.size();
5078 PyObject *res = PyList_New(sz);
5079 for(std::size_t i=0;i<sz;i++)
5084 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5088 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5092 PyObject *ret=PyTuple_New(2);
5093 PyTuple_SetItem(ret,0,res);
5094 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5097 PyObject *getArrays() const
5099 std::vector<DataArrayDouble *> ms=self->getArrays();
5100 std::size_t sz=ms.size();
5101 PyObject *res = PyList_New(sz);
5102 for(std::size_t i=0;i<sz;i++)
5107 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5111 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5116 PyObject *getDifferentArrays() const
5118 std::vector< std::vector<int> > refs;
5119 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5120 std::size_t sz=ms.size();
5121 PyObject *res = PyList_New(sz);
5122 PyObject *res2 = PyList_New(sz);
5123 for(std::size_t i=0;i<sz;i++)
5128 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5132 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5134 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5137 PyObject *ret=PyTuple_New(2);
5138 PyTuple_SetItem(ret,0,res);
5139 PyTuple_SetItem(ret,1,res2);
5145 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5148 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5149 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5150 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5151 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5152 void setTimeUnit(const std::string& unit);
5153 std::string getTimeUnit() const;
5154 void setTime(double val, int iteration, int order);
5155 void setArray(DataArrayInt32 *array);
5156 MEDCouplingFieldInt *deepCopy() const;
5157 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5158 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5159 MEDCouplingFieldDouble *convertToDblField() const;
5160 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5162 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5164 return MEDCouplingFieldInt::New(type,td);
5167 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5169 return MEDCouplingFieldInt::New(ft,td);
5172 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5175 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5176 PyObject *ret=PyTuple_New(2);
5177 PyObject *ret0Py=ret0?Py_True:Py_False;
5179 PyTuple_SetItem(ret,0,ret0Py);
5180 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5184 std::string __str__() const
5186 return self->simpleRepr();
5189 std::string __repr__() const
5191 std::ostringstream oss;
5192 self->reprQuickOverview(oss);
5196 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5198 return fieldT_buildSubPart(self,li);
5201 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5203 return fieldT__getitem__(self,li);
5206 DataArrayInt32 *getArray()
5208 DataArrayInt32 *ret=self->getArray();
5217 double tmp0=self->getTime(tmp1,tmp2);
5218 PyObject *res = PyList_New(3);
5219 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5220 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5221 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5225 PyObject *getTinySerializationInformation() const
5227 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5230 PyObject *serialize() const
5232 return field_serialize<int>(self);
5235 PyObject *__getstate__() const
5237 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5240 void __setstate__(PyObject *inp)
5242 field__setstate__<int>(self,inp);
5247 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5250 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5251 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5252 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5253 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5254 void setTimeUnit(const std::string& unit);
5255 std::string getTimeUnit() const;
5256 void setTime(double val, int iteration, int order);
5257 void setArray(DataArrayFloat *array);
5258 MEDCouplingFieldFloat *deepCopy() const;
5259 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5260 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5261 MEDCouplingFieldDouble *convertToDblField() const;
5262 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5264 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5266 return MEDCouplingFieldFloat::New(type,td);
5269 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5271 return MEDCouplingFieldFloat::New(ft,td);
5274 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5277 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5278 PyObject *ret=PyTuple_New(2);
5279 PyObject *ret0Py=ret0?Py_True:Py_False;
5281 PyTuple_SetItem(ret,0,ret0Py);
5282 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5286 std::string __str__() const
5288 return self->simpleRepr();
5291 std::string __repr__() const
5293 std::ostringstream oss;
5294 self->reprQuickOverview(oss);
5298 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5300 return fieldT_buildSubPart(self,li);
5303 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5305 return fieldT__getitem__(self,li);
5308 DataArrayFloat *getArray()
5310 DataArrayFloat *ret=self->getArray();
5319 double tmp0=self->getTime(tmp1,tmp2);
5320 PyObject *res = PyList_New(3);
5321 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5322 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5323 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5327 PyObject *getTinySerializationInformation() const
5329 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5332 PyObject *serialize() const
5334 return field_serialize<float>(self);
5337 PyObject *__getstate__() const
5339 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5342 void __setstate__(PyObject *inp)
5344 field__setstate__<float>(self,inp);
5349 class MEDCouplingDefinitionTime
5352 MEDCouplingDefinitionTime();
5353 void assign(const MEDCouplingDefinitionTime& other);
5354 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5355 double getTimeResolution() const;
5356 std::vector<double> getHotSpotsTime() const;
5359 std::string __str__() const
5361 std::ostringstream oss;
5362 self->appendRepr(oss);
5366 PyObject *getIdsOnTimeRight(double tm) const
5368 int meshId,arrId,arrIdInField,fieldId;
5369 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5370 PyObject *res=PyList_New(4);
5371 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5372 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5373 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5374 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5378 PyObject *getIdsOnTimeLeft(double tm) const
5380 int meshId,arrId,arrIdInField,fieldId;
5381 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5382 PyObject *res=PyList_New(4);
5383 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5384 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5385 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5386 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5392 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5395 double getTimeTolerance() const;
5396 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5400 MEDCouplingFieldOverTime(PyObject *li)
5402 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5403 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5404 std::size_t sz=tmp.size();
5405 std::vector<MEDCouplingFieldDouble *> fs(sz);
5406 for(std::size_t i=0;i<sz;i++)
5407 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5408 return MEDCouplingFieldOverTime::New(fs);
5410 std::string __str__() const
5412 return self->simpleRepr();
5414 static MEDCouplingFieldOverTime *New(PyObject *li)
5416 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5417 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5418 std::size_t sz=tmp.size();
5419 std::vector<MEDCouplingFieldDouble *> fs(sz);
5420 for(std::size_t i=0;i<sz;i++)
5421 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5422 return MEDCouplingFieldOverTime::New(fs);
5427 class MEDCouplingCartesianAMRMesh;
5429 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5432 int getNumberOfCellsRecursiveWithOverlap() const;
5433 int getNumberOfCellsRecursiveWithoutOverlap() const;
5434 int getMaxNumberOfLevelsRelativeToThis() const;
5437 MEDCouplingCartesianAMRMeshGen *getMesh() const
5439 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5447 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5450 int getNumberOfOverlapedCellsForFather() const;
5451 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5452 std::vector<mcIdType> computeCellGridSt() const;
5455 PyObject *getBLTRRange() const
5457 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5458 return convertFromVectorPairInt(ret);
5461 PyObject *getBLTRRangeRelativeToGF() const
5463 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5464 return convertFromVectorPairInt(ret);
5467 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5469 std::vector< std::pair<mcIdType,mcIdType> > inp;
5470 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5471 self->addPatch(inp,factors);
5474 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5476 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5478 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5479 if(patchId==mesh->getNumberOfPatches())
5481 std::ostringstream oss;
5482 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5483 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5486 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5492 void __delitem__(mcIdType patchId)
5494 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5496 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5497 mesh->removePatch(patchId);
5500 mcIdType __len__() const
5502 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5504 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5505 return mesh->getNumberOfPatches();
5510 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5514 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5517 mcIdType getAbsoluteLevel() const;
5518 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5519 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5520 int getSpaceDimension() const;
5521 const std::vector<mcIdType>& getFactors() const;
5522 void setFactors(const std::vector<mcIdType>& newFactors);
5523 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5524 mcIdType getNumberOfCellsAtCurrentLevel() const;
5525 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5526 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5527 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5528 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5529 virtual void detachFromFather();
5531 mcIdType getNumberOfPatches() const;
5532 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5533 MEDCouplingUMesh *buildUnstructured() const;
5534 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5535 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5536 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5537 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5538 void removeAllPatches();
5539 void removePatch(mcIdType patchId);
5540 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5541 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5542 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5543 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5544 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5545 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5546 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5547 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5548 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5549 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5550 std::string buildPythonDumpOfThis() const;
5553 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5555 std::vector< std::pair<mcIdType,mcIdType> > inp;
5556 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5557 self->addPatch(inp,factors);
5560 PyObject *getPatches() const
5562 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5563 std::size_t sz(ps.size());
5564 PyObject *ret = PyList_New(sz);
5565 for(std::size_t i=0;i<sz;i++)
5567 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5570 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5575 // agy : don't know why typemap fails here ??? let it in the extend section
5576 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5578 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5581 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5583 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5584 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5590 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5592 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5593 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5599 virtual PyObject *positionRelativeToGodFather() const
5601 std::vector<mcIdType> out1;
5602 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5603 PyObject *ret(PyTuple_New(2));
5604 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5605 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5609 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5611 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5612 std::size_t sz(ps.size());
5613 PyObject *ret = PyList_New(sz);
5614 for(std::size_t i=0;i<sz;i++)
5615 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5619 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5621 std::vector<const DataArrayDouble *> inp;
5622 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5623 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5626 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5628 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5634 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5636 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5642 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5644 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5650 MEDCouplingIMesh *getImageMesh() const
5652 const MEDCouplingIMesh *ret(self->getImageMesh());
5655 return const_cast<MEDCouplingIMesh *>(ret);
5658 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5660 if(patchId==self->getNumberOfPatches())
5662 std::ostringstream oss;
5663 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5664 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5667 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5673 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5675 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5676 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5677 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5680 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5682 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5683 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5684 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5687 void __delitem__(mcIdType patchId)
5689 self->removePatch(patchId);
5692 mcIdType __len__() const
5694 return self->getNumberOfPatches();
5699 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5703 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5706 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5709 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5711 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5712 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5713 const mcIdType *nodeStrctPtr(0);
5714 const double *originPtr(0),*dxyzPtr(0);
5715 mcIdType sw,sz,val0;
5716 std::vector<mcIdType> bb0;
5717 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5720 std::vector<double> bb,bb2;
5722 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5723 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5725 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5728 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5730 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5731 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5732 std::vector< std::vector<mcIdType> > inp2;
5733 convertPyToVectorOfVectorOfInt(factors,inp2);
5734 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5737 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5739 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5742 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5744 return MEDCouplingCartesianAMRMesh::New(mesh);
5749 class MEDCouplingDataForGodFather : public RefCountObject
5752 virtual void synchronizeFineToCoarse();
5753 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5754 virtual void synchronizeCoarseToFine();
5755 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5756 virtual void synchronizeAllGhostZones();
5757 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5758 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5759 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5760 virtual void alloc();
5761 virtual void dealloc();
5764 MEDCouplingCartesianAMRMesh *getMyGodFather()
5766 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5774 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5777 mcIdType getNumberOfLevels() const;
5778 MEDCouplingAMRAttribute *deepCopy() const;
5779 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5780 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5781 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5782 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5783 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5784 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5785 std::string writeVTHB(const std::string& fileName) const;
5788 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5790 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5791 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5792 MEDCouplingAMRAttribute *ret(0);
5795 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5796 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5798 catch(INTERP_KERNEL::Exception&)
5800 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5801 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5806 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5808 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5811 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5813 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5814 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5820 void spillInfoOnComponents(PyObject *compNames)
5822 std::vector< std::vector<std::string> > compNamesCpp;
5823 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5824 self->spillInfoOnComponents(compNamesCpp);
5827 void spillNatures(PyObject *nfs)
5829 std::vector<mcIdType> inp0;
5830 if(!fillIntVector(nfs,inp0))
5831 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5832 std::size_t sz(inp0.size());
5833 std::vector<NatureOfField> inp00(sz);
5834 for(std::size_t i=0;i<sz;i++)
5835 inp00[i]=(NatureOfField)inp0[i];
5836 self->spillNatures(inp00);
5839 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5841 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5842 std::size_t sz(ret.size());
5843 PyObject *retPy(PyList_New(sz));
5844 for(std::size_t i=0;i<sz;i++)
5845 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5851 class DenseMatrix : public RefCountObject, public TimeLabel
5854 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5855 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5856 DenseMatrix *deepCopy() const;
5857 DenseMatrix *shallowCpy() const;
5859 mcIdType getNumberOfRows() const;
5860 mcIdType getNumberOfCols() const;
5861 mcIdType getNbOfElems() const;
5862 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5863 void reShape(mcIdType nbRows, mcIdType nbCols);
5866 bool isEqual(const DenseMatrix& other, double eps) const;
5867 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5868 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5871 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5873 return DenseMatrix::New(nbRows,nbCols);
5876 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5878 return DenseMatrix::New(array,nbRows,nbCols);
5881 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5884 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5885 PyObject *ret=PyTuple_New(2);
5886 PyObject *ret0Py=ret0?Py_True:Py_False;
5888 PyTuple_SetItem(ret,0,ret0Py);
5889 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5893 DataArrayDouble *getData()
5895 DataArrayDouble *ret(self->getData());
5901 DenseMatrix *__add__(const DenseMatrix *other)
5903 return MEDCoupling::DenseMatrix::Add(self,other);
5906 DenseMatrix *__sub__(const DenseMatrix *other)
5908 return MEDCoupling::DenseMatrix::Substract(self,other);
5911 DenseMatrix *__mul__(const DenseMatrix *other)
5913 return MEDCoupling::DenseMatrix::Multiply(self,other);
5916 DenseMatrix *__mul__(const DataArrayDouble *other)
5918 return MEDCoupling::DenseMatrix::Multiply(self,other);
5921 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5923 self->addEqual(other);
5924 Py_XINCREF(trueSelf);
5928 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5930 self->substractEqual(other);
5931 Py_XINCREF(trueSelf);
5935 PyObject *toNumPyMatrix() // not const. It is not a bug !
5937 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5946 def MEDCouplingUMeshReduce(self):
5947 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5948 def MEDCouplingCMeshReduce(self):
5949 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5950 def MEDCouplingIMeshReduce(self):
5951 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5952 def MEDCouplingMappedExtrudedMeshReduce(self):
5953 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5954 def MEDCouplingCurveLinearMeshReduce(self):
5955 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5956 def MEDCoupling1SGTUMeshReduce(self):
5957 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5958 def MEDCoupling1DGTUMeshReduce(self):
5959 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5960 def MEDCouplingFieldDoubleReduce(self):
5961 self.checkConsistencyLight()
5962 d=(self.getTypeOfField(),self.getTimeDiscretization())
5963 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5964 def MEDCouplingFieldIntReduce(self):
5965 self.checkConsistencyLight()
5966 d=(self.getTypeOfField(),self.getTimeDiscretization())
5967 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5968 def MEDCouplingFieldFloatReduce(self):
5969 self.checkConsistencyLight()
5970 d=(self.getTypeOfField(),self.getTimeDiscretization())
5971 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5972 def MEDCouplingFTReduceFunct(cls,params):
5974 ret=object.__new__(cls)
5978 def MEDCouplingFieldTemplateReduce(self):
5979 ret = MEDCouplingFieldDouble(self)
5980 nbTuples = self.getNumberOfTuplesExpected()
5981 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5983 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5985 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5987 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5988 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5989 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5990 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5991 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5992 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5993 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5999 __filename=os.environ.get('PYTHONSTARTUP')
6000 if __filename and os.path.isfile(__filename):
6001 with open(__filename) as __fp: