1 // Copyright (C) 2017-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifdef WITH_DOCSTRINGS
22 %include MEDCoupling_doc.i
29 #include "MEDCouplingMemArray.hxx"
30 #include "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;
470 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
471 %feature("unref") MEDCouplingMesh "$this->decrRef();"
472 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
473 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
474 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
475 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
476 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
477 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
478 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
479 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
480 %feature("unref") MEDCouplingField "$this->decrRef();"
481 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
482 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
483 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
484 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
485 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
486 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
487 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
488 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
489 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
490 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
491 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
492 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
493 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
494 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
495 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
496 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
497 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
498 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
499 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
500 %feature("unref") DenseMatrix "$this->decrRef();"
501 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
503 %rename(assign) *::operator=;
504 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
505 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
506 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
507 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
511 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
512 // on the Python side. Must be put BEFORE the %rename clause:
513 %exceptionclass INTERP_KERNEL::Exception;
514 %rename (InterpKernelException) INTERP_KERNEL::Exception;
516 %include "MEDCouplingRefCountObject.i"
517 %include "MEDCouplingMemArray.i"
521 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
522 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
523 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
524 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
525 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
526 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
527 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
528 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
529 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
535 PyObject *med2vtk_cell_types()
537 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
538 PyObject *ret(PyList_New(sz));
539 for(Py_ssize_t i=0;i<sz;i++)
541 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
542 PyList_SetItem(ret,i,PyInt_FromLong(elt));
547 PyObject *vtk2med_cell_types()
549 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
550 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
551 auto szOut(maxElt+1);
552 std::vector< mcIdType > retCpp(szOut,-1);
554 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
556 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
560 PyObject *ret(PyList_New(szOut));
562 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
563 PyList_SetItem(ret,id,PyInt_FromLong(*it));
567 PyObject *AllGeometricTypes()
569 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
570 PyObject *ret(PyList_New(sz));
571 for(Py_ssize_t i=0;i<sz;i++)
572 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
577 namespace INTERP_KERNEL
580 * \class BoxSplittingOptions
581 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
583 class BoxSplittingOptions
586 BoxSplittingOptions();
588 double getEfficiencyGoal() const;
589 void setEfficiencyGoal(double efficiency);
590 double getEfficiencyThreshold() const;
591 void setEfficiencyThreshold(double efficiencyThreshold);
592 int getMinimumPatchLength() const;
593 void setMinimumPatchLength(int minPatchLength);
594 int getMaximumPatchLength() const;
595 void setMaximumPatchLength(int maxPatchLength);
596 int getMaximumNbOfCellsInPatch() const;
597 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
598 void copyOptions(const BoxSplittingOptions & other);
599 std::string printOptions() const;
602 std::string __str__() const
604 return self->printOptions();
610 namespace MEDCoupling
626 CONST_ON_TIME_INTERVAL = 7
627 } TypeOfTimeDiscretization;
635 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
636 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
638 } MEDCouplingMeshType;
640 class DataArrayInt32;
641 class DataArrayInt64;
642 class DataArrayDouble;
643 class MEDCouplingUMesh;
644 class MEDCouplingCMesh;
645 class MEDCouplingFieldDouble;
647 %extend RefCountObject
649 std::string getHiddenCppPointer() const
651 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
656 %extend MEDCouplingGaussLocalization
658 std::string __str__() const
660 return self->getStringRepr();
663 std::string __repr__() const
665 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
666 oss << self->getStringRepr();
673 class MEDCouplingMesh : public RefCountObject, public TimeLabel
676 void setName(const std::string& name);
677 std::string getName() const;
678 void setDescription(const std::string& descr);
679 std::string getDescription() const;
680 void setTime(double val, int iteration, int order);
681 void setTimeUnit(const std::string& unit);
682 std::string getTimeUnit() const;
683 virtual MEDCouplingMeshType getType() const;
684 bool isStructured() const;
685 virtual MEDCouplingMesh *deepCopy() const;
686 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
687 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
688 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
689 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
690 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
691 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
692 virtual void checkConsistencyLight() const;
693 virtual void checkConsistency(double eps=1e-12) const;
694 virtual int getNumberOfCells() const;
695 virtual int getNumberOfNodes() const;
696 virtual int getSpaceDimension() const;
697 virtual int getMeshDimension() const;
698 virtual DataArrayDouble *getCoordinatesAndOwner() const;
699 virtual DataArrayDouble *computeCellCenterOfMass() const;
700 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
701 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
702 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
703 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
704 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
705 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
706 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
707 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
708 virtual std::string simpleRepr() const;
709 virtual std::string advancedRepr() const;
710 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
711 virtual std::string getVTKFileExtension() const;
712 std::string getVTKFileNameOf(const std::string& fileName) const;
714 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
715 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
716 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
717 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
718 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
719 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
720 virtual MEDCouplingUMesh *buildUnstructured() const;
721 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
722 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
723 virtual DataArrayIdType *simplexize(int policy);
724 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
725 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
726 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
727 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
728 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
729 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
730 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
731 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
734 std::string __str__() const
736 return self->simpleRepr();
742 double tmp0=self->getTime(tmp1,tmp2);
743 PyObject *res = PyList_New(3);
744 PyList_SetItem(res,0,SWIG_From_double(tmp0));
745 PyList_SetItem(res,1,SWIG_From_int(tmp1));
746 PyList_SetItem(res,2,SWIG_From_int(tmp2));
750 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
752 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
753 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
759 mcIdType getCellContainingPoint(PyObject *p, double eps) const
763 DataArrayDoubleTuple *aa;
764 std::vector<double> bb;
766 int spaceDim=self->getSpaceDimension();
767 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
768 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
769 return self->getCellContainingPoint(pos,eps);
772 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
776 DataArrayDoubleTuple *aa;
777 std::vector<double> bb;
779 int spaceDim=self->getSpaceDimension();
780 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
781 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
782 MCAuto<DataArrayIdType> elts,eltsIndex;
783 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
784 PyObject *ret=PyTuple_New(2);
785 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
786 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
790 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
794 DataArrayDoubleTuple *aa;
795 std::vector<double> bb;
797 int spaceDim=self->getSpaceDimension();
798 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
799 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
800 MCAuto<DataArrayIdType> elts,eltsIndex;
801 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
802 PyObject *ret=PyTuple_New(2);
803 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
804 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
808 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
810 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
811 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
814 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
816 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
817 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
820 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
824 DataArrayDoubleTuple *aa;
825 std::vector<double> bb;
827 int spaceDim=self->getSpaceDimension();
828 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
829 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
830 std::vector<mcIdType> elts;
831 self->getCellsContainingPoint(pos,eps,elts);
832 DataArrayIdType *ret=DataArrayIdType::New();
833 ret->alloc((int)elts.size(),1);
834 std::copy(elts.begin(),elts.end(),ret->getPointer());
835 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
838 virtual PyObject *getReverseNodalConnectivity() const
840 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
841 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
842 self->getReverseNodalConnectivity(d0,d1);
843 PyObject *ret=PyTuple_New(2);
844 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
845 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
849 void renumberCells(PyObject *li, bool check=true)
852 mcIdType v0; std::vector<mcIdType> v1;
853 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
854 self->renumberCells(ids,check);
857 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
859 DataArrayIdType *cellCor, *nodeCor;
860 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
861 PyObject *res = PyList_New(2);
862 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
863 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
867 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
869 DataArrayIdType *cellCor=0,*nodeCor=0;
870 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
871 PyObject *res = PyList_New(2);
872 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
873 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
877 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
879 DataArrayIdType *cellCor=0;
880 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
884 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
887 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
888 if (!SWIG_IsOK(res1))
891 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
892 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
896 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
898 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
899 da2->checkAllocated();
900 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
903 PyObject *getNodeIdsOfCell(int cellId) const
905 std::vector<mcIdType> conn;
906 self->getNodeIdsOfCell(cellId,conn);
907 return convertIntArrToPyList2(conn);
910 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
912 std::vector<double> coo;
913 self->getCoordinatesOfNode(nodeId,coo);
914 return convertDblArrToPyList2(coo);
917 void scale(PyObject *point, double factor)
921 DataArrayDoubleTuple *aa;
922 std::vector<double> bb;
924 int spaceDim=self->getSpaceDimension();
925 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
926 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
927 self->scale(pointPtr,factor);
930 PyObject *getBoundingBox() const
932 int spaceDim=self->getSpaceDimension();
933 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
934 self->getBoundingBox(tmp);
935 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
939 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
942 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
943 PyObject *ret=PyTuple_New(2);
944 PyObject *ret0Py=ret0?Py_True:Py_False;
946 PyTuple_SetItem(ret,0,ret0Py);
947 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
951 PyObject *buildPart(PyObject *li) const
953 mcIdType szArr,sw,iTypppArr;
954 std::vector<mcIdType> stdvecTyyppArr;
955 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
956 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
957 if(sw==3)//DataArrayIdType
959 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
960 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
961 std::string name=argpt->getName();
963 ret->setName(name.c_str());
965 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
968 PyObject *buildPartAndReduceNodes(PyObject *li) const
970 mcIdType szArr,sw,iTypppArr;
971 std::vector<mcIdType> stdvecTyyppArr;
972 DataArrayIdType *arr=0;
973 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
974 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
975 if(sw==3)//DataArrayIdType
977 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
978 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
979 std::string name=argpt->getName();
981 ret->setName(name.c_str());
984 PyObject *res = PyList_New(2);
985 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
986 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
987 PyList_SetItem(res,0,obj0);
988 PyList_SetItem(res,1,obj1);
992 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
995 DataArrayIdType *arr=0;
996 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
997 PyObject *res = PyTuple_New(2);
998 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1001 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1003 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1004 PyTuple_SetItem(res,0,obj0);
1005 PyTuple_SetItem(res,1,obj1);
1009 PyObject *getDistributionOfTypes() const
1011 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1012 if(vals.size()%3!=0)
1013 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1014 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1015 for(std::size_t j=0;j<vals.size()/3;j++)
1017 PyObject *ret1=PyList_New(3);
1018 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1019 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1020 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1021 PyList_SetItem(ret,j,ret1);
1026 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1028 std::vector<mcIdType> code;
1029 std::vector<const DataArrayIdType *> idsPerType;
1030 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1031 convertPyToNewIntArr4(li,1,3,code);
1032 return self->checkTypeConsistencyAndContig(code,idsPerType);
1035 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1037 std::vector<mcIdType> code;
1038 std::vector<DataArrayIdType *> idsInPflPerType;
1039 std::vector<DataArrayIdType *> idsPerType;
1040 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1041 PyObject *ret=PyTuple_New(3);
1043 if(code.size()%3!=0)
1044 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1045 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1046 for(std::size_t j=0;j<code.size()/3;j++)
1048 PyObject *ret00=PyList_New(3);
1049 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1050 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1051 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1052 PyList_SetItem(ret0,j,ret00);
1054 PyTuple_SetItem(ret,0,ret0);
1056 PyObject *ret1=PyList_New(idsInPflPerType.size());
1057 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1058 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1059 PyTuple_SetItem(ret,1,ret1);
1060 std::size_t n=idsPerType.size();
1061 PyObject *ret2=PyList_New(n);
1062 for(std::size_t i=0;i<n;i++)
1063 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1064 PyTuple_SetItem(ret,2,ret2);
1068 void translate(PyObject *vector)
1072 DataArrayDoubleTuple *aa;
1073 std::vector<double> bb;
1075 int spaceDim=self->getSpaceDimension();
1076 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1077 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1078 self->translate(vectorPtr);
1081 void rotate(PyObject *center, double alpha)
1083 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1086 DataArrayDoubleTuple *aa;
1087 std::vector<double> bb;
1089 int spaceDim=self->getSpaceDimension();
1090 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1091 self->rotate(centerPtr,0,alpha);
1094 void rotate(PyObject *center, PyObject *vector, double alpha)
1096 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1098 DataArrayDouble *a,*a2;
1099 DataArrayDoubleTuple *aa,*aa2;
1100 std::vector<double> bb,bb2;
1102 int spaceDim=self->getSpaceDimension();
1103 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1104 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
1105 self->rotate(centerPtr,vectorPtr,alpha);
1108 PyObject *getAllGeoTypes() const
1110 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1111 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1112 PyObject *res=PyList_New(result.size());
1113 for(int i=0;iL!=result.end(); i++, iL++)
1114 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1118 virtual PyObject *getTinySerializationInformation() const
1120 std::vector<double> a0;
1121 std::vector<mcIdType> a1;
1122 std::vector<std::string> a2;
1123 self->getTinySerializationInformation(a0,a1,a2);
1124 PyObject *ret(PyTuple_New(3));
1125 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1126 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1127 std::size_t sz(a2.size());
1128 PyObject *ret2(PyList_New(sz));
1130 for(std::size_t i=0;i<sz;i++)
1131 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1133 PyTuple_SetItem(ret,2,ret2);
1137 virtual PyObject *serialize() const
1139 DataArrayIdType *a0Tmp(0);
1140 DataArrayDouble *a1Tmp(0);
1141 self->serialize(a0Tmp,a1Tmp);
1142 PyObject *ret(PyTuple_New(2));
1143 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1144 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1148 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1150 std::vector<std::string> littleStrings;
1151 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1154 PyObject *__getstate__() const
1156 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1157 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1158 PyObject *ret(PyTuple_New(2));
1159 PyTuple_SetItem(ret,0,ret0);
1160 PyTuple_SetItem(ret,1,ret1);
1164 void __setstate__(PyObject *inp)
1166 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1167 if(!PyTuple_Check(inp))
1168 throw INTERP_KERNEL::Exception(MSG);
1169 std::size_t sz(PyTuple_Size(inp));
1171 throw INTERP_KERNEL::Exception(MSG);
1172 PyObject *elt0(PyTuple_GetItem(inp,0));
1173 PyObject *elt1(PyTuple_GetItem(inp,1));
1174 std::vector<double> a0;
1175 std::vector<mcIdType> a1;
1176 std::vector<std::string> a2;
1177 DataArrayIdType *b0(0);
1178 DataArrayDouble *b1(0);
1180 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1181 throw INTERP_KERNEL::Exception(MSG);
1182 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1184 fillArrayWithPyListDbl3(a0py,tmp,a0);
1185 convertPyToNewIntArr3(a1py,a1);
1186 fillStringVector(a2py,a2);
1189 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1190 throw INTERP_KERNEL::Exception(MSG);
1191 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1193 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1194 if(!SWIG_IsOK(status))
1195 throw INTERP_KERNEL::Exception(MSG);
1196 b0=reinterpret_cast<DataArrayIdType *>(argp);
1197 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1198 if(!SWIG_IsOK(status))
1199 throw INTERP_KERNEL::Exception(MSG);
1200 b1=reinterpret_cast<DataArrayDouble *>(argp);
1202 // useless here to call resizeForUnserialization because arrays are well resized.
1203 self->unserialization(a0,a1,b0,b1,a2);
1206 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1208 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1209 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1210 return MEDCouplingMesh::MergeMeshes(tmp);
1216 //== MEDCouplingMesh End
1218 %include "NormalizedGeometricTypes"
1219 %include "MEDCouplingNatureOfFieldEnum"
1221 namespace MEDCoupling
1223 class MEDCouplingNatureOfField
1226 static const char *GetRepr(NatureOfField nat);
1227 static std::string GetReprNoThrow(NatureOfField nat);
1228 static std::string GetAllPossibilitiesStr();
1232 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1233 // include "MEDCouplingTimeDiscretization.i"
1235 namespace MEDCoupling
1237 class MEDCouplingGaussLocalization
1240 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1241 const std::vector<double>& gsCoo, const std::vector<double>& w);
1242 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1243 INTERP_KERNEL::NormalizedCellType getType() const;
1244 void setType(INTERP_KERNEL::NormalizedCellType typ);
1245 int getNumberOfGaussPt() const;
1246 int getDimension() const;
1247 int getNumberOfPtsInRefCell() const;
1248 std::string getStringRepr() const;
1249 void checkConsistencyLight() const;
1250 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1252 const std::vector<double>& getRefCoords() const;
1253 double getRefCoord(int ptIdInCell, int comp) const;
1254 const std::vector<double>& getGaussCoords() const;
1255 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1256 const std::vector<double>& getWeights() const;
1257 double getWeight(int gaussPtIdInCell, double newVal) const;
1258 void setRefCoord(int ptIdInCell, int comp, double newVal);
1259 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1260 void setWeight(int gaussPtIdInCell, double newVal);
1261 void setRefCoords(const std::vector<double>& refCoo);
1262 void setGaussCoords(const std::vector<double>& gsCoo);
1263 void setWeights(const std::vector<double>& w);
1265 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1269 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1271 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1275 MEDCouplingUMesh *buildRefCell() const
1277 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1283 class MEDCouplingSkyLineArray
1286 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1288 void set( DataArrayIdType* index, DataArrayIdType* value );
1289 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1291 int getSuperNumberOf() const;
1292 int getNumberOf() const;
1293 int getLength() const;
1295 void deletePack(const int i, const int j);
1297 void deleteSimplePack(const int i);
1298 void deleteSimplePacks(const DataArrayIdType* idx);
1302 MEDCouplingSkyLineArray()
1304 return MEDCouplingSkyLineArray::New();
1307 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1309 return MEDCouplingSkyLineArray::New(index, value);
1312 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1314 return MEDCouplingSkyLineArray::New(index, value);
1317 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1319 return MEDCouplingSkyLineArray::New(other);
1322 std::string __str__() const
1324 return self->simpleRepr();
1327 DataArrayIdType *getSuperIndexArray() const
1329 DataArrayIdType *ret(self->getSuperIndexArray());
1335 DataArrayIdType *getIndexArray() const
1337 DataArrayIdType *ret(self->getIndexArray());
1343 DataArrayIdType *getValuesArray() const
1345 DataArrayIdType *ret(self->getValuesArray());
1351 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1353 std::vector<mcIdType> ret;
1354 self->getSimplePackSafe(absolutePackId,ret);
1355 return convertIntArrToPyList2(ret);
1358 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1360 std::vector<mcIdType> vpack, vspIdx, out;
1362 convertPyToNewIntArr3(superPackIndices,vspIdx);
1363 convertPyToNewIntArr3(pack,vpack);
1365 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1366 return convertIntArrToPyList2(out);
1369 void pushBackPack(const mcIdType i, PyObject *pack)
1371 std::vector<mcIdType> vpack;
1372 convertPyToNewIntArr3(pack,vpack);
1373 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1376 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1378 std::vector<mcIdType> vpack;
1379 convertPyToNewIntArr3(pack,vpack);
1380 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1383 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1385 std::vector<const DataArrayIdType*> packs;
1386 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1387 self->replaceSimplePacks(idx, packs);
1390 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1392 std::vector<mcIdType> vpack;
1393 convertPyToNewIntArr3(pack,vpack);
1394 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1397 PyObject *convertToPolyhedronConn() const
1399 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1400 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1401 self->convertToPolyhedronConn(d0,d1);
1402 PyObject *ret=PyTuple_New(2);
1403 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1404 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1411 %include "MEDCouplingFieldDiscretization.i"
1413 //== MEDCouplingPointSet
1415 namespace MEDCoupling
1417 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1420 void setCoords(const DataArrayDouble *coords);
1421 DataArrayDouble *getCoordinatesAndOwner() const;
1422 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1424 double getCaracteristicDimension() const;
1425 void recenterForMaxPrecision(double eps);
1426 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1427 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1428 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1429 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1430 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1431 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1432 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1433 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1434 virtual DataArrayIdType *computeFetchedNodeIds() const;
1435 virtual int getNumberOfNodesInCell(int cellId) const;
1436 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1437 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1438 virtual DataArrayIdType *zipCoordsTraducer();
1439 virtual DataArrayIdType *findBoundaryNodes() const;
1440 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1441 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1442 virtual void checkFullyDefined() const;
1443 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1444 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1445 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1446 virtual void renumberNodesWithOffsetInConn(int offset);
1447 virtual bool areAllNodesFetched() const;
1448 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1449 virtual void invertOrientationOfAllCells();
1452 std::string __str__() const
1454 return self->simpleRepr();
1457 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1459 mcIdType newNbOfNodes;
1460 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1461 PyObject *res = PyList_New(2);
1462 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1463 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1467 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1469 DataArrayIdType *comm, *commIndex;
1470 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1471 PyObject *res = PyList_New(2);
1472 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1473 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1477 PyObject *getCoords()
1479 DataArrayDouble *ret1=self->getCoords();
1482 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1485 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1487 mcIdType szArr,sw,iTypppArr;
1488 std::vector<mcIdType> stdvecTyyppArr;
1489 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1490 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1491 if(sw==3)//DataArrayIdType
1493 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1494 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1495 std::string name=argpt->getName();
1497 ret->setName(name.c_str());
1499 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1502 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1504 mcIdType szArr,sw,iTypppArr;
1505 std::vector<mcIdType> stdvecTyyppArr;
1506 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1507 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1508 if(sw==3)//DataArrayIdType
1510 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1511 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1512 std::string name=argpt->getName();
1514 ret->setName(name.c_str());
1516 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1519 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1521 mcIdType szArr,sw,iTypppArr;
1522 std::vector<mcIdType> stdvecTyyppArr;
1523 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1524 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1525 if(sw==3)//DataArrayIdType
1527 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1528 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1529 std::string name=argpt->getName();
1531 ret->setName(name.c_str());
1533 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1536 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1538 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1539 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1542 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1544 mcIdType szArr,sw,iTypppArr;
1545 std::vector<mcIdType> stdvecTyyppArr;
1546 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1547 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1548 if(sw==3)//DataArrayIdType
1550 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1551 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1552 std::string name=argpt->getName();
1554 ret->setName(name.c_str());
1556 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1559 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1561 mcIdType szArr,sw,iTypppArr;
1562 std::vector<mcIdType> stdvecTyyppArr;
1563 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1564 self->renumberNodes(tmp,newNbOfNodes);
1567 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1569 mcIdType szArr,sw,iTypppArr;
1570 std::vector<mcIdType> stdvecTyyppArr;
1571 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1572 self->renumberNodesCenter(tmp,newNbOfNodes);
1575 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1577 int spaceDim=self->getSpaceDimension();
1579 DataArrayDouble *a,*a2;
1580 DataArrayDoubleTuple *aa,*aa2;
1581 std::vector<double> bb,bb2;
1583 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1584 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1585 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1586 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1587 std::vector<mcIdType> nodes;
1588 self->findNodesOnLine(p,v,eps,nodes);
1589 DataArrayIdType *ret=DataArrayIdType::New();
1590 ret->alloc(nodes.size(),1);
1591 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1592 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1594 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1596 int spaceDim=self->getSpaceDimension();
1598 DataArrayDouble *a,*a2;
1599 DataArrayDoubleTuple *aa,*aa2;
1600 std::vector<double> bb,bb2;
1602 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1603 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1604 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1605 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1606 std::vector<mcIdType> nodes;
1607 self->findNodesOnPlane(p,v,eps,nodes);
1608 DataArrayIdType *ret=DataArrayIdType::New();
1609 ret->alloc(nodes.size(),1);
1610 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1611 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1614 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1618 DataArrayDoubleTuple *aa;
1619 std::vector<double> bb;
1621 int spaceDim=self->getSpaceDimension();
1622 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1623 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1624 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1625 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1628 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1630 DataArrayIdType *c=0,*cI=0;
1634 DataArrayDoubleTuple *aa;
1635 std::vector<double> bb;
1637 int spaceDim=self->getSpaceDimension();
1638 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1639 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1640 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1641 PyObject *ret=PyTuple_New(2);
1642 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1643 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1647 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1649 DataArrayIdType *c=0,*cI=0;
1650 int spaceDim=self->getSpaceDimension();
1653 DataArrayDoubleTuple *aa;
1654 std::vector<double> bb;
1656 mcIdType nbOfTuples=-1;
1657 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1658 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1660 PyObject *ret=PyTuple_New(2);
1661 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1662 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1666 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1670 DataArrayDoubleTuple *aa;
1671 std::vector<double> bb;
1673 int spaceDim=self->getSpaceDimension();
1674 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1675 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1677 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1678 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1681 void duplicateNodesInCoords(PyObject *li)
1685 std::vector<mcIdType> multiVal;
1686 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1687 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1688 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1692 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1694 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1696 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1698 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1702 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1704 DataArrayIdType *v0(nullptr),*v1(nullptr);
1705 self->findCommonCells(compType,startCellId,v0,v1);
1706 PyObject *res = PyList_New(2);
1707 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1708 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1713 virtual void renumberNodesInConn(PyObject *li)
1717 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1720 MapII *da2(reinterpret_cast<MapII *>(da));
1721 self->renumberNodesInConn(da2->data());
1725 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1726 if (!SWIG_IsOK(res1))
1729 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1730 self->renumberNodesInConn(tmp);
1734 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1736 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1737 da2->checkAllocated();
1738 self->renumberNodesInConn(da2->getConstPointer());
1742 virtual PyObject *getNodeIdsInUse() const
1745 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1746 PyObject *ret=PyTuple_New(2);
1747 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1748 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1752 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1754 DataArrayIdType *ret(nullptr);
1756 mcIdType szArr,sw,iTypppArr;
1757 std::vector<mcIdType> stdvecTyyppArr;
1758 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1759 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1763 virtual PyObject *mergeNodes(double precision)
1767 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1768 PyObject *res = PyList_New(3);
1769 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1770 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1771 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1775 virtual PyObject *mergeNodesCenter(double precision)
1779 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1780 PyObject *res = PyList_New(3);
1781 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1782 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1783 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1787 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1790 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1791 if (!SWIG_IsOK(res1))
1794 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1795 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1799 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1801 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1802 da2->checkAllocated();
1803 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1807 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1811 std::vector<mcIdType> multiVal;
1812 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1813 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1814 mcIdType nbc=self->getNumberOfCells();
1815 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1822 std::ostringstream oss;
1823 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1824 throw INTERP_KERNEL::Exception(oss.str().c_str());
1827 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1832 mcIdType tmp=nbc+singleVal;
1833 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1837 std::ostringstream oss;
1838 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1839 throw INTERP_KERNEL::Exception(oss.str().c_str());
1845 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1849 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1854 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1855 daIntTyypp->checkAllocated();
1856 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1859 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1863 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1866 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1867 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1868 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1869 for(mcIdType i=0;i<sz;i++)
1870 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1873 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1876 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1877 mcIdType sw,nbNodes=0;
1878 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1879 std::vector<double> val3;
1880 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1881 "Rotate2DAlg",2,true,nbNodes);
1883 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1884 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1887 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1890 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1891 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1892 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1893 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1894 for(mcIdType i=0;i<sz;i++)
1895 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1898 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1901 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1902 mcIdType sw,nbNodes=0;
1903 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1904 std::vector<double> val3;
1905 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1906 "Rotate3DAlg",3,true,nbNodes);
1908 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1909 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1910 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1915 //== MEDCouplingPointSet End
1917 class MEDCouplingUMeshCell
1920 INTERP_KERNEL::NormalizedCellType getType() const;
1923 std::string __str__() const
1925 return self->repr();
1928 PyObject *getAllConn() const
1931 const mcIdType *r=self->getAllConn(ret2);
1932 PyObject *ret=PyTuple_New(ret2);
1933 for(mcIdType i=0;i<ret2;i++)
1934 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1940 class MEDCouplingUMeshCellIterator
1947 MEDCouplingUMeshCell *ret=self->nextt();
1949 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1952 PyErr_SetString(PyExc_StopIteration,"No more data.");
1959 class MEDCouplingUMeshCellByTypeIterator
1962 ~MEDCouplingUMeshCellByTypeIterator();
1967 MEDCouplingUMeshCellEntry *ret=self->nextt();
1969 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1972 PyErr_SetString(PyExc_StopIteration,"No more data.");
1979 class MEDCouplingUMeshCellByTypeEntry
1982 ~MEDCouplingUMeshCellByTypeEntry();
1985 MEDCouplingUMeshCellByTypeIterator *__iter__()
1987 return self->iterator();
1992 class MEDCouplingUMeshCellEntry
1995 INTERP_KERNEL::NormalizedCellType getType() const;
1996 int getNumberOfElems() const;
1999 MEDCouplingUMeshCellIterator *__iter__()
2001 return self->iterator();
2006 //== MEDCouplingUMesh
2008 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2011 static MEDCouplingUMesh *New();
2012 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2013 void checkConsistencyLight() const;
2014 void setMeshDimension(int meshDim);
2015 void allocateCells(int nbOfCells=0);
2016 void finishInsertingCells();
2017 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2018 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2019 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2020 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2021 int getNodalConnectivityArrayLen() const;
2022 void computeTypes();
2023 std::string reprConnectivityOfThis() const;
2024 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2026 DataArrayIdType *conformize2D(double eps);
2027 DataArrayIdType *conformize3D(double eps);
2028 DataArrayIdType *colinearize2D(double eps);
2029 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2030 void shiftNodeNumbersInConn(int delta);
2031 std::vector<bool> getQuadraticStatus() const;
2032 DataArrayIdType *findCellIdsOnBoundary() const;
2033 MEDCouplingUMesh *computeSkin() const;
2034 bool checkConsecutiveCellTypes() const;
2035 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2036 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2037 DataArrayIdType *sortCellsInMEDFileFrmt();
2038 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2039 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2040 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2041 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2042 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2043 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2044 void orientCorrectlyPolyhedrons();
2045 bool isPresenceOfQuadratic() const;
2046 bool isFullyQuadratic() const;
2047 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2048 bool isContiguous1D() const;
2049 void tessellate2D(double eps);
2050 void convertQuadraticCellsToLinear();
2051 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2052 void convertDegeneratedCells();
2053 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2054 bool removeDegenerated1DCells();
2055 bool areOnlySimplexCells() const;
2056 MEDCouplingFieldDouble *getEdgeRatioField() const;
2057 MEDCouplingFieldDouble *getAspectRatioField() const;
2058 MEDCouplingFieldDouble *getWarpField() const;
2059 MEDCouplingFieldDouble *getSkewField() const;
2060 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2061 DataArrayIdType *convexEnvelop2D();
2062 std::string cppRepr() const;
2063 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2064 DataArrayIdType *findAndCorrectBadOriented3DCells();
2065 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2066 MEDCouplingSkyLineArray *generateGraph() const;
2067 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2068 DataArrayIdType *buildUnionOf2DMesh() const;
2069 DataArrayIdType *buildUnionOf3DMesh() const;
2070 DataArrayIdType *orderConsecutiveCells1D() const;
2071 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2072 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2073 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2074 void changeOrientationOfCells();
2075 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2076 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2077 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2078 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2079 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2080 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2081 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2085 return MEDCouplingUMesh::New();
2088 MEDCouplingUMesh(const char *meshName, int meshDim)
2090 return MEDCouplingUMesh::New(meshName,meshDim);
2093 std::string __str__() const
2095 return self->simpleRepr();
2098 std::string __repr__() const
2100 std::ostringstream oss;
2101 self->reprQuickOverview(oss);
2105 MEDCouplingUMeshCellIterator *__iter__()
2107 return self->cellIterator();
2110 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2112 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2116 PyObject *getAllGeoTypesSorted() const
2118 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2119 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2120 PyObject *res=PyList_New(result.size());
2121 for(int i=0;iL!=result.end(); i++, iL++)
2122 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2126 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2130 std::vector<mcIdType> multiVal;
2131 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2132 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2133 mcIdType nbc=self->getNumberOfCells();
2134 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2141 std::ostringstream oss;
2142 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2143 throw INTERP_KERNEL::Exception(oss.str().c_str());
2147 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2154 mcIdType tmp=nbc+singleVal;
2155 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2160 std::ostringstream oss;
2161 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2162 throw INTERP_KERNEL::Exception(oss.str().c_str());
2168 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2174 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2175 daIntTyypp->checkAllocated();
2176 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2180 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2184 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2188 std::vector<mcIdType> multiVal;
2189 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2190 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2191 mcIdType nbc=self->getNumberOfCells();
2192 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2199 std::ostringstream oss;
2200 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2201 throw INTERP_KERNEL::Exception(oss.str().c_str());
2205 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2212 mcIdType tmp=nbc+singleVal;
2213 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2218 std::ostringstream oss;
2219 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2220 throw INTERP_KERNEL::Exception(oss.str().c_str());
2226 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2231 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2237 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2238 daIntTyypp->checkAllocated();
2239 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2243 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2247 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2249 mcIdType szArr,sw,iTypppArr;
2250 std::vector<mcIdType> stdvecTyyppArr;
2251 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2254 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2255 throw INTERP_KERNEL::Exception(oss.str().c_str());
2257 self->insertNextCell(type,size,tmp);
2260 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2262 mcIdType szArr,sw,iTypppArr;
2263 std::vector<mcIdType> stdvecTyyppArr;
2264 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2265 self->insertNextCell(type,szArr,tmp);
2268 DataArrayIdType *getNodalConnectivity()
2270 DataArrayIdType *ret=self->getNodalConnectivity();
2275 DataArrayIdType *getNodalConnectivityIndex()
2277 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2283 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2285 mcIdType szArr,sw,iTypppArr;
2286 std::vector<mcIdType> stdvecTyyppArr;
2287 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2288 mcIdType nbOfDepthPeelingPerformed=0;
2289 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2290 PyObject *res=PyTuple_New(2);
2291 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2292 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2296 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2298 DataArrayIdType *v0=0,*v1=0;
2299 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2300 PyObject *res = PyList_New(2);
2301 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2302 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2306 PyObject *distanceToPoint(PyObject *point) const
2310 DataArrayDoubleTuple *aa;
2311 std::vector<double> bb;
2313 int nbOfCompo=self->getSpaceDimension();
2314 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2317 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2318 PyObject *ret=PyTuple_New(2);
2319 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2320 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2324 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2326 DataArrayIdType *ret1=0;
2327 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2328 PyObject *ret=PyTuple_New(2);
2329 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2330 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2334 PyObject *tetrahedrize(int policy)
2337 DataArrayIdType *ret1(0);
2338 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2339 PyObject *ret=PyTuple_New(3);
2340 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2341 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2346 PyObject *checkButterflyCells(double eps=1e-12)
2348 std::vector<mcIdType> cells;
2349 self->checkButterflyCells(cells,eps);
2350 DataArrayIdType *ret=DataArrayIdType::New();
2351 ret->alloc(cells.size(),1);
2352 std::copy(cells.begin(),cells.end(),ret->getPointer());
2353 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2356 PyObject *splitByType() const
2358 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2359 std::size_t sz=ms.size();
2360 PyObject *ret = PyList_New(sz);
2361 for(std::size_t i=0;i<sz;i++)
2362 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2366 PyObject *partitionBySpreadZone() const
2368 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2369 std::size_t sz=retCpp.size();
2370 PyObject *ret=PyList_New(sz);
2371 for(std::size_t i=0;i<sz;i++)
2372 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2376 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2378 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2379 std::size_t sz=retCpp.size();
2380 PyObject *ret=PyList_New(sz);
2381 for(std::size_t i=0;i<sz;i++)
2382 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2386 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2389 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2390 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2391 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2394 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2397 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2398 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2402 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2405 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2406 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2410 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2412 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2413 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2414 PyObject *ret=PyTuple_New(3);
2415 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2416 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2417 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2421 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2423 DataArrayIdType *tmp0=0,*tmp1=0;
2424 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2425 PyObject *ret=PyTuple_New(2);
2426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2431 void duplicateNodes(PyObject *li)
2435 std::vector<mcIdType> multiVal;
2436 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2437 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2438 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2442 return self->duplicateNodes(&singleVal,&singleVal+1);
2444 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2446 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2448 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2452 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2456 std::vector<mcIdType> multiVal;
2457 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2458 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2459 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2463 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2465 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2467 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2469 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2473 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2475 mcIdType szArr,sw,iTypppArr;
2476 std::vector<mcIdType> stdvecTyyppArr;
2477 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2478 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2481 PyObject *getLevArrPerCellTypes(PyObject *li) const
2484 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2485 DataArrayIdType *tmp0,*tmp1=0;
2486 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2487 PyObject *ret=PyTuple_New(2);
2488 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2489 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2493 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2495 DataArrayIdType *ret0=0,*ret1=0;
2496 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2497 PyObject *ret=PyTuple_New(2);
2498 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2499 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2503 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2505 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2506 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2507 DataArrayIdType *ret1=0,*ret2=0;
2508 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2509 PyObject *ret=PyTuple_New(3);
2510 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2511 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2512 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2516 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2518 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2519 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2520 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2521 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2524 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2527 std::vector<const MEDCouplingUMesh *> meshes;
2528 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2529 std::vector<DataArrayIdType *> corr;
2530 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2532 PyObject *ret1=PyList_New(sz);
2533 for(std::size_t i=0;i<sz;i++)
2534 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2535 PyObject *ret=PyList_New(2);
2536 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2537 PyList_SetItem(ret,1,ret1);
2541 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2543 std::vector<MEDCouplingUMesh *> meshes;
2544 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2545 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2548 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2550 std::vector<MEDCouplingUMesh *> meshes;
2551 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2552 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2555 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2559 DataArrayDoubleTuple *aa;
2560 std::vector<double> bb;
2562 int spaceDim=self->getSpaceDimension();
2563 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2564 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2566 std::vector<mcIdType> cells;
2567 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2568 DataArrayIdType *ret=DataArrayIdType::New();
2569 ret->alloc(cells.size(),1);
2570 std::copy(cells.begin(),cells.end(),ret->getPointer());
2571 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2574 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2578 DataArrayDoubleTuple *aa;
2579 std::vector<double> bb;
2581 int spaceDim=self->getSpaceDimension();
2582 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2583 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2584 self->orientCorrectly2DCells(v,polyOnly);
2587 PyObject *arePolyhedronsNotCorrectlyOriented() const
2589 std::vector<mcIdType> cells;
2590 self->arePolyhedronsNotCorrectlyOriented(cells);
2591 DataArrayIdType *ret=DataArrayIdType::New();
2592 ret->alloc(cells.size(),1);
2593 std::copy(cells.begin(),cells.end(),ret->getPointer());
2594 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2597 PyObject *getFastAveragePlaneOfThis() const
2601 self->getFastAveragePlaneOfThis(vec,pos);
2603 std::copy(vec,vec+3,vals);
2604 std::copy(pos,pos+3,vals+3);
2605 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2608 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2610 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2611 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2612 return MEDCouplingUMesh::MergeUMeshes(tmp);
2615 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2617 DataArrayIdType *ret1;
2618 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2619 PyObject *ret=PyTuple_New(2);
2620 PyObject *ret0Py=ret0?Py_True:Py_False;
2622 PyTuple_SetItem(ret,0,ret0Py);
2623 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2627 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2629 DataArrayIdType *ret1;
2630 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2631 PyObject *ret=PyTuple_New(2);
2632 PyObject *ret0Py=ret0?Py_True:Py_False;
2634 PyTuple_SetItem(ret,0,ret0Py);
2635 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2639 PyObject *explode3DMeshTo1D() const
2641 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2642 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2643 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2644 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2645 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2646 PyObject *ret=PyTuple_New(5);
2647 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2648 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2649 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2650 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2651 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2655 PyObject *explodeIntoEdges() const
2657 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2658 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2659 PyObject *ret=PyTuple_New(5);
2660 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2661 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2662 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2663 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2664 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2668 PyObject *explodeMeshIntoMicroEdges() const
2670 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2671 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2672 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2673 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2674 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2675 PyObject *ret=PyTuple_New(5);
2676 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2677 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2678 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2679 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2680 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2684 PyObject *buildDescendingConnectivity() const
2686 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2687 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2688 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2689 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2690 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2691 PyObject *ret=PyTuple_New(5);
2692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2696 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2700 PyObject *buildDescendingConnectivity2() const
2702 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2703 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2704 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2705 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2706 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2707 PyObject *ret=PyTuple_New(5);
2708 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2709 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2710 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2711 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2712 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2716 PyObject *computeNeighborsOfCells() const
2718 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2719 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2720 PyObject *ret=PyTuple_New(2);
2721 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2722 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2726 PyObject *computeNeighborsOfNodes() const
2728 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2729 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2730 PyObject *ret=PyTuple_New(2);
2731 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2732 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2736 PyObject *computeEnlargedNeighborsOfNodes() const
2738 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2739 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2740 PyObject *ret=PyTuple_New(2);
2741 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2746 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2748 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2749 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2750 PyObject *ret=PyTuple_New(2);
2751 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2752 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2756 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2758 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2759 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2760 PyObject *ret=PyTuple_New(2);
2761 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2766 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2768 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2769 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2770 DataArrayIdType *d2,*d3,*d4,*dd5;
2771 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2772 PyObject *ret=PyTuple_New(7);
2773 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2774 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2775 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2776 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2777 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2778 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2779 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2783 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2786 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2787 da->checkAllocated();
2788 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2791 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2794 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2795 da->checkAllocated();
2796 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2799 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2802 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2803 da->checkAllocated();
2804 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2807 PyObject *getTypesOfPart(DataArrayIdType *da) const
2810 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2811 da->checkAllocated();
2812 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2813 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2814 PyObject *res = PyList_New(result.size());
2815 for (int i=0;iL!=result.end(); i++, iL++)
2816 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2820 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2823 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2824 da->checkAllocated();
2825 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2826 ret->setName(da->getName().c_str());
2830 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2832 DataArrayIdType *cellNb1=0,*cellNb2=0;
2833 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2834 PyObject *ret=PyTuple_New(3);
2835 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2836 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2837 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2841 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2843 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2844 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2845 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2846 PyObject *ret(PyTuple_New(4));
2847 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2848 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2849 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2850 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2854 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2856 int spaceDim=self->getSpaceDimension();
2858 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2860 DataArrayDouble *a,*a2;
2861 DataArrayDoubleTuple *aa,*aa2;
2862 std::vector<double> bb,bb2;
2864 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2865 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2866 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2867 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2869 DataArrayIdType *cellIds=0;
2870 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2871 PyObject *ret=PyTuple_New(2);
2872 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2873 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2877 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2879 int spaceDim=self->getSpaceDimension();
2881 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2883 DataArrayDouble *a,*a2;
2884 DataArrayDoubleTuple *aa,*aa2;
2885 std::vector<double> bb,bb2;
2887 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2888 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2889 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2890 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2892 DataArrayIdType *cellIds=0;
2893 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2894 PyObject *ret=PyTuple_New(2);
2895 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2896 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2900 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2903 DataArrayDouble *a,*a2;
2904 DataArrayDoubleTuple *aa,*aa2;
2905 std::vector<double> bb,bb2;
2907 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2908 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2909 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2910 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2911 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2915 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2917 int spaceDim=self->getSpaceDimension();
2919 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2921 DataArrayDouble *a,*a2;
2922 DataArrayDoubleTuple *aa,*aa2;
2923 std::vector<double> bb,bb2;
2925 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2926 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2927 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2928 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2929 return self->getCellIdsCrossingPlane(orig,vect,eps);
2932 void convertToPolyTypes(PyObject *li)
2936 std::vector<mcIdType> pos2;
2937 DataArrayIdType *pos3=0;
2938 DataArrayIdTypeTuple *pos4=0;
2939 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2944 self->convertToPolyTypes(&pos1,&pos1+1);
2951 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2956 self->convertToPolyTypes(pos3->begin(),pos3->end());
2960 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2964 void convertAllToPoly();
2965 void convertExtrudedPolyhedra();
2967 void simplifyPolyhedra(double eps);
2968 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2969 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2972 //== MEDCouplingUMesh End
2974 //== MEDCouplingMappedExtrudedMesh
2976 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2979 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2980 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2981 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2982 int get2DCellIdForExtrusion() const;
2984 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
2986 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2989 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2991 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2994 MEDCouplingMappedExtrudedMesh()
2996 return MEDCouplingMappedExtrudedMesh::New();
2999 std::string __str__() const
3001 return self->simpleRepr();
3004 std::string __repr__() const
3006 std::ostringstream oss;
3007 self->reprQuickOverview(oss);
3011 PyObject *getMesh2D() const
3013 MEDCouplingUMesh *ret=self->getMesh2D();
3016 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3018 PyObject *getMesh1D() const
3020 MEDCouplingUMesh *ret=self->getMesh1D();
3023 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3025 PyObject *getMesh3DIds() const
3027 DataArrayIdType *ret=self->getMesh3DIds();
3030 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3035 //== MEDCouplingMappedExtrudedMesh End
3037 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3040 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3041 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3042 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3043 int getNodalConnectivityLength() const;
3044 virtual void allocateCells(int nbOfCells=0);
3045 virtual void checkConsistencyOfConnectivity() const;
3048 virtual void insertNextCell(PyObject *li)
3050 mcIdType szArr,sw,iTypppArr;
3051 std::vector<mcIdType> stdvecTyyppArr;
3052 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3053 self->insertNextCell(tmp,tmp+szArr);
3056 virtual DataArrayIdType *getNodalConnectivity() const
3058 DataArrayIdType *ret=self->getNodalConnectivity();
3059 if(ret) ret->incrRef();
3063 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3065 std::vector< const MEDCoupling1GTUMesh *> parts;
3066 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3067 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3072 //== MEDCoupling1SGTUMesh
3074 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3077 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3078 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3079 void setNodalConnectivity(DataArrayIdType *nodalConn);
3080 int getNumberOfNodesPerCell() const;
3081 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3082 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3083 MEDCoupling1GTUMesh *computeDualMesh() const;
3084 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3085 DataArrayIdType *sortHexa8EachOther();
3088 MEDCoupling1SGTUMesh()
3090 return MEDCoupling1SGTUMesh::New();
3093 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3095 return MEDCoupling1SGTUMesh::New(name,type);
3098 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3100 return MEDCoupling1SGTUMesh::New(m);
3103 std::string __str__() const
3105 return self->simpleRepr();
3108 std::string __repr__() const
3110 std::ostringstream oss;
3111 self->reprQuickOverview(oss);
3115 PyObject *structurizeMe(double eps=1e-12) const
3117 DataArrayIdType *cellPerm(0),*nodePerm(0);
3118 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3119 PyObject *ret(PyTuple_New(3));
3120 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3121 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3122 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3126 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3128 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3129 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3130 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3133 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3135 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3136 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3137 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3142 //== MEDCoupling1SGTUMesh End
3144 //== MEDCoupling1DGTUMesh
3146 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3149 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3150 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3151 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3152 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3153 bool isPacked() const;
3156 MEDCoupling1DGTUMesh()
3158 return MEDCoupling1DGTUMesh::New();
3160 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3162 return MEDCoupling1DGTUMesh::New(name,type);
3165 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3167 return MEDCoupling1DGTUMesh::New(m);
3170 std::string __str__() const
3172 return self->simpleRepr();
3175 std::string __repr__() const
3177 std::ostringstream oss;
3178 self->reprQuickOverview(oss);
3182 DataArrayIdType *getNodalConnectivityIndex() const
3184 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3185 if(ret) ret->incrRef();
3189 PyObject *retrievePackedNodalConnectivity() const
3191 DataArrayIdType *ret1=0,*ret2=0;
3192 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3193 PyObject *ret0Py=ret0?Py_True:Py_False;
3195 PyObject *ret=PyTuple_New(3);
3196 PyTuple_SetItem(ret,0,ret0Py);
3197 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3198 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3202 PyObject *copyWithNodalConnectivityPacked() const
3205 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3206 PyObject *ret=PyTuple_New(2);
3207 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3208 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3209 PyTuple_SetItem(ret,1,ret1Py);
3213 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3215 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3216 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3217 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3220 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3222 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3223 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3224 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3227 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3229 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3230 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3231 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3236 //== MEDCoupling1DGTUMeshEnd
3238 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3241 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3242 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3243 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3244 int getSpaceDimensionOnNodeStruct() const;
3245 double computeSquareness() const;
3246 virtual std::vector<mcIdType> getNodeGridStructure() const;
3247 std::vector<mcIdType> getCellGridStructure() const;
3248 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3249 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3250 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3251 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3252 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3253 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3254 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3255 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3258 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3260 mcIdType tmpp1=-1,tmpp2=-1;
3261 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3262 std::vector< std::pair<mcIdType,mcIdType> > inp;
3266 for(mcIdType i=0;i<tmpp1;i++)
3267 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3272 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3273 inp.resize(tmpp1/2);
3274 for(mcIdType i=0;i<tmpp1/2;i++)
3275 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3278 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3279 return self->buildStructuredSubPart(inp);
3282 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3284 std::vector< std::pair<mcIdType,mcIdType> > inp;
3285 convertPyToVectorPairInt(part,inp);
3287 mcIdType szArr,sw,iTypppArr;
3288 std::vector<mcIdType> stdvecTyyppArr;
3289 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3290 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3292 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3295 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3297 std::vector< std::pair<mcIdType,mcIdType> > inp;
3298 convertPyToVectorPairInt(part,inp);
3299 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3302 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3304 std::vector< std::pair<mcIdType,mcIdType> > inp;
3305 convertPyToVectorPairInt(part,inp);
3306 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3309 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3311 std::vector< std::pair<mcIdType,mcIdType> > inp;
3312 convertPyToVectorPairInt(part,inp);
3313 std::vector<mcIdType> stWithGhost;
3314 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3315 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3316 PyObject *ret(PyTuple_New(2));
3317 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3318 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3322 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3324 std::vector< std::pair<mcIdType,mcIdType> > inp;
3325 convertPyToVectorPairInt(partCompactFormat,inp);
3326 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3329 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3331 std::vector< std::pair<mcIdType,mcIdType> > inp;
3332 convertPyToVectorPairInt(partCompactFormat,inp);
3333 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3336 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3338 std::vector< std::pair<mcIdType,mcIdType> > inp;
3339 convertPyToVectorPairInt(part,inp);
3340 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3343 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3345 mcIdType szArr,sw,iTypppArr;
3346 std::vector<mcIdType> stdvecTyyppArr;
3347 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3348 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3351 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3353 mcIdType szArr,sw,iTypppArr;
3354 std::vector<mcIdType> stdvecTyyppArr;
3355 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3356 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3359 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3361 std::vector< std::pair<mcIdType,mcIdType> > inp;
3362 convertPyToVectorPairInt(partCompactFormat,inp);
3363 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3366 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3368 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3369 PyObject *retPy=PyList_New(ret.size());
3370 for(std::size_t i=0;i<ret.size();i++)
3372 PyObject *tmp=PyTuple_New(2);
3373 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3374 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3375 PyList_SetItem(retPy,i,tmp);
3380 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3382 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3383 convertPyToVectorPairInt(r1,r1Cpp);
3384 convertPyToVectorPairInt(r2,r2Cpp);
3385 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3386 PyObject *retPy=PyList_New(ret.size());
3387 for(std::size_t i=0;i<ret.size();i++)
3389 PyObject *tmp=PyTuple_New(2);
3390 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3391 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3392 PyList_SetItem(retPy,i,tmp);
3397 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3399 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3400 convertPyToVectorPairInt(r1,r1Cpp);
3401 convertPyToVectorPairInt(r2,r2Cpp);
3402 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3405 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3407 mcIdType szArr,sw,iTypppArr;
3408 std::vector<mcIdType> stdvecTyyppArr;
3409 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3410 mcIdType szArr2,sw2,iTypppArr2;
3411 std::vector<mcIdType> stdvecTyyppArr2;
3412 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3413 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3414 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3415 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3416 PyObject *ret=PyTuple_New(2);
3417 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3418 PyTuple_SetItem(ret,0,ret0Py);
3419 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3420 for(std::size_t i=0;i<partCompactFormat.size();i++)
3422 PyObject *tmp4=PyTuple_New(2);
3423 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3424 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3425 PyList_SetItem(ret1Py,i,tmp4);
3427 PyTuple_SetItem(ret,1,ret1Py);
3431 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3433 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3434 convertPyToVectorPairInt(bigInAbs,param0);
3435 convertPyToVectorPairInt(partOfBigInAbs,param1);
3436 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3437 PyObject *retPy(PyList_New(ret.size()));
3438 for(std::size_t i=0;i<ret.size();i++)
3440 PyObject *tmp(PyTuple_New(2));
3441 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3442 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3443 PyList_SetItem(retPy,i,tmp);
3448 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3450 std::vector< std::pair<mcIdType,mcIdType> > param0;
3451 convertPyToVectorPairInt(part,param0);
3452 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3453 PyObject *retPy(PyList_New(ret.size()));
3454 for(std::size_t i=0;i<ret.size();i++)
3456 PyObject *tmp(PyTuple_New(2));
3457 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3458 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3459 PyList_SetItem(retPy,i,tmp);
3464 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3466 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3467 convertPyToVectorPairInt(startingFrom,param0);
3468 convertPyToVectorPairInt(goingTo,param1);
3469 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3472 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3474 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3475 convertPyToVectorPairInt(bigInAbs,param0);
3476 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3477 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3478 PyObject *retPy(PyList_New(ret.size()));
3479 for(std::size_t i=0;i<ret.size();i++)
3481 PyObject *tmp(PyTuple_New(2));
3482 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3483 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3484 PyList_SetItem(retPy,i,tmp);
3491 class MEDCouplingCurveLinearMesh;
3493 //== MEDCouplingCMesh
3495 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3498 static MEDCouplingCMesh *New();
3499 static MEDCouplingCMesh *New(const std::string& meshName);
3500 void setCoords(const DataArrayDouble *coordsX,
3501 const DataArrayDouble *coordsY=0,
3502 const DataArrayDouble *coordsZ=0);
3503 void setCoordsAt(int i, const DataArrayDouble *arr);
3504 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3508 return MEDCouplingCMesh::New();
3510 MEDCouplingCMesh(const std::string& meshName)
3512 return MEDCouplingCMesh::New(meshName);
3514 std::string __str__() const
3516 return self->simpleRepr();
3518 std::string __repr__() const
3520 std::ostringstream oss;
3521 self->reprQuickOverview(oss);
3524 DataArrayDouble *getCoordsAt(int i)
3526 DataArrayDouble *ret=self->getCoordsAt(i);
3534 //== MEDCouplingCMesh End
3536 //== MEDCouplingCurveLinearMesh
3538 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3541 static MEDCouplingCurveLinearMesh *New();
3542 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3543 void setCoords(const DataArrayDouble *coords);
3545 MEDCouplingCurveLinearMesh()
3547 return MEDCouplingCurveLinearMesh::New();
3549 MEDCouplingCurveLinearMesh(const std::string& meshName)
3551 return MEDCouplingCurveLinearMesh::New(meshName);
3553 std::string __str__() const
3555 return self->simpleRepr();
3557 std::string __repr__() const
3559 std::ostringstream oss;
3560 self->reprQuickOverview(oss);
3563 DataArrayDouble *getCoords()
3565 DataArrayDouble *ret=self->getCoords();
3570 void setNodeGridStructure(PyObject *gridStruct)
3572 mcIdType szArr,sw,iTypppArr;
3573 std::vector<mcIdType> stdvecTyyppArr;
3574 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3575 self->setNodeGridStructure(tmp,tmp+szArr);
3580 //== MEDCouplingCurveLinearMesh End
3582 //== MEDCouplingIMesh
3584 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3587 static MEDCouplingIMesh *New();
3589 void setSpaceDimension(int spaceDim);
3590 std::vector<mcIdType> getNodeStruct() const;
3591 std::vector<double> getOrigin() const;
3592 std::vector<double> getDXYZ() const;
3593 void setAxisUnit(const std::string& unitName);
3594 std::string getAxisUnit() const;
3595 double getMeasureOfAnyCell() const;
3596 MEDCouplingCMesh *convertToCartesian() const;
3597 void refineWithFactor(const std::vector<mcIdType>& factors);
3598 MEDCouplingIMesh *asSingleCell() const;
3599 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3604 return MEDCouplingIMesh::New();
3606 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3608 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3609 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3610 const mcIdType *nodeStrctPtr(0);
3611 const double *originPtr(0),*dxyzPtr(0);
3612 mcIdType sw,sz,val0;
3613 std::vector<mcIdType> bb0;
3614 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3617 std::vector<double> bb,bb2;
3619 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3620 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3622 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3625 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3627 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3630 void setNodeStruct(PyObject *nodeStrct)
3632 mcIdType sw,sz,val0;
3633 std::vector<mcIdType> bb0;
3634 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3635 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3638 void setOrigin(PyObject *origin)
3640 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3642 std::vector<double> bb;
3643 mcIdType sw,nbTuples;
3644 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3645 self->setOrigin(originPtr,originPtr+nbTuples);
3648 void setDXYZ(PyObject *dxyz)
3650 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3652 std::vector<double> bb;
3653 mcIdType sw,nbTuples;
3654 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3655 self->setDXYZ(originPtr,originPtr+nbTuples);
3658 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3660 std::vector< std::pair<mcIdType,mcIdType> > inp;
3661 convertPyToVectorPairInt(fineLocInCoarse,inp);
3662 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3665 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3667 std::vector< std::pair<mcIdType,mcIdType> > inp;
3668 convertPyToVectorPairInt(fineLocInCoarse,inp);
3669 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3672 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3674 std::vector< std::pair<mcIdType,mcIdType> > inp;
3675 convertPyToVectorPairInt(fineLocInCoarse,inp);
3676 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3679 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3681 std::vector< std::pair<mcIdType,mcIdType> > inp;
3682 convertPyToVectorPairInt(fineLocInCoarse,inp);
3683 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3686 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3688 std::vector< std::pair<mcIdType,mcIdType> > inp;
3689 convertPyToVectorPairInt(fineLocInCoarse,inp);
3690 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3693 std::string __str__() const
3695 return self->simpleRepr();
3697 std::string __repr__() const
3699 std::ostringstream oss;
3700 self->reprQuickOverview(oss);
3706 //== MEDCouplingIMesh End
3710 namespace MEDCoupling
3712 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3715 virtual void checkConsistencyLight() const;
3716 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3717 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3718 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3719 void setName(const char *name);
3720 std::string getDescription() const;
3721 void setDescription(const char *desc);
3722 std::string getName() const;
3723 TypeOfField getTypeOfField() const;
3724 NatureOfField getNature() const;
3725 virtual void setNature(NatureOfField nat);
3726 DataArrayDouble *getLocalizationOfDiscr() const;
3727 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3728 mcIdType getNumberOfTuplesExpected() const;
3729 mcIdType getNumberOfMeshPlacesExpected() const;
3730 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3731 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3732 void clearGaussLocalizations();
3733 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3734 mcIdType getNbOfGaussLocalization() const;
3735 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3736 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3737 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3738 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3740 PyObject *getMesh() const
3742 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3745 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3748 PyObject *getDiscretization()
3750 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3753 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3756 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3758 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3759 return convertIntArrToPyList3(ret);
3762 PyObject *buildSubMeshData(PyObject *li) const
3764 DataArrayIdType *ret1=0;
3765 MEDCouplingMesh *ret0=0;
3767 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3768 if (!SWIG_IsOK(res1))
3771 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3772 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3776 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3778 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3779 da2->checkAllocated();
3780 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3782 PyObject *res = PyList_New(2);
3783 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3784 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3788 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3790 DataArrayIdType *ret1=0;
3792 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3793 PyObject *res=PyTuple_New(2);
3794 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3796 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3799 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3800 PyTuple_SetItem(res,1,res1);
3805 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3808 mcIdType v0; std::vector<mcIdType> v1;
3809 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3810 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3813 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3814 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3817 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3818 if (!SWIG_IsOK(res1))
3821 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3822 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3826 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3828 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3829 da2->checkAllocated();
3830 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3834 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3836 std::vector<mcIdType> tmp;
3837 self->getCellIdsHavingGaussLocalization(locId,tmp);
3838 DataArrayIdType *ret=DataArrayIdType::New();
3839 ret->alloc((mcIdType)tmp.size(),1);
3840 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3841 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3844 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3846 std::vector<mcIdType> inp0;
3847 convertPyToNewIntArr4(code,1,3,inp0);
3848 std::vector<const DataArrayIdType *> inp1;
3849 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3850 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3855 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3858 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3859 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3860 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3861 static MEDCouplingFieldTemplate *New(TypeOfField type);
3862 std::string simpleRepr() const;
3863 std::string advancedRepr() const;
3864 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3865 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3868 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3870 return MEDCouplingFieldTemplate::New(f);
3873 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3875 return MEDCouplingFieldTemplate::New(f);
3878 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3880 return MEDCouplingFieldTemplate::New(f);
3883 MEDCouplingFieldTemplate(TypeOfField type)
3885 return MEDCouplingFieldTemplate::New(type);
3888 std::string __str__() const
3890 return self->simpleRepr();
3893 std::string __repr__() const
3895 std::ostringstream oss;
3896 self->reprQuickOverview(oss);
3900 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3903 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3904 PyObject *ret=PyTuple_New(2);
3905 PyObject *ret0Py=ret0?Py_True:Py_False;
3907 PyTuple_SetItem(ret,0,ret0Py);
3908 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3915 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3918 TypeOfTimeDiscretization getTimeDiscretization() const;
3920 MEDCouplingFieldT();
3921 ~MEDCouplingFieldT();
3924 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3925 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3926 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3928 class MEDCouplingFieldInt;
3929 class MEDCouplingFieldFloat;
3931 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3934 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3935 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3936 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3937 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3938 void setTimeUnit(const std::string& unit);
3939 std::string getTimeUnit() const;
3940 void synchronizeTimeWithSupport();
3941 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3942 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3943 std::string simpleRepr() const;
3944 std::string advancedRepr() const;
3945 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3946 MEDCouplingFieldInt *convertToIntField() const;
3947 MEDCouplingFieldFloat *convertToFloatField() const;
3948 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3949 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3950 MEDCouplingFieldDouble *deepCopy() const;
3951 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3952 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3953 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3954 double getIJ(int tupleId, int compoId) const;
3955 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3956 void synchronizeTimeWithMesh();
3957 void setArray(DataArrayDouble *array);
3958 void setEndArray(DataArrayDouble *array);
3959 void setTime(double val, int iteration, int order);
3960 void setStartTime(double val, int iteration, int order);
3961 void setEndTime(double val, int iteration, int order);
3962 void applyLin(double a, double b, int compoId);
3963 void applyLin(double a, double b);
3964 int getNumberOfComponents() const;
3965 int getNumberOfTuples() const;
3966 int getNumberOfValues() const;
3967 void setTimeTolerance(double val);
3968 double getTimeTolerance() const;
3969 void setIteration(int it);
3970 void setEndIteration(int it);
3971 void setOrder(int order);
3972 void setEndOrder(int order);
3973 void setTimeValue(double val);
3974 void setEndTimeValue(double val);
3975 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3976 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3977 bool mergeNodes(double eps, double epsOnVals=1e-15);
3978 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3979 bool zipCoords(double epsOnVals=1e-15);
3980 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3981 bool simplexize(int policy);
3982 MEDCouplingFieldDouble *doublyContractedProduct() const;
3983 MEDCouplingFieldDouble *determinant() const;
3984 MEDCouplingFieldDouble *eigenValues() const;
3985 MEDCouplingFieldDouble *eigenVectors() const;
3986 MEDCouplingFieldDouble *inverse() const;
3987 MEDCouplingFieldDouble *trace() const;
3988 MEDCouplingFieldDouble *deviator() const;
3989 MEDCouplingFieldDouble *magnitude() const;
3990 MEDCouplingFieldDouble *maxPerTuple() const;
3991 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
3992 void sortPerTuple(bool asc);
3993 MEDCouplingFieldDouble &operator=(double value);
3994 void fillFromAnalytic(int nbOfComp, const std::string& func);
3995 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
3996 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3997 void applyFunc(int nbOfComp, const std::string& func);
3998 void applyFuncCompo(int nbOfComp, const std::string& func);
3999 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4000 void applyFunc(int nbOfComp, double val);
4001 void applyFunc(const std::string& func);
4002 void applyFuncFast32(const std::string& func);
4003 void applyFuncFast64(const std::string& func);
4004 double accumulate(int compId) const;
4005 double getMaxValue() const;
4006 double getMinValue() const;
4007 double getAverageValue() const;
4008 double norm2() const;
4009 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4010 double getWeightedAverageValue(int compId, bool isWAbs) const;
4011 double integral(int compId, bool isWAbs) const;
4012 double normL1(int compId) const;
4013 double normL2(int compId) const;
4014 double normMax(int compId) const;
4015 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4016 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4017 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4018 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4019 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4020 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4021 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4022 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4023 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4024 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4025 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4026 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4027 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4028 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4029 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4030 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4031 MEDCouplingFieldDouble *negate() const;
4033 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4035 return MEDCouplingFieldDouble::New(type,td);
4038 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4040 return MEDCouplingFieldDouble::New(ft,td);
4043 std::string __str__() const
4045 return self->simpleRepr();
4048 std::string __repr__() const
4050 std::ostringstream oss;
4051 self->reprQuickOverview(oss);
4055 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4058 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4059 PyObject *ret=PyTuple_New(2);
4060 PyObject *ret0Py=ret0?Py_True:Py_False;
4062 PyTuple_SetItem(ret,0,ret0Py);
4063 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4067 MEDCouplingFieldDouble *voronoize(double eps) const
4069 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4073 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4075 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4079 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4081 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4083 DataArrayDouble *a,*a2;
4084 DataArrayDoubleTuple *aa,*aa2;
4085 std::vector<double> bb,bb2;
4087 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4088 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4089 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4092 DataArrayDouble *getArray()
4094 DataArrayDouble *ret=self->getArray();
4100 PyObject *getArrays() const
4102 std::vector<DataArrayDouble *> arrs=self->getArrays();
4103 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4106 std::size_t sz=arrs.size();
4107 PyObject *ret=PyTuple_New(sz);
4108 for(std::size_t i=0;i<sz;i++)
4111 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4113 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4118 void setArrays(PyObject *ls)
4120 std::vector<const DataArrayDouble *> tmp;
4121 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4122 std::size_t sz=tmp.size();
4123 std::vector<DataArrayDouble *> arrs(sz);
4124 for(std::size_t i=0;i<sz;i++)
4125 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4126 self->setArrays(arrs);
4129 DataArrayDouble *getEndArray()
4131 DataArrayDouble *ret=self->getEndArray();
4137 PyObject *getValueOn(PyObject *sl) const
4141 DataArrayDoubleTuple *aa;
4142 std::vector<double> bb;
4144 const MEDCouplingMesh *mesh=self->getMesh();
4146 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4147 int spaceDim=mesh->getSpaceDimension();
4148 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4149 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4151 mcIdType sz=ToIdType(self->getNumberOfComponents());
4152 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4153 self->getValueOn(spaceLoc,res);
4154 return convertDblArrToPyList<double>(res,sz);
4157 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4159 mcIdType sz=ToIdType(self->getNumberOfComponents());
4160 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4161 self->getValueOnPos(i,j,k,res);
4162 return convertDblArrToPyList<double>(res,sz);
4165 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4167 const MEDCouplingMesh *mesh(self->getMesh());
4169 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4172 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4173 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4174 mesh->getSpaceDimension(),true,nbPts);
4175 return self->getValueOnMulti(inp,(int)nbPts);
4178 PyObject *getValueOn(PyObject *sl, double time) const
4182 DataArrayDoubleTuple *aa;
4183 std::vector<double> bb;
4185 const MEDCouplingMesh *mesh=self->getMesh();
4187 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4188 int spaceDim=mesh->getSpaceDimension();
4189 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4190 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4193 mcIdType sz=ToIdType(self->getNumberOfComponents());
4194 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4195 self->getValueOn(spaceLoc,time,res);
4196 return convertDblArrToPyList<double>(res,sz);
4199 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4201 if(self->getArray()!=0)
4202 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4205 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4206 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4207 self->setArray(arr);
4214 double tmp0=self->getTime(tmp1,tmp2);
4215 PyObject *res = PyList_New(3);
4216 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4217 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4218 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4222 PyObject *getStartTime()
4225 double tmp0=self->getStartTime(tmp1,tmp2);
4226 PyObject *res = PyList_New(3);
4227 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4228 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4229 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4233 PyObject *getEndTime()
4236 double tmp0=self->getEndTime(tmp1,tmp2);
4237 PyObject *res = PyList_New(3);
4238 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4239 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4240 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4243 PyObject *accumulate() const
4245 mcIdType sz=ToIdType(self->getNumberOfComponents());
4246 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4247 self->accumulate(tmp);
4248 return convertDblArrToPyList<double>(tmp,sz);
4250 PyObject *integral(bool isWAbs) const
4252 mcIdType sz=ToIdType(self->getNumberOfComponents());
4253 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4254 self->integral(isWAbs,tmp);
4255 return convertDblArrToPyList<double>(tmp,sz);
4257 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4259 mcIdType sz=ToIdType(self->getNumberOfComponents());
4260 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4261 self->getWeightedAverageValue(tmp,isWAbs);
4262 return convertDblArrToPyList<double>(tmp,sz);
4264 PyObject *normL1() const
4266 mcIdType sz=ToIdType(self->getNumberOfComponents());
4267 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4269 return convertDblArrToPyList<double>(tmp,sz);
4271 PyObject *normL2() const
4273 mcIdType sz=ToIdType(self->getNumberOfComponents());
4274 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4276 return convertDblArrToPyList<double>(tmp,sz);
4278 PyObject *normMax() const
4280 mcIdType sz=ToIdType(self->getNumberOfComponents());
4281 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4283 return convertDblArrToPyList<double>(tmp,sz);
4285 void renumberCells(PyObject *li, bool check=true)
4287 mcIdType szArr,sw,iTypppArr;
4288 std::vector<mcIdType> stdvecTyyppArr;
4289 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4290 self->renumberCells(tmp,check);
4293 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4295 mcIdType szArr,sw,iTypppArr;
4296 std::vector<mcIdType> stdvecTyyppArr;
4297 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4298 self->renumberCellsWithoutMesh(tmp,check);
4301 void renumberNodes(PyObject *li, double eps=1e-15)
4303 mcIdType szArr,sw,iTypppArr;
4304 std::vector<mcIdType> stdvecTyyppArr;
4305 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4306 self->renumberNodes(tmp,eps);
4309 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4311 mcIdType szArr,sw,iTypppArr;
4312 std::vector<mcIdType> stdvecTyyppArr;
4313 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4314 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4317 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4319 return fieldT_buildSubPart(self,li);
4322 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4324 return fieldT__getitem__(self,li);
4327 PyObject *getMaxValue2() const
4329 DataArrayIdType *tmp;
4330 double r1=self->getMaxValue2(tmp);
4331 PyObject *ret=PyTuple_New(2);
4332 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4333 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4337 PyObject *getMinValue2() const
4339 DataArrayIdType *tmp;
4340 double r1=self->getMinValue2(tmp);
4341 PyObject *ret=PyTuple_New(2);
4342 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4343 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4347 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4349 std::vector<std::size_t> tmp;
4350 convertPyToNewIntArr3(li,tmp);
4351 return self->keepSelectedComponents(tmp);
4354 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4356 std::vector<std::size_t> tmp;
4357 convertPyToNewIntArr3(li,tmp);
4358 self->setSelectedComponents(f,tmp);
4361 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4364 DataArrayDouble *a,*a2;
4365 DataArrayDoubleTuple *aa,*aa2;
4366 std::vector<double> bb,bb2;
4369 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4370 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4371 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4372 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4374 return self->extractSlice3D(orig,vect,eps);
4377 MEDCouplingFieldDouble *__add__(PyObject *obj)
4379 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4382 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4384 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4387 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4389 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.";
4390 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4393 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4395 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4397 return (*self)-(*other);
4399 throw INTERP_KERNEL::Exception(msg);
4404 DataArrayDoubleTuple *aa;
4405 std::vector<double> bb;
4407 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4412 if(!self->getArray())
4413 throw INTERP_KERNEL::Exception(msg2);
4414 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4415 ret->applyLin(1.,-val);
4416 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4417 ret2->setArray(ret);
4422 if(!self->getArray())
4423 throw INTERP_KERNEL::Exception(msg2);
4424 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4425 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4426 ret2->setArray(ret);
4431 if(!self->getArray())
4432 throw INTERP_KERNEL::Exception(msg2);
4433 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4434 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4435 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4436 ret2->setArray(ret);
4441 if(!self->getArray())
4442 throw INTERP_KERNEL::Exception(msg2);
4443 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4444 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4445 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4446 ret2->setArray(ret);
4450 { throw INTERP_KERNEL::Exception(msg); }
4454 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4456 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4459 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4461 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4464 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4466 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4469 MEDCouplingFieldDouble *__div__(PyObject *obj)
4471 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.";
4472 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4475 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4477 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4479 return (*self)/(*other);
4481 throw INTERP_KERNEL::Exception(msg);
4486 DataArrayDoubleTuple *aa;
4487 std::vector<double> bb;
4489 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4495 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4496 if(!self->getArray())
4497 throw INTERP_KERNEL::Exception(msg2);
4498 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4499 ret->applyLin(1./val,0);
4500 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4501 ret2->setArray(ret);
4506 if(!self->getArray())
4507 throw INTERP_KERNEL::Exception(msg2);
4508 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4509 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4510 ret2->setArray(ret);
4515 if(!self->getArray())
4516 throw INTERP_KERNEL::Exception(msg2);
4517 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4518 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4519 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4520 ret2->setArray(ret);
4525 if(!self->getArray())
4526 throw INTERP_KERNEL::Exception(msg2);
4527 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4528 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4529 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4530 ret2->setArray(ret);
4534 { throw INTERP_KERNEL::Exception(msg); }
4538 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4540 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4543 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4545 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.";
4546 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4549 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4551 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4553 return (*self)^(*other);
4555 throw INTERP_KERNEL::Exception(msg);
4560 DataArrayDoubleTuple *aa;
4561 std::vector<double> bb;
4563 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4568 if(!self->getArray())
4569 throw INTERP_KERNEL::Exception(msg2);
4570 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4572 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4573 ret2->setArray(ret);
4578 if(!self->getArray())
4579 throw INTERP_KERNEL::Exception(msg2);
4580 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4581 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4582 ret2->setArray(ret);
4587 if(!self->getArray())
4588 throw INTERP_KERNEL::Exception(msg2);
4589 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4590 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4591 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4592 ret2->setArray(ret);
4597 if(!self->getArray())
4598 throw INTERP_KERNEL::Exception(msg2);
4599 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4600 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4601 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4602 ret2->setArray(ret);
4606 { throw INTERP_KERNEL::Exception(msg); }
4610 MEDCouplingFieldDouble *__neg__() const
4612 return self->negate();
4615 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4617 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.";
4618 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4621 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4623 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4627 Py_XINCREF(trueSelf);
4631 throw INTERP_KERNEL::Exception(msg);
4636 DataArrayDoubleTuple *aa;
4637 std::vector<double> bb;
4639 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4644 if(!self->getArray())
4645 throw INTERP_KERNEL::Exception(msg2);
4646 self->getArray()->applyLin(1.,val);
4647 Py_XINCREF(trueSelf);
4652 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4655 Py_XINCREF(trueSelf);
4660 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4661 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4662 ret2->setArray(aaa);
4664 Py_XINCREF(trueSelf);
4669 if(!self->getArray())
4670 throw INTERP_KERNEL::Exception(msg2);
4671 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4672 self->getArray()->addEqual(aaa);
4673 Py_XINCREF(trueSelf);
4677 { throw INTERP_KERNEL::Exception(msg); }
4681 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4683 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.";
4684 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4687 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4689 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4693 Py_XINCREF(trueSelf);
4697 throw INTERP_KERNEL::Exception(msg);
4702 DataArrayDoubleTuple *aa;
4703 std::vector<double> bb;
4705 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4710 if(!self->getArray())
4711 throw INTERP_KERNEL::Exception(msg2);
4712 self->getArray()->applyLin(1.,-val);
4713 Py_XINCREF(trueSelf);
4718 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4721 Py_XINCREF(trueSelf);
4726 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4727 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4728 ret2->setArray(aaa);
4730 Py_XINCREF(trueSelf);
4735 if(!self->getArray())
4736 throw INTERP_KERNEL::Exception(msg2);
4737 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4738 self->getArray()->substractEqual(aaa);
4739 Py_XINCREF(trueSelf);
4743 { throw INTERP_KERNEL::Exception(msg); }
4747 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4749 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.";
4750 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4753 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4755 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4759 Py_XINCREF(trueSelf);
4763 throw INTERP_KERNEL::Exception(msg);
4768 DataArrayDoubleTuple *aa;
4769 std::vector<double> bb;
4771 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4776 if(!self->getArray())
4777 throw INTERP_KERNEL::Exception(msg2);
4778 self->getArray()->applyLin(val,0);
4779 Py_XINCREF(trueSelf);
4784 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4787 Py_XINCREF(trueSelf);
4792 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4793 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4794 ret2->setArray(aaa);
4796 Py_XINCREF(trueSelf);
4801 if(!self->getArray())
4802 throw INTERP_KERNEL::Exception(msg2);
4803 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4804 self->getArray()->multiplyEqual(aaa);
4805 Py_XINCREF(trueSelf);
4809 { throw INTERP_KERNEL::Exception(msg); }
4813 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4815 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.";
4816 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4819 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4821 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4825 Py_XINCREF(trueSelf);
4829 throw INTERP_KERNEL::Exception(msg);
4834 DataArrayDoubleTuple *aa;
4835 std::vector<double> bb;
4837 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4843 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4844 if(!self->getArray())
4845 throw INTERP_KERNEL::Exception(msg2);
4846 self->getArray()->applyLin(1./val,0);
4847 Py_XINCREF(trueSelf);
4852 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4855 Py_XINCREF(trueSelf);
4860 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4861 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4862 ret2->setArray(aaa);
4864 Py_XINCREF(trueSelf);
4869 if(!self->getArray())
4870 throw INTERP_KERNEL::Exception(msg2);
4871 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4872 self->getArray()->divideEqual(aaa);
4873 Py_XINCREF(trueSelf);
4877 { throw INTERP_KERNEL::Exception(msg); }
4881 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4883 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.";
4884 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4887 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4889 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4893 Py_XINCREF(trueSelf);
4897 throw INTERP_KERNEL::Exception(msg);
4902 DataArrayDoubleTuple *aa;
4903 std::vector<double> bb;
4905 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4910 if(!self->getArray())
4911 throw INTERP_KERNEL::Exception(msg2);
4912 self->getArray()->applyPow(val);
4913 Py_XINCREF(trueSelf);
4918 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4921 Py_XINCREF(trueSelf);
4926 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4927 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4928 ret2->setArray(aaa);
4930 Py_XINCREF(trueSelf);
4935 if(!self->getArray())
4936 throw INTERP_KERNEL::Exception(msg2);
4937 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4938 self->getArray()->powEqual(aaa);
4939 Py_XINCREF(trueSelf);
4943 { throw INTERP_KERNEL::Exception(msg); }
4947 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4949 std::vector<const MEDCouplingFieldDouble *> tmp;
4950 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4951 return MEDCouplingFieldDouble::MergeFields(tmp);
4954 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4956 std::vector<const MEDCouplingFieldDouble *> tmp;
4957 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4958 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4961 PyObject *getTinySerializationInformation() const
4963 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4966 PyObject *serialize() const
4968 return field_serialize<double>(self);
4971 PyObject *__getstate__() const
4973 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4976 void __setstate__(PyObject *inp)
4978 field__setstate__<double>(self,inp);
4983 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4986 int getNumberOfFields() const;
4987 MEDCouplingMultiFields *deepCopy() const;
4988 virtual std::string simpleRepr() const;
4989 virtual std::string advancedRepr() const;
4990 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4991 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4992 virtual void checkConsistencyLight() const;
4995 std::string __str__() const
4997 return self->simpleRepr();
4999 static MEDCouplingMultiFields *New(PyObject *li)
5001 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5002 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5003 std::size_t sz=tmp.size();
5004 std::vector<MEDCouplingFieldDouble *> fs(sz);
5005 for(std::size_t i=0;i<sz;i++)
5006 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5007 return MEDCouplingMultiFields::New(fs);
5009 MEDCouplingMultiFields(PyObject *li)
5011 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5012 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5013 std::size_t sz=tmp.size();
5014 std::vector<MEDCouplingFieldDouble *> fs(sz);
5015 for(std::size_t i=0;i<sz;i++)
5016 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5017 return MEDCouplingMultiFields::New(fs);
5019 PyObject *getFields() const
5021 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5022 std::size_t sz=fields.size();
5023 PyObject *res = PyList_New(sz);
5024 for(std::size_t i=0;i<sz;i++)
5028 fields[i]->incrRef();
5029 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5033 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5038 PyObject *getFieldAtPos(int id) const
5040 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5044 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5047 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5049 PyObject *getMeshes() const
5051 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5052 std::size_t sz=ms.size();
5053 PyObject *res = PyList_New(sz);
5054 for(std::size_t i=0;i<sz;i++)
5059 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5063 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5068 PyObject *getDifferentMeshes() const
5070 std::vector<int> refs;
5071 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5072 std::size_t sz=ms.size();
5073 PyObject *res = PyList_New(sz);
5074 for(std::size_t i=0;i<sz;i++)
5079 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5083 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5087 PyObject *ret=PyTuple_New(2);
5088 PyTuple_SetItem(ret,0,res);
5089 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5092 PyObject *getArrays() const
5094 std::vector<DataArrayDouble *> ms=self->getArrays();
5095 std::size_t sz=ms.size();
5096 PyObject *res = PyList_New(sz);
5097 for(std::size_t i=0;i<sz;i++)
5102 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5106 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5111 PyObject *getDifferentArrays() const
5113 std::vector< std::vector<int> > refs;
5114 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5115 std::size_t sz=ms.size();
5116 PyObject *res = PyList_New(sz);
5117 PyObject *res2 = PyList_New(sz);
5118 for(std::size_t i=0;i<sz;i++)
5123 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5127 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5129 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5132 PyObject *ret=PyTuple_New(2);
5133 PyTuple_SetItem(ret,0,res);
5134 PyTuple_SetItem(ret,1,res2);
5140 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5143 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5144 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5145 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5146 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5147 void setTimeUnit(const std::string& unit);
5148 std::string getTimeUnit() const;
5149 void setTime(double val, int iteration, int order);
5150 void setArray(DataArrayInt32 *array);
5151 MEDCouplingFieldInt *deepCopy() const;
5152 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5153 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5154 MEDCouplingFieldDouble *convertToDblField() const;
5155 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5157 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5159 return MEDCouplingFieldInt::New(type,td);
5162 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5164 return MEDCouplingFieldInt::New(ft,td);
5167 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5170 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5171 PyObject *ret=PyTuple_New(2);
5172 PyObject *ret0Py=ret0?Py_True:Py_False;
5174 PyTuple_SetItem(ret,0,ret0Py);
5175 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5179 std::string __str__() const
5181 return self->simpleRepr();
5184 std::string __repr__() const
5186 std::ostringstream oss;
5187 self->reprQuickOverview(oss);
5191 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5193 return fieldT_buildSubPart(self,li);
5196 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5198 return fieldT__getitem__(self,li);
5201 DataArrayInt32 *getArray()
5203 DataArrayInt32 *ret=self->getArray();
5212 double tmp0=self->getTime(tmp1,tmp2);
5213 PyObject *res = PyList_New(3);
5214 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5215 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5216 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5220 PyObject *getTinySerializationInformation() const
5222 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5225 PyObject *serialize() const
5227 return field_serialize<int>(self);
5230 PyObject *__getstate__() const
5232 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5235 void __setstate__(PyObject *inp)
5237 field__setstate__<int>(self,inp);
5242 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5245 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5246 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5247 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5248 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5249 void setTimeUnit(const std::string& unit);
5250 std::string getTimeUnit() const;
5251 void setTime(double val, int iteration, int order);
5252 void setArray(DataArrayFloat *array);
5253 MEDCouplingFieldFloat *deepCopy() const;
5254 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5255 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5256 MEDCouplingFieldDouble *convertToDblField() const;
5257 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5259 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5261 return MEDCouplingFieldFloat::New(type,td);
5264 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5266 return MEDCouplingFieldFloat::New(ft,td);
5269 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5272 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5273 PyObject *ret=PyTuple_New(2);
5274 PyObject *ret0Py=ret0?Py_True:Py_False;
5276 PyTuple_SetItem(ret,0,ret0Py);
5277 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5281 std::string __str__() const
5283 return self->simpleRepr();
5286 std::string __repr__() const
5288 std::ostringstream oss;
5289 self->reprQuickOverview(oss);
5293 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5295 return fieldT_buildSubPart(self,li);
5298 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5300 return fieldT__getitem__(self,li);
5303 DataArrayFloat *getArray()
5305 DataArrayFloat *ret=self->getArray();
5314 double tmp0=self->getTime(tmp1,tmp2);
5315 PyObject *res = PyList_New(3);
5316 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5317 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5318 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5322 PyObject *getTinySerializationInformation() const
5324 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5327 PyObject *serialize() const
5329 return field_serialize<float>(self);
5332 PyObject *__getstate__() const
5334 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5337 void __setstate__(PyObject *inp)
5339 field__setstate__<float>(self,inp);
5344 class MEDCouplingDefinitionTime
5347 MEDCouplingDefinitionTime();
5348 void assign(const MEDCouplingDefinitionTime& other);
5349 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5350 double getTimeResolution() const;
5351 std::vector<double> getHotSpotsTime() const;
5354 std::string __str__() const
5356 std::ostringstream oss;
5357 self->appendRepr(oss);
5361 PyObject *getIdsOnTimeRight(double tm) const
5363 int meshId,arrId,arrIdInField,fieldId;
5364 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5365 PyObject *res=PyList_New(4);
5366 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5367 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5368 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5369 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5373 PyObject *getIdsOnTimeLeft(double tm) const
5375 int meshId,arrId,arrIdInField,fieldId;
5376 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5377 PyObject *res=PyList_New(4);
5378 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5379 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5380 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5381 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5387 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5390 double getTimeTolerance() const;
5391 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5395 MEDCouplingFieldOverTime(PyObject *li)
5397 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5398 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5399 std::size_t sz=tmp.size();
5400 std::vector<MEDCouplingFieldDouble *> fs(sz);
5401 for(std::size_t i=0;i<sz;i++)
5402 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5403 return MEDCouplingFieldOverTime::New(fs);
5405 std::string __str__() const
5407 return self->simpleRepr();
5409 static MEDCouplingFieldOverTime *New(PyObject *li)
5411 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5412 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5413 std::size_t sz=tmp.size();
5414 std::vector<MEDCouplingFieldDouble *> fs(sz);
5415 for(std::size_t i=0;i<sz;i++)
5416 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5417 return MEDCouplingFieldOverTime::New(fs);
5422 class MEDCouplingCartesianAMRMesh;
5424 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5427 int getNumberOfCellsRecursiveWithOverlap() const;
5428 int getNumberOfCellsRecursiveWithoutOverlap() const;
5429 int getMaxNumberOfLevelsRelativeToThis() const;
5432 MEDCouplingCartesianAMRMeshGen *getMesh() const
5434 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5442 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5445 int getNumberOfOverlapedCellsForFather() const;
5446 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5447 std::vector<mcIdType> computeCellGridSt() const;
5450 PyObject *getBLTRRange() const
5452 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5453 return convertFromVectorPairInt(ret);
5456 PyObject *getBLTRRangeRelativeToGF() const
5458 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5459 return convertFromVectorPairInt(ret);
5462 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5464 std::vector< std::pair<mcIdType,mcIdType> > inp;
5465 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5466 self->addPatch(inp,factors);
5469 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5471 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5473 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5474 if(patchId==mesh->getNumberOfPatches())
5476 std::ostringstream oss;
5477 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5478 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5481 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5487 void __delitem__(mcIdType patchId)
5489 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5491 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5492 mesh->removePatch(patchId);
5495 mcIdType __len__() const
5497 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5499 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5500 return mesh->getNumberOfPatches();
5505 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5509 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5512 mcIdType getAbsoluteLevel() const;
5513 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5514 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5515 int getSpaceDimension() const;
5516 const std::vector<mcIdType>& getFactors() const;
5517 void setFactors(const std::vector<mcIdType>& newFactors);
5518 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5519 mcIdType getNumberOfCellsAtCurrentLevel() const;
5520 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5521 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5522 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5523 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5524 virtual void detachFromFather();
5526 mcIdType getNumberOfPatches() const;
5527 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5528 MEDCouplingUMesh *buildUnstructured() const;
5529 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5530 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5531 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5532 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5533 void removeAllPatches();
5534 void removePatch(mcIdType patchId);
5535 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5536 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5537 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5538 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5539 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5540 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5541 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5542 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5543 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5544 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5545 std::string buildPythonDumpOfThis() const;
5548 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5550 std::vector< std::pair<mcIdType,mcIdType> > inp;
5551 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5552 self->addPatch(inp,factors);
5555 PyObject *getPatches() const
5557 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5558 std::size_t sz(ps.size());
5559 PyObject *ret = PyList_New(sz);
5560 for(std::size_t i=0;i<sz;i++)
5562 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5565 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5570 // agy : don't know why typemap fails here ??? let it in the extend section
5571 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5573 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5576 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5578 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5579 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5585 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5587 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5588 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5594 virtual PyObject *positionRelativeToGodFather() const
5596 std::vector<mcIdType> out1;
5597 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5598 PyObject *ret(PyTuple_New(2));
5599 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5600 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5604 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5606 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5607 std::size_t sz(ps.size());
5608 PyObject *ret = PyList_New(sz);
5609 for(std::size_t i=0;i<sz;i++)
5610 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5614 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5616 std::vector<const DataArrayDouble *> inp;
5617 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5618 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5621 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5623 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5629 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5631 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5637 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5639 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5645 MEDCouplingIMesh *getImageMesh() const
5647 const MEDCouplingIMesh *ret(self->getImageMesh());
5650 return const_cast<MEDCouplingIMesh *>(ret);
5653 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5655 if(patchId==self->getNumberOfPatches())
5657 std::ostringstream oss;
5658 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5659 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5662 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5668 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5670 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5671 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5672 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5675 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5677 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5678 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5679 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5682 void __delitem__(mcIdType patchId)
5684 self->removePatch(patchId);
5687 mcIdType __len__() const
5689 return self->getNumberOfPatches();
5694 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5698 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5701 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5704 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5706 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5707 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5708 const mcIdType *nodeStrctPtr(0);
5709 const double *originPtr(0),*dxyzPtr(0);
5710 mcIdType sw,sz,val0;
5711 std::vector<mcIdType> bb0;
5712 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5715 std::vector<double> bb,bb2;
5717 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5718 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5720 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5723 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5725 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5726 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5727 std::vector< std::vector<mcIdType> > inp2;
5728 convertPyToVectorOfVectorOfInt(factors,inp2);
5729 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5732 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5734 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5737 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5739 return MEDCouplingCartesianAMRMesh::New(mesh);
5744 class MEDCouplingDataForGodFather : public RefCountObject
5747 virtual void synchronizeFineToCoarse();
5748 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5749 virtual void synchronizeCoarseToFine();
5750 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5751 virtual void synchronizeAllGhostZones();
5752 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5753 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5754 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5755 virtual void alloc();
5756 virtual void dealloc();
5759 MEDCouplingCartesianAMRMesh *getMyGodFather()
5761 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5769 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5772 mcIdType getNumberOfLevels() const;
5773 MEDCouplingAMRAttribute *deepCopy() const;
5774 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5775 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5776 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5777 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5778 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5779 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5780 std::string writeVTHB(const std::string& fileName) const;
5783 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5785 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5786 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5787 MEDCouplingAMRAttribute *ret(0);
5790 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5791 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5793 catch(INTERP_KERNEL::Exception&)
5795 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5796 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5801 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5803 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5806 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5808 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5809 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5815 void spillInfoOnComponents(PyObject *compNames)
5817 std::vector< std::vector<std::string> > compNamesCpp;
5818 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5819 self->spillInfoOnComponents(compNamesCpp);
5822 void spillNatures(PyObject *nfs)
5824 std::vector<mcIdType> inp0;
5825 if(!fillIntVector(nfs,inp0))
5826 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5827 std::size_t sz(inp0.size());
5828 std::vector<NatureOfField> inp00(sz);
5829 for(std::size_t i=0;i<sz;i++)
5830 inp00[i]=(NatureOfField)inp0[i];
5831 self->spillNatures(inp00);
5834 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5836 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5837 std::size_t sz(ret.size());
5838 PyObject *retPy(PyList_New(sz));
5839 for(std::size_t i=0;i<sz;i++)
5840 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5846 class DenseMatrix : public RefCountObject, public TimeLabel
5849 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5850 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5851 DenseMatrix *deepCopy() const;
5852 DenseMatrix *shallowCpy() const;
5854 mcIdType getNumberOfRows() const;
5855 mcIdType getNumberOfCols() const;
5856 mcIdType getNbOfElems() const;
5857 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5858 void reShape(mcIdType nbRows, mcIdType nbCols);
5861 bool isEqual(const DenseMatrix& other, double eps) const;
5862 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5863 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5866 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5868 return DenseMatrix::New(nbRows,nbCols);
5871 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5873 return DenseMatrix::New(array,nbRows,nbCols);
5876 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5879 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5880 PyObject *ret=PyTuple_New(2);
5881 PyObject *ret0Py=ret0?Py_True:Py_False;
5883 PyTuple_SetItem(ret,0,ret0Py);
5884 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5888 DataArrayDouble *getData()
5890 DataArrayDouble *ret(self->getData());
5896 DenseMatrix *__add__(const DenseMatrix *other)
5898 return MEDCoupling::DenseMatrix::Add(self,other);
5901 DenseMatrix *__sub__(const DenseMatrix *other)
5903 return MEDCoupling::DenseMatrix::Substract(self,other);
5906 DenseMatrix *__mul__(const DenseMatrix *other)
5908 return MEDCoupling::DenseMatrix::Multiply(self,other);
5911 DenseMatrix *__mul__(const DataArrayDouble *other)
5913 return MEDCoupling::DenseMatrix::Multiply(self,other);
5916 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5918 self->addEqual(other);
5919 Py_XINCREF(trueSelf);
5923 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5925 self->substractEqual(other);
5926 Py_XINCREF(trueSelf);
5930 PyObject *toNumPyMatrix() // not const. It is not a bug !
5932 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5941 def MEDCouplingUMeshReduce(self):
5942 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5943 def MEDCouplingCMeshReduce(self):
5944 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5945 def MEDCouplingIMeshReduce(self):
5946 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5947 def MEDCouplingMappedExtrudedMeshReduce(self):
5948 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5949 def MEDCouplingCurveLinearMeshReduce(self):
5950 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5951 def MEDCoupling1SGTUMeshReduce(self):
5952 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5953 def MEDCoupling1DGTUMeshReduce(self):
5954 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5955 def MEDCouplingFieldDoubleReduce(self):
5956 self.checkConsistencyLight()
5957 d=(self.getTypeOfField(),self.getTimeDiscretization())
5958 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5959 def MEDCouplingFieldIntReduce(self):
5960 self.checkConsistencyLight()
5961 d=(self.getTypeOfField(),self.getTimeDiscretization())
5962 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5963 def MEDCouplingFieldFloatReduce(self):
5964 self.checkConsistencyLight()
5965 d=(self.getTypeOfField(),self.getTimeDiscretization())
5966 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5967 def MEDCouplingFTReduceFunct(cls,params):
5969 ret=object.__new__(cls)
5973 def MEDCouplingFieldTemplateReduce(self):
5974 ret = MEDCouplingFieldDouble(self)
5975 nbTuples = self.getNumberOfTuplesExpected()
5976 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5978 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5980 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5982 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5983 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5984 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5985 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5986 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5987 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5988 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5994 __filename=os.environ.get('PYTHONSTARTUP')
5995 if __filename and os.path.isfile(__filename):
5996 with open(__filename) as __fp: