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 ));
1427 %include "MEDCouplingFieldDiscretization.i"
1429 //== MEDCouplingPointSet
1431 namespace MEDCoupling
1433 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1436 void setCoords(const DataArrayDouble *coords);
1437 DataArrayDouble *getCoordinatesAndOwner() const;
1438 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1440 double getCaracteristicDimension() const;
1441 void recenterForMaxPrecision(double eps);
1442 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1443 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1444 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1445 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1446 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1447 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1448 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1449 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1450 virtual DataArrayIdType *computeFetchedNodeIds() const;
1451 virtual int getNumberOfNodesInCell(int cellId) const;
1452 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1453 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1454 virtual DataArrayIdType *zipCoordsTraducer();
1455 virtual DataArrayIdType *findBoundaryNodes() const;
1456 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1457 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1458 virtual void checkFullyDefined() const;
1459 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1460 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1461 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1462 virtual void renumberNodesWithOffsetInConn(int offset);
1463 virtual bool areAllNodesFetched() const;
1464 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1465 virtual void invertOrientationOfAllCells();
1468 std::string __str__() const
1470 return self->simpleRepr();
1473 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1475 mcIdType newNbOfNodes;
1476 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1477 PyObject *res = PyList_New(2);
1478 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1479 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1483 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1485 DataArrayIdType *comm, *commIndex;
1486 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1487 PyObject *res = PyList_New(2);
1488 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1489 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1493 PyObject *getCoords()
1495 DataArrayDouble *ret1=self->getCoords();
1498 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1501 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1503 mcIdType szArr,sw,iTypppArr;
1504 std::vector<mcIdType> stdvecTyyppArr;
1505 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1506 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1507 if(sw==3)//DataArrayIdType
1509 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1510 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1511 std::string name=argpt->getName();
1513 ret->setName(name.c_str());
1515 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1518 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1520 mcIdType szArr,sw,iTypppArr;
1521 std::vector<mcIdType> stdvecTyyppArr;
1522 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1523 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1524 if(sw==3)//DataArrayIdType
1526 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1527 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1528 std::string name=argpt->getName();
1530 ret->setName(name.c_str());
1532 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1535 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1537 mcIdType szArr,sw,iTypppArr;
1538 std::vector<mcIdType> stdvecTyyppArr;
1539 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1540 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1541 if(sw==3)//DataArrayIdType
1543 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1544 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1545 std::string name=argpt->getName();
1547 ret->setName(name.c_str());
1549 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1552 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1554 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1555 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1558 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1560 mcIdType szArr,sw,iTypppArr;
1561 std::vector<mcIdType> stdvecTyyppArr;
1562 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1563 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1564 if(sw==3)//DataArrayIdType
1566 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1567 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1568 std::string name=argpt->getName();
1570 ret->setName(name.c_str());
1572 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1575 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1577 mcIdType szArr,sw,iTypppArr;
1578 std::vector<mcIdType> stdvecTyyppArr;
1579 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1580 self->renumberNodes(tmp,newNbOfNodes);
1583 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1585 mcIdType szArr,sw,iTypppArr;
1586 std::vector<mcIdType> stdvecTyyppArr;
1587 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1588 self->renumberNodesCenter(tmp,newNbOfNodes);
1591 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1593 int spaceDim=self->getSpaceDimension();
1595 DataArrayDouble *a,*a2;
1596 DataArrayDoubleTuple *aa,*aa2;
1597 std::vector<double> bb,bb2;
1599 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1600 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1601 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1602 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1603 std::vector<mcIdType> nodes;
1604 self->findNodesOnLine(p,v,eps,nodes);
1605 DataArrayIdType *ret=DataArrayIdType::New();
1606 ret->alloc(nodes.size(),1);
1607 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1608 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1610 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1612 int spaceDim=self->getSpaceDimension();
1614 DataArrayDouble *a,*a2;
1615 DataArrayDoubleTuple *aa,*aa2;
1616 std::vector<double> bb,bb2;
1618 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1619 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1620 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1621 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1622 std::vector<mcIdType> nodes;
1623 self->findNodesOnPlane(p,v,eps,nodes);
1624 DataArrayIdType *ret=DataArrayIdType::New();
1625 ret->alloc(nodes.size(),1);
1626 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1627 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1630 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1634 DataArrayDoubleTuple *aa;
1635 std::vector<double> bb;
1637 int spaceDim=self->getSpaceDimension();
1638 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1639 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1640 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1641 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1644 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1646 DataArrayIdType *c=0,*cI=0;
1650 DataArrayDoubleTuple *aa;
1651 std::vector<double> bb;
1653 int spaceDim=self->getSpaceDimension();
1654 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1655 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1656 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1657 PyObject *ret=PyTuple_New(2);
1658 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1659 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1663 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1665 DataArrayIdType *c=0,*cI=0;
1666 int spaceDim=self->getSpaceDimension();
1669 DataArrayDoubleTuple *aa;
1670 std::vector<double> bb;
1672 mcIdType nbOfTuples=-1;
1673 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1674 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1676 PyObject *ret=PyTuple_New(2);
1677 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1678 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1682 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1686 DataArrayDoubleTuple *aa;
1687 std::vector<double> bb;
1689 int spaceDim=self->getSpaceDimension();
1690 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1691 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1693 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1694 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1697 void duplicateNodesInCoords(PyObject *li)
1701 std::vector<mcIdType> multiVal;
1702 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1703 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1704 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1708 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1710 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1712 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1714 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1718 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1720 DataArrayIdType *v0(nullptr),*v1(nullptr);
1721 self->findCommonCells(compType,startCellId,v0,v1);
1722 PyObject *res = PyList_New(2);
1723 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1724 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1729 virtual void renumberNodesInConn(PyObject *li)
1733 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1736 MapII *da2(reinterpret_cast<MapII *>(da));
1737 self->renumberNodesInConn(da2->data());
1741 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1742 if (!SWIG_IsOK(res1))
1745 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1746 self->renumberNodesInConn(tmp);
1750 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1752 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1753 da2->checkAllocated();
1754 self->renumberNodesInConn(da2->getConstPointer());
1758 virtual PyObject *getNodeIdsInUse() const
1761 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1762 PyObject *ret=PyTuple_New(2);
1763 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1764 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1768 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1770 DataArrayIdType *ret(nullptr);
1772 mcIdType szArr,sw,iTypppArr;
1773 std::vector<mcIdType> stdvecTyyppArr;
1774 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1775 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1779 virtual PyObject *mergeNodes(double precision)
1783 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1784 PyObject *res = PyList_New(3);
1785 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1786 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1787 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1791 virtual PyObject *mergeNodesCenter(double precision)
1795 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1796 PyObject *res = PyList_New(3);
1797 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1798 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1799 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1803 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1806 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1807 if (!SWIG_IsOK(res1))
1810 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1811 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1815 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1817 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1818 da2->checkAllocated();
1819 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1823 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1827 std::vector<mcIdType> multiVal;
1828 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1829 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1830 mcIdType nbc=self->getNumberOfCells();
1831 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1838 std::ostringstream oss;
1839 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1840 throw INTERP_KERNEL::Exception(oss.str().c_str());
1843 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1848 mcIdType tmp=nbc+singleVal;
1849 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1853 std::ostringstream oss;
1854 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1855 throw INTERP_KERNEL::Exception(oss.str().c_str());
1861 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1865 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1870 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1871 daIntTyypp->checkAllocated();
1872 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1875 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1879 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1882 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1883 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1884 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1885 for(mcIdType i=0;i<sz;i++)
1886 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1889 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1892 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1893 mcIdType sw,nbNodes=0;
1894 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1895 std::vector<double> val3;
1896 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1897 "Rotate2DAlg",2,true,nbNodes);
1899 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1900 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1903 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1906 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1907 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1908 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1909 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1910 for(mcIdType i=0;i<sz;i++)
1911 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1914 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1917 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1918 mcIdType sw,nbNodes=0;
1919 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1920 std::vector<double> val3;
1921 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1922 "Rotate3DAlg",3,true,nbNodes);
1924 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1925 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1926 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1931 //== MEDCouplingPointSet End
1933 class MEDCouplingUMeshCell
1936 INTERP_KERNEL::NormalizedCellType getType() const;
1939 std::string __str__() const
1941 return self->repr();
1944 PyObject *getAllConn() const
1947 const mcIdType *r=self->getAllConn(ret2);
1948 PyObject *ret=PyTuple_New(ret2);
1949 for(mcIdType i=0;i<ret2;i++)
1950 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1956 class MEDCouplingUMeshCellIterator
1963 MEDCouplingUMeshCell *ret=self->nextt();
1965 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1968 PyErr_SetString(PyExc_StopIteration,"No more data.");
1975 class MEDCouplingUMeshCellByTypeIterator
1978 ~MEDCouplingUMeshCellByTypeIterator();
1983 MEDCouplingUMeshCellEntry *ret=self->nextt();
1985 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1988 PyErr_SetString(PyExc_StopIteration,"No more data.");
1995 class MEDCouplingUMeshCellByTypeEntry
1998 ~MEDCouplingUMeshCellByTypeEntry();
2001 MEDCouplingUMeshCellByTypeIterator *__iter__()
2003 return self->iterator();
2008 class MEDCouplingUMeshCellEntry
2011 INTERP_KERNEL::NormalizedCellType getType() const;
2012 int getNumberOfElems() const;
2015 MEDCouplingUMeshCellIterator *__iter__()
2017 return self->iterator();
2022 //== MEDCouplingUMesh
2024 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2027 static MEDCouplingUMesh *New();
2028 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2029 void checkConsistencyLight() const;
2030 void setMeshDimension(int meshDim);
2031 void allocateCells(int nbOfCells=0);
2032 void finishInsertingCells();
2033 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2034 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2035 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2036 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2037 int getNodalConnectivityArrayLen() const;
2038 void computeTypes();
2039 std::string reprConnectivityOfThis() const;
2040 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2042 DataArrayIdType *conformize2D(double eps);
2043 DataArrayIdType *conformize3D(double eps);
2044 DataArrayIdType *colinearize2D(double eps);
2045 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2046 void shiftNodeNumbersInConn(int delta);
2047 std::vector<bool> getQuadraticStatus() const;
2048 DataArrayIdType *findCellIdsOnBoundary() const;
2049 MEDCouplingUMesh *computeSkin() const;
2050 bool checkConsecutiveCellTypes() const;
2051 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2052 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2053 DataArrayIdType *sortCellsInMEDFileFrmt();
2054 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2055 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2056 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2057 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2058 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2059 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2060 void orientCorrectlyPolyhedrons();
2061 bool isPresenceOfQuadratic() const;
2062 bool isFullyQuadratic() const;
2063 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2064 bool isContiguous1D() const;
2065 void tessellate2D(double eps);
2066 void convertQuadraticCellsToLinear();
2067 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2068 void convertDegeneratedCells();
2069 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2070 bool removeDegenerated1DCells();
2071 bool areOnlySimplexCells() const;
2072 MEDCouplingFieldDouble *getEdgeRatioField() const;
2073 MEDCouplingFieldDouble *getAspectRatioField() const;
2074 MEDCouplingFieldDouble *getWarpField() const;
2075 MEDCouplingFieldDouble *getSkewField() const;
2076 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2077 DataArrayIdType *convexEnvelop2D();
2078 std::string cppRepr() const;
2079 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2080 DataArrayIdType *findAndCorrectBadOriented3DCells();
2081 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2082 MEDCouplingSkyLineArray *generateGraph() const;
2083 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2084 DataArrayIdType *buildUnionOf2DMesh() const;
2085 DataArrayIdType *buildUnionOf3DMesh() const;
2086 DataArrayIdType *orderConsecutiveCells1D() const;
2087 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2088 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2089 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2090 void changeOrientationOfCells();
2091 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2092 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2093 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2094 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2095 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2096 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2097 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2101 return MEDCouplingUMesh::New();
2104 MEDCouplingUMesh(const char *meshName, int meshDim)
2106 return MEDCouplingUMesh::New(meshName,meshDim);
2109 std::string __str__() const
2111 return self->simpleRepr();
2114 std::string __repr__() const
2116 std::ostringstream oss;
2117 self->reprQuickOverview(oss);
2121 MEDCouplingUMeshCellIterator *__iter__()
2123 return self->cellIterator();
2126 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2128 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2132 PyObject *getAllGeoTypesSorted() const
2134 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2135 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2136 PyObject *res=PyList_New(result.size());
2137 for(int i=0;iL!=result.end(); i++, iL++)
2138 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2142 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2146 std::vector<mcIdType> multiVal;
2147 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2148 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2149 mcIdType nbc=self->getNumberOfCells();
2150 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2157 std::ostringstream oss;
2158 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2159 throw INTERP_KERNEL::Exception(oss.str().c_str());
2163 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2170 mcIdType tmp=nbc+singleVal;
2171 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2176 std::ostringstream oss;
2177 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2178 throw INTERP_KERNEL::Exception(oss.str().c_str());
2184 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2190 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2191 daIntTyypp->checkAllocated();
2192 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2196 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2200 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2204 std::vector<mcIdType> multiVal;
2205 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2206 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2207 mcIdType nbc=self->getNumberOfCells();
2208 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2215 std::ostringstream oss;
2216 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2217 throw INTERP_KERNEL::Exception(oss.str().c_str());
2221 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2228 mcIdType tmp=nbc+singleVal;
2229 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2234 std::ostringstream oss;
2235 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2236 throw INTERP_KERNEL::Exception(oss.str().c_str());
2242 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2247 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2253 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2254 daIntTyypp->checkAllocated();
2255 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2259 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2263 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2265 mcIdType szArr,sw,iTypppArr;
2266 std::vector<mcIdType> stdvecTyyppArr;
2267 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2270 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2271 throw INTERP_KERNEL::Exception(oss.str().c_str());
2273 self->insertNextCell(type,size,tmp);
2276 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2278 mcIdType szArr,sw,iTypppArr;
2279 std::vector<mcIdType> stdvecTyyppArr;
2280 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2281 self->insertNextCell(type,szArr,tmp);
2284 DataArrayIdType *getNodalConnectivity()
2286 DataArrayIdType *ret=self->getNodalConnectivity();
2291 DataArrayIdType *getNodalConnectivityIndex()
2293 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2299 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2301 mcIdType szArr,sw,iTypppArr;
2302 std::vector<mcIdType> stdvecTyyppArr;
2303 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2304 mcIdType nbOfDepthPeelingPerformed=0;
2305 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2306 PyObject *res=PyTuple_New(2);
2307 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2308 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2312 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2314 DataArrayIdType *v0=0,*v1=0;
2315 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2316 PyObject *res = PyList_New(2);
2317 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2318 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2322 PyObject *distanceToPoint(PyObject *point) const
2326 DataArrayDoubleTuple *aa;
2327 std::vector<double> bb;
2329 int nbOfCompo=self->getSpaceDimension();
2330 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2333 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2334 PyObject *ret=PyTuple_New(2);
2335 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2336 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2340 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2342 DataArrayIdType *ret1=0;
2343 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2344 PyObject *ret=PyTuple_New(2);
2345 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2350 PyObject *tetrahedrize(int policy)
2353 DataArrayIdType *ret1(0);
2354 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2355 PyObject *ret=PyTuple_New(3);
2356 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2357 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2362 PyObject *checkButterflyCells(double eps=1e-12)
2364 std::vector<mcIdType> cells;
2365 self->checkButterflyCells(cells,eps);
2366 DataArrayIdType *ret=DataArrayIdType::New();
2367 ret->alloc(cells.size(),1);
2368 std::copy(cells.begin(),cells.end(),ret->getPointer());
2369 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2372 PyObject *splitByType() const
2374 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2375 std::size_t sz=ms.size();
2376 PyObject *ret = PyList_New(sz);
2377 for(std::size_t i=0;i<sz;i++)
2378 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2382 PyObject *partitionBySpreadZone() const
2384 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2385 std::size_t sz=retCpp.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(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2392 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2394 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
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 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2405 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2406 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2407 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2410 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2413 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2414 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2418 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2421 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2422 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2426 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2428 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2429 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2430 PyObject *ret=PyTuple_New(3);
2431 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2432 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2433 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2437 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2439 DataArrayIdType *tmp0=0,*tmp1=0;
2440 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2441 PyObject *ret=PyTuple_New(2);
2442 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2447 void duplicateNodes(PyObject *li)
2451 std::vector<mcIdType> multiVal;
2452 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2453 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2454 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2458 return self->duplicateNodes(&singleVal,&singleVal+1);
2460 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2462 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2464 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2468 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2472 std::vector<mcIdType> multiVal;
2473 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2474 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2475 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2479 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2481 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2483 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2485 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2489 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2491 mcIdType szArr,sw,iTypppArr;
2492 std::vector<mcIdType> stdvecTyyppArr;
2493 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2494 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2497 PyObject *getLevArrPerCellTypes(PyObject *li) const
2500 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2501 DataArrayIdType *tmp0,*tmp1=0;
2502 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2503 PyObject *ret=PyTuple_New(2);
2504 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2505 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2509 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2511 DataArrayIdType *ret0=0,*ret1=0;
2512 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2513 PyObject *ret=PyTuple_New(2);
2514 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2515 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2519 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2521 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2522 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2523 DataArrayIdType *ret1=0,*ret2=0;
2524 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2525 PyObject *ret=PyTuple_New(3);
2526 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2527 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2528 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2532 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2534 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2535 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2536 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2537 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2540 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2543 std::vector<const MEDCouplingUMesh *> meshes;
2544 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2545 std::vector<DataArrayIdType *> corr;
2546 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2548 PyObject *ret1=PyList_New(sz);
2549 for(std::size_t i=0;i<sz;i++)
2550 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2551 PyObject *ret=PyList_New(2);
2552 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2553 PyList_SetItem(ret,1,ret1);
2557 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2559 std::vector<MEDCouplingUMesh *> meshes;
2560 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2561 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2564 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2566 std::vector<MEDCouplingUMesh *> meshes;
2567 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2568 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2571 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2575 DataArrayDoubleTuple *aa;
2576 std::vector<double> bb;
2578 int spaceDim=self->getSpaceDimension();
2579 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2580 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2582 std::vector<mcIdType> cells;
2583 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2584 DataArrayIdType *ret=DataArrayIdType::New();
2585 ret->alloc(cells.size(),1);
2586 std::copy(cells.begin(),cells.end(),ret->getPointer());
2587 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2590 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2594 DataArrayDoubleTuple *aa;
2595 std::vector<double> bb;
2597 int spaceDim=self->getSpaceDimension();
2598 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2599 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2600 self->orientCorrectly2DCells(v,polyOnly);
2603 PyObject *arePolyhedronsNotCorrectlyOriented() const
2605 std::vector<mcIdType> cells;
2606 self->arePolyhedronsNotCorrectlyOriented(cells);
2607 DataArrayIdType *ret=DataArrayIdType::New();
2608 ret->alloc(cells.size(),1);
2609 std::copy(cells.begin(),cells.end(),ret->getPointer());
2610 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2613 PyObject *getFastAveragePlaneOfThis() const
2617 self->getFastAveragePlaneOfThis(vec,pos);
2619 std::copy(vec,vec+3,vals);
2620 std::copy(pos,pos+3,vals+3);
2621 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2624 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2626 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2627 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2628 return MEDCouplingUMesh::MergeUMeshes(tmp);
2631 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2633 DataArrayIdType *ret1;
2634 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2635 PyObject *ret=PyTuple_New(2);
2636 PyObject *ret0Py=ret0?Py_True:Py_False;
2638 PyTuple_SetItem(ret,0,ret0Py);
2639 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2643 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2645 DataArrayIdType *ret1;
2646 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2647 PyObject *ret=PyTuple_New(2);
2648 PyObject *ret0Py=ret0?Py_True:Py_False;
2650 PyTuple_SetItem(ret,0,ret0Py);
2651 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2655 PyObject *explode3DMeshTo1D() const
2657 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2658 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2659 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2660 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2661 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2662 PyObject *ret=PyTuple_New(5);
2663 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2664 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2665 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2666 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2667 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2671 PyObject *explodeIntoEdges() const
2673 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2674 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2675 PyObject *ret=PyTuple_New(5);
2676 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2677 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2678 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2679 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2680 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2684 PyObject *explodeMeshIntoMicroEdges() const
2686 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2687 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2688 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2689 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2690 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2691 PyObject *ret=PyTuple_New(5);
2692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2696 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2700 PyObject *buildDescendingConnectivity() const
2702 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2703 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2704 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2705 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2706 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2707 PyObject *ret=PyTuple_New(5);
2708 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2709 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2710 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2711 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2712 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2716 PyObject *buildDescendingConnectivity2() const
2718 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2719 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2720 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2721 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2722 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2723 PyObject *ret=PyTuple_New(5);
2724 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2725 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2726 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2727 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2728 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2732 PyObject *computeNeighborsOfCells() const
2734 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2735 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2736 PyObject *ret=PyTuple_New(2);
2737 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2738 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2742 PyObject *computeNeighborsOfNodes() const
2744 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2745 self->computeNeighborsOfNodes(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 *computeEnlargedNeighborsOfNodes() const
2754 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2755 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2756 PyObject *ret=PyTuple_New(2);
2757 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2758 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2764 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2765 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2766 PyObject *ret=PyTuple_New(2);
2767 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2768 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2772 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2774 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2775 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2776 PyObject *ret=PyTuple_New(2);
2777 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2778 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2782 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2784 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2785 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2786 DataArrayIdType *d2,*d3,*d4,*dd5;
2787 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2788 PyObject *ret=PyTuple_New(7);
2789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2791 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2792 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2793 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2794 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2795 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2799 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2802 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2803 da->checkAllocated();
2804 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2807 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2810 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2811 da->checkAllocated();
2812 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2815 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2818 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2819 da->checkAllocated();
2820 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2823 PyObject *getTypesOfPart(DataArrayIdType *da) const
2826 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2827 da->checkAllocated();
2828 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2829 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2830 PyObject *res = PyList_New(result.size());
2831 for (int i=0;iL!=result.end(); i++, iL++)
2832 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2836 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2839 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2840 da->checkAllocated();
2841 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2842 ret->setName(da->getName().c_str());
2846 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2848 DataArrayIdType *cellNb1=0,*cellNb2=0;
2849 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2850 PyObject *ret=PyTuple_New(3);
2851 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2852 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2853 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2857 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2859 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2860 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2861 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2862 PyObject *ret(PyTuple_New(4));
2863 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2864 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2865 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2866 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2870 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2872 int spaceDim=self->getSpaceDimension();
2874 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2876 DataArrayDouble *a,*a2;
2877 DataArrayDoubleTuple *aa,*aa2;
2878 std::vector<double> bb,bb2;
2880 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2881 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2882 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2883 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2885 DataArrayIdType *cellIds=0;
2886 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2887 PyObject *ret=PyTuple_New(2);
2888 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2889 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2893 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2895 int spaceDim=self->getSpaceDimension();
2897 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2899 DataArrayDouble *a,*a2;
2900 DataArrayDoubleTuple *aa,*aa2;
2901 std::vector<double> bb,bb2;
2903 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2904 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2905 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2906 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2908 DataArrayIdType *cellIds=0;
2909 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2910 PyObject *ret=PyTuple_New(2);
2911 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2912 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2916 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2919 DataArrayDouble *a,*a2;
2920 DataArrayDoubleTuple *aa,*aa2;
2921 std::vector<double> bb,bb2;
2923 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2924 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2925 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2926 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2927 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2931 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2933 int spaceDim=self->getSpaceDimension();
2935 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2937 DataArrayDouble *a,*a2;
2938 DataArrayDoubleTuple *aa,*aa2;
2939 std::vector<double> bb,bb2;
2941 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2942 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2943 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2944 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2945 return self->getCellIdsCrossingPlane(orig,vect,eps);
2948 void convertToPolyTypes(PyObject *li)
2952 std::vector<mcIdType> pos2;
2953 DataArrayIdType *pos3=0;
2954 DataArrayIdTypeTuple *pos4=0;
2955 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2960 self->convertToPolyTypes(&pos1,&pos1+1);
2967 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2972 self->convertToPolyTypes(pos3->begin(),pos3->end());
2976 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2980 void convertAllToPoly();
2981 void convertExtrudedPolyhedra();
2983 void simplifyPolyhedra(double eps);
2984 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2985 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2988 //== MEDCouplingUMesh End
2990 //== MEDCouplingMappedExtrudedMesh
2992 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2995 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2996 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2997 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2998 int get2DCellIdForExtrusion() const;
3000 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
3002 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
3005 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
3007 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
3010 MEDCouplingMappedExtrudedMesh()
3012 return MEDCouplingMappedExtrudedMesh::New();
3015 std::string __str__() const
3017 return self->simpleRepr();
3020 std::string __repr__() const
3022 std::ostringstream oss;
3023 self->reprQuickOverview(oss);
3027 PyObject *getMesh2D() const
3029 MEDCouplingUMesh *ret=self->getMesh2D();
3032 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3034 PyObject *getMesh1D() const
3036 MEDCouplingUMesh *ret=self->getMesh1D();
3039 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3041 PyObject *getMesh3DIds() const
3043 DataArrayIdType *ret=self->getMesh3DIds();
3046 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3051 //== MEDCouplingMappedExtrudedMesh End
3053 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3056 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3057 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3058 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3059 int getNodalConnectivityLength() const;
3060 virtual void allocateCells(int nbOfCells=0);
3061 virtual void checkConsistencyOfConnectivity() const;
3064 virtual void insertNextCell(PyObject *li)
3066 mcIdType szArr,sw,iTypppArr;
3067 std::vector<mcIdType> stdvecTyyppArr;
3068 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3069 self->insertNextCell(tmp,tmp+szArr);
3072 virtual DataArrayIdType *getNodalConnectivity() const
3074 DataArrayIdType *ret=self->getNodalConnectivity();
3075 if(ret) ret->incrRef();
3079 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3081 std::vector< const MEDCoupling1GTUMesh *> parts;
3082 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3083 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3088 //== MEDCoupling1SGTUMesh
3090 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3093 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3094 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3095 void setNodalConnectivity(DataArrayIdType *nodalConn);
3096 int getNumberOfNodesPerCell() const;
3097 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3098 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3099 MEDCoupling1GTUMesh *computeDualMesh() const;
3100 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3101 DataArrayIdType *sortHexa8EachOther();
3104 MEDCoupling1SGTUMesh()
3106 return MEDCoupling1SGTUMesh::New();
3109 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3111 return MEDCoupling1SGTUMesh::New(name,type);
3114 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3116 return MEDCoupling1SGTUMesh::New(m);
3119 std::string __str__() const
3121 return self->simpleRepr();
3124 std::string __repr__() const
3126 std::ostringstream oss;
3127 self->reprQuickOverview(oss);
3131 PyObject *structurizeMe(double eps=1e-12) const
3133 DataArrayIdType *cellPerm(0),*nodePerm(0);
3134 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3135 PyObject *ret(PyTuple_New(3));
3136 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3137 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3138 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3142 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3144 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3145 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3146 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3149 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3151 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3152 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3153 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3158 //== MEDCoupling1SGTUMesh End
3160 //== MEDCoupling1DGTUMesh
3162 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3165 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3166 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3167 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3168 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3169 bool isPacked() const;
3172 MEDCoupling1DGTUMesh()
3174 return MEDCoupling1DGTUMesh::New();
3176 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3178 return MEDCoupling1DGTUMesh::New(name,type);
3181 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3183 return MEDCoupling1DGTUMesh::New(m);
3186 std::string __str__() const
3188 return self->simpleRepr();
3191 std::string __repr__() const
3193 std::ostringstream oss;
3194 self->reprQuickOverview(oss);
3198 DataArrayIdType *getNodalConnectivityIndex() const
3200 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3201 if(ret) ret->incrRef();
3205 PyObject *retrievePackedNodalConnectivity() const
3207 DataArrayIdType *ret1=0,*ret2=0;
3208 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3209 PyObject *ret0Py=ret0?Py_True:Py_False;
3211 PyObject *ret=PyTuple_New(3);
3212 PyTuple_SetItem(ret,0,ret0Py);
3213 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3214 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3218 PyObject *copyWithNodalConnectivityPacked() const
3221 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3222 PyObject *ret=PyTuple_New(2);
3223 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3224 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3225 PyTuple_SetItem(ret,1,ret1Py);
3229 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3231 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3232 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3233 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3236 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3238 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3239 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3240 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3243 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3245 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3246 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3247 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3252 //== MEDCoupling1DGTUMeshEnd
3254 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3257 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3258 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3259 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3260 int getSpaceDimensionOnNodeStruct() const;
3261 double computeSquareness() const;
3262 virtual std::vector<mcIdType> getNodeGridStructure() const;
3263 std::vector<mcIdType> getCellGridStructure() const;
3264 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3265 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3266 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3267 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3268 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3269 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3270 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3271 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3274 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3276 mcIdType tmpp1=-1,tmpp2=-1;
3277 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3278 std::vector< std::pair<mcIdType,mcIdType> > inp;
3282 for(mcIdType i=0;i<tmpp1;i++)
3283 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3288 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3289 inp.resize(tmpp1/2);
3290 for(mcIdType i=0;i<tmpp1/2;i++)
3291 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3294 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3295 return self->buildStructuredSubPart(inp);
3298 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3300 std::vector< std::pair<mcIdType,mcIdType> > inp;
3301 convertPyToVectorPairInt(part,inp);
3303 mcIdType szArr,sw,iTypppArr;
3304 std::vector<mcIdType> stdvecTyyppArr;
3305 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3306 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3308 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3311 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3313 std::vector< std::pair<mcIdType,mcIdType> > inp;
3314 convertPyToVectorPairInt(part,inp);
3315 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3318 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3320 std::vector< std::pair<mcIdType,mcIdType> > inp;
3321 convertPyToVectorPairInt(part,inp);
3322 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3325 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3327 std::vector< std::pair<mcIdType,mcIdType> > inp;
3328 convertPyToVectorPairInt(part,inp);
3329 std::vector<mcIdType> stWithGhost;
3330 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3331 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3332 PyObject *ret(PyTuple_New(2));
3333 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3334 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3338 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3340 std::vector< std::pair<mcIdType,mcIdType> > inp;
3341 convertPyToVectorPairInt(partCompactFormat,inp);
3342 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3345 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3347 std::vector< std::pair<mcIdType,mcIdType> > inp;
3348 convertPyToVectorPairInt(partCompactFormat,inp);
3349 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3352 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3354 std::vector< std::pair<mcIdType,mcIdType> > inp;
3355 convertPyToVectorPairInt(part,inp);
3356 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3359 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3361 mcIdType szArr,sw,iTypppArr;
3362 std::vector<mcIdType> stdvecTyyppArr;
3363 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3364 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3367 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3369 mcIdType szArr,sw,iTypppArr;
3370 std::vector<mcIdType> stdvecTyyppArr;
3371 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3372 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3375 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3377 std::vector< std::pair<mcIdType,mcIdType> > inp;
3378 convertPyToVectorPairInt(partCompactFormat,inp);
3379 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3382 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3384 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3385 PyObject *retPy=PyList_New(ret.size());
3386 for(std::size_t i=0;i<ret.size();i++)
3388 PyObject *tmp=PyTuple_New(2);
3389 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3390 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3391 PyList_SetItem(retPy,i,tmp);
3396 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3398 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3399 convertPyToVectorPairInt(r1,r1Cpp);
3400 convertPyToVectorPairInt(r2,r2Cpp);
3401 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3402 PyObject *retPy=PyList_New(ret.size());
3403 for(std::size_t i=0;i<ret.size();i++)
3405 PyObject *tmp=PyTuple_New(2);
3406 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3407 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3408 PyList_SetItem(retPy,i,tmp);
3413 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3415 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3416 convertPyToVectorPairInt(r1,r1Cpp);
3417 convertPyToVectorPairInt(r2,r2Cpp);
3418 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3421 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3423 mcIdType szArr,sw,iTypppArr;
3424 std::vector<mcIdType> stdvecTyyppArr;
3425 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3426 mcIdType szArr2,sw2,iTypppArr2;
3427 std::vector<mcIdType> stdvecTyyppArr2;
3428 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3429 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3430 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3431 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3432 PyObject *ret=PyTuple_New(2);
3433 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3434 PyTuple_SetItem(ret,0,ret0Py);
3435 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3436 for(std::size_t i=0;i<partCompactFormat.size();i++)
3438 PyObject *tmp4=PyTuple_New(2);
3439 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3440 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3441 PyList_SetItem(ret1Py,i,tmp4);
3443 PyTuple_SetItem(ret,1,ret1Py);
3447 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3449 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3450 convertPyToVectorPairInt(bigInAbs,param0);
3451 convertPyToVectorPairInt(partOfBigInAbs,param1);
3452 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3453 PyObject *retPy(PyList_New(ret.size()));
3454 for(std::size_t i=0;i<ret.size();i++)
3456 PyObject *tmp(PyTuple_New(2));
3457 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3458 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3459 PyList_SetItem(retPy,i,tmp);
3464 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3466 std::vector< std::pair<mcIdType,mcIdType> > param0;
3467 convertPyToVectorPairInt(part,param0);
3468 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3469 PyObject *retPy(PyList_New(ret.size()));
3470 for(std::size_t i=0;i<ret.size();i++)
3472 PyObject *tmp(PyTuple_New(2));
3473 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3474 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3475 PyList_SetItem(retPy,i,tmp);
3480 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3482 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3483 convertPyToVectorPairInt(startingFrom,param0);
3484 convertPyToVectorPairInt(goingTo,param1);
3485 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3488 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3490 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3491 convertPyToVectorPairInt(bigInAbs,param0);
3492 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3493 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3494 PyObject *retPy(PyList_New(ret.size()));
3495 for(std::size_t i=0;i<ret.size();i++)
3497 PyObject *tmp(PyTuple_New(2));
3498 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3499 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3500 PyList_SetItem(retPy,i,tmp);
3507 class MEDCouplingCurveLinearMesh;
3509 //== MEDCouplingCMesh
3511 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3514 static MEDCouplingCMesh *New();
3515 static MEDCouplingCMesh *New(const std::string& meshName);
3516 void setCoords(const DataArrayDouble *coordsX,
3517 const DataArrayDouble *coordsY=0,
3518 const DataArrayDouble *coordsZ=0);
3519 void setCoordsAt(int i, const DataArrayDouble *arr);
3520 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3524 return MEDCouplingCMesh::New();
3526 MEDCouplingCMesh(const std::string& meshName)
3528 return MEDCouplingCMesh::New(meshName);
3530 std::string __str__() const
3532 return self->simpleRepr();
3534 std::string __repr__() const
3536 std::ostringstream oss;
3537 self->reprQuickOverview(oss);
3540 DataArrayDouble *getCoordsAt(int i)
3542 DataArrayDouble *ret=self->getCoordsAt(i);
3550 //== MEDCouplingCMesh End
3552 //== MEDCouplingCurveLinearMesh
3554 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3557 static MEDCouplingCurveLinearMesh *New();
3558 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3559 void setCoords(const DataArrayDouble *coords);
3561 MEDCouplingCurveLinearMesh()
3563 return MEDCouplingCurveLinearMesh::New();
3565 MEDCouplingCurveLinearMesh(const std::string& meshName)
3567 return MEDCouplingCurveLinearMesh::New(meshName);
3569 std::string __str__() const
3571 return self->simpleRepr();
3573 std::string __repr__() const
3575 std::ostringstream oss;
3576 self->reprQuickOverview(oss);
3579 DataArrayDouble *getCoords()
3581 DataArrayDouble *ret=self->getCoords();
3586 void setNodeGridStructure(PyObject *gridStruct)
3588 mcIdType szArr,sw,iTypppArr;
3589 std::vector<mcIdType> stdvecTyyppArr;
3590 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3591 self->setNodeGridStructure(tmp,tmp+szArr);
3596 //== MEDCouplingCurveLinearMesh End
3598 //== MEDCouplingIMesh
3600 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3603 static MEDCouplingIMesh *New();
3605 void setSpaceDimension(int spaceDim);
3606 std::vector<mcIdType> getNodeStruct() const;
3607 std::vector<double> getOrigin() const;
3608 std::vector<double> getDXYZ() const;
3609 void setAxisUnit(const std::string& unitName);
3610 std::string getAxisUnit() const;
3611 double getMeasureOfAnyCell() const;
3612 MEDCouplingCMesh *convertToCartesian() const;
3613 void refineWithFactor(const std::vector<mcIdType>& factors);
3614 MEDCouplingIMesh *asSingleCell() const;
3615 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3620 return MEDCouplingIMesh::New();
3622 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3624 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3625 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3626 const mcIdType *nodeStrctPtr(0);
3627 const double *originPtr(0),*dxyzPtr(0);
3628 mcIdType sw,sz,val0;
3629 std::vector<mcIdType> bb0;
3630 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3633 std::vector<double> bb,bb2;
3635 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3636 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3638 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3641 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3643 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3646 void setNodeStruct(PyObject *nodeStrct)
3648 mcIdType sw,sz,val0;
3649 std::vector<mcIdType> bb0;
3650 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3651 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3654 void setOrigin(PyObject *origin)
3656 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3658 std::vector<double> bb;
3659 mcIdType sw,nbTuples;
3660 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3661 self->setOrigin(originPtr,originPtr+nbTuples);
3664 void setDXYZ(PyObject *dxyz)
3666 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' 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(dxyz,sw,val,bb,msg,false,nbTuples));
3671 self->setDXYZ(originPtr,originPtr+nbTuples);
3674 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3676 std::vector< std::pair<mcIdType,mcIdType> > inp;
3677 convertPyToVectorPairInt(fineLocInCoarse,inp);
3678 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3681 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3683 std::vector< std::pair<mcIdType,mcIdType> > inp;
3684 convertPyToVectorPairInt(fineLocInCoarse,inp);
3685 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3688 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3690 std::vector< std::pair<mcIdType,mcIdType> > inp;
3691 convertPyToVectorPairInt(fineLocInCoarse,inp);
3692 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3695 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3697 std::vector< std::pair<mcIdType,mcIdType> > inp;
3698 convertPyToVectorPairInt(fineLocInCoarse,inp);
3699 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3702 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3704 std::vector< std::pair<mcIdType,mcIdType> > inp;
3705 convertPyToVectorPairInt(fineLocInCoarse,inp);
3706 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3709 std::string __str__() const
3711 return self->simpleRepr();
3713 std::string __repr__() const
3715 std::ostringstream oss;
3716 self->reprQuickOverview(oss);
3722 //== MEDCouplingIMesh End
3726 namespace MEDCoupling
3728 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3731 virtual void checkConsistencyLight() const;
3732 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3733 bool areStrictlyCompatible(const MEDCouplingField *other) const;
3734 bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
3735 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3736 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3737 void setName(const char *name);
3738 std::string getDescription() const;
3739 void setDescription(const char *desc);
3740 std::string getName() const;
3741 TypeOfField getTypeOfField() const;
3742 NatureOfField getNature() const;
3743 virtual void setNature(NatureOfField nat);
3744 DataArrayDouble *getLocalizationOfDiscr() const;
3745 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3746 mcIdType getNumberOfTuplesExpected() const;
3747 mcIdType getNumberOfMeshPlacesExpected() const;
3748 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3749 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3750 void clearGaussLocalizations();
3751 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3752 mcIdType getNbOfGaussLocalization() const;
3753 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3754 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3755 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3756 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3758 PyObject *getMesh() const
3760 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3763 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3766 PyObject *getDiscretization()
3768 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3771 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3774 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3776 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3777 return convertIntArrToPyList3(ret);
3780 PyObject *buildSubMeshData(PyObject *li) const
3782 DataArrayIdType *ret1=0;
3783 MEDCouplingMesh *ret0=0;
3785 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3786 if (!SWIG_IsOK(res1))
3789 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3790 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3794 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3796 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3797 da2->checkAllocated();
3798 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3800 PyObject *res = PyList_New(2);
3801 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3802 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3806 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3808 DataArrayIdType *ret1=0;
3810 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3811 PyObject *res=PyTuple_New(2);
3812 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3814 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3817 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3818 PyTuple_SetItem(res,1,res1);
3823 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3826 mcIdType v0; std::vector<mcIdType> v1;
3827 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3828 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3831 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3832 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3835 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3836 if (!SWIG_IsOK(res1))
3839 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3840 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3844 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3846 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3847 da2->checkAllocated();
3848 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3852 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3854 std::vector<mcIdType> tmp;
3855 self->getCellIdsHavingGaussLocalization(locId,tmp);
3856 DataArrayIdType *ret=DataArrayIdType::New();
3857 ret->alloc((mcIdType)tmp.size(),1);
3858 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3859 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3862 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3864 std::vector<mcIdType> inp0;
3865 convertPyToNewIntArr4(code,1,3,inp0);
3866 std::vector<const DataArrayIdType *> inp1;
3867 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3868 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3873 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3876 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3877 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3878 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3879 static MEDCouplingFieldTemplate *New(TypeOfField type);
3880 std::string simpleRepr() const;
3881 std::string advancedRepr() const;
3882 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3883 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3886 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3888 return MEDCouplingFieldTemplate::New(f);
3891 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3893 return MEDCouplingFieldTemplate::New(f);
3896 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3898 return MEDCouplingFieldTemplate::New(f);
3901 MEDCouplingFieldTemplate(TypeOfField type)
3903 return MEDCouplingFieldTemplate::New(type);
3906 std::string __str__() const
3908 return self->simpleRepr();
3911 std::string __repr__() const
3913 std::ostringstream oss;
3914 self->reprQuickOverview(oss);
3918 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3921 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3922 PyObject *ret=PyTuple_New(2);
3923 PyObject *ret0Py=ret0?Py_True:Py_False;
3925 PyTuple_SetItem(ret,0,ret0Py);
3926 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3933 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3936 TypeOfTimeDiscretization getTimeDiscretization() const;
3938 MEDCouplingFieldT();
3939 ~MEDCouplingFieldT();
3942 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3943 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3944 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3946 class MEDCouplingFieldInt;
3947 class MEDCouplingFieldFloat;
3949 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3952 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3953 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3954 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3955 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3956 void setTimeUnit(const std::string& unit);
3957 std::string getTimeUnit() const;
3958 void synchronizeTimeWithSupport();
3959 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3960 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3961 std::string simpleRepr() const;
3962 std::string advancedRepr() const;
3963 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3964 MEDCouplingFieldInt *convertToIntField() const;
3965 MEDCouplingFieldFloat *convertToFloatField() const;
3966 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3967 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3968 MEDCouplingFieldDouble *deepCopy() const;
3969 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3970 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3971 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3972 double getIJ(int tupleId, int compoId) const;
3973 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3974 void synchronizeTimeWithMesh();
3975 void setArray(DataArrayDouble *array);
3976 void setEndArray(DataArrayDouble *array);
3977 void setTime(double val, int iteration, int order);
3978 void setStartTime(double val, int iteration, int order);
3979 void setEndTime(double val, int iteration, int order);
3980 void applyLin(double a, double b, int compoId);
3981 void applyLin(double a, double b);
3982 int getNumberOfComponents() const;
3983 int getNumberOfTuples() const;
3984 int getNumberOfValues() const;
3985 void setTimeTolerance(double val);
3986 double getTimeTolerance() const;
3987 void setIteration(int it);
3988 void setEndIteration(int it);
3989 void setOrder(int order);
3990 void setEndOrder(int order);
3991 void setTimeValue(double val);
3992 void setEndTimeValue(double val);
3993 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3994 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3995 bool mergeNodes(double eps, double epsOnVals=1e-15);
3996 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3997 bool zipCoords(double epsOnVals=1e-15);
3998 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3999 bool simplexize(int policy);
4000 MEDCouplingFieldDouble *doublyContractedProduct() const;
4001 MEDCouplingFieldDouble *determinant() const;
4002 MEDCouplingFieldDouble *eigenValues() const;
4003 MEDCouplingFieldDouble *eigenVectors() const;
4004 MEDCouplingFieldDouble *inverse() const;
4005 MEDCouplingFieldDouble *trace() const;
4006 MEDCouplingFieldDouble *deviator() const;
4007 MEDCouplingFieldDouble *magnitude() const;
4008 MEDCouplingFieldDouble *maxPerTuple() const;
4009 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
4010 void sortPerTuple(bool asc);
4011 MEDCouplingFieldDouble &operator=(double value);
4012 void fillFromAnalytic(int nbOfComp, const std::string& func);
4013 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
4014 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4015 void applyFunc(int nbOfComp, const std::string& func);
4016 void applyFuncCompo(int nbOfComp, const std::string& func);
4017 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
4018 void applyFunc(int nbOfComp, double val);
4019 void applyFunc(const std::string& func);
4020 void applyFuncFast32(const std::string& func);
4021 void applyFuncFast64(const std::string& func);
4022 double accumulate(int compId) const;
4023 double getMaxValue() const;
4024 double getMinValue() const;
4025 double getAverageValue() const;
4026 double norm2() const;
4027 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4028 double getWeightedAverageValue(int compId, bool isWAbs) const;
4029 double integral(int compId, bool isWAbs) const;
4030 double normL1(int compId) const;
4031 double normL2(int compId) const;
4032 double normMax(int compId) const;
4033 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4034 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4035 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4036 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4037 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4038 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4039 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4040 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4041 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4042 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4043 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4044 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4045 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4046 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4047 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4048 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4049 MEDCouplingFieldDouble *negate() const;
4051 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4053 return MEDCouplingFieldDouble::New(type,td);
4056 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4058 return MEDCouplingFieldDouble::New(ft,td);
4061 std::string __str__() const
4063 return self->simpleRepr();
4066 std::string __repr__() const
4068 std::ostringstream oss;
4069 self->reprQuickOverview(oss);
4073 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4076 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4077 PyObject *ret=PyTuple_New(2);
4078 PyObject *ret0Py=ret0?Py_True:Py_False;
4080 PyTuple_SetItem(ret,0,ret0Py);
4081 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4085 MEDCouplingFieldDouble *voronoize(double eps) const
4087 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4091 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4093 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4097 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4099 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4101 DataArrayDouble *a,*a2;
4102 DataArrayDoubleTuple *aa,*aa2;
4103 std::vector<double> bb,bb2;
4105 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4106 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4107 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4110 DataArrayDouble *getArray()
4112 DataArrayDouble *ret=self->getArray();
4118 PyObject *getArrays() const
4120 std::vector<DataArrayDouble *> arrs=self->getArrays();
4121 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4124 std::size_t sz=arrs.size();
4125 PyObject *ret=PyTuple_New(sz);
4126 for(std::size_t i=0;i<sz;i++)
4129 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4131 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4136 void setArrays(PyObject *ls)
4138 std::vector<const DataArrayDouble *> tmp;
4139 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4140 std::size_t sz=tmp.size();
4141 std::vector<DataArrayDouble *> arrs(sz);
4142 for(std::size_t i=0;i<sz;i++)
4143 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4144 self->setArrays(arrs);
4147 DataArrayDouble *getEndArray()
4149 DataArrayDouble *ret=self->getEndArray();
4155 PyObject *getValueOn(PyObject *sl) const
4159 DataArrayDoubleTuple *aa;
4160 std::vector<double> bb;
4162 const MEDCouplingMesh *mesh=self->getMesh();
4164 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4165 int spaceDim=mesh->getSpaceDimension();
4166 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4167 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4169 mcIdType sz=ToIdType(self->getNumberOfComponents());
4170 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4171 self->getValueOn(spaceLoc,res);
4172 return convertDblArrToPyList<double>(res,sz);
4175 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4177 mcIdType sz=ToIdType(self->getNumberOfComponents());
4178 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4179 self->getValueOnPos(i,j,k,res);
4180 return convertDblArrToPyList<double>(res,sz);
4183 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4185 const MEDCouplingMesh *mesh(self->getMesh());
4187 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4190 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4191 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4192 mesh->getSpaceDimension(),true,nbPts);
4193 return self->getValueOnMulti(inp,(int)nbPts);
4196 PyObject *getValueOn(PyObject *sl, double time) const
4200 DataArrayDoubleTuple *aa;
4201 std::vector<double> bb;
4203 const MEDCouplingMesh *mesh=self->getMesh();
4205 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4206 int spaceDim=mesh->getSpaceDimension();
4207 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4208 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4211 mcIdType sz=ToIdType(self->getNumberOfComponents());
4212 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4213 self->getValueOn(spaceLoc,time,res);
4214 return convertDblArrToPyList<double>(res,sz);
4217 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4219 if(self->getArray()!=0)
4220 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4223 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4224 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4225 self->setArray(arr);
4232 double tmp0=self->getTime(tmp1,tmp2);
4233 PyObject *res = PyList_New(3);
4234 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4235 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4236 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4240 PyObject *getStartTime()
4243 double tmp0=self->getStartTime(tmp1,tmp2);
4244 PyObject *res = PyList_New(3);
4245 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4246 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4247 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4251 PyObject *getEndTime()
4254 double tmp0=self->getEndTime(tmp1,tmp2);
4255 PyObject *res = PyList_New(3);
4256 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4257 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4258 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4261 PyObject *accumulate() const
4263 mcIdType sz=ToIdType(self->getNumberOfComponents());
4264 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4265 self->accumulate(tmp);
4266 return convertDblArrToPyList<double>(tmp,sz);
4268 PyObject *integral(bool isWAbs) const
4270 mcIdType sz=ToIdType(self->getNumberOfComponents());
4271 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4272 self->integral(isWAbs,tmp);
4273 return convertDblArrToPyList<double>(tmp,sz);
4275 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4277 mcIdType sz=ToIdType(self->getNumberOfComponents());
4278 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4279 self->getWeightedAverageValue(tmp,isWAbs);
4280 return convertDblArrToPyList<double>(tmp,sz);
4282 PyObject *normL1() const
4284 mcIdType sz=ToIdType(self->getNumberOfComponents());
4285 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4287 return convertDblArrToPyList<double>(tmp,sz);
4289 PyObject *normL2() const
4291 mcIdType sz=ToIdType(self->getNumberOfComponents());
4292 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4294 return convertDblArrToPyList<double>(tmp,sz);
4296 PyObject *normMax() const
4298 mcIdType sz=ToIdType(self->getNumberOfComponents());
4299 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4301 return convertDblArrToPyList<double>(tmp,sz);
4303 void renumberCells(PyObject *li, bool check=true)
4305 mcIdType szArr,sw,iTypppArr;
4306 std::vector<mcIdType> stdvecTyyppArr;
4307 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4308 self->renumberCells(tmp,check);
4311 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4313 mcIdType szArr,sw,iTypppArr;
4314 std::vector<mcIdType> stdvecTyyppArr;
4315 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4316 self->renumberCellsWithoutMesh(tmp,check);
4319 void renumberNodes(PyObject *li, double eps=1e-15)
4321 mcIdType szArr,sw,iTypppArr;
4322 std::vector<mcIdType> stdvecTyyppArr;
4323 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4324 self->renumberNodes(tmp,eps);
4327 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4329 mcIdType szArr,sw,iTypppArr;
4330 std::vector<mcIdType> stdvecTyyppArr;
4331 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4332 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4335 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4337 return fieldT_buildSubPart(self,li);
4340 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4342 return fieldT__getitem__(self,li);
4345 PyObject *getMaxValue2() const
4347 DataArrayIdType *tmp;
4348 double r1=self->getMaxValue2(tmp);
4349 PyObject *ret=PyTuple_New(2);
4350 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4351 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4355 PyObject *getMinValue2() const
4357 DataArrayIdType *tmp;
4358 double r1=self->getMinValue2(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 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4367 std::vector<std::size_t> tmp;
4368 convertPyToNewIntArr3(li,tmp);
4369 return self->keepSelectedComponents(tmp);
4372 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4374 std::vector<std::size_t> tmp;
4375 convertPyToNewIntArr3(li,tmp);
4376 self->setSelectedComponents(f,tmp);
4379 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4382 DataArrayDouble *a,*a2;
4383 DataArrayDoubleTuple *aa,*aa2;
4384 std::vector<double> bb,bb2;
4387 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4388 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4389 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4390 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4392 return self->extractSlice3D(orig,vect,eps);
4395 MEDCouplingFieldDouble *__add__(PyObject *obj)
4397 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4400 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4402 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4405 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4407 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.";
4408 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4411 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4413 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4415 return (*self)-(*other);
4417 throw INTERP_KERNEL::Exception(msg);
4422 DataArrayDoubleTuple *aa;
4423 std::vector<double> bb;
4425 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4430 if(!self->getArray())
4431 throw INTERP_KERNEL::Exception(msg2);
4432 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4433 ret->applyLin(1.,-val);
4434 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4435 ret2->setArray(ret);
4440 if(!self->getArray())
4441 throw INTERP_KERNEL::Exception(msg2);
4442 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4443 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4444 ret2->setArray(ret);
4449 if(!self->getArray())
4450 throw INTERP_KERNEL::Exception(msg2);
4451 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4452 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
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=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4462 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4463 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4464 ret2->setArray(ret);
4468 { throw INTERP_KERNEL::Exception(msg); }
4472 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4474 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4477 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4479 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4482 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4484 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4487 MEDCouplingFieldDouble *__div__(PyObject *obj)
4489 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.";
4490 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4493 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4495 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4497 return (*self)/(*other);
4499 throw INTERP_KERNEL::Exception(msg);
4504 DataArrayDoubleTuple *aa;
4505 std::vector<double> bb;
4507 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4513 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4514 if(!self->getArray())
4515 throw INTERP_KERNEL::Exception(msg2);
4516 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4517 ret->applyLin(1./val,0);
4518 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4519 ret2->setArray(ret);
4524 if(!self->getArray())
4525 throw INTERP_KERNEL::Exception(msg2);
4526 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4527 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4528 ret2->setArray(ret);
4533 if(!self->getArray())
4534 throw INTERP_KERNEL::Exception(msg2);
4535 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4536 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
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=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4546 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4547 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4548 ret2->setArray(ret);
4552 { throw INTERP_KERNEL::Exception(msg); }
4556 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4558 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4561 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4563 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.";
4564 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4567 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4569 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4571 return (*self)^(*other);
4573 throw INTERP_KERNEL::Exception(msg);
4578 DataArrayDoubleTuple *aa;
4579 std::vector<double> bb;
4581 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4586 if(!self->getArray())
4587 throw INTERP_KERNEL::Exception(msg2);
4588 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4590 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4591 ret2->setArray(ret);
4596 if(!self->getArray())
4597 throw INTERP_KERNEL::Exception(msg2);
4598 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4599 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4600 ret2->setArray(ret);
4605 if(!self->getArray())
4606 throw INTERP_KERNEL::Exception(msg2);
4607 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4608 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4609 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4610 ret2->setArray(ret);
4615 if(!self->getArray())
4616 throw INTERP_KERNEL::Exception(msg2);
4617 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4618 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4619 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4620 ret2->setArray(ret);
4624 { throw INTERP_KERNEL::Exception(msg); }
4628 MEDCouplingFieldDouble *__neg__() const
4630 return self->negate();
4633 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4635 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.";
4636 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4639 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4641 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4645 Py_XINCREF(trueSelf);
4649 throw INTERP_KERNEL::Exception(msg);
4654 DataArrayDoubleTuple *aa;
4655 std::vector<double> bb;
4657 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4662 if(!self->getArray())
4663 throw INTERP_KERNEL::Exception(msg2);
4664 self->getArray()->applyLin(1.,val);
4665 Py_XINCREF(trueSelf);
4670 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4673 Py_XINCREF(trueSelf);
4678 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4679 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4680 ret2->setArray(aaa);
4682 Py_XINCREF(trueSelf);
4687 if(!self->getArray())
4688 throw INTERP_KERNEL::Exception(msg2);
4689 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4690 self->getArray()->addEqual(aaa);
4691 Py_XINCREF(trueSelf);
4695 { throw INTERP_KERNEL::Exception(msg); }
4699 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4701 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.";
4702 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4705 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4707 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4711 Py_XINCREF(trueSelf);
4715 throw INTERP_KERNEL::Exception(msg);
4720 DataArrayDoubleTuple *aa;
4721 std::vector<double> bb;
4723 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4728 if(!self->getArray())
4729 throw INTERP_KERNEL::Exception(msg2);
4730 self->getArray()->applyLin(1.,-val);
4731 Py_XINCREF(trueSelf);
4736 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4739 Py_XINCREF(trueSelf);
4744 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4745 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4746 ret2->setArray(aaa);
4748 Py_XINCREF(trueSelf);
4753 if(!self->getArray())
4754 throw INTERP_KERNEL::Exception(msg2);
4755 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4756 self->getArray()->substractEqual(aaa);
4757 Py_XINCREF(trueSelf);
4761 { throw INTERP_KERNEL::Exception(msg); }
4765 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4767 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.";
4768 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4771 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4773 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4777 Py_XINCREF(trueSelf);
4781 throw INTERP_KERNEL::Exception(msg);
4786 DataArrayDoubleTuple *aa;
4787 std::vector<double> bb;
4789 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4794 if(!self->getArray())
4795 throw INTERP_KERNEL::Exception(msg2);
4796 self->getArray()->applyLin(val,0);
4797 Py_XINCREF(trueSelf);
4802 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4805 Py_XINCREF(trueSelf);
4810 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4811 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4812 ret2->setArray(aaa);
4814 Py_XINCREF(trueSelf);
4819 if(!self->getArray())
4820 throw INTERP_KERNEL::Exception(msg2);
4821 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4822 self->getArray()->multiplyEqual(aaa);
4823 Py_XINCREF(trueSelf);
4827 { throw INTERP_KERNEL::Exception(msg); }
4831 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4833 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.";
4834 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4837 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4839 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4843 Py_XINCREF(trueSelf);
4847 throw INTERP_KERNEL::Exception(msg);
4852 DataArrayDoubleTuple *aa;
4853 std::vector<double> bb;
4855 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4861 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4862 if(!self->getArray())
4863 throw INTERP_KERNEL::Exception(msg2);
4864 self->getArray()->applyLin(1./val,0);
4865 Py_XINCREF(trueSelf);
4870 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4873 Py_XINCREF(trueSelf);
4878 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4879 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4880 ret2->setArray(aaa);
4882 Py_XINCREF(trueSelf);
4887 if(!self->getArray())
4888 throw INTERP_KERNEL::Exception(msg2);
4889 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4890 self->getArray()->divideEqual(aaa);
4891 Py_XINCREF(trueSelf);
4895 { throw INTERP_KERNEL::Exception(msg); }
4899 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4901 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.";
4902 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4905 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4907 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4911 Py_XINCREF(trueSelf);
4915 throw INTERP_KERNEL::Exception(msg);
4920 DataArrayDoubleTuple *aa;
4921 std::vector<double> bb;
4923 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4928 if(!self->getArray())
4929 throw INTERP_KERNEL::Exception(msg2);
4930 self->getArray()->applyPow(val);
4931 Py_XINCREF(trueSelf);
4936 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4939 Py_XINCREF(trueSelf);
4944 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4945 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4946 ret2->setArray(aaa);
4948 Py_XINCREF(trueSelf);
4953 if(!self->getArray())
4954 throw INTERP_KERNEL::Exception(msg2);
4955 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4956 self->getArray()->powEqual(aaa);
4957 Py_XINCREF(trueSelf);
4961 { throw INTERP_KERNEL::Exception(msg); }
4965 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4967 std::vector<const MEDCouplingFieldDouble *> tmp;
4968 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4969 return MEDCouplingFieldDouble::MergeFields(tmp);
4972 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4974 std::vector<const MEDCouplingFieldDouble *> tmp;
4975 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4976 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4979 PyObject *getTinySerializationInformation() const
4981 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4984 PyObject *serialize() const
4986 return field_serialize<double>(self);
4989 PyObject *__getstate__() const
4991 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4994 void __setstate__(PyObject *inp)
4996 field__setstate__<double>(self,inp);
5001 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
5004 int getNumberOfFields() const;
5005 MEDCouplingMultiFields *deepCopy() const;
5006 virtual std::string simpleRepr() const;
5007 virtual std::string advancedRepr() const;
5008 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5009 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
5010 virtual void checkConsistencyLight() const;
5013 std::string __str__() const
5015 return self->simpleRepr();
5017 static MEDCouplingMultiFields *New(PyObject *li)
5019 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5020 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5021 std::size_t sz=tmp.size();
5022 std::vector<MEDCouplingFieldDouble *> fs(sz);
5023 for(std::size_t i=0;i<sz;i++)
5024 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5025 return MEDCouplingMultiFields::New(fs);
5027 MEDCouplingMultiFields(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 PyObject *getFields() const
5039 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5040 std::size_t sz=fields.size();
5041 PyObject *res = PyList_New(sz);
5042 for(std::size_t i=0;i<sz;i++)
5046 fields[i]->incrRef();
5047 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5051 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5056 PyObject *getFieldAtPos(int id) const
5058 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5062 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5065 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5067 PyObject *getMeshes() const
5069 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5070 std::size_t sz=ms.size();
5071 PyObject *res = PyList_New(sz);
5072 for(std::size_t i=0;i<sz;i++)
5077 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5081 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5086 PyObject *getDifferentMeshes() const
5088 std::vector<int> refs;
5089 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5090 std::size_t sz=ms.size();
5091 PyObject *res = PyList_New(sz);
5092 for(std::size_t i=0;i<sz;i++)
5097 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5101 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5105 PyObject *ret=PyTuple_New(2);
5106 PyTuple_SetItem(ret,0,res);
5107 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5110 PyObject *getArrays() const
5112 std::vector<DataArrayDouble *> ms=self->getArrays();
5113 std::size_t sz=ms.size();
5114 PyObject *res = PyList_New(sz);
5115 for(std::size_t i=0;i<sz;i++)
5120 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5124 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5129 PyObject *getDifferentArrays() const
5131 std::vector< std::vector<int> > refs;
5132 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5133 std::size_t sz=ms.size();
5134 PyObject *res = PyList_New(sz);
5135 PyObject *res2 = PyList_New(sz);
5136 for(std::size_t i=0;i<sz;i++)
5141 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5145 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5147 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5150 PyObject *ret=PyTuple_New(2);
5151 PyTuple_SetItem(ret,0,res);
5152 PyTuple_SetItem(ret,1,res2);
5158 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5161 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5162 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5163 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5164 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5165 void setTimeUnit(const std::string& unit);
5166 std::string getTimeUnit() const;
5167 void setTime(double val, int iteration, int order);
5168 void setArray(DataArrayInt32 *array);
5169 MEDCouplingFieldInt *deepCopy() const;
5170 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5171 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5172 MEDCouplingFieldDouble *convertToDblField() const;
5173 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5175 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5177 return MEDCouplingFieldInt::New(type,td);
5180 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5182 return MEDCouplingFieldInt::New(ft,td);
5185 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5188 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5189 PyObject *ret=PyTuple_New(2);
5190 PyObject *ret0Py=ret0?Py_True:Py_False;
5192 PyTuple_SetItem(ret,0,ret0Py);
5193 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5197 std::string __str__() const
5199 return self->simpleRepr();
5202 std::string __repr__() const
5204 std::ostringstream oss;
5205 self->reprQuickOverview(oss);
5209 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5211 return fieldT_buildSubPart(self,li);
5214 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5216 return fieldT__getitem__(self,li);
5219 DataArrayInt32 *getArray()
5221 DataArrayInt32 *ret=self->getArray();
5230 double tmp0=self->getTime(tmp1,tmp2);
5231 PyObject *res = PyList_New(3);
5232 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5233 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5234 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5238 PyObject *getTinySerializationInformation() const
5240 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5243 PyObject *serialize() const
5245 return field_serialize<int>(self);
5248 PyObject *__getstate__() const
5250 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5253 void __setstate__(PyObject *inp)
5255 field__setstate__<int>(self,inp);
5260 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5263 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5264 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5265 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5266 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5267 void setTimeUnit(const std::string& unit);
5268 std::string getTimeUnit() const;
5269 void setTime(double val, int iteration, int order);
5270 void setArray(DataArrayFloat *array);
5271 MEDCouplingFieldFloat *deepCopy() const;
5272 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5273 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5274 MEDCouplingFieldDouble *convertToDblField() const;
5275 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5277 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5279 return MEDCouplingFieldFloat::New(type,td);
5282 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5284 return MEDCouplingFieldFloat::New(ft,td);
5287 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5290 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5291 PyObject *ret=PyTuple_New(2);
5292 PyObject *ret0Py=ret0?Py_True:Py_False;
5294 PyTuple_SetItem(ret,0,ret0Py);
5295 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5299 std::string __str__() const
5301 return self->simpleRepr();
5304 std::string __repr__() const
5306 std::ostringstream oss;
5307 self->reprQuickOverview(oss);
5311 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5313 return fieldT_buildSubPart(self,li);
5316 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5318 return fieldT__getitem__(self,li);
5321 DataArrayFloat *getArray()
5323 DataArrayFloat *ret=self->getArray();
5332 double tmp0=self->getTime(tmp1,tmp2);
5333 PyObject *res = PyList_New(3);
5334 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5335 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5336 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5340 PyObject *getTinySerializationInformation() const
5342 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5345 PyObject *serialize() const
5347 return field_serialize<float>(self);
5350 PyObject *__getstate__() const
5352 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5355 void __setstate__(PyObject *inp)
5357 field__setstate__<float>(self,inp);
5362 class MEDCouplingDefinitionTime
5365 MEDCouplingDefinitionTime();
5366 void assign(const MEDCouplingDefinitionTime& other);
5367 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5368 double getTimeResolution() const;
5369 std::vector<double> getHotSpotsTime() const;
5372 std::string __str__() const
5374 std::ostringstream oss;
5375 self->appendRepr(oss);
5379 PyObject *getIdsOnTimeRight(double tm) const
5381 int meshId,arrId,arrIdInField,fieldId;
5382 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5383 PyObject *res=PyList_New(4);
5384 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5385 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5386 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5387 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5391 PyObject *getIdsOnTimeLeft(double tm) const
5393 int meshId,arrId,arrIdInField,fieldId;
5394 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5395 PyObject *res=PyList_New(4);
5396 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5397 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5398 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5399 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5405 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5408 double getTimeTolerance() const;
5409 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5413 MEDCouplingFieldOverTime(PyObject *li)
5415 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5416 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5417 std::size_t sz=tmp.size();
5418 std::vector<MEDCouplingFieldDouble *> fs(sz);
5419 for(std::size_t i=0;i<sz;i++)
5420 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5421 return MEDCouplingFieldOverTime::New(fs);
5423 std::string __str__() const
5425 return self->simpleRepr();
5427 static MEDCouplingFieldOverTime *New(PyObject *li)
5429 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5430 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5431 std::size_t sz=tmp.size();
5432 std::vector<MEDCouplingFieldDouble *> fs(sz);
5433 for(std::size_t i=0;i<sz;i++)
5434 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5435 return MEDCouplingFieldOverTime::New(fs);
5440 class MEDCouplingCartesianAMRMesh;
5442 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5445 int getNumberOfCellsRecursiveWithOverlap() const;
5446 int getNumberOfCellsRecursiveWithoutOverlap() const;
5447 int getMaxNumberOfLevelsRelativeToThis() const;
5450 MEDCouplingCartesianAMRMeshGen *getMesh() const
5452 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5460 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5463 int getNumberOfOverlapedCellsForFather() const;
5464 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5465 std::vector<mcIdType> computeCellGridSt() const;
5468 PyObject *getBLTRRange() const
5470 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5471 return convertFromVectorPairInt(ret);
5474 PyObject *getBLTRRangeRelativeToGF() const
5476 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5477 return convertFromVectorPairInt(ret);
5480 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5482 std::vector< std::pair<mcIdType,mcIdType> > inp;
5483 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5484 self->addPatch(inp,factors);
5487 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5489 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5491 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5492 if(patchId==mesh->getNumberOfPatches())
5494 std::ostringstream oss;
5495 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5496 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5499 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5505 void __delitem__(mcIdType patchId)
5507 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5509 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5510 mesh->removePatch(patchId);
5513 mcIdType __len__() const
5515 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5517 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5518 return mesh->getNumberOfPatches();
5523 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5527 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5530 mcIdType getAbsoluteLevel() const;
5531 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5532 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5533 int getSpaceDimension() const;
5534 const std::vector<mcIdType>& getFactors() const;
5535 void setFactors(const std::vector<mcIdType>& newFactors);
5536 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5537 mcIdType getNumberOfCellsAtCurrentLevel() const;
5538 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5539 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5540 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5541 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5542 virtual void detachFromFather();
5544 mcIdType getNumberOfPatches() const;
5545 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5546 MEDCouplingUMesh *buildUnstructured() const;
5547 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5548 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5549 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5550 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5551 void removeAllPatches();
5552 void removePatch(mcIdType patchId);
5553 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5554 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5555 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5556 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5557 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5558 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5559 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5560 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5561 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5562 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5563 std::string buildPythonDumpOfThis() const;
5566 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5568 std::vector< std::pair<mcIdType,mcIdType> > inp;
5569 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5570 self->addPatch(inp,factors);
5573 PyObject *getPatches() const
5575 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5576 std::size_t sz(ps.size());
5577 PyObject *ret = PyList_New(sz);
5578 for(std::size_t i=0;i<sz;i++)
5580 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5583 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5588 // agy : don't know why typemap fails here ??? let it in the extend section
5589 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5591 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5594 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5596 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5597 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5603 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5605 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5606 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5612 virtual PyObject *positionRelativeToGodFather() const
5614 std::vector<mcIdType> out1;
5615 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5616 PyObject *ret(PyTuple_New(2));
5617 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5618 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5622 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5624 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5625 std::size_t sz(ps.size());
5626 PyObject *ret = PyList_New(sz);
5627 for(std::size_t i=0;i<sz;i++)
5628 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5632 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5634 std::vector<const DataArrayDouble *> inp;
5635 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5636 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5639 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5641 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5647 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5649 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5655 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5657 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5663 MEDCouplingIMesh *getImageMesh() const
5665 const MEDCouplingIMesh *ret(self->getImageMesh());
5668 return const_cast<MEDCouplingIMesh *>(ret);
5671 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5673 if(patchId==self->getNumberOfPatches())
5675 std::ostringstream oss;
5676 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5677 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5680 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5686 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5688 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5689 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5690 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5693 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5695 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5696 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5697 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5700 void __delitem__(mcIdType patchId)
5702 self->removePatch(patchId);
5705 mcIdType __len__() const
5707 return self->getNumberOfPatches();
5712 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5716 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5719 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5722 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5724 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5725 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5726 const mcIdType *nodeStrctPtr(0);
5727 const double *originPtr(0),*dxyzPtr(0);
5728 mcIdType sw,sz,val0;
5729 std::vector<mcIdType> bb0;
5730 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5733 std::vector<double> bb,bb2;
5735 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5736 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5738 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5741 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5743 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5744 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5745 std::vector< std::vector<mcIdType> > inp2;
5746 convertPyToVectorOfVectorOfInt(factors,inp2);
5747 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5750 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5752 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5755 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5757 return MEDCouplingCartesianAMRMesh::New(mesh);
5762 class MEDCouplingDataForGodFather : public RefCountObject
5765 virtual void synchronizeFineToCoarse();
5766 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5767 virtual void synchronizeCoarseToFine();
5768 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5769 virtual void synchronizeAllGhostZones();
5770 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5771 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5772 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5773 virtual void alloc();
5774 virtual void dealloc();
5777 MEDCouplingCartesianAMRMesh *getMyGodFather()
5779 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5787 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5790 mcIdType getNumberOfLevels() const;
5791 MEDCouplingAMRAttribute *deepCopy() const;
5792 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5793 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5794 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5795 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5796 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5797 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5798 std::string writeVTHB(const std::string& fileName) const;
5801 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5803 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5804 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5805 MEDCouplingAMRAttribute *ret(0);
5808 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5809 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5811 catch(INTERP_KERNEL::Exception&)
5813 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5814 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5819 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5821 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5824 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5826 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5827 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5833 void spillInfoOnComponents(PyObject *compNames)
5835 std::vector< std::vector<std::string> > compNamesCpp;
5836 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5837 self->spillInfoOnComponents(compNamesCpp);
5840 void spillNatures(PyObject *nfs)
5842 std::vector<mcIdType> inp0;
5843 if(!fillIntVector(nfs,inp0))
5844 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5845 std::size_t sz(inp0.size());
5846 std::vector<NatureOfField> inp00(sz);
5847 for(std::size_t i=0;i<sz;i++)
5848 inp00[i]=(NatureOfField)inp0[i];
5849 self->spillNatures(inp00);
5852 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5854 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5855 std::size_t sz(ret.size());
5856 PyObject *retPy(PyList_New(sz));
5857 for(std::size_t i=0;i<sz;i++)
5858 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5864 class DenseMatrix : public RefCountObject, public TimeLabel
5867 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5868 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5869 DenseMatrix *deepCopy() const;
5870 DenseMatrix *shallowCpy() const;
5872 mcIdType getNumberOfRows() const;
5873 mcIdType getNumberOfCols() const;
5874 mcIdType getNbOfElems() const;
5875 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5876 void reShape(mcIdType nbRows, mcIdType nbCols);
5879 bool isEqual(const DenseMatrix& other, double eps) const;
5880 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5881 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5884 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5886 return DenseMatrix::New(nbRows,nbCols);
5889 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5891 return DenseMatrix::New(array,nbRows,nbCols);
5894 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5897 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5898 PyObject *ret=PyTuple_New(2);
5899 PyObject *ret0Py=ret0?Py_True:Py_False;
5901 PyTuple_SetItem(ret,0,ret0Py);
5902 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5906 DataArrayDouble *getData()
5908 DataArrayDouble *ret(self->getData());
5914 DenseMatrix *__add__(const DenseMatrix *other)
5916 return MEDCoupling::DenseMatrix::Add(self,other);
5919 DenseMatrix *__sub__(const DenseMatrix *other)
5921 return MEDCoupling::DenseMatrix::Substract(self,other);
5924 DenseMatrix *__mul__(const DenseMatrix *other)
5926 return MEDCoupling::DenseMatrix::Multiply(self,other);
5929 DenseMatrix *__mul__(const DataArrayDouble *other)
5931 return MEDCoupling::DenseMatrix::Multiply(self,other);
5934 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5936 self->addEqual(other);
5937 Py_XINCREF(trueSelf);
5941 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5943 self->substractEqual(other);
5944 Py_XINCREF(trueSelf);
5948 PyObject *toNumPyMatrix() // not const. It is not a bug !
5950 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5959 def MEDCouplingUMeshReduce(self):
5960 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5961 def MEDCouplingCMeshReduce(self):
5962 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5963 def MEDCouplingIMeshReduce(self):
5964 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5965 def MEDCouplingMappedExtrudedMeshReduce(self):
5966 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5967 def MEDCouplingCurveLinearMeshReduce(self):
5968 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5969 def MEDCoupling1SGTUMeshReduce(self):
5970 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5971 def MEDCoupling1DGTUMeshReduce(self):
5972 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5973 def MEDCouplingFieldDoubleReduce(self):
5974 self.checkConsistencyLight()
5975 d=(self.getTypeOfField(),self.getTimeDiscretization())
5976 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5977 def MEDCouplingFieldIntReduce(self):
5978 self.checkConsistencyLight()
5979 d=(self.getTypeOfField(),self.getTimeDiscretization())
5980 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5981 def MEDCouplingFieldFloatReduce(self):
5982 self.checkConsistencyLight()
5983 d=(self.getTypeOfField(),self.getTimeDiscretization())
5984 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5985 def MEDCouplingFTReduceFunct(cls,params):
5987 ret=object.__new__(cls)
5991 def MEDCouplingFieldTemplateReduce(self):
5992 ret = MEDCouplingFieldDouble(self)
5993 nbTuples = self.getNumberOfTuplesExpected()
5994 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5996 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5998 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
6000 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
6001 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
6002 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
6003 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
6004 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
6005 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
6006 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
6012 __filename=os.environ.get('PYTHONSTARTUP')
6013 if __filename and os.path.isfile(__filename):
6014 with open(__filename) as __fp: