1 // Copyright (C) 2017-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifdef WITH_DOCSTRINGS
22 %include MEDCoupling_doc.i
29 #include "MEDCouplingMemArray.hxx"
30 #include "MEDCouplingMemArray.txx"
31 #include "MEDCouplingUMesh.hxx"
32 #include "MEDCouplingMappedExtrudedMesh.hxx"
33 #include "MEDCouplingCMesh.hxx"
34 #include "MEDCouplingIMesh.hxx"
35 #include "MEDCouplingMap.txx"
36 #include "MEDCouplingCurveLinearMesh.hxx"
37 #include "MEDCoupling1GTUMesh.hxx"
38 #include "MEDCouplingField.hxx"
39 #include "MEDCouplingFieldDouble.hxx"
40 #include "MEDCouplingFieldInt.hxx"
41 #include "MEDCouplingFieldFloat.hxx"
42 #include "MEDCouplingFieldTemplate.hxx"
43 #include "MEDCouplingGaussLocalization.hxx"
45 #include "MEDCouplingMultiFields.hxx"
46 #include "MEDCouplingFieldOverTime.hxx"
47 #include "MEDCouplingDefinitionTime.hxx"
48 #include "MEDCouplingFieldDiscretization.hxx"
49 #include "MEDCouplingCartesianAMRMesh.hxx"
50 #include "MEDCouplingAMRAttribute.hxx"
51 #include "MEDCouplingMatrix.hxx"
52 #include "MEDCouplingPartDefinition.hxx"
53 #include "MEDCouplingSkyLineArray.hxx"
54 #include "MEDCouplingTypemaps.i"
56 #include "InterpKernelAutoPtr.hxx"
57 #include "BoxSplittingOptions.hxx"
59 using namespace MEDCoupling;
60 using namespace INTERP_KERNEL;
64 %template(dvec) std::vector<double>;
65 %template(svec) std::vector<std::string>;
69 #ifndef MEDCOUPLING_USE_64BIT_IDS
70 //typedef std::int32_t mcIdType;
72 typedef DataArrayInt32 DataArrayIdType;
73 %template(ivec) std::vector<int>;
74 %template(i64vec) std::vector<long>;
76 //typedef std::int64_t mcIdType;
77 typedef DataArrayInt64 DataArrayIdType;
79 %template(ivec) std::vector<long long>;
80 typedef long long mcIdType;
82 %template(ivec) std::vector<long>;
83 typedef long int mcIdType;
85 %template(i32vec) std::vector<int>;
90 %typemap(out) MEDCoupling::MEDCouplingMesh*
92 $result=convertMesh($1,$owner);
95 %typemap(out) MEDCouplingMesh*
97 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCoupling::MEDCouplingPointSet*
104 $result=convertMesh($1,$owner);
107 %typemap(out) MEDCouplingPointSet*
109 $result=convertMesh($1,$owner);
114 %typemap(out) MEDCouplingCartesianAMRPatchGen*
116 $result=convertCartesianAMRPatch($1,$owner);
121 %typemap(out) MEDCouplingCartesianAMRMeshGen*
123 $result=convertCartesianAMRMesh($1,$owner);
128 %typemap(out) MEDCouplingDataForGodFather*
130 $result=convertDataForGodFather($1,$owner);
135 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
137 $result=convertMesh($1,$owner);
140 %typemap(out) MEDCoupling1GTUMesh*
142 $result=convertMesh($1,$owner);
147 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
149 $result=convertMesh($1,$owner);
152 %typemap(out) MEDCouplingStructuredMesh*
154 $result=convertMesh($1,$owner);
159 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
161 $result=convertFieldDiscretization($1,$owner);
164 %typemap(out) MEDCouplingFieldDiscretization*
166 $result=convertFieldDiscretization($1,$owner);
171 %typemap(out) MEDCoupling::MEDCouplingField*
173 $result=convertField($1,$owner);
176 %typemap(out) MEDCouplingField*
178 $result=convertField($1,$owner);
183 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
185 $result=convertMultiFields($1,$owner);
188 %typemap(out) MEDCouplingMultiFields*
190 $result=convertMultiFields($1,$owner);
195 %typemap(out) MEDCoupling::PartDefinition*
197 $result=convertPartDefinition($1,$owner);
200 %typemap(out) PartDefinition*
202 $result=convertPartDefinition($1,$owner);
207 %init %{ import_array(); %}
210 %init %{ initializeMe(); %}
212 %feature("autodoc", "1");
213 %feature("docstring");
215 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
216 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
217 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
218 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
251 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
252 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
253 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
254 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
255 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
256 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
257 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
258 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
259 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
260 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
261 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
262 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
263 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
264 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
265 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
266 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
267 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
268 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
269 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
270 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
271 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
272 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
273 %newobject MEDCoupling::MEDCouplingFieldInt::New;
274 %newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField;
275 %newobject MEDCoupling::MEDCouplingFieldInt::getArray;
276 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
277 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
278 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
279 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
280 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
281 %newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
282 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
283 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
284 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
285 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
286 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
287 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
288 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
289 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
290 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
291 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
292 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
293 %newobject MEDCoupling::MEDCouplingMesh::clone;
294 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
295 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
296 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
297 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
298 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
299 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
300 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
301 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
302 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
303 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
304 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
305 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
306 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
307 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
308 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
309 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
310 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
311 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
312 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
313 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
314 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
315 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
316 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
317 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
318 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
319 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
320 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
321 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
322 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
323 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
324 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
325 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
326 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
327 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
328 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
329 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
330 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
331 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
332 %newobject MEDCoupling::MEDCouplingUMesh::New;
333 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
334 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
335 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
336 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
337 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
338 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
339 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
340 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
341 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
342 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
343 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
344 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
345 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
346 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
347 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
348 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
349 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
350 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
351 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
352 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
353 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
354 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
355 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
356 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
357 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
358 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
359 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
360 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
361 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
362 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
363 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
364 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
365 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
366 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
367 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
368 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
369 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
370 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
371 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
372 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
373 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
374 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
375 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
376 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
377 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
378 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
379 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
380 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
381 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
382 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
383 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
384 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
385 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
386 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
387 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
388 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
389 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
390 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
391 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
392 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
393 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
394 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
395 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
396 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
397 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
398 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
399 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
400 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
401 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
402 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
403 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
404 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
405 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
406 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
407 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
408 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
409 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
410 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
411 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
412 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
413 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
414 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
415 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
416 %newobject MEDCoupling::MEDCouplingCMesh::New;
417 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
418 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
419 %newobject MEDCoupling::MEDCouplingIMesh::New;
420 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
421 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
422 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
423 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
424 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
425 %newobject MEDCoupling::MEDCouplingMultiFields::New;
426 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
427 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
428 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
429 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
430 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
431 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
432 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
433 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
434 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
435 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
436 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
437 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
438 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
439 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
440 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
441 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
442 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
443 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
444 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
445 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
446 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
447 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
448 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
449 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
450 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
451 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
452 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
453 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
454 %newobject MEDCoupling::DenseMatrix::New;
455 %newobject MEDCoupling::DenseMatrix::deepCopy;
456 %newobject MEDCoupling::DenseMatrix::shallowCpy;
457 %newobject MEDCoupling::DenseMatrix::getData;
458 %newobject MEDCoupling::DenseMatrix::matVecMult;
459 %newobject MEDCoupling::DenseMatrix::MatVecMult;
460 %newobject MEDCoupling::DenseMatrix::__add__;
461 %newobject MEDCoupling::DenseMatrix::__sub__;
462 %newobject MEDCoupling::DenseMatrix::__mul__;
463 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
464 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
465 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
466 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
467 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
468 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
469 %newobject MEDCoupling::MEDCouplingSkyLineArray::groupPacks;
470 %newobject MEDCoupling::MEDCouplingSkyLineArray::uniqueNotSortedByPack;
471 %newobject MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks;
472 %newobject MEDCoupling::MEDCouplingSkyLineArray::deepCopy;
474 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
475 %feature("unref") MEDCouplingMesh "$this->decrRef();"
476 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
477 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
478 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
479 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
480 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
481 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
482 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
483 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
484 %feature("unref") MEDCouplingField "$this->decrRef();"
485 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
486 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
487 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
488 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
489 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
490 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
491 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
492 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
493 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
494 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
495 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
496 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
497 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
498 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
499 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
500 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
501 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
502 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
503 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
504 %feature("unref") DenseMatrix "$this->decrRef();"
505 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
507 %rename(assign) *::operator=;
508 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
509 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
510 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
511 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
515 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
516 // on the Python side. Must be put BEFORE the %rename clause:
517 %exceptionclass INTERP_KERNEL::Exception;
518 %rename (InterpKernelException) INTERP_KERNEL::Exception;
520 %include "MEDCouplingRefCountObject.i"
521 %include "MEDCouplingMemArray.i"
525 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
526 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
527 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
528 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
529 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
530 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
531 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
532 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
533 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
539 PyObject *med2vtk_cell_types()
541 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
542 PyObject *ret(PyList_New(sz));
543 for(Py_ssize_t i=0;i<sz;i++)
545 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
546 PyList_SetItem(ret,i,PyInt_FromLong(elt));
551 PyObject *vtk2med_cell_types()
553 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
554 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
555 auto szOut(maxElt+1);
556 std::vector< mcIdType > retCpp(szOut,-1);
558 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
560 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
564 PyObject *ret(PyList_New(szOut));
566 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
567 PyList_SetItem(ret,id,PyInt_FromLong(*it));
571 PyObject *AllGeometricTypes()
573 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
574 PyObject *ret(PyList_New(sz));
575 for(Py_ssize_t i=0;i<sz;i++)
576 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
581 namespace INTERP_KERNEL
584 * \class BoxSplittingOptions
585 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
587 class BoxSplittingOptions
590 BoxSplittingOptions();
592 double getEfficiencyGoal() const;
593 void setEfficiencyGoal(double efficiency);
594 double getEfficiencyThreshold() const;
595 void setEfficiencyThreshold(double efficiencyThreshold);
596 int getMinimumPatchLength() const;
597 void setMinimumPatchLength(int minPatchLength);
598 int getMaximumPatchLength() const;
599 void setMaximumPatchLength(int maxPatchLength);
600 int getMaximumNbOfCellsInPatch() const;
601 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
602 void copyOptions(const BoxSplittingOptions & other);
603 std::string printOptions() const;
606 std::string __str__() const
608 return self->printOptions();
614 namespace MEDCoupling
630 CONST_ON_TIME_INTERVAL = 7
631 } TypeOfTimeDiscretization;
639 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
640 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
642 } MEDCouplingMeshType;
644 class DataArrayInt32;
645 class DataArrayInt64;
646 class DataArrayDouble;
647 class MEDCouplingUMesh;
648 class MEDCouplingCMesh;
649 class MEDCouplingFieldDouble;
651 %extend RefCountObject
653 std::string getHiddenCppPointer() const
655 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
660 %extend MEDCouplingGaussLocalization
662 std::string __str__() const
664 return self->getStringRepr();
667 std::string __repr__() const
669 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
670 oss << self->getStringRepr();
677 class MEDCouplingMesh : public RefCountObject, public TimeLabel
680 void setName(const std::string& name);
681 std::string getName() const;
682 void setDescription(const std::string& descr);
683 std::string getDescription() const;
684 void setTime(double val, int iteration, int order);
685 void setTimeUnit(const std::string& unit);
686 std::string getTimeUnit() const;
687 virtual MEDCouplingMeshType getType() const;
688 bool isStructured() const;
689 virtual MEDCouplingMesh *deepCopy() const;
690 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
691 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
692 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
693 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
694 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
695 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
696 virtual void checkConsistencyLight() const;
697 virtual void checkConsistency(double eps=1e-12) const;
698 virtual int getNumberOfCells() const;
699 virtual int getNumberOfNodes() const;
700 virtual int getSpaceDimension() const;
701 virtual int getMeshDimension() const;
702 virtual DataArrayDouble *getCoordinatesAndOwner() const;
703 virtual DataArrayDouble *computeCellCenterOfMass() const;
704 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
705 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
706 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
707 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
708 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
709 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
710 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
711 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
712 virtual std::string simpleRepr() const;
713 virtual std::string advancedRepr() const;
714 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
715 virtual std::string getVTKFileExtension() const;
716 std::string getVTKFileNameOf(const std::string& fileName) const;
718 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
719 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
720 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
721 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
722 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
723 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
724 virtual MEDCouplingUMesh *buildUnstructured() const;
725 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
726 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
727 virtual DataArrayIdType *simplexize(int policy);
728 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
729 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
730 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
731 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
732 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
733 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
734 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
735 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
738 std::string __str__() const
740 return self->simpleRepr();
746 double tmp0=self->getTime(tmp1,tmp2);
747 PyObject *res = PyList_New(3);
748 PyList_SetItem(res,0,SWIG_From_double(tmp0));
749 PyList_SetItem(res,1,SWIG_From_int(tmp1));
750 PyList_SetItem(res,2,SWIG_From_int(tmp2));
754 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
756 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
757 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
763 mcIdType getCellContainingPoint(PyObject *p, double eps) const
767 DataArrayDoubleTuple *aa;
768 std::vector<double> bb;
770 int spaceDim=self->getSpaceDimension();
771 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
772 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
773 return self->getCellContainingPoint(pos,eps);
776 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
780 DataArrayDoubleTuple *aa;
781 std::vector<double> bb;
783 int spaceDim=self->getSpaceDimension();
784 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
785 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
786 MCAuto<DataArrayIdType> elts,eltsIndex;
787 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
788 PyObject *ret=PyTuple_New(2);
789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
794 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
798 DataArrayDoubleTuple *aa;
799 std::vector<double> bb;
801 int spaceDim=self->getSpaceDimension();
802 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
803 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
804 MCAuto<DataArrayIdType> elts,eltsIndex;
805 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
806 PyObject *ret=PyTuple_New(2);
807 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
808 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
812 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
814 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
815 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
818 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
820 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
821 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
824 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
828 DataArrayDoubleTuple *aa;
829 std::vector<double> bb;
831 int spaceDim=self->getSpaceDimension();
832 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
833 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
834 std::vector<mcIdType> elts;
835 self->getCellsContainingPoint(pos,eps,elts);
836 DataArrayIdType *ret=DataArrayIdType::New();
837 ret->alloc((int)elts.size(),1);
838 std::copy(elts.begin(),elts.end(),ret->getPointer());
839 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
842 virtual PyObject *getReverseNodalConnectivity() const
844 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
845 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
846 self->getReverseNodalConnectivity(d0,d1);
847 PyObject *ret=PyTuple_New(2);
848 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
849 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
853 void renumberCells(PyObject *li, bool check=true)
856 mcIdType v0; std::vector<mcIdType> v1;
857 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
858 self->renumberCells(ids,check);
861 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
863 DataArrayIdType *cellCor, *nodeCor;
864 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
865 PyObject *res = PyList_New(2);
866 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
867 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
871 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
873 DataArrayIdType *cellCor=0,*nodeCor=0;
874 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
875 PyObject *res = PyList_New(2);
876 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
877 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
881 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
883 DataArrayIdType *cellCor=0;
884 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
888 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
891 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
892 if (!SWIG_IsOK(res1))
895 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
896 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
900 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
902 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
903 da2->checkAllocated();
904 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
907 PyObject *getNodeIdsOfCell(int cellId) const
909 std::vector<mcIdType> conn;
910 self->getNodeIdsOfCell(cellId,conn);
911 return convertIntArrToPyList2(conn);
914 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
916 std::vector<double> coo;
917 self->getCoordinatesOfNode(nodeId,coo);
918 return convertDblArrToPyList2(coo);
921 void scale(PyObject *point, double factor)
925 DataArrayDoubleTuple *aa;
926 std::vector<double> bb;
928 int spaceDim=self->getSpaceDimension();
929 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
930 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
931 self->scale(pointPtr,factor);
934 PyObject *getBoundingBox() const
936 int spaceDim=self->getSpaceDimension();
937 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
938 self->getBoundingBox(tmp);
939 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
943 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
946 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
947 PyObject *ret=PyTuple_New(2);
948 PyObject *ret0Py=ret0?Py_True:Py_False;
950 PyTuple_SetItem(ret,0,ret0Py);
951 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
955 PyObject *buildPart(PyObject *li) const
957 mcIdType szArr,sw,iTypppArr;
958 std::vector<mcIdType> stdvecTyyppArr;
959 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
960 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
961 if(sw==3)//DataArrayIdType
963 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
964 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
965 std::string name=argpt->getName();
967 ret->setName(name.c_str());
969 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
972 PyObject *buildPartAndReduceNodes(PyObject *li) const
974 mcIdType szArr,sw,iTypppArr;
975 std::vector<mcIdType> stdvecTyyppArr;
976 DataArrayIdType *arr=0;
977 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
978 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
979 if(sw==3)//DataArrayIdType
981 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
982 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
983 std::string name=argpt->getName();
985 ret->setName(name.c_str());
988 PyObject *res = PyList_New(2);
989 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
990 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
991 PyList_SetItem(res,0,obj0);
992 PyList_SetItem(res,1,obj1);
996 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
999 DataArrayIdType *arr=0;
1000 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
1001 PyObject *res = PyTuple_New(2);
1002 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
1005 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1007 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
1008 PyTuple_SetItem(res,0,obj0);
1009 PyTuple_SetItem(res,1,obj1);
1013 PyObject *getDistributionOfTypes() const
1015 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1016 if(vals.size()%3!=0)
1017 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1018 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1019 for(std::size_t j=0;j<vals.size()/3;j++)
1021 PyObject *ret1=PyList_New(3);
1022 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1023 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1024 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1025 PyList_SetItem(ret,j,ret1);
1030 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1032 std::vector<mcIdType> code;
1033 std::vector<const DataArrayIdType *> idsPerType;
1034 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1035 convertPyToNewIntArr4(li,1,3,code);
1036 return self->checkTypeConsistencyAndContig(code,idsPerType);
1039 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1041 std::vector<mcIdType> code;
1042 std::vector<DataArrayIdType *> idsInPflPerType;
1043 std::vector<DataArrayIdType *> idsPerType;
1044 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1045 PyObject *ret=PyTuple_New(3);
1047 if(code.size()%3!=0)
1048 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1049 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1050 for(std::size_t j=0;j<code.size()/3;j++)
1052 PyObject *ret00=PyList_New(3);
1053 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1054 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1055 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1056 PyList_SetItem(ret0,j,ret00);
1058 PyTuple_SetItem(ret,0,ret0);
1060 PyObject *ret1=PyList_New(idsInPflPerType.size());
1061 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1062 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1063 PyTuple_SetItem(ret,1,ret1);
1064 std::size_t n=idsPerType.size();
1065 PyObject *ret2=PyList_New(n);
1066 for(std::size_t i=0;i<n;i++)
1067 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1068 PyTuple_SetItem(ret,2,ret2);
1072 void translate(PyObject *vector)
1076 DataArrayDoubleTuple *aa;
1077 std::vector<double> bb;
1079 int spaceDim=self->getSpaceDimension();
1080 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1081 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1082 self->translate(vectorPtr);
1085 void rotate(PyObject *center, double alpha)
1087 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1090 DataArrayDoubleTuple *aa;
1091 std::vector<double> bb;
1093 int spaceDim=self->getSpaceDimension();
1094 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1095 self->rotate(centerPtr,0,alpha);
1098 void rotate(PyObject *center, PyObject *vector, double alpha)
1100 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1102 DataArrayDouble *a,*a2;
1103 DataArrayDoubleTuple *aa,*aa2;
1104 std::vector<double> bb,bb2;
1106 int spaceDim=self->getSpaceDimension();
1107 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1108 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
1109 self->rotate(centerPtr,vectorPtr,alpha);
1112 PyObject *getAllGeoTypes() const
1114 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1115 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1116 PyObject *res=PyList_New(result.size());
1117 for(int i=0;iL!=result.end(); i++, iL++)
1118 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1122 virtual PyObject *getTinySerializationInformation() const
1124 std::vector<double> a0;
1125 std::vector<mcIdType> a1;
1126 std::vector<std::string> a2;
1127 self->getTinySerializationInformation(a0,a1,a2);
1128 PyObject *ret(PyTuple_New(3));
1129 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1130 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1131 std::size_t sz(a2.size());
1132 PyObject *ret2(PyList_New(sz));
1134 for(std::size_t i=0;i<sz;i++)
1135 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1137 PyTuple_SetItem(ret,2,ret2);
1141 virtual PyObject *serialize() const
1143 DataArrayIdType *a0Tmp(0);
1144 DataArrayDouble *a1Tmp(0);
1145 self->serialize(a0Tmp,a1Tmp);
1146 PyObject *ret(PyTuple_New(2));
1147 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1148 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1152 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1154 std::vector<std::string> littleStrings;
1155 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1158 PyObject *__getstate__() const
1160 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1161 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1162 PyObject *ret(PyTuple_New(2));
1163 PyTuple_SetItem(ret,0,ret0);
1164 PyTuple_SetItem(ret,1,ret1);
1168 void __setstate__(PyObject *inp)
1170 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1171 if(!PyTuple_Check(inp))
1172 throw INTERP_KERNEL::Exception(MSG);
1173 std::size_t sz(PyTuple_Size(inp));
1175 throw INTERP_KERNEL::Exception(MSG);
1176 PyObject *elt0(PyTuple_GetItem(inp,0));
1177 PyObject *elt1(PyTuple_GetItem(inp,1));
1178 std::vector<double> a0;
1179 std::vector<mcIdType> a1;
1180 std::vector<std::string> a2;
1181 DataArrayIdType *b0(0);
1182 DataArrayDouble *b1(0);
1184 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1185 throw INTERP_KERNEL::Exception(MSG);
1186 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1188 fillArrayWithPyListDbl3(a0py,tmp,a0);
1189 convertPyToNewIntArr3(a1py,a1);
1190 fillStringVector(a2py,a2);
1193 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1194 throw INTERP_KERNEL::Exception(MSG);
1195 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1197 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1198 if(!SWIG_IsOK(status))
1199 throw INTERP_KERNEL::Exception(MSG);
1200 b0=reinterpret_cast<DataArrayIdType *>(argp);
1201 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1202 if(!SWIG_IsOK(status))
1203 throw INTERP_KERNEL::Exception(MSG);
1204 b1=reinterpret_cast<DataArrayDouble *>(argp);
1206 // useless here to call resizeForUnserialization because arrays are well resized.
1207 self->unserialization(a0,a1,b0,b1,a2);
1210 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1212 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1213 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1214 return MEDCouplingMesh::MergeMeshes(tmp);
1220 //== MEDCouplingMesh End
1222 %include "NormalizedGeometricTypes"
1223 %include "MEDCouplingNatureOfFieldEnum"
1225 namespace MEDCoupling
1227 class MEDCouplingNatureOfField
1230 static const char *GetRepr(NatureOfField nat);
1231 static std::string GetReprNoThrow(NatureOfField nat);
1232 static std::string GetAllPossibilitiesStr();
1236 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1237 // include "MEDCouplingTimeDiscretization.i"
1239 namespace MEDCoupling
1241 class MEDCouplingGaussLocalization
1244 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1245 const std::vector<double>& gsCoo, const std::vector<double>& w);
1246 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1247 INTERP_KERNEL::NormalizedCellType getType() const;
1248 void setType(INTERP_KERNEL::NormalizedCellType typ);
1249 int getNumberOfGaussPt() const;
1250 int getDimension() const;
1251 int getNumberOfPtsInRefCell() const;
1252 std::string getStringRepr() const;
1253 void checkConsistencyLight() const;
1254 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1256 const std::vector<double>& getRefCoords() const;
1257 double getRefCoord(int ptIdInCell, int comp) const;
1258 const std::vector<double>& getGaussCoords() const;
1259 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1260 const std::vector<double>& getWeights() const;
1261 double getWeight(int gaussPtIdInCell, double newVal) const;
1262 void setRefCoord(int ptIdInCell, int comp, double newVal);
1263 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1264 void setWeight(int gaussPtIdInCell, double newVal);
1265 void setRefCoords(const std::vector<double>& refCoo);
1266 void setGaussCoords(const std::vector<double>& gsCoo);
1267 void setWeights(const std::vector<double>& w);
1269 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1273 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1275 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1279 MEDCouplingUMesh *buildRefCell() const
1281 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1287 class MEDCouplingSkyLineArray
1290 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1292 void set( DataArrayIdType* index, DataArrayIdType* value );
1293 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1295 int getSuperNumberOf() const;
1296 int getNumberOf() const;
1297 int getLength() const;
1299 void deletePack(const int i, const int j);
1301 void deleteSimplePack(const int i);
1302 void deleteSimplePacks(const DataArrayIdType* idx);
1304 MEDCouplingSkyLineArray *groupPacks(const DataArrayIdType *indexedPacks) const;
1305 MEDCouplingSkyLineArray *uniqueNotSortedByPack() const;
1307 MEDCouplingSkyLineArray *deepCopy() const;
1311 MEDCouplingSkyLineArray()
1313 return MEDCouplingSkyLineArray::New();
1316 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1318 return MEDCouplingSkyLineArray::New(index, value);
1321 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1323 return MEDCouplingSkyLineArray::New(index, value);
1326 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1328 return MEDCouplingSkyLineArray::New(other);
1331 std::string __str__() const
1333 return self->simpleRepr();
1336 DataArrayIdType *getSuperIndexArray() const
1338 DataArrayIdType *ret(self->getSuperIndexArray());
1344 DataArrayIdType *getIndexArray() const
1346 DataArrayIdType *ret(self->getIndexArray());
1352 DataArrayIdType *getValuesArray() const
1354 DataArrayIdType *ret(self->getValuesArray());
1360 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1362 std::vector<mcIdType> ret;
1363 self->getSimplePackSafe(absolutePackId,ret);
1364 return convertIntArrToPyList2(ret);
1367 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1369 std::vector<mcIdType> vpack, vspIdx, out;
1371 convertPyToNewIntArr3(superPackIndices,vspIdx);
1372 convertPyToNewIntArr3(pack,vpack);
1374 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1375 return convertIntArrToPyList2(out);
1378 void pushBackPack(const mcIdType i, PyObject *pack)
1380 std::vector<mcIdType> vpack;
1381 convertPyToNewIntArr3(pack,vpack);
1382 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1385 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1387 std::vector<mcIdType> vpack;
1388 convertPyToNewIntArr3(pack,vpack);
1389 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1392 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1394 std::vector<const DataArrayIdType*> packs;
1395 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1396 self->replaceSimplePacks(idx, packs);
1399 static MEDCouplingSkyLineArray *AggregatePacks(PyObject *sks)
1401 std::vector<const MEDCouplingSkyLineArray *> sksCpp;
1402 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingSkyLineArray*>(sks,SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray,"MEDCouplingSkyLineArray",sksCpp);
1403 return MEDCoupling::MEDCouplingSkyLineArray::AggregatePacks(sksCpp);
1406 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1408 std::vector<mcIdType> vpack;
1409 convertPyToNewIntArr3(pack,vpack);
1410 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1413 PyObject *convertToPolyhedronConn() const
1415 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1416 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1417 self->convertToPolyhedronConn(d0,d1);
1418 PyObject *ret=PyTuple_New(2);
1419 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1420 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1424 PyObject *thresholdPerPack(mcIdType threshold) const
1426 MCAuto<MEDCouplingSkyLineArray> left, right;
1427 self->thresholdPerPack(threshold,left,right);
1428 PyObject *ret=PyTuple_New(2);
1429 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(left.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1430 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(right.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 ));
1437 %include "MEDCouplingFieldDiscretization.i"
1439 //== MEDCouplingPointSet
1441 namespace MEDCoupling
1443 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1446 void setCoords(const DataArrayDouble *coords);
1447 DataArrayDouble *getCoordinatesAndOwner() const;
1448 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1450 double getCaracteristicDimension() const;
1451 void recenterForMaxPrecision(double eps);
1452 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1453 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1454 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1455 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1456 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1457 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1458 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1459 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1460 virtual DataArrayIdType *computeFetchedNodeIds() const;
1461 virtual int getNumberOfNodesInCell(int cellId) const;
1462 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1463 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1464 virtual DataArrayIdType *zipCoordsTraducer();
1465 virtual DataArrayIdType *findBoundaryNodes() const;
1466 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1467 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1468 virtual void checkFullyDefined() const;
1469 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1470 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1471 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1472 virtual void renumberNodesWithOffsetInConn(int offset);
1473 virtual bool areAllNodesFetched() const;
1474 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1475 virtual void invertOrientationOfAllCells();
1478 std::string __str__() const
1480 return self->simpleRepr();
1483 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1485 mcIdType newNbOfNodes;
1486 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1487 PyObject *res = PyList_New(2);
1488 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1489 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1493 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1495 DataArrayIdType *comm, *commIndex;
1496 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1497 PyObject *res = PyList_New(2);
1498 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1499 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1503 PyObject *getCoords()
1505 DataArrayDouble *ret1=self->getCoords();
1508 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1511 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1513 mcIdType szArr,sw,iTypppArr;
1514 std::vector<mcIdType> stdvecTyyppArr;
1515 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1516 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1517 if(sw==3)//DataArrayIdType
1519 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1520 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1521 std::string name=argpt->getName();
1523 ret->setName(name.c_str());
1525 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1528 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1530 mcIdType szArr,sw,iTypppArr;
1531 std::vector<mcIdType> stdvecTyyppArr;
1532 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1533 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1534 if(sw==3)//DataArrayIdType
1536 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1537 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1538 std::string name=argpt->getName();
1540 ret->setName(name.c_str());
1542 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1545 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1547 mcIdType szArr,sw,iTypppArr;
1548 std::vector<mcIdType> stdvecTyyppArr;
1549 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1550 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1551 if(sw==3)//DataArrayIdType
1553 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1554 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1555 std::string name=argpt->getName();
1557 ret->setName(name.c_str());
1559 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1562 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1564 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1565 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1568 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1570 mcIdType szArr,sw,iTypppArr;
1571 std::vector<mcIdType> stdvecTyyppArr;
1572 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1573 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1574 if(sw==3)//DataArrayIdType
1576 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1577 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1578 std::string name=argpt->getName();
1580 ret->setName(name.c_str());
1582 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1585 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1587 mcIdType szArr,sw,iTypppArr;
1588 std::vector<mcIdType> stdvecTyyppArr;
1589 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1590 self->renumberNodes(tmp,newNbOfNodes);
1593 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1595 mcIdType szArr,sw,iTypppArr;
1596 std::vector<mcIdType> stdvecTyyppArr;
1597 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1598 self->renumberNodesCenter(tmp,newNbOfNodes);
1601 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1603 int spaceDim=self->getSpaceDimension();
1605 DataArrayDouble *a,*a2;
1606 DataArrayDoubleTuple *aa,*aa2;
1607 std::vector<double> bb,bb2;
1609 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1610 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1611 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1612 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1613 std::vector<mcIdType> nodes;
1614 self->findNodesOnLine(p,v,eps,nodes);
1615 DataArrayIdType *ret=DataArrayIdType::New();
1616 ret->alloc(nodes.size(),1);
1617 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1618 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1620 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1622 int spaceDim=self->getSpaceDimension();
1624 DataArrayDouble *a,*a2;
1625 DataArrayDoubleTuple *aa,*aa2;
1626 std::vector<double> bb,bb2;
1628 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1629 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1630 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1631 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1632 std::vector<mcIdType> nodes;
1633 self->findNodesOnPlane(p,v,eps,nodes);
1634 DataArrayIdType *ret=DataArrayIdType::New();
1635 ret->alloc(nodes.size(),1);
1636 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1637 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1640 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1644 DataArrayDoubleTuple *aa;
1645 std::vector<double> bb;
1647 int spaceDim=self->getSpaceDimension();
1648 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1649 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1650 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1651 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1654 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1656 DataArrayIdType *c=0,*cI=0;
1660 DataArrayDoubleTuple *aa;
1661 std::vector<double> bb;
1663 int spaceDim=self->getSpaceDimension();
1664 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1665 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1666 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1667 PyObject *ret=PyTuple_New(2);
1668 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1669 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1673 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1675 DataArrayIdType *c=0,*cI=0;
1676 int spaceDim=self->getSpaceDimension();
1679 DataArrayDoubleTuple *aa;
1680 std::vector<double> bb;
1682 mcIdType nbOfTuples=-1;
1683 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1684 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1686 PyObject *ret=PyTuple_New(2);
1687 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1688 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1692 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1696 DataArrayDoubleTuple *aa;
1697 std::vector<double> bb;
1699 int spaceDim=self->getSpaceDimension();
1700 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1701 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1703 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1704 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1707 void duplicateNodesInCoords(PyObject *li)
1711 std::vector<mcIdType> multiVal;
1712 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1713 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1714 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1718 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1720 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1722 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1724 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1728 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1730 DataArrayIdType *v0(nullptr),*v1(nullptr);
1731 self->findCommonCells(compType,startCellId,v0,v1);
1732 PyObject *res = PyList_New(2);
1733 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1734 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1739 virtual void renumberNodesInConn(PyObject *li)
1743 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1746 MapII *da2(reinterpret_cast<MapII *>(da));
1747 self->renumberNodesInConn(da2->data());
1751 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1752 if (!SWIG_IsOK(res1))
1755 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1756 self->renumberNodesInConn(tmp);
1760 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1762 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1763 da2->checkAllocated();
1764 self->renumberNodesInConn(da2->getConstPointer());
1768 virtual PyObject *getNodeIdsInUse() const
1771 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1772 PyObject *ret=PyTuple_New(2);
1773 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1774 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1778 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1780 DataArrayIdType *ret(nullptr);
1782 mcIdType szArr,sw,iTypppArr;
1783 std::vector<mcIdType> stdvecTyyppArr;
1784 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1785 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1789 virtual PyObject *mergeNodes(double precision)
1793 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1794 PyObject *res = PyList_New(3);
1795 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1796 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1797 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1801 virtual PyObject *mergeNodesCenter(double precision)
1805 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1806 PyObject *res = PyList_New(3);
1807 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1808 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1809 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1813 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1816 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1817 if (!SWIG_IsOK(res1))
1820 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1821 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1825 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1827 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1828 da2->checkAllocated();
1829 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1833 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1837 std::vector<mcIdType> multiVal;
1838 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1839 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1840 mcIdType nbc=self->getNumberOfCells();
1841 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1848 std::ostringstream oss;
1849 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1850 throw INTERP_KERNEL::Exception(oss.str().c_str());
1853 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1858 mcIdType tmp=nbc+singleVal;
1859 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1863 std::ostringstream oss;
1864 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1865 throw INTERP_KERNEL::Exception(oss.str().c_str());
1871 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1875 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1880 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1881 daIntTyypp->checkAllocated();
1882 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1885 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1889 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1892 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1893 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1894 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1895 for(mcIdType i=0;i<sz;i++)
1896 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1899 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1902 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1903 mcIdType sw,nbNodes=0;
1904 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1905 std::vector<double> val3;
1906 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1907 "Rotate2DAlg",2,true,nbNodes);
1909 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1910 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1913 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1916 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1917 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1918 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1919 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1920 for(mcIdType i=0;i<sz;i++)
1921 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1924 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1927 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1928 mcIdType sw,nbNodes=0;
1929 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1930 std::vector<double> val3;
1931 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1932 "Rotate3DAlg",3,true,nbNodes);
1934 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1935 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1936 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1941 //== MEDCouplingPointSet End
1943 class MEDCouplingUMeshCell
1946 INTERP_KERNEL::NormalizedCellType getType() const;
1949 std::string __str__() const
1951 return self->repr();
1954 PyObject *getAllConn() const
1957 const mcIdType *r=self->getAllConn(ret2);
1958 PyObject *ret=PyTuple_New(ret2);
1959 for(mcIdType i=0;i<ret2;i++)
1960 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1966 class MEDCouplingUMeshCellIterator
1973 MEDCouplingUMeshCell *ret=self->nextt();
1975 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1978 PyErr_SetString(PyExc_StopIteration,"No more data.");
1985 class MEDCouplingUMeshCellByTypeIterator
1988 ~MEDCouplingUMeshCellByTypeIterator();
1993 MEDCouplingUMeshCellEntry *ret=self->nextt();
1995 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1998 PyErr_SetString(PyExc_StopIteration,"No more data.");
2005 class MEDCouplingUMeshCellByTypeEntry
2008 ~MEDCouplingUMeshCellByTypeEntry();
2011 MEDCouplingUMeshCellByTypeIterator *__iter__()
2013 return self->iterator();
2018 class MEDCouplingUMeshCellEntry
2021 INTERP_KERNEL::NormalizedCellType getType() const;
2022 int getNumberOfElems() const;
2025 MEDCouplingUMeshCellIterator *__iter__()
2027 return self->iterator();
2032 //== MEDCouplingUMesh
2034 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2037 static MEDCouplingUMesh *New();
2038 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2039 void checkConsistencyLight() const;
2040 void setMeshDimension(int meshDim);
2041 void allocateCells(int nbOfCells=0);
2042 void finishInsertingCells();
2043 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2044 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2045 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2046 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2047 int getNodalConnectivityArrayLen() const;
2048 void computeTypes();
2049 std::string reprConnectivityOfThis() const;
2050 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2052 DataArrayIdType *conformize2D(double eps);
2053 DataArrayIdType *conformize3D(double eps);
2054 DataArrayIdType *colinearize2D(double eps);
2055 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2056 void shiftNodeNumbersInConn(int delta);
2057 std::vector<bool> getQuadraticStatus() const;
2058 DataArrayIdType *findCellIdsOnBoundary() const;
2059 MEDCouplingUMesh *computeSkin() const;
2060 bool checkConsecutiveCellTypes() const;
2061 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2062 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2063 DataArrayIdType *sortCellsInMEDFileFrmt();
2064 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2065 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2066 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2067 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2068 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2069 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2070 void orientCorrectlyPolyhedrons();
2071 bool isPresenceOfQuadratic() const;
2072 bool isFullyQuadratic() const;
2073 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2074 bool isContiguous1D() const;
2075 void tessellate2D(double eps);
2076 void convertQuadraticCellsToLinear();
2077 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2078 void convertDegeneratedCells();
2079 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2080 bool removeDegenerated1DCells();
2081 bool areOnlySimplexCells() const;
2082 MEDCouplingFieldDouble *getEdgeRatioField() const;
2083 MEDCouplingFieldDouble *getAspectRatioField() const;
2084 MEDCouplingFieldDouble *getWarpField() const;
2085 MEDCouplingFieldDouble *getSkewField() const;
2086 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2087 DataArrayIdType *convexEnvelop2D();
2088 std::string cppRepr() const;
2089 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2090 DataArrayIdType *findAndCorrectBadOriented3DCells();
2091 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2092 MEDCouplingSkyLineArray *generateGraph() const;
2093 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2094 DataArrayIdType *buildUnionOf2DMesh() const;
2095 DataArrayIdType *buildUnionOf3DMesh() const;
2096 DataArrayIdType *orderConsecutiveCells1D() const;
2097 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2098 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2099 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2100 void changeOrientationOfCells();
2101 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2102 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2103 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2104 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2105 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2106 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2107 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2111 return MEDCouplingUMesh::New();
2114 MEDCouplingUMesh(const char *meshName, int meshDim)
2116 return MEDCouplingUMesh::New(meshName,meshDim);
2119 std::string __str__() const
2121 return self->simpleRepr();
2124 std::string __repr__() const
2126 std::ostringstream oss;
2127 self->reprQuickOverview(oss);
2131 MEDCouplingUMeshCellIterator *__iter__()
2133 return self->cellIterator();
2136 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2138 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2142 PyObject *getAllGeoTypesSorted() const
2144 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2145 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2146 PyObject *res=PyList_New(result.size());
2147 for(int i=0;iL!=result.end(); i++, iL++)
2148 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2152 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2156 std::vector<mcIdType> multiVal;
2157 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2158 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2159 mcIdType nbc=self->getNumberOfCells();
2160 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2167 std::ostringstream oss;
2168 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2169 throw INTERP_KERNEL::Exception(oss.str().c_str());
2173 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2180 mcIdType tmp=nbc+singleVal;
2181 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2186 std::ostringstream oss;
2187 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2188 throw INTERP_KERNEL::Exception(oss.str().c_str());
2194 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2200 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2201 daIntTyypp->checkAllocated();
2202 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2206 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2210 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2214 std::vector<mcIdType> multiVal;
2215 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2216 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2217 mcIdType nbc=self->getNumberOfCells();
2218 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2225 std::ostringstream oss;
2226 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2227 throw INTERP_KERNEL::Exception(oss.str().c_str());
2231 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2238 mcIdType tmp=nbc+singleVal;
2239 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2244 std::ostringstream oss;
2245 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2246 throw INTERP_KERNEL::Exception(oss.str().c_str());
2252 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2257 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2263 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2264 daIntTyypp->checkAllocated();
2265 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2269 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2273 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2275 mcIdType szArr,sw,iTypppArr;
2276 std::vector<mcIdType> stdvecTyyppArr;
2277 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2280 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2281 throw INTERP_KERNEL::Exception(oss.str().c_str());
2283 self->insertNextCell(type,size,tmp);
2286 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2288 mcIdType szArr,sw,iTypppArr;
2289 std::vector<mcIdType> stdvecTyyppArr;
2290 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2291 self->insertNextCell(type,szArr,tmp);
2294 DataArrayIdType *getNodalConnectivity()
2296 DataArrayIdType *ret=self->getNodalConnectivity();
2301 DataArrayIdType *getNodalConnectivityIndex()
2303 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2309 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2311 mcIdType szArr,sw,iTypppArr;
2312 std::vector<mcIdType> stdvecTyyppArr;
2313 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2314 mcIdType nbOfDepthPeelingPerformed=0;
2315 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2316 PyObject *res=PyTuple_New(2);
2317 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2318 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2322 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2324 DataArrayIdType *v0=0,*v1=0;
2325 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2326 PyObject *res = PyList_New(2);
2327 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2328 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2332 PyObject *distanceToPoint(PyObject *point) const
2336 DataArrayDoubleTuple *aa;
2337 std::vector<double> bb;
2339 int nbOfCompo=self->getSpaceDimension();
2340 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2343 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2344 PyObject *ret=PyTuple_New(2);
2345 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2346 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2350 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2352 DataArrayIdType *ret1=0;
2353 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2354 PyObject *ret=PyTuple_New(2);
2355 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2356 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2360 PyObject *tetrahedrize(int policy)
2363 DataArrayIdType *ret1(0);
2364 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2365 PyObject *ret=PyTuple_New(3);
2366 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2367 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2368 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2372 PyObject *checkButterflyCells(double eps=1e-12)
2374 std::vector<mcIdType> cells;
2375 self->checkButterflyCells(cells,eps);
2376 DataArrayIdType *ret=DataArrayIdType::New();
2377 ret->alloc(cells.size(),1);
2378 std::copy(cells.begin(),cells.end(),ret->getPointer());
2379 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2382 PyObject *splitByType() const
2384 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2385 std::size_t sz=ms.size();
2386 PyObject *ret = PyList_New(sz);
2387 for(std::size_t i=0;i<sz;i++)
2388 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2392 PyObject *partitionBySpreadZone() const
2394 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2395 std::size_t sz=retCpp.size();
2396 PyObject *ret=PyList_New(sz);
2397 for(std::size_t i=0;i<sz;i++)
2398 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2402 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2404 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2405 std::size_t sz=retCpp.size();
2406 PyObject *ret=PyList_New(sz);
2407 for(std::size_t i=0;i<sz;i++)
2408 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2412 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2415 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2416 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2420 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2423 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2424 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2428 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2431 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2432 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2436 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2438 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2439 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2440 PyObject *ret=PyTuple_New(3);
2441 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2442 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2447 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2449 DataArrayIdType *tmp0=0,*tmp1=0;
2450 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2451 PyObject *ret=PyTuple_New(2);
2452 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2457 void duplicateNodes(PyObject *li)
2461 std::vector<mcIdType> multiVal;
2462 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2463 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2464 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2468 return self->duplicateNodes(&singleVal,&singleVal+1);
2470 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2472 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2474 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2478 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2482 std::vector<mcIdType> multiVal;
2483 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2484 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2485 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2489 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2491 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2493 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2495 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2499 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2501 mcIdType szArr,sw,iTypppArr;
2502 std::vector<mcIdType> stdvecTyyppArr;
2503 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2504 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2507 PyObject *getLevArrPerCellTypes(PyObject *li) const
2510 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2511 DataArrayIdType *tmp0,*tmp1=0;
2512 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2513 PyObject *ret=PyTuple_New(2);
2514 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2515 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2519 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2521 DataArrayIdType *ret0=0,*ret1=0;
2522 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2523 PyObject *ret=PyTuple_New(2);
2524 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2525 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2529 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2531 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2532 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2533 DataArrayIdType *ret1=0,*ret2=0;
2534 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2535 PyObject *ret=PyTuple_New(3);
2536 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2537 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2538 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2542 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2544 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2545 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2546 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2547 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2550 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2553 std::vector<const MEDCouplingUMesh *> meshes;
2554 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2555 std::vector<DataArrayIdType *> corr;
2556 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2558 PyObject *ret1=PyList_New(sz);
2559 for(std::size_t i=0;i<sz;i++)
2560 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2561 PyObject *ret=PyList_New(2);
2562 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2563 PyList_SetItem(ret,1,ret1);
2567 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2569 std::vector<MEDCouplingUMesh *> meshes;
2570 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2571 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2574 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2576 std::vector<MEDCouplingUMesh *> meshes;
2577 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2578 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2581 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2585 DataArrayDoubleTuple *aa;
2586 std::vector<double> bb;
2588 int spaceDim=self->getSpaceDimension();
2589 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2590 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2592 std::vector<mcIdType> cells;
2593 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2594 DataArrayIdType *ret=DataArrayIdType::New();
2595 ret->alloc(cells.size(),1);
2596 std::copy(cells.begin(),cells.end(),ret->getPointer());
2597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2600 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2604 DataArrayDoubleTuple *aa;
2605 std::vector<double> bb;
2607 int spaceDim=self->getSpaceDimension();
2608 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2609 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2610 self->orientCorrectly2DCells(v,polyOnly);
2613 PyObject *arePolyhedronsNotCorrectlyOriented() const
2615 std::vector<mcIdType> cells;
2616 self->arePolyhedronsNotCorrectlyOriented(cells);
2617 DataArrayIdType *ret=DataArrayIdType::New();
2618 ret->alloc(cells.size(),1);
2619 std::copy(cells.begin(),cells.end(),ret->getPointer());
2620 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2623 PyObject *getFastAveragePlaneOfThis() const
2627 self->getFastAveragePlaneOfThis(vec,pos);
2629 std::copy(vec,vec+3,vals);
2630 std::copy(pos,pos+3,vals+3);
2631 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2634 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2636 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2637 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2638 return MEDCouplingUMesh::MergeUMeshes(tmp);
2641 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2643 DataArrayIdType *ret1;
2644 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2645 PyObject *ret=PyTuple_New(2);
2646 PyObject *ret0Py=ret0?Py_True:Py_False;
2648 PyTuple_SetItem(ret,0,ret0Py);
2649 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2653 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2655 DataArrayIdType *ret1;
2656 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2657 PyObject *ret=PyTuple_New(2);
2658 PyObject *ret0Py=ret0?Py_True:Py_False;
2660 PyTuple_SetItem(ret,0,ret0Py);
2661 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2665 PyObject *explode3DMeshTo1D() const
2667 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2668 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2669 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2670 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2671 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2672 PyObject *ret=PyTuple_New(5);
2673 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2674 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2675 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2676 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2677 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2681 PyObject *explodeIntoEdges() const
2683 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2684 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2685 PyObject *ret=PyTuple_New(5);
2686 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2687 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2688 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2689 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2690 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2694 PyObject *explodeMeshIntoMicroEdges() const
2696 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2697 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2698 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2699 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2700 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2701 PyObject *ret=PyTuple_New(5);
2702 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2703 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2704 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2705 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2706 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2710 PyObject *buildDescendingConnectivity() const
2712 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2713 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2714 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2715 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2716 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2717 PyObject *ret=PyTuple_New(5);
2718 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2719 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2720 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2721 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2722 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2726 PyObject *buildDescendingConnectivity2() const
2728 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2729 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2730 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2731 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2732 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2733 PyObject *ret=PyTuple_New(5);
2734 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2735 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2736 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2737 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2738 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2742 PyObject *computeNeighborsOfCells() const
2744 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2745 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2746 PyObject *ret=PyTuple_New(2);
2747 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2748 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2752 PyObject *computeNeighborsOfNodes() const
2754 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2755 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2756 PyObject *ret=PyTuple_New(2);
2757 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2758 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyObject *computeEnlargedNeighborsOfNodes() const
2764 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2765 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2766 PyObject *ret=PyTuple_New(2);
2767 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2768 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2772 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2774 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2775 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2776 PyObject *ret=PyTuple_New(2);
2777 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2778 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2782 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2784 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2785 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2786 PyObject *ret=PyTuple_New(2);
2787 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2788 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2792 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2794 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2795 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2796 DataArrayIdType *d2,*d3,*d4,*dd5;
2797 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2798 PyObject *ret=PyTuple_New(7);
2799 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2800 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2801 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2802 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2803 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2804 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2805 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2809 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2812 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2813 da->checkAllocated();
2814 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2817 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2820 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2821 da->checkAllocated();
2822 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2825 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2828 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2829 da->checkAllocated();
2830 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2833 PyObject *getTypesOfPart(DataArrayIdType *da) const
2836 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2837 da->checkAllocated();
2838 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2839 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2840 PyObject *res = PyList_New(result.size());
2841 for (int i=0;iL!=result.end(); i++, iL++)
2842 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2846 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2849 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2850 da->checkAllocated();
2851 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2852 ret->setName(da->getName().c_str());
2856 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2858 DataArrayIdType *cellNb1=0,*cellNb2=0;
2859 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2860 PyObject *ret=PyTuple_New(3);
2861 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2862 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2863 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2867 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2869 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2870 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2871 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2872 PyObject *ret(PyTuple_New(4));
2873 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2874 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2875 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2876 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2880 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2882 int spaceDim=self->getSpaceDimension();
2884 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2886 DataArrayDouble *a,*a2;
2887 DataArrayDoubleTuple *aa,*aa2;
2888 std::vector<double> bb,bb2;
2890 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2891 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2892 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2893 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2895 DataArrayIdType *cellIds=0;
2896 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2897 PyObject *ret=PyTuple_New(2);
2898 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2899 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2903 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2905 int spaceDim=self->getSpaceDimension();
2907 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2909 DataArrayDouble *a,*a2;
2910 DataArrayDoubleTuple *aa,*aa2;
2911 std::vector<double> bb,bb2;
2913 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2914 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2915 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2916 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2918 DataArrayIdType *cellIds=0;
2919 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2920 PyObject *ret=PyTuple_New(2);
2921 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2922 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2926 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2929 DataArrayDouble *a,*a2;
2930 DataArrayDoubleTuple *aa,*aa2;
2931 std::vector<double> bb,bb2;
2933 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2934 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2935 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2936 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2937 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2941 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2943 int spaceDim=self->getSpaceDimension();
2945 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2947 DataArrayDouble *a,*a2;
2948 DataArrayDoubleTuple *aa,*aa2;
2949 std::vector<double> bb,bb2;
2951 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2952 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2953 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2954 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2955 return self->getCellIdsCrossingPlane(orig,vect,eps);
2958 void convertToPolyTypes(PyObject *li)
2962 std::vector<mcIdType> pos2;
2963 DataArrayIdType *pos3=0;
2964 DataArrayIdTypeTuple *pos4=0;
2965 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2970 self->convertToPolyTypes(&pos1,&pos1+1);
2977 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2982 self->convertToPolyTypes(pos3->begin(),pos3->end());
2986 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2990 void convertAllToPoly();
2991 void convertExtrudedPolyhedra();
2993 void simplifyPolyhedra(double eps);
2994 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2995 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2998 //== MEDCouplingUMesh End
3000 //== MEDCouplingMappedExtrudedMesh
3002 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
3005 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
3006 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
3007 MEDCouplingUMesh *build3DUnstructuredMesh() const;
3008 int get2DCellIdForExtrusion() const;
3010 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
3012 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3015 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3017 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3020 MEDCouplingMappedExtrudedMesh()
3022 return MEDCouplingMappedExtrudedMesh::New();
3025 std::string __str__() const
3027 return self->simpleRepr();
3030 std::string __repr__() const
3032 std::ostringstream oss;
3033 self->reprQuickOverview(oss);
3037 PyObject *getMesh2D() const
3039 MEDCouplingUMesh *ret=self->getMesh2D();
3042 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3044 PyObject *getMesh1D() const
3046 MEDCouplingUMesh *ret=self->getMesh1D();
3049 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3051 PyObject *getMesh3DIds() const
3053 DataArrayIdType *ret=self->getMesh3DIds();
3056 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3061 //== MEDCouplingMappedExtrudedMesh End
3063 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3066 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3067 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3068 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3069 int getNodalConnectivityLength() const;
3070 virtual void allocateCells(int nbOfCells=0);
3071 virtual void checkConsistencyOfConnectivity() const;
3074 virtual void insertNextCell(PyObject *li)
3076 mcIdType szArr,sw,iTypppArr;
3077 std::vector<mcIdType> stdvecTyyppArr;
3078 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3079 self->insertNextCell(tmp,tmp+szArr);
3082 virtual DataArrayIdType *getNodalConnectivity() const
3084 DataArrayIdType *ret=self->getNodalConnectivity();
3085 if(ret) ret->incrRef();
3089 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3091 std::vector< const MEDCoupling1GTUMesh *> parts;
3092 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3093 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3098 //== MEDCoupling1SGTUMesh
3100 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3103 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3104 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3105 void setNodalConnectivity(DataArrayIdType *nodalConn);
3106 int getNumberOfNodesPerCell() const;
3107 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3108 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3109 MEDCoupling1GTUMesh *computeDualMesh() const;
3110 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3111 DataArrayIdType *sortHexa8EachOther();
3114 MEDCoupling1SGTUMesh()
3116 return MEDCoupling1SGTUMesh::New();
3119 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3121 return MEDCoupling1SGTUMesh::New(name,type);
3124 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3126 return MEDCoupling1SGTUMesh::New(m);
3129 std::string __str__() const
3131 return self->simpleRepr();
3134 std::string __repr__() const
3136 std::ostringstream oss;
3137 self->reprQuickOverview(oss);
3141 PyObject *structurizeMe(double eps=1e-12) const
3143 DataArrayIdType *cellPerm(0),*nodePerm(0);
3144 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3145 PyObject *ret(PyTuple_New(3));
3146 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3147 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3148 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3152 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3154 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3155 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3156 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3159 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3161 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3162 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3163 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3168 //== MEDCoupling1SGTUMesh End
3170 //== MEDCoupling1DGTUMesh
3172 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3175 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3176 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3177 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3178 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3179 bool isPacked() const;
3182 MEDCoupling1DGTUMesh()
3184 return MEDCoupling1DGTUMesh::New();
3186 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3188 return MEDCoupling1DGTUMesh::New(name,type);
3191 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3193 return MEDCoupling1DGTUMesh::New(m);
3196 std::string __str__() const
3198 return self->simpleRepr();
3201 std::string __repr__() const
3203 std::ostringstream oss;
3204 self->reprQuickOverview(oss);
3208 DataArrayIdType *getNodalConnectivityIndex() const
3210 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3211 if(ret) ret->incrRef();
3215 PyObject *retrievePackedNodalConnectivity() const
3217 DataArrayIdType *ret1=0,*ret2=0;
3218 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3219 PyObject *ret0Py=ret0?Py_True:Py_False;
3221 PyObject *ret=PyTuple_New(3);
3222 PyTuple_SetItem(ret,0,ret0Py);
3223 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3224 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3228 PyObject *copyWithNodalConnectivityPacked() const
3231 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3232 PyObject *ret=PyTuple_New(2);
3233 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3234 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3235 PyTuple_SetItem(ret,1,ret1Py);
3239 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3241 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3242 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3243 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3246 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3248 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3249 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3250 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3253 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3255 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3256 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3257 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3262 //== MEDCoupling1DGTUMeshEnd
3264 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3267 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3268 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3269 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3270 int getSpaceDimensionOnNodeStruct() const;
3271 double computeSquareness() const;
3272 virtual std::vector<mcIdType> getNodeGridStructure() const;
3273 std::vector<mcIdType> getCellGridStructure() const;
3274 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3275 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3276 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3277 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3278 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3279 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3280 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3281 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3284 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3286 mcIdType tmpp1=-1,tmpp2=-1;
3287 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3288 std::vector< std::pair<mcIdType,mcIdType> > inp;
3292 for(mcIdType i=0;i<tmpp1;i++)
3293 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3298 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3299 inp.resize(tmpp1/2);
3300 for(mcIdType i=0;i<tmpp1/2;i++)
3301 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3304 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3305 return self->buildStructuredSubPart(inp);
3308 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3310 std::vector< std::pair<mcIdType,mcIdType> > inp;
3311 convertPyToVectorPairInt(part,inp);
3313 mcIdType szArr,sw,iTypppArr;
3314 std::vector<mcIdType> stdvecTyyppArr;
3315 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3316 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3318 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3321 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3323 std::vector< std::pair<mcIdType,mcIdType> > inp;
3324 convertPyToVectorPairInt(part,inp);
3325 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3328 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3330 std::vector< std::pair<mcIdType,mcIdType> > inp;
3331 convertPyToVectorPairInt(part,inp);
3332 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3335 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3337 std::vector< std::pair<mcIdType,mcIdType> > inp;
3338 convertPyToVectorPairInt(part,inp);
3339 std::vector<mcIdType> stWithGhost;
3340 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3341 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3342 PyObject *ret(PyTuple_New(2));
3343 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3344 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3348 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3350 std::vector< std::pair<mcIdType,mcIdType> > inp;
3351 convertPyToVectorPairInt(partCompactFormat,inp);
3352 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3355 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3357 std::vector< std::pair<mcIdType,mcIdType> > inp;
3358 convertPyToVectorPairInt(partCompactFormat,inp);
3359 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3362 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3364 std::vector< std::pair<mcIdType,mcIdType> > inp;
3365 convertPyToVectorPairInt(part,inp);
3366 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3369 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3371 mcIdType szArr,sw,iTypppArr;
3372 std::vector<mcIdType> stdvecTyyppArr;
3373 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3374 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3377 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3379 mcIdType szArr,sw,iTypppArr;
3380 std::vector<mcIdType> stdvecTyyppArr;
3381 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3382 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3385 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3387 std::vector< std::pair<mcIdType,mcIdType> > inp;
3388 convertPyToVectorPairInt(partCompactFormat,inp);
3389 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3392 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3394 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3395 PyObject *retPy=PyList_New(ret.size());
3396 for(std::size_t i=0;i<ret.size();i++)
3398 PyObject *tmp=PyTuple_New(2);
3399 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3400 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3401 PyList_SetItem(retPy,i,tmp);
3406 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3408 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3409 convertPyToVectorPairInt(r1,r1Cpp);
3410 convertPyToVectorPairInt(r2,r2Cpp);
3411 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3412 PyObject *retPy=PyList_New(ret.size());
3413 for(std::size_t i=0;i<ret.size();i++)
3415 PyObject *tmp=PyTuple_New(2);
3416 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3417 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3418 PyList_SetItem(retPy,i,tmp);
3423 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3425 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3426 convertPyToVectorPairInt(r1,r1Cpp);
3427 convertPyToVectorPairInt(r2,r2Cpp);
3428 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3431 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3433 mcIdType szArr,sw,iTypppArr;
3434 std::vector<mcIdType> stdvecTyyppArr;
3435 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3436 mcIdType szArr2,sw2,iTypppArr2;
3437 std::vector<mcIdType> stdvecTyyppArr2;
3438 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3439 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3440 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3441 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3442 PyObject *ret=PyTuple_New(2);
3443 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3444 PyTuple_SetItem(ret,0,ret0Py);
3445 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3446 for(std::size_t i=0;i<partCompactFormat.size();i++)
3448 PyObject *tmp4=PyTuple_New(2);
3449 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3450 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3451 PyList_SetItem(ret1Py,i,tmp4);
3453 PyTuple_SetItem(ret,1,ret1Py);
3457 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3459 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3460 convertPyToVectorPairInt(bigInAbs,param0);
3461 convertPyToVectorPairInt(partOfBigInAbs,param1);
3462 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3463 PyObject *retPy(PyList_New(ret.size()));
3464 for(std::size_t i=0;i<ret.size();i++)
3466 PyObject *tmp(PyTuple_New(2));
3467 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3468 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3469 PyList_SetItem(retPy,i,tmp);
3474 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3476 std::vector< std::pair<mcIdType,mcIdType> > param0;
3477 convertPyToVectorPairInt(part,param0);
3478 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3479 PyObject *retPy(PyList_New(ret.size()));
3480 for(std::size_t i=0;i<ret.size();i++)
3482 PyObject *tmp(PyTuple_New(2));
3483 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3484 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3485 PyList_SetItem(retPy,i,tmp);
3490 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3492 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3493 convertPyToVectorPairInt(startingFrom,param0);
3494 convertPyToVectorPairInt(goingTo,param1);
3495 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3498 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3500 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3501 convertPyToVectorPairInt(bigInAbs,param0);
3502 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3503 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3504 PyObject *retPy(PyList_New(ret.size()));
3505 for(std::size_t i=0;i<ret.size();i++)
3507 PyObject *tmp(PyTuple_New(2));
3508 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3509 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3510 PyList_SetItem(retPy,i,tmp);
3517 class MEDCouplingCurveLinearMesh;
3519 //== MEDCouplingCMesh
3521 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3524 static MEDCouplingCMesh *New();
3525 static MEDCouplingCMesh *New(const std::string& meshName);
3526 void setCoords(const DataArrayDouble *coordsX,
3527 const DataArrayDouble *coordsY=0,
3528 const DataArrayDouble *coordsZ=0);
3529 void setCoordsAt(int i, const DataArrayDouble *arr);
3530 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3534 return MEDCouplingCMesh::New();
3536 MEDCouplingCMesh(const std::string& meshName)
3538 return MEDCouplingCMesh::New(meshName);
3540 std::string __str__() const
3542 return self->simpleRepr();
3544 std::string __repr__() const
3546 std::ostringstream oss;
3547 self->reprQuickOverview(oss);
3550 DataArrayDouble *getCoordsAt(int i)
3552 DataArrayDouble *ret=self->getCoordsAt(i);
3560 //== MEDCouplingCMesh End
3562 //== MEDCouplingCurveLinearMesh
3564 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3567 static MEDCouplingCurveLinearMesh *New();
3568 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3569 void setCoords(const DataArrayDouble *coords);
3571 MEDCouplingCurveLinearMesh()
3573 return MEDCouplingCurveLinearMesh::New();
3575 MEDCouplingCurveLinearMesh(const std::string& meshName)
3577 return MEDCouplingCurveLinearMesh::New(meshName);
3579 std::string __str__() const
3581 return self->simpleRepr();
3583 std::string __repr__() const
3585 std::ostringstream oss;
3586 self->reprQuickOverview(oss);
3589 DataArrayDouble *getCoords()
3591 DataArrayDouble *ret=self->getCoords();
3596 void setNodeGridStructure(PyObject *gridStruct)
3598 mcIdType szArr,sw,iTypppArr;
3599 std::vector<mcIdType> stdvecTyyppArr;
3600 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3601 self->setNodeGridStructure(tmp,tmp+szArr);
3606 //== MEDCouplingCurveLinearMesh End
3608 //== MEDCouplingIMesh
3610 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3613 static MEDCouplingIMesh *New();
3615 void setSpaceDimension(int spaceDim);
3616 std::vector<mcIdType> getNodeStruct() const;
3617 std::vector<double> getOrigin() const;
3618 std::vector<double> getDXYZ() const;
3619 void setAxisUnit(const std::string& unitName);
3620 std::string getAxisUnit() const;
3621 double getMeasureOfAnyCell() const;
3622 MEDCouplingCMesh *convertToCartesian() const;
3623 void refineWithFactor(const std::vector<mcIdType>& factors);
3624 MEDCouplingIMesh *asSingleCell() const;
3625 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3630 return MEDCouplingIMesh::New();
3632 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3634 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3635 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3636 const mcIdType *nodeStrctPtr(0);
3637 const double *originPtr(0),*dxyzPtr(0);
3638 mcIdType sw,sz,val0;
3639 std::vector<mcIdType> bb0;
3640 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3643 std::vector<double> bb,bb2;
3645 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3646 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3648 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3651 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3653 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3656 void setNodeStruct(PyObject *nodeStrct)
3658 mcIdType sw,sz,val0;
3659 std::vector<mcIdType> bb0;
3660 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3661 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3664 void setOrigin(PyObject *origin)
3666 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3668 std::vector<double> bb;
3669 mcIdType sw,nbTuples;
3670 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3671 self->setOrigin(originPtr,originPtr+nbTuples);
3674 void setDXYZ(PyObject *dxyz)
3676 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3678 std::vector<double> bb;
3679 mcIdType sw,nbTuples;
3680 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3681 self->setDXYZ(originPtr,originPtr+nbTuples);
3684 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3686 std::vector< std::pair<mcIdType,mcIdType> > inp;
3687 convertPyToVectorPairInt(fineLocInCoarse,inp);
3688 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3691 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3693 std::vector< std::pair<mcIdType,mcIdType> > inp;
3694 convertPyToVectorPairInt(fineLocInCoarse,inp);
3695 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3698 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3700 std::vector< std::pair<mcIdType,mcIdType> > inp;
3701 convertPyToVectorPairInt(fineLocInCoarse,inp);
3702 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3705 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3707 std::vector< std::pair<mcIdType,mcIdType> > inp;
3708 convertPyToVectorPairInt(fineLocInCoarse,inp);
3709 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3712 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3714 std::vector< std::pair<mcIdType,mcIdType> > inp;
3715 convertPyToVectorPairInt(fineLocInCoarse,inp);
3716 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3719 std::string __str__() const
3721 return self->simpleRepr();
3723 std::string __repr__() const
3725 std::ostringstream oss;
3726 self->reprQuickOverview(oss);
3732 //== MEDCouplingIMesh End
3736 namespace MEDCoupling
3738 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3741 virtual void checkConsistencyLight() const;
3742 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3743 bool areStrictlyCompatible(const MEDCouplingField *other) const;
3744 bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
3745 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3746 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3747 void setName(const char *name);
3748 std::string getDescription() const;
3749 void setDescription(const char *desc);
3750 std::string getName() const;
3751 TypeOfField getTypeOfField() const;
3752 NatureOfField getNature() const;
3753 virtual void setNature(NatureOfField nat);
3754 DataArrayDouble *getLocalizationOfDiscr() const;
3755 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3756 mcIdType getNumberOfTuplesExpected() const;
3757 mcIdType getNumberOfMeshPlacesExpected() const;
3758 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3759 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3760 void clearGaussLocalizations();
3761 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3762 mcIdType getNbOfGaussLocalization() const;
3763 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3764 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3765 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3766 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3768 PyObject *getMesh() const
3770 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3773 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3776 PyObject *getDiscretization()
3778 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3781 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3784 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3786 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3787 return convertIntArrToPyList3(ret);
3790 PyObject *buildSubMeshData(PyObject *li) const
3792 DataArrayIdType *ret1=0;
3793 MEDCouplingMesh *ret0=0;
3795 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3796 if (!SWIG_IsOK(res1))
3799 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3800 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3804 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3806 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3807 da2->checkAllocated();
3808 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3810 PyObject *res = PyList_New(2);
3811 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3812 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3816 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3818 DataArrayIdType *ret1=0;
3820 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3821 PyObject *res=PyTuple_New(2);
3822 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3824 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3827 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3828 PyTuple_SetItem(res,1,res1);
3833 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3836 mcIdType v0; std::vector<mcIdType> v1;
3837 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3838 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3841 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3842 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3845 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3846 if (!SWIG_IsOK(res1))
3849 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3850 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3854 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3856 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3857 da2->checkAllocated();
3858 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3862 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3864 std::vector<mcIdType> tmp;
3865 self->getCellIdsHavingGaussLocalization(locId,tmp);
3866 DataArrayIdType *ret=DataArrayIdType::New();
3867 ret->alloc((mcIdType)tmp.size(),1);
3868 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3869 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3872 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3874 std::vector<mcIdType> inp0;
3875 convertPyToNewIntArr4(code,1,3,inp0);
3876 std::vector<const DataArrayIdType *> inp1;
3877 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3878 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3883 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3886 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3887 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3888 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3889 static MEDCouplingFieldTemplate *New(TypeOfField type);
3890 std::string simpleRepr() const;
3891 std::string advancedRepr() const;
3892 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3893 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3896 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3898 return MEDCouplingFieldTemplate::New(f);
3901 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3903 return MEDCouplingFieldTemplate::New(f);
3906 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3908 return MEDCouplingFieldTemplate::New(f);
3911 MEDCouplingFieldTemplate(TypeOfField type)
3913 return MEDCouplingFieldTemplate::New(type);
3916 std::string __str__() const
3918 return self->simpleRepr();
3921 std::string __repr__() const
3923 std::ostringstream oss;
3924 self->reprQuickOverview(oss);
3928 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3931 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3932 PyObject *ret=PyTuple_New(2);
3933 PyObject *ret0Py=ret0?Py_True:Py_False;
3935 PyTuple_SetItem(ret,0,ret0Py);
3936 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3943 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3946 TypeOfTimeDiscretization getTimeDiscretization() const;
3948 MEDCouplingFieldT();
3949 ~MEDCouplingFieldT();
3952 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3953 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3954 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3956 class MEDCouplingFieldInt;
3957 class MEDCouplingFieldFloat;
3959 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3962 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3963 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3964 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3965 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3966 void setTimeUnit(const std::string& unit);
3967 std::string getTimeUnit() const;
3968 void synchronizeTimeWithSupport();
3969 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3970 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3971 std::string simpleRepr() const;
3972 std::string advancedRepr() const;
3973 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3974 MEDCouplingFieldInt *convertToIntField() const;
3975 MEDCouplingFieldFloat *convertToFloatField() const;
3976 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3977 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3978 MEDCouplingFieldDouble *deepCopy() const;
3979 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3980 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3981 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3982 double getIJ(int tupleId, int compoId) const;
3983 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3984 void synchronizeTimeWithMesh();
3985 void setArray(DataArrayDouble *array);
3986 void setEndArray(DataArrayDouble *array);
3987 void setTime(double val, int iteration, int order);
3988 void setStartTime(double val, int iteration, int order);
3989 void setEndTime(double val, int iteration, int order);
3990 void applyLin(double a, double b, int compoId);
3991 void applyLin(double a, double b);
3992 int getNumberOfComponents() const;
3993 int getNumberOfTuples() const;
3994 int getNumberOfValues() const;
3995 void setTimeTolerance(double val);
3996 double getTimeTolerance() const;
3997 void setIteration(int it);
3998 void setEndIteration(int it);
3999 void setOrder(int order);
4000 void setEndOrder(int order);
4001 void setTimeValue(double val);
4002 void setEndTimeValue(double val);
4003 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
4004 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
4005 bool mergeNodes(double eps, double epsOnVals=1e-15);
4006 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
4007 bool zipCoords(double epsOnVals=1e-15);
4008 bool zipConnectivity(int compType,double epsOnVals=1e-15);
4009 bool simplexize(int policy);
4010 MEDCouplingFieldDouble *doublyContractedProduct() const;
4011 MEDCouplingFieldDouble *determinant() const;
4012 MEDCouplingFieldDouble *eigenValues() const;
4013 MEDCouplingFieldDouble *eigenVectors() const;
4014 MEDCouplingFieldDouble *inverse() const;
4015 MEDCouplingFieldDouble *trace() const;
4016 MEDCouplingFieldDouble *deviator() const;
4017 MEDCouplingFieldDouble *magnitude() const;
4018 MEDCouplingFieldDouble *maxPerTuple() const;
4019 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
4020 void sortPerTuple(bool asc);
4021 MEDCouplingFieldDouble &operator=(double value);
4022 void fillFromAnalytic(int nbOfComp, const std::string& func);
4023 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4024 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4025 void applyFunc(int nbOfComp, const std::string& func);
4026 void applyFuncCompo(int nbOfComp, const std::string& func);
4027 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4028 void applyFunc(int nbOfComp, double val);
4029 void applyFunc(const std::string& func);
4030 void applyFuncFast32(const std::string& func);
4031 void applyFuncFast64(const std::string& func);
4032 double accumulate(int compId) const;
4033 double getMaxValue() const;
4034 double getMinValue() const;
4035 double getAverageValue() const;
4036 double norm2() const;
4037 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4038 double getWeightedAverageValue(int compId, bool isWAbs) const;
4039 double integral(int compId, bool isWAbs) const;
4040 double normL1(int compId) const;
4041 double normL2(int compId) const;
4042 double normMax(int compId) const;
4043 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4044 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4045 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4046 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4047 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4048 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4049 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4050 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4051 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4052 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4053 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4054 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4055 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4056 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4057 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4058 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4059 MEDCouplingFieldDouble *negate() const;
4061 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4063 return MEDCouplingFieldDouble::New(type,td);
4066 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4068 return MEDCouplingFieldDouble::New(ft,td);
4071 std::string __str__() const
4073 return self->simpleRepr();
4076 std::string __repr__() const
4078 std::ostringstream oss;
4079 self->reprQuickOverview(oss);
4083 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4086 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4087 PyObject *ret=PyTuple_New(2);
4088 PyObject *ret0Py=ret0?Py_True:Py_False;
4090 PyTuple_SetItem(ret,0,ret0Py);
4091 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4095 MEDCouplingFieldDouble *voronoize(double eps) const
4097 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4101 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4103 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4107 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4109 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4111 DataArrayDouble *a,*a2;
4112 DataArrayDoubleTuple *aa,*aa2;
4113 std::vector<double> bb,bb2;
4115 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4116 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4117 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4120 DataArrayDouble *getArray()
4122 DataArrayDouble *ret=self->getArray();
4128 PyObject *getArrays() const
4130 std::vector<DataArrayDouble *> arrs=self->getArrays();
4131 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4134 std::size_t sz=arrs.size();
4135 PyObject *ret=PyTuple_New(sz);
4136 for(std::size_t i=0;i<sz;i++)
4139 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4141 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4146 void setArrays(PyObject *ls)
4148 std::vector<const DataArrayDouble *> tmp;
4149 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4150 std::size_t sz=tmp.size();
4151 std::vector<DataArrayDouble *> arrs(sz);
4152 for(std::size_t i=0;i<sz;i++)
4153 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4154 self->setArrays(arrs);
4157 DataArrayDouble *getEndArray()
4159 DataArrayDouble *ret=self->getEndArray();
4165 PyObject *getValueOn(PyObject *sl) const
4169 DataArrayDoubleTuple *aa;
4170 std::vector<double> bb;
4172 const MEDCouplingMesh *mesh=self->getMesh();
4174 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4175 int spaceDim=mesh->getSpaceDimension();
4176 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4177 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4179 mcIdType sz=ToIdType(self->getNumberOfComponents());
4180 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4181 self->getValueOn(spaceLoc,res);
4182 return convertDblArrToPyList<double>(res,sz);
4185 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4187 mcIdType sz=ToIdType(self->getNumberOfComponents());
4188 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4189 self->getValueOnPos(i,j,k,res);
4190 return convertDblArrToPyList<double>(res,sz);
4193 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4195 const MEDCouplingMesh *mesh(self->getMesh());
4197 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4200 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4201 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4202 mesh->getSpaceDimension(),true,nbPts);
4203 return self->getValueOnMulti(inp,(int)nbPts);
4206 PyObject *getValueOn(PyObject *sl, double time) const
4210 DataArrayDoubleTuple *aa;
4211 std::vector<double> bb;
4213 const MEDCouplingMesh *mesh=self->getMesh();
4215 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4216 int spaceDim=mesh->getSpaceDimension();
4217 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4218 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4221 mcIdType sz=ToIdType(self->getNumberOfComponents());
4222 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4223 self->getValueOn(spaceLoc,time,res);
4224 return convertDblArrToPyList<double>(res,sz);
4227 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4229 if(self->getArray()!=0)
4230 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4233 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4234 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4235 self->setArray(arr);
4242 double tmp0=self->getTime(tmp1,tmp2);
4243 PyObject *res = PyList_New(3);
4244 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4245 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4246 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4250 PyObject *getStartTime()
4253 double tmp0=self->getStartTime(tmp1,tmp2);
4254 PyObject *res = PyList_New(3);
4255 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4256 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4257 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4261 PyObject *getEndTime()
4264 double tmp0=self->getEndTime(tmp1,tmp2);
4265 PyObject *res = PyList_New(3);
4266 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4267 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4268 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4271 PyObject *accumulate() const
4273 mcIdType sz=ToIdType(self->getNumberOfComponents());
4274 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4275 self->accumulate(tmp);
4276 return convertDblArrToPyList<double>(tmp,sz);
4278 PyObject *integral(bool isWAbs) const
4280 mcIdType sz=ToIdType(self->getNumberOfComponents());
4281 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4282 self->integral(isWAbs,tmp);
4283 return convertDblArrToPyList<double>(tmp,sz);
4285 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4287 mcIdType sz=ToIdType(self->getNumberOfComponents());
4288 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4289 self->getWeightedAverageValue(tmp,isWAbs);
4290 return convertDblArrToPyList<double>(tmp,sz);
4292 PyObject *normL1() const
4294 mcIdType sz=ToIdType(self->getNumberOfComponents());
4295 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4297 return convertDblArrToPyList<double>(tmp,sz);
4299 PyObject *normL2() const
4301 mcIdType sz=ToIdType(self->getNumberOfComponents());
4302 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4304 return convertDblArrToPyList<double>(tmp,sz);
4306 PyObject *normMax() const
4308 mcIdType sz=ToIdType(self->getNumberOfComponents());
4309 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4311 return convertDblArrToPyList<double>(tmp,sz);
4313 void renumberCells(PyObject *li, bool check=true)
4315 mcIdType szArr,sw,iTypppArr;
4316 std::vector<mcIdType> stdvecTyyppArr;
4317 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4318 self->renumberCells(tmp,check);
4321 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4323 mcIdType szArr,sw,iTypppArr;
4324 std::vector<mcIdType> stdvecTyyppArr;
4325 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4326 self->renumberCellsWithoutMesh(tmp,check);
4329 void renumberNodes(PyObject *li, double eps=1e-15)
4331 mcIdType szArr,sw,iTypppArr;
4332 std::vector<mcIdType> stdvecTyyppArr;
4333 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4334 self->renumberNodes(tmp,eps);
4337 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4339 mcIdType szArr,sw,iTypppArr;
4340 std::vector<mcIdType> stdvecTyyppArr;
4341 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4342 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4345 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4347 return fieldT_buildSubPart(self,li);
4350 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4352 return fieldT__getitem__(self,li);
4355 PyObject *getMaxValue2() const
4357 DataArrayIdType *tmp;
4358 double r1=self->getMaxValue2(tmp);
4359 PyObject *ret=PyTuple_New(2);
4360 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4361 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4365 PyObject *getMinValue2() const
4367 DataArrayIdType *tmp;
4368 double r1=self->getMinValue2(tmp);
4369 PyObject *ret=PyTuple_New(2);
4370 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4371 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4375 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4377 std::vector<std::size_t> tmp;
4378 convertPyToNewIntArr3(li,tmp);
4379 return self->keepSelectedComponents(tmp);
4382 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4384 std::vector<std::size_t> tmp;
4385 convertPyToNewIntArr3(li,tmp);
4386 self->setSelectedComponents(f,tmp);
4389 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4392 DataArrayDouble *a,*a2;
4393 DataArrayDoubleTuple *aa,*aa2;
4394 std::vector<double> bb,bb2;
4397 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4398 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4399 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4400 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4402 return self->extractSlice3D(orig,vect,eps);
4405 MEDCouplingFieldDouble *__add__(PyObject *obj)
4407 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4410 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4412 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4415 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4417 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.";
4418 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4421 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4423 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4425 return (*self)-(*other);
4427 throw INTERP_KERNEL::Exception(msg);
4432 DataArrayDoubleTuple *aa;
4433 std::vector<double> bb;
4435 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4440 if(!self->getArray())
4441 throw INTERP_KERNEL::Exception(msg2);
4442 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4443 ret->applyLin(1.,-val);
4444 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4445 ret2->setArray(ret);
4450 if(!self->getArray())
4451 throw INTERP_KERNEL::Exception(msg2);
4452 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4453 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4454 ret2->setArray(ret);
4459 if(!self->getArray())
4460 throw INTERP_KERNEL::Exception(msg2);
4461 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4462 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4463 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4464 ret2->setArray(ret);
4469 if(!self->getArray())
4470 throw INTERP_KERNEL::Exception(msg2);
4471 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4472 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4473 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4474 ret2->setArray(ret);
4478 { throw INTERP_KERNEL::Exception(msg); }
4482 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4484 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4487 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4489 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4492 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4494 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4497 MEDCouplingFieldDouble *__div__(PyObject *obj)
4499 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.";
4500 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4503 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4505 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4507 return (*self)/(*other);
4509 throw INTERP_KERNEL::Exception(msg);
4514 DataArrayDoubleTuple *aa;
4515 std::vector<double> bb;
4517 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4523 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4524 if(!self->getArray())
4525 throw INTERP_KERNEL::Exception(msg2);
4526 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4527 ret->applyLin(1./val,0);
4528 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4529 ret2->setArray(ret);
4534 if(!self->getArray())
4535 throw INTERP_KERNEL::Exception(msg2);
4536 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4537 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4538 ret2->setArray(ret);
4543 if(!self->getArray())
4544 throw INTERP_KERNEL::Exception(msg2);
4545 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4546 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4547 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4548 ret2->setArray(ret);
4553 if(!self->getArray())
4554 throw INTERP_KERNEL::Exception(msg2);
4555 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4556 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4557 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4558 ret2->setArray(ret);
4562 { throw INTERP_KERNEL::Exception(msg); }
4566 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4568 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4571 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4573 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.";
4574 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4577 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4579 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4581 return (*self)^(*other);
4583 throw INTERP_KERNEL::Exception(msg);
4588 DataArrayDoubleTuple *aa;
4589 std::vector<double> bb;
4591 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4596 if(!self->getArray())
4597 throw INTERP_KERNEL::Exception(msg2);
4598 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4600 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4601 ret2->setArray(ret);
4606 if(!self->getArray())
4607 throw INTERP_KERNEL::Exception(msg2);
4608 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4609 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4610 ret2->setArray(ret);
4615 if(!self->getArray())
4616 throw INTERP_KERNEL::Exception(msg2);
4617 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4618 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4619 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4620 ret2->setArray(ret);
4625 if(!self->getArray())
4626 throw INTERP_KERNEL::Exception(msg2);
4627 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4628 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4629 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4630 ret2->setArray(ret);
4634 { throw INTERP_KERNEL::Exception(msg); }
4638 MEDCouplingFieldDouble *__neg__() const
4640 return self->negate();
4643 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4645 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.";
4646 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4649 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4651 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4655 Py_XINCREF(trueSelf);
4659 throw INTERP_KERNEL::Exception(msg);
4664 DataArrayDoubleTuple *aa;
4665 std::vector<double> bb;
4667 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4672 if(!self->getArray())
4673 throw INTERP_KERNEL::Exception(msg2);
4674 self->getArray()->applyLin(1.,val);
4675 Py_XINCREF(trueSelf);
4680 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4683 Py_XINCREF(trueSelf);
4688 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4689 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4690 ret2->setArray(aaa);
4692 Py_XINCREF(trueSelf);
4697 if(!self->getArray())
4698 throw INTERP_KERNEL::Exception(msg2);
4699 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4700 self->getArray()->addEqual(aaa);
4701 Py_XINCREF(trueSelf);
4705 { throw INTERP_KERNEL::Exception(msg); }
4709 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4711 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.";
4712 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4715 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4717 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4721 Py_XINCREF(trueSelf);
4725 throw INTERP_KERNEL::Exception(msg);
4730 DataArrayDoubleTuple *aa;
4731 std::vector<double> bb;
4733 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4738 if(!self->getArray())
4739 throw INTERP_KERNEL::Exception(msg2);
4740 self->getArray()->applyLin(1.,-val);
4741 Py_XINCREF(trueSelf);
4746 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4749 Py_XINCREF(trueSelf);
4754 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4755 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4756 ret2->setArray(aaa);
4758 Py_XINCREF(trueSelf);
4763 if(!self->getArray())
4764 throw INTERP_KERNEL::Exception(msg2);
4765 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4766 self->getArray()->substractEqual(aaa);
4767 Py_XINCREF(trueSelf);
4771 { throw INTERP_KERNEL::Exception(msg); }
4775 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4777 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.";
4778 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4781 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4783 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4787 Py_XINCREF(trueSelf);
4791 throw INTERP_KERNEL::Exception(msg);
4796 DataArrayDoubleTuple *aa;
4797 std::vector<double> bb;
4799 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4804 if(!self->getArray())
4805 throw INTERP_KERNEL::Exception(msg2);
4806 self->getArray()->applyLin(val,0);
4807 Py_XINCREF(trueSelf);
4812 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4815 Py_XINCREF(trueSelf);
4820 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4821 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4822 ret2->setArray(aaa);
4824 Py_XINCREF(trueSelf);
4829 if(!self->getArray())
4830 throw INTERP_KERNEL::Exception(msg2);
4831 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4832 self->getArray()->multiplyEqual(aaa);
4833 Py_XINCREF(trueSelf);
4837 { throw INTERP_KERNEL::Exception(msg); }
4841 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4843 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.";
4844 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4847 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4849 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4853 Py_XINCREF(trueSelf);
4857 throw INTERP_KERNEL::Exception(msg);
4862 DataArrayDoubleTuple *aa;
4863 std::vector<double> bb;
4865 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4871 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4872 if(!self->getArray())
4873 throw INTERP_KERNEL::Exception(msg2);
4874 self->getArray()->applyLin(1./val,0);
4875 Py_XINCREF(trueSelf);
4880 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4883 Py_XINCREF(trueSelf);
4888 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4889 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4890 ret2->setArray(aaa);
4892 Py_XINCREF(trueSelf);
4897 if(!self->getArray())
4898 throw INTERP_KERNEL::Exception(msg2);
4899 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4900 self->getArray()->divideEqual(aaa);
4901 Py_XINCREF(trueSelf);
4905 { throw INTERP_KERNEL::Exception(msg); }
4909 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4911 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.";
4912 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4915 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4917 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4921 Py_XINCREF(trueSelf);
4925 throw INTERP_KERNEL::Exception(msg);
4930 DataArrayDoubleTuple *aa;
4931 std::vector<double> bb;
4933 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4938 if(!self->getArray())
4939 throw INTERP_KERNEL::Exception(msg2);
4940 self->getArray()->applyPow(val);
4941 Py_XINCREF(trueSelf);
4946 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4949 Py_XINCREF(trueSelf);
4954 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4955 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4956 ret2->setArray(aaa);
4958 Py_XINCREF(trueSelf);
4963 if(!self->getArray())
4964 throw INTERP_KERNEL::Exception(msg2);
4965 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4966 self->getArray()->powEqual(aaa);
4967 Py_XINCREF(trueSelf);
4971 { throw INTERP_KERNEL::Exception(msg); }
4975 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4977 std::vector<const MEDCouplingFieldDouble *> tmp;
4978 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4979 return MEDCouplingFieldDouble::MergeFields(tmp);
4982 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4984 std::vector<const MEDCouplingFieldDouble *> tmp;
4985 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4986 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4989 PyObject *getTinySerializationInformation() const
4991 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4994 PyObject *serialize() const
4996 return field_serialize<double>(self);
4999 PyObject *__getstate__() const
5001 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
5004 void __setstate__(PyObject *inp)
5006 field__setstate__<double>(self,inp);
5011 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5014 int getNumberOfFields() const;
5015 MEDCouplingMultiFields *deepCopy() const;
5016 virtual std::string simpleRepr() const;
5017 virtual std::string advancedRepr() const;
5018 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5019 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5020 virtual void checkConsistencyLight() const;
5023 std::string __str__() const
5025 return self->simpleRepr();
5027 static MEDCouplingMultiFields *New(PyObject *li)
5029 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5030 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5031 std::size_t sz=tmp.size();
5032 std::vector<MEDCouplingFieldDouble *> fs(sz);
5033 for(std::size_t i=0;i<sz;i++)
5034 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5035 return MEDCouplingMultiFields::New(fs);
5037 MEDCouplingMultiFields(PyObject *li)
5039 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5040 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5041 std::size_t sz=tmp.size();
5042 std::vector<MEDCouplingFieldDouble *> fs(sz);
5043 for(std::size_t i=0;i<sz;i++)
5044 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5045 return MEDCouplingMultiFields::New(fs);
5047 PyObject *getFields() const
5049 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5050 std::size_t sz=fields.size();
5051 PyObject *res = PyList_New(sz);
5052 for(std::size_t i=0;i<sz;i++)
5056 fields[i]->incrRef();
5057 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5061 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5066 PyObject *getFieldAtPos(int id) const
5068 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5072 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5075 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5077 PyObject *getMeshes() const
5079 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5080 std::size_t sz=ms.size();
5081 PyObject *res = PyList_New(sz);
5082 for(std::size_t i=0;i<sz;i++)
5087 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5091 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5096 PyObject *getDifferentMeshes() const
5098 std::vector<int> refs;
5099 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5100 std::size_t sz=ms.size();
5101 PyObject *res = PyList_New(sz);
5102 for(std::size_t i=0;i<sz;i++)
5107 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5111 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5115 PyObject *ret=PyTuple_New(2);
5116 PyTuple_SetItem(ret,0,res);
5117 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5120 PyObject *getArrays() const
5122 std::vector<DataArrayDouble *> ms=self->getArrays();
5123 std::size_t sz=ms.size();
5124 PyObject *res = PyList_New(sz);
5125 for(std::size_t i=0;i<sz;i++)
5130 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5134 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5139 PyObject *getDifferentArrays() const
5141 std::vector< std::vector<int> > refs;
5142 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5143 std::size_t sz=ms.size();
5144 PyObject *res = PyList_New(sz);
5145 PyObject *res2 = PyList_New(sz);
5146 for(std::size_t i=0;i<sz;i++)
5151 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5155 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5157 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5160 PyObject *ret=PyTuple_New(2);
5161 PyTuple_SetItem(ret,0,res);
5162 PyTuple_SetItem(ret,1,res2);
5168 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5171 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5172 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5173 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5174 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5175 void setTimeUnit(const std::string& unit);
5176 std::string getTimeUnit() const;
5177 void setTime(double val, int iteration, int order);
5178 void setArray(DataArrayInt32 *array);
5179 MEDCouplingFieldInt *deepCopy() const;
5180 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5181 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5182 MEDCouplingFieldDouble *convertToDblField() const;
5183 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5185 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5187 return MEDCouplingFieldInt::New(type,td);
5190 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5192 return MEDCouplingFieldInt::New(ft,td);
5195 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5198 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5199 PyObject *ret=PyTuple_New(2);
5200 PyObject *ret0Py=ret0?Py_True:Py_False;
5202 PyTuple_SetItem(ret,0,ret0Py);
5203 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5207 std::string __str__() const
5209 return self->simpleRepr();
5212 std::string __repr__() const
5214 std::ostringstream oss;
5215 self->reprQuickOverview(oss);
5219 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5221 return fieldT_buildSubPart(self,li);
5224 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5226 return fieldT__getitem__(self,li);
5229 DataArrayInt32 *getArray()
5231 DataArrayInt32 *ret=self->getArray();
5240 double tmp0=self->getTime(tmp1,tmp2);
5241 PyObject *res = PyList_New(3);
5242 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5243 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5244 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5248 PyObject *getTinySerializationInformation() const
5250 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5253 PyObject *serialize() const
5255 return field_serialize<int>(self);
5258 PyObject *__getstate__() const
5260 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5263 void __setstate__(PyObject *inp)
5265 field__setstate__<int>(self,inp);
5270 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5273 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5274 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5275 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5276 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5277 void setTimeUnit(const std::string& unit);
5278 std::string getTimeUnit() const;
5279 void setTime(double val, int iteration, int order);
5280 void setArray(DataArrayFloat *array);
5281 MEDCouplingFieldFloat *deepCopy() const;
5282 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5283 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5284 MEDCouplingFieldDouble *convertToDblField() const;
5285 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5287 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5289 return MEDCouplingFieldFloat::New(type,td);
5292 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5294 return MEDCouplingFieldFloat::New(ft,td);
5297 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5300 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5301 PyObject *ret=PyTuple_New(2);
5302 PyObject *ret0Py=ret0?Py_True:Py_False;
5304 PyTuple_SetItem(ret,0,ret0Py);
5305 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5309 std::string __str__() const
5311 return self->simpleRepr();
5314 std::string __repr__() const
5316 std::ostringstream oss;
5317 self->reprQuickOverview(oss);
5321 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5323 return fieldT_buildSubPart(self,li);
5326 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5328 return fieldT__getitem__(self,li);
5331 DataArrayFloat *getArray()
5333 DataArrayFloat *ret=self->getArray();
5342 double tmp0=self->getTime(tmp1,tmp2);
5343 PyObject *res = PyList_New(3);
5344 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5345 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5346 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5350 PyObject *getTinySerializationInformation() const
5352 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5355 PyObject *serialize() const
5357 return field_serialize<float>(self);
5360 PyObject *__getstate__() const
5362 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5365 void __setstate__(PyObject *inp)
5367 field__setstate__<float>(self,inp);
5372 class MEDCouplingDefinitionTime
5375 MEDCouplingDefinitionTime();
5376 void assign(const MEDCouplingDefinitionTime& other);
5377 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5378 double getTimeResolution() const;
5379 std::vector<double> getHotSpotsTime() const;
5382 std::string __str__() const
5384 std::ostringstream oss;
5385 self->appendRepr(oss);
5389 PyObject *getIdsOnTimeRight(double tm) const
5391 int meshId,arrId,arrIdInField,fieldId;
5392 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5393 PyObject *res=PyList_New(4);
5394 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5395 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5396 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5397 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5401 PyObject *getIdsOnTimeLeft(double tm) const
5403 int meshId,arrId,arrIdInField,fieldId;
5404 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5405 PyObject *res=PyList_New(4);
5406 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5407 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5408 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5409 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5415 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5418 double getTimeTolerance() const;
5419 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5423 MEDCouplingFieldOverTime(PyObject *li)
5425 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5426 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5427 std::size_t sz=tmp.size();
5428 std::vector<MEDCouplingFieldDouble *> fs(sz);
5429 for(std::size_t i=0;i<sz;i++)
5430 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5431 return MEDCouplingFieldOverTime::New(fs);
5433 std::string __str__() const
5435 return self->simpleRepr();
5437 static MEDCouplingFieldOverTime *New(PyObject *li)
5439 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5440 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5441 std::size_t sz=tmp.size();
5442 std::vector<MEDCouplingFieldDouble *> fs(sz);
5443 for(std::size_t i=0;i<sz;i++)
5444 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5445 return MEDCouplingFieldOverTime::New(fs);
5450 class MEDCouplingCartesianAMRMesh;
5452 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5455 int getNumberOfCellsRecursiveWithOverlap() const;
5456 int getNumberOfCellsRecursiveWithoutOverlap() const;
5457 int getMaxNumberOfLevelsRelativeToThis() const;
5460 MEDCouplingCartesianAMRMeshGen *getMesh() const
5462 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5470 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5473 int getNumberOfOverlapedCellsForFather() const;
5474 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5475 std::vector<mcIdType> computeCellGridSt() const;
5478 PyObject *getBLTRRange() const
5480 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5481 return convertFromVectorPairInt(ret);
5484 PyObject *getBLTRRangeRelativeToGF() const
5486 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5487 return convertFromVectorPairInt(ret);
5490 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5492 std::vector< std::pair<mcIdType,mcIdType> > inp;
5493 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5494 self->addPatch(inp,factors);
5497 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5499 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5501 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5502 if(patchId==mesh->getNumberOfPatches())
5504 std::ostringstream oss;
5505 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5506 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5509 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5515 void __delitem__(mcIdType patchId)
5517 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5519 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5520 mesh->removePatch(patchId);
5523 mcIdType __len__() const
5525 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5527 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5528 return mesh->getNumberOfPatches();
5533 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5537 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5540 mcIdType getAbsoluteLevel() const;
5541 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5542 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5543 int getSpaceDimension() const;
5544 const std::vector<mcIdType>& getFactors() const;
5545 void setFactors(const std::vector<mcIdType>& newFactors);
5546 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5547 mcIdType getNumberOfCellsAtCurrentLevel() const;
5548 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5549 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5550 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5551 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5552 virtual void detachFromFather();
5554 mcIdType getNumberOfPatches() const;
5555 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5556 MEDCouplingUMesh *buildUnstructured() const;
5557 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5558 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5559 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5560 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5561 void removeAllPatches();
5562 void removePatch(mcIdType patchId);
5563 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5564 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5565 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5566 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5567 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5568 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5569 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5570 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5571 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5572 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5573 std::string buildPythonDumpOfThis() const;
5576 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5578 std::vector< std::pair<mcIdType,mcIdType> > inp;
5579 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5580 self->addPatch(inp,factors);
5583 PyObject *getPatches() const
5585 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5586 std::size_t sz(ps.size());
5587 PyObject *ret = PyList_New(sz);
5588 for(std::size_t i=0;i<sz;i++)
5590 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5593 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5598 // agy : don't know why typemap fails here ??? let it in the extend section
5599 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5601 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5604 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5606 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5607 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5613 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5615 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5616 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5622 virtual PyObject *positionRelativeToGodFather() const
5624 std::vector<mcIdType> out1;
5625 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5626 PyObject *ret(PyTuple_New(2));
5627 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5628 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5632 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5634 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5635 std::size_t sz(ps.size());
5636 PyObject *ret = PyList_New(sz);
5637 for(std::size_t i=0;i<sz;i++)
5638 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5642 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5644 std::vector<const DataArrayDouble *> inp;
5645 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5646 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5649 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5651 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5657 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5659 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5665 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5667 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5673 MEDCouplingIMesh *getImageMesh() const
5675 const MEDCouplingIMesh *ret(self->getImageMesh());
5678 return const_cast<MEDCouplingIMesh *>(ret);
5681 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5683 if(patchId==self->getNumberOfPatches())
5685 std::ostringstream oss;
5686 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5687 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5690 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5696 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5698 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5699 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5700 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5703 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5705 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5706 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5707 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5710 void __delitem__(mcIdType patchId)
5712 self->removePatch(patchId);
5715 mcIdType __len__() const
5717 return self->getNumberOfPatches();
5722 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5726 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5729 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5732 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5734 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5735 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5736 const mcIdType *nodeStrctPtr(0);
5737 const double *originPtr(0),*dxyzPtr(0);
5738 mcIdType sw,sz,val0;
5739 std::vector<mcIdType> bb0;
5740 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5743 std::vector<double> bb,bb2;
5745 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5746 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5748 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5751 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5753 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5754 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5755 std::vector< std::vector<mcIdType> > inp2;
5756 convertPyToVectorOfVectorOfInt(factors,inp2);
5757 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5760 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5762 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5765 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5767 return MEDCouplingCartesianAMRMesh::New(mesh);
5772 class MEDCouplingDataForGodFather : public RefCountObject
5775 virtual void synchronizeFineToCoarse();
5776 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5777 virtual void synchronizeCoarseToFine();
5778 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5779 virtual void synchronizeAllGhostZones();
5780 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5781 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5782 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5783 virtual void alloc();
5784 virtual void dealloc();
5787 MEDCouplingCartesianAMRMesh *getMyGodFather()
5789 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5797 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5800 mcIdType getNumberOfLevels() const;
5801 MEDCouplingAMRAttribute *deepCopy() const;
5802 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5803 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5804 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5805 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5806 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5807 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5808 std::string writeVTHB(const std::string& fileName) const;
5811 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5813 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5814 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5815 MEDCouplingAMRAttribute *ret(0);
5818 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5819 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5821 catch(INTERP_KERNEL::Exception&)
5823 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5824 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5829 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5831 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5834 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5836 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5837 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5843 void spillInfoOnComponents(PyObject *compNames)
5845 std::vector< std::vector<std::string> > compNamesCpp;
5846 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5847 self->spillInfoOnComponents(compNamesCpp);
5850 void spillNatures(PyObject *nfs)
5852 std::vector<mcIdType> inp0;
5853 if(!fillIntVector(nfs,inp0))
5854 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5855 std::size_t sz(inp0.size());
5856 std::vector<NatureOfField> inp00(sz);
5857 for(std::size_t i=0;i<sz;i++)
5858 inp00[i]=(NatureOfField)inp0[i];
5859 self->spillNatures(inp00);
5862 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5864 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5865 std::size_t sz(ret.size());
5866 PyObject *retPy(PyList_New(sz));
5867 for(std::size_t i=0;i<sz;i++)
5868 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5874 class DenseMatrix : public RefCountObject, public TimeLabel
5877 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5878 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5879 DenseMatrix *deepCopy() const;
5880 DenseMatrix *shallowCpy() const;
5882 mcIdType getNumberOfRows() const;
5883 mcIdType getNumberOfCols() const;
5884 mcIdType getNbOfElems() const;
5885 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5886 void reShape(mcIdType nbRows, mcIdType nbCols);
5889 bool isEqual(const DenseMatrix& other, double eps) const;
5890 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5891 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5894 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5896 return DenseMatrix::New(nbRows,nbCols);
5899 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5901 return DenseMatrix::New(array,nbRows,nbCols);
5904 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5907 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5908 PyObject *ret=PyTuple_New(2);
5909 PyObject *ret0Py=ret0?Py_True:Py_False;
5911 PyTuple_SetItem(ret,0,ret0Py);
5912 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5916 DataArrayDouble *getData()
5918 DataArrayDouble *ret(self->getData());
5924 DenseMatrix *__add__(const DenseMatrix *other)
5926 return MEDCoupling::DenseMatrix::Add(self,other);
5929 DenseMatrix *__sub__(const DenseMatrix *other)
5931 return MEDCoupling::DenseMatrix::Substract(self,other);
5934 DenseMatrix *__mul__(const DenseMatrix *other)
5936 return MEDCoupling::DenseMatrix::Multiply(self,other);
5939 DenseMatrix *__mul__(const DataArrayDouble *other)
5941 return MEDCoupling::DenseMatrix::Multiply(self,other);
5944 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5946 self->addEqual(other);
5947 Py_XINCREF(trueSelf);
5951 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5953 self->substractEqual(other);
5954 Py_XINCREF(trueSelf);
5958 PyObject *toNumPyMatrix() // not const. It is not a bug !
5960 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5969 def MEDCouplingUMeshReduce(self):
5970 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5971 def MEDCouplingCMeshReduce(self):
5972 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5973 def MEDCouplingIMeshReduce(self):
5974 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5975 def MEDCouplingMappedExtrudedMeshReduce(self):
5976 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5977 def MEDCouplingCurveLinearMeshReduce(self):
5978 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5979 def MEDCoupling1SGTUMeshReduce(self):
5980 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5981 def MEDCoupling1DGTUMeshReduce(self):
5982 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5983 def MEDCouplingFieldDoubleReduce(self):
5984 self.checkConsistencyLight()
5985 d=(self.getTypeOfField(),self.getTimeDiscretization())
5986 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5987 def MEDCouplingFieldIntReduce(self):
5988 self.checkConsistencyLight()
5989 d=(self.getTypeOfField(),self.getTimeDiscretization())
5990 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5991 def MEDCouplingFieldFloatReduce(self):
5992 self.checkConsistencyLight()
5993 d=(self.getTypeOfField(),self.getTimeDiscretization())
5994 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5995 def MEDCouplingFTReduceFunct(cls,params):
5997 ret=object.__new__(cls)
6001 def MEDCouplingFieldTemplateReduce(self):
6002 ret = MEDCouplingFieldDouble(self)
6003 nbTuples = self.getNumberOfTuplesExpected()
6004 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
6006 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
6008 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
6010 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
6011 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
6012 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
6013 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
6014 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
6015 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
6016 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
6022 __filename=os.environ.get('PYTHONSTARTUP')
6023 if __filename and os.path.isfile(__filename):
6024 with open(__filename) as __fp: