1 // Copyright (C) 2017-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifdef WITH_DOCSTRINGS
22 %include MEDCoupling_doc.i
29 #include "MEDCouplingMemArray.hxx"
30 #include "MEDCouplingMemArray.txx"
31 #include "MEDCouplingUMesh.hxx"
32 #include "MEDCouplingMappedExtrudedMesh.hxx"
33 #include "MEDCouplingCMesh.hxx"
34 #include "MEDCouplingIMesh.hxx"
35 #include "MEDCouplingMap.txx"
36 #include "MEDCouplingCurveLinearMesh.hxx"
37 #include "MEDCoupling1GTUMesh.hxx"
38 #include "MEDCouplingField.hxx"
39 #include "MEDCouplingFieldDouble.hxx"
40 #include "MEDCouplingFieldInt.hxx"
41 #include "MEDCouplingFieldFloat.hxx"
42 #include "MEDCouplingFieldTemplate.hxx"
43 #include "MEDCouplingGaussLocalization.hxx"
45 #include "MEDCouplingMultiFields.hxx"
46 #include "MEDCouplingFieldOverTime.hxx"
47 #include "MEDCouplingDefinitionTime.hxx"
48 #include "MEDCouplingFieldDiscretization.hxx"
49 #include "MEDCouplingCartesianAMRMesh.hxx"
50 #include "MEDCouplingAMRAttribute.hxx"
51 #include "MEDCouplingMatrix.hxx"
52 #include "MEDCouplingPartDefinition.hxx"
53 #include "MEDCouplingSkyLineArray.hxx"
54 #include "MEDCouplingTypemaps.i"
56 #include "InterpKernelAutoPtr.hxx"
57 #include "BoxSplittingOptions.hxx"
59 using namespace MEDCoupling;
60 using namespace INTERP_KERNEL;
64 %template(dvec) std::vector<double>;
65 %template(svec) std::vector<std::string>;
69 #ifndef MEDCOUPLING_USE_64BIT_IDS
70 //typedef std::int32_t mcIdType;
72 typedef DataArrayInt32 DataArrayIdType;
73 %template(ivec) std::vector<int>;
74 %template(i64vec) std::vector<long>;
76 //typedef std::int64_t mcIdType;
77 typedef long int mcIdType;
78 typedef DataArrayInt64 DataArrayIdType;
79 %template(ivec) std::vector<long>;
80 %template(i32vec) std::vector<int>;
85 %typemap(out) MEDCoupling::MEDCouplingMesh*
87 $result=convertMesh($1,$owner);
90 %typemap(out) MEDCouplingMesh*
92 $result=convertMesh($1,$owner);
97 %typemap(out) MEDCoupling::MEDCouplingPointSet*
99 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCouplingPointSet*
104 $result=convertMesh($1,$owner);
109 %typemap(out) MEDCouplingCartesianAMRPatchGen*
111 $result=convertCartesianAMRPatch($1,$owner);
116 %typemap(out) MEDCouplingCartesianAMRMeshGen*
118 $result=convertCartesianAMRMesh($1,$owner);
123 %typemap(out) MEDCouplingDataForGodFather*
125 $result=convertDataForGodFather($1,$owner);
130 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
132 $result=convertMesh($1,$owner);
135 %typemap(out) MEDCoupling1GTUMesh*
137 $result=convertMesh($1,$owner);
142 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
144 $result=convertMesh($1,$owner);
147 %typemap(out) MEDCouplingStructuredMesh*
149 $result=convertMesh($1,$owner);
154 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
156 $result=convertFieldDiscretization($1,$owner);
159 %typemap(out) MEDCouplingFieldDiscretization*
161 $result=convertFieldDiscretization($1,$owner);
166 %typemap(out) MEDCoupling::MEDCouplingField*
168 $result=convertField($1,$owner);
171 %typemap(out) MEDCouplingField*
173 $result=convertField($1,$owner);
178 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
180 $result=convertMultiFields($1,$owner);
183 %typemap(out) MEDCouplingMultiFields*
185 $result=convertMultiFields($1,$owner);
190 %typemap(out) MEDCoupling::PartDefinition*
192 $result=convertPartDefinition($1,$owner);
195 %typemap(out) PartDefinition*
197 $result=convertPartDefinition($1,$owner);
202 %init %{ import_array(); %}
205 %init %{ initializeMe(); %}
207 %feature("autodoc", "1");
208 %feature("docstring");
210 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
211 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
212 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
213 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
214 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
215 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
216 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
217 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
218 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
251 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
252 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
253 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
254 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
255 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
256 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
257 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
258 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
259 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
260 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
261 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
262 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
263 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
264 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
265 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
266 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
267 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
268 %newobject MEDCoupling::MEDCouplingFieldInt::New;
269 %newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField;
270 %newobject MEDCoupling::MEDCouplingFieldInt::getArray;
271 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
272 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
273 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
274 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
275 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
276 %newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
277 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
278 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
279 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
280 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
281 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
282 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
283 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
284 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
285 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
286 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
287 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
288 %newobject MEDCoupling::MEDCouplingMesh::clone;
289 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
290 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
291 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
292 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
293 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
294 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
295 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
296 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
297 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
298 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
299 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
300 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
301 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
302 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
303 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
304 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
305 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
306 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
307 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
308 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
309 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
310 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
311 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
312 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
313 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
314 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
315 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
316 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
317 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
318 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
319 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
320 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
321 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
322 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
323 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
324 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
325 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
326 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
327 %newobject MEDCoupling::MEDCouplingUMesh::New;
328 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
329 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
330 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
331 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
332 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
333 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
334 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
335 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
336 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
337 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
338 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
339 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
340 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
341 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
342 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
343 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
344 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
345 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
346 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
347 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
348 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
349 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
350 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
351 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
352 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
353 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
354 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
355 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
356 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
357 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
358 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
359 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
360 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
361 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
362 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
363 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
364 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
365 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
366 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
367 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
368 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
369 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
370 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
371 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
372 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
373 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
374 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
375 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
376 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
377 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
378 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
379 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
380 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
381 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
382 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
383 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
384 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
385 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
386 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
387 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
388 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
389 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
390 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
391 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
392 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
393 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
394 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
395 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
396 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
397 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
398 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
399 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
400 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
401 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
402 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
403 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
404 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
405 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
406 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
407 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
408 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
409 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
410 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
411 %newobject MEDCoupling::MEDCouplingCMesh::New;
412 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
413 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
414 %newobject MEDCoupling::MEDCouplingIMesh::New;
415 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
416 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
417 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
418 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
419 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
420 %newobject MEDCoupling::MEDCouplingMultiFields::New;
421 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
422 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
423 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
424 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
425 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
426 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
427 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
428 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
429 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
430 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
431 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
432 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
433 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
434 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
435 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
436 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
437 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
438 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
439 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
440 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
441 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
442 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
443 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
444 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
445 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
446 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
447 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
448 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
449 %newobject MEDCoupling::DenseMatrix::New;
450 %newobject MEDCoupling::DenseMatrix::deepCopy;
451 %newobject MEDCoupling::DenseMatrix::shallowCpy;
452 %newobject MEDCoupling::DenseMatrix::getData;
453 %newobject MEDCoupling::DenseMatrix::matVecMult;
454 %newobject MEDCoupling::DenseMatrix::MatVecMult;
455 %newobject MEDCoupling::DenseMatrix::__add__;
456 %newobject MEDCoupling::DenseMatrix::__sub__;
457 %newobject MEDCoupling::DenseMatrix::__mul__;
458 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
459 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
460 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
461 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
462 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
463 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
465 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
466 %feature("unref") MEDCouplingMesh "$this->decrRef();"
467 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
468 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
469 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
470 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
471 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
472 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
473 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
474 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
475 %feature("unref") MEDCouplingField "$this->decrRef();"
476 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
477 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
478 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
479 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
480 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
481 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
482 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
483 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
484 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
485 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
486 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
487 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
488 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
489 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
490 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
491 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
492 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
493 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
494 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
495 %feature("unref") DenseMatrix "$this->decrRef();"
496 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
498 %rename(assign) *::operator=;
499 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
500 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
501 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
502 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
506 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
507 // on the Python side. Must be put BEFORE the %rename clause:
508 %exceptionclass INTERP_KERNEL::Exception;
509 %rename (InterpKernelException) INTERP_KERNEL::Exception;
511 %include "MEDCouplingRefCountObject.i"
512 %include "MEDCouplingMemArray.i"
516 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
517 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
518 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
519 SWIGTITraits<Int32>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32;
520 SWIGTITraits<Int64>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64;
521 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
522 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
523 SWIGTITraits<Int32>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple;
524 SWIGTITraits<Int64>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple;
530 PyObject *med2vtk_cell_types()
532 Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
533 PyObject *ret(PyList_New(sz));
534 for(Py_ssize_t i=0;i<sz;i++)
536 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[i]));
541 PyObject *vtk2med_cell_types()
543 Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
544 auto maxElt(*std::max_element(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER,MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz));
545 auto szOut(maxElt+1);
546 std::vector< mcIdType > retCpp(szOut,-1);
548 for(const mcIdType *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
554 PyObject *ret(PyList_New(szOut));
556 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
557 PyList_SetItem(ret,id,PyInt_FromLong(*it));
562 namespace INTERP_KERNEL
565 * \class BoxSplittingOptions
566 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
568 class BoxSplittingOptions
571 BoxSplittingOptions();
573 double getEfficiencyGoal() const;
574 void setEfficiencyGoal(double efficiency);
575 double getEfficiencyThreshold() const;
576 void setEfficiencyThreshold(double efficiencyThreshold);
577 int getMinimumPatchLength() const;
578 void setMinimumPatchLength(int minPatchLength);
579 int getMaximumPatchLength() const;
580 void setMaximumPatchLength(int maxPatchLength);
581 int getMaximumNbOfCellsInPatch() const;
582 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
583 void copyOptions(const BoxSplittingOptions & other);
584 std::string printOptions() const;
587 std::string __str__() const
589 return self->printOptions();
595 namespace MEDCoupling
611 CONST_ON_TIME_INTERVAL = 7
612 } TypeOfTimeDiscretization;
620 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
621 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
623 } MEDCouplingMeshType;
625 class DataArrayInt32;
626 class DataArrayInt64;
627 class DataArrayDouble;
628 class MEDCouplingUMesh;
629 class MEDCouplingCMesh;
630 class MEDCouplingFieldDouble;
632 %extend RefCountObject
634 std::string getHiddenCppPointer() const
636 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
641 %extend MEDCouplingGaussLocalization
643 std::string __str__() const
645 return self->getStringRepr();
648 std::string __repr__() const
650 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
651 oss << self->getStringRepr();
658 class MEDCouplingMesh : public RefCountObject, public TimeLabel
661 void setName(const std::string& name);
662 std::string getName() const;
663 void setDescription(const std::string& descr);
664 std::string getDescription() const;
665 void setTime(double val, int iteration, int order);
666 void setTimeUnit(const std::string& unit);
667 std::string getTimeUnit() const;
668 virtual MEDCouplingMeshType getType() const;
669 bool isStructured() const;
670 virtual MEDCouplingMesh *deepCopy() const;
671 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
672 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
673 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
674 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
675 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
676 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
677 virtual void checkConsistencyLight() const;
678 virtual void checkConsistency(double eps=1e-12) const;
679 virtual int getNumberOfCells() const;
680 virtual int getNumberOfNodes() const;
681 virtual int getSpaceDimension() const;
682 virtual int getMeshDimension() const;
683 virtual DataArrayDouble *getCoordinatesAndOwner() const;
684 virtual DataArrayDouble *computeCellCenterOfMass() const;
685 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
686 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
687 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
688 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
689 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
690 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
691 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
692 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
693 virtual std::string simpleRepr() const;
694 virtual std::string advancedRepr() const;
695 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
696 virtual std::string getVTKFileExtension() const;
697 std::string getVTKFileNameOf(const std::string& fileName) const;
699 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
700 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
701 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
702 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
703 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
704 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
705 virtual MEDCouplingUMesh *buildUnstructured() const;
706 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
707 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
708 virtual DataArrayIdType *simplexize(int policy);
709 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
710 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
711 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
712 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
713 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
714 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
715 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
716 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
719 std::string __str__() const
721 return self->simpleRepr();
727 double tmp0=self->getTime(tmp1,tmp2);
728 PyObject *res = PyList_New(3);
729 PyList_SetItem(res,0,SWIG_From_double(tmp0));
730 PyList_SetItem(res,1,SWIG_From_int(tmp1));
731 PyList_SetItem(res,2,SWIG_From_int(tmp2));
735 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
737 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
738 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
744 mcIdType getCellContainingPoint(PyObject *p, double eps) const
748 DataArrayDoubleTuple *aa;
749 std::vector<double> bb;
751 int spaceDim=self->getSpaceDimension();
752 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
753 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
754 return self->getCellContainingPoint(pos,eps);
757 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
761 DataArrayDoubleTuple *aa;
762 std::vector<double> bb;
764 int spaceDim=self->getSpaceDimension();
765 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
766 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
767 MCAuto<DataArrayIdType> elts,eltsIndex;
768 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
769 PyObject *ret=PyTuple_New(2);
770 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
771 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
775 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
779 DataArrayDoubleTuple *aa;
780 std::vector<double> bb;
782 int spaceDim=self->getSpaceDimension();
783 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
784 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
785 MCAuto<DataArrayIdType> elts,eltsIndex;
786 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
787 PyObject *ret=PyTuple_New(2);
788 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
789 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
793 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
795 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
796 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
799 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
801 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
802 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
805 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
809 DataArrayDoubleTuple *aa;
810 std::vector<double> bb;
812 int spaceDim=self->getSpaceDimension();
813 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
814 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
815 std::vector<mcIdType> elts;
816 self->getCellsContainingPoint(pos,eps,elts);
817 DataArrayIdType *ret=DataArrayIdType::New();
818 ret->alloc((int)elts.size(),1);
819 std::copy(elts.begin(),elts.end(),ret->getPointer());
820 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
823 virtual PyObject *getReverseNodalConnectivity() const
825 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
826 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
827 self->getReverseNodalConnectivity(d0,d1);
828 PyObject *ret=PyTuple_New(2);
829 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
830 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
834 void renumberCells(PyObject *li, bool check=true)
837 mcIdType v0; std::vector<mcIdType> v1;
838 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
839 self->renumberCells(ids,check);
842 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
844 DataArrayIdType *cellCor, *nodeCor;
845 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
846 PyObject *res = PyList_New(2);
847 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
848 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
852 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
854 DataArrayIdType *cellCor=0,*nodeCor=0;
855 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
856 PyObject *res = PyList_New(2);
857 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
858 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
862 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
864 DataArrayIdType *cellCor=0;
865 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
869 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
872 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
873 if (!SWIG_IsOK(res1))
876 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
877 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
881 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
883 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
884 da2->checkAllocated();
885 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
888 PyObject *getNodeIdsOfCell(int cellId) const
890 std::vector<mcIdType> conn;
891 self->getNodeIdsOfCell(cellId,conn);
892 return convertIntArrToPyList2(conn);
895 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
897 std::vector<double> coo;
898 self->getCoordinatesOfNode(nodeId,coo);
899 return convertDblArrToPyList2(coo);
902 void scale(PyObject *point, double factor)
906 DataArrayDoubleTuple *aa;
907 std::vector<double> bb;
909 int spaceDim=self->getSpaceDimension();
910 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
911 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
912 self->scale(pointPtr,factor);
915 PyObject *getBoundingBox() const
917 int spaceDim=self->getSpaceDimension();
918 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
919 self->getBoundingBox(tmp);
920 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
924 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
927 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
928 PyObject *ret=PyTuple_New(2);
929 PyObject *ret0Py=ret0?Py_True:Py_False;
931 PyTuple_SetItem(ret,0,ret0Py);
932 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
936 PyObject *buildPart(PyObject *li) const
938 mcIdType szArr,sw,iTypppArr;
939 std::vector<mcIdType> stdvecTyyppArr;
940 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
941 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
942 if(sw==3)//DataArrayIdType
944 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
945 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
946 std::string name=argpt->getName();
948 ret->setName(name.c_str());
950 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
953 PyObject *buildPartAndReduceNodes(PyObject *li) const
955 mcIdType szArr,sw,iTypppArr;
956 std::vector<mcIdType> stdvecTyyppArr;
957 DataArrayIdType *arr=0;
958 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
959 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
960 if(sw==3)//DataArrayIdType
962 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
963 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
964 std::string name=argpt->getName();
966 ret->setName(name.c_str());
969 PyObject *res = PyList_New(2);
970 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
971 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
972 PyList_SetItem(res,0,obj0);
973 PyList_SetItem(res,1,obj1);
977 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
980 DataArrayIdType *arr=0;
981 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
982 PyObject *res = PyTuple_New(2);
983 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
986 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
988 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
989 PyTuple_SetItem(res,0,obj0);
990 PyTuple_SetItem(res,1,obj1);
994 PyObject *getDistributionOfTypes() const
996 std::vector<mcIdType> vals=self->getDistributionOfTypes();
998 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
999 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1000 for(std::size_t j=0;j<vals.size()/3;j++)
1002 PyObject *ret1=PyList_New(3);
1003 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1004 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1005 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1006 PyList_SetItem(ret,j,ret1);
1011 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1013 std::vector<mcIdType> code;
1014 std::vector<const DataArrayIdType *> idsPerType;
1015 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1016 convertPyToNewIntArr4(li,1,3,code);
1017 return self->checkTypeConsistencyAndContig(code,idsPerType);
1020 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1022 std::vector<mcIdType> code;
1023 std::vector<DataArrayIdType *> idsInPflPerType;
1024 std::vector<DataArrayIdType *> idsPerType;
1025 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1026 PyObject *ret=PyTuple_New(3);
1028 if(code.size()%3!=0)
1029 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1030 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1031 for(std::size_t j=0;j<code.size()/3;j++)
1033 PyObject *ret00=PyList_New(3);
1034 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1035 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1036 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1037 PyList_SetItem(ret0,j,ret00);
1039 PyTuple_SetItem(ret,0,ret0);
1041 PyObject *ret1=PyList_New(idsInPflPerType.size());
1042 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1043 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1044 PyTuple_SetItem(ret,1,ret1);
1045 std::size_t n=idsPerType.size();
1046 PyObject *ret2=PyList_New(n);
1047 for(std::size_t i=0;i<n;i++)
1048 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1049 PyTuple_SetItem(ret,2,ret2);
1053 void translate(PyObject *vector)
1057 DataArrayDoubleTuple *aa;
1058 std::vector<double> bb;
1060 int spaceDim=self->getSpaceDimension();
1061 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1062 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1063 self->translate(vectorPtr);
1066 void rotate(PyObject *center, double alpha)
1068 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1071 DataArrayDoubleTuple *aa;
1072 std::vector<double> bb;
1074 int spaceDim=self->getSpaceDimension();
1075 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1076 self->rotate(centerPtr,0,alpha);
1079 void rotate(PyObject *center, PyObject *vector, double alpha)
1081 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1083 DataArrayDouble *a,*a2;
1084 DataArrayDoubleTuple *aa,*aa2;
1085 std::vector<double> bb,bb2;
1087 int spaceDim=self->getSpaceDimension();
1088 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1089 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
1090 self->rotate(centerPtr,vectorPtr,alpha);
1093 PyObject *getAllGeoTypes() const
1095 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1096 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1097 PyObject *res=PyList_New(result.size());
1098 for(int i=0;iL!=result.end(); i++, iL++)
1099 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1103 virtual PyObject *getTinySerializationInformation() const
1105 std::vector<double> a0;
1106 std::vector<mcIdType> a1;
1107 std::vector<std::string> a2;
1108 self->getTinySerializationInformation(a0,a1,a2);
1109 PyObject *ret(PyTuple_New(3));
1110 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1111 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1112 std::size_t sz(a2.size());
1113 PyObject *ret2(PyList_New(sz));
1115 for(std::size_t i=0;i<sz;i++)
1116 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1118 PyTuple_SetItem(ret,2,ret2);
1122 virtual PyObject *serialize() const
1124 DataArrayIdType *a0Tmp(0);
1125 DataArrayDouble *a1Tmp(0);
1126 self->serialize(a0Tmp,a1Tmp);
1127 PyObject *ret(PyTuple_New(2));
1128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1129 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1133 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1135 std::vector<std::string> littleStrings;
1136 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1139 PyObject *__getstate__() const
1141 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1142 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1143 PyObject *ret(PyTuple_New(2));
1144 PyTuple_SetItem(ret,0,ret0);
1145 PyTuple_SetItem(ret,1,ret1);
1149 void __setstate__(PyObject *inp)
1151 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1152 if(!PyTuple_Check(inp))
1153 throw INTERP_KERNEL::Exception(MSG);
1154 std::size_t sz(PyTuple_Size(inp));
1156 throw INTERP_KERNEL::Exception(MSG);
1157 PyObject *elt0(PyTuple_GetItem(inp,0));
1158 PyObject *elt1(PyTuple_GetItem(inp,1));
1159 std::vector<double> a0;
1160 std::vector<mcIdType> a1;
1161 std::vector<std::string> a2;
1162 DataArrayIdType *b0(0);
1163 DataArrayDouble *b1(0);
1165 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1166 throw INTERP_KERNEL::Exception(MSG);
1167 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1169 fillArrayWithPyListDbl3(a0py,tmp,a0);
1170 convertPyToNewIntArr3(a1py,a1);
1171 fillStringVector(a2py,a2);
1174 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1175 throw INTERP_KERNEL::Exception(MSG);
1176 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1178 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1179 if(!SWIG_IsOK(status))
1180 throw INTERP_KERNEL::Exception(MSG);
1181 b0=reinterpret_cast<DataArrayIdType *>(argp);
1182 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1183 if(!SWIG_IsOK(status))
1184 throw INTERP_KERNEL::Exception(MSG);
1185 b1=reinterpret_cast<DataArrayDouble *>(argp);
1187 // useless here to call resizeForUnserialization because arrays are well resized.
1188 self->unserialization(a0,a1,b0,b1,a2);
1191 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1193 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1194 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1195 return MEDCouplingMesh::MergeMeshes(tmp);
1201 //== MEDCouplingMesh End
1203 %include "NormalizedGeometricTypes"
1204 %include "MEDCouplingNatureOfFieldEnum"
1206 namespace MEDCoupling
1208 class MEDCouplingNatureOfField
1211 static const char *GetRepr(NatureOfField nat);
1212 static std::string GetReprNoThrow(NatureOfField nat);
1213 static std::string GetAllPossibilitiesStr();
1217 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1218 // include "MEDCouplingTimeDiscretization.i"
1220 namespace MEDCoupling
1222 class MEDCouplingGaussLocalization
1225 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1226 const std::vector<double>& gsCoo, const std::vector<double>& w);
1227 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1228 INTERP_KERNEL::NormalizedCellType getType() const;
1229 void setType(INTERP_KERNEL::NormalizedCellType typ);
1230 int getNumberOfGaussPt() const;
1231 int getDimension() const;
1232 int getNumberOfPtsInRefCell() const;
1233 std::string getStringRepr() const;
1234 void checkConsistencyLight() const;
1235 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1237 const std::vector<double>& getRefCoords() const;
1238 double getRefCoord(int ptIdInCell, int comp) const;
1239 const std::vector<double>& getGaussCoords() const;
1240 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1241 const std::vector<double>& getWeights() const;
1242 double getWeight(int gaussPtIdInCell, double newVal) const;
1243 void setRefCoord(int ptIdInCell, int comp, double newVal);
1244 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1245 void setWeight(int gaussPtIdInCell, double newVal);
1246 void setRefCoords(const std::vector<double>& refCoo);
1247 void setGaussCoords(const std::vector<double>& gsCoo);
1248 void setWeights(const std::vector<double>& w);
1250 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1254 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1256 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1260 MEDCouplingUMesh *buildRefCell() const
1262 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1268 class MEDCouplingSkyLineArray
1271 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1273 void set( DataArrayIdType* index, DataArrayIdType* value );
1274 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1276 int getSuperNumberOf() const;
1277 int getNumberOf() const;
1278 int getLength() const;
1280 void deletePack(const int i, const int j);
1282 void deleteSimplePack(const int i);
1283 void deleteSimplePacks(const DataArrayIdType* idx);
1287 MEDCouplingSkyLineArray()
1289 return MEDCouplingSkyLineArray::New();
1292 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1294 return MEDCouplingSkyLineArray::New(index, value);
1297 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1299 return MEDCouplingSkyLineArray::New(index, value);
1302 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1304 return MEDCouplingSkyLineArray::New(other);
1307 std::string __str__() const
1309 return self->simpleRepr();
1312 DataArrayIdType *getSuperIndexArray() const
1314 DataArrayIdType *ret(self->getSuperIndexArray());
1320 DataArrayIdType *getIndexArray() const
1322 DataArrayIdType *ret(self->getIndexArray());
1328 DataArrayIdType *getValuesArray() const
1330 DataArrayIdType *ret(self->getValuesArray());
1336 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1338 std::vector<mcIdType> ret;
1339 self->getSimplePackSafe(absolutePackId,ret);
1340 return convertIntArrToPyList2(ret);
1343 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1345 std::vector<mcIdType> vpack, vspIdx, out;
1347 convertPyToNewIntArr3(superPackIndices,vspIdx);
1348 convertPyToNewIntArr3(pack,vpack);
1350 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1351 return convertIntArrToPyList2(out);
1354 void pushBackPack(const mcIdType i, PyObject *pack)
1356 std::vector<mcIdType> vpack;
1357 convertPyToNewIntArr3(pack,vpack);
1358 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1361 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1363 std::vector<mcIdType> vpack;
1364 convertPyToNewIntArr3(pack,vpack);
1365 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1368 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1370 std::vector<const DataArrayIdType*> packs;
1371 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1372 self->replaceSimplePacks(idx, packs);
1375 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1377 std::vector<mcIdType> vpack;
1378 convertPyToNewIntArr3(pack,vpack);
1379 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1382 PyObject *convertToPolyhedronConn() const
1384 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1385 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1386 self->convertToPolyhedronConn(d0,d1);
1387 PyObject *ret=PyTuple_New(2);
1388 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1389 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1396 %include "MEDCouplingFieldDiscretization.i"
1398 //== MEDCouplingPointSet
1400 namespace MEDCoupling
1402 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1405 void setCoords(const DataArrayDouble *coords);
1406 DataArrayDouble *getCoordinatesAndOwner() const;
1407 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1409 double getCaracteristicDimension() const;
1410 void recenterForMaxPrecision(double eps);
1411 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1412 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1413 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1414 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1415 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1416 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1417 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1418 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1419 virtual DataArrayIdType *computeFetchedNodeIds() const;
1420 virtual int getNumberOfNodesInCell(int cellId) const;
1421 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1422 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1423 virtual DataArrayIdType *zipCoordsTraducer();
1424 virtual DataArrayIdType *findBoundaryNodes() const;
1425 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1426 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1427 virtual void checkFullyDefined() const;
1428 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1429 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1430 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1431 virtual void renumberNodesWithOffsetInConn(int offset);
1432 virtual bool areAllNodesFetched() const;
1433 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1434 virtual void invertOrientationOfAllCells();
1437 std::string __str__() const
1439 return self->simpleRepr();
1442 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1444 mcIdType newNbOfNodes;
1445 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1446 PyObject *res = PyList_New(2);
1447 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1448 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1452 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1454 DataArrayIdType *comm, *commIndex;
1455 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1456 PyObject *res = PyList_New(2);
1457 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1458 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1462 PyObject *getCoords()
1464 DataArrayDouble *ret1=self->getCoords();
1467 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1470 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1472 mcIdType szArr,sw,iTypppArr;
1473 std::vector<mcIdType> stdvecTyyppArr;
1474 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1475 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1476 if(sw==3)//DataArrayIdType
1478 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1479 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1480 std::string name=argpt->getName();
1482 ret->setName(name.c_str());
1484 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1487 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1489 mcIdType szArr,sw,iTypppArr;
1490 std::vector<mcIdType> stdvecTyyppArr;
1491 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1492 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1493 if(sw==3)//DataArrayIdType
1495 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1496 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1497 std::string name=argpt->getName();
1499 ret->setName(name.c_str());
1501 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1504 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1506 mcIdType szArr,sw,iTypppArr;
1507 std::vector<mcIdType> stdvecTyyppArr;
1508 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1509 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1510 if(sw==3)//DataArrayIdType
1512 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1513 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1514 std::string name=argpt->getName();
1516 ret->setName(name.c_str());
1518 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1521 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1523 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1524 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1527 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1529 mcIdType szArr,sw,iTypppArr;
1530 std::vector<mcIdType> stdvecTyyppArr;
1531 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1532 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1533 if(sw==3)//DataArrayIdType
1535 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1536 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1537 std::string name=argpt->getName();
1539 ret->setName(name.c_str());
1541 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1544 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1546 mcIdType szArr,sw,iTypppArr;
1547 std::vector<mcIdType> stdvecTyyppArr;
1548 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1549 self->renumberNodes(tmp,newNbOfNodes);
1552 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1554 mcIdType szArr,sw,iTypppArr;
1555 std::vector<mcIdType> stdvecTyyppArr;
1556 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1557 self->renumberNodesCenter(tmp,newNbOfNodes);
1560 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1562 int spaceDim=self->getSpaceDimension();
1564 DataArrayDouble *a,*a2;
1565 DataArrayDoubleTuple *aa,*aa2;
1566 std::vector<double> bb,bb2;
1568 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1569 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1570 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1571 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1572 std::vector<mcIdType> nodes;
1573 self->findNodesOnLine(p,v,eps,nodes);
1574 DataArrayIdType *ret=DataArrayIdType::New();
1575 ret->alloc(nodes.size(),1);
1576 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1577 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1579 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1581 int spaceDim=self->getSpaceDimension();
1583 DataArrayDouble *a,*a2;
1584 DataArrayDoubleTuple *aa,*aa2;
1585 std::vector<double> bb,bb2;
1587 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1588 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1589 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1590 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1591 std::vector<mcIdType> nodes;
1592 self->findNodesOnPlane(p,v,eps,nodes);
1593 DataArrayIdType *ret=DataArrayIdType::New();
1594 ret->alloc(nodes.size(),1);
1595 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1599 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1603 DataArrayDoubleTuple *aa;
1604 std::vector<double> bb;
1606 int spaceDim=self->getSpaceDimension();
1607 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1608 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1609 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1610 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1613 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1615 DataArrayIdType *c=0,*cI=0;
1619 DataArrayDoubleTuple *aa;
1620 std::vector<double> bb;
1622 int spaceDim=self->getSpaceDimension();
1623 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1624 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1625 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1626 PyObject *ret=PyTuple_New(2);
1627 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1628 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1632 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1634 DataArrayIdType *c=0,*cI=0;
1635 int spaceDim=self->getSpaceDimension();
1638 DataArrayDoubleTuple *aa;
1639 std::vector<double> bb;
1641 mcIdType nbOfTuples=-1;
1642 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1643 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1645 PyObject *ret=PyTuple_New(2);
1646 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1647 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1651 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1655 DataArrayDoubleTuple *aa;
1656 std::vector<double> bb;
1658 int spaceDim=self->getSpaceDimension();
1659 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1660 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1662 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1663 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1666 void duplicateNodesInCoords(PyObject *li)
1670 std::vector<mcIdType> multiVal;
1671 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1672 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1673 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1677 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1679 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1681 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1683 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1687 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1689 DataArrayIdType *v0(nullptr),*v1(nullptr);
1690 self->findCommonCells(compType,startCellId,v0,v1);
1691 PyObject *res = PyList_New(2);
1692 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1693 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1698 virtual void renumberNodesInConn(PyObject *li)
1702 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1705 MapII *da2(reinterpret_cast<MapII *>(da));
1706 self->renumberNodesInConn(da2->data());
1710 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1711 if (!SWIG_IsOK(res1))
1714 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1715 self->renumberNodesInConn(tmp);
1719 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1721 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1722 da2->checkAllocated();
1723 self->renumberNodesInConn(da2->getConstPointer());
1727 virtual PyObject *getNodeIdsInUse() const
1730 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1731 PyObject *ret=PyTuple_New(2);
1732 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1733 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1737 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1739 DataArrayIdType *ret(nullptr);
1741 mcIdType szArr,sw,iTypppArr;
1742 std::vector<mcIdType> stdvecTyyppArr;
1743 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1744 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1748 virtual PyObject *mergeNodes(double precision)
1752 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1753 PyObject *res = PyList_New(3);
1754 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1755 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1756 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1760 virtual PyObject *mergeNodesCenter(double precision)
1764 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1765 PyObject *res = PyList_New(3);
1766 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1767 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1768 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1772 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1775 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1776 if (!SWIG_IsOK(res1))
1779 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1780 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1784 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1786 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1787 da2->checkAllocated();
1788 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1792 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1796 std::vector<mcIdType> multiVal;
1797 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1798 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1799 mcIdType nbc=self->getNumberOfCells();
1800 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1807 std::ostringstream oss;
1808 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1809 throw INTERP_KERNEL::Exception(oss.str().c_str());
1812 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1817 mcIdType tmp=nbc+singleVal;
1818 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1822 std::ostringstream oss;
1823 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1824 throw INTERP_KERNEL::Exception(oss.str().c_str());
1830 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1834 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1839 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1840 daIntTyypp->checkAllocated();
1841 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1844 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1848 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1851 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1852 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1853 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1854 for(mcIdType i=0;i<sz;i++)
1855 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1858 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1861 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1862 mcIdType sw,nbNodes=0;
1863 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1864 std::vector<double> val3;
1865 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1866 "Rotate2DAlg",2,true,nbNodes);
1868 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1869 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1872 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1875 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1876 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1877 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1878 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1879 for(mcIdType i=0;i<sz;i++)
1880 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1883 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1886 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1887 mcIdType sw,nbNodes=0;
1888 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1889 std::vector<double> val3;
1890 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1891 "Rotate3DAlg",3,true,nbNodes);
1893 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1894 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1895 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1900 //== MEDCouplingPointSet End
1902 class MEDCouplingUMeshCell
1905 INTERP_KERNEL::NormalizedCellType getType() const;
1908 std::string __str__() const
1910 return self->repr();
1913 PyObject *getAllConn() const
1916 const mcIdType *r=self->getAllConn(ret2);
1917 PyObject *ret=PyTuple_New(ret2);
1918 for(mcIdType i=0;i<ret2;i++)
1919 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1925 class MEDCouplingUMeshCellIterator
1932 MEDCouplingUMeshCell *ret=self->nextt();
1934 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1937 PyErr_SetString(PyExc_StopIteration,"No more data.");
1944 class MEDCouplingUMeshCellByTypeIterator
1947 ~MEDCouplingUMeshCellByTypeIterator();
1952 MEDCouplingUMeshCellEntry *ret=self->nextt();
1954 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1957 PyErr_SetString(PyExc_StopIteration,"No more data.");
1964 class MEDCouplingUMeshCellByTypeEntry
1967 ~MEDCouplingUMeshCellByTypeEntry();
1970 MEDCouplingUMeshCellByTypeIterator *__iter__()
1972 return self->iterator();
1977 class MEDCouplingUMeshCellEntry
1980 INTERP_KERNEL::NormalizedCellType getType() const;
1981 int getNumberOfElems() const;
1984 MEDCouplingUMeshCellIterator *__iter__()
1986 return self->iterator();
1991 //== MEDCouplingUMesh
1993 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
1996 static MEDCouplingUMesh *New();
1997 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
1998 void checkConsistencyLight() const;
1999 void setMeshDimension(int meshDim);
2000 void allocateCells(int nbOfCells=0);
2001 void finishInsertingCells();
2002 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2003 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2004 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2005 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2006 int getNodalConnectivityArrayLen() const;
2007 void computeTypes();
2008 std::string reprConnectivityOfThis() const;
2009 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2011 DataArrayIdType *conformize2D(double eps);
2012 DataArrayIdType *conformize3D(double eps);
2013 DataArrayIdType *colinearize2D(double eps);
2014 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2015 void shiftNodeNumbersInConn(int delta);
2016 std::vector<bool> getQuadraticStatus() const;
2017 DataArrayIdType *findCellIdsOnBoundary() const;
2018 MEDCouplingUMesh *computeSkin() const;
2019 bool checkConsecutiveCellTypes() const;
2020 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2021 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2022 DataArrayIdType *sortCellsInMEDFileFrmt();
2023 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2024 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2025 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2026 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2027 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2028 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2029 void orientCorrectlyPolyhedrons();
2030 bool isPresenceOfQuadratic() const;
2031 bool isFullyQuadratic() const;
2032 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2033 bool isContiguous1D() const;
2034 void tessellate2D(double eps);
2035 void convertQuadraticCellsToLinear();
2036 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2037 void convertDegeneratedCells();
2038 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2039 bool removeDegenerated1DCells();
2040 bool areOnlySimplexCells() const;
2041 MEDCouplingFieldDouble *getEdgeRatioField() const;
2042 MEDCouplingFieldDouble *getAspectRatioField() const;
2043 MEDCouplingFieldDouble *getWarpField() const;
2044 MEDCouplingFieldDouble *getSkewField() const;
2045 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2046 DataArrayIdType *convexEnvelop2D();
2047 std::string cppRepr() const;
2048 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2049 DataArrayIdType *findAndCorrectBadOriented3DCells();
2050 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2051 MEDCouplingSkyLineArray *generateGraph() const;
2052 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2053 DataArrayIdType *buildUnionOf2DMesh() const;
2054 DataArrayIdType *buildUnionOf3DMesh() const;
2055 DataArrayIdType *orderConsecutiveCells1D() const;
2056 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2057 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2058 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2059 void changeOrientationOfCells();
2060 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2061 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2062 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2063 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2064 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2065 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2066 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2070 return MEDCouplingUMesh::New();
2073 MEDCouplingUMesh(const char *meshName, int meshDim)
2075 return MEDCouplingUMesh::New(meshName,meshDim);
2078 std::string __str__() const
2080 return self->simpleRepr();
2083 std::string __repr__() const
2085 std::ostringstream oss;
2086 self->reprQuickOverview(oss);
2090 MEDCouplingUMeshCellIterator *__iter__()
2092 return self->cellIterator();
2095 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2097 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2101 PyObject *getAllGeoTypesSorted() const
2103 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2104 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2105 PyObject *res=PyList_New(result.size());
2106 for(int i=0;iL!=result.end(); i++, iL++)
2107 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2111 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2115 std::vector<mcIdType> multiVal;
2116 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2117 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2118 mcIdType nbc=self->getNumberOfCells();
2119 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2126 std::ostringstream oss;
2127 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2128 throw INTERP_KERNEL::Exception(oss.str().c_str());
2132 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2139 mcIdType tmp=nbc+singleVal;
2140 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2145 std::ostringstream oss;
2146 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2147 throw INTERP_KERNEL::Exception(oss.str().c_str());
2153 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2159 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2160 daIntTyypp->checkAllocated();
2161 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2165 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2169 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2173 std::vector<mcIdType> multiVal;
2174 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2175 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2176 mcIdType nbc=self->getNumberOfCells();
2177 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2184 std::ostringstream oss;
2185 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2186 throw INTERP_KERNEL::Exception(oss.str().c_str());
2190 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2197 mcIdType tmp=nbc+singleVal;
2198 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2203 std::ostringstream oss;
2204 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2205 throw INTERP_KERNEL::Exception(oss.str().c_str());
2211 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2216 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2222 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2223 daIntTyypp->checkAllocated();
2224 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2228 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2232 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2234 mcIdType szArr,sw,iTypppArr;
2235 std::vector<mcIdType> stdvecTyyppArr;
2236 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2239 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2240 throw INTERP_KERNEL::Exception(oss.str().c_str());
2242 self->insertNextCell(type,size,tmp);
2245 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2247 mcIdType szArr,sw,iTypppArr;
2248 std::vector<mcIdType> stdvecTyyppArr;
2249 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2250 self->insertNextCell(type,szArr,tmp);
2253 DataArrayIdType *getNodalConnectivity()
2255 DataArrayIdType *ret=self->getNodalConnectivity();
2260 DataArrayIdType *getNodalConnectivityIndex()
2262 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2268 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2270 mcIdType szArr,sw,iTypppArr;
2271 std::vector<mcIdType> stdvecTyyppArr;
2272 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2273 mcIdType nbOfDepthPeelingPerformed=0;
2274 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2275 PyObject *res=PyTuple_New(2);
2276 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2277 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2281 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2283 DataArrayIdType *v0=0,*v1=0;
2284 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2285 PyObject *res = PyList_New(2);
2286 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2287 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2291 PyObject *distanceToPoint(PyObject *point) const
2295 DataArrayDoubleTuple *aa;
2296 std::vector<double> bb;
2298 int nbOfCompo=self->getSpaceDimension();
2299 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2302 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2303 PyObject *ret=PyTuple_New(2);
2304 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2305 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2309 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2311 DataArrayIdType *ret1=0;
2312 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2313 PyObject *ret=PyTuple_New(2);
2314 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2315 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2319 PyObject *tetrahedrize(int policy)
2322 DataArrayIdType *ret1(0);
2323 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2324 PyObject *ret=PyTuple_New(3);
2325 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2331 PyObject *checkButterflyCells(double eps=1e-12)
2333 std::vector<mcIdType> cells;
2334 self->checkButterflyCells(cells,eps);
2335 DataArrayIdType *ret=DataArrayIdType::New();
2336 ret->alloc(cells.size(),1);
2337 std::copy(cells.begin(),cells.end(),ret->getPointer());
2338 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2341 PyObject *splitByType() const
2343 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2344 std::size_t sz=ms.size();
2345 PyObject *ret = PyList_New(sz);
2346 for(std::size_t i=0;i<sz;i++)
2347 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2351 PyObject *partitionBySpreadZone() const
2353 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2354 std::size_t sz=retCpp.size();
2355 PyObject *ret=PyList_New(sz);
2356 for(std::size_t i=0;i<sz;i++)
2357 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2361 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2363 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2364 std::size_t sz=retCpp.size();
2365 PyObject *ret=PyList_New(sz);
2366 for(std::size_t i=0;i<sz;i++)
2367 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2371 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2374 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2375 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2376 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2379 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2382 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2383 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2387 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2390 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2391 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2395 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2397 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2398 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2399 PyObject *ret=PyTuple_New(3);
2400 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2401 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2402 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2406 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2408 DataArrayIdType *tmp0=0,*tmp1=0;
2409 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2410 PyObject *ret=PyTuple_New(2);
2411 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2412 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2416 void duplicateNodes(PyObject *li)
2420 std::vector<mcIdType> multiVal;
2421 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2422 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2423 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2427 return self->duplicateNodes(&singleVal,&singleVal+1);
2429 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2431 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2433 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2437 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2441 std::vector<mcIdType> multiVal;
2442 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2443 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2444 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2448 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2450 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2452 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2454 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2458 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2460 mcIdType szArr,sw,iTypppArr;
2461 std::vector<mcIdType> stdvecTyyppArr;
2462 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2463 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2466 PyObject *getLevArrPerCellTypes(PyObject *li) const
2469 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2470 DataArrayIdType *tmp0,*tmp1=0;
2471 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2472 PyObject *ret=PyTuple_New(2);
2473 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2474 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2478 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2480 DataArrayIdType *ret0=0,*ret1=0;
2481 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2482 PyObject *ret=PyTuple_New(2);
2483 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2484 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2488 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2490 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2491 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2492 DataArrayIdType *ret1=0,*ret2=0;
2493 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2494 PyObject *ret=PyTuple_New(3);
2495 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2496 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2497 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2501 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2503 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2504 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2505 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2506 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2509 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2512 std::vector<const MEDCouplingUMesh *> meshes;
2513 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2514 std::vector<DataArrayIdType *> corr;
2515 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2517 PyObject *ret1=PyList_New(sz);
2518 for(std::size_t i=0;i<sz;i++)
2519 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2520 PyObject *ret=PyList_New(2);
2521 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2522 PyList_SetItem(ret,1,ret1);
2526 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2528 std::vector<MEDCouplingUMesh *> meshes;
2529 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2530 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2533 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2535 std::vector<MEDCouplingUMesh *> meshes;
2536 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2537 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2540 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2544 DataArrayDoubleTuple *aa;
2545 std::vector<double> bb;
2547 int spaceDim=self->getSpaceDimension();
2548 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2549 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2551 std::vector<mcIdType> cells;
2552 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2553 DataArrayIdType *ret=DataArrayIdType::New();
2554 ret->alloc(cells.size(),1);
2555 std::copy(cells.begin(),cells.end(),ret->getPointer());
2556 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2559 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2563 DataArrayDoubleTuple *aa;
2564 std::vector<double> bb;
2566 int spaceDim=self->getSpaceDimension();
2567 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2568 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2569 self->orientCorrectly2DCells(v,polyOnly);
2572 PyObject *arePolyhedronsNotCorrectlyOriented() const
2574 std::vector<mcIdType> cells;
2575 self->arePolyhedronsNotCorrectlyOriented(cells);
2576 DataArrayIdType *ret=DataArrayIdType::New();
2577 ret->alloc(cells.size(),1);
2578 std::copy(cells.begin(),cells.end(),ret->getPointer());
2579 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2582 PyObject *getFastAveragePlaneOfThis() const
2586 self->getFastAveragePlaneOfThis(vec,pos);
2588 std::copy(vec,vec+3,vals);
2589 std::copy(pos,pos+3,vals+3);
2590 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2593 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2595 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2596 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2597 return MEDCouplingUMesh::MergeUMeshes(tmp);
2600 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2602 DataArrayIdType *ret1;
2603 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2604 PyObject *ret=PyTuple_New(2);
2605 PyObject *ret0Py=ret0?Py_True:Py_False;
2607 PyTuple_SetItem(ret,0,ret0Py);
2608 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2612 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2614 DataArrayIdType *ret1;
2615 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2616 PyObject *ret=PyTuple_New(2);
2617 PyObject *ret0Py=ret0?Py_True:Py_False;
2619 PyTuple_SetItem(ret,0,ret0Py);
2620 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2624 PyObject *explode3DMeshTo1D() const
2626 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2627 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2628 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2629 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2630 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2631 PyObject *ret=PyTuple_New(5);
2632 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2633 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2634 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2635 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2636 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2640 PyObject *explodeIntoEdges() const
2642 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2643 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2644 PyObject *ret=PyTuple_New(5);
2645 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2646 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2647 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2648 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2649 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2653 PyObject *explodeMeshIntoMicroEdges() const
2655 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2656 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2657 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2658 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2659 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2660 PyObject *ret=PyTuple_New(5);
2661 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2662 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2663 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2664 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2665 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2669 PyObject *buildDescendingConnectivity() const
2671 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2672 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2673 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2674 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2675 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2676 PyObject *ret=PyTuple_New(5);
2677 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2678 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2679 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2680 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2681 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2685 PyObject *buildDescendingConnectivity2() const
2687 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2688 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2689 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2690 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2691 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2692 PyObject *ret=PyTuple_New(5);
2693 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2696 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2697 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2701 PyObject *computeNeighborsOfCells() const
2703 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2704 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2705 PyObject *ret=PyTuple_New(2);
2706 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2707 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2711 PyObject *computeNeighborsOfNodes() const
2713 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2714 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2715 PyObject *ret=PyTuple_New(2);
2716 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2721 PyObject *computeEnlargedNeighborsOfNodes() const
2723 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2724 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2725 PyObject *ret=PyTuple_New(2);
2726 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2727 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2731 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2733 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2734 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2735 PyObject *ret=PyTuple_New(2);
2736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2741 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2743 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2744 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2745 PyObject *ret=PyTuple_New(2);
2746 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2747 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2751 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2753 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2754 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2755 DataArrayIdType *d2,*d3,*d4,*dd5;
2756 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2757 PyObject *ret=PyTuple_New(7);
2758 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2759 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2760 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2763 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2764 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2768 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2771 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2772 da->checkAllocated();
2773 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2776 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2779 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2780 da->checkAllocated();
2781 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2784 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2787 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2788 da->checkAllocated();
2789 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2792 PyObject *getTypesOfPart(DataArrayIdType *da) const
2795 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2796 da->checkAllocated();
2797 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2798 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2799 PyObject *res = PyList_New(result.size());
2800 for (int i=0;iL!=result.end(); i++, iL++)
2801 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2805 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2808 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2809 da->checkAllocated();
2810 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2811 ret->setName(da->getName().c_str());
2815 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2817 DataArrayIdType *cellNb1=0,*cellNb2=0;
2818 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2819 PyObject *ret=PyTuple_New(3);
2820 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2821 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2822 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2826 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2828 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2829 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2830 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2831 PyObject *ret(PyTuple_New(4));
2832 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2833 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2834 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2835 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2839 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2841 int spaceDim=self->getSpaceDimension();
2843 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2845 DataArrayDouble *a,*a2;
2846 DataArrayDoubleTuple *aa,*aa2;
2847 std::vector<double> bb,bb2;
2849 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2850 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2851 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2852 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2854 DataArrayIdType *cellIds=0;
2855 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2856 PyObject *ret=PyTuple_New(2);
2857 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2858 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2862 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2864 int spaceDim=self->getSpaceDimension();
2866 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2868 DataArrayDouble *a,*a2;
2869 DataArrayDoubleTuple *aa,*aa2;
2870 std::vector<double> bb,bb2;
2872 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2873 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2874 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2875 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2877 DataArrayIdType *cellIds=0;
2878 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2879 PyObject *ret=PyTuple_New(2);
2880 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2881 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2885 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2888 DataArrayDouble *a,*a2;
2889 DataArrayDoubleTuple *aa,*aa2;
2890 std::vector<double> bb,bb2;
2892 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2893 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2894 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2895 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2896 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2900 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2902 int spaceDim=self->getSpaceDimension();
2904 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2906 DataArrayDouble *a,*a2;
2907 DataArrayDoubleTuple *aa,*aa2;
2908 std::vector<double> bb,bb2;
2910 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2911 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2912 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2913 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2914 return self->getCellIdsCrossingPlane(orig,vect,eps);
2917 void convertToPolyTypes(PyObject *li)
2921 std::vector<mcIdType> pos2;
2922 DataArrayIdType *pos3=0;
2923 DataArrayIdTypeTuple *pos4=0;
2924 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2929 self->convertToPolyTypes(&pos1,&pos1+1);
2936 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2941 self->convertToPolyTypes(pos3->begin(),pos3->end());
2945 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2949 void convertAllToPoly();
2950 void convertExtrudedPolyhedra();
2952 void simplifyPolyhedra(double eps);
2953 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2954 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2957 //== MEDCouplingUMesh End
2959 //== MEDCouplingMappedExtrudedMesh
2961 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2964 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2965 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2966 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2967 int get2DCellIdForExtrusion() const;
2969 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
2971 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2974 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2976 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2979 MEDCouplingMappedExtrudedMesh()
2981 return MEDCouplingMappedExtrudedMesh::New();
2984 std::string __str__() const
2986 return self->simpleRepr();
2989 std::string __repr__() const
2991 std::ostringstream oss;
2992 self->reprQuickOverview(oss);
2996 PyObject *getMesh2D() const
2998 MEDCouplingUMesh *ret=self->getMesh2D();
3001 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3003 PyObject *getMesh1D() const
3005 MEDCouplingUMesh *ret=self->getMesh1D();
3008 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3010 PyObject *getMesh3DIds() const
3012 DataArrayIdType *ret=self->getMesh3DIds();
3015 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3020 //== MEDCouplingMappedExtrudedMesh End
3022 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3025 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3026 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3027 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3028 int getNodalConnectivityLength() const;
3029 virtual void allocateCells(int nbOfCells=0);
3030 virtual void checkConsistencyOfConnectivity() const;
3033 virtual void insertNextCell(PyObject *li)
3035 mcIdType szArr,sw,iTypppArr;
3036 std::vector<mcIdType> stdvecTyyppArr;
3037 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3038 self->insertNextCell(tmp,tmp+szArr);
3041 virtual DataArrayIdType *getNodalConnectivity() const
3043 DataArrayIdType *ret=self->getNodalConnectivity();
3044 if(ret) ret->incrRef();
3048 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3050 std::vector< const MEDCoupling1GTUMesh *> parts;
3051 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3052 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3057 //== MEDCoupling1SGTUMesh
3059 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3062 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3063 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3064 void setNodalConnectivity(DataArrayIdType *nodalConn);
3065 int getNumberOfNodesPerCell() const;
3066 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3067 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3068 MEDCoupling1GTUMesh *computeDualMesh() const;
3069 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3070 DataArrayIdType *sortHexa8EachOther();
3073 MEDCoupling1SGTUMesh()
3075 return MEDCoupling1SGTUMesh::New();
3078 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3080 return MEDCoupling1SGTUMesh::New(name,type);
3083 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3085 return MEDCoupling1SGTUMesh::New(m);
3088 std::string __str__() const
3090 return self->simpleRepr();
3093 std::string __repr__() const
3095 std::ostringstream oss;
3096 self->reprQuickOverview(oss);
3100 PyObject *structurizeMe(double eps=1e-12) const
3102 DataArrayIdType *cellPerm(0),*nodePerm(0);
3103 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3104 PyObject *ret(PyTuple_New(3));
3105 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3106 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3107 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3111 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3113 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3114 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3115 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3118 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3120 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3121 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3122 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3127 //== MEDCoupling1SGTUMesh End
3129 //== MEDCoupling1DGTUMesh
3131 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3134 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3135 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3136 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3137 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3138 bool isPacked() const;
3141 MEDCoupling1DGTUMesh()
3143 return MEDCoupling1DGTUMesh::New();
3145 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3147 return MEDCoupling1DGTUMesh::New(name,type);
3150 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3152 return MEDCoupling1DGTUMesh::New(m);
3155 std::string __str__() const
3157 return self->simpleRepr();
3160 std::string __repr__() const
3162 std::ostringstream oss;
3163 self->reprQuickOverview(oss);
3167 DataArrayIdType *getNodalConnectivityIndex() const
3169 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3170 if(ret) ret->incrRef();
3174 PyObject *retrievePackedNodalConnectivity() const
3176 DataArrayIdType *ret1=0,*ret2=0;
3177 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3178 PyObject *ret0Py=ret0?Py_True:Py_False;
3180 PyObject *ret=PyTuple_New(3);
3181 PyTuple_SetItem(ret,0,ret0Py);
3182 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3183 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3187 PyObject *copyWithNodalConnectivityPacked() const
3190 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3191 PyObject *ret=PyTuple_New(2);
3192 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3193 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3194 PyTuple_SetItem(ret,1,ret1Py);
3198 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3200 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3201 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3202 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3205 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3207 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3208 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3209 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3212 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3214 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3215 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3216 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3221 //== MEDCoupling1DGTUMeshEnd
3223 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3226 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3227 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3228 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3229 int getSpaceDimensionOnNodeStruct() const;
3230 double computeSquareness() const;
3231 virtual std::vector<mcIdType> getNodeGridStructure() const;
3232 std::vector<mcIdType> getCellGridStructure() const;
3233 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3234 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3235 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3236 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3237 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3238 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3239 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3240 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3243 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3245 mcIdType tmpp1=-1,tmpp2=-1;
3246 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3247 std::vector< std::pair<mcIdType,mcIdType> > inp;
3251 for(mcIdType i=0;i<tmpp1;i++)
3252 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3257 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3258 inp.resize(tmpp1/2);
3259 for(mcIdType i=0;i<tmpp1/2;i++)
3260 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3263 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3264 return self->buildStructuredSubPart(inp);
3267 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3269 std::vector< std::pair<mcIdType,mcIdType> > inp;
3270 convertPyToVectorPairInt(part,inp);
3272 mcIdType szArr,sw,iTypppArr;
3273 std::vector<mcIdType> stdvecTyyppArr;
3274 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3275 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3277 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3280 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3282 std::vector< std::pair<mcIdType,mcIdType> > inp;
3283 convertPyToVectorPairInt(part,inp);
3284 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3287 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3289 std::vector< std::pair<mcIdType,mcIdType> > inp;
3290 convertPyToVectorPairInt(part,inp);
3291 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3294 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3296 std::vector< std::pair<mcIdType,mcIdType> > inp;
3297 convertPyToVectorPairInt(part,inp);
3298 std::vector<mcIdType> stWithGhost;
3299 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3300 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3301 PyObject *ret(PyTuple_New(2));
3302 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3303 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3307 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3309 std::vector< std::pair<mcIdType,mcIdType> > inp;
3310 convertPyToVectorPairInt(partCompactFormat,inp);
3311 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3314 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3316 std::vector< std::pair<mcIdType,mcIdType> > inp;
3317 convertPyToVectorPairInt(partCompactFormat,inp);
3318 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3321 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3323 std::vector< std::pair<mcIdType,mcIdType> > inp;
3324 convertPyToVectorPairInt(part,inp);
3325 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3328 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3330 mcIdType szArr,sw,iTypppArr;
3331 std::vector<mcIdType> stdvecTyyppArr;
3332 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3333 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3336 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3338 mcIdType szArr,sw,iTypppArr;
3339 std::vector<mcIdType> stdvecTyyppArr;
3340 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3341 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3344 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3346 std::vector< std::pair<mcIdType,mcIdType> > inp;
3347 convertPyToVectorPairInt(partCompactFormat,inp);
3348 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3351 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3353 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3354 PyObject *retPy=PyList_New(ret.size());
3355 for(std::size_t i=0;i<ret.size();i++)
3357 PyObject *tmp=PyTuple_New(2);
3358 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3359 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3360 PyList_SetItem(retPy,i,tmp);
3365 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3367 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3368 convertPyToVectorPairInt(r1,r1Cpp);
3369 convertPyToVectorPairInt(r2,r2Cpp);
3370 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3371 PyObject *retPy=PyList_New(ret.size());
3372 for(std::size_t i=0;i<ret.size();i++)
3374 PyObject *tmp=PyTuple_New(2);
3375 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3376 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3377 PyList_SetItem(retPy,i,tmp);
3382 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3384 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3385 convertPyToVectorPairInt(r1,r1Cpp);
3386 convertPyToVectorPairInt(r2,r2Cpp);
3387 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3390 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3392 mcIdType szArr,sw,iTypppArr;
3393 std::vector<mcIdType> stdvecTyyppArr;
3394 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3395 mcIdType szArr2,sw2,iTypppArr2;
3396 std::vector<mcIdType> stdvecTyyppArr2;
3397 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3398 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3399 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3400 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3401 PyObject *ret=PyTuple_New(2);
3402 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3403 PyTuple_SetItem(ret,0,ret0Py);
3404 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3405 for(std::size_t i=0;i<partCompactFormat.size();i++)
3407 PyObject *tmp4=PyTuple_New(2);
3408 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3409 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3410 PyList_SetItem(ret1Py,i,tmp4);
3412 PyTuple_SetItem(ret,1,ret1Py);
3416 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3418 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3419 convertPyToVectorPairInt(bigInAbs,param0);
3420 convertPyToVectorPairInt(partOfBigInAbs,param1);
3421 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3422 PyObject *retPy(PyList_New(ret.size()));
3423 for(std::size_t i=0;i<ret.size();i++)
3425 PyObject *tmp(PyTuple_New(2));
3426 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3427 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3428 PyList_SetItem(retPy,i,tmp);
3433 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3435 std::vector< std::pair<mcIdType,mcIdType> > param0;
3436 convertPyToVectorPairInt(part,param0);
3437 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3438 PyObject *retPy(PyList_New(ret.size()));
3439 for(std::size_t i=0;i<ret.size();i++)
3441 PyObject *tmp(PyTuple_New(2));
3442 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3443 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3444 PyList_SetItem(retPy,i,tmp);
3449 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3451 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3452 convertPyToVectorPairInt(startingFrom,param0);
3453 convertPyToVectorPairInt(goingTo,param1);
3454 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3457 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3459 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3460 convertPyToVectorPairInt(bigInAbs,param0);
3461 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3462 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3463 PyObject *retPy(PyList_New(ret.size()));
3464 for(std::size_t i=0;i<ret.size();i++)
3466 PyObject *tmp(PyTuple_New(2));
3467 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3468 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3469 PyList_SetItem(retPy,i,tmp);
3476 class MEDCouplingCurveLinearMesh;
3478 //== MEDCouplingCMesh
3480 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3483 static MEDCouplingCMesh *New();
3484 static MEDCouplingCMesh *New(const std::string& meshName);
3485 void setCoords(const DataArrayDouble *coordsX,
3486 const DataArrayDouble *coordsY=0,
3487 const DataArrayDouble *coordsZ=0);
3488 void setCoordsAt(int i, const DataArrayDouble *arr);
3489 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3493 return MEDCouplingCMesh::New();
3495 MEDCouplingCMesh(const std::string& meshName)
3497 return MEDCouplingCMesh::New(meshName);
3499 std::string __str__() const
3501 return self->simpleRepr();
3503 std::string __repr__() const
3505 std::ostringstream oss;
3506 self->reprQuickOverview(oss);
3509 DataArrayDouble *getCoordsAt(int i)
3511 DataArrayDouble *ret=self->getCoordsAt(i);
3519 //== MEDCouplingCMesh End
3521 //== MEDCouplingCurveLinearMesh
3523 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3526 static MEDCouplingCurveLinearMesh *New();
3527 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3528 void setCoords(const DataArrayDouble *coords);
3530 MEDCouplingCurveLinearMesh()
3532 return MEDCouplingCurveLinearMesh::New();
3534 MEDCouplingCurveLinearMesh(const std::string& meshName)
3536 return MEDCouplingCurveLinearMesh::New(meshName);
3538 std::string __str__() const
3540 return self->simpleRepr();
3542 std::string __repr__() const
3544 std::ostringstream oss;
3545 self->reprQuickOverview(oss);
3548 DataArrayDouble *getCoords()
3550 DataArrayDouble *ret=self->getCoords();
3555 void setNodeGridStructure(PyObject *gridStruct)
3557 mcIdType szArr,sw,iTypppArr;
3558 std::vector<mcIdType> stdvecTyyppArr;
3559 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3560 self->setNodeGridStructure(tmp,tmp+szArr);
3565 //== MEDCouplingCurveLinearMesh End
3567 //== MEDCouplingIMesh
3569 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3572 static MEDCouplingIMesh *New();
3574 void setSpaceDimension(int spaceDim);
3575 std::vector<mcIdType> getNodeStruct() const;
3576 std::vector<double> getOrigin() const;
3577 std::vector<double> getDXYZ() const;
3578 void setAxisUnit(const std::string& unitName);
3579 std::string getAxisUnit() const;
3580 double getMeasureOfAnyCell() const;
3581 MEDCouplingCMesh *convertToCartesian() const;
3582 void refineWithFactor(const std::vector<mcIdType>& factors);
3583 MEDCouplingIMesh *asSingleCell() const;
3584 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3589 return MEDCouplingIMesh::New();
3591 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3593 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3594 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3595 const mcIdType *nodeStrctPtr(0);
3596 const double *originPtr(0),*dxyzPtr(0);
3597 mcIdType sw,sz,val0;
3598 std::vector<mcIdType> bb0;
3599 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3602 std::vector<double> bb,bb2;
3604 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3605 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3607 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3610 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3612 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3615 void setNodeStruct(PyObject *nodeStrct)
3617 mcIdType sw,sz,val0;
3618 std::vector<mcIdType> bb0;
3619 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3620 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3623 void setOrigin(PyObject *origin)
3625 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3627 std::vector<double> bb;
3628 mcIdType sw,nbTuples;
3629 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3630 self->setOrigin(originPtr,originPtr+nbTuples);
3633 void setDXYZ(PyObject *dxyz)
3635 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3637 std::vector<double> bb;
3638 mcIdType sw,nbTuples;
3639 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3640 self->setDXYZ(originPtr,originPtr+nbTuples);
3643 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3645 std::vector< std::pair<mcIdType,mcIdType> > inp;
3646 convertPyToVectorPairInt(fineLocInCoarse,inp);
3647 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3650 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3652 std::vector< std::pair<mcIdType,mcIdType> > inp;
3653 convertPyToVectorPairInt(fineLocInCoarse,inp);
3654 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3657 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3659 std::vector< std::pair<mcIdType,mcIdType> > inp;
3660 convertPyToVectorPairInt(fineLocInCoarse,inp);
3661 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3664 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3666 std::vector< std::pair<mcIdType,mcIdType> > inp;
3667 convertPyToVectorPairInt(fineLocInCoarse,inp);
3668 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3671 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3673 std::vector< std::pair<mcIdType,mcIdType> > inp;
3674 convertPyToVectorPairInt(fineLocInCoarse,inp);
3675 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3678 std::string __str__() const
3680 return self->simpleRepr();
3682 std::string __repr__() const
3684 std::ostringstream oss;
3685 self->reprQuickOverview(oss);
3691 //== MEDCouplingIMesh End
3695 namespace MEDCoupling
3697 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3700 virtual void checkConsistencyLight() const;
3701 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3702 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3703 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3704 void setName(const char *name);
3705 std::string getDescription() const;
3706 void setDescription(const char *desc);
3707 std::string getName() const;
3708 TypeOfField getTypeOfField() const;
3709 NatureOfField getNature() const;
3710 virtual void setNature(NatureOfField nat);
3711 DataArrayDouble *getLocalizationOfDiscr() const;
3712 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3713 mcIdType getNumberOfTuplesExpected() const;
3714 mcIdType getNumberOfMeshPlacesExpected() const;
3715 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3716 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3717 void clearGaussLocalizations();
3718 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3719 mcIdType getNbOfGaussLocalization() const;
3720 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3721 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3722 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3723 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3725 PyObject *getMesh() const
3727 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3730 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3733 PyObject *getDiscretization()
3735 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3738 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3741 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3743 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3744 return convertIntArrToPyList3(ret);
3747 PyObject *buildSubMeshData(PyObject *li) const
3749 DataArrayIdType *ret1=0;
3750 MEDCouplingMesh *ret0=0;
3752 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3753 if (!SWIG_IsOK(res1))
3756 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3757 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3761 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3763 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3764 da2->checkAllocated();
3765 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3767 PyObject *res = PyList_New(2);
3768 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3769 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3773 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3775 DataArrayIdType *ret1=0;
3777 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3778 PyObject *res=PyTuple_New(2);
3779 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3781 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3784 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3785 PyTuple_SetItem(res,1,res1);
3790 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3793 mcIdType v0; std::vector<mcIdType> v1;
3794 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3795 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3798 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3799 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3802 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3803 if (!SWIG_IsOK(res1))
3806 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3807 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3811 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3813 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3814 da2->checkAllocated();
3815 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3819 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3821 std::vector<mcIdType> tmp;
3822 self->getCellIdsHavingGaussLocalization(locId,tmp);
3823 DataArrayIdType *ret=DataArrayIdType::New();
3824 ret->alloc((mcIdType)tmp.size(),1);
3825 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3826 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3829 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3831 std::vector<mcIdType> inp0;
3832 convertPyToNewIntArr4(code,1,3,inp0);
3833 std::vector<const DataArrayIdType *> inp1;
3834 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3835 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3840 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3843 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3844 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3845 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3846 static MEDCouplingFieldTemplate *New(TypeOfField type);
3847 std::string simpleRepr() const;
3848 std::string advancedRepr() const;
3849 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3850 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3853 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3855 return MEDCouplingFieldTemplate::New(f);
3858 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3860 return MEDCouplingFieldTemplate::New(f);
3863 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3865 return MEDCouplingFieldTemplate::New(f);
3868 MEDCouplingFieldTemplate(TypeOfField type)
3870 return MEDCouplingFieldTemplate::New(type);
3873 std::string __str__() const
3875 return self->simpleRepr();
3878 std::string __repr__() const
3880 std::ostringstream oss;
3881 self->reprQuickOverview(oss);
3885 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3888 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3889 PyObject *ret=PyTuple_New(2);
3890 PyObject *ret0Py=ret0?Py_True:Py_False;
3892 PyTuple_SetItem(ret,0,ret0Py);
3893 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3900 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3903 TypeOfTimeDiscretization getTimeDiscretization() const;
3905 MEDCouplingFieldT();
3906 ~MEDCouplingFieldT();
3909 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3910 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3911 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3913 class MEDCouplingFieldInt;
3914 class MEDCouplingFieldFloat;
3916 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3919 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3920 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3921 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3922 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3923 void setTimeUnit(const std::string& unit);
3924 std::string getTimeUnit() const;
3925 void synchronizeTimeWithSupport();
3926 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3927 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3928 std::string simpleRepr() const;
3929 std::string advancedRepr() const;
3930 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3931 MEDCouplingFieldInt *convertToIntField() const;
3932 MEDCouplingFieldFloat *convertToFloatField() const;
3933 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3934 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3935 MEDCouplingFieldDouble *deepCopy() const;
3936 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3937 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3938 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3939 double getIJ(int tupleId, int compoId) const;
3940 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3941 void synchronizeTimeWithMesh();
3942 void setArray(DataArrayDouble *array);
3943 void setEndArray(DataArrayDouble *array);
3944 void setTime(double val, int iteration, int order);
3945 void setStartTime(double val, int iteration, int order);
3946 void setEndTime(double val, int iteration, int order);
3947 void applyLin(double a, double b, int compoId);
3948 void applyLin(double a, double b);
3949 int getNumberOfComponents() const;
3950 int getNumberOfTuples() const;
3951 int getNumberOfValues() const;
3952 void setTimeTolerance(double val);
3953 double getTimeTolerance() const;
3954 void setIteration(int it);
3955 void setEndIteration(int it);
3956 void setOrder(int order);
3957 void setEndOrder(int order);
3958 void setTimeValue(double val);
3959 void setEndTimeValue(double val);
3960 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3961 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3962 bool mergeNodes(double eps, double epsOnVals=1e-15);
3963 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3964 bool zipCoords(double epsOnVals=1e-15);
3965 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3966 bool simplexize(int policy);
3967 MEDCouplingFieldDouble *doublyContractedProduct() const;
3968 MEDCouplingFieldDouble *determinant() const;
3969 MEDCouplingFieldDouble *eigenValues() const;
3970 MEDCouplingFieldDouble *eigenVectors() const;
3971 MEDCouplingFieldDouble *inverse() const;
3972 MEDCouplingFieldDouble *trace() const;
3973 MEDCouplingFieldDouble *deviator() const;
3974 MEDCouplingFieldDouble *magnitude() const;
3975 MEDCouplingFieldDouble *maxPerTuple() const;
3976 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
3977 void sortPerTuple(bool asc);
3978 MEDCouplingFieldDouble &operator=(double value);
3979 void fillFromAnalytic(int nbOfComp, const std::string& func);
3980 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
3981 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3982 void applyFunc(int nbOfComp, const std::string& func);
3983 void applyFuncCompo(int nbOfComp, const std::string& func);
3984 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3985 void applyFunc(int nbOfComp, double val);
3986 void applyFunc(const std::string& func);
3987 void applyFuncFast32(const std::string& func);
3988 void applyFuncFast64(const std::string& func);
3989 double accumulate(int compId) const;
3990 double getMaxValue() const;
3991 double getMinValue() const;
3992 double getAverageValue() const;
3993 double norm2() const;
3994 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3995 double getWeightedAverageValue(int compId, bool isWAbs) const;
3996 double integral(int compId, bool isWAbs) const;
3997 double normL1(int compId) const;
3998 double normL2(int compId) const;
3999 double normMax(int compId) const;
4000 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4001 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4002 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4003 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4004 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4005 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4006 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4007 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4008 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4009 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4010 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4011 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4012 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4013 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4014 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4015 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4016 MEDCouplingFieldDouble *negate() const;
4018 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4020 return MEDCouplingFieldDouble::New(type,td);
4023 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4025 return MEDCouplingFieldDouble::New(ft,td);
4028 std::string __str__() const
4030 return self->simpleRepr();
4033 std::string __repr__() const
4035 std::ostringstream oss;
4036 self->reprQuickOverview(oss);
4040 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4043 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4044 PyObject *ret=PyTuple_New(2);
4045 PyObject *ret0Py=ret0?Py_True:Py_False;
4047 PyTuple_SetItem(ret,0,ret0Py);
4048 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4052 MEDCouplingFieldDouble *voronoize(double eps) const
4054 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4058 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4060 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4064 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4066 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4068 DataArrayDouble *a,*a2;
4069 DataArrayDoubleTuple *aa,*aa2;
4070 std::vector<double> bb,bb2;
4072 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4073 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4074 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4077 DataArrayDouble *getArray()
4079 DataArrayDouble *ret=self->getArray();
4085 PyObject *getArrays() const
4087 std::vector<DataArrayDouble *> arrs=self->getArrays();
4088 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4091 std::size_t sz=arrs.size();
4092 PyObject *ret=PyTuple_New(sz);
4093 for(std::size_t i=0;i<sz;i++)
4096 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4098 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4103 void setArrays(PyObject *ls)
4105 std::vector<const DataArrayDouble *> tmp;
4106 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4107 std::size_t sz=tmp.size();
4108 std::vector<DataArrayDouble *> arrs(sz);
4109 for(std::size_t i=0;i<sz;i++)
4110 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4111 self->setArrays(arrs);
4114 DataArrayDouble *getEndArray()
4116 DataArrayDouble *ret=self->getEndArray();
4122 PyObject *getValueOn(PyObject *sl) const
4126 DataArrayDoubleTuple *aa;
4127 std::vector<double> bb;
4129 const MEDCouplingMesh *mesh=self->getMesh();
4131 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4132 int spaceDim=mesh->getSpaceDimension();
4133 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4134 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4136 mcIdType sz=ToIdType(self->getNumberOfComponents());
4137 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4138 self->getValueOn(spaceLoc,res);
4139 return convertDblArrToPyList<double>(res,sz);
4142 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4144 mcIdType sz=ToIdType(self->getNumberOfComponents());
4145 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4146 self->getValueOnPos(i,j,k,res);
4147 return convertDblArrToPyList<double>(res,sz);
4150 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4152 const MEDCouplingMesh *mesh(self->getMesh());
4154 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4157 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4158 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4159 mesh->getSpaceDimension(),true,nbPts);
4160 return self->getValueOnMulti(inp,(int)nbPts);
4163 PyObject *getValueOn(PyObject *sl, double time) const
4167 DataArrayDoubleTuple *aa;
4168 std::vector<double> bb;
4170 const MEDCouplingMesh *mesh=self->getMesh();
4172 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4173 int spaceDim=mesh->getSpaceDimension();
4174 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4175 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4178 mcIdType sz=ToIdType(self->getNumberOfComponents());
4179 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4180 self->getValueOn(spaceLoc,time,res);
4181 return convertDblArrToPyList<double>(res,sz);
4184 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4186 if(self->getArray()!=0)
4187 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4190 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4191 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4192 self->setArray(arr);
4199 double tmp0=self->getTime(tmp1,tmp2);
4200 PyObject *res = PyList_New(3);
4201 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4202 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4203 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4207 PyObject *getStartTime()
4210 double tmp0=self->getStartTime(tmp1,tmp2);
4211 PyObject *res = PyList_New(3);
4212 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4213 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4214 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4218 PyObject *getEndTime()
4221 double tmp0=self->getEndTime(tmp1,tmp2);
4222 PyObject *res = PyList_New(3);
4223 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4224 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4225 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4228 PyObject *accumulate() const
4230 mcIdType sz=ToIdType(self->getNumberOfComponents());
4231 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4232 self->accumulate(tmp);
4233 return convertDblArrToPyList<double>(tmp,sz);
4235 PyObject *integral(bool isWAbs) const
4237 mcIdType sz=ToIdType(self->getNumberOfComponents());
4238 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4239 self->integral(isWAbs,tmp);
4240 return convertDblArrToPyList<double>(tmp,sz);
4242 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4244 mcIdType sz=ToIdType(self->getNumberOfComponents());
4245 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4246 self->getWeightedAverageValue(tmp,isWAbs);
4247 return convertDblArrToPyList<double>(tmp,sz);
4249 PyObject *normL1() const
4251 mcIdType sz=ToIdType(self->getNumberOfComponents());
4252 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4254 return convertDblArrToPyList<double>(tmp,sz);
4256 PyObject *normL2() const
4258 mcIdType sz=ToIdType(self->getNumberOfComponents());
4259 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4261 return convertDblArrToPyList<double>(tmp,sz);
4263 PyObject *normMax() const
4265 mcIdType sz=ToIdType(self->getNumberOfComponents());
4266 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4268 return convertDblArrToPyList<double>(tmp,sz);
4270 void renumberCells(PyObject *li, bool check=true)
4272 mcIdType szArr,sw,iTypppArr;
4273 std::vector<mcIdType> stdvecTyyppArr;
4274 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4275 self->renumberCells(tmp,check);
4278 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4280 mcIdType szArr,sw,iTypppArr;
4281 std::vector<mcIdType> stdvecTyyppArr;
4282 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4283 self->renumberCellsWithoutMesh(tmp,check);
4286 void renumberNodes(PyObject *li, double eps=1e-15)
4288 mcIdType szArr,sw,iTypppArr;
4289 std::vector<mcIdType> stdvecTyyppArr;
4290 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4291 self->renumberNodes(tmp,eps);
4294 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4296 mcIdType szArr,sw,iTypppArr;
4297 std::vector<mcIdType> stdvecTyyppArr;
4298 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4299 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4302 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4304 return fieldT_buildSubPart(self,li);
4307 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4309 return fieldT__getitem__(self,li);
4312 PyObject *getMaxValue2() const
4314 DataArrayIdType *tmp;
4315 double r1=self->getMaxValue2(tmp);
4316 PyObject *ret=PyTuple_New(2);
4317 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4318 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4322 PyObject *getMinValue2() const
4324 DataArrayIdType *tmp;
4325 double r1=self->getMinValue2(tmp);
4326 PyObject *ret=PyTuple_New(2);
4327 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4328 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4332 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4334 std::vector<std::size_t> tmp;
4335 convertPyToNewIntArr3(li,tmp);
4336 return self->keepSelectedComponents(tmp);
4339 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4341 std::vector<std::size_t> tmp;
4342 convertPyToNewIntArr3(li,tmp);
4343 self->setSelectedComponents(f,tmp);
4346 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4349 DataArrayDouble *a,*a2;
4350 DataArrayDoubleTuple *aa,*aa2;
4351 std::vector<double> bb,bb2;
4354 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4355 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4356 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4357 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4359 return self->extractSlice3D(orig,vect,eps);
4362 MEDCouplingFieldDouble *__add__(PyObject *obj)
4364 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4367 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4369 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4372 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4374 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.";
4375 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4378 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4380 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4382 return (*self)-(*other);
4384 throw INTERP_KERNEL::Exception(msg);
4389 DataArrayDoubleTuple *aa;
4390 std::vector<double> bb;
4392 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4397 if(!self->getArray())
4398 throw INTERP_KERNEL::Exception(msg2);
4399 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4400 ret->applyLin(1.,-val);
4401 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4402 ret2->setArray(ret);
4407 if(!self->getArray())
4408 throw INTERP_KERNEL::Exception(msg2);
4409 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4410 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4411 ret2->setArray(ret);
4416 if(!self->getArray())
4417 throw INTERP_KERNEL::Exception(msg2);
4418 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4419 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4420 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4421 ret2->setArray(ret);
4426 if(!self->getArray())
4427 throw INTERP_KERNEL::Exception(msg2);
4428 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4429 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4430 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4431 ret2->setArray(ret);
4435 { throw INTERP_KERNEL::Exception(msg); }
4439 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4441 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4444 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4446 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4449 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4451 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4454 MEDCouplingFieldDouble *__div__(PyObject *obj)
4456 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.";
4457 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4460 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4462 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4464 return (*self)/(*other);
4466 throw INTERP_KERNEL::Exception(msg);
4471 DataArrayDoubleTuple *aa;
4472 std::vector<double> bb;
4474 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4480 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4481 if(!self->getArray())
4482 throw INTERP_KERNEL::Exception(msg2);
4483 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4484 ret->applyLin(1./val,0);
4485 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4486 ret2->setArray(ret);
4491 if(!self->getArray())
4492 throw INTERP_KERNEL::Exception(msg2);
4493 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4494 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4495 ret2->setArray(ret);
4500 if(!self->getArray())
4501 throw INTERP_KERNEL::Exception(msg2);
4502 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4503 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4504 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4505 ret2->setArray(ret);
4510 if(!self->getArray())
4511 throw INTERP_KERNEL::Exception(msg2);
4512 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4513 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4514 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4515 ret2->setArray(ret);
4519 { throw INTERP_KERNEL::Exception(msg); }
4523 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4525 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4528 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4530 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.";
4531 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4534 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4536 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4538 return (*self)^(*other);
4540 throw INTERP_KERNEL::Exception(msg);
4545 DataArrayDoubleTuple *aa;
4546 std::vector<double> bb;
4548 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4553 if(!self->getArray())
4554 throw INTERP_KERNEL::Exception(msg2);
4555 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4557 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4558 ret2->setArray(ret);
4563 if(!self->getArray())
4564 throw INTERP_KERNEL::Exception(msg2);
4565 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4566 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4567 ret2->setArray(ret);
4572 if(!self->getArray())
4573 throw INTERP_KERNEL::Exception(msg2);
4574 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4575 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4576 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4577 ret2->setArray(ret);
4582 if(!self->getArray())
4583 throw INTERP_KERNEL::Exception(msg2);
4584 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4585 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4586 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4587 ret2->setArray(ret);
4591 { throw INTERP_KERNEL::Exception(msg); }
4595 MEDCouplingFieldDouble *__neg__() const
4597 return self->negate();
4600 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4602 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.";
4603 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4606 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4608 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4612 Py_XINCREF(trueSelf);
4616 throw INTERP_KERNEL::Exception(msg);
4621 DataArrayDoubleTuple *aa;
4622 std::vector<double> bb;
4624 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4629 if(!self->getArray())
4630 throw INTERP_KERNEL::Exception(msg2);
4631 self->getArray()->applyLin(1.,val);
4632 Py_XINCREF(trueSelf);
4637 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4640 Py_XINCREF(trueSelf);
4645 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4646 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4647 ret2->setArray(aaa);
4649 Py_XINCREF(trueSelf);
4654 if(!self->getArray())
4655 throw INTERP_KERNEL::Exception(msg2);
4656 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4657 self->getArray()->addEqual(aaa);
4658 Py_XINCREF(trueSelf);
4662 { throw INTERP_KERNEL::Exception(msg); }
4666 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4668 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.";
4669 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4672 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4674 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4678 Py_XINCREF(trueSelf);
4682 throw INTERP_KERNEL::Exception(msg);
4687 DataArrayDoubleTuple *aa;
4688 std::vector<double> bb;
4690 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4695 if(!self->getArray())
4696 throw INTERP_KERNEL::Exception(msg2);
4697 self->getArray()->applyLin(1.,-val);
4698 Py_XINCREF(trueSelf);
4703 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4706 Py_XINCREF(trueSelf);
4711 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4712 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4713 ret2->setArray(aaa);
4715 Py_XINCREF(trueSelf);
4720 if(!self->getArray())
4721 throw INTERP_KERNEL::Exception(msg2);
4722 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4723 self->getArray()->substractEqual(aaa);
4724 Py_XINCREF(trueSelf);
4728 { throw INTERP_KERNEL::Exception(msg); }
4732 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4734 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.";
4735 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4738 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4740 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4744 Py_XINCREF(trueSelf);
4748 throw INTERP_KERNEL::Exception(msg);
4753 DataArrayDoubleTuple *aa;
4754 std::vector<double> bb;
4756 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4761 if(!self->getArray())
4762 throw INTERP_KERNEL::Exception(msg2);
4763 self->getArray()->applyLin(val,0);
4764 Py_XINCREF(trueSelf);
4769 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4772 Py_XINCREF(trueSelf);
4777 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4778 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4779 ret2->setArray(aaa);
4781 Py_XINCREF(trueSelf);
4786 if(!self->getArray())
4787 throw INTERP_KERNEL::Exception(msg2);
4788 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4789 self->getArray()->multiplyEqual(aaa);
4790 Py_XINCREF(trueSelf);
4794 { throw INTERP_KERNEL::Exception(msg); }
4798 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4800 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.";
4801 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4804 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4806 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4810 Py_XINCREF(trueSelf);
4814 throw INTERP_KERNEL::Exception(msg);
4819 DataArrayDoubleTuple *aa;
4820 std::vector<double> bb;
4822 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4828 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4829 if(!self->getArray())
4830 throw INTERP_KERNEL::Exception(msg2);
4831 self->getArray()->applyLin(1./val,0);
4832 Py_XINCREF(trueSelf);
4837 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4840 Py_XINCREF(trueSelf);
4845 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4846 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4847 ret2->setArray(aaa);
4849 Py_XINCREF(trueSelf);
4854 if(!self->getArray())
4855 throw INTERP_KERNEL::Exception(msg2);
4856 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4857 self->getArray()->divideEqual(aaa);
4858 Py_XINCREF(trueSelf);
4862 { throw INTERP_KERNEL::Exception(msg); }
4866 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4868 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.";
4869 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4872 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4874 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4878 Py_XINCREF(trueSelf);
4882 throw INTERP_KERNEL::Exception(msg);
4887 DataArrayDoubleTuple *aa;
4888 std::vector<double> bb;
4890 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4895 if(!self->getArray())
4896 throw INTERP_KERNEL::Exception(msg2);
4897 self->getArray()->applyPow(val);
4898 Py_XINCREF(trueSelf);
4903 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4906 Py_XINCREF(trueSelf);
4911 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4912 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4913 ret2->setArray(aaa);
4915 Py_XINCREF(trueSelf);
4920 if(!self->getArray())
4921 throw INTERP_KERNEL::Exception(msg2);
4922 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4923 self->getArray()->powEqual(aaa);
4924 Py_XINCREF(trueSelf);
4928 { throw INTERP_KERNEL::Exception(msg); }
4932 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4934 std::vector<const MEDCouplingFieldDouble *> tmp;
4935 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4936 return MEDCouplingFieldDouble::MergeFields(tmp);
4939 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4941 std::vector<const MEDCouplingFieldDouble *> tmp;
4942 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4943 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4946 PyObject *getTinySerializationInformation() const
4948 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4951 PyObject *serialize() const
4953 return field_serialize<double>(self);
4956 PyObject *__getstate__() const
4958 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4961 void __setstate__(PyObject *inp)
4963 field__setstate__<double>(self,inp);
4968 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4971 int getNumberOfFields() const;
4972 MEDCouplingMultiFields *deepCopy() const;
4973 virtual std::string simpleRepr() const;
4974 virtual std::string advancedRepr() const;
4975 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4976 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4977 virtual void checkConsistencyLight() const;
4980 std::string __str__() const
4982 return self->simpleRepr();
4984 static MEDCouplingMultiFields *New(PyObject *li)
4986 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4987 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4988 std::size_t sz=tmp.size();
4989 std::vector<MEDCouplingFieldDouble *> fs(sz);
4990 for(std::size_t i=0;i<sz;i++)
4991 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4992 return MEDCouplingMultiFields::New(fs);
4994 MEDCouplingMultiFields(PyObject *li)
4996 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4997 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4998 std::size_t sz=tmp.size();
4999 std::vector<MEDCouplingFieldDouble *> fs(sz);
5000 for(std::size_t i=0;i<sz;i++)
5001 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5002 return MEDCouplingMultiFields::New(fs);
5004 PyObject *getFields() const
5006 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5007 std::size_t sz=fields.size();
5008 PyObject *res = PyList_New(sz);
5009 for(std::size_t i=0;i<sz;i++)
5013 fields[i]->incrRef();
5014 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5018 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5023 PyObject *getFieldAtPos(int id) const
5025 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5029 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5032 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5034 PyObject *getMeshes() const
5036 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5037 std::size_t sz=ms.size();
5038 PyObject *res = PyList_New(sz);
5039 for(std::size_t i=0;i<sz;i++)
5044 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5048 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5053 PyObject *getDifferentMeshes() const
5055 std::vector<int> refs;
5056 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5057 std::size_t sz=ms.size();
5058 PyObject *res = PyList_New(sz);
5059 for(std::size_t i=0;i<sz;i++)
5064 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5068 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5072 PyObject *ret=PyTuple_New(2);
5073 PyTuple_SetItem(ret,0,res);
5074 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5077 PyObject *getArrays() const
5079 std::vector<DataArrayDouble *> ms=self->getArrays();
5080 std::size_t sz=ms.size();
5081 PyObject *res = PyList_New(sz);
5082 for(std::size_t i=0;i<sz;i++)
5087 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5091 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5096 PyObject *getDifferentArrays() const
5098 std::vector< std::vector<int> > refs;
5099 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5100 std::size_t sz=ms.size();
5101 PyObject *res = PyList_New(sz);
5102 PyObject *res2 = PyList_New(sz);
5103 for(std::size_t i=0;i<sz;i++)
5108 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5112 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5114 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5117 PyObject *ret=PyTuple_New(2);
5118 PyTuple_SetItem(ret,0,res);
5119 PyTuple_SetItem(ret,1,res2);
5125 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5128 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5129 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5130 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5131 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5132 void setTimeUnit(const std::string& unit);
5133 std::string getTimeUnit() const;
5134 void setTime(double val, int iteration, int order);
5135 void setArray(DataArrayInt32 *array);
5136 MEDCouplingFieldInt *deepCopy() const;
5137 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5138 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5139 MEDCouplingFieldDouble *convertToDblField() const;
5140 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5142 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5144 return MEDCouplingFieldInt::New(type,td);
5147 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5149 return MEDCouplingFieldInt::New(ft,td);
5152 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5155 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5156 PyObject *ret=PyTuple_New(2);
5157 PyObject *ret0Py=ret0?Py_True:Py_False;
5159 PyTuple_SetItem(ret,0,ret0Py);
5160 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5164 std::string __str__() const
5166 return self->simpleRepr();
5169 std::string __repr__() const
5171 std::ostringstream oss;
5172 self->reprQuickOverview(oss);
5176 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5178 return fieldT_buildSubPart(self,li);
5181 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5183 return fieldT__getitem__(self,li);
5186 DataArrayInt32 *getArray()
5188 DataArrayInt32 *ret=self->getArray();
5197 double tmp0=self->getTime(tmp1,tmp2);
5198 PyObject *res = PyList_New(3);
5199 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5200 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5201 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5205 PyObject *getTinySerializationInformation() const
5207 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5210 PyObject *serialize() const
5212 return field_serialize<int>(self);
5215 PyObject *__getstate__() const
5217 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5220 void __setstate__(PyObject *inp)
5222 field__setstate__<int>(self,inp);
5227 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5230 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5231 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5232 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5233 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5234 void setTimeUnit(const std::string& unit);
5235 std::string getTimeUnit() const;
5236 void setTime(double val, int iteration, int order);
5237 void setArray(DataArrayFloat *array);
5238 MEDCouplingFieldFloat *deepCopy() const;
5239 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5240 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5241 MEDCouplingFieldDouble *convertToDblField() const;
5242 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5244 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5246 return MEDCouplingFieldFloat::New(type,td);
5249 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5251 return MEDCouplingFieldFloat::New(ft,td);
5254 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5257 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5258 PyObject *ret=PyTuple_New(2);
5259 PyObject *ret0Py=ret0?Py_True:Py_False;
5261 PyTuple_SetItem(ret,0,ret0Py);
5262 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5266 std::string __str__() const
5268 return self->simpleRepr();
5271 std::string __repr__() const
5273 std::ostringstream oss;
5274 self->reprQuickOverview(oss);
5278 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5280 return fieldT_buildSubPart(self,li);
5283 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5285 return fieldT__getitem__(self,li);
5288 DataArrayFloat *getArray()
5290 DataArrayFloat *ret=self->getArray();
5299 double tmp0=self->getTime(tmp1,tmp2);
5300 PyObject *res = PyList_New(3);
5301 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5302 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5303 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5307 PyObject *getTinySerializationInformation() const
5309 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5312 PyObject *serialize() const
5314 return field_serialize<float>(self);
5317 PyObject *__getstate__() const
5319 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5322 void __setstate__(PyObject *inp)
5324 field__setstate__<float>(self,inp);
5329 class MEDCouplingDefinitionTime
5332 MEDCouplingDefinitionTime();
5333 void assign(const MEDCouplingDefinitionTime& other);
5334 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5335 double getTimeResolution() const;
5336 std::vector<double> getHotSpotsTime() const;
5339 std::string __str__() const
5341 std::ostringstream oss;
5342 self->appendRepr(oss);
5346 PyObject *getIdsOnTimeRight(double tm) const
5348 int meshId,arrId,arrIdInField,fieldId;
5349 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5350 PyObject *res=PyList_New(4);
5351 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5352 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5353 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5354 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5358 PyObject *getIdsOnTimeLeft(double tm) const
5360 int meshId,arrId,arrIdInField,fieldId;
5361 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5362 PyObject *res=PyList_New(4);
5363 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5364 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5365 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5366 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5372 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5375 double getTimeTolerance() const;
5376 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5380 MEDCouplingFieldOverTime(PyObject *li)
5382 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5383 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5384 std::size_t sz=tmp.size();
5385 std::vector<MEDCouplingFieldDouble *> fs(sz);
5386 for(std::size_t i=0;i<sz;i++)
5387 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5388 return MEDCouplingFieldOverTime::New(fs);
5390 std::string __str__() const
5392 return self->simpleRepr();
5394 static MEDCouplingFieldOverTime *New(PyObject *li)
5396 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5397 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5398 std::size_t sz=tmp.size();
5399 std::vector<MEDCouplingFieldDouble *> fs(sz);
5400 for(std::size_t i=0;i<sz;i++)
5401 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5402 return MEDCouplingFieldOverTime::New(fs);
5407 class MEDCouplingCartesianAMRMesh;
5409 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5412 int getNumberOfCellsRecursiveWithOverlap() const;
5413 int getNumberOfCellsRecursiveWithoutOverlap() const;
5414 int getMaxNumberOfLevelsRelativeToThis() const;
5417 MEDCouplingCartesianAMRMeshGen *getMesh() const
5419 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5427 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5430 int getNumberOfOverlapedCellsForFather() const;
5431 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5432 std::vector<mcIdType> computeCellGridSt() const;
5435 PyObject *getBLTRRange() const
5437 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5438 return convertFromVectorPairInt(ret);
5441 PyObject *getBLTRRangeRelativeToGF() const
5443 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5444 return convertFromVectorPairInt(ret);
5447 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5449 std::vector< std::pair<mcIdType,mcIdType> > inp;
5450 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5451 self->addPatch(inp,factors);
5454 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5456 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5458 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5459 if(patchId==mesh->getNumberOfPatches())
5461 std::ostringstream oss;
5462 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5463 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5466 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5472 void __delitem__(mcIdType patchId)
5474 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5476 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5477 mesh->removePatch(patchId);
5480 mcIdType __len__() const
5482 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5484 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5485 return mesh->getNumberOfPatches();
5490 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5494 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5497 mcIdType getAbsoluteLevel() const;
5498 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5499 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5500 int getSpaceDimension() const;
5501 const std::vector<mcIdType>& getFactors() const;
5502 void setFactors(const std::vector<mcIdType>& newFactors);
5503 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5504 mcIdType getNumberOfCellsAtCurrentLevel() const;
5505 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5506 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5507 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5508 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5509 virtual void detachFromFather();
5511 mcIdType getNumberOfPatches() const;
5512 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5513 MEDCouplingUMesh *buildUnstructured() const;
5514 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5515 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5516 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5517 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5518 void removeAllPatches();
5519 void removePatch(mcIdType patchId);
5520 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5521 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5522 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5523 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5524 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5525 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5526 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5527 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5528 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5529 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5530 std::string buildPythonDumpOfThis() const;
5533 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5535 std::vector< std::pair<mcIdType,mcIdType> > inp;
5536 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5537 self->addPatch(inp,factors);
5540 PyObject *getPatches() const
5542 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5543 std::size_t sz(ps.size());
5544 PyObject *ret = PyList_New(sz);
5545 for(std::size_t i=0;i<sz;i++)
5547 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5550 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5555 // agy : don't know why typemap fails here ??? let it in the extend section
5556 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5558 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5561 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5563 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5564 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5570 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5572 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5573 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5579 virtual PyObject *positionRelativeToGodFather() const
5581 std::vector<mcIdType> out1;
5582 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5583 PyObject *ret(PyTuple_New(2));
5584 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5585 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5589 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5591 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5592 std::size_t sz(ps.size());
5593 PyObject *ret = PyList_New(sz);
5594 for(std::size_t i=0;i<sz;i++)
5595 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5599 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5601 std::vector<const DataArrayDouble *> inp;
5602 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5603 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5606 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5608 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5614 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5616 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5622 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5624 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5630 MEDCouplingIMesh *getImageMesh() const
5632 const MEDCouplingIMesh *ret(self->getImageMesh());
5635 return const_cast<MEDCouplingIMesh *>(ret);
5638 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5640 if(patchId==self->getNumberOfPatches())
5642 std::ostringstream oss;
5643 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5644 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5647 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5653 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5655 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5656 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5657 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5660 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5662 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5663 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5664 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5667 void __delitem__(mcIdType patchId)
5669 self->removePatch(patchId);
5672 mcIdType __len__() const
5674 return self->getNumberOfPatches();
5679 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5683 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5686 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5689 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5691 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5692 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5693 const mcIdType *nodeStrctPtr(0);
5694 const double *originPtr(0),*dxyzPtr(0);
5695 mcIdType sw,sz,val0;
5696 std::vector<mcIdType> bb0;
5697 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5700 std::vector<double> bb,bb2;
5702 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5703 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5705 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5708 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5710 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5711 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5712 std::vector< std::vector<mcIdType> > inp2;
5713 convertPyToVectorOfVectorOfInt(factors,inp2);
5714 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5717 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5719 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5722 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5724 return MEDCouplingCartesianAMRMesh::New(mesh);
5729 class MEDCouplingDataForGodFather : public RefCountObject
5732 virtual void synchronizeFineToCoarse();
5733 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5734 virtual void synchronizeCoarseToFine();
5735 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5736 virtual void synchronizeAllGhostZones();
5737 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5738 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5739 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5740 virtual void alloc();
5741 virtual void dealloc();
5744 MEDCouplingCartesianAMRMesh *getMyGodFather()
5746 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5754 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5757 mcIdType getNumberOfLevels() const;
5758 MEDCouplingAMRAttribute *deepCopy() const;
5759 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5760 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5761 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5762 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5763 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5764 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5765 std::string writeVTHB(const std::string& fileName) const;
5768 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5770 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5771 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5772 MEDCouplingAMRAttribute *ret(0);
5775 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5776 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5778 catch(INTERP_KERNEL::Exception&)
5780 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5781 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5786 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5788 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5791 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5793 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5794 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5800 void spillInfoOnComponents(PyObject *compNames)
5802 std::vector< std::vector<std::string> > compNamesCpp;
5803 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5804 self->spillInfoOnComponents(compNamesCpp);
5807 void spillNatures(PyObject *nfs)
5809 std::vector<mcIdType> inp0;
5810 if(!fillIntVector(nfs,inp0))
5811 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5812 std::size_t sz(inp0.size());
5813 std::vector<NatureOfField> inp00(sz);
5814 for(std::size_t i=0;i<sz;i++)
5815 inp00[i]=(NatureOfField)inp0[i];
5816 self->spillNatures(inp00);
5819 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5821 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5822 std::size_t sz(ret.size());
5823 PyObject *retPy(PyList_New(sz));
5824 for(std::size_t i=0;i<sz;i++)
5825 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5831 class DenseMatrix : public RefCountObject, public TimeLabel
5834 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5835 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5836 DenseMatrix *deepCopy() const;
5837 DenseMatrix *shallowCpy() const;
5839 mcIdType getNumberOfRows() const;
5840 mcIdType getNumberOfCols() const;
5841 mcIdType getNbOfElems() const;
5842 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5843 void reShape(mcIdType nbRows, mcIdType nbCols);
5846 bool isEqual(const DenseMatrix& other, double eps) const;
5847 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5848 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5851 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5853 return DenseMatrix::New(nbRows,nbCols);
5856 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5858 return DenseMatrix::New(array,nbRows,nbCols);
5861 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5864 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5865 PyObject *ret=PyTuple_New(2);
5866 PyObject *ret0Py=ret0?Py_True:Py_False;
5868 PyTuple_SetItem(ret,0,ret0Py);
5869 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5873 DataArrayDouble *getData()
5875 DataArrayDouble *ret(self->getData());
5881 DenseMatrix *__add__(const DenseMatrix *other)
5883 return MEDCoupling::DenseMatrix::Add(self,other);
5886 DenseMatrix *__sub__(const DenseMatrix *other)
5888 return MEDCoupling::DenseMatrix::Substract(self,other);
5891 DenseMatrix *__mul__(const DenseMatrix *other)
5893 return MEDCoupling::DenseMatrix::Multiply(self,other);
5896 DenseMatrix *__mul__(const DataArrayDouble *other)
5898 return MEDCoupling::DenseMatrix::Multiply(self,other);
5901 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5903 self->addEqual(other);
5904 Py_XINCREF(trueSelf);
5908 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5910 self->substractEqual(other);
5911 Py_XINCREF(trueSelf);
5915 PyObject *toNumPyMatrix() // not const. It is not a bug !
5917 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5926 def MEDCouplingUMeshReduce(self):
5927 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5928 def MEDCouplingCMeshReduce(self):
5929 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5930 def MEDCouplingIMeshReduce(self):
5931 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5932 def MEDCouplingMappedExtrudedMeshReduce(self):
5933 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5934 def MEDCouplingCurveLinearMeshReduce(self):
5935 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5936 def MEDCoupling1SGTUMeshReduce(self):
5937 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5938 def MEDCoupling1DGTUMeshReduce(self):
5939 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5940 def MEDCouplingFieldDoubleReduce(self):
5941 self.checkConsistencyLight()
5942 d=(self.getTypeOfField(),self.getTimeDiscretization())
5943 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5944 def MEDCouplingFieldIntReduce(self):
5945 self.checkConsistencyLight()
5946 d=(self.getTypeOfField(),self.getTimeDiscretization())
5947 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5948 def MEDCouplingFieldFloatReduce(self):
5949 self.checkConsistencyLight()
5950 d=(self.getTypeOfField(),self.getTimeDiscretization())
5951 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5952 def MEDCouplingFTReduceFunct(cls,params):
5954 ret=object.__new__(cls)
5958 def MEDCouplingFieldTemplateReduce(self):
5959 ret = MEDCouplingFieldDouble(self)
5960 nbTuples = self.getNumberOfTuplesExpected()
5961 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5963 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5965 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5967 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5968 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5969 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5970 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5971 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5972 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5973 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5979 __filename=os.environ.get('PYTHONSTARTUP')
5980 if __filename and os.path.isfile(__filename):
5981 with open(__filename) as __fp: