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(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
533 PyObject *ret(PyList_New(sz));
534 for(Py_ssize_t i=0;i<sz;i++)
536 mcIdType elt = MEDCOUPLING2VTKTYPETRADUCER[i]!=255 ? MEDCOUPLING2VTKTYPETRADUCER[i] : -1;
537 PyList_SetItem(ret,i,PyInt_FromLong(elt));
542 PyObject *vtk2med_cell_types()
544 Py_ssize_t sz(sizeof(MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCOUPLING2VTKTYPETRADUCER[0])));
545 auto maxElt(*std::max_element(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+sz,[](unsigned char a, unsigned char b) { if(b==MEDCOUPLING2VTKTYPETRADUCER_NONE) return false; else return a<b; } ));
546 auto szOut(maxElt+1);
547 std::vector< mcIdType > retCpp(szOut,-1);
549 for(const unsigned char *it=MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
551 if(*it!=MEDCOUPLING2VTKTYPETRADUCER_NONE)
555 PyObject *ret(PyList_New(szOut));
557 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
558 PyList_SetItem(ret,id,PyInt_FromLong(*it));
563 namespace INTERP_KERNEL
566 * \class BoxSplittingOptions
567 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
569 class BoxSplittingOptions
572 BoxSplittingOptions();
574 double getEfficiencyGoal() const;
575 void setEfficiencyGoal(double efficiency);
576 double getEfficiencyThreshold() const;
577 void setEfficiencyThreshold(double efficiencyThreshold);
578 int getMinimumPatchLength() const;
579 void setMinimumPatchLength(int minPatchLength);
580 int getMaximumPatchLength() const;
581 void setMaximumPatchLength(int maxPatchLength);
582 int getMaximumNbOfCellsInPatch() const;
583 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
584 void copyOptions(const BoxSplittingOptions & other);
585 std::string printOptions() const;
588 std::string __str__() const
590 return self->printOptions();
596 namespace MEDCoupling
612 CONST_ON_TIME_INTERVAL = 7
613 } TypeOfTimeDiscretization;
621 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
622 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
624 } MEDCouplingMeshType;
626 class DataArrayInt32;
627 class DataArrayInt64;
628 class DataArrayDouble;
629 class MEDCouplingUMesh;
630 class MEDCouplingCMesh;
631 class MEDCouplingFieldDouble;
633 %extend RefCountObject
635 std::string getHiddenCppPointer() const
637 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
642 %extend MEDCouplingGaussLocalization
644 std::string __str__() const
646 return self->getStringRepr();
649 std::string __repr__() const
651 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
652 oss << self->getStringRepr();
659 class MEDCouplingMesh : public RefCountObject, public TimeLabel
662 void setName(const std::string& name);
663 std::string getName() const;
664 void setDescription(const std::string& descr);
665 std::string getDescription() const;
666 void setTime(double val, int iteration, int order);
667 void setTimeUnit(const std::string& unit);
668 std::string getTimeUnit() const;
669 virtual MEDCouplingMeshType getType() const;
670 bool isStructured() const;
671 virtual MEDCouplingMesh *deepCopy() const;
672 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
673 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
674 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
675 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
676 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
677 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
678 virtual void checkConsistencyLight() const;
679 virtual void checkConsistency(double eps=1e-12) const;
680 virtual int getNumberOfCells() const;
681 virtual int getNumberOfNodes() const;
682 virtual int getSpaceDimension() const;
683 virtual int getMeshDimension() const;
684 virtual DataArrayDouble *getCoordinatesAndOwner() const;
685 virtual DataArrayDouble *computeCellCenterOfMass() const;
686 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
687 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
688 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
689 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
690 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
691 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
692 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
693 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
694 virtual std::string simpleRepr() const;
695 virtual std::string advancedRepr() const;
696 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
697 virtual std::string getVTKFileExtension() const;
698 std::string getVTKFileNameOf(const std::string& fileName) const;
700 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
701 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
702 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
703 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
704 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
705 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
706 virtual MEDCouplingUMesh *buildUnstructured() const;
707 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
708 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
709 virtual DataArrayIdType *simplexize(int policy);
710 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
711 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
712 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
713 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
714 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
715 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
716 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
717 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
720 std::string __str__() const
722 return self->simpleRepr();
728 double tmp0=self->getTime(tmp1,tmp2);
729 PyObject *res = PyList_New(3);
730 PyList_SetItem(res,0,SWIG_From_double(tmp0));
731 PyList_SetItem(res,1,SWIG_From_int(tmp1));
732 PyList_SetItem(res,2,SWIG_From_int(tmp2));
736 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
738 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
739 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
745 mcIdType getCellContainingPoint(PyObject *p, double eps) const
749 DataArrayDoubleTuple *aa;
750 std::vector<double> bb;
752 int spaceDim=self->getSpaceDimension();
753 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
754 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
755 return self->getCellContainingPoint(pos,eps);
758 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
762 DataArrayDoubleTuple *aa;
763 std::vector<double> bb;
765 int spaceDim=self->getSpaceDimension();
766 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
767 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
768 MCAuto<DataArrayIdType> elts,eltsIndex;
769 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
770 PyObject *ret=PyTuple_New(2);
771 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
772 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
776 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
780 DataArrayDoubleTuple *aa;
781 std::vector<double> bb;
783 int spaceDim=self->getSpaceDimension();
784 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
785 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
786 MCAuto<DataArrayIdType> elts,eltsIndex;
787 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
788 PyObject *ret=PyTuple_New(2);
789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
794 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
796 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
797 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
800 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
802 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
803 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
806 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
810 DataArrayDoubleTuple *aa;
811 std::vector<double> bb;
813 int spaceDim=self->getSpaceDimension();
814 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
815 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
816 std::vector<mcIdType> elts;
817 self->getCellsContainingPoint(pos,eps,elts);
818 DataArrayIdType *ret=DataArrayIdType::New();
819 ret->alloc((int)elts.size(),1);
820 std::copy(elts.begin(),elts.end(),ret->getPointer());
821 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
824 virtual PyObject *getReverseNodalConnectivity() const
826 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
827 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
828 self->getReverseNodalConnectivity(d0,d1);
829 PyObject *ret=PyTuple_New(2);
830 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
831 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
835 void renumberCells(PyObject *li, bool check=true)
838 mcIdType v0; std::vector<mcIdType> v1;
839 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
840 self->renumberCells(ids,check);
843 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
845 DataArrayIdType *cellCor, *nodeCor;
846 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
847 PyObject *res = PyList_New(2);
848 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
849 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
853 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
855 DataArrayIdType *cellCor=0,*nodeCor=0;
856 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
857 PyObject *res = PyList_New(2);
858 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
859 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
863 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
865 DataArrayIdType *cellCor=0;
866 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
870 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
873 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
874 if (!SWIG_IsOK(res1))
877 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
878 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
882 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
884 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
885 da2->checkAllocated();
886 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
889 PyObject *getNodeIdsOfCell(int cellId) const
891 std::vector<mcIdType> conn;
892 self->getNodeIdsOfCell(cellId,conn);
893 return convertIntArrToPyList2(conn);
896 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
898 std::vector<double> coo;
899 self->getCoordinatesOfNode(nodeId,coo);
900 return convertDblArrToPyList2(coo);
903 void scale(PyObject *point, double factor)
907 DataArrayDoubleTuple *aa;
908 std::vector<double> bb;
910 int spaceDim=self->getSpaceDimension();
911 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
912 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
913 self->scale(pointPtr,factor);
916 PyObject *getBoundingBox() const
918 int spaceDim=self->getSpaceDimension();
919 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
920 self->getBoundingBox(tmp);
921 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
925 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
928 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
929 PyObject *ret=PyTuple_New(2);
930 PyObject *ret0Py=ret0?Py_True:Py_False;
932 PyTuple_SetItem(ret,0,ret0Py);
933 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
937 PyObject *buildPart(PyObject *li) const
939 mcIdType szArr,sw,iTypppArr;
940 std::vector<mcIdType> stdvecTyyppArr;
941 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
942 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
943 if(sw==3)//DataArrayIdType
945 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
946 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
947 std::string name=argpt->getName();
949 ret->setName(name.c_str());
951 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
954 PyObject *buildPartAndReduceNodes(PyObject *li) const
956 mcIdType szArr,sw,iTypppArr;
957 std::vector<mcIdType> stdvecTyyppArr;
958 DataArrayIdType *arr=0;
959 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
960 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
961 if(sw==3)//DataArrayIdType
963 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
964 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
965 std::string name=argpt->getName();
967 ret->setName(name.c_str());
970 PyObject *res = PyList_New(2);
971 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
972 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
973 PyList_SetItem(res,0,obj0);
974 PyList_SetItem(res,1,obj1);
978 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
981 DataArrayIdType *arr=0;
982 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
983 PyObject *res = PyTuple_New(2);
984 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
987 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
989 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
990 PyTuple_SetItem(res,0,obj0);
991 PyTuple_SetItem(res,1,obj1);
995 PyObject *getDistributionOfTypes() const
997 std::vector<mcIdType> vals=self->getDistributionOfTypes();
999 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1000 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1001 for(std::size_t j=0;j<vals.size()/3;j++)
1003 PyObject *ret1=PyList_New(3);
1004 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1005 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1006 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1007 PyList_SetItem(ret,j,ret1);
1012 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1014 std::vector<mcIdType> code;
1015 std::vector<const DataArrayIdType *> idsPerType;
1016 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1017 convertPyToNewIntArr4(li,1,3,code);
1018 return self->checkTypeConsistencyAndContig(code,idsPerType);
1021 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1023 std::vector<mcIdType> code;
1024 std::vector<DataArrayIdType *> idsInPflPerType;
1025 std::vector<DataArrayIdType *> idsPerType;
1026 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1027 PyObject *ret=PyTuple_New(3);
1029 if(code.size()%3!=0)
1030 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1031 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1032 for(std::size_t j=0;j<code.size()/3;j++)
1034 PyObject *ret00=PyList_New(3);
1035 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1036 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1037 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1038 PyList_SetItem(ret0,j,ret00);
1040 PyTuple_SetItem(ret,0,ret0);
1042 PyObject *ret1=PyList_New(idsInPflPerType.size());
1043 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1044 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1045 PyTuple_SetItem(ret,1,ret1);
1046 std::size_t n=idsPerType.size();
1047 PyObject *ret2=PyList_New(n);
1048 for(std::size_t i=0;i<n;i++)
1049 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1050 PyTuple_SetItem(ret,2,ret2);
1054 void translate(PyObject *vector)
1058 DataArrayDoubleTuple *aa;
1059 std::vector<double> bb;
1061 int spaceDim=self->getSpaceDimension();
1062 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1063 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1064 self->translate(vectorPtr);
1067 void rotate(PyObject *center, double alpha)
1069 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1072 DataArrayDoubleTuple *aa;
1073 std::vector<double> bb;
1075 int spaceDim=self->getSpaceDimension();
1076 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1077 self->rotate(centerPtr,0,alpha);
1080 void rotate(PyObject *center, PyObject *vector, double alpha)
1082 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1084 DataArrayDouble *a,*a2;
1085 DataArrayDoubleTuple *aa,*aa2;
1086 std::vector<double> bb,bb2;
1088 int spaceDim=self->getSpaceDimension();
1089 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1090 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
1091 self->rotate(centerPtr,vectorPtr,alpha);
1094 PyObject *getAllGeoTypes() const
1096 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1097 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1098 PyObject *res=PyList_New(result.size());
1099 for(int i=0;iL!=result.end(); i++, iL++)
1100 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1104 virtual PyObject *getTinySerializationInformation() const
1106 std::vector<double> a0;
1107 std::vector<mcIdType> a1;
1108 std::vector<std::string> a2;
1109 self->getTinySerializationInformation(a0,a1,a2);
1110 PyObject *ret(PyTuple_New(3));
1111 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1112 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1113 std::size_t sz(a2.size());
1114 PyObject *ret2(PyList_New(sz));
1116 for(std::size_t i=0;i<sz;i++)
1117 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1119 PyTuple_SetItem(ret,2,ret2);
1123 virtual PyObject *serialize() const
1125 DataArrayIdType *a0Tmp(0);
1126 DataArrayDouble *a1Tmp(0);
1127 self->serialize(a0Tmp,a1Tmp);
1128 PyObject *ret(PyTuple_New(2));
1129 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1130 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1134 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1136 std::vector<std::string> littleStrings;
1137 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1140 PyObject *__getstate__() const
1142 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1143 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1144 PyObject *ret(PyTuple_New(2));
1145 PyTuple_SetItem(ret,0,ret0);
1146 PyTuple_SetItem(ret,1,ret1);
1150 void __setstate__(PyObject *inp)
1152 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1153 if(!PyTuple_Check(inp))
1154 throw INTERP_KERNEL::Exception(MSG);
1155 std::size_t sz(PyTuple_Size(inp));
1157 throw INTERP_KERNEL::Exception(MSG);
1158 PyObject *elt0(PyTuple_GetItem(inp,0));
1159 PyObject *elt1(PyTuple_GetItem(inp,1));
1160 std::vector<double> a0;
1161 std::vector<mcIdType> a1;
1162 std::vector<std::string> a2;
1163 DataArrayIdType *b0(0);
1164 DataArrayDouble *b1(0);
1166 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1167 throw INTERP_KERNEL::Exception(MSG);
1168 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1170 fillArrayWithPyListDbl3(a0py,tmp,a0);
1171 convertPyToNewIntArr3(a1py,a1);
1172 fillStringVector(a2py,a2);
1175 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1176 throw INTERP_KERNEL::Exception(MSG);
1177 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1179 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1180 if(!SWIG_IsOK(status))
1181 throw INTERP_KERNEL::Exception(MSG);
1182 b0=reinterpret_cast<DataArrayIdType *>(argp);
1183 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1184 if(!SWIG_IsOK(status))
1185 throw INTERP_KERNEL::Exception(MSG);
1186 b1=reinterpret_cast<DataArrayDouble *>(argp);
1188 // useless here to call resizeForUnserialization because arrays are well resized.
1189 self->unserialization(a0,a1,b0,b1,a2);
1192 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1194 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1195 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1196 return MEDCouplingMesh::MergeMeshes(tmp);
1202 //== MEDCouplingMesh End
1204 %include "NormalizedGeometricTypes"
1205 %include "MEDCouplingNatureOfFieldEnum"
1207 namespace MEDCoupling
1209 class MEDCouplingNatureOfField
1212 static const char *GetRepr(NatureOfField nat);
1213 static std::string GetReprNoThrow(NatureOfField nat);
1214 static std::string GetAllPossibilitiesStr();
1218 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1219 // include "MEDCouplingTimeDiscretization.i"
1221 namespace MEDCoupling
1223 class MEDCouplingGaussLocalization
1226 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1227 const std::vector<double>& gsCoo, const std::vector<double>& w);
1228 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1229 INTERP_KERNEL::NormalizedCellType getType() const;
1230 void setType(INTERP_KERNEL::NormalizedCellType typ);
1231 int getNumberOfGaussPt() const;
1232 int getDimension() const;
1233 int getNumberOfPtsInRefCell() const;
1234 std::string getStringRepr() const;
1235 void checkConsistencyLight() const;
1236 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1238 const std::vector<double>& getRefCoords() const;
1239 double getRefCoord(int ptIdInCell, int comp) const;
1240 const std::vector<double>& getGaussCoords() const;
1241 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1242 const std::vector<double>& getWeights() const;
1243 double getWeight(int gaussPtIdInCell, double newVal) const;
1244 void setRefCoord(int ptIdInCell, int comp, double newVal);
1245 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1246 void setWeight(int gaussPtIdInCell, double newVal);
1247 void setRefCoords(const std::vector<double>& refCoo);
1248 void setGaussCoords(const std::vector<double>& gsCoo);
1249 void setWeights(const std::vector<double>& w);
1251 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1255 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1257 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1261 MEDCouplingUMesh *buildRefCell() const
1263 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1269 class MEDCouplingSkyLineArray
1272 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1274 void set( DataArrayIdType* index, DataArrayIdType* value );
1275 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1277 int getSuperNumberOf() const;
1278 int getNumberOf() const;
1279 int getLength() const;
1281 void deletePack(const int i, const int j);
1283 void deleteSimplePack(const int i);
1284 void deleteSimplePacks(const DataArrayIdType* idx);
1288 MEDCouplingSkyLineArray()
1290 return MEDCouplingSkyLineArray::New();
1293 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1295 return MEDCouplingSkyLineArray::New(index, value);
1298 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1300 return MEDCouplingSkyLineArray::New(index, value);
1303 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1305 return MEDCouplingSkyLineArray::New(other);
1308 std::string __str__() const
1310 return self->simpleRepr();
1313 DataArrayIdType *getSuperIndexArray() const
1315 DataArrayIdType *ret(self->getSuperIndexArray());
1321 DataArrayIdType *getIndexArray() const
1323 DataArrayIdType *ret(self->getIndexArray());
1329 DataArrayIdType *getValuesArray() const
1331 DataArrayIdType *ret(self->getValuesArray());
1337 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1339 std::vector<mcIdType> ret;
1340 self->getSimplePackSafe(absolutePackId,ret);
1341 return convertIntArrToPyList2(ret);
1344 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1346 std::vector<mcIdType> vpack, vspIdx, out;
1348 convertPyToNewIntArr3(superPackIndices,vspIdx);
1349 convertPyToNewIntArr3(pack,vpack);
1351 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1352 return convertIntArrToPyList2(out);
1355 void pushBackPack(const mcIdType i, PyObject *pack)
1357 std::vector<mcIdType> vpack;
1358 convertPyToNewIntArr3(pack,vpack);
1359 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1362 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1364 std::vector<mcIdType> vpack;
1365 convertPyToNewIntArr3(pack,vpack);
1366 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1369 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1371 std::vector<const DataArrayIdType*> packs;
1372 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1373 self->replaceSimplePacks(idx, packs);
1376 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1378 std::vector<mcIdType> vpack;
1379 convertPyToNewIntArr3(pack,vpack);
1380 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1383 PyObject *convertToPolyhedronConn() const
1385 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1386 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1387 self->convertToPolyhedronConn(d0,d1);
1388 PyObject *ret=PyTuple_New(2);
1389 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1390 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1397 %include "MEDCouplingFieldDiscretization.i"
1399 //== MEDCouplingPointSet
1401 namespace MEDCoupling
1403 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1406 void setCoords(const DataArrayDouble *coords);
1407 DataArrayDouble *getCoordinatesAndOwner() const;
1408 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1410 double getCaracteristicDimension() const;
1411 void recenterForMaxPrecision(double eps);
1412 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1413 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1414 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1415 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1416 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1417 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1418 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1419 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1420 virtual DataArrayIdType *computeFetchedNodeIds() const;
1421 virtual int getNumberOfNodesInCell(int cellId) const;
1422 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1423 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1424 virtual DataArrayIdType *zipCoordsTraducer();
1425 virtual DataArrayIdType *findBoundaryNodes() const;
1426 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1427 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1428 virtual void checkFullyDefined() const;
1429 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1430 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1431 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1432 virtual void renumberNodesWithOffsetInConn(int offset);
1433 virtual bool areAllNodesFetched() const;
1434 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1435 virtual void invertOrientationOfAllCells();
1438 std::string __str__() const
1440 return self->simpleRepr();
1443 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1445 mcIdType newNbOfNodes;
1446 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1447 PyObject *res = PyList_New(2);
1448 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1449 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1453 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1455 DataArrayIdType *comm, *commIndex;
1456 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1457 PyObject *res = PyList_New(2);
1458 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1459 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1463 PyObject *getCoords()
1465 DataArrayDouble *ret1=self->getCoords();
1468 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1471 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1473 mcIdType szArr,sw,iTypppArr;
1474 std::vector<mcIdType> stdvecTyyppArr;
1475 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1476 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1477 if(sw==3)//DataArrayIdType
1479 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1480 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1481 std::string name=argpt->getName();
1483 ret->setName(name.c_str());
1485 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1488 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1490 mcIdType szArr,sw,iTypppArr;
1491 std::vector<mcIdType> stdvecTyyppArr;
1492 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1493 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1494 if(sw==3)//DataArrayIdType
1496 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1497 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1498 std::string name=argpt->getName();
1500 ret->setName(name.c_str());
1502 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1505 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1507 mcIdType szArr,sw,iTypppArr;
1508 std::vector<mcIdType> stdvecTyyppArr;
1509 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1510 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1511 if(sw==3)//DataArrayIdType
1513 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1514 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1515 std::string name=argpt->getName();
1517 ret->setName(name.c_str());
1519 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1522 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1524 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1525 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1528 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1530 mcIdType szArr,sw,iTypppArr;
1531 std::vector<mcIdType> stdvecTyyppArr;
1532 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1533 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1534 if(sw==3)//DataArrayIdType
1536 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1537 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1538 std::string name=argpt->getName();
1540 ret->setName(name.c_str());
1542 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1545 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1547 mcIdType szArr,sw,iTypppArr;
1548 std::vector<mcIdType> stdvecTyyppArr;
1549 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1550 self->renumberNodes(tmp,newNbOfNodes);
1553 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1555 mcIdType szArr,sw,iTypppArr;
1556 std::vector<mcIdType> stdvecTyyppArr;
1557 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1558 self->renumberNodesCenter(tmp,newNbOfNodes);
1561 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1563 int spaceDim=self->getSpaceDimension();
1565 DataArrayDouble *a,*a2;
1566 DataArrayDoubleTuple *aa,*aa2;
1567 std::vector<double> bb,bb2;
1569 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1570 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1571 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1572 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1573 std::vector<mcIdType> nodes;
1574 self->findNodesOnLine(p,v,eps,nodes);
1575 DataArrayIdType *ret=DataArrayIdType::New();
1576 ret->alloc(nodes.size(),1);
1577 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1578 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1580 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1582 int spaceDim=self->getSpaceDimension();
1584 DataArrayDouble *a,*a2;
1585 DataArrayDoubleTuple *aa,*aa2;
1586 std::vector<double> bb,bb2;
1588 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1589 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1590 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1591 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1592 std::vector<mcIdType> nodes;
1593 self->findNodesOnPlane(p,v,eps,nodes);
1594 DataArrayIdType *ret=DataArrayIdType::New();
1595 ret->alloc(nodes.size(),1);
1596 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1600 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1604 DataArrayDoubleTuple *aa;
1605 std::vector<double> bb;
1607 int spaceDim=self->getSpaceDimension();
1608 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1609 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1610 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1611 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1614 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1616 DataArrayIdType *c=0,*cI=0;
1620 DataArrayDoubleTuple *aa;
1621 std::vector<double> bb;
1623 int spaceDim=self->getSpaceDimension();
1624 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1625 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1626 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1627 PyObject *ret=PyTuple_New(2);
1628 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1629 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1633 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1635 DataArrayIdType *c=0,*cI=0;
1636 int spaceDim=self->getSpaceDimension();
1639 DataArrayDoubleTuple *aa;
1640 std::vector<double> bb;
1642 mcIdType nbOfTuples=-1;
1643 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1644 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1646 PyObject *ret=PyTuple_New(2);
1647 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1648 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1652 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1656 DataArrayDoubleTuple *aa;
1657 std::vector<double> bb;
1659 int spaceDim=self->getSpaceDimension();
1660 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1661 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1663 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1664 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1667 void duplicateNodesInCoords(PyObject *li)
1671 std::vector<mcIdType> multiVal;
1672 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1673 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1674 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1678 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1680 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1682 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1684 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1688 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1690 DataArrayIdType *v0(nullptr),*v1(nullptr);
1691 self->findCommonCells(compType,startCellId,v0,v1);
1692 PyObject *res = PyList_New(2);
1693 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1694 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1699 virtual void renumberNodesInConn(PyObject *li)
1703 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1706 MapII *da2(reinterpret_cast<MapII *>(da));
1707 self->renumberNodesInConn(da2->data());
1711 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1712 if (!SWIG_IsOK(res1))
1715 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1716 self->renumberNodesInConn(tmp);
1720 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1722 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1723 da2->checkAllocated();
1724 self->renumberNodesInConn(da2->getConstPointer());
1728 virtual PyObject *getNodeIdsInUse() const
1731 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1732 PyObject *ret=PyTuple_New(2);
1733 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1734 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1738 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1740 DataArrayIdType *ret(nullptr);
1742 mcIdType szArr,sw,iTypppArr;
1743 std::vector<mcIdType> stdvecTyyppArr;
1744 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1745 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1749 virtual PyObject *mergeNodes(double precision)
1753 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1754 PyObject *res = PyList_New(3);
1755 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1756 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1757 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1761 virtual PyObject *mergeNodesCenter(double precision)
1765 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1766 PyObject *res = PyList_New(3);
1767 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1768 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1769 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1773 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1776 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1777 if (!SWIG_IsOK(res1))
1780 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1781 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1785 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1787 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1788 da2->checkAllocated();
1789 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1793 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1797 std::vector<mcIdType> multiVal;
1798 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1799 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1800 mcIdType nbc=self->getNumberOfCells();
1801 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1808 std::ostringstream oss;
1809 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1810 throw INTERP_KERNEL::Exception(oss.str().c_str());
1813 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1818 mcIdType tmp=nbc+singleVal;
1819 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1823 std::ostringstream oss;
1824 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1825 throw INTERP_KERNEL::Exception(oss.str().c_str());
1831 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1835 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1840 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1841 daIntTyypp->checkAllocated();
1842 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1845 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1849 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1852 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1853 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1854 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1855 for(mcIdType i=0;i<sz;i++)
1856 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1859 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1862 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1863 mcIdType sw,nbNodes=0;
1864 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1865 std::vector<double> val3;
1866 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1867 "Rotate2DAlg",2,true,nbNodes);
1869 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1870 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1873 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1876 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1877 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1878 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1879 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1880 for(mcIdType i=0;i<sz;i++)
1881 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1884 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1887 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1888 mcIdType sw,nbNodes=0;
1889 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1890 std::vector<double> val3;
1891 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1892 "Rotate3DAlg",3,true,nbNodes);
1894 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1895 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1896 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1901 //== MEDCouplingPointSet End
1903 class MEDCouplingUMeshCell
1906 INTERP_KERNEL::NormalizedCellType getType() const;
1909 std::string __str__() const
1911 return self->repr();
1914 PyObject *getAllConn() const
1917 const mcIdType *r=self->getAllConn(ret2);
1918 PyObject *ret=PyTuple_New(ret2);
1919 for(mcIdType i=0;i<ret2;i++)
1920 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1926 class MEDCouplingUMeshCellIterator
1933 MEDCouplingUMeshCell *ret=self->nextt();
1935 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1938 PyErr_SetString(PyExc_StopIteration,"No more data.");
1945 class MEDCouplingUMeshCellByTypeIterator
1948 ~MEDCouplingUMeshCellByTypeIterator();
1953 MEDCouplingUMeshCellEntry *ret=self->nextt();
1955 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1958 PyErr_SetString(PyExc_StopIteration,"No more data.");
1965 class MEDCouplingUMeshCellByTypeEntry
1968 ~MEDCouplingUMeshCellByTypeEntry();
1971 MEDCouplingUMeshCellByTypeIterator *__iter__()
1973 return self->iterator();
1978 class MEDCouplingUMeshCellEntry
1981 INTERP_KERNEL::NormalizedCellType getType() const;
1982 int getNumberOfElems() const;
1985 MEDCouplingUMeshCellIterator *__iter__()
1987 return self->iterator();
1992 //== MEDCouplingUMesh
1994 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
1997 static MEDCouplingUMesh *New();
1998 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
1999 void checkConsistencyLight() const;
2000 void setMeshDimension(int meshDim);
2001 void allocateCells(int nbOfCells=0);
2002 void finishInsertingCells();
2003 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2004 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2005 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2006 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2007 int getNodalConnectivityArrayLen() const;
2008 void computeTypes();
2009 std::string reprConnectivityOfThis() const;
2010 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2012 DataArrayIdType *conformize2D(double eps);
2013 DataArrayIdType *conformize3D(double eps);
2014 DataArrayIdType *colinearize2D(double eps);
2015 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2016 void shiftNodeNumbersInConn(int delta);
2017 std::vector<bool> getQuadraticStatus() const;
2018 DataArrayIdType *findCellIdsOnBoundary() const;
2019 MEDCouplingUMesh *computeSkin() const;
2020 bool checkConsecutiveCellTypes() const;
2021 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2022 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2023 DataArrayIdType *sortCellsInMEDFileFrmt();
2024 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2025 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2026 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2027 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2028 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2029 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2030 void orientCorrectlyPolyhedrons();
2031 bool isPresenceOfQuadratic() const;
2032 bool isFullyQuadratic() const;
2033 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2034 bool isContiguous1D() const;
2035 void tessellate2D(double eps);
2036 void convertQuadraticCellsToLinear();
2037 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2038 void convertDegeneratedCells();
2039 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2040 bool removeDegenerated1DCells();
2041 bool areOnlySimplexCells() const;
2042 MEDCouplingFieldDouble *getEdgeRatioField() const;
2043 MEDCouplingFieldDouble *getAspectRatioField() const;
2044 MEDCouplingFieldDouble *getWarpField() const;
2045 MEDCouplingFieldDouble *getSkewField() const;
2046 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2047 DataArrayIdType *convexEnvelop2D();
2048 std::string cppRepr() const;
2049 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2050 DataArrayIdType *findAndCorrectBadOriented3DCells();
2051 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2052 MEDCouplingSkyLineArray *generateGraph() const;
2053 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2054 DataArrayIdType *buildUnionOf2DMesh() const;
2055 DataArrayIdType *buildUnionOf3DMesh() const;
2056 DataArrayIdType *orderConsecutiveCells1D() const;
2057 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2058 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2059 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2060 void changeOrientationOfCells();
2061 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2062 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2063 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2064 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2065 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2066 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2067 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2071 return MEDCouplingUMesh::New();
2074 MEDCouplingUMesh(const char *meshName, int meshDim)
2076 return MEDCouplingUMesh::New(meshName,meshDim);
2079 std::string __str__() const
2081 return self->simpleRepr();
2084 std::string __repr__() const
2086 std::ostringstream oss;
2087 self->reprQuickOverview(oss);
2091 MEDCouplingUMeshCellIterator *__iter__()
2093 return self->cellIterator();
2096 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2098 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2102 PyObject *getAllGeoTypesSorted() const
2104 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2105 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2106 PyObject *res=PyList_New(result.size());
2107 for(int i=0;iL!=result.end(); i++, iL++)
2108 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2112 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2116 std::vector<mcIdType> multiVal;
2117 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2118 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2119 mcIdType nbc=self->getNumberOfCells();
2120 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2127 std::ostringstream oss;
2128 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2129 throw INTERP_KERNEL::Exception(oss.str().c_str());
2133 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2140 mcIdType tmp=nbc+singleVal;
2141 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2146 std::ostringstream oss;
2147 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2148 throw INTERP_KERNEL::Exception(oss.str().c_str());
2154 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2160 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2161 daIntTyypp->checkAllocated();
2162 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2166 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2170 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2174 std::vector<mcIdType> multiVal;
2175 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2176 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2177 mcIdType nbc=self->getNumberOfCells();
2178 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2185 std::ostringstream oss;
2186 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2187 throw INTERP_KERNEL::Exception(oss.str().c_str());
2191 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2198 mcIdType tmp=nbc+singleVal;
2199 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2204 std::ostringstream oss;
2205 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2206 throw INTERP_KERNEL::Exception(oss.str().c_str());
2212 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2217 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2223 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2224 daIntTyypp->checkAllocated();
2225 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2229 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2233 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2235 mcIdType szArr,sw,iTypppArr;
2236 std::vector<mcIdType> stdvecTyyppArr;
2237 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2240 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2241 throw INTERP_KERNEL::Exception(oss.str().c_str());
2243 self->insertNextCell(type,size,tmp);
2246 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2248 mcIdType szArr,sw,iTypppArr;
2249 std::vector<mcIdType> stdvecTyyppArr;
2250 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2251 self->insertNextCell(type,szArr,tmp);
2254 DataArrayIdType *getNodalConnectivity()
2256 DataArrayIdType *ret=self->getNodalConnectivity();
2261 DataArrayIdType *getNodalConnectivityIndex()
2263 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2269 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2271 mcIdType szArr,sw,iTypppArr;
2272 std::vector<mcIdType> stdvecTyyppArr;
2273 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2274 mcIdType nbOfDepthPeelingPerformed=0;
2275 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2276 PyObject *res=PyTuple_New(2);
2277 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2278 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2282 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2284 DataArrayIdType *v0=0,*v1=0;
2285 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2286 PyObject *res = PyList_New(2);
2287 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2288 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2292 PyObject *distanceToPoint(PyObject *point) const
2296 DataArrayDoubleTuple *aa;
2297 std::vector<double> bb;
2299 int nbOfCompo=self->getSpaceDimension();
2300 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2303 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2304 PyObject *ret=PyTuple_New(2);
2305 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2306 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2310 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2312 DataArrayIdType *ret1=0;
2313 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2314 PyObject *ret=PyTuple_New(2);
2315 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2316 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2320 PyObject *tetrahedrize(int policy)
2323 DataArrayIdType *ret1(0);
2324 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2325 PyObject *ret=PyTuple_New(3);
2326 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2328 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2332 PyObject *checkButterflyCells(double eps=1e-12)
2334 std::vector<mcIdType> cells;
2335 self->checkButterflyCells(cells,eps);
2336 DataArrayIdType *ret=DataArrayIdType::New();
2337 ret->alloc(cells.size(),1);
2338 std::copy(cells.begin(),cells.end(),ret->getPointer());
2339 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2342 PyObject *splitByType() const
2344 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2345 std::size_t sz=ms.size();
2346 PyObject *ret = PyList_New(sz);
2347 for(std::size_t i=0;i<sz;i++)
2348 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2352 PyObject *partitionBySpreadZone() const
2354 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2355 std::size_t sz=retCpp.size();
2356 PyObject *ret=PyList_New(sz);
2357 for(std::size_t i=0;i<sz;i++)
2358 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2362 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2364 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2365 std::size_t sz=retCpp.size();
2366 PyObject *ret=PyList_New(sz);
2367 for(std::size_t i=0;i<sz;i++)
2368 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2372 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2375 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2376 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2380 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2383 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2384 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2388 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2391 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2392 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2396 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2398 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2399 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2400 PyObject *ret=PyTuple_New(3);
2401 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2402 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2403 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2407 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2409 DataArrayIdType *tmp0=0,*tmp1=0;
2410 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2411 PyObject *ret=PyTuple_New(2);
2412 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2413 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2417 void duplicateNodes(PyObject *li)
2421 std::vector<mcIdType> multiVal;
2422 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2423 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2424 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2428 return self->duplicateNodes(&singleVal,&singleVal+1);
2430 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2432 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2434 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2438 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2442 std::vector<mcIdType> multiVal;
2443 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2444 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2445 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2449 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2451 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2453 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2455 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2459 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2461 mcIdType szArr,sw,iTypppArr;
2462 std::vector<mcIdType> stdvecTyyppArr;
2463 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2464 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2467 PyObject *getLevArrPerCellTypes(PyObject *li) const
2470 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2471 DataArrayIdType *tmp0,*tmp1=0;
2472 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2473 PyObject *ret=PyTuple_New(2);
2474 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2475 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2479 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2481 DataArrayIdType *ret0=0,*ret1=0;
2482 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2483 PyObject *ret=PyTuple_New(2);
2484 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2485 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2489 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2491 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2492 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2493 DataArrayIdType *ret1=0,*ret2=0;
2494 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2495 PyObject *ret=PyTuple_New(3);
2496 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2497 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2498 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2502 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2504 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2505 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2506 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2507 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2510 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2513 std::vector<const MEDCouplingUMesh *> meshes;
2514 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2515 std::vector<DataArrayIdType *> corr;
2516 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2518 PyObject *ret1=PyList_New(sz);
2519 for(std::size_t i=0;i<sz;i++)
2520 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2521 PyObject *ret=PyList_New(2);
2522 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2523 PyList_SetItem(ret,1,ret1);
2527 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2529 std::vector<MEDCouplingUMesh *> meshes;
2530 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2531 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2534 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2536 std::vector<MEDCouplingUMesh *> meshes;
2537 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2538 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2541 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2545 DataArrayDoubleTuple *aa;
2546 std::vector<double> bb;
2548 int spaceDim=self->getSpaceDimension();
2549 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2550 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2552 std::vector<mcIdType> cells;
2553 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2554 DataArrayIdType *ret=DataArrayIdType::New();
2555 ret->alloc(cells.size(),1);
2556 std::copy(cells.begin(),cells.end(),ret->getPointer());
2557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2560 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2564 DataArrayDoubleTuple *aa;
2565 std::vector<double> bb;
2567 int spaceDim=self->getSpaceDimension();
2568 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2569 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2570 self->orientCorrectly2DCells(v,polyOnly);
2573 PyObject *arePolyhedronsNotCorrectlyOriented() const
2575 std::vector<mcIdType> cells;
2576 self->arePolyhedronsNotCorrectlyOriented(cells);
2577 DataArrayIdType *ret=DataArrayIdType::New();
2578 ret->alloc(cells.size(),1);
2579 std::copy(cells.begin(),cells.end(),ret->getPointer());
2580 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2583 PyObject *getFastAveragePlaneOfThis() const
2587 self->getFastAveragePlaneOfThis(vec,pos);
2589 std::copy(vec,vec+3,vals);
2590 std::copy(pos,pos+3,vals+3);
2591 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2594 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2596 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2597 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2598 return MEDCouplingUMesh::MergeUMeshes(tmp);
2601 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2603 DataArrayIdType *ret1;
2604 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2605 PyObject *ret=PyTuple_New(2);
2606 PyObject *ret0Py=ret0?Py_True:Py_False;
2608 PyTuple_SetItem(ret,0,ret0Py);
2609 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2613 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2615 DataArrayIdType *ret1;
2616 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2617 PyObject *ret=PyTuple_New(2);
2618 PyObject *ret0Py=ret0?Py_True:Py_False;
2620 PyTuple_SetItem(ret,0,ret0Py);
2621 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2625 PyObject *explode3DMeshTo1D() const
2627 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2628 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2629 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2630 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2631 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2632 PyObject *ret=PyTuple_New(5);
2633 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2634 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2635 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2636 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2637 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2641 PyObject *explodeIntoEdges() const
2643 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2644 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2645 PyObject *ret=PyTuple_New(5);
2646 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2647 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2648 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2649 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2650 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2654 PyObject *explodeMeshIntoMicroEdges() const
2656 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2657 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2658 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2659 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2660 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2661 PyObject *ret=PyTuple_New(5);
2662 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2663 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2664 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2665 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2666 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2670 PyObject *buildDescendingConnectivity() const
2672 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2673 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2674 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2675 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2676 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2677 PyObject *ret=PyTuple_New(5);
2678 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2679 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2680 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2681 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2682 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2686 PyObject *buildDescendingConnectivity2() const
2688 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2689 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2690 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2691 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2692 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2693 PyObject *ret=PyTuple_New(5);
2694 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2696 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2697 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2698 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2702 PyObject *computeNeighborsOfCells() const
2704 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2705 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2706 PyObject *ret=PyTuple_New(2);
2707 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2708 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2712 PyObject *computeNeighborsOfNodes() const
2714 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2715 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2716 PyObject *ret=PyTuple_New(2);
2717 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2718 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2722 PyObject *computeEnlargedNeighborsOfNodes() const
2724 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2725 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2726 PyObject *ret=PyTuple_New(2);
2727 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2728 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2732 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2734 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2735 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2736 PyObject *ret=PyTuple_New(2);
2737 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2738 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2742 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2744 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2745 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2746 PyObject *ret=PyTuple_New(2);
2747 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2748 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2752 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2754 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2755 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2756 DataArrayIdType *d2,*d3,*d4,*dd5;
2757 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2758 PyObject *ret=PyTuple_New(7);
2759 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2760 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2762 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2763 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2764 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2765 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2769 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2772 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2773 da->checkAllocated();
2774 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2777 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2780 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2781 da->checkAllocated();
2782 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2785 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2788 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2789 da->checkAllocated();
2790 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2793 PyObject *getTypesOfPart(DataArrayIdType *da) const
2796 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2797 da->checkAllocated();
2798 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2799 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2800 PyObject *res = PyList_New(result.size());
2801 for (int i=0;iL!=result.end(); i++, iL++)
2802 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2806 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2809 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2810 da->checkAllocated();
2811 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2812 ret->setName(da->getName().c_str());
2816 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2818 DataArrayIdType *cellNb1=0,*cellNb2=0;
2819 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2820 PyObject *ret=PyTuple_New(3);
2821 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2822 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2823 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2827 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2829 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2830 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2831 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2832 PyObject *ret(PyTuple_New(4));
2833 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2834 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2835 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2836 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2840 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2842 int spaceDim=self->getSpaceDimension();
2844 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2846 DataArrayDouble *a,*a2;
2847 DataArrayDoubleTuple *aa,*aa2;
2848 std::vector<double> bb,bb2;
2850 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2851 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2852 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2853 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2855 DataArrayIdType *cellIds=0;
2856 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2857 PyObject *ret=PyTuple_New(2);
2858 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2859 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2863 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2865 int spaceDim=self->getSpaceDimension();
2867 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2869 DataArrayDouble *a,*a2;
2870 DataArrayDoubleTuple *aa,*aa2;
2871 std::vector<double> bb,bb2;
2873 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2874 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2875 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2876 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2878 DataArrayIdType *cellIds=0;
2879 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2880 PyObject *ret=PyTuple_New(2);
2881 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2882 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2886 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2889 DataArrayDouble *a,*a2;
2890 DataArrayDoubleTuple *aa,*aa2;
2891 std::vector<double> bb,bb2;
2893 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2894 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2895 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2896 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2897 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2901 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2903 int spaceDim=self->getSpaceDimension();
2905 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2907 DataArrayDouble *a,*a2;
2908 DataArrayDoubleTuple *aa,*aa2;
2909 std::vector<double> bb,bb2;
2911 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2912 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2913 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2914 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2915 return self->getCellIdsCrossingPlane(orig,vect,eps);
2918 void convertToPolyTypes(PyObject *li)
2922 std::vector<mcIdType> pos2;
2923 DataArrayIdType *pos3=0;
2924 DataArrayIdTypeTuple *pos4=0;
2925 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2930 self->convertToPolyTypes(&pos1,&pos1+1);
2937 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2942 self->convertToPolyTypes(pos3->begin(),pos3->end());
2946 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2950 void convertAllToPoly();
2951 void convertExtrudedPolyhedra();
2953 void simplifyPolyhedra(double eps);
2954 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2955 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2958 //== MEDCouplingUMesh End
2960 //== MEDCouplingMappedExtrudedMesh
2962 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2965 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2966 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2967 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2968 int get2DCellIdForExtrusion() const;
2970 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
2972 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2975 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2977 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2980 MEDCouplingMappedExtrudedMesh()
2982 return MEDCouplingMappedExtrudedMesh::New();
2985 std::string __str__() const
2987 return self->simpleRepr();
2990 std::string __repr__() const
2992 std::ostringstream oss;
2993 self->reprQuickOverview(oss);
2997 PyObject *getMesh2D() const
2999 MEDCouplingUMesh *ret=self->getMesh2D();
3002 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3004 PyObject *getMesh1D() const
3006 MEDCouplingUMesh *ret=self->getMesh1D();
3009 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3011 PyObject *getMesh3DIds() const
3013 DataArrayIdType *ret=self->getMesh3DIds();
3016 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3021 //== MEDCouplingMappedExtrudedMesh End
3023 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3026 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3027 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3028 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3029 int getNodalConnectivityLength() const;
3030 virtual void allocateCells(int nbOfCells=0);
3031 virtual void checkConsistencyOfConnectivity() const;
3034 virtual void insertNextCell(PyObject *li)
3036 mcIdType szArr,sw,iTypppArr;
3037 std::vector<mcIdType> stdvecTyyppArr;
3038 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3039 self->insertNextCell(tmp,tmp+szArr);
3042 virtual DataArrayIdType *getNodalConnectivity() const
3044 DataArrayIdType *ret=self->getNodalConnectivity();
3045 if(ret) ret->incrRef();
3049 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3051 std::vector< const MEDCoupling1GTUMesh *> parts;
3052 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3053 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3058 //== MEDCoupling1SGTUMesh
3060 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3063 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3064 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3065 void setNodalConnectivity(DataArrayIdType *nodalConn);
3066 int getNumberOfNodesPerCell() const;
3067 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3068 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3069 MEDCoupling1GTUMesh *computeDualMesh() const;
3070 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3071 DataArrayIdType *sortHexa8EachOther();
3074 MEDCoupling1SGTUMesh()
3076 return MEDCoupling1SGTUMesh::New();
3079 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3081 return MEDCoupling1SGTUMesh::New(name,type);
3084 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3086 return MEDCoupling1SGTUMesh::New(m);
3089 std::string __str__() const
3091 return self->simpleRepr();
3094 std::string __repr__() const
3096 std::ostringstream oss;
3097 self->reprQuickOverview(oss);
3101 PyObject *structurizeMe(double eps=1e-12) const
3103 DataArrayIdType *cellPerm(0),*nodePerm(0);
3104 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3105 PyObject *ret(PyTuple_New(3));
3106 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3107 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3108 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3112 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3114 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3115 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3116 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3119 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3121 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3122 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3123 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3128 //== MEDCoupling1SGTUMesh End
3130 //== MEDCoupling1DGTUMesh
3132 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3135 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3136 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3137 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3138 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3139 bool isPacked() const;
3142 MEDCoupling1DGTUMesh()
3144 return MEDCoupling1DGTUMesh::New();
3146 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3148 return MEDCoupling1DGTUMesh::New(name,type);
3151 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3153 return MEDCoupling1DGTUMesh::New(m);
3156 std::string __str__() const
3158 return self->simpleRepr();
3161 std::string __repr__() const
3163 std::ostringstream oss;
3164 self->reprQuickOverview(oss);
3168 DataArrayIdType *getNodalConnectivityIndex() const
3170 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3171 if(ret) ret->incrRef();
3175 PyObject *retrievePackedNodalConnectivity() const
3177 DataArrayIdType *ret1=0,*ret2=0;
3178 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3179 PyObject *ret0Py=ret0?Py_True:Py_False;
3181 PyObject *ret=PyTuple_New(3);
3182 PyTuple_SetItem(ret,0,ret0Py);
3183 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3184 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3188 PyObject *copyWithNodalConnectivityPacked() const
3191 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3192 PyObject *ret=PyTuple_New(2);
3193 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3194 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3195 PyTuple_SetItem(ret,1,ret1Py);
3199 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3201 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3202 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3203 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3206 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3208 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3209 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3210 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3213 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3215 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3216 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3217 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3222 //== MEDCoupling1DGTUMeshEnd
3224 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3227 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3228 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3229 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3230 int getSpaceDimensionOnNodeStruct() const;
3231 double computeSquareness() const;
3232 virtual std::vector<mcIdType> getNodeGridStructure() const;
3233 std::vector<mcIdType> getCellGridStructure() const;
3234 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3235 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3236 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3237 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3238 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3239 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3240 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3241 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3244 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3246 mcIdType tmpp1=-1,tmpp2=-1;
3247 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3248 std::vector< std::pair<mcIdType,mcIdType> > inp;
3252 for(mcIdType i=0;i<tmpp1;i++)
3253 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3258 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3259 inp.resize(tmpp1/2);
3260 for(mcIdType i=0;i<tmpp1/2;i++)
3261 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3264 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3265 return self->buildStructuredSubPart(inp);
3268 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3270 std::vector< std::pair<mcIdType,mcIdType> > inp;
3271 convertPyToVectorPairInt(part,inp);
3273 mcIdType szArr,sw,iTypppArr;
3274 std::vector<mcIdType> stdvecTyyppArr;
3275 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3276 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3278 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3281 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3283 std::vector< std::pair<mcIdType,mcIdType> > inp;
3284 convertPyToVectorPairInt(part,inp);
3285 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3288 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3290 std::vector< std::pair<mcIdType,mcIdType> > inp;
3291 convertPyToVectorPairInt(part,inp);
3292 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3295 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3297 std::vector< std::pair<mcIdType,mcIdType> > inp;
3298 convertPyToVectorPairInt(part,inp);
3299 std::vector<mcIdType> stWithGhost;
3300 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3301 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3302 PyObject *ret(PyTuple_New(2));
3303 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3304 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3308 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3310 std::vector< std::pair<mcIdType,mcIdType> > inp;
3311 convertPyToVectorPairInt(partCompactFormat,inp);
3312 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3315 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3317 std::vector< std::pair<mcIdType,mcIdType> > inp;
3318 convertPyToVectorPairInt(partCompactFormat,inp);
3319 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3322 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3324 std::vector< std::pair<mcIdType,mcIdType> > inp;
3325 convertPyToVectorPairInt(part,inp);
3326 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3329 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3331 mcIdType szArr,sw,iTypppArr;
3332 std::vector<mcIdType> stdvecTyyppArr;
3333 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3334 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3337 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3339 mcIdType szArr,sw,iTypppArr;
3340 std::vector<mcIdType> stdvecTyyppArr;
3341 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3342 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3345 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3347 std::vector< std::pair<mcIdType,mcIdType> > inp;
3348 convertPyToVectorPairInt(partCompactFormat,inp);
3349 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3352 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3354 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3355 PyObject *retPy=PyList_New(ret.size());
3356 for(std::size_t i=0;i<ret.size();i++)
3358 PyObject *tmp=PyTuple_New(2);
3359 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3360 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3361 PyList_SetItem(retPy,i,tmp);
3366 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3368 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3369 convertPyToVectorPairInt(r1,r1Cpp);
3370 convertPyToVectorPairInt(r2,r2Cpp);
3371 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3372 PyObject *retPy=PyList_New(ret.size());
3373 for(std::size_t i=0;i<ret.size();i++)
3375 PyObject *tmp=PyTuple_New(2);
3376 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3377 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3378 PyList_SetItem(retPy,i,tmp);
3383 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3385 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3386 convertPyToVectorPairInt(r1,r1Cpp);
3387 convertPyToVectorPairInt(r2,r2Cpp);
3388 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3391 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3393 mcIdType szArr,sw,iTypppArr;
3394 std::vector<mcIdType> stdvecTyyppArr;
3395 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3396 mcIdType szArr2,sw2,iTypppArr2;
3397 std::vector<mcIdType> stdvecTyyppArr2;
3398 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3399 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3400 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3401 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3402 PyObject *ret=PyTuple_New(2);
3403 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3404 PyTuple_SetItem(ret,0,ret0Py);
3405 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3406 for(std::size_t i=0;i<partCompactFormat.size();i++)
3408 PyObject *tmp4=PyTuple_New(2);
3409 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3410 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3411 PyList_SetItem(ret1Py,i,tmp4);
3413 PyTuple_SetItem(ret,1,ret1Py);
3417 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3419 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3420 convertPyToVectorPairInt(bigInAbs,param0);
3421 convertPyToVectorPairInt(partOfBigInAbs,param1);
3422 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3423 PyObject *retPy(PyList_New(ret.size()));
3424 for(std::size_t i=0;i<ret.size();i++)
3426 PyObject *tmp(PyTuple_New(2));
3427 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3428 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3429 PyList_SetItem(retPy,i,tmp);
3434 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3436 std::vector< std::pair<mcIdType,mcIdType> > param0;
3437 convertPyToVectorPairInt(part,param0);
3438 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3439 PyObject *retPy(PyList_New(ret.size()));
3440 for(std::size_t i=0;i<ret.size();i++)
3442 PyObject *tmp(PyTuple_New(2));
3443 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3444 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3445 PyList_SetItem(retPy,i,tmp);
3450 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3452 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3453 convertPyToVectorPairInt(startingFrom,param0);
3454 convertPyToVectorPairInt(goingTo,param1);
3455 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3458 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3460 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3461 convertPyToVectorPairInt(bigInAbs,param0);
3462 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3463 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3464 PyObject *retPy(PyList_New(ret.size()));
3465 for(std::size_t i=0;i<ret.size();i++)
3467 PyObject *tmp(PyTuple_New(2));
3468 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3469 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3470 PyList_SetItem(retPy,i,tmp);
3477 class MEDCouplingCurveLinearMesh;
3479 //== MEDCouplingCMesh
3481 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3484 static MEDCouplingCMesh *New();
3485 static MEDCouplingCMesh *New(const std::string& meshName);
3486 void setCoords(const DataArrayDouble *coordsX,
3487 const DataArrayDouble *coordsY=0,
3488 const DataArrayDouble *coordsZ=0);
3489 void setCoordsAt(int i, const DataArrayDouble *arr);
3490 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3494 return MEDCouplingCMesh::New();
3496 MEDCouplingCMesh(const std::string& meshName)
3498 return MEDCouplingCMesh::New(meshName);
3500 std::string __str__() const
3502 return self->simpleRepr();
3504 std::string __repr__() const
3506 std::ostringstream oss;
3507 self->reprQuickOverview(oss);
3510 DataArrayDouble *getCoordsAt(int i)
3512 DataArrayDouble *ret=self->getCoordsAt(i);
3520 //== MEDCouplingCMesh End
3522 //== MEDCouplingCurveLinearMesh
3524 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3527 static MEDCouplingCurveLinearMesh *New();
3528 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3529 void setCoords(const DataArrayDouble *coords);
3531 MEDCouplingCurveLinearMesh()
3533 return MEDCouplingCurveLinearMesh::New();
3535 MEDCouplingCurveLinearMesh(const std::string& meshName)
3537 return MEDCouplingCurveLinearMesh::New(meshName);
3539 std::string __str__() const
3541 return self->simpleRepr();
3543 std::string __repr__() const
3545 std::ostringstream oss;
3546 self->reprQuickOverview(oss);
3549 DataArrayDouble *getCoords()
3551 DataArrayDouble *ret=self->getCoords();
3556 void setNodeGridStructure(PyObject *gridStruct)
3558 mcIdType szArr,sw,iTypppArr;
3559 std::vector<mcIdType> stdvecTyyppArr;
3560 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3561 self->setNodeGridStructure(tmp,tmp+szArr);
3566 //== MEDCouplingCurveLinearMesh End
3568 //== MEDCouplingIMesh
3570 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3573 static MEDCouplingIMesh *New();
3575 void setSpaceDimension(int spaceDim);
3576 std::vector<mcIdType> getNodeStruct() const;
3577 std::vector<double> getOrigin() const;
3578 std::vector<double> getDXYZ() const;
3579 void setAxisUnit(const std::string& unitName);
3580 std::string getAxisUnit() const;
3581 double getMeasureOfAnyCell() const;
3582 MEDCouplingCMesh *convertToCartesian() const;
3583 void refineWithFactor(const std::vector<mcIdType>& factors);
3584 MEDCouplingIMesh *asSingleCell() const;
3585 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3590 return MEDCouplingIMesh::New();
3592 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3594 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3595 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3596 const mcIdType *nodeStrctPtr(0);
3597 const double *originPtr(0),*dxyzPtr(0);
3598 mcIdType sw,sz,val0;
3599 std::vector<mcIdType> bb0;
3600 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3603 std::vector<double> bb,bb2;
3605 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3606 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3608 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3611 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3613 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3616 void setNodeStruct(PyObject *nodeStrct)
3618 mcIdType sw,sz,val0;
3619 std::vector<mcIdType> bb0;
3620 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3621 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3624 void setOrigin(PyObject *origin)
3626 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3628 std::vector<double> bb;
3629 mcIdType sw,nbTuples;
3630 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3631 self->setOrigin(originPtr,originPtr+nbTuples);
3634 void setDXYZ(PyObject *dxyz)
3636 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3638 std::vector<double> bb;
3639 mcIdType sw,nbTuples;
3640 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3641 self->setDXYZ(originPtr,originPtr+nbTuples);
3644 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3646 std::vector< std::pair<mcIdType,mcIdType> > inp;
3647 convertPyToVectorPairInt(fineLocInCoarse,inp);
3648 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3651 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3653 std::vector< std::pair<mcIdType,mcIdType> > inp;
3654 convertPyToVectorPairInt(fineLocInCoarse,inp);
3655 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3658 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3660 std::vector< std::pair<mcIdType,mcIdType> > inp;
3661 convertPyToVectorPairInt(fineLocInCoarse,inp);
3662 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3665 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3667 std::vector< std::pair<mcIdType,mcIdType> > inp;
3668 convertPyToVectorPairInt(fineLocInCoarse,inp);
3669 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3672 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3674 std::vector< std::pair<mcIdType,mcIdType> > inp;
3675 convertPyToVectorPairInt(fineLocInCoarse,inp);
3676 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3679 std::string __str__() const
3681 return self->simpleRepr();
3683 std::string __repr__() const
3685 std::ostringstream oss;
3686 self->reprQuickOverview(oss);
3692 //== MEDCouplingIMesh End
3696 namespace MEDCoupling
3698 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3701 virtual void checkConsistencyLight() const;
3702 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3703 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3704 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3705 void setName(const char *name);
3706 std::string getDescription() const;
3707 void setDescription(const char *desc);
3708 std::string getName() const;
3709 TypeOfField getTypeOfField() const;
3710 NatureOfField getNature() const;
3711 virtual void setNature(NatureOfField nat);
3712 DataArrayDouble *getLocalizationOfDiscr() const;
3713 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3714 mcIdType getNumberOfTuplesExpected() const;
3715 mcIdType getNumberOfMeshPlacesExpected() const;
3716 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3717 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3718 void clearGaussLocalizations();
3719 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3720 mcIdType getNbOfGaussLocalization() const;
3721 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3722 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3723 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3724 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3726 PyObject *getMesh() const
3728 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3731 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3734 PyObject *getDiscretization()
3736 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3739 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3742 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3744 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3745 return convertIntArrToPyList3(ret);
3748 PyObject *buildSubMeshData(PyObject *li) const
3750 DataArrayIdType *ret1=0;
3751 MEDCouplingMesh *ret0=0;
3753 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3754 if (!SWIG_IsOK(res1))
3757 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3758 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3762 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3764 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3765 da2->checkAllocated();
3766 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3768 PyObject *res = PyList_New(2);
3769 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3770 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3774 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3776 DataArrayIdType *ret1=0;
3778 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3779 PyObject *res=PyTuple_New(2);
3780 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3782 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3785 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3786 PyTuple_SetItem(res,1,res1);
3791 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3794 mcIdType v0; std::vector<mcIdType> v1;
3795 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3796 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3799 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3800 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3803 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3804 if (!SWIG_IsOK(res1))
3807 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3808 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3812 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3814 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3815 da2->checkAllocated();
3816 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3820 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3822 std::vector<mcIdType> tmp;
3823 self->getCellIdsHavingGaussLocalization(locId,tmp);
3824 DataArrayIdType *ret=DataArrayIdType::New();
3825 ret->alloc((mcIdType)tmp.size(),1);
3826 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3827 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3830 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3832 std::vector<mcIdType> inp0;
3833 convertPyToNewIntArr4(code,1,3,inp0);
3834 std::vector<const DataArrayIdType *> inp1;
3835 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3836 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3841 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3844 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3845 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3846 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3847 static MEDCouplingFieldTemplate *New(TypeOfField type);
3848 std::string simpleRepr() const;
3849 std::string advancedRepr() const;
3850 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3851 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3854 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3856 return MEDCouplingFieldTemplate::New(f);
3859 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3861 return MEDCouplingFieldTemplate::New(f);
3864 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3866 return MEDCouplingFieldTemplate::New(f);
3869 MEDCouplingFieldTemplate(TypeOfField type)
3871 return MEDCouplingFieldTemplate::New(type);
3874 std::string __str__() const
3876 return self->simpleRepr();
3879 std::string __repr__() const
3881 std::ostringstream oss;
3882 self->reprQuickOverview(oss);
3886 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3889 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3890 PyObject *ret=PyTuple_New(2);
3891 PyObject *ret0Py=ret0?Py_True:Py_False;
3893 PyTuple_SetItem(ret,0,ret0Py);
3894 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3901 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3904 TypeOfTimeDiscretization getTimeDiscretization() const;
3906 MEDCouplingFieldT();
3907 ~MEDCouplingFieldT();
3910 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3911 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3912 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3914 class MEDCouplingFieldInt;
3915 class MEDCouplingFieldFloat;
3917 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3920 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3921 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3922 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3923 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3924 void setTimeUnit(const std::string& unit);
3925 std::string getTimeUnit() const;
3926 void synchronizeTimeWithSupport();
3927 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3928 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3929 std::string simpleRepr() const;
3930 std::string advancedRepr() const;
3931 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3932 MEDCouplingFieldInt *convertToIntField() const;
3933 MEDCouplingFieldFloat *convertToFloatField() const;
3934 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3935 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3936 MEDCouplingFieldDouble *deepCopy() const;
3937 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3938 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3939 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3940 double getIJ(int tupleId, int compoId) const;
3941 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3942 void synchronizeTimeWithMesh();
3943 void setArray(DataArrayDouble *array);
3944 void setEndArray(DataArrayDouble *array);
3945 void setTime(double val, int iteration, int order);
3946 void setStartTime(double val, int iteration, int order);
3947 void setEndTime(double val, int iteration, int order);
3948 void applyLin(double a, double b, int compoId);
3949 void applyLin(double a, double b);
3950 int getNumberOfComponents() const;
3951 int getNumberOfTuples() const;
3952 int getNumberOfValues() const;
3953 void setTimeTolerance(double val);
3954 double getTimeTolerance() const;
3955 void setIteration(int it);
3956 void setEndIteration(int it);
3957 void setOrder(int order);
3958 void setEndOrder(int order);
3959 void setTimeValue(double val);
3960 void setEndTimeValue(double val);
3961 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3962 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3963 bool mergeNodes(double eps, double epsOnVals=1e-15);
3964 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3965 bool zipCoords(double epsOnVals=1e-15);
3966 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3967 bool simplexize(int policy);
3968 MEDCouplingFieldDouble *doublyContractedProduct() const;
3969 MEDCouplingFieldDouble *determinant() const;
3970 MEDCouplingFieldDouble *eigenValues() const;
3971 MEDCouplingFieldDouble *eigenVectors() const;
3972 MEDCouplingFieldDouble *inverse() const;
3973 MEDCouplingFieldDouble *trace() const;
3974 MEDCouplingFieldDouble *deviator() const;
3975 MEDCouplingFieldDouble *magnitude() const;
3976 MEDCouplingFieldDouble *maxPerTuple() const;
3977 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
3978 void sortPerTuple(bool asc);
3979 MEDCouplingFieldDouble &operator=(double value);
3980 void fillFromAnalytic(int nbOfComp, const std::string& func);
3981 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
3982 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3983 void applyFunc(int nbOfComp, const std::string& func);
3984 void applyFuncCompo(int nbOfComp, const std::string& func);
3985 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3986 void applyFunc(int nbOfComp, double val);
3987 void applyFunc(const std::string& func);
3988 void applyFuncFast32(const std::string& func);
3989 void applyFuncFast64(const std::string& func);
3990 double accumulate(int compId) const;
3991 double getMaxValue() const;
3992 double getMinValue() const;
3993 double getAverageValue() const;
3994 double norm2() const;
3995 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3996 double getWeightedAverageValue(int compId, bool isWAbs) const;
3997 double integral(int compId, bool isWAbs) const;
3998 double normL1(int compId) const;
3999 double normL2(int compId) const;
4000 double normMax(int compId) const;
4001 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4002 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4003 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4004 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4005 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4006 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4007 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4008 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4009 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4010 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4011 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4012 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4013 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4014 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4015 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4016 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4017 MEDCouplingFieldDouble *negate() const;
4019 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4021 return MEDCouplingFieldDouble::New(type,td);
4024 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4026 return MEDCouplingFieldDouble::New(ft,td);
4029 std::string __str__() const
4031 return self->simpleRepr();
4034 std::string __repr__() const
4036 std::ostringstream oss;
4037 self->reprQuickOverview(oss);
4041 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4044 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4045 PyObject *ret=PyTuple_New(2);
4046 PyObject *ret0Py=ret0?Py_True:Py_False;
4048 PyTuple_SetItem(ret,0,ret0Py);
4049 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4053 MEDCouplingFieldDouble *voronoize(double eps) const
4055 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4059 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4061 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4065 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4067 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4069 DataArrayDouble *a,*a2;
4070 DataArrayDoubleTuple *aa,*aa2;
4071 std::vector<double> bb,bb2;
4073 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4074 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4075 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4078 DataArrayDouble *getArray()
4080 DataArrayDouble *ret=self->getArray();
4086 PyObject *getArrays() const
4088 std::vector<DataArrayDouble *> arrs=self->getArrays();
4089 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4092 std::size_t sz=arrs.size();
4093 PyObject *ret=PyTuple_New(sz);
4094 for(std::size_t i=0;i<sz;i++)
4097 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4099 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4104 void setArrays(PyObject *ls)
4106 std::vector<const DataArrayDouble *> tmp;
4107 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4108 std::size_t sz=tmp.size();
4109 std::vector<DataArrayDouble *> arrs(sz);
4110 for(std::size_t i=0;i<sz;i++)
4111 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4112 self->setArrays(arrs);
4115 DataArrayDouble *getEndArray()
4117 DataArrayDouble *ret=self->getEndArray();
4123 PyObject *getValueOn(PyObject *sl) const
4127 DataArrayDoubleTuple *aa;
4128 std::vector<double> bb;
4130 const MEDCouplingMesh *mesh=self->getMesh();
4132 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4133 int spaceDim=mesh->getSpaceDimension();
4134 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4135 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4137 mcIdType sz=ToIdType(self->getNumberOfComponents());
4138 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4139 self->getValueOn(spaceLoc,res);
4140 return convertDblArrToPyList<double>(res,sz);
4143 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4145 mcIdType sz=ToIdType(self->getNumberOfComponents());
4146 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4147 self->getValueOnPos(i,j,k,res);
4148 return convertDblArrToPyList<double>(res,sz);
4151 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4153 const MEDCouplingMesh *mesh(self->getMesh());
4155 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4158 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4159 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4160 mesh->getSpaceDimension(),true,nbPts);
4161 return self->getValueOnMulti(inp,(int)nbPts);
4164 PyObject *getValueOn(PyObject *sl, double time) const
4168 DataArrayDoubleTuple *aa;
4169 std::vector<double> bb;
4171 const MEDCouplingMesh *mesh=self->getMesh();
4173 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4174 int spaceDim=mesh->getSpaceDimension();
4175 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4176 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4179 mcIdType sz=ToIdType(self->getNumberOfComponents());
4180 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4181 self->getValueOn(spaceLoc,time,res);
4182 return convertDblArrToPyList<double>(res,sz);
4185 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4187 if(self->getArray()!=0)
4188 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4191 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4192 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4193 self->setArray(arr);
4200 double tmp0=self->getTime(tmp1,tmp2);
4201 PyObject *res = PyList_New(3);
4202 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4203 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4204 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4208 PyObject *getStartTime()
4211 double tmp0=self->getStartTime(tmp1,tmp2);
4212 PyObject *res = PyList_New(3);
4213 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4214 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4215 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4219 PyObject *getEndTime()
4222 double tmp0=self->getEndTime(tmp1,tmp2);
4223 PyObject *res = PyList_New(3);
4224 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4225 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4226 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4229 PyObject *accumulate() const
4231 mcIdType sz=ToIdType(self->getNumberOfComponents());
4232 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4233 self->accumulate(tmp);
4234 return convertDblArrToPyList<double>(tmp,sz);
4236 PyObject *integral(bool isWAbs) const
4238 mcIdType sz=ToIdType(self->getNumberOfComponents());
4239 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4240 self->integral(isWAbs,tmp);
4241 return convertDblArrToPyList<double>(tmp,sz);
4243 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4245 mcIdType sz=ToIdType(self->getNumberOfComponents());
4246 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4247 self->getWeightedAverageValue(tmp,isWAbs);
4248 return convertDblArrToPyList<double>(tmp,sz);
4250 PyObject *normL1() const
4252 mcIdType sz=ToIdType(self->getNumberOfComponents());
4253 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4255 return convertDblArrToPyList<double>(tmp,sz);
4257 PyObject *normL2() const
4259 mcIdType sz=ToIdType(self->getNumberOfComponents());
4260 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4262 return convertDblArrToPyList<double>(tmp,sz);
4264 PyObject *normMax() const
4266 mcIdType sz=ToIdType(self->getNumberOfComponents());
4267 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4269 return convertDblArrToPyList<double>(tmp,sz);
4271 void renumberCells(PyObject *li, bool check=true)
4273 mcIdType szArr,sw,iTypppArr;
4274 std::vector<mcIdType> stdvecTyyppArr;
4275 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4276 self->renumberCells(tmp,check);
4279 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4281 mcIdType szArr,sw,iTypppArr;
4282 std::vector<mcIdType> stdvecTyyppArr;
4283 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4284 self->renumberCellsWithoutMesh(tmp,check);
4287 void renumberNodes(PyObject *li, double eps=1e-15)
4289 mcIdType szArr,sw,iTypppArr;
4290 std::vector<mcIdType> stdvecTyyppArr;
4291 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4292 self->renumberNodes(tmp,eps);
4295 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4297 mcIdType szArr,sw,iTypppArr;
4298 std::vector<mcIdType> stdvecTyyppArr;
4299 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4300 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4303 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4305 return fieldT_buildSubPart(self,li);
4308 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4310 return fieldT__getitem__(self,li);
4313 PyObject *getMaxValue2() const
4315 DataArrayIdType *tmp;
4316 double r1=self->getMaxValue2(tmp);
4317 PyObject *ret=PyTuple_New(2);
4318 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4319 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4323 PyObject *getMinValue2() const
4325 DataArrayIdType *tmp;
4326 double r1=self->getMinValue2(tmp);
4327 PyObject *ret=PyTuple_New(2);
4328 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4329 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4333 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4335 std::vector<std::size_t> tmp;
4336 convertPyToNewIntArr3(li,tmp);
4337 return self->keepSelectedComponents(tmp);
4340 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4342 std::vector<std::size_t> tmp;
4343 convertPyToNewIntArr3(li,tmp);
4344 self->setSelectedComponents(f,tmp);
4347 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4350 DataArrayDouble *a,*a2;
4351 DataArrayDoubleTuple *aa,*aa2;
4352 std::vector<double> bb,bb2;
4355 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4356 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4357 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4358 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4360 return self->extractSlice3D(orig,vect,eps);
4363 MEDCouplingFieldDouble *__add__(PyObject *obj)
4365 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4368 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4370 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4373 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4375 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.";
4376 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4379 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4381 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4383 return (*self)-(*other);
4385 throw INTERP_KERNEL::Exception(msg);
4390 DataArrayDoubleTuple *aa;
4391 std::vector<double> bb;
4393 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4398 if(!self->getArray())
4399 throw INTERP_KERNEL::Exception(msg2);
4400 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4401 ret->applyLin(1.,-val);
4402 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4403 ret2->setArray(ret);
4408 if(!self->getArray())
4409 throw INTERP_KERNEL::Exception(msg2);
4410 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4411 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4412 ret2->setArray(ret);
4417 if(!self->getArray())
4418 throw INTERP_KERNEL::Exception(msg2);
4419 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4420 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4421 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4422 ret2->setArray(ret);
4427 if(!self->getArray())
4428 throw INTERP_KERNEL::Exception(msg2);
4429 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4430 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4431 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4432 ret2->setArray(ret);
4436 { throw INTERP_KERNEL::Exception(msg); }
4440 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4442 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4445 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4447 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4450 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4452 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4455 MEDCouplingFieldDouble *__div__(PyObject *obj)
4457 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.";
4458 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4461 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4463 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4465 return (*self)/(*other);
4467 throw INTERP_KERNEL::Exception(msg);
4472 DataArrayDoubleTuple *aa;
4473 std::vector<double> bb;
4475 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4481 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4482 if(!self->getArray())
4483 throw INTERP_KERNEL::Exception(msg2);
4484 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4485 ret->applyLin(1./val,0);
4486 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4487 ret2->setArray(ret);
4492 if(!self->getArray())
4493 throw INTERP_KERNEL::Exception(msg2);
4494 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4495 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4496 ret2->setArray(ret);
4501 if(!self->getArray())
4502 throw INTERP_KERNEL::Exception(msg2);
4503 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4504 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4505 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4506 ret2->setArray(ret);
4511 if(!self->getArray())
4512 throw INTERP_KERNEL::Exception(msg2);
4513 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4514 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4515 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4516 ret2->setArray(ret);
4520 { throw INTERP_KERNEL::Exception(msg); }
4524 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4526 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4529 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4531 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.";
4532 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4535 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4537 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4539 return (*self)^(*other);
4541 throw INTERP_KERNEL::Exception(msg);
4546 DataArrayDoubleTuple *aa;
4547 std::vector<double> bb;
4549 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4554 if(!self->getArray())
4555 throw INTERP_KERNEL::Exception(msg2);
4556 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4558 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4559 ret2->setArray(ret);
4564 if(!self->getArray())
4565 throw INTERP_KERNEL::Exception(msg2);
4566 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4567 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4568 ret2->setArray(ret);
4573 if(!self->getArray())
4574 throw INTERP_KERNEL::Exception(msg2);
4575 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4576 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4577 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4578 ret2->setArray(ret);
4583 if(!self->getArray())
4584 throw INTERP_KERNEL::Exception(msg2);
4585 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4586 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4587 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4588 ret2->setArray(ret);
4592 { throw INTERP_KERNEL::Exception(msg); }
4596 MEDCouplingFieldDouble *__neg__() const
4598 return self->negate();
4601 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4603 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.";
4604 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4607 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4609 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4613 Py_XINCREF(trueSelf);
4617 throw INTERP_KERNEL::Exception(msg);
4622 DataArrayDoubleTuple *aa;
4623 std::vector<double> bb;
4625 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4630 if(!self->getArray())
4631 throw INTERP_KERNEL::Exception(msg2);
4632 self->getArray()->applyLin(1.,val);
4633 Py_XINCREF(trueSelf);
4638 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4641 Py_XINCREF(trueSelf);
4646 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4647 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4648 ret2->setArray(aaa);
4650 Py_XINCREF(trueSelf);
4655 if(!self->getArray())
4656 throw INTERP_KERNEL::Exception(msg2);
4657 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4658 self->getArray()->addEqual(aaa);
4659 Py_XINCREF(trueSelf);
4663 { throw INTERP_KERNEL::Exception(msg); }
4667 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4669 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.";
4670 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4673 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4675 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4679 Py_XINCREF(trueSelf);
4683 throw INTERP_KERNEL::Exception(msg);
4688 DataArrayDoubleTuple *aa;
4689 std::vector<double> bb;
4691 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4696 if(!self->getArray())
4697 throw INTERP_KERNEL::Exception(msg2);
4698 self->getArray()->applyLin(1.,-val);
4699 Py_XINCREF(trueSelf);
4704 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4707 Py_XINCREF(trueSelf);
4712 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4713 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4714 ret2->setArray(aaa);
4716 Py_XINCREF(trueSelf);
4721 if(!self->getArray())
4722 throw INTERP_KERNEL::Exception(msg2);
4723 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4724 self->getArray()->substractEqual(aaa);
4725 Py_XINCREF(trueSelf);
4729 { throw INTERP_KERNEL::Exception(msg); }
4733 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4735 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.";
4736 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4739 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4741 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4745 Py_XINCREF(trueSelf);
4749 throw INTERP_KERNEL::Exception(msg);
4754 DataArrayDoubleTuple *aa;
4755 std::vector<double> bb;
4757 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4762 if(!self->getArray())
4763 throw INTERP_KERNEL::Exception(msg2);
4764 self->getArray()->applyLin(val,0);
4765 Py_XINCREF(trueSelf);
4770 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4773 Py_XINCREF(trueSelf);
4778 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4779 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4780 ret2->setArray(aaa);
4782 Py_XINCREF(trueSelf);
4787 if(!self->getArray())
4788 throw INTERP_KERNEL::Exception(msg2);
4789 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4790 self->getArray()->multiplyEqual(aaa);
4791 Py_XINCREF(trueSelf);
4795 { throw INTERP_KERNEL::Exception(msg); }
4799 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4801 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.";
4802 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4805 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4807 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4811 Py_XINCREF(trueSelf);
4815 throw INTERP_KERNEL::Exception(msg);
4820 DataArrayDoubleTuple *aa;
4821 std::vector<double> bb;
4823 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4829 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4830 if(!self->getArray())
4831 throw INTERP_KERNEL::Exception(msg2);
4832 self->getArray()->applyLin(1./val,0);
4833 Py_XINCREF(trueSelf);
4838 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4841 Py_XINCREF(trueSelf);
4846 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4847 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4848 ret2->setArray(aaa);
4850 Py_XINCREF(trueSelf);
4855 if(!self->getArray())
4856 throw INTERP_KERNEL::Exception(msg2);
4857 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4858 self->getArray()->divideEqual(aaa);
4859 Py_XINCREF(trueSelf);
4863 { throw INTERP_KERNEL::Exception(msg); }
4867 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4869 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.";
4870 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4873 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4875 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4879 Py_XINCREF(trueSelf);
4883 throw INTERP_KERNEL::Exception(msg);
4888 DataArrayDoubleTuple *aa;
4889 std::vector<double> bb;
4891 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4896 if(!self->getArray())
4897 throw INTERP_KERNEL::Exception(msg2);
4898 self->getArray()->applyPow(val);
4899 Py_XINCREF(trueSelf);
4904 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4907 Py_XINCREF(trueSelf);
4912 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4913 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4914 ret2->setArray(aaa);
4916 Py_XINCREF(trueSelf);
4921 if(!self->getArray())
4922 throw INTERP_KERNEL::Exception(msg2);
4923 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4924 self->getArray()->powEqual(aaa);
4925 Py_XINCREF(trueSelf);
4929 { throw INTERP_KERNEL::Exception(msg); }
4933 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4935 std::vector<const MEDCouplingFieldDouble *> tmp;
4936 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4937 return MEDCouplingFieldDouble::MergeFields(tmp);
4940 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4942 std::vector<const MEDCouplingFieldDouble *> tmp;
4943 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4944 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4947 PyObject *getTinySerializationInformation() const
4949 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4952 PyObject *serialize() const
4954 return field_serialize<double>(self);
4957 PyObject *__getstate__() const
4959 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4962 void __setstate__(PyObject *inp)
4964 field__setstate__<double>(self,inp);
4969 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4972 int getNumberOfFields() const;
4973 MEDCouplingMultiFields *deepCopy() const;
4974 virtual std::string simpleRepr() const;
4975 virtual std::string advancedRepr() const;
4976 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4977 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4978 virtual void checkConsistencyLight() const;
4981 std::string __str__() const
4983 return self->simpleRepr();
4985 static MEDCouplingMultiFields *New(PyObject *li)
4987 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4988 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4989 std::size_t sz=tmp.size();
4990 std::vector<MEDCouplingFieldDouble *> fs(sz);
4991 for(std::size_t i=0;i<sz;i++)
4992 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4993 return MEDCouplingMultiFields::New(fs);
4995 MEDCouplingMultiFields(PyObject *li)
4997 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4998 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4999 std::size_t sz=tmp.size();
5000 std::vector<MEDCouplingFieldDouble *> fs(sz);
5001 for(std::size_t i=0;i<sz;i++)
5002 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5003 return MEDCouplingMultiFields::New(fs);
5005 PyObject *getFields() const
5007 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5008 std::size_t sz=fields.size();
5009 PyObject *res = PyList_New(sz);
5010 for(std::size_t i=0;i<sz;i++)
5014 fields[i]->incrRef();
5015 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5019 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5024 PyObject *getFieldAtPos(int id) const
5026 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5030 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5033 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5035 PyObject *getMeshes() const
5037 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5038 std::size_t sz=ms.size();
5039 PyObject *res = PyList_New(sz);
5040 for(std::size_t i=0;i<sz;i++)
5045 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5049 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5054 PyObject *getDifferentMeshes() const
5056 std::vector<int> refs;
5057 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5058 std::size_t sz=ms.size();
5059 PyObject *res = PyList_New(sz);
5060 for(std::size_t i=0;i<sz;i++)
5065 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5069 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5073 PyObject *ret=PyTuple_New(2);
5074 PyTuple_SetItem(ret,0,res);
5075 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5078 PyObject *getArrays() const
5080 std::vector<DataArrayDouble *> ms=self->getArrays();
5081 std::size_t sz=ms.size();
5082 PyObject *res = PyList_New(sz);
5083 for(std::size_t i=0;i<sz;i++)
5088 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5092 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5097 PyObject *getDifferentArrays() const
5099 std::vector< std::vector<int> > refs;
5100 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5101 std::size_t sz=ms.size();
5102 PyObject *res = PyList_New(sz);
5103 PyObject *res2 = PyList_New(sz);
5104 for(std::size_t i=0;i<sz;i++)
5109 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5113 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5115 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5118 PyObject *ret=PyTuple_New(2);
5119 PyTuple_SetItem(ret,0,res);
5120 PyTuple_SetItem(ret,1,res2);
5126 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5129 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5130 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5131 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5132 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5133 void setTimeUnit(const std::string& unit);
5134 std::string getTimeUnit() const;
5135 void setTime(double val, int iteration, int order);
5136 void setArray(DataArrayInt32 *array);
5137 MEDCouplingFieldInt *deepCopy() const;
5138 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5139 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5140 MEDCouplingFieldDouble *convertToDblField() const;
5141 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5143 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5145 return MEDCouplingFieldInt::New(type,td);
5148 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5150 return MEDCouplingFieldInt::New(ft,td);
5153 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5156 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5157 PyObject *ret=PyTuple_New(2);
5158 PyObject *ret0Py=ret0?Py_True:Py_False;
5160 PyTuple_SetItem(ret,0,ret0Py);
5161 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5165 std::string __str__() const
5167 return self->simpleRepr();
5170 std::string __repr__() const
5172 std::ostringstream oss;
5173 self->reprQuickOverview(oss);
5177 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5179 return fieldT_buildSubPart(self,li);
5182 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5184 return fieldT__getitem__(self,li);
5187 DataArrayInt32 *getArray()
5189 DataArrayInt32 *ret=self->getArray();
5198 double tmp0=self->getTime(tmp1,tmp2);
5199 PyObject *res = PyList_New(3);
5200 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5201 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5202 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5206 PyObject *getTinySerializationInformation() const
5208 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5211 PyObject *serialize() const
5213 return field_serialize<int>(self);
5216 PyObject *__getstate__() const
5218 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5221 void __setstate__(PyObject *inp)
5223 field__setstate__<int>(self,inp);
5228 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5231 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5232 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5233 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5234 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5235 void setTimeUnit(const std::string& unit);
5236 std::string getTimeUnit() const;
5237 void setTime(double val, int iteration, int order);
5238 void setArray(DataArrayFloat *array);
5239 MEDCouplingFieldFloat *deepCopy() const;
5240 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5241 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5242 MEDCouplingFieldDouble *convertToDblField() const;
5243 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5245 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5247 return MEDCouplingFieldFloat::New(type,td);
5250 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5252 return MEDCouplingFieldFloat::New(ft,td);
5255 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5258 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5259 PyObject *ret=PyTuple_New(2);
5260 PyObject *ret0Py=ret0?Py_True:Py_False;
5262 PyTuple_SetItem(ret,0,ret0Py);
5263 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5267 std::string __str__() const
5269 return self->simpleRepr();
5272 std::string __repr__() const
5274 std::ostringstream oss;
5275 self->reprQuickOverview(oss);
5279 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5281 return fieldT_buildSubPart(self,li);
5284 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5286 return fieldT__getitem__(self,li);
5289 DataArrayFloat *getArray()
5291 DataArrayFloat *ret=self->getArray();
5300 double tmp0=self->getTime(tmp1,tmp2);
5301 PyObject *res = PyList_New(3);
5302 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5303 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5304 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5308 PyObject *getTinySerializationInformation() const
5310 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5313 PyObject *serialize() const
5315 return field_serialize<float>(self);
5318 PyObject *__getstate__() const
5320 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5323 void __setstate__(PyObject *inp)
5325 field__setstate__<float>(self,inp);
5330 class MEDCouplingDefinitionTime
5333 MEDCouplingDefinitionTime();
5334 void assign(const MEDCouplingDefinitionTime& other);
5335 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5336 double getTimeResolution() const;
5337 std::vector<double> getHotSpotsTime() const;
5340 std::string __str__() const
5342 std::ostringstream oss;
5343 self->appendRepr(oss);
5347 PyObject *getIdsOnTimeRight(double tm) const
5349 int meshId,arrId,arrIdInField,fieldId;
5350 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5351 PyObject *res=PyList_New(4);
5352 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5353 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5354 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5355 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5359 PyObject *getIdsOnTimeLeft(double tm) const
5361 int meshId,arrId,arrIdInField,fieldId;
5362 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5363 PyObject *res=PyList_New(4);
5364 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5365 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5366 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5367 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5373 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5376 double getTimeTolerance() const;
5377 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5381 MEDCouplingFieldOverTime(PyObject *li)
5383 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5384 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5385 std::size_t sz=tmp.size();
5386 std::vector<MEDCouplingFieldDouble *> fs(sz);
5387 for(std::size_t i=0;i<sz;i++)
5388 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5389 return MEDCouplingFieldOverTime::New(fs);
5391 std::string __str__() const
5393 return self->simpleRepr();
5395 static MEDCouplingFieldOverTime *New(PyObject *li)
5397 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5398 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5399 std::size_t sz=tmp.size();
5400 std::vector<MEDCouplingFieldDouble *> fs(sz);
5401 for(std::size_t i=0;i<sz;i++)
5402 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5403 return MEDCouplingFieldOverTime::New(fs);
5408 class MEDCouplingCartesianAMRMesh;
5410 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5413 int getNumberOfCellsRecursiveWithOverlap() const;
5414 int getNumberOfCellsRecursiveWithoutOverlap() const;
5415 int getMaxNumberOfLevelsRelativeToThis() const;
5418 MEDCouplingCartesianAMRMeshGen *getMesh() const
5420 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5428 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5431 int getNumberOfOverlapedCellsForFather() const;
5432 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5433 std::vector<mcIdType> computeCellGridSt() const;
5436 PyObject *getBLTRRange() const
5438 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5439 return convertFromVectorPairInt(ret);
5442 PyObject *getBLTRRangeRelativeToGF() const
5444 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5445 return convertFromVectorPairInt(ret);
5448 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5450 std::vector< std::pair<mcIdType,mcIdType> > inp;
5451 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5452 self->addPatch(inp,factors);
5455 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5457 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5459 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5460 if(patchId==mesh->getNumberOfPatches())
5462 std::ostringstream oss;
5463 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5464 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5467 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5473 void __delitem__(mcIdType patchId)
5475 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5477 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5478 mesh->removePatch(patchId);
5481 mcIdType __len__() const
5483 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5485 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5486 return mesh->getNumberOfPatches();
5491 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5495 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5498 mcIdType getAbsoluteLevel() const;
5499 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5500 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5501 int getSpaceDimension() const;
5502 const std::vector<mcIdType>& getFactors() const;
5503 void setFactors(const std::vector<mcIdType>& newFactors);
5504 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5505 mcIdType getNumberOfCellsAtCurrentLevel() const;
5506 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5507 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5508 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5509 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5510 virtual void detachFromFather();
5512 mcIdType getNumberOfPatches() const;
5513 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5514 MEDCouplingUMesh *buildUnstructured() const;
5515 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5516 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5517 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5518 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5519 void removeAllPatches();
5520 void removePatch(mcIdType patchId);
5521 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5522 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5523 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5524 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5525 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5526 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5527 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5528 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5529 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5530 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5531 std::string buildPythonDumpOfThis() const;
5534 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5536 std::vector< std::pair<mcIdType,mcIdType> > inp;
5537 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5538 self->addPatch(inp,factors);
5541 PyObject *getPatches() const
5543 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5544 std::size_t sz(ps.size());
5545 PyObject *ret = PyList_New(sz);
5546 for(std::size_t i=0;i<sz;i++)
5548 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5551 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5556 // agy : don't know why typemap fails here ??? let it in the extend section
5557 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5559 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5562 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5564 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5565 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5571 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5573 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5574 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5580 virtual PyObject *positionRelativeToGodFather() const
5582 std::vector<mcIdType> out1;
5583 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5584 PyObject *ret(PyTuple_New(2));
5585 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5586 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5590 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5592 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5593 std::size_t sz(ps.size());
5594 PyObject *ret = PyList_New(sz);
5595 for(std::size_t i=0;i<sz;i++)
5596 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5600 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5602 std::vector<const DataArrayDouble *> inp;
5603 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5604 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5607 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5609 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5615 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5617 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5623 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5625 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5631 MEDCouplingIMesh *getImageMesh() const
5633 const MEDCouplingIMesh *ret(self->getImageMesh());
5636 return const_cast<MEDCouplingIMesh *>(ret);
5639 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5641 if(patchId==self->getNumberOfPatches())
5643 std::ostringstream oss;
5644 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5645 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5648 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5654 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5656 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5657 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5658 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5661 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5663 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5664 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5665 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5668 void __delitem__(mcIdType patchId)
5670 self->removePatch(patchId);
5673 mcIdType __len__() const
5675 return self->getNumberOfPatches();
5680 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5684 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5687 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5690 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5692 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5693 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5694 const mcIdType *nodeStrctPtr(0);
5695 const double *originPtr(0),*dxyzPtr(0);
5696 mcIdType sw,sz,val0;
5697 std::vector<mcIdType> bb0;
5698 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5701 std::vector<double> bb,bb2;
5703 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5704 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5706 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5709 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5711 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5712 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5713 std::vector< std::vector<mcIdType> > inp2;
5714 convertPyToVectorOfVectorOfInt(factors,inp2);
5715 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5718 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5720 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5723 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5725 return MEDCouplingCartesianAMRMesh::New(mesh);
5730 class MEDCouplingDataForGodFather : public RefCountObject
5733 virtual void synchronizeFineToCoarse();
5734 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5735 virtual void synchronizeCoarseToFine();
5736 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5737 virtual void synchronizeAllGhostZones();
5738 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5739 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5740 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5741 virtual void alloc();
5742 virtual void dealloc();
5745 MEDCouplingCartesianAMRMesh *getMyGodFather()
5747 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5755 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5758 mcIdType getNumberOfLevels() const;
5759 MEDCouplingAMRAttribute *deepCopy() const;
5760 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5761 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5762 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5763 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5764 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5765 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5766 std::string writeVTHB(const std::string& fileName) const;
5769 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5771 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5772 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5773 MEDCouplingAMRAttribute *ret(0);
5776 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5777 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5779 catch(INTERP_KERNEL::Exception&)
5781 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5782 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5787 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5789 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5792 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5794 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5795 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5801 void spillInfoOnComponents(PyObject *compNames)
5803 std::vector< std::vector<std::string> > compNamesCpp;
5804 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5805 self->spillInfoOnComponents(compNamesCpp);
5808 void spillNatures(PyObject *nfs)
5810 std::vector<mcIdType> inp0;
5811 if(!fillIntVector(nfs,inp0))
5812 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5813 std::size_t sz(inp0.size());
5814 std::vector<NatureOfField> inp00(sz);
5815 for(std::size_t i=0;i<sz;i++)
5816 inp00[i]=(NatureOfField)inp0[i];
5817 self->spillNatures(inp00);
5820 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5822 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5823 std::size_t sz(ret.size());
5824 PyObject *retPy(PyList_New(sz));
5825 for(std::size_t i=0;i<sz;i++)
5826 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5832 class DenseMatrix : public RefCountObject, public TimeLabel
5835 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5836 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5837 DenseMatrix *deepCopy() const;
5838 DenseMatrix *shallowCpy() const;
5840 mcIdType getNumberOfRows() const;
5841 mcIdType getNumberOfCols() const;
5842 mcIdType getNbOfElems() const;
5843 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5844 void reShape(mcIdType nbRows, mcIdType nbCols);
5847 bool isEqual(const DenseMatrix& other, double eps) const;
5848 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5849 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5852 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5854 return DenseMatrix::New(nbRows,nbCols);
5857 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5859 return DenseMatrix::New(array,nbRows,nbCols);
5862 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5865 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5866 PyObject *ret=PyTuple_New(2);
5867 PyObject *ret0Py=ret0?Py_True:Py_False;
5869 PyTuple_SetItem(ret,0,ret0Py);
5870 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5874 DataArrayDouble *getData()
5876 DataArrayDouble *ret(self->getData());
5882 DenseMatrix *__add__(const DenseMatrix *other)
5884 return MEDCoupling::DenseMatrix::Add(self,other);
5887 DenseMatrix *__sub__(const DenseMatrix *other)
5889 return MEDCoupling::DenseMatrix::Substract(self,other);
5892 DenseMatrix *__mul__(const DenseMatrix *other)
5894 return MEDCoupling::DenseMatrix::Multiply(self,other);
5897 DenseMatrix *__mul__(const DataArrayDouble *other)
5899 return MEDCoupling::DenseMatrix::Multiply(self,other);
5902 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5904 self->addEqual(other);
5905 Py_XINCREF(trueSelf);
5909 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5911 self->substractEqual(other);
5912 Py_XINCREF(trueSelf);
5916 PyObject *toNumPyMatrix() // not const. It is not a bug !
5918 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5927 def MEDCouplingUMeshReduce(self):
5928 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5929 def MEDCouplingCMeshReduce(self):
5930 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5931 def MEDCouplingIMeshReduce(self):
5932 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5933 def MEDCouplingMappedExtrudedMeshReduce(self):
5934 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5935 def MEDCouplingCurveLinearMeshReduce(self):
5936 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5937 def MEDCoupling1SGTUMeshReduce(self):
5938 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5939 def MEDCoupling1DGTUMeshReduce(self):
5940 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5941 def MEDCouplingFieldDoubleReduce(self):
5942 self.checkConsistencyLight()
5943 d=(self.getTypeOfField(),self.getTimeDiscretization())
5944 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5945 def MEDCouplingFieldIntReduce(self):
5946 self.checkConsistencyLight()
5947 d=(self.getTypeOfField(),self.getTimeDiscretization())
5948 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5949 def MEDCouplingFieldFloatReduce(self):
5950 self.checkConsistencyLight()
5951 d=(self.getTypeOfField(),self.getTimeDiscretization())
5952 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5953 def MEDCouplingFTReduceFunct(cls,params):
5955 ret=object.__new__(cls)
5959 def MEDCouplingFieldTemplateReduce(self):
5960 ret = MEDCouplingFieldDouble(self)
5961 nbTuples = self.getNumberOfTuplesExpected()
5962 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5964 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5966 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5968 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5969 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5970 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5971 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5972 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5973 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5974 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5980 __filename=os.environ.get('PYTHONSTARTUP')
5981 if __filename and os.path.isfile(__filename):
5982 with open(__filename) as __fp: