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]!=MEDCOUPLING2VTKTYPETRADUCER_NONE ? 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));
562 PyObject *AllGeometricTypes()
564 Py_ssize_t sz(MEDCouplingUMesh::N_MEDMEM_ORDER);
565 PyObject *ret(PyList_New(sz));
566 for(Py_ssize_t i=0;i<sz;i++)
567 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDMEM_ORDER[i]));
572 namespace INTERP_KERNEL
575 * \class BoxSplittingOptions
576 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
578 class BoxSplittingOptions
581 BoxSplittingOptions();
583 double getEfficiencyGoal() const;
584 void setEfficiencyGoal(double efficiency);
585 double getEfficiencyThreshold() const;
586 void setEfficiencyThreshold(double efficiencyThreshold);
587 int getMinimumPatchLength() const;
588 void setMinimumPatchLength(int minPatchLength);
589 int getMaximumPatchLength() const;
590 void setMaximumPatchLength(int maxPatchLength);
591 int getMaximumNbOfCellsInPatch() const;
592 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
593 void copyOptions(const BoxSplittingOptions & other);
594 std::string printOptions() const;
597 std::string __str__() const
599 return self->printOptions();
605 namespace MEDCoupling
621 CONST_ON_TIME_INTERVAL = 7
622 } TypeOfTimeDiscretization;
630 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
631 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
633 } MEDCouplingMeshType;
635 class DataArrayInt32;
636 class DataArrayInt64;
637 class DataArrayDouble;
638 class MEDCouplingUMesh;
639 class MEDCouplingCMesh;
640 class MEDCouplingFieldDouble;
642 %extend RefCountObject
644 std::string getHiddenCppPointer() const
646 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
651 %extend MEDCouplingGaussLocalization
653 std::string __str__() const
655 return self->getStringRepr();
658 std::string __repr__() const
660 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
661 oss << self->getStringRepr();
668 class MEDCouplingMesh : public RefCountObject, public TimeLabel
671 void setName(const std::string& name);
672 std::string getName() const;
673 void setDescription(const std::string& descr);
674 std::string getDescription() const;
675 void setTime(double val, int iteration, int order);
676 void setTimeUnit(const std::string& unit);
677 std::string getTimeUnit() const;
678 virtual MEDCouplingMeshType getType() const;
679 bool isStructured() const;
680 virtual MEDCouplingMesh *deepCopy() const;
681 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
682 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
683 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
684 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
685 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
686 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
687 virtual void checkConsistencyLight() const;
688 virtual void checkConsistency(double eps=1e-12) const;
689 virtual int getNumberOfCells() const;
690 virtual int getNumberOfNodes() const;
691 virtual int getSpaceDimension() const;
692 virtual int getMeshDimension() const;
693 virtual DataArrayDouble *getCoordinatesAndOwner() const;
694 virtual DataArrayDouble *computeCellCenterOfMass() const;
695 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
696 virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
697 virtual DataArrayIdType *computeNbOfNodesPerCell() const;
698 virtual DataArrayIdType *computeNbOfFacesPerCell() const;
699 virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
700 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
701 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
702 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
703 virtual std::string simpleRepr() const;
704 virtual std::string advancedRepr() const;
705 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
706 virtual std::string getVTKFileExtension() const;
707 std::string getVTKFileNameOf(const std::string& fileName) const;
709 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
710 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
711 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
712 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
713 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
714 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
715 virtual MEDCouplingUMesh *buildUnstructured() const;
716 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
717 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
718 virtual DataArrayIdType *simplexize(int policy);
719 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
720 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
721 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
722 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
723 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
724 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
725 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
726 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
729 std::string __str__() const
731 return self->simpleRepr();
737 double tmp0=self->getTime(tmp1,tmp2);
738 PyObject *res = PyList_New(3);
739 PyList_SetItem(res,0,SWIG_From_double(tmp0));
740 PyList_SetItem(res,1,SWIG_From_int(tmp1));
741 PyList_SetItem(res,2,SWIG_From_int(tmp2));
745 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
747 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
748 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
754 mcIdType getCellContainingPoint(PyObject *p, double eps) const
758 DataArrayDoubleTuple *aa;
759 std::vector<double> bb;
761 int spaceDim=self->getSpaceDimension();
762 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
763 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
764 return self->getCellContainingPoint(pos,eps);
767 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
771 DataArrayDoubleTuple *aa;
772 std::vector<double> bb;
774 int spaceDim=self->getSpaceDimension();
775 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
776 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
777 MCAuto<DataArrayIdType> elts,eltsIndex;
778 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
779 PyObject *ret=PyTuple_New(2);
780 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
781 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
785 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
789 DataArrayDoubleTuple *aa;
790 std::vector<double> bb;
792 int spaceDim=self->getSpaceDimension();
793 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
794 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
795 MCAuto<DataArrayIdType> elts,eltsIndex;
796 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
797 PyObject *ret=PyTuple_New(2);
798 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
799 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
803 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
805 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
806 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
809 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
811 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayIdType>& d, MCAuto<DataArrayIdType>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
812 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
815 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
819 DataArrayDoubleTuple *aa;
820 std::vector<double> bb;
822 int spaceDim=self->getSpaceDimension();
823 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
824 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
825 std::vector<mcIdType> elts;
826 self->getCellsContainingPoint(pos,eps,elts);
827 DataArrayIdType *ret=DataArrayIdType::New();
828 ret->alloc((int)elts.size(),1);
829 std::copy(elts.begin(),elts.end(),ret->getPointer());
830 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
833 virtual PyObject *getReverseNodalConnectivity() const
835 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
836 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
837 self->getReverseNodalConnectivity(d0,d1);
838 PyObject *ret=PyTuple_New(2);
839 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
840 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
844 void renumberCells(PyObject *li, bool check=true)
847 mcIdType v0; std::vector<mcIdType> v1;
848 const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
849 self->renumberCells(ids,check);
852 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
854 DataArrayIdType *cellCor, *nodeCor;
855 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
856 PyObject *res = PyList_New(2);
857 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
858 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
862 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
864 DataArrayIdType *cellCor=0,*nodeCor=0;
865 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
866 PyObject *res = PyList_New(2);
867 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits<mcIdType>::TI, cellCor?SWIG_POINTER_OWN | 0:0 ));
868 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits<mcIdType>::TI, nodeCor?SWIG_POINTER_OWN | 0:0 ));
872 DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
874 DataArrayIdType *cellCor=0;
875 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
879 DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
882 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
883 if (!SWIG_IsOK(res1))
886 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
887 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size);
891 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
893 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
894 da2->checkAllocated();
895 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
898 PyObject *getNodeIdsOfCell(int cellId) const
900 std::vector<mcIdType> conn;
901 self->getNodeIdsOfCell(cellId,conn);
902 return convertIntArrToPyList2(conn);
905 PyObject *getCoordinatesOfNode(mcIdType nodeId) const
907 std::vector<double> coo;
908 self->getCoordinatesOfNode(nodeId,coo);
909 return convertDblArrToPyList2(coo);
912 void scale(PyObject *point, double factor)
916 DataArrayDoubleTuple *aa;
917 std::vector<double> bb;
919 int spaceDim=self->getSpaceDimension();
920 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
921 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
922 self->scale(pointPtr,factor);
925 PyObject *getBoundingBox() const
927 int spaceDim=self->getSpaceDimension();
928 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
929 self->getBoundingBox(tmp);
930 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
934 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
937 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
938 PyObject *ret=PyTuple_New(2);
939 PyObject *ret0Py=ret0?Py_True:Py_False;
941 PyTuple_SetItem(ret,0,ret0Py);
942 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
946 PyObject *buildPart(PyObject *li) const
948 mcIdType szArr,sw,iTypppArr;
949 std::vector<mcIdType> stdvecTyyppArr;
950 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
951 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
952 if(sw==3)//DataArrayIdType
954 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
955 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
956 std::string name=argpt->getName();
958 ret->setName(name.c_str());
960 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
963 PyObject *buildPartAndReduceNodes(PyObject *li) const
965 mcIdType szArr,sw,iTypppArr;
966 std::vector<mcIdType> stdvecTyyppArr;
967 DataArrayIdType *arr=0;
968 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
969 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
970 if(sw==3)//DataArrayIdType
972 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
973 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
974 std::string name=argpt->getName();
976 ret->setName(name.c_str());
979 PyObject *res = PyList_New(2);
980 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
981 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
982 PyList_SetItem(res,0,obj0);
983 PyList_SetItem(res,1,obj1);
987 PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
990 DataArrayIdType *arr=0;
991 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
992 PyObject *res = PyTuple_New(2);
993 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
996 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
998 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
999 PyTuple_SetItem(res,0,obj0);
1000 PyTuple_SetItem(res,1,obj1);
1004 PyObject *getDistributionOfTypes() const
1006 std::vector<mcIdType> vals=self->getDistributionOfTypes();
1007 if(vals.size()%3!=0)
1008 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
1009 PyObject *ret=PyList_New((mcIdType)vals.size()/3);
1010 for(std::size_t j=0;j<vals.size()/3;j++)
1012 PyObject *ret1=PyList_New(3);
1013 PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
1014 PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
1015 PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
1016 PyList_SetItem(ret,j,ret1);
1021 DataArrayIdType *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
1023 std::vector<mcIdType> code;
1024 std::vector<const DataArrayIdType *> idsPerType;
1025 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li2,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",idsPerType);
1026 convertPyToNewIntArr4(li,1,3,code);
1027 return self->checkTypeConsistencyAndContig(code,idsPerType);
1030 PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const
1032 std::vector<mcIdType> code;
1033 std::vector<DataArrayIdType *> idsInPflPerType;
1034 std::vector<DataArrayIdType *> idsPerType;
1035 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1036 PyObject *ret=PyTuple_New(3);
1038 if(code.size()%3!=0)
1039 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1040 PyObject *ret0=PyList_New((mcIdType)code.size()/3);
1041 for(std::size_t j=0;j<code.size()/3;j++)
1043 PyObject *ret00=PyList_New(3);
1044 PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
1045 PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
1046 PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
1047 PyList_SetItem(ret0,j,ret00);
1049 PyTuple_SetItem(ret,0,ret0);
1051 PyObject *ret1=PyList_New(idsInPflPerType.size());
1052 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1053 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1054 PyTuple_SetItem(ret,1,ret1);
1055 std::size_t n=idsPerType.size();
1056 PyObject *ret2=PyList_New(n);
1057 for(std::size_t i=0;i<n;i++)
1058 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1059 PyTuple_SetItem(ret,2,ret2);
1063 void translate(PyObject *vector)
1067 DataArrayDoubleTuple *aa;
1068 std::vector<double> bb;
1070 int spaceDim=self->getSpaceDimension();
1071 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1072 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1073 self->translate(vectorPtr);
1076 void rotate(PyObject *center, double alpha)
1078 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1081 DataArrayDoubleTuple *aa;
1082 std::vector<double> bb;
1084 int spaceDim=self->getSpaceDimension();
1085 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1086 self->rotate(centerPtr,0,alpha);
1089 void rotate(PyObject *center, PyObject *vector, double alpha)
1091 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1093 DataArrayDouble *a,*a2;
1094 DataArrayDoubleTuple *aa,*aa2;
1095 std::vector<double> bb,bb2;
1097 int spaceDim=self->getSpaceDimension();
1098 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1099 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
1100 self->rotate(centerPtr,vectorPtr,alpha);
1103 PyObject *getAllGeoTypes() const
1105 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1106 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1107 PyObject *res=PyList_New(result.size());
1108 for(int i=0;iL!=result.end(); i++, iL++)
1109 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1113 virtual PyObject *getTinySerializationInformation() const
1115 std::vector<double> a0;
1116 std::vector<mcIdType> a1;
1117 std::vector<std::string> a2;
1118 self->getTinySerializationInformation(a0,a1,a2);
1119 PyObject *ret(PyTuple_New(3));
1120 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1121 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1122 std::size_t sz(a2.size());
1123 PyObject *ret2(PyList_New(sz));
1125 for(std::size_t i=0;i<sz;i++)
1126 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1128 PyTuple_SetItem(ret,2,ret2);
1132 virtual PyObject *serialize() const
1134 DataArrayIdType *a0Tmp(0);
1135 DataArrayDouble *a1Tmp(0);
1136 self->serialize(a0Tmp,a1Tmp);
1137 PyObject *ret(PyTuple_New(2));
1138 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1139 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1143 void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const
1145 std::vector<std::string> littleStrings;
1146 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1149 PyObject *__getstate__() const
1151 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1152 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1153 PyObject *ret(PyTuple_New(2));
1154 PyTuple_SetItem(ret,0,ret0);
1155 PyTuple_SetItem(ret,1,ret1);
1159 void __setstate__(PyObject *inp)
1161 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1162 if(!PyTuple_Check(inp))
1163 throw INTERP_KERNEL::Exception(MSG);
1164 std::size_t sz(PyTuple_Size(inp));
1166 throw INTERP_KERNEL::Exception(MSG);
1167 PyObject *elt0(PyTuple_GetItem(inp,0));
1168 PyObject *elt1(PyTuple_GetItem(inp,1));
1169 std::vector<double> a0;
1170 std::vector<mcIdType> a1;
1171 std::vector<std::string> a2;
1172 DataArrayIdType *b0(0);
1173 DataArrayDouble *b1(0);
1175 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1176 throw INTERP_KERNEL::Exception(MSG);
1177 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1179 fillArrayWithPyListDbl3(a0py,tmp,a0);
1180 convertPyToNewIntArr3(a1py,a1);
1181 fillStringVector(a2py,a2);
1184 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1185 throw INTERP_KERNEL::Exception(MSG);
1186 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1188 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits<mcIdType>::TI,0|0));
1189 if(!SWIG_IsOK(status))
1190 throw INTERP_KERNEL::Exception(MSG);
1191 b0=reinterpret_cast<DataArrayIdType *>(argp);
1192 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1193 if(!SWIG_IsOK(status))
1194 throw INTERP_KERNEL::Exception(MSG);
1195 b1=reinterpret_cast<DataArrayDouble *>(argp);
1197 // useless here to call resizeForUnserialization because arrays are well resized.
1198 self->unserialization(a0,a1,b0,b1,a2);
1201 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1203 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1204 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1205 return MEDCouplingMesh::MergeMeshes(tmp);
1211 //== MEDCouplingMesh End
1213 %include "NormalizedGeometricTypes"
1214 %include "MEDCouplingNatureOfFieldEnum"
1216 namespace MEDCoupling
1218 class MEDCouplingNatureOfField
1221 static const char *GetRepr(NatureOfField nat);
1222 static std::string GetReprNoThrow(NatureOfField nat);
1223 static std::string GetAllPossibilitiesStr();
1227 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1228 // include "MEDCouplingTimeDiscretization.i"
1230 namespace MEDCoupling
1232 class MEDCouplingGaussLocalization
1235 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1236 const std::vector<double>& gsCoo, const std::vector<double>& w);
1237 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1238 INTERP_KERNEL::NormalizedCellType getType() const;
1239 void setType(INTERP_KERNEL::NormalizedCellType typ);
1240 int getNumberOfGaussPt() const;
1241 int getDimension() const;
1242 int getNumberOfPtsInRefCell() const;
1243 std::string getStringRepr() const;
1244 void checkConsistencyLight() const;
1245 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1247 const std::vector<double>& getRefCoords() const;
1248 double getRefCoord(int ptIdInCell, int comp) const;
1249 const std::vector<double>& getGaussCoords() const;
1250 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1251 const std::vector<double>& getWeights() const;
1252 double getWeight(int gaussPtIdInCell, double newVal) const;
1253 void setRefCoord(int ptIdInCell, int comp, double newVal);
1254 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1255 void setWeight(int gaussPtIdInCell, double newVal);
1256 void setRefCoords(const std::vector<double>& refCoo);
1257 void setGaussCoords(const std::vector<double>& gsCoo);
1258 void setWeights(const std::vector<double>& w);
1260 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1264 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1266 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1270 MEDCouplingUMesh *buildRefCell() const
1272 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1278 class MEDCouplingSkyLineArray
1281 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI );
1283 void set( DataArrayIdType* index, DataArrayIdType* value );
1284 void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
1286 int getSuperNumberOf() const;
1287 int getNumberOf() const;
1288 int getLength() const;
1290 void deletePack(const int i, const int j);
1292 void deleteSimplePack(const int i);
1293 void deleteSimplePacks(const DataArrayIdType* idx);
1297 MEDCouplingSkyLineArray()
1299 return MEDCouplingSkyLineArray::New();
1302 MEDCouplingSkyLineArray( const std::vector<mcIdType>& index, const std::vector<mcIdType>& value)
1304 return MEDCouplingSkyLineArray::New(index, value);
1307 MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value )
1309 return MEDCouplingSkyLineArray::New(index, value);
1312 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1314 return MEDCouplingSkyLineArray::New(other);
1317 std::string __str__() const
1319 return self->simpleRepr();
1322 DataArrayIdType *getSuperIndexArray() const
1324 DataArrayIdType *ret(self->getSuperIndexArray());
1330 DataArrayIdType *getIndexArray() const
1332 DataArrayIdType *ret(self->getIndexArray());
1338 DataArrayIdType *getValuesArray() const
1340 DataArrayIdType *ret(self->getValuesArray());
1346 PyObject *getSimplePackSafe(mcIdType absolutePackId) const
1348 std::vector<mcIdType> ret;
1349 self->getSimplePackSafe(absolutePackId,ret);
1350 return convertIntArrToPyList2(ret);
1353 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1355 std::vector<mcIdType> vpack, vspIdx, out;
1357 convertPyToNewIntArr3(superPackIndices,vspIdx);
1358 convertPyToNewIntArr3(pack,vpack);
1360 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1361 return convertIntArrToPyList2(out);
1364 void pushBackPack(const mcIdType i, PyObject *pack)
1366 std::vector<mcIdType> vpack;
1367 convertPyToNewIntArr3(pack,vpack);
1368 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1371 void replaceSimplePack(const mcIdType idx, PyObject *pack)
1373 std::vector<mcIdType> vpack;
1374 convertPyToNewIntArr3(pack,vpack);
1375 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1378 void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks)
1380 std::vector<const DataArrayIdType*> packs;
1381 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType*>(listePacks,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",packs);
1382 self->replaceSimplePacks(idx, packs);
1385 void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack)
1387 std::vector<mcIdType> vpack;
1388 convertPyToNewIntArr3(pack,vpack);
1389 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1392 PyObject *convertToPolyhedronConn() const
1394 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
1395 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
1396 self->convertToPolyhedronConn(d0,d1);
1397 PyObject *ret=PyTuple_New(2);
1398 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1399 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1406 %include "MEDCouplingFieldDiscretization.i"
1408 //== MEDCouplingPointSet
1410 namespace MEDCoupling
1412 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1415 void setCoords(const DataArrayDouble *coords);
1416 DataArrayDouble *getCoordinatesAndOwner() const;
1417 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1419 double getCaracteristicDimension() const;
1420 void recenterForMaxPrecision(double eps);
1421 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1422 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1423 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1424 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1425 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1426 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1427 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1428 static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1429 virtual DataArrayIdType *computeFetchedNodeIds() const;
1430 virtual int getNumberOfNodesInCell(int cellId) const;
1431 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1432 virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1433 virtual DataArrayIdType *zipCoordsTraducer();
1434 virtual DataArrayIdType *findBoundaryNodes() const;
1435 virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0);
1436 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1437 virtual void checkFullyDefined() const;
1438 virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
1439 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1440 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1441 virtual void renumberNodesWithOffsetInConn(int offset);
1442 virtual bool areAllNodesFetched() const;
1443 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1444 virtual void invertOrientationOfAllCells();
1447 std::string __str__() const
1449 return self->simpleRepr();
1452 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const
1454 mcIdType newNbOfNodes;
1455 DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1456 PyObject *res = PyList_New(2);
1457 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1458 PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
1462 PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const
1464 DataArrayIdType *comm, *commIndex;
1465 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1466 PyObject *res = PyList_New(2);
1467 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1468 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1472 PyObject *getCoords()
1474 DataArrayDouble *ret1=self->getCoords();
1477 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1480 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1482 mcIdType szArr,sw,iTypppArr;
1483 std::vector<mcIdType> stdvecTyyppArr;
1484 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1485 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1486 if(sw==3)//DataArrayIdType
1488 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1489 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1490 std::string name=argpt->getName();
1492 ret->setName(name.c_str());
1494 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1497 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1499 mcIdType szArr,sw,iTypppArr;
1500 std::vector<mcIdType> stdvecTyyppArr;
1501 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1502 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1503 if(sw==3)//DataArrayIdType
1505 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1506 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1507 std::string name=argpt->getName();
1509 ret->setName(name.c_str());
1511 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1514 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1516 mcIdType szArr,sw,iTypppArr;
1517 std::vector<mcIdType> stdvecTyyppArr;
1518 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1519 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1520 if(sw==3)//DataArrayIdType
1522 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1523 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1524 std::string name=argpt->getName();
1526 ret->setName(name.c_str());
1528 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1531 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
1533 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1534 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1537 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1539 mcIdType szArr,sw,iTypppArr;
1540 std::vector<mcIdType> stdvecTyyppArr;
1541 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1542 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1543 if(sw==3)//DataArrayIdType
1545 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits<mcIdType>::TI,0|0);
1546 DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp);
1547 std::string name=argpt->getName();
1549 ret->setName(name.c_str());
1551 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1554 void renumberNodes(PyObject *li, mcIdType newNbOfNodes)
1556 mcIdType szArr,sw,iTypppArr;
1557 std::vector<mcIdType> stdvecTyyppArr;
1558 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1559 self->renumberNodes(tmp,newNbOfNodes);
1562 void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes)
1564 mcIdType szArr,sw,iTypppArr;
1565 std::vector<mcIdType> stdvecTyyppArr;
1566 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1567 self->renumberNodesCenter(tmp,newNbOfNodes);
1570 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1572 int spaceDim=self->getSpaceDimension();
1574 DataArrayDouble *a,*a2;
1575 DataArrayDoubleTuple *aa,*aa2;
1576 std::vector<double> bb,bb2;
1578 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1579 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1580 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1581 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1582 std::vector<mcIdType> nodes;
1583 self->findNodesOnLine(p,v,eps,nodes);
1584 DataArrayIdType *ret=DataArrayIdType::New();
1585 ret->alloc(nodes.size(),1);
1586 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1587 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1589 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1591 int spaceDim=self->getSpaceDimension();
1593 DataArrayDouble *a,*a2;
1594 DataArrayDoubleTuple *aa,*aa2;
1595 std::vector<double> bb,bb2;
1597 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1598 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1599 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1600 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1601 std::vector<mcIdType> nodes;
1602 self->findNodesOnPlane(p,v,eps,nodes);
1603 DataArrayIdType *ret=DataArrayIdType::New();
1604 ret->alloc(nodes.size(),1);
1605 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1606 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1609 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1613 DataArrayDoubleTuple *aa;
1614 std::vector<double> bb;
1616 int spaceDim=self->getSpaceDimension();
1617 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1618 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1619 DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps);
1620 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1623 PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const
1625 DataArrayIdType *c=0,*cI=0;
1629 DataArrayDoubleTuple *aa;
1630 std::vector<double> bb;
1632 int spaceDim=self->getSpaceDimension();
1633 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1634 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1635 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1636 PyObject *ret=PyTuple_New(2);
1637 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1638 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1642 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1644 DataArrayIdType *c=0,*cI=0;
1645 int spaceDim=self->getSpaceDimension();
1648 DataArrayDoubleTuple *aa;
1649 std::vector<double> bb;
1651 mcIdType nbOfTuples=-1;
1652 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1653 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1655 PyObject *ret=PyTuple_New(2);
1656 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1657 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1661 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1665 DataArrayDoubleTuple *aa;
1666 std::vector<double> bb;
1668 int spaceDim=self->getSpaceDimension();
1669 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1670 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1672 DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps);
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
1676 void duplicateNodesInCoords(PyObject *li)
1680 std::vector<mcIdType> multiVal;
1681 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1682 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1683 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1687 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1689 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1691 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1693 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
1697 virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const
1699 DataArrayIdType *v0(nullptr),*v1(nullptr);
1700 self->findCommonCells(compType,startCellId,v0,v1);
1701 PyObject *res = PyList_New(2);
1702 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1703 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1708 virtual void renumberNodesInConn(PyObject *li)
1712 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1715 MapII *da2(reinterpret_cast<MapII *>(da));
1716 self->renumberNodesInConn(da2->data());
1720 int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
1721 if (!SWIG_IsOK(res1))
1724 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1725 self->renumberNodesInConn(tmp);
1729 DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da));
1731 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1732 da2->checkAllocated();
1733 self->renumberNodesInConn(da2->getConstPointer());
1737 virtual PyObject *getNodeIdsInUse() const
1740 DataArrayIdType *ret0=self->getNodeIdsInUse(ret1);
1741 PyObject *ret=PyTuple_New(2);
1742 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1743 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1747 virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1749 DataArrayIdType *ret(nullptr);
1751 mcIdType szArr,sw,iTypppArr;
1752 std::vector<mcIdType> stdvecTyyppArr;
1753 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1754 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1758 virtual PyObject *mergeNodes(double precision)
1762 DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2);
1763 PyObject *res = PyList_New(3);
1764 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1765 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1766 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1770 virtual PyObject *mergeNodesCenter(double precision)
1774 DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1775 PyObject *res = PyList_New(3);
1776 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
1777 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1778 PyList_SetItem(res,2,PyInt_FromLong(ret2));
1782 DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1785 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
1786 if (!SWIG_IsOK(res1))
1789 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
1790 return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn);
1794 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
1796 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
1797 da2->checkAllocated();
1798 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1802 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1806 std::vector<mcIdType> multiVal;
1807 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
1808 MEDCoupling::DataArrayIdType *daIntTyypp=0;
1809 mcIdType nbc=self->getNumberOfCells();
1810 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1817 std::ostringstream oss;
1818 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1819 throw INTERP_KERNEL::Exception(oss.str().c_str());
1822 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1827 mcIdType tmp=nbc+singleVal;
1828 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1832 std::ostringstream oss;
1833 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1834 throw INTERP_KERNEL::Exception(oss.str().c_str());
1840 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1844 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1849 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1850 daIntTyypp->checkAllocated();
1851 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1854 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
1858 static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords)
1861 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1862 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1863 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1864 for(mcIdType i=0;i<sz;i++)
1865 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1868 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1871 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1872 mcIdType sw,nbNodes=0;
1873 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1874 std::vector<double> val3;
1875 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1876 "Rotate2DAlg",2,true,nbNodes);
1878 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1879 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1882 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords)
1885 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1886 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1887 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1888 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1889 for(mcIdType i=0;i<sz;i++)
1890 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1893 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1896 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1897 mcIdType sw,nbNodes=0;
1898 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1899 std::vector<double> val3;
1900 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1901 "Rotate3DAlg",3,true,nbNodes);
1903 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1904 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1905 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1910 //== MEDCouplingPointSet End
1912 class MEDCouplingUMeshCell
1915 INTERP_KERNEL::NormalizedCellType getType() const;
1918 std::string __str__() const
1920 return self->repr();
1923 PyObject *getAllConn() const
1926 const mcIdType *r=self->getAllConn(ret2);
1927 PyObject *ret=PyTuple_New(ret2);
1928 for(mcIdType i=0;i<ret2;i++)
1929 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1935 class MEDCouplingUMeshCellIterator
1942 MEDCouplingUMeshCell *ret=self->nextt();
1944 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1947 PyErr_SetString(PyExc_StopIteration,"No more data.");
1954 class MEDCouplingUMeshCellByTypeIterator
1957 ~MEDCouplingUMeshCellByTypeIterator();
1962 MEDCouplingUMeshCellEntry *ret=self->nextt();
1964 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1967 PyErr_SetString(PyExc_StopIteration,"No more data.");
1974 class MEDCouplingUMeshCellByTypeEntry
1977 ~MEDCouplingUMeshCellByTypeEntry();
1980 MEDCouplingUMeshCellByTypeIterator *__iter__()
1982 return self->iterator();
1987 class MEDCouplingUMeshCellEntry
1990 INTERP_KERNEL::NormalizedCellType getType() const;
1991 int getNumberOfElems() const;
1994 MEDCouplingUMeshCellIterator *__iter__()
1996 return self->iterator();
2001 //== MEDCouplingUMesh
2003 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
2006 static MEDCouplingUMesh *New();
2007 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
2008 void checkConsistencyLight() const;
2009 void setMeshDimension(int meshDim);
2010 void allocateCells(int nbOfCells=0);
2011 void finishInsertingCells();
2012 MEDCouplingUMeshCellByTypeEntry *cellsByType();
2013 void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
2014 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
2015 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
2016 int getNodalConnectivityArrayLen() const;
2017 void computeTypes();
2018 std::string reprConnectivityOfThis() const;
2019 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
2021 DataArrayIdType *conformize2D(double eps);
2022 DataArrayIdType *conformize3D(double eps);
2023 DataArrayIdType *colinearize2D(double eps);
2024 DataArrayIdType *colinearizeKeepingConform2D(double eps);
2025 void shiftNodeNumbersInConn(int delta);
2026 std::vector<bool> getQuadraticStatus() const;
2027 DataArrayIdType *findCellIdsOnBoundary() const;
2028 MEDCouplingUMesh *computeSkin() const;
2029 bool checkConsecutiveCellTypes() const;
2030 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2031 DataArrayIdType *rearrange2ConsecutiveCellTypes();
2032 DataArrayIdType *sortCellsInMEDFileFrmt();
2033 DataArrayIdType *getRenumArrForMEDFileFrmt() const;
2034 DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
2035 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2036 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2037 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2038 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
2039 void orientCorrectlyPolyhedrons();
2040 bool isPresenceOfQuadratic() const;
2041 bool isFullyQuadratic() const;
2042 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2043 bool isContiguous1D() const;
2044 void tessellate2D(double eps);
2045 void convertQuadraticCellsToLinear();
2046 DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
2047 void convertDegeneratedCells();
2048 DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
2049 bool removeDegenerated1DCells();
2050 bool areOnlySimplexCells() const;
2051 MEDCouplingFieldDouble *getEdgeRatioField() const;
2052 MEDCouplingFieldDouble *getAspectRatioField() const;
2053 MEDCouplingFieldDouble *getWarpField() const;
2054 MEDCouplingFieldDouble *getSkewField() const;
2055 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2056 DataArrayIdType *convexEnvelop2D();
2057 std::string cppRepr() const;
2058 DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
2059 DataArrayIdType *findAndCorrectBadOriented3DCells();
2060 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2061 MEDCouplingSkyLineArray *generateGraph() const;
2062 DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
2063 DataArrayIdType *buildUnionOf2DMesh() const;
2064 DataArrayIdType *buildUnionOf3DMesh() const;
2065 DataArrayIdType *orderConsecutiveCells1D() const;
2066 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2067 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2068 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2069 void changeOrientationOfCells();
2070 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2071 int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
2072 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2073 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2074 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2075 static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
2076 static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
2080 return MEDCouplingUMesh::New();
2083 MEDCouplingUMesh(const char *meshName, int meshDim)
2085 return MEDCouplingUMesh::New(meshName,meshDim);
2088 std::string __str__() const
2090 return self->simpleRepr();
2093 std::string __repr__() const
2095 std::ostringstream oss;
2096 self->reprQuickOverview(oss);
2100 MEDCouplingUMeshCellIterator *__iter__()
2102 return self->cellIterator();
2105 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2107 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2111 PyObject *getAllGeoTypesSorted() const
2113 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2114 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2115 PyObject *res=PyList_New(result.size());
2116 for(int i=0;iL!=result.end(); i++, iL++)
2117 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2121 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2125 std::vector<mcIdType> multiVal;
2126 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2127 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2128 mcIdType nbc=self->getNumberOfCells();
2129 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2136 std::ostringstream oss;
2137 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2138 throw INTERP_KERNEL::Exception(oss.str().c_str());
2142 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2149 mcIdType tmp=nbc+singleVal;
2150 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2155 std::ostringstream oss;
2156 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2157 throw INTERP_KERNEL::Exception(oss.str().c_str());
2163 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2169 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2170 daIntTyypp->checkAllocated();
2171 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2175 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !");
2179 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2183 std::vector<mcIdType> multiVal;
2184 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2185 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2186 mcIdType nbc=self->getNumberOfCells();
2187 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2194 std::ostringstream oss;
2195 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2196 throw INTERP_KERNEL::Exception(oss.str().c_str());
2200 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2207 mcIdType tmp=nbc+singleVal;
2208 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2213 std::ostringstream oss;
2214 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2215 throw INTERP_KERNEL::Exception(oss.str().c_str());
2221 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2226 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2232 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2233 daIntTyypp->checkAllocated();
2234 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2238 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !");
2242 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li)
2244 mcIdType szArr,sw,iTypppArr;
2245 std::vector<mcIdType> stdvecTyyppArr;
2246 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2249 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2250 throw INTERP_KERNEL::Exception(oss.str().c_str());
2252 self->insertNextCell(type,size,tmp);
2255 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2257 mcIdType szArr,sw,iTypppArr;
2258 std::vector<mcIdType> stdvecTyyppArr;
2259 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2260 self->insertNextCell(type,szArr,tmp);
2263 DataArrayIdType *getNodalConnectivity()
2265 DataArrayIdType *ret=self->getNodalConnectivity();
2270 DataArrayIdType *getNodalConnectivityIndex()
2272 DataArrayIdType *ret=self->getNodalConnectivityIndex();
2278 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1)
2280 mcIdType szArr,sw,iTypppArr;
2281 std::vector<mcIdType> stdvecTyyppArr;
2282 const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2283 mcIdType nbOfDepthPeelingPerformed=0;
2284 DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2285 PyObject *res=PyTuple_New(2);
2286 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2287 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2291 static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI)
2293 DataArrayIdType *v0=0,*v1=0;
2294 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2295 PyObject *res = PyList_New(2);
2296 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2297 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2301 PyObject *distanceToPoint(PyObject *point) const
2305 DataArrayDoubleTuple *aa;
2306 std::vector<double> bb;
2308 int nbOfCompo=self->getSpaceDimension();
2309 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2312 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2313 PyObject *ret=PyTuple_New(2);
2314 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2315 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2319 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2321 DataArrayIdType *ret1=0;
2322 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2323 PyObject *ret=PyTuple_New(2);
2324 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2325 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2329 PyObject *tetrahedrize(int policy)
2332 DataArrayIdType *ret1(0);
2333 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2334 PyObject *ret=PyTuple_New(3);
2335 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2336 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2337 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2341 PyObject *checkButterflyCells(double eps=1e-12)
2343 std::vector<mcIdType> cells;
2344 self->checkButterflyCells(cells,eps);
2345 DataArrayIdType *ret=DataArrayIdType::New();
2346 ret->alloc(cells.size(),1);
2347 std::copy(cells.begin(),cells.end(),ret->getPointer());
2348 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2351 PyObject *splitByType() const
2353 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2354 std::size_t sz=ms.size();
2355 PyObject *ret = PyList_New(sz);
2356 for(std::size_t i=0;i<sz;i++)
2357 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2361 PyObject *partitionBySpreadZone() const
2363 std::vector<DataArrayIdType *> retCpp=self->partitionBySpreadZone();
2364 std::size_t sz=retCpp.size();
2365 PyObject *ret=PyList_New(sz);
2366 for(std::size_t i=0;i<sz;i++)
2367 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2371 static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn)
2373 std::vector<DataArrayIdType *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2374 std::size_t sz=retCpp.size();
2375 PyObject *ret=PyList_New(sz);
2376 for(std::size_t i=0;i<sz;i++)
2377 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2381 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2384 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(ids,&size);
2385 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2386 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2389 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2392 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2393 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2397 DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2400 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2401 DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2405 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2407 DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0;
2408 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2409 PyObject *ret=PyTuple_New(3);
2410 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2411 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2412 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2416 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2418 DataArrayIdType *tmp0=0,*tmp1=0;
2419 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2420 PyObject *ret=PyTuple_New(2);
2421 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2422 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2426 void duplicateNodes(PyObject *li)
2430 std::vector<mcIdType> multiVal;
2431 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2432 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2433 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2437 return self->duplicateNodes(&singleVal,&singleVal+1);
2439 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2441 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2443 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2447 void duplicateNodesInConn(PyObject *li, mcIdType offset)
2451 std::vector<mcIdType> multiVal;
2452 std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2453 MEDCoupling::DataArrayIdType *daIntTyypp=0;
2454 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2458 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2460 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2462 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2464 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !");
2468 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2470 mcIdType szArr,sw,iTypppArr;
2471 std::vector<mcIdType> stdvecTyyppArr;
2472 const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2473 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2476 PyObject *getLevArrPerCellTypes(PyObject *li) const
2479 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
2480 DataArrayIdType *tmp0,*tmp1=0;
2481 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2482 PyObject *ret=PyTuple_New(2);
2483 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2484 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2488 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2490 DataArrayIdType *ret0=0,*ret1=0;
2491 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2492 PyObject *ret=PyTuple_New(2);
2493 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2494 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2498 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2500 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2501 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2502 DataArrayIdType *ret1=0,*ret2=0;
2503 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2504 PyObject *ret=PyTuple_New(3);
2505 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2506 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2507 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2511 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2513 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2514 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2515 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2516 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2519 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2522 std::vector<const MEDCouplingUMesh *> meshes;
2523 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2524 std::vector<DataArrayIdType *> corr;
2525 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2527 PyObject *ret1=PyList_New(sz);
2528 for(std::size_t i=0;i<sz;i++)
2529 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2530 PyObject *ret=PyList_New(2);
2531 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2532 PyList_SetItem(ret,1,ret1);
2536 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2538 std::vector<MEDCouplingUMesh *> meshes;
2539 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2540 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2543 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2545 std::vector<MEDCouplingUMesh *> meshes;
2546 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2547 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2550 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2554 DataArrayDoubleTuple *aa;
2555 std::vector<double> bb;
2557 int spaceDim=self->getSpaceDimension();
2558 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2559 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2561 std::vector<mcIdType> cells;
2562 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2563 DataArrayIdType *ret=DataArrayIdType::New();
2564 ret->alloc(cells.size(),1);
2565 std::copy(cells.begin(),cells.end(),ret->getPointer());
2566 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2569 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2573 DataArrayDoubleTuple *aa;
2574 std::vector<double> bb;
2576 int spaceDim=self->getSpaceDimension();
2577 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2578 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2579 self->orientCorrectly2DCells(v,polyOnly);
2582 PyObject *arePolyhedronsNotCorrectlyOriented() const
2584 std::vector<mcIdType> cells;
2585 self->arePolyhedronsNotCorrectlyOriented(cells);
2586 DataArrayIdType *ret=DataArrayIdType::New();
2587 ret->alloc(cells.size(),1);
2588 std::copy(cells.begin(),cells.end(),ret->getPointer());
2589 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
2592 PyObject *getFastAveragePlaneOfThis() const
2596 self->getFastAveragePlaneOfThis(vec,pos);
2598 std::copy(vec,vec+3,vals);
2599 std::copy(pos,pos+3,vals+3);
2600 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2603 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2605 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2606 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2607 return MEDCouplingUMesh::MergeUMeshes(tmp);
2610 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2612 DataArrayIdType *ret1;
2613 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2614 PyObject *ret=PyTuple_New(2);
2615 PyObject *ret0Py=ret0?Py_True:Py_False;
2617 PyTuple_SetItem(ret,0,ret0Py);
2618 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2622 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2624 DataArrayIdType *ret1;
2625 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2626 PyObject *ret=PyTuple_New(2);
2627 PyObject *ret0Py=ret0?Py_True:Py_False;
2629 PyTuple_SetItem(ret,0,ret0Py);
2630 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2634 PyObject *explode3DMeshTo1D() const
2636 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2637 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2638 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2639 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2640 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2641 PyObject *ret=PyTuple_New(5);
2642 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2643 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2644 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2645 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2646 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2650 PyObject *explodeIntoEdges() const
2652 MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
2653 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2654 PyObject *ret=PyTuple_New(5);
2655 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2656 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2657 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2658 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2659 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2663 PyObject *explodeMeshIntoMicroEdges() const
2665 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2666 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2667 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2668 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2669 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2670 PyObject *ret=PyTuple_New(5);
2671 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2672 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2673 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2674 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2675 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2679 PyObject *buildDescendingConnectivity() const
2681 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2682 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2683 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2684 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2685 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2686 PyObject *ret=PyTuple_New(5);
2687 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2688 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2689 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2690 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2691 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2695 PyObject *buildDescendingConnectivity2() const
2697 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2698 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2699 MCAuto<DataArrayIdType> d2=DataArrayIdType::New();
2700 MCAuto<DataArrayIdType> d3=DataArrayIdType::New();
2701 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2702 PyObject *ret=PyTuple_New(5);
2703 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2704 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2705 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2706 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2707 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2711 PyObject *computeNeighborsOfCells() const
2713 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2714 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2715 PyObject *ret=PyTuple_New(2);
2716 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2721 PyObject *computeNeighborsOfNodes() const
2723 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2724 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2725 PyObject *ret=PyTuple_New(2);
2726 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2727 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2731 PyObject *computeEnlargedNeighborsOfNodes() const
2733 MCAuto<DataArrayIdType> neighbors,neighborsIdx;
2734 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2735 PyObject *ret=PyTuple_New(2);
2736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2741 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const
2743 MCAuto<DataArrayIdType> cellNeigh,cellNeighIndex;
2744 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2745 PyObject *ret=PyTuple_New(2);
2746 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2747 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2751 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI)
2753 DataArrayIdType *neighbors=0,*neighborsIdx=0;
2754 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2755 PyObject *ret=PyTuple_New(2);
2756 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2757 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2761 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2763 MCAuto<DataArrayIdType> d0=DataArrayIdType::New();
2764 MCAuto<DataArrayIdType> d1=DataArrayIdType::New();
2765 DataArrayIdType *d2,*d3,*d4,*dd5;
2766 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2767 PyObject *ret=PyTuple_New(7);
2768 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2769 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2770 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2771 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2772 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2773 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2774 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2778 DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const
2781 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2782 da->checkAllocated();
2783 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2786 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const
2789 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2790 da->checkAllocated();
2791 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2794 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const
2797 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2798 da->checkAllocated();
2799 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2802 PyObject *getTypesOfPart(DataArrayIdType *da) const
2805 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2806 da->checkAllocated();
2807 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2808 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2809 PyObject *res = PyList_New(result.size());
2810 for (int i=0;iL!=result.end(); i++, iL++)
2811 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2815 DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const
2818 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
2819 da->checkAllocated();
2820 DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2821 ret->setName(da->getName().c_str());
2825 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2827 DataArrayIdType *cellNb1=0,*cellNb2=0;
2828 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2829 PyObject *ret=PyTuple_New(3);
2830 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2831 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2832 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2836 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2838 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2839 DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2840 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2841 PyObject *ret(PyTuple_New(4));
2842 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2843 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2844 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2845 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2849 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2851 int spaceDim=self->getSpaceDimension();
2853 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2855 DataArrayDouble *a,*a2;
2856 DataArrayDoubleTuple *aa,*aa2;
2857 std::vector<double> bb,bb2;
2859 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2860 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2861 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2862 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2864 DataArrayIdType *cellIds=0;
2865 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2866 PyObject *ret=PyTuple_New(2);
2867 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2868 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2872 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2874 int spaceDim=self->getSpaceDimension();
2876 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2878 DataArrayDouble *a,*a2;
2879 DataArrayDoubleTuple *aa,*aa2;
2880 std::vector<double> bb,bb2;
2882 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2883 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2884 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2885 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2887 DataArrayIdType *cellIds=0;
2888 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2889 PyObject *ret=PyTuple_New(2);
2890 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2891 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2895 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2898 DataArrayDouble *a,*a2;
2899 DataArrayDoubleTuple *aa,*aa2;
2900 std::vector<double> bb,bb2;
2902 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2903 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2904 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2905 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2906 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2910 DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2912 int spaceDim=self->getSpaceDimension();
2914 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2916 DataArrayDouble *a,*a2;
2917 DataArrayDoubleTuple *aa,*aa2;
2918 std::vector<double> bb,bb2;
2920 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2921 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2922 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2923 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2924 return self->getCellIdsCrossingPlane(orig,vect,eps);
2927 void convertToPolyTypes(PyObject *li)
2931 std::vector<mcIdType> pos2;
2932 DataArrayIdType *pos3=0;
2933 DataArrayIdTypeTuple *pos4=0;
2934 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2939 self->convertToPolyTypes(&pos1,&pos1+1);
2946 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2951 self->convertToPolyTypes(pos3->begin(),pos3->end());
2955 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2959 void convertAllToPoly();
2960 void convertExtrudedPolyhedra();
2962 void simplifyPolyhedra(double eps);
2963 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2964 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2967 //== MEDCouplingUMesh End
2969 //== MEDCouplingMappedExtrudedMesh
2971 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2974 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2975 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2976 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2977 int get2DCellIdForExtrusion() const;
2979 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
2981 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2984 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2986 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2989 MEDCouplingMappedExtrudedMesh()
2991 return MEDCouplingMappedExtrudedMesh::New();
2994 std::string __str__() const
2996 return self->simpleRepr();
2999 std::string __repr__() const
3001 std::ostringstream oss;
3002 self->reprQuickOverview(oss);
3006 PyObject *getMesh2D() const
3008 MEDCouplingUMesh *ret=self->getMesh2D();
3011 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3013 PyObject *getMesh1D() const
3015 MEDCouplingUMesh *ret=self->getMesh1D();
3018 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
3020 PyObject *getMesh3DIds() const
3022 DataArrayIdType *ret=self->getMesh3DIds();
3025 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3030 //== MEDCouplingMappedExtrudedMesh End
3032 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3035 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3036 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3037 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3038 int getNodalConnectivityLength() const;
3039 virtual void allocateCells(int nbOfCells=0);
3040 virtual void checkConsistencyOfConnectivity() const;
3043 virtual void insertNextCell(PyObject *li)
3045 mcIdType szArr,sw,iTypppArr;
3046 std::vector<mcIdType> stdvecTyyppArr;
3047 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3048 self->insertNextCell(tmp,tmp+szArr);
3051 virtual DataArrayIdType *getNodalConnectivity() const
3053 DataArrayIdType *ret=self->getNodalConnectivity();
3054 if(ret) ret->incrRef();
3058 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3060 std::vector< const MEDCoupling1GTUMesh *> parts;
3061 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3062 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3067 //== MEDCoupling1SGTUMesh
3069 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3072 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3073 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3074 void setNodalConnectivity(DataArrayIdType *nodalConn);
3075 int getNumberOfNodesPerCell() const;
3076 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3077 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3078 MEDCoupling1GTUMesh *computeDualMesh() const;
3079 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3080 DataArrayIdType *sortHexa8EachOther();
3083 MEDCoupling1SGTUMesh()
3085 return MEDCoupling1SGTUMesh::New();
3088 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3090 return MEDCoupling1SGTUMesh::New(name,type);
3093 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3095 return MEDCoupling1SGTUMesh::New(m);
3098 std::string __str__() const
3100 return self->simpleRepr();
3103 std::string __repr__() const
3105 std::ostringstream oss;
3106 self->reprQuickOverview(oss);
3110 PyObject *structurizeMe(double eps=1e-12) const
3112 DataArrayIdType *cellPerm(0),*nodePerm(0);
3113 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3114 PyObject *ret(PyTuple_New(3));
3115 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3116 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3117 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3121 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3123 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3124 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3125 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3128 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3130 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3131 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3132 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3137 //== MEDCoupling1SGTUMesh End
3139 //== MEDCoupling1DGTUMesh
3141 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3144 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3145 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3146 void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
3147 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3148 bool isPacked() const;
3151 MEDCoupling1DGTUMesh()
3153 return MEDCoupling1DGTUMesh::New();
3155 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3157 return MEDCoupling1DGTUMesh::New(name,type);
3160 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3162 return MEDCoupling1DGTUMesh::New(m);
3165 std::string __str__() const
3167 return self->simpleRepr();
3170 std::string __repr__() const
3172 std::ostringstream oss;
3173 self->reprQuickOverview(oss);
3177 DataArrayIdType *getNodalConnectivityIndex() const
3179 DataArrayIdType *ret=self->getNodalConnectivityIndex();
3180 if(ret) ret->incrRef();
3184 PyObject *retrievePackedNodalConnectivity() const
3186 DataArrayIdType *ret1=0,*ret2=0;
3187 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3188 PyObject *ret0Py=ret0?Py_True:Py_False;
3190 PyObject *ret=PyTuple_New(3);
3191 PyTuple_SetItem(ret,0,ret0Py);
3192 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3193 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
3197 PyObject *copyWithNodalConnectivityPacked() const
3200 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3201 PyObject *ret=PyTuple_New(2);
3202 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3203 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3204 PyTuple_SetItem(ret,1,ret1Py);
3208 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3210 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3211 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3212 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3215 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3217 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3218 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3219 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3222 static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<mcIdType>& offsetInNodeIdsPerElt)
3224 std::vector<const MEDCoupling::DataArrayIdType *> tmp;
3225 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",tmp);
3226 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3231 //== MEDCoupling1DGTUMeshEnd
3233 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3236 mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3237 mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
3238 mcIdType getNumberOfCellsOfSubLevelMesh() const;
3239 int getSpaceDimensionOnNodeStruct() const;
3240 double computeSquareness() const;
3241 virtual std::vector<mcIdType> getNodeGridStructure() const;
3242 std::vector<mcIdType> getCellGridStructure() const;
3243 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3244 std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
3245 std::vector<mcIdType> getLocationFromNodeId(mcIdType cellId) const;
3246 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3247 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3248 static mcIdType DeduceNumberOfGivenStructure(const std::vector<mcIdType>& st);
3249 static DataArrayIdType *ComputeCornersGhost(const std::vector<mcIdType>& st, mcIdType ghostLev);
3250 static std::vector<mcIdType> GetSplitVectFromStruct(const std::vector<mcIdType>& strct);
3253 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3255 mcIdType tmpp1=-1,tmpp2=-1;
3256 std::vector<mcIdType> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3257 std::vector< std::pair<mcIdType,mcIdType> > inp;
3261 for(mcIdType i=0;i<tmpp1;i++)
3262 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3267 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3268 inp.resize(tmpp1/2);
3269 for(mcIdType i=0;i<tmpp1/2;i++)
3270 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3273 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3274 return self->buildStructuredSubPart(inp);
3277 static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3279 std::vector< std::pair<mcIdType,mcIdType> > inp;
3280 convertPyToVectorPairInt(part,inp);
3282 mcIdType szArr,sw,iTypppArr;
3283 std::vector<mcIdType> stdvecTyyppArr;
3284 const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3285 std::vector<mcIdType> tmp5(tmp4,tmp4+szArr);
3287 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3290 static void MultiplyPartOf(const std::vector<mcIdType>& st, PyObject *part, double factor, DataArrayDouble *da)
3292 std::vector< std::pair<mcIdType,mcIdType> > inp;
3293 convertPyToVectorPairInt(part,inp);
3294 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3297 static void MultiplyPartOfByGhost(const std::vector<mcIdType>& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da)
3299 std::vector< std::pair<mcIdType,mcIdType> > inp;
3300 convertPyToVectorPairInt(part,inp);
3301 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3304 static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector<mcIdType>& st, PyObject *part)
3306 std::vector< std::pair<mcIdType,mcIdType> > inp;
3307 convertPyToVectorPairInt(part,inp);
3308 std::vector<mcIdType> stWithGhost;
3309 std::vector< std::pair<mcIdType,mcIdType> > partWithGhost;
3310 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3311 PyObject *ret(PyTuple_New(2));
3312 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3313 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3317 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<mcIdType>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3319 std::vector< std::pair<mcIdType,mcIdType> > inp;
3320 convertPyToVectorPairInt(partCompactFormat,inp);
3321 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3324 static void AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3326 std::vector< std::pair<mcIdType,mcIdType> > inp;
3327 convertPyToVectorPairInt(partCompactFormat,inp);
3328 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3331 static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3333 std::vector< std::pair<mcIdType,mcIdType> > inp;
3334 convertPyToVectorPairInt(part,inp);
3335 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3338 static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li)
3340 mcIdType szArr,sw,iTypppArr;
3341 std::vector<mcIdType> stdvecTyyppArr;
3342 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3343 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3346 static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3348 mcIdType szArr,sw,iTypppArr;
3349 std::vector<mcIdType> stdvecTyyppArr;
3350 const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3351 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3354 static std::vector<mcIdType> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3356 std::vector< std::pair<mcIdType,mcIdType> > inp;
3357 convertPyToVectorPairInt(partCompactFormat,inp);
3358 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3361 static PyObject *GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
3363 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3364 PyObject *retPy=PyList_New(ret.size());
3365 for(std::size_t i=0;i<ret.size();i++)
3367 PyObject *tmp=PyTuple_New(2);
3368 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3369 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3370 PyList_SetItem(retPy,i,tmp);
3375 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3377 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3378 convertPyToVectorPairInt(r1,r1Cpp);
3379 convertPyToVectorPairInt(r2,r2Cpp);
3380 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3381 PyObject *retPy=PyList_New(ret.size());
3382 for(std::size_t i=0;i<ret.size();i++)
3384 PyObject *tmp=PyTuple_New(2);
3385 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3386 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3387 PyList_SetItem(retPy,i,tmp);
3392 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3394 std::vector< std::pair<mcIdType,mcIdType> > r1Cpp,r2Cpp;
3395 convertPyToVectorPairInt(r1,r1Cpp);
3396 convertPyToVectorPairInt(r2,r2Cpp);
3397 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3400 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3402 mcIdType szArr,sw,iTypppArr;
3403 std::vector<mcIdType> stdvecTyyppArr;
3404 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3405 mcIdType szArr2,sw2,iTypppArr2;
3406 std::vector<mcIdType> stdvecTyyppArr2;
3407 const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3408 std::vector<mcIdType> tmp3(tmp2,tmp2+szArr2);
3409 std::vector< std::pair<mcIdType,mcIdType> > partCompactFormat;
3410 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3411 PyObject *ret=PyTuple_New(2);
3412 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3413 PyTuple_SetItem(ret,0,ret0Py);
3414 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3415 for(std::size_t i=0;i<partCompactFormat.size();i++)
3417 PyObject *tmp4=PyTuple_New(2);
3418 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3419 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3420 PyList_SetItem(ret1Py,i,tmp4);
3422 PyTuple_SetItem(ret,1,ret1Py);
3426 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3428 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3429 convertPyToVectorPairInt(bigInAbs,param0);
3430 convertPyToVectorPairInt(partOfBigInAbs,param1);
3431 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3432 PyObject *retPy(PyList_New(ret.size()));
3433 for(std::size_t i=0;i<ret.size();i++)
3435 PyObject *tmp(PyTuple_New(2));
3436 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3437 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3438 PyList_SetItem(retPy,i,tmp);
3443 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<mcIdType>& translation)
3445 std::vector< std::pair<mcIdType,mcIdType> > param0;
3446 convertPyToVectorPairInt(part,param0);
3447 std::vector< std::pair<mcIdType,mcIdType> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3448 PyObject *retPy(PyList_New(ret.size()));
3449 for(std::size_t i=0;i<ret.size();i++)
3451 PyObject *tmp(PyTuple_New(2));
3452 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3453 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3454 PyList_SetItem(retPy,i,tmp);
3459 static std::vector<mcIdType> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3461 std::vector< std::pair<mcIdType,mcIdType> > param0,param1;
3462 convertPyToVectorPairInt(startingFrom,param0);
3463 convertPyToVectorPairInt(goingTo,param1);
3464 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3467 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3469 std::vector< std::pair<mcIdType,mcIdType> > param0,param1,ret;
3470 convertPyToVectorPairInt(bigInAbs,param0);
3471 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3472 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3473 PyObject *retPy(PyList_New(ret.size()));
3474 for(std::size_t i=0;i<ret.size();i++)
3476 PyObject *tmp(PyTuple_New(2));
3477 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3478 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3479 PyList_SetItem(retPy,i,tmp);
3486 class MEDCouplingCurveLinearMesh;
3488 //== MEDCouplingCMesh
3490 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3493 static MEDCouplingCMesh *New();
3494 static MEDCouplingCMesh *New(const std::string& meshName);
3495 void setCoords(const DataArrayDouble *coordsX,
3496 const DataArrayDouble *coordsY=0,
3497 const DataArrayDouble *coordsZ=0);
3498 void setCoordsAt(int i, const DataArrayDouble *arr);
3499 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3503 return MEDCouplingCMesh::New();
3505 MEDCouplingCMesh(const std::string& meshName)
3507 return MEDCouplingCMesh::New(meshName);
3509 std::string __str__() const
3511 return self->simpleRepr();
3513 std::string __repr__() const
3515 std::ostringstream oss;
3516 self->reprQuickOverview(oss);
3519 DataArrayDouble *getCoordsAt(int i)
3521 DataArrayDouble *ret=self->getCoordsAt(i);
3529 //== MEDCouplingCMesh End
3531 //== MEDCouplingCurveLinearMesh
3533 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3536 static MEDCouplingCurveLinearMesh *New();
3537 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3538 void setCoords(const DataArrayDouble *coords);
3540 MEDCouplingCurveLinearMesh()
3542 return MEDCouplingCurveLinearMesh::New();
3544 MEDCouplingCurveLinearMesh(const std::string& meshName)
3546 return MEDCouplingCurveLinearMesh::New(meshName);
3548 std::string __str__() const
3550 return self->simpleRepr();
3552 std::string __repr__() const
3554 std::ostringstream oss;
3555 self->reprQuickOverview(oss);
3558 DataArrayDouble *getCoords()
3560 DataArrayDouble *ret=self->getCoords();
3565 void setNodeGridStructure(PyObject *gridStruct)
3567 mcIdType szArr,sw,iTypppArr;
3568 std::vector<mcIdType> stdvecTyyppArr;
3569 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3570 self->setNodeGridStructure(tmp,tmp+szArr);
3575 //== MEDCouplingCurveLinearMesh End
3577 //== MEDCouplingIMesh
3579 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3582 static MEDCouplingIMesh *New();
3584 void setSpaceDimension(int spaceDim);
3585 std::vector<mcIdType> getNodeStruct() const;
3586 std::vector<double> getOrigin() const;
3587 std::vector<double> getDXYZ() const;
3588 void setAxisUnit(const std::string& unitName);
3589 std::string getAxisUnit() const;
3590 double getMeasureOfAnyCell() const;
3591 MEDCouplingCMesh *convertToCartesian() const;
3592 void refineWithFactor(const std::vector<mcIdType>& factors);
3593 MEDCouplingIMesh *asSingleCell() const;
3594 MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
3599 return MEDCouplingIMesh::New();
3601 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3603 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3604 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3605 const mcIdType *nodeStrctPtr(0);
3606 const double *originPtr(0),*dxyzPtr(0);
3607 mcIdType sw,sz,val0;
3608 std::vector<mcIdType> bb0;
3609 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3612 std::vector<double> bb,bb2;
3614 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3615 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3617 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3620 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3622 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3625 void setNodeStruct(PyObject *nodeStrct)
3627 mcIdType sw,sz,val0;
3628 std::vector<mcIdType> bb0;
3629 const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3630 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3633 void setOrigin(PyObject *origin)
3635 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3637 std::vector<double> bb;
3638 mcIdType sw,nbTuples;
3639 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3640 self->setOrigin(originPtr,originPtr+nbTuples);
3643 void setDXYZ(PyObject *dxyz)
3645 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3647 std::vector<double> bb;
3648 mcIdType sw,nbTuples;
3649 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3650 self->setDXYZ(originPtr,originPtr+nbTuples);
3653 static void CondenseFineToCoarse(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA)
3655 std::vector< std::pair<mcIdType,mcIdType> > inp;
3656 convertPyToVectorPairInt(fineLocInCoarse,inp);
3657 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3660 static void CondenseFineToCoarseGhost(const std::vector<mcIdType>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, DataArrayDouble *coarseDA, mcIdType ghostSize)
3662 std::vector< std::pair<mcIdType,mcIdType> > inp;
3663 convertPyToVectorPairInt(fineLocInCoarse,inp);
3664 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3667 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts)
3669 std::vector< std::pair<mcIdType,mcIdType> > inp;
3670 convertPyToVectorPairInt(fineLocInCoarse,inp);
3671 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3674 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3676 std::vector< std::pair<mcIdType,mcIdType> > inp;
3677 convertPyToVectorPairInt(fineLocInCoarse,inp);
3678 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3681 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize)
3683 std::vector< std::pair<mcIdType,mcIdType> > inp;
3684 convertPyToVectorPairInt(fineLocInCoarse,inp);
3685 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3688 std::string __str__() const
3690 return self->simpleRepr();
3692 std::string __repr__() const
3694 std::ostringstream oss;
3695 self->reprQuickOverview(oss);
3701 //== MEDCouplingIMesh End
3705 namespace MEDCoupling
3707 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3710 virtual void checkConsistencyLight() const;
3711 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3712 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3713 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3714 void setName(const char *name);
3715 std::string getDescription() const;
3716 void setDescription(const char *desc);
3717 std::string getName() const;
3718 TypeOfField getTypeOfField() const;
3719 NatureOfField getNature() const;
3720 virtual void setNature(NatureOfField nat);
3721 DataArrayDouble *getLocalizationOfDiscr() const;
3722 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3723 mcIdType getNumberOfTuplesExpected() const;
3724 mcIdType getNumberOfMeshPlacesExpected() const;
3725 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3726 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3727 void clearGaussLocalizations();
3728 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3729 mcIdType getNbOfGaussLocalization() const;
3730 mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
3731 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3732 mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3733 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3735 PyObject *getMesh() const
3737 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3740 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3743 PyObject *getDiscretization()
3745 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3748 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3751 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3753 std::set<mcIdType> ret=self->getGaussLocalizationIdsOfOneType(type);
3754 return convertIntArrToPyList3(ret);
3757 PyObject *buildSubMeshData(PyObject *li) const
3759 DataArrayIdType *ret1=0;
3760 MEDCouplingMesh *ret0=0;
3762 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3763 if (!SWIG_IsOK(res1))
3766 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3767 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3771 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3773 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3774 da2->checkAllocated();
3775 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3777 PyObject *res = PyList_New(2);
3778 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3779 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3783 PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const
3785 DataArrayIdType *ret1=0;
3787 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3788 PyObject *res=PyTuple_New(2);
3789 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3791 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
3794 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3795 PyTuple_SetItem(res,1,res1);
3800 DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3803 mcIdType v0; std::vector<mcIdType> v1;
3804 const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3805 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3808 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3809 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3812 int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
3813 if (!SWIG_IsOK(res1))
3816 INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
3817 self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg);
3821 DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
3823 throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !");
3824 da2->checkAllocated();
3825 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3829 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3831 std::vector<mcIdType> tmp;
3832 self->getCellIdsHavingGaussLocalization(locId,tmp);
3833 DataArrayIdType *ret=DataArrayIdType::New();
3834 ret->alloc((mcIdType)tmp.size(),1);
3835 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3836 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
3839 mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3841 std::vector<mcIdType> inp0;
3842 convertPyToNewIntArr4(code,1,3,inp0);
3843 std::vector<const DataArrayIdType *> inp1;
3844 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(idsPerType,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",inp1);
3845 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3850 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3853 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3854 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3855 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3856 static MEDCouplingFieldTemplate *New(TypeOfField type);
3857 std::string simpleRepr() const;
3858 std::string advancedRepr() const;
3859 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3860 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3863 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3865 return MEDCouplingFieldTemplate::New(f);
3868 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3870 return MEDCouplingFieldTemplate::New(f);
3873 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3875 return MEDCouplingFieldTemplate::New(f);
3878 MEDCouplingFieldTemplate(TypeOfField type)
3880 return MEDCouplingFieldTemplate::New(type);
3883 std::string __str__() const
3885 return self->simpleRepr();
3888 std::string __repr__() const
3890 std::ostringstream oss;
3891 self->reprQuickOverview(oss);
3895 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3898 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3899 PyObject *ret=PyTuple_New(2);
3900 PyObject *ret0Py=ret0?Py_True:Py_False;
3902 PyTuple_SetItem(ret,0,ret0Py);
3903 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3910 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3913 TypeOfTimeDiscretization getTimeDiscretization() const;
3915 MEDCouplingFieldT();
3916 ~MEDCouplingFieldT();
3919 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3920 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3921 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3923 class MEDCouplingFieldInt;
3924 class MEDCouplingFieldFloat;
3926 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3929 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3930 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3931 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3932 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3933 void setTimeUnit(const std::string& unit);
3934 std::string getTimeUnit() const;
3935 void synchronizeTimeWithSupport();
3936 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3937 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3938 std::string simpleRepr() const;
3939 std::string advancedRepr() const;
3940 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3941 MEDCouplingFieldInt *convertToIntField() const;
3942 MEDCouplingFieldFloat *convertToFloatField() const;
3943 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3944 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3945 MEDCouplingFieldDouble *deepCopy() const;
3946 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3947 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3948 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3949 double getIJ(int tupleId, int compoId) const;
3950 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3951 void synchronizeTimeWithMesh();
3952 void setArray(DataArrayDouble *array);
3953 void setEndArray(DataArrayDouble *array);
3954 void setTime(double val, int iteration, int order);
3955 void setStartTime(double val, int iteration, int order);
3956 void setEndTime(double val, int iteration, int order);
3957 void applyLin(double a, double b, int compoId);
3958 void applyLin(double a, double b);
3959 int getNumberOfComponents() const;
3960 int getNumberOfTuples() const;
3961 int getNumberOfValues() const;
3962 void setTimeTolerance(double val);
3963 double getTimeTolerance() const;
3964 void setIteration(int it);
3965 void setEndIteration(int it);
3966 void setOrder(int order);
3967 void setEndOrder(int order);
3968 void setTimeValue(double val);
3969 void setEndTimeValue(double val);
3970 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3971 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3972 bool mergeNodes(double eps, double epsOnVals=1e-15);
3973 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3974 bool zipCoords(double epsOnVals=1e-15);
3975 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3976 bool simplexize(int policy);
3977 MEDCouplingFieldDouble *doublyContractedProduct() const;
3978 MEDCouplingFieldDouble *determinant() const;
3979 MEDCouplingFieldDouble *eigenValues() const;
3980 MEDCouplingFieldDouble *eigenVectors() const;
3981 MEDCouplingFieldDouble *inverse() const;
3982 MEDCouplingFieldDouble *trace() const;
3983 MEDCouplingFieldDouble *deviator() const;
3984 MEDCouplingFieldDouble *magnitude() const;
3985 MEDCouplingFieldDouble *maxPerTuple() const;
3986 void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
3987 void sortPerTuple(bool asc);
3988 MEDCouplingFieldDouble &operator=(double value);
3989 void fillFromAnalytic(int nbOfComp, const std::string& func);
3990 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
3991 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3992 void applyFunc(int nbOfComp, const std::string& func);
3993 void applyFuncCompo(int nbOfComp, const std::string& func);
3994 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3995 void applyFunc(int nbOfComp, double val);
3996 void applyFunc(const std::string& func);
3997 void applyFuncFast32(const std::string& func);
3998 void applyFuncFast64(const std::string& func);
3999 double accumulate(int compId) const;
4000 double getMaxValue() const;
4001 double getMinValue() const;
4002 double getAverageValue() const;
4003 double norm2() const;
4004 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
4005 double getWeightedAverageValue(int compId, bool isWAbs) const;
4006 double integral(int compId, bool isWAbs) const;
4007 double normL1(int compId) const;
4008 double normL2(int compId) const;
4009 double normMax(int compId) const;
4010 DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
4011 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
4012 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4013 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4014 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4015 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
4016 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4017 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
4018 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4019 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
4020 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4021 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4022 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4023 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4024 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
4025 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4026 MEDCouplingFieldDouble *negate() const;
4028 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4030 return MEDCouplingFieldDouble::New(type,td);
4033 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4035 return MEDCouplingFieldDouble::New(ft,td);
4038 std::string __str__() const
4040 return self->simpleRepr();
4043 std::string __repr__() const
4045 std::ostringstream oss;
4046 self->reprQuickOverview(oss);
4050 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4053 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4054 PyObject *ret=PyTuple_New(2);
4055 PyObject *ret0Py=ret0?Py_True:Py_False;
4057 PyTuple_SetItem(ret,0,ret0Py);
4058 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4062 MEDCouplingFieldDouble *voronoize(double eps) const
4064 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4068 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4070 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4074 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4076 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4078 DataArrayDouble *a,*a2;
4079 DataArrayDoubleTuple *aa,*aa2;
4080 std::vector<double> bb,bb2;
4082 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4083 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4084 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4087 DataArrayDouble *getArray()
4089 DataArrayDouble *ret=self->getArray();
4095 PyObject *getArrays() const
4097 std::vector<DataArrayDouble *> arrs=self->getArrays();
4098 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4101 std::size_t sz=arrs.size();
4102 PyObject *ret=PyTuple_New(sz);
4103 for(std::size_t i=0;i<sz;i++)
4106 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4108 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4113 void setArrays(PyObject *ls)
4115 std::vector<const DataArrayDouble *> tmp;
4116 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4117 std::size_t sz=tmp.size();
4118 std::vector<DataArrayDouble *> arrs(sz);
4119 for(std::size_t i=0;i<sz;i++)
4120 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4121 self->setArrays(arrs);
4124 DataArrayDouble *getEndArray()
4126 DataArrayDouble *ret=self->getEndArray();
4132 PyObject *getValueOn(PyObject *sl) const
4136 DataArrayDoubleTuple *aa;
4137 std::vector<double> bb;
4139 const MEDCouplingMesh *mesh=self->getMesh();
4141 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4142 int spaceDim=mesh->getSpaceDimension();
4143 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4144 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4146 mcIdType sz=ToIdType(self->getNumberOfComponents());
4147 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4148 self->getValueOn(spaceLoc,res);
4149 return convertDblArrToPyList<double>(res,sz);
4152 PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
4154 mcIdType sz=ToIdType(self->getNumberOfComponents());
4155 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4156 self->getValueOnPos(i,j,k,res);
4157 return convertDblArrToPyList<double>(res,sz);
4160 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4162 const MEDCouplingMesh *mesh(self->getMesh());
4164 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4167 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4168 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4169 mesh->getSpaceDimension(),true,nbPts);
4170 return self->getValueOnMulti(inp,(int)nbPts);
4173 PyObject *getValueOn(PyObject *sl, double time) const
4177 DataArrayDoubleTuple *aa;
4178 std::vector<double> bb;
4180 const MEDCouplingMesh *mesh=self->getMesh();
4182 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4183 int spaceDim=mesh->getSpaceDimension();
4184 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4185 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4188 mcIdType sz=ToIdType(self->getNumberOfComponents());
4189 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4190 self->getValueOn(spaceLoc,time,res);
4191 return convertDblArrToPyList<double>(res,sz);
4194 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4196 if(self->getArray()!=0)
4197 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4200 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4201 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4202 self->setArray(arr);
4209 double tmp0=self->getTime(tmp1,tmp2);
4210 PyObject *res = PyList_New(3);
4211 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4212 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4213 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4217 PyObject *getStartTime()
4220 double tmp0=self->getStartTime(tmp1,tmp2);
4221 PyObject *res = PyList_New(3);
4222 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4223 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4224 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4228 PyObject *getEndTime()
4231 double tmp0=self->getEndTime(tmp1,tmp2);
4232 PyObject *res = PyList_New(3);
4233 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4234 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4235 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4238 PyObject *accumulate() const
4240 mcIdType sz=ToIdType(self->getNumberOfComponents());
4241 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4242 self->accumulate(tmp);
4243 return convertDblArrToPyList<double>(tmp,sz);
4245 PyObject *integral(bool isWAbs) const
4247 mcIdType sz=ToIdType(self->getNumberOfComponents());
4248 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4249 self->integral(isWAbs,tmp);
4250 return convertDblArrToPyList<double>(tmp,sz);
4252 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4254 mcIdType sz=ToIdType(self->getNumberOfComponents());
4255 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4256 self->getWeightedAverageValue(tmp,isWAbs);
4257 return convertDblArrToPyList<double>(tmp,sz);
4259 PyObject *normL1() const
4261 mcIdType sz=ToIdType(self->getNumberOfComponents());
4262 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4264 return convertDblArrToPyList<double>(tmp,sz);
4266 PyObject *normL2() const
4268 mcIdType sz=ToIdType(self->getNumberOfComponents());
4269 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4271 return convertDblArrToPyList<double>(tmp,sz);
4273 PyObject *normMax() const
4275 mcIdType sz=ToIdType(self->getNumberOfComponents());
4276 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4278 return convertDblArrToPyList<double>(tmp,sz);
4280 void renumberCells(PyObject *li, bool check=true)
4282 mcIdType szArr,sw,iTypppArr;
4283 std::vector<mcIdType> stdvecTyyppArr;
4284 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4285 self->renumberCells(tmp,check);
4288 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4290 mcIdType szArr,sw,iTypppArr;
4291 std::vector<mcIdType> stdvecTyyppArr;
4292 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4293 self->renumberCellsWithoutMesh(tmp,check);
4296 void renumberNodes(PyObject *li, double eps=1e-15)
4298 mcIdType szArr,sw,iTypppArr;
4299 std::vector<mcIdType> stdvecTyyppArr;
4300 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4301 self->renumberNodes(tmp,eps);
4304 void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15)
4306 mcIdType szArr,sw,iTypppArr;
4307 std::vector<mcIdType> stdvecTyyppArr;
4308 const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4309 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4312 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4314 return fieldT_buildSubPart(self,li);
4317 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4319 return fieldT__getitem__(self,li);
4322 PyObject *getMaxValue2() const
4324 DataArrayIdType *tmp;
4325 double r1=self->getMaxValue2(tmp);
4326 PyObject *ret=PyTuple_New(2);
4327 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4328 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4332 PyObject *getMinValue2() const
4334 DataArrayIdType *tmp;
4335 double r1=self->getMinValue2(tmp);
4336 PyObject *ret=PyTuple_New(2);
4337 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4338 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
4342 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4344 std::vector<std::size_t> tmp;
4345 convertPyToNewIntArr3(li,tmp);
4346 return self->keepSelectedComponents(tmp);
4349 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4351 std::vector<std::size_t> tmp;
4352 convertPyToNewIntArr3(li,tmp);
4353 self->setSelectedComponents(f,tmp);
4356 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4359 DataArrayDouble *a,*a2;
4360 DataArrayDoubleTuple *aa,*aa2;
4361 std::vector<double> bb,bb2;
4364 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4365 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4366 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4367 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4369 return self->extractSlice3D(orig,vect,eps);
4372 MEDCouplingFieldDouble *__add__(PyObject *obj)
4374 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4377 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4379 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4382 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4384 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.";
4385 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4388 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4390 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4392 return (*self)-(*other);
4394 throw INTERP_KERNEL::Exception(msg);
4399 DataArrayDoubleTuple *aa;
4400 std::vector<double> bb;
4402 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4407 if(!self->getArray())
4408 throw INTERP_KERNEL::Exception(msg2);
4409 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4410 ret->applyLin(1.,-val);
4411 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4412 ret2->setArray(ret);
4417 if(!self->getArray())
4418 throw INTERP_KERNEL::Exception(msg2);
4419 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4420 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4421 ret2->setArray(ret);
4426 if(!self->getArray())
4427 throw INTERP_KERNEL::Exception(msg2);
4428 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4429 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4430 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4431 ret2->setArray(ret);
4436 if(!self->getArray())
4437 throw INTERP_KERNEL::Exception(msg2);
4438 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4439 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4440 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4441 ret2->setArray(ret);
4445 { throw INTERP_KERNEL::Exception(msg); }
4449 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4451 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4454 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4456 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4459 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4461 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4464 MEDCouplingFieldDouble *__div__(PyObject *obj)
4466 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.";
4467 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4470 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4472 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4474 return (*self)/(*other);
4476 throw INTERP_KERNEL::Exception(msg);
4481 DataArrayDoubleTuple *aa;
4482 std::vector<double> bb;
4484 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4490 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4491 if(!self->getArray())
4492 throw INTERP_KERNEL::Exception(msg2);
4493 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4494 ret->applyLin(1./val,0);
4495 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4496 ret2->setArray(ret);
4501 if(!self->getArray())
4502 throw INTERP_KERNEL::Exception(msg2);
4503 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4504 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4505 ret2->setArray(ret);
4510 if(!self->getArray())
4511 throw INTERP_KERNEL::Exception(msg2);
4512 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4513 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4514 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4515 ret2->setArray(ret);
4520 if(!self->getArray())
4521 throw INTERP_KERNEL::Exception(msg2);
4522 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4523 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4524 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4525 ret2->setArray(ret);
4529 { throw INTERP_KERNEL::Exception(msg); }
4533 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4535 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4538 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4540 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.";
4541 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4544 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4546 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4548 return (*self)^(*other);
4550 throw INTERP_KERNEL::Exception(msg);
4555 DataArrayDoubleTuple *aa;
4556 std::vector<double> bb;
4558 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4563 if(!self->getArray())
4564 throw INTERP_KERNEL::Exception(msg2);
4565 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4567 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4568 ret2->setArray(ret);
4573 if(!self->getArray())
4574 throw INTERP_KERNEL::Exception(msg2);
4575 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4576 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4577 ret2->setArray(ret);
4582 if(!self->getArray())
4583 throw INTERP_KERNEL::Exception(msg2);
4584 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4585 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4586 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4587 ret2->setArray(ret);
4592 if(!self->getArray())
4593 throw INTERP_KERNEL::Exception(msg2);
4594 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4595 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4596 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4597 ret2->setArray(ret);
4601 { throw INTERP_KERNEL::Exception(msg); }
4605 MEDCouplingFieldDouble *__neg__() const
4607 return self->negate();
4610 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4612 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.";
4613 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4616 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4618 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4622 Py_XINCREF(trueSelf);
4626 throw INTERP_KERNEL::Exception(msg);
4631 DataArrayDoubleTuple *aa;
4632 std::vector<double> bb;
4634 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4639 if(!self->getArray())
4640 throw INTERP_KERNEL::Exception(msg2);
4641 self->getArray()->applyLin(1.,val);
4642 Py_XINCREF(trueSelf);
4647 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4650 Py_XINCREF(trueSelf);
4655 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4656 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4657 ret2->setArray(aaa);
4659 Py_XINCREF(trueSelf);
4664 if(!self->getArray())
4665 throw INTERP_KERNEL::Exception(msg2);
4666 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4667 self->getArray()->addEqual(aaa);
4668 Py_XINCREF(trueSelf);
4672 { throw INTERP_KERNEL::Exception(msg); }
4676 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4678 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.";
4679 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4682 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4684 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4688 Py_XINCREF(trueSelf);
4692 throw INTERP_KERNEL::Exception(msg);
4697 DataArrayDoubleTuple *aa;
4698 std::vector<double> bb;
4700 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4705 if(!self->getArray())
4706 throw INTERP_KERNEL::Exception(msg2);
4707 self->getArray()->applyLin(1.,-val);
4708 Py_XINCREF(trueSelf);
4713 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4716 Py_XINCREF(trueSelf);
4721 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4722 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4723 ret2->setArray(aaa);
4725 Py_XINCREF(trueSelf);
4730 if(!self->getArray())
4731 throw INTERP_KERNEL::Exception(msg2);
4732 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4733 self->getArray()->substractEqual(aaa);
4734 Py_XINCREF(trueSelf);
4738 { throw INTERP_KERNEL::Exception(msg); }
4742 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4744 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.";
4745 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4748 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4750 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4754 Py_XINCREF(trueSelf);
4758 throw INTERP_KERNEL::Exception(msg);
4763 DataArrayDoubleTuple *aa;
4764 std::vector<double> bb;
4766 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4771 if(!self->getArray())
4772 throw INTERP_KERNEL::Exception(msg2);
4773 self->getArray()->applyLin(val,0);
4774 Py_XINCREF(trueSelf);
4779 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4782 Py_XINCREF(trueSelf);
4787 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4788 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4789 ret2->setArray(aaa);
4791 Py_XINCREF(trueSelf);
4796 if(!self->getArray())
4797 throw INTERP_KERNEL::Exception(msg2);
4798 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4799 self->getArray()->multiplyEqual(aaa);
4800 Py_XINCREF(trueSelf);
4804 { throw INTERP_KERNEL::Exception(msg); }
4808 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4810 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.";
4811 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4814 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4816 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4820 Py_XINCREF(trueSelf);
4824 throw INTERP_KERNEL::Exception(msg);
4829 DataArrayDoubleTuple *aa;
4830 std::vector<double> bb;
4832 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4838 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4839 if(!self->getArray())
4840 throw INTERP_KERNEL::Exception(msg2);
4841 self->getArray()->applyLin(1./val,0);
4842 Py_XINCREF(trueSelf);
4847 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4850 Py_XINCREF(trueSelf);
4855 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4856 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4857 ret2->setArray(aaa);
4859 Py_XINCREF(trueSelf);
4864 if(!self->getArray())
4865 throw INTERP_KERNEL::Exception(msg2);
4866 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4867 self->getArray()->divideEqual(aaa);
4868 Py_XINCREF(trueSelf);
4872 { throw INTERP_KERNEL::Exception(msg); }
4876 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4878 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.";
4879 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4882 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4884 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4888 Py_XINCREF(trueSelf);
4892 throw INTERP_KERNEL::Exception(msg);
4897 DataArrayDoubleTuple *aa;
4898 std::vector<double> bb;
4900 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4905 if(!self->getArray())
4906 throw INTERP_KERNEL::Exception(msg2);
4907 self->getArray()->applyPow(val);
4908 Py_XINCREF(trueSelf);
4913 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4916 Py_XINCREF(trueSelf);
4921 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4922 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4923 ret2->setArray(aaa);
4925 Py_XINCREF(trueSelf);
4930 if(!self->getArray())
4931 throw INTERP_KERNEL::Exception(msg2);
4932 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size());
4933 self->getArray()->powEqual(aaa);
4934 Py_XINCREF(trueSelf);
4938 { throw INTERP_KERNEL::Exception(msg); }
4942 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4944 std::vector<const MEDCouplingFieldDouble *> tmp;
4945 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4946 return MEDCouplingFieldDouble::MergeFields(tmp);
4949 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4951 std::vector<const MEDCouplingFieldDouble *> tmp;
4952 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4953 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4956 PyObject *getTinySerializationInformation() const
4958 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4961 PyObject *serialize() const
4963 return field_serialize<double>(self);
4966 PyObject *__getstate__() const
4968 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4971 void __setstate__(PyObject *inp)
4973 field__setstate__<double>(self,inp);
4978 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4981 int getNumberOfFields() const;
4982 MEDCouplingMultiFields *deepCopy() const;
4983 virtual std::string simpleRepr() const;
4984 virtual std::string advancedRepr() const;
4985 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4986 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4987 virtual void checkConsistencyLight() const;
4990 std::string __str__() const
4992 return self->simpleRepr();
4994 static MEDCouplingMultiFields *New(PyObject *li)
4996 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4997 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4998 std::size_t sz=tmp.size();
4999 std::vector<MEDCouplingFieldDouble *> fs(sz);
5000 for(std::size_t i=0;i<sz;i++)
5001 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5002 return MEDCouplingMultiFields::New(fs);
5004 MEDCouplingMultiFields(PyObject *li)
5006 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5007 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5008 std::size_t sz=tmp.size();
5009 std::vector<MEDCouplingFieldDouble *> fs(sz);
5010 for(std::size_t i=0;i<sz;i++)
5011 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5012 return MEDCouplingMultiFields::New(fs);
5014 PyObject *getFields() const
5016 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
5017 std::size_t sz=fields.size();
5018 PyObject *res = PyList_New(sz);
5019 for(std::size_t i=0;i<sz;i++)
5023 fields[i]->incrRef();
5024 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5028 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5033 PyObject *getFieldAtPos(int id) const
5035 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5039 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5042 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5044 PyObject *getMeshes() const
5046 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5047 std::size_t sz=ms.size();
5048 PyObject *res = PyList_New(sz);
5049 for(std::size_t i=0;i<sz;i++)
5054 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5058 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5063 PyObject *getDifferentMeshes() const
5065 std::vector<int> refs;
5066 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5067 std::size_t sz=ms.size();
5068 PyObject *res = PyList_New(sz);
5069 for(std::size_t i=0;i<sz;i++)
5074 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5078 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5082 PyObject *ret=PyTuple_New(2);
5083 PyTuple_SetItem(ret,0,res);
5084 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5087 PyObject *getArrays() const
5089 std::vector<DataArrayDouble *> ms=self->getArrays();
5090 std::size_t sz=ms.size();
5091 PyObject *res = PyList_New(sz);
5092 for(std::size_t i=0;i<sz;i++)
5097 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5101 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5106 PyObject *getDifferentArrays() const
5108 std::vector< std::vector<int> > refs;
5109 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5110 std::size_t sz=ms.size();
5111 PyObject *res = PyList_New(sz);
5112 PyObject *res2 = PyList_New(sz);
5113 for(std::size_t i=0;i<sz;i++)
5118 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5122 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5124 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5127 PyObject *ret=PyTuple_New(2);
5128 PyTuple_SetItem(ret,0,res);
5129 PyTuple_SetItem(ret,1,res2);
5135 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5138 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5139 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5140 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5141 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5142 void setTimeUnit(const std::string& unit);
5143 std::string getTimeUnit() const;
5144 void setTime(double val, int iteration, int order);
5145 void setArray(DataArrayInt32 *array);
5146 MEDCouplingFieldInt *deepCopy() const;
5147 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5148 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5149 MEDCouplingFieldDouble *convertToDblField() const;
5150 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5152 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5154 return MEDCouplingFieldInt::New(type,td);
5157 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5159 return MEDCouplingFieldInt::New(ft,td);
5162 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5165 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5166 PyObject *ret=PyTuple_New(2);
5167 PyObject *ret0Py=ret0?Py_True:Py_False;
5169 PyTuple_SetItem(ret,0,ret0Py);
5170 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5174 std::string __str__() const
5176 return self->simpleRepr();
5179 std::string __repr__() const
5181 std::ostringstream oss;
5182 self->reprQuickOverview(oss);
5186 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5188 return fieldT_buildSubPart(self,li);
5191 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5193 return fieldT__getitem__(self,li);
5196 DataArrayInt32 *getArray()
5198 DataArrayInt32 *ret=self->getArray();
5207 double tmp0=self->getTime(tmp1,tmp2);
5208 PyObject *res = PyList_New(3);
5209 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5210 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5211 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5215 PyObject *getTinySerializationInformation() const
5217 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5220 PyObject *serialize() const
5222 return field_serialize<int>(self);
5225 PyObject *__getstate__() const
5227 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5230 void __setstate__(PyObject *inp)
5232 field__setstate__<int>(self,inp);
5237 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5240 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5241 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5242 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5243 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5244 void setTimeUnit(const std::string& unit);
5245 std::string getTimeUnit() const;
5246 void setTime(double val, int iteration, int order);
5247 void setArray(DataArrayFloat *array);
5248 MEDCouplingFieldFloat *deepCopy() const;
5249 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5250 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5251 MEDCouplingFieldDouble *convertToDblField() const;
5252 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5254 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5256 return MEDCouplingFieldFloat::New(type,td);
5259 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5261 return MEDCouplingFieldFloat::New(ft,td);
5264 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5267 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5268 PyObject *ret=PyTuple_New(2);
5269 PyObject *ret0Py=ret0?Py_True:Py_False;
5271 PyTuple_SetItem(ret,0,ret0Py);
5272 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5276 std::string __str__() const
5278 return self->simpleRepr();
5281 std::string __repr__() const
5283 std::ostringstream oss;
5284 self->reprQuickOverview(oss);
5288 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5290 return fieldT_buildSubPart(self,li);
5293 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5295 return fieldT__getitem__(self,li);
5298 DataArrayFloat *getArray()
5300 DataArrayFloat *ret=self->getArray();
5309 double tmp0=self->getTime(tmp1,tmp2);
5310 PyObject *res = PyList_New(3);
5311 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5312 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5313 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5317 PyObject *getTinySerializationInformation() const
5319 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5322 PyObject *serialize() const
5324 return field_serialize<float>(self);
5327 PyObject *__getstate__() const
5329 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5332 void __setstate__(PyObject *inp)
5334 field__setstate__<float>(self,inp);
5339 class MEDCouplingDefinitionTime
5342 MEDCouplingDefinitionTime();
5343 void assign(const MEDCouplingDefinitionTime& other);
5344 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5345 double getTimeResolution() const;
5346 std::vector<double> getHotSpotsTime() const;
5349 std::string __str__() const
5351 std::ostringstream oss;
5352 self->appendRepr(oss);
5356 PyObject *getIdsOnTimeRight(double tm) const
5358 int meshId,arrId,arrIdInField,fieldId;
5359 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5360 PyObject *res=PyList_New(4);
5361 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5362 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5363 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5364 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5368 PyObject *getIdsOnTimeLeft(double tm) const
5370 int meshId,arrId,arrIdInField,fieldId;
5371 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5372 PyObject *res=PyList_New(4);
5373 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5374 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5375 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5376 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5382 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5385 double getTimeTolerance() const;
5386 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5390 MEDCouplingFieldOverTime(PyObject *li)
5392 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5393 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5394 std::size_t sz=tmp.size();
5395 std::vector<MEDCouplingFieldDouble *> fs(sz);
5396 for(std::size_t i=0;i<sz;i++)
5397 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5398 return MEDCouplingFieldOverTime::New(fs);
5400 std::string __str__() const
5402 return self->simpleRepr();
5404 static MEDCouplingFieldOverTime *New(PyObject *li)
5406 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5407 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5408 std::size_t sz=tmp.size();
5409 std::vector<MEDCouplingFieldDouble *> fs(sz);
5410 for(std::size_t i=0;i<sz;i++)
5411 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5412 return MEDCouplingFieldOverTime::New(fs);
5417 class MEDCouplingCartesianAMRMesh;
5419 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5422 int getNumberOfCellsRecursiveWithOverlap() const;
5423 int getNumberOfCellsRecursiveWithoutOverlap() const;
5424 int getMaxNumberOfLevelsRelativeToThis() const;
5427 MEDCouplingCartesianAMRMeshGen *getMesh() const
5429 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5437 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5440 int getNumberOfOverlapedCellsForFather() const;
5441 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5442 std::vector<mcIdType> computeCellGridSt() const;
5445 PyObject *getBLTRRange() const
5447 const std::vector< std::pair<mcIdType,mcIdType> >& ret(self->getBLTRRange());
5448 return convertFromVectorPairInt(ret);
5451 PyObject *getBLTRRangeRelativeToGF() const
5453 std::vector< std::pair<mcIdType,mcIdType> > ret(self->getBLTRRangeRelativeToGF());
5454 return convertFromVectorPairInt(ret);
5457 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5459 std::vector< std::pair<mcIdType,mcIdType> > inp;
5460 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5461 self->addPatch(inp,factors);
5464 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5466 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5468 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5469 if(patchId==mesh->getNumberOfPatches())
5471 std::ostringstream oss;
5472 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5473 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5476 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5482 void __delitem__(mcIdType patchId)
5484 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5486 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5487 mesh->removePatch(patchId);
5490 mcIdType __len__() const
5492 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5494 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5495 return mesh->getNumberOfPatches();
5500 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5504 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5507 mcIdType getAbsoluteLevel() const;
5508 mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5509 std::vector<mcIdType> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5510 int getSpaceDimension() const;
5511 const std::vector<mcIdType>& getFactors() const;
5512 void setFactors(const std::vector<mcIdType>& newFactors);
5513 mcIdType getMaxNumberOfLevelsRelativeToThis() const;
5514 mcIdType getNumberOfCellsAtCurrentLevel() const;
5515 mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const;
5516 mcIdType getNumberOfCellsRecursiveWithOverlap() const;
5517 mcIdType getNumberOfCellsRecursiveWithoutOverlap() const;
5518 bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const;
5519 virtual void detachFromFather();
5521 mcIdType getNumberOfPatches() const;
5522 mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5523 MEDCouplingUMesh *buildUnstructured() const;
5524 DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const;
5525 std::vector<mcIdType> getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5526 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5527 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5528 void removeAllPatches();
5529 void removePatch(mcIdType patchId);
5530 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<mcIdType>& factors);
5531 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<mcIdType>& factors, double eps);
5532 DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const;
5533 void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5534 void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const;
5535 void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const;
5536 void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5537 void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5538 void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const;
5539 DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const;
5540 std::string buildPythonDumpOfThis() const;
5543 void addPatch(PyObject *bottomLeftTopRight, const std::vector<mcIdType>& factors)
5545 std::vector< std::pair<mcIdType,mcIdType> > inp;
5546 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5547 self->addPatch(inp,factors);
5550 PyObject *getPatches() const
5552 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5553 std::size_t sz(ps.size());
5554 PyObject *ret = PyList_New(sz);
5555 for(std::size_t i=0;i<sz;i++)
5557 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5560 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5565 // agy : don't know why typemap fails here ??? let it in the extend section
5566 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5568 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5571 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<mcIdType>& pos) const
5573 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5574 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5580 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<mcIdType>& pos) const
5582 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5583 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5589 virtual PyObject *positionRelativeToGodFather() const
5591 std::vector<mcIdType> out1;
5592 std::vector< std::pair<mcIdType,mcIdType> > out0(self->positionRelativeToGodFather(out1));
5593 PyObject *ret(PyTuple_New(2));
5594 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5595 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5599 virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
5601 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5602 std::size_t sz(ps.size());
5603 PyObject *ret = PyList_New(sz);
5604 for(std::size_t i=0;i<sz;i++)
5605 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5609 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, PyObject *recurseArrs) const
5611 std::vector<const DataArrayDouble *> inp;
5612 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5613 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5616 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5618 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5624 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5626 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5632 MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const
5634 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5640 MEDCouplingIMesh *getImageMesh() const
5642 const MEDCouplingIMesh *ret(self->getImageMesh());
5645 return const_cast<MEDCouplingIMesh *>(ret);
5648 MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const
5650 if(patchId==self->getNumberOfPatches())
5652 std::ostringstream oss;
5653 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5654 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5657 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5663 void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5665 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5666 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5667 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5670 void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const
5672 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5673 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5674 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5677 void __delitem__(mcIdType patchId)
5679 self->removePatch(patchId);
5682 mcIdType __len__() const
5684 return self->getNumberOfPatches();
5689 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5693 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5696 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5699 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5701 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5702 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5703 const mcIdType *nodeStrctPtr(0);
5704 const double *originPtr(0),*dxyzPtr(0);
5705 mcIdType sw,sz,val0;
5706 std::vector<mcIdType> bb0;
5707 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5710 std::vector<double> bb,bb2;
5712 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5713 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5715 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5718 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5720 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5721 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5722 std::vector< std::vector<mcIdType> > inp2;
5723 convertPyToVectorOfVectorOfInt(factors,inp2);
5724 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5727 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5729 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5732 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5734 return MEDCouplingCartesianAMRMesh::New(mesh);
5739 class MEDCouplingDataForGodFather : public RefCountObject
5742 virtual void synchronizeFineToCoarse();
5743 virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
5744 virtual void synchronizeCoarseToFine();
5745 virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
5746 virtual void synchronizeAllGhostZones();
5747 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5748 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
5749 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
5750 virtual void alloc();
5751 virtual void dealloc();
5754 MEDCouplingCartesianAMRMesh *getMyGodFather()
5756 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5764 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5767 mcIdType getNumberOfLevels() const;
5768 MEDCouplingAMRAttribute *deepCopy() const;
5769 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5770 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5771 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5772 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5773 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5774 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5775 std::string writeVTHB(const std::string& fileName) const;
5778 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5780 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5781 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5782 MEDCouplingAMRAttribute *ret(0);
5785 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5786 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5788 catch(INTERP_KERNEL::Exception&)
5790 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5791 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5796 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev)
5798 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5801 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5803 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5804 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5810 void spillInfoOnComponents(PyObject *compNames)
5812 std::vector< std::vector<std::string> > compNamesCpp;
5813 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5814 self->spillInfoOnComponents(compNamesCpp);
5817 void spillNatures(PyObject *nfs)
5819 std::vector<mcIdType> inp0;
5820 if(!fillIntVector(nfs,inp0))
5821 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5822 std::size_t sz(inp0.size());
5823 std::vector<NatureOfField> inp00(sz);
5824 for(std::size_t i=0;i<sz;i++)
5825 inp00[i]=(NatureOfField)inp0[i];
5826 self->spillNatures(inp00);
5829 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5831 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5832 std::size_t sz(ret.size());
5833 PyObject *retPy(PyList_New(sz));
5834 for(std::size_t i=0;i<sz;i++)
5835 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5841 class DenseMatrix : public RefCountObject, public TimeLabel
5844 static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols);
5845 static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
5846 DenseMatrix *deepCopy() const;
5847 DenseMatrix *shallowCpy() const;
5849 mcIdType getNumberOfRows() const;
5850 mcIdType getNumberOfCols() const;
5851 mcIdType getNbOfElems() const;
5852 void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1);
5853 void reShape(mcIdType nbRows, mcIdType nbCols);
5856 bool isEqual(const DenseMatrix& other, double eps) const;
5857 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5858 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5861 DenseMatrix(mcIdType nbRows, mcIdType nbCols)
5863 return DenseMatrix::New(nbRows,nbCols);
5866 DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols)
5868 return DenseMatrix::New(array,nbRows,nbCols);
5871 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5874 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5875 PyObject *ret=PyTuple_New(2);
5876 PyObject *ret0Py=ret0?Py_True:Py_False;
5878 PyTuple_SetItem(ret,0,ret0Py);
5879 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5883 DataArrayDouble *getData()
5885 DataArrayDouble *ret(self->getData());
5891 DenseMatrix *__add__(const DenseMatrix *other)
5893 return MEDCoupling::DenseMatrix::Add(self,other);
5896 DenseMatrix *__sub__(const DenseMatrix *other)
5898 return MEDCoupling::DenseMatrix::Substract(self,other);
5901 DenseMatrix *__mul__(const DenseMatrix *other)
5903 return MEDCoupling::DenseMatrix::Multiply(self,other);
5906 DenseMatrix *__mul__(const DataArrayDouble *other)
5908 return MEDCoupling::DenseMatrix::Multiply(self,other);
5911 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5913 self->addEqual(other);
5914 Py_XINCREF(trueSelf);
5918 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5920 self->substractEqual(other);
5921 Py_XINCREF(trueSelf);
5925 PyObject *toNumPyMatrix() // not const. It is not a bug !
5927 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5936 def MEDCouplingUMeshReduce(self):
5937 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5938 def MEDCouplingCMeshReduce(self):
5939 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5940 def MEDCouplingIMeshReduce(self):
5941 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5942 def MEDCouplingMappedExtrudedMeshReduce(self):
5943 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5944 def MEDCouplingCurveLinearMeshReduce(self):
5945 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5946 def MEDCoupling1SGTUMeshReduce(self):
5947 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5948 def MEDCoupling1DGTUMeshReduce(self):
5949 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5950 def MEDCouplingFieldDoubleReduce(self):
5951 self.checkConsistencyLight()
5952 d=(self.getTypeOfField(),self.getTimeDiscretization())
5953 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5954 def MEDCouplingFieldIntReduce(self):
5955 self.checkConsistencyLight()
5956 d=(self.getTypeOfField(),self.getTimeDiscretization())
5957 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5958 def MEDCouplingFieldFloatReduce(self):
5959 self.checkConsistencyLight()
5960 d=(self.getTypeOfField(),self.getTimeDiscretization())
5961 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5962 def MEDCouplingFTReduceFunct(cls,params):
5964 ret=object.__new__(cls)
5968 def MEDCouplingFieldTemplateReduce(self):
5969 ret = MEDCouplingFieldDouble(self)
5970 nbTuples = self.getNumberOfTuplesExpected()
5971 arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
5973 return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
5975 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5977 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5978 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5979 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5980 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5981 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5982 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5983 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5989 __filename=os.environ.get('PYTHONSTARTUP')
5990 if __filename and os.path.isfile(__filename):
5991 with open(__filename) as __fp: