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 "MEDCouplingUMesh.hxx"
31 #include "MEDCouplingMappedExtrudedMesh.hxx"
32 #include "MEDCouplingCMesh.hxx"
33 #include "MEDCouplingIMesh.hxx"
34 #include "MEDCouplingMap.txx"
35 #include "MEDCouplingCurveLinearMesh.hxx"
36 #include "MEDCoupling1GTUMesh.hxx"
37 #include "MEDCouplingField.hxx"
38 #include "MEDCouplingFieldDouble.hxx"
39 #include "MEDCouplingFieldInt.hxx"
40 #include "MEDCouplingFieldFloat.hxx"
41 #include "MEDCouplingFieldTemplate.hxx"
42 #include "MEDCouplingGaussLocalization.hxx"
44 #include "MEDCouplingMultiFields.hxx"
45 #include "MEDCouplingFieldOverTime.hxx"
46 #include "MEDCouplingDefinitionTime.hxx"
47 #include "MEDCouplingFieldDiscretization.hxx"
48 #include "MEDCouplingCartesianAMRMesh.hxx"
49 #include "MEDCouplingAMRAttribute.hxx"
50 #include "MEDCouplingMatrix.hxx"
51 #include "MEDCouplingPartDefinition.hxx"
52 #include "MEDCouplingSkyLineArray.hxx"
53 #include "MEDCouplingTypemaps.i"
55 #include "InterpKernelAutoPtr.hxx"
56 #include "BoxSplittingOptions.hxx"
58 using namespace MEDCoupling;
59 using namespace INTERP_KERNEL;
63 %template(ivec) std::vector<int>;
64 %template(dvec) std::vector<double>;
65 %template(svec) std::vector<std::string>;
68 %typemap(out) MEDCoupling::MEDCouplingMesh*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingMesh*
75 $result=convertMesh($1,$owner);
80 %typemap(out) MEDCoupling::MEDCouplingPointSet*
82 $result=convertMesh($1,$owner);
85 %typemap(out) MEDCouplingPointSet*
87 $result=convertMesh($1,$owner);
92 %typemap(out) MEDCouplingCartesianAMRPatchGen*
94 $result=convertCartesianAMRPatch($1,$owner);
99 %typemap(out) MEDCouplingCartesianAMRMeshGen*
101 $result=convertCartesianAMRMesh($1,$owner);
106 %typemap(out) MEDCouplingDataForGodFather*
108 $result=convertDataForGodFather($1,$owner);
113 %typemap(out) MEDCoupling::MEDCoupling1GTUMesh*
115 $result=convertMesh($1,$owner);
118 %typemap(out) MEDCoupling1GTUMesh*
120 $result=convertMesh($1,$owner);
125 %typemap(out) MEDCoupling::MEDCouplingStructuredMesh*
127 $result=convertMesh($1,$owner);
130 %typemap(out) MEDCouplingStructuredMesh*
132 $result=convertMesh($1,$owner);
137 %typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
139 $result=convertFieldDiscretization($1,$owner);
142 %typemap(out) MEDCouplingFieldDiscretization*
144 $result=convertFieldDiscretization($1,$owner);
149 %typemap(out) MEDCoupling::MEDCouplingField*
151 $result=convertField($1,$owner);
154 %typemap(out) MEDCouplingField*
156 $result=convertField($1,$owner);
161 %typemap(out) MEDCoupling::MEDCouplingMultiFields*
163 $result=convertMultiFields($1,$owner);
166 %typemap(out) MEDCouplingMultiFields*
168 $result=convertMultiFields($1,$owner);
173 %typemap(out) MEDCoupling::PartDefinition*
175 $result=convertPartDefinition($1,$owner);
178 %typemap(out) PartDefinition*
180 $result=convertPartDefinition($1,$owner);
185 %init %{ import_array(); %}
188 %init %{ initializeMe(); %}
190 %feature("autodoc", "1");
191 %feature("docstring");
193 %newobject MEDCoupling::MEDCouplingField::buildMeasureField;
194 %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
195 %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
196 %newobject MEDCoupling::MEDCouplingFieldDouble::New;
197 %newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
198 %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
199 %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
200 %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
201 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
202 %newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
203 %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
204 %newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
205 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
206 %newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
207 %newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
208 %newobject MEDCoupling::MEDCouplingFieldDouble::trace;
209 %newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
210 %newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
211 %newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
212 %newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
213 %newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
214 %newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
215 %newobject MEDCoupling::MEDCouplingFieldDouble::dot;
216 %newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
217 %newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
218 %newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
219 %newobject MEDCoupling::MEDCouplingFieldDouble::max;
220 %newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
221 %newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
222 %newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
223 %newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
224 %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
225 %newobject MEDCoupling::MEDCouplingFieldDouble::min;
226 %newobject MEDCoupling::MEDCouplingFieldDouble::negate;
227 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
228 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
229 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
230 %newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
231 %newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
232 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
233 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
234 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
235 %newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
236 %newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
237 %newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
238 %newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
239 %newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
240 %newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
241 %newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
242 %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
243 %newobject MEDCoupling::MEDCouplingFieldDouble::clone;
244 %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
245 %newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy;
246 %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
247 %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization;
248 %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization;
249 %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti;
250 %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl;
251 %newobject MEDCoupling::MEDCouplingFieldInt::New;
252 %newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField;
253 %newobject MEDCoupling::MEDCouplingFieldInt::getArray;
254 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
255 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
256 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
257 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
258 %newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
259 %newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
260 %newobject MEDCoupling::MEDCouplingFieldFloat::New;
261 %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
262 %newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
263 %newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
264 %newobject MEDCoupling::MEDCouplingFieldFloat::clone;
265 %newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
266 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
267 %newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
268 %newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
269 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
270 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
271 %newobject MEDCoupling::MEDCouplingMesh::clone;
272 %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
273 %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig;
274 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfNodesPerCell;
275 %newobject MEDCoupling::MEDCouplingMesh::computeNbOfFacesPerCell;
276 %newobject MEDCoupling::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
277 %newobject MEDCoupling::MEDCouplingMesh::buildPartRange;
278 %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType;
279 %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner;
280 %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass;
281 %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
282 %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField;
283 %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
284 %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith;
285 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic;
286 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo;
287 %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo;
288 %newobject MEDCoupling::MEDCouplingMesh::getMeasureField;
289 %newobject MEDCoupling::MEDCouplingMesh::simplexize;
290 %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured;
291 %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes;
292 %newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure;
293 %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer;
294 %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox;
295 %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes;
296 %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh;
297 %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray;
298 %newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice;
299 %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType;
300 %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer;
301 %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
302 %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
303 %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes;
304 %newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly;
305 %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree;
306 %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds;
307 %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
308 %newobject MEDCoupling::MEDCouplingPointSet::computeDiameterField;
309 %newobject MEDCoupling::MEDCouplingPointSet::__getitem__;
310 %newobject MEDCoupling::MEDCouplingUMesh::New;
311 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivity;
312 %newobject MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex;
313 %newobject MEDCoupling::MEDCouplingUMesh::__iter__;
314 %newobject MEDCoupling::MEDCouplingUMesh::cellsByType;
315 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity;
316 %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2;
317 %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D;
318 %newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges;
319 %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh;
320 %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly;
321 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes;
322 %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
323 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGradually;
324 %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
325 %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
326 %newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
327 %newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
328 %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
329 %newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
330 %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
331 %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
332 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
333 %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType;
334 %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
335 %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField;
336 %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic;
337 %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField;
338 %newobject MEDCoupling::MEDCouplingUMesh::getAspectRatioField;
339 %newobject MEDCoupling::MEDCouplingUMesh::getWarpField;
340 %newobject MEDCoupling::MEDCouplingUMesh::getSkewField;
341 %newobject MEDCoupling::MEDCouplingUMesh::getPartBarycenterAndOwner;
342 %newobject MEDCoupling::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
343 %newobject MEDCoupling::MEDCouplingUMesh::getPartMeasureField;
344 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
345 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
346 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
347 %newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
348 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
349 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
350 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
351 %newobject MEDCoupling::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
352 %newobject MEDCoupling::MEDCouplingUMesh::findCellIdsOnBoundary;
353 %newobject MEDCoupling::MEDCouplingUMesh::computeSkin;
354 %newobject MEDCoupling::MEDCouplingUMesh::buildSetInstanceFromThis;
355 %newobject MEDCoupling::MEDCouplingUMesh::getCellIdsCrossingPlane;
356 %newobject MEDCoupling::MEDCouplingUMesh::convexEnvelop2D;
357 %newobject MEDCoupling::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
358 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf2DMesh;
359 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
360 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
361 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
362 %newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
363 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
364 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
365 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
366 %newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
367 %newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
368 %newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
369 %newobject MEDCoupling::MEDCoupling1GTUMesh::New;
370 %newobject MEDCoupling::MEDCoupling1GTUMesh::getNodalConnectivity;
371 %newobject MEDCoupling::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
372 %newobject MEDCoupling::MEDCoupling1SGTUMesh::New;
373 %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
374 %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh;
375 %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
376 %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther;
377 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
378 %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
379 %newobject MEDCoupling::MEDCoupling1DGTUMesh::New;
380 %newobject MEDCoupling::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
381 %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
382 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
383 %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
384 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New;
385 %newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh;
386 %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart;
387 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured;
388 %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
389 %newobject MEDCoupling::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
390 %newobject MEDCoupling::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
391 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
392 %newobject MEDCoupling::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
393 %newobject MEDCoupling::MEDCouplingStructuredMesh::ComputeCornersGhost;
394 %newobject MEDCoupling::MEDCouplingCMesh::New;
395 %newobject MEDCoupling::MEDCouplingCMesh::getCoordsAt;
396 %newobject MEDCoupling::MEDCouplingCMesh::buildCurveLinear;
397 %newobject MEDCoupling::MEDCouplingIMesh::New;
398 %newobject MEDCoupling::MEDCouplingIMesh::asSingleCell;
399 %newobject MEDCoupling::MEDCouplingIMesh::buildWithGhost;
400 %newobject MEDCoupling::MEDCouplingIMesh::convertToCartesian;
401 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New;
402 %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords;
403 %newobject MEDCoupling::MEDCouplingMultiFields::New;
404 %newobject MEDCoupling::MEDCouplingMultiFields::deepCopy;
405 %newobject MEDCoupling::MEDCouplingFieldOverTime::New;
406 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh;
407 %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__;
408 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy;
409 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
410 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
411 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
412 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
413 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getImageMesh;
414 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getGodFather;
415 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getFather;
416 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatch;
417 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
418 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
419 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
420 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
421 %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::__getitem__;
422 %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New;
423 %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather;
424 %newobject MEDCoupling::MEDCouplingAMRAttribute::New;
425 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy;
426 %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
427 %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn;
428 %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo;
429 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
430 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
431 %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
432 %newobject MEDCoupling::DenseMatrix::New;
433 %newobject MEDCoupling::DenseMatrix::deepCopy;
434 %newobject MEDCoupling::DenseMatrix::shallowCpy;
435 %newobject MEDCoupling::DenseMatrix::getData;
436 %newobject MEDCoupling::DenseMatrix::matVecMult;
437 %newobject MEDCoupling::DenseMatrix::MatVecMult;
438 %newobject MEDCoupling::DenseMatrix::__add__;
439 %newobject MEDCoupling::DenseMatrix::__sub__;
440 %newobject MEDCoupling::DenseMatrix::__mul__;
441 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
442 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
443 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
444 %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
445 %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
446 %newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
448 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
449 %feature("unref") MEDCouplingMesh "$this->decrRef();"
450 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
451 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
452 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
453 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
454 %feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();"
455 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
456 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
457 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
458 %feature("unref") MEDCouplingField "$this->decrRef();"
459 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
460 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
461 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
462 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
463 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
464 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
465 %feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
466 %feature("unref") MEDCouplingFieldInt "$this->decrRef();"
467 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
468 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
469 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
470 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
471 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
472 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
473 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
474 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
475 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
476 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
477 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
478 %feature("unref") DenseMatrix "$this->decrRef();"
479 %feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
481 %rename(assign) *::operator=;
482 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
483 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
484 %ignore MEDCoupling::MEDCouplingGaussLocalization::fillWithValues;
485 %ignore MEDCoupling::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
489 // ABN: Instruct SWIG that INTERP_KERNEL::Exception is an exception class and that it should inherit Exception
490 // on the Python side. Must be put BEFORE the %rename clause:
491 %exceptionclass INTERP_KERNEL::Exception;
492 %rename (InterpKernelException) INTERP_KERNEL::Exception;
494 %include "MEDCouplingRefCountObject.i"
495 %include "MEDCouplingMemArray.i"
499 {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
500 SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
501 SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
502 SWIGTITraits<int>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt;
503 SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
504 SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
505 SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
511 PyObject *med2vtk_cell_types()
513 Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
514 PyObject *ret(PyList_New(sz));
515 for(Py_ssize_t i=0;i<sz;i++)
517 PyList_SetItem(ret,i,PyInt_FromLong(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[i]));
522 PyObject *vtk2med_cell_types()
524 Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
525 auto maxElt(*std::max_element(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER,MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz));
526 auto szOut(maxElt+1);
527 std::vector< int > retCpp(szOut,-1);
529 for(const int *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
535 PyObject *ret(PyList_New(szOut));
537 for(auto it=retCpp.begin();it!=retCpp.end();it++,id++)
538 PyList_SetItem(ret,id,PyInt_FromLong(*it));
543 namespace INTERP_KERNEL
546 * \class BoxSplittingOptions
547 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
549 class BoxSplittingOptions
552 BoxSplittingOptions();
554 double getEfficiencyGoal() const;
555 void setEfficiencyGoal(double efficiency);
556 double getEfficiencyThreshold() const;
557 void setEfficiencyThreshold(double efficiencyThreshold);
558 int getMinimumPatchLength() const;
559 void setMinimumPatchLength(int minPatchLength);
560 int getMaximumPatchLength() const;
561 void setMaximumPatchLength(int maxPatchLength);
562 int getMaximumNbOfCellsInPatch() const;
563 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch);
564 void copyOptions(const BoxSplittingOptions & other);
565 std::string printOptions() const;
568 std::string __str__() const
570 return self->printOptions();
576 namespace MEDCoupling
592 CONST_ON_TIME_INTERVAL = 7
593 } TypeOfTimeDiscretization;
601 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
602 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
604 } MEDCouplingMeshType;
607 class DataArrayDouble;
608 class MEDCouplingUMesh;
609 class MEDCouplingCMesh;
610 class MEDCouplingFieldDouble;
612 %extend RefCountObject
614 std::string getHiddenCppPointer() const
616 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
621 %extend MEDCouplingGaussLocalization
623 std::string __str__() const
625 return self->getStringRepr();
628 std::string __repr__() const
630 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
631 oss << self->getStringRepr();
638 class MEDCouplingMesh : public RefCountObject, public TimeLabel
641 void setName(const std::string& name);
642 std::string getName() const;
643 void setDescription(const std::string& descr);
644 std::string getDescription() const;
645 void setTime(double val, int iteration, int order);
646 void setTimeUnit(const std::string& unit);
647 std::string getTimeUnit() const;
648 virtual MEDCouplingMeshType getType() const;
649 bool isStructured() const;
650 virtual MEDCouplingMesh *deepCopy() const;
651 virtual MEDCouplingMesh *clone(bool recDeepCpy) const;
652 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
653 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
654 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
655 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other);
656 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other);
657 virtual void checkConsistencyLight() const;
658 virtual void checkConsistency(double eps=1e-12) const;
659 virtual int getNumberOfCells() const;
660 virtual int getNumberOfNodes() const;
661 virtual int getSpaceDimension() const;
662 virtual int getMeshDimension() const;
663 virtual DataArrayDouble *getCoordinatesAndOwner() const;
664 virtual DataArrayDouble *computeCellCenterOfMass() const;
665 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
666 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
667 virtual DataArrayInt *computeNbOfNodesPerCell() const;
668 virtual DataArrayInt *computeNbOfFacesPerCell() const;
669 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
670 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
671 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
672 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
673 virtual std::string simpleRepr() const;
674 virtual std::string advancedRepr() const;
675 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
676 virtual std::string getVTKFileExtension() const;
677 std::string getVTKFileNameOf(const std::string& fileName) const;
679 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
680 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
681 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
682 virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const;
683 virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
684 virtual MEDCouplingFieldDouble *buildOrthogonalField() const;
685 virtual MEDCouplingUMesh *buildUnstructured() const;
686 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
687 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
688 virtual DataArrayInt *simplexize(int policy);
689 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
690 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
691 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type);
692 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type);
693 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type);
694 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
695 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
696 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type);
699 std::string __str__() const
701 return self->simpleRepr();
707 double tmp0=self->getTime(tmp1,tmp2);
708 PyObject *res = PyList_New(3);
709 PyList_SetItem(res,0,SWIG_From_double(tmp0));
710 PyList_SetItem(res,1,SWIG_From_int(tmp1));
711 PyList_SetItem(res,2,SWIG_From_int(tmp2));
715 DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const
717 const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure());
718 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
724 int getCellContainingPoint(PyObject *p, double eps) const
728 DataArrayDoubleTuple *aa;
729 std::vector<double> bb;
731 int spaceDim=self->getSpaceDimension();
732 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
733 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
734 return self->getCellContainingPoint(pos,eps);
737 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const
741 DataArrayDoubleTuple *aa;
742 std::vector<double> bb;
744 int spaceDim=self->getSpaceDimension();
745 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
746 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
747 MCAuto<DataArrayInt> elts,eltsIndex;
748 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
749 PyObject *ret=PyTuple_New(2);
750 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
751 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
755 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const
759 DataArrayDoubleTuple *aa;
760 std::vector<double> bb;
762 int spaceDim=self->getSpaceDimension();
763 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
764 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
765 MCAuto<DataArrayInt> elts,eltsIndex;
766 self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
767 PyObject *ret=PyTuple_New(2);
768 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
769 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
773 PyObject *getCellsContainingPoints(PyObject *p, double eps) const
775 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
776 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
779 PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const
781 auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
782 return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
785 PyObject *getCellsContainingPoint(PyObject *p, double eps) const
789 DataArrayDoubleTuple *aa;
790 std::vector<double> bb;
792 int spaceDim=self->getSpaceDimension();
793 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
794 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
795 std::vector<int> elts;
796 self->getCellsContainingPoint(pos,eps,elts);
797 DataArrayInt *ret=DataArrayInt::New();
798 ret->alloc((int)elts.size(),1);
799 std::copy(elts.begin(),elts.end(),ret->getPointer());
800 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
803 virtual PyObject *getReverseNodalConnectivity() const
805 MCAuto<DataArrayInt> d0=DataArrayInt::New();
806 MCAuto<DataArrayInt> d1=DataArrayInt::New();
807 self->getReverseNodalConnectivity(d0,d1);
808 PyObject *ret=PyTuple_New(2);
809 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
810 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
814 void renumberCells(PyObject *li, bool check=true)
817 int v0; std::vector<int> v1;
818 const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
819 self->renumberCells(ids,check);
822 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const
824 DataArrayInt *cellCor, *nodeCor;
825 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
826 PyObject *res = PyList_New(2);
827 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
828 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
832 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
834 DataArrayInt *cellCor=0,*nodeCor=0;
835 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
836 PyObject *res = PyList_New(2);
837 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
838 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
842 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const
844 DataArrayInt *cellCor=0;
845 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
849 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const
852 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
853 if (!SWIG_IsOK(res1))
856 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
857 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
861 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
863 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
864 da2->checkAllocated();
865 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
868 PyObject *getNodeIdsOfCell(int cellId) const
870 std::vector<int> conn;
871 self->getNodeIdsOfCell(cellId,conn);
872 return convertIntArrToPyList2(conn);
875 PyObject *getCoordinatesOfNode(int nodeId) const
877 std::vector<double> coo;
878 self->getCoordinatesOfNode(nodeId,coo);
879 return convertDblArrToPyList2(coo);
882 void scale(PyObject *point, double factor)
886 DataArrayDoubleTuple *aa;
887 std::vector<double> bb;
889 int spaceDim=self->getSpaceDimension();
890 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
891 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
892 self->scale(pointPtr,factor);
895 PyObject *getBoundingBox() const
897 int spaceDim=self->getSpaceDimension();
898 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
899 self->getBoundingBox(tmp);
900 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
904 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const
907 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
908 PyObject *ret=PyTuple_New(2);
909 PyObject *ret0Py=ret0?Py_True:Py_False;
911 PyTuple_SetItem(ret,0,ret0Py);
912 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
916 PyObject *buildPart(PyObject *li) const
918 int szArr,sw,iTypppArr;
919 std::vector<int> stdvecTyyppArr;
920 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
921 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
922 if(sw==3)//DataArrayInt
924 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
925 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
926 std::string name=argpt->getName();
928 ret->setName(name.c_str());
930 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
933 PyObject *buildPartAndReduceNodes(PyObject *li) const
935 int szArr,sw,iTypppArr;
936 std::vector<int> stdvecTyyppArr;
938 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
939 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
940 if(sw==3)//DataArrayInt
942 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
943 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
944 std::string name=argpt->getName();
946 ret->setName(name.c_str());
949 PyObject *res = PyList_New(2);
950 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
951 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
952 PyList_SetItem(res,0,obj0);
953 PyList_SetItem(res,1,obj1);
957 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const
961 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
962 PyObject *res = PyTuple_New(2);
963 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
966 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
968 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
969 PyTuple_SetItem(res,0,obj0);
970 PyTuple_SetItem(res,1,obj1);
974 PyObject *getDistributionOfTypes() const
976 std::vector<int> vals=self->getDistributionOfTypes();
978 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
979 PyObject *ret=PyList_New((int)vals.size()/3);
980 for(int j=0;j<(int)vals.size()/3;j++)
982 PyObject *ret1=PyList_New(3);
983 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
984 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
985 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
986 PyList_SetItem(ret,j,ret1);
991 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const
993 std::vector<int> code;
994 std::vector<const DataArrayInt *> idsPerType;
995 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li2,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",idsPerType);
996 convertPyToNewIntArr4(li,1,3,code);
997 return self->checkTypeConsistencyAndContig(code,idsPerType);
1000 PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const
1002 std::vector<int> code;
1003 std::vector<DataArrayInt *> idsInPflPerType;
1004 std::vector<DataArrayInt *> idsPerType;
1005 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
1006 PyObject *ret=PyTuple_New(3);
1008 if(code.size()%3!=0)
1009 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
1010 PyObject *ret0=PyList_New((int)code.size()/3);
1011 for(int j=0;j<(int)code.size()/3;j++)
1013 PyObject *ret00=PyList_New(3);
1014 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
1015 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
1016 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
1017 PyList_SetItem(ret0,j,ret00);
1019 PyTuple_SetItem(ret,0,ret0);
1021 PyObject *ret1=PyList_New(idsInPflPerType.size());
1022 for(std::size_t j=0;j<idsInPflPerType.size();j++)
1023 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1024 PyTuple_SetItem(ret,1,ret1);
1025 int n=idsPerType.size();
1026 PyObject *ret2=PyList_New(n);
1027 for(int i=0;i<n;i++)
1028 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1029 PyTuple_SetItem(ret,2,ret2);
1033 void translate(PyObject *vector)
1037 DataArrayDoubleTuple *aa;
1038 std::vector<double> bb;
1040 int spaceDim=self->getSpaceDimension();
1041 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
1042 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
1043 self->translate(vectorPtr);
1046 void rotate(PyObject *center, double alpha)
1048 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1051 DataArrayDoubleTuple *aa;
1052 std::vector<double> bb;
1054 int spaceDim=self->getSpaceDimension();
1055 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1056 self->rotate(centerPtr,0,alpha);
1059 void rotate(PyObject *center, PyObject *vector, double alpha)
1061 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
1063 DataArrayDouble *a,*a2;
1064 DataArrayDoubleTuple *aa,*aa2;
1065 std::vector<double> bb,bb2;
1067 int spaceDim=self->getSpaceDimension();
1068 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
1069 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
1070 self->rotate(centerPtr,vectorPtr,alpha);
1073 PyObject *getAllGeoTypes() const
1075 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
1076 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1077 PyObject *res=PyList_New(result.size());
1078 for(int i=0;iL!=result.end(); i++, iL++)
1079 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1083 virtual PyObject *getTinySerializationInformation() const
1085 std::vector<double> a0;
1086 std::vector<int> a1;
1087 std::vector<std::string> a2;
1088 self->getTinySerializationInformation(a0,a1,a2);
1089 PyObject *ret(PyTuple_New(3));
1090 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
1091 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
1093 PyObject *ret2(PyList_New(sz));
1095 for(int i=0;i<sz;i++)
1096 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
1098 PyTuple_SetItem(ret,2,ret2);
1102 virtual PyObject *serialize() const
1104 DataArrayInt *a0Tmp(0);
1105 DataArrayDouble *a1Tmp(0);
1106 self->serialize(a0Tmp,a1Tmp);
1107 PyObject *ret(PyTuple_New(2));
1108 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1109 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1113 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2) const
1115 std::vector<std::string> littleStrings;
1116 self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
1119 PyObject *__getstate__() const
1121 PyObject *ret0(MEDCoupling_MEDCouplingMesh_getTinySerializationInformation(self));
1122 PyObject *ret1(MEDCoupling_MEDCouplingMesh_serialize(self));
1123 PyObject *ret(PyTuple_New(2));
1124 PyTuple_SetItem(ret,0,ret0);
1125 PyTuple_SetItem(ret,1,ret1);
1129 void __setstate__(PyObject *inp)
1131 static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
1132 if(!PyTuple_Check(inp))
1133 throw INTERP_KERNEL::Exception(MSG);
1134 int sz(PyTuple_Size(inp));
1136 throw INTERP_KERNEL::Exception(MSG);
1137 PyObject *elt0(PyTuple_GetItem(inp,0));
1138 PyObject *elt1(PyTuple_GetItem(inp,1));
1139 std::vector<double> a0;
1140 std::vector<int> a1;
1141 std::vector<std::string> a2;
1142 DataArrayInt *b0(0);
1143 DataArrayDouble *b1(0);
1145 if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
1146 throw INTERP_KERNEL::Exception(MSG);
1147 PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
1149 fillArrayWithPyListDbl3(a0py,tmp,a0);
1150 convertPyToNewIntArr3(a1py,a1);
1151 fillStringVector(a2py,a2);
1154 if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
1155 throw INTERP_KERNEL::Exception(MSG);
1156 PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
1158 int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
1159 if(!SWIG_IsOK(status))
1160 throw INTERP_KERNEL::Exception(MSG);
1161 b0=reinterpret_cast<DataArrayInt *>(argp);
1162 status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
1163 if(!SWIG_IsOK(status))
1164 throw INTERP_KERNEL::Exception(MSG);
1165 b1=reinterpret_cast<DataArrayDouble *>(argp);
1167 // useless here to call resizeForUnserialization because arrays are well resized.
1168 self->unserialization(a0,a1,b0,b1,a2);
1171 static MEDCouplingMesh *MergeMeshes(PyObject *li)
1173 std::vector<const MEDCoupling::MEDCouplingMesh *> tmp;
1174 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,"MEDCouplingMesh",tmp);
1175 return MEDCouplingMesh::MergeMeshes(tmp);
1181 //== MEDCouplingMesh End
1183 %include "NormalizedGeometricTypes"
1184 %include "MEDCouplingNatureOfFieldEnum"
1186 namespace MEDCoupling
1188 class MEDCouplingNatureOfField
1191 static const char *GetRepr(NatureOfField nat);
1192 static std::string GetReprNoThrow(NatureOfField nat);
1193 static std::string GetAllPossibilitiesStr();
1197 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
1198 // include "MEDCouplingTimeDiscretization.i"
1200 namespace MEDCoupling
1202 class MEDCouplingGaussLocalization
1205 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
1206 const std::vector<double>& gsCoo, const std::vector<double>& w);
1207 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ);
1208 INTERP_KERNEL::NormalizedCellType getType() const;
1209 void setType(INTERP_KERNEL::NormalizedCellType typ);
1210 int getNumberOfGaussPt() const;
1211 int getDimension() const;
1212 int getNumberOfPtsInRefCell() const;
1213 std::string getStringRepr() const;
1214 void checkConsistencyLight() const;
1215 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const;
1217 const std::vector<double>& getRefCoords() const;
1218 double getRefCoord(int ptIdInCell, int comp) const;
1219 const std::vector<double>& getGaussCoords() const;
1220 double getGaussCoord(int gaussPtIdInCell, int comp) const;
1221 const std::vector<double>& getWeights() const;
1222 double getWeight(int gaussPtIdInCell, double newVal) const;
1223 void setRefCoord(int ptIdInCell, int comp, double newVal);
1224 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal);
1225 void setWeight(int gaussPtIdInCell, double newVal);
1226 void setRefCoords(const std::vector<double>& refCoo);
1227 void setGaussCoords(const std::vector<double>& gsCoo);
1228 void setWeights(const std::vector<double>& w);
1230 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1234 DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
1236 MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
1240 MEDCouplingUMesh *buildRefCell() const
1242 MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
1248 class MEDCouplingSkyLineArray
1251 static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI );
1253 void set( DataArrayInt* index, DataArrayInt* value );
1254 void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value );
1256 int getSuperNumberOf() const;
1257 int getNumberOf() const;
1258 int getLength() const;
1260 void deletePack(const int i, const int j);
1262 void deleteSimplePack(const int i);
1263 void deleteSimplePacks(const DataArrayInt* idx);
1267 MEDCouplingSkyLineArray()
1269 return MEDCouplingSkyLineArray::New();
1272 MEDCouplingSkyLineArray( const std::vector<int>& index, const std::vector<int>& value)
1274 return MEDCouplingSkyLineArray::New(index, value);
1277 MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value )
1279 return MEDCouplingSkyLineArray::New(index, value);
1282 MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other )
1284 return MEDCouplingSkyLineArray::New(other);
1287 std::string __str__() const
1289 return self->simpleRepr();
1292 DataArrayInt *getSuperIndexArray() const
1294 DataArrayInt *ret(self->getSuperIndexArray());
1300 DataArrayInt *getIndexArray() const
1302 DataArrayInt *ret(self->getIndexArray());
1308 DataArrayInt *getValuesArray() const
1310 DataArrayInt *ret(self->getValuesArray());
1316 PyObject *getSimplePackSafe(int absolutePackId) const
1318 std::vector<int> ret;
1319 self->getSimplePackSafe(absolutePackId,ret);
1320 return convertIntArrToPyList2(ret);
1323 PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const
1325 std::vector<int> vpack, vspIdx, out;
1327 convertPyToNewIntArr3(superPackIndices,vspIdx);
1328 convertPyToNewIntArr3(pack,vpack);
1330 self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out);
1331 return convertIntArrToPyList2(out);
1334 void pushBackPack(const int i, PyObject *pack)
1336 std::vector<int> vpack;
1337 convertPyToNewIntArr3(pack,vpack);
1338 self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size());
1341 void replaceSimplePack(const int idx, PyObject *pack)
1343 std::vector<int> vpack;
1344 convertPyToNewIntArr3(pack,vpack);
1345 self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
1348 void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks)
1350 std::vector<const DataArrayInt*> packs;
1351 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt*>(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs);
1352 self->replaceSimplePacks(idx, packs);
1355 void replacePack(const int superIdx, const int idx, PyObject *pack)
1357 std::vector<int> vpack;
1358 convertPyToNewIntArr3(pack,vpack);
1359 self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size());
1362 PyObject *convertToPolyhedronConn() const
1364 MCAuto<DataArrayInt> d0=DataArrayInt::New();
1365 MCAuto<DataArrayInt> d1=DataArrayInt::New();
1366 self->convertToPolyhedronConn(d0,d1);
1367 PyObject *ret=PyTuple_New(2);
1368 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1369 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1376 %include "MEDCouplingFieldDiscretization.i"
1378 //== MEDCouplingPointSet
1380 namespace MEDCoupling
1382 class MEDCouplingPointSet : public MEDCoupling::MEDCouplingMesh
1385 void setCoords(const DataArrayDouble *coords);
1386 DataArrayDouble *getCoordinatesAndOwner() const;
1387 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
1389 double getCaracteristicDimension() const;
1390 void recenterForMaxPrecision(double eps);
1391 void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
1392 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
1393 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
1394 virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const;
1395 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon);
1396 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2);
1397 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
1398 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
1399 virtual DataArrayInt *computeFetchedNodeIds() const;
1400 virtual int getNumberOfNodesInCell(int cellId) const;
1401 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
1402 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
1403 virtual DataArrayInt *zipCoordsTraducer();
1404 virtual DataArrayInt *findBoundaryNodes() const;
1405 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
1406 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
1407 virtual void checkFullyDefined() const;
1408 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
1409 virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const;
1410 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
1411 virtual void renumberNodesWithOffsetInConn(int offset);
1412 virtual bool areAllNodesFetched() const;
1413 virtual MEDCouplingFieldDouble *computeDiameterField() const;
1414 virtual void invertOrientationOfAllCells();
1417 std::string __str__() const
1419 return self->simpleRepr();
1422 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const
1425 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1426 PyObject *res = PyList_New(2);
1427 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1428 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1432 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const
1434 DataArrayInt *comm, *commIndex;
1435 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1436 PyObject *res = PyList_New(2);
1437 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1438 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1442 PyObject *getCoords()
1444 DataArrayDouble *ret1=self->getCoords();
1447 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0);
1450 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const
1452 int szArr,sw,iTypppArr;
1453 std::vector<int> stdvecTyyppArr;
1454 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1455 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1456 if(sw==3)//DataArrayInt
1458 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1459 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1460 std::string name=argpt->getName();
1462 ret->setName(name.c_str());
1464 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1467 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const
1469 int szArr,sw,iTypppArr;
1470 std::vector<int> stdvecTyyppArr;
1471 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1472 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1473 if(sw==3)//DataArrayInt
1475 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1476 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1477 std::string name=argpt->getName();
1479 ret->setName(name.c_str());
1481 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1484 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const
1486 int szArr,sw,iTypppArr;
1487 std::vector<int> stdvecTyyppArr;
1488 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1489 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1490 if(sw==3)//DataArrayInt
1492 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1493 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1494 std::string name=argpt->getName();
1496 ret->setName(name.c_str());
1498 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1501 virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
1503 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step);
1504 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1507 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const
1509 int szArr,sw,iTypppArr;
1510 std::vector<int> stdvecTyyppArr;
1511 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1512 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1513 if(sw==3)//DataArrayInt
1515 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1516 DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1517 std::string name=argpt->getName();
1519 ret->setName(name.c_str());
1521 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1524 void renumberNodes(PyObject *li, int newNbOfNodes)
1526 int szArr,sw,iTypppArr;
1527 std::vector<int> stdvecTyyppArr;
1528 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1529 self->renumberNodes(tmp,newNbOfNodes);
1532 void renumberNodesCenter(PyObject *li, int newNbOfNodes)
1534 int szArr,sw,iTypppArr;
1535 std::vector<int> stdvecTyyppArr;
1536 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1537 self->renumberNodesCenter(tmp,newNbOfNodes);
1540 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const
1542 int spaceDim=self->getSpaceDimension();
1544 DataArrayDouble *a,*a2;
1545 DataArrayDoubleTuple *aa,*aa2;
1546 std::vector<double> bb,bb2;
1548 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
1549 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
1550 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1551 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1552 std::vector<int> nodes;
1553 self->findNodesOnLine(p,v,eps,nodes);
1554 DataArrayInt *ret=DataArrayInt::New();
1555 ret->alloc((int)nodes.size(),1);
1556 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1559 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const
1561 int spaceDim=self->getSpaceDimension();
1563 DataArrayDouble *a,*a2;
1564 DataArrayDoubleTuple *aa,*aa2;
1565 std::vector<double> bb,bb2;
1567 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
1568 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
1569 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1570 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1571 std::vector<int> nodes;
1572 self->findNodesOnPlane(p,v,eps,nodes);
1573 DataArrayInt *ret=DataArrayInt::New();
1574 ret->alloc((int)nodes.size(),1);
1575 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1576 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1579 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const
1583 DataArrayDoubleTuple *aa;
1584 std::vector<double> bb;
1586 int spaceDim=self->getSpaceDimension();
1587 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1588 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1589 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1590 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1593 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const
1595 DataArrayInt *c=0,*cI=0;
1599 DataArrayDoubleTuple *aa;
1600 std::vector<double> bb;
1602 int spaceDim=self->getSpaceDimension();
1603 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1604 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1605 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1606 PyObject *ret=PyTuple_New(2);
1607 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1608 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1612 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const
1614 DataArrayInt *c=0,*cI=0;
1615 int spaceDim=self->getSpaceDimension();
1618 DataArrayDoubleTuple *aa;
1619 std::vector<double> bb;
1622 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1623 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1625 PyObject *ret=PyTuple_New(2);
1626 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1627 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1631 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const
1635 DataArrayDoubleTuple *aa;
1636 std::vector<double> bb;
1638 int spaceDim=self->getSpaceDimension();
1639 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1640 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1642 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1643 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
1646 void duplicateNodesInCoords(PyObject *li)
1650 std::vector<int> multiVal;
1651 std::pair<int, std::pair<int,int> > slic;
1652 MEDCoupling::DataArrayInt *daIntTyypp=0;
1653 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1657 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1659 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1661 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1663 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1667 virtual PyObject *findCommonCells(int compType, int startCellId=0) const
1669 DataArrayInt *v0(nullptr),*v1(nullptr);
1670 self->findCommonCells(compType,startCellId,v0,v1);
1671 PyObject *res = PyList_New(2);
1672 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1673 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1678 virtual void renumberNodesInConn(PyObject *li)
1682 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
1685 MapII *da2(reinterpret_cast<MapII *>(da));
1686 self->renumberNodesInConn(da2->data());
1690 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
1691 if (!SWIG_IsOK(res1))
1694 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1695 self->renumberNodesInConn(tmp);
1699 DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da));
1701 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1702 da2->checkAllocated();
1703 self->renumberNodesInConn(da2->getConstPointer());
1707 virtual PyObject *getNodeIdsInUse() const
1710 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1711 PyObject *ret=PyTuple_New(2);
1712 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1713 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1717 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1719 DataArrayInt *ret(nullptr);
1721 int szArr,sw,iTypppArr;
1722 std::vector<int> stdvecTyyppArr;
1723 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1724 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1728 virtual PyObject *mergeNodes(double precision)
1732 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1733 PyObject *res = PyList_New(3);
1734 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1735 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1736 PyList_SetItem(res,2,SWIG_From_int(ret2));
1740 virtual PyObject *mergeNodesCenter(double precision)
1744 DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2);
1745 PyObject *res = PyList_New(3);
1746 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1747 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1748 PyList_SetItem(res,2,SWIG_From_int(ret2));
1752 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const
1755 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1756 if (!SWIG_IsOK(res1))
1759 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1760 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1764 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1766 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1767 da2->checkAllocated();
1768 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1772 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI)
1776 std::vector<int> multiVal;
1777 std::pair<int, std::pair<int,int> > slic;
1778 MEDCoupling::DataArrayInt *daIntTyypp=0;
1779 int nbc=self->getNumberOfCells();
1780 convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1787 std::ostringstream oss;
1788 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1789 throw INTERP_KERNEL::Exception(oss.str().c_str());
1792 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1797 int tmp=nbc+singleVal;
1798 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1802 std::ostringstream oss;
1803 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1804 throw INTERP_KERNEL::Exception(oss.str().c_str());
1810 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1814 return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true);
1819 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1820 daIntTyypp->checkAllocated();
1821 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1824 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1828 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords)
1831 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1832 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1833 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo);
1834 for(int i=0;i<sz;i++)
1835 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1838 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords)
1841 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1843 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1844 std::vector<double> val3;
1845 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1846 "Rotate2DAlg",2,true,nbNodes);
1848 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1849 MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast<double *>(coo));
1852 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords)
1855 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1856 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1857 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1858 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo);
1859 for(int i=0;i<sz;i++)
1860 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1863 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords)
1866 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1868 double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0;
1869 std::vector<double> val3;
1870 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1871 "Rotate3DAlg",3,true,nbNodes);
1873 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1874 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1875 MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast<double *>(coo));
1880 //== MEDCouplingPointSet End
1882 class MEDCouplingUMeshCell
1885 INTERP_KERNEL::NormalizedCellType getType() const;
1888 std::string __str__() const
1890 return self->repr();
1893 PyObject *getAllConn() const
1896 const int *r=self->getAllConn(ret2);
1897 PyObject *ret=PyTuple_New(ret2);
1898 for(int i=0;i<ret2;i++)
1899 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1905 class MEDCouplingUMeshCellIterator
1912 MEDCouplingUMeshCell *ret=self->nextt();
1914 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCell,0|0);
1917 PyErr_SetString(PyExc_StopIteration,"No more data.");
1924 class MEDCouplingUMeshCellByTypeIterator
1927 ~MEDCouplingUMeshCellByTypeIterator();
1932 MEDCouplingUMeshCellEntry *ret=self->nextt();
1934 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1937 PyErr_SetString(PyExc_StopIteration,"No more data.");
1944 class MEDCouplingUMeshCellByTypeEntry
1947 ~MEDCouplingUMeshCellByTypeEntry();
1950 MEDCouplingUMeshCellByTypeIterator *__iter__()
1952 return self->iterator();
1957 class MEDCouplingUMeshCellEntry
1960 INTERP_KERNEL::NormalizedCellType getType() const;
1961 int getNumberOfElems() const;
1964 MEDCouplingUMeshCellIterator *__iter__()
1966 return self->iterator();
1971 //== MEDCouplingUMesh
1973 class MEDCouplingUMesh : public MEDCoupling::MEDCouplingPointSet
1976 static MEDCouplingUMesh *New();
1977 static MEDCouplingUMesh *New(const char *meshName, int meshDim);
1978 void checkConsistencyLight() const;
1979 void setMeshDimension(int meshDim);
1980 void allocateCells(int nbOfCells=0);
1981 void finishInsertingCells();
1982 MEDCouplingUMeshCellByTypeEntry *cellsByType();
1983 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
1984 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
1985 void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
1986 int getNodalConnectivityArrayLen() const;
1987 void computeTypes();
1988 std::string reprConnectivityOfThis() const;
1989 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const;
1991 DataArrayInt *conformize2D(double eps);
1992 DataArrayInt *conformize3D(double eps);
1993 DataArrayInt *colinearize2D(double eps);
1994 DataArrayInt *colinearizeKeepingConform2D(double eps);
1995 void shiftNodeNumbersInConn(int delta);
1996 std::vector<bool> getQuadraticStatus() const;
1997 DataArrayInt *findCellIdsOnBoundary() const;
1998 MEDCouplingUMesh *computeSkin() const;
1999 bool checkConsecutiveCellTypes() const;
2000 bool checkConsecutiveCellTypesForMEDFileFrmt() const;
2001 DataArrayInt *rearrange2ConsecutiveCellTypes();
2002 DataArrayInt *sortCellsInMEDFileFrmt();
2003 DataArrayInt *getRenumArrForMEDFileFrmt() const;
2004 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const;
2005 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
2006 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
2007 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
2008 MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
2009 void orientCorrectlyPolyhedrons();
2010 bool isPresenceOfQuadratic() const;
2011 bool isFullyQuadratic() const;
2012 MEDCouplingFieldDouble *buildDirectionVectorField() const;
2013 bool isContiguous1D() const;
2014 void tessellate2D(double eps);
2015 void convertQuadraticCellsToLinear();
2016 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0);
2017 void convertDegeneratedCells();
2018 DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes();
2019 bool removeDegenerated1DCells();
2020 bool areOnlySimplexCells() const;
2021 MEDCouplingFieldDouble *getEdgeRatioField() const;
2022 MEDCouplingFieldDouble *getAspectRatioField() const;
2023 MEDCouplingFieldDouble *getWarpField() const;
2024 MEDCouplingFieldDouble *getSkewField() const;
2025 DataArrayDouble *computePlaneEquationOf3DFaces() const;
2026 DataArrayInt *convexEnvelop2D();
2027 std::string cppRepr() const;
2028 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells();
2029 DataArrayInt *findAndCorrectBadOriented3DCells();
2030 MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
2031 MEDCouplingSkyLineArray *generateGraph() const;
2032 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const;
2033 DataArrayInt *buildUnionOf2DMesh() const;
2034 DataArrayInt *buildUnionOf3DMesh() const;
2035 DataArrayInt *orderConsecutiveCells1D() const;
2036 DataArrayDouble *getBoundingBoxForBBTreeFast() const;
2037 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
2038 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
2039 void changeOrientationOfCells();
2040 DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps);
2041 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0);
2042 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
2043 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2044 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
2045 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn);
2046 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code);
2050 return MEDCouplingUMesh::New();
2053 MEDCouplingUMesh(const char *meshName, int meshDim)
2055 return MEDCouplingUMesh::New(meshName,meshDim);
2058 std::string __str__() const
2060 return self->simpleRepr();
2063 std::string __repr__() const
2065 std::ostringstream oss;
2066 self->reprQuickOverview(oss);
2070 MEDCouplingUMeshCellIterator *__iter__()
2072 return self->cellIterator();
2075 static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da)
2077 MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
2081 PyObject *getAllGeoTypesSorted() const
2083 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
2084 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2085 PyObject *res=PyList_New(result.size());
2086 for(int i=0;iL!=result.end(); i++, iL++)
2087 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2091 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2095 std::vector<int> multiVal;
2096 std::pair<int, std::pair<int,int> > slic;
2097 MEDCoupling::DataArrayInt *daIntTyypp=0;
2098 int nbc=self->getNumberOfCells();
2099 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2106 std::ostringstream oss;
2107 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2108 throw INTERP_KERNEL::Exception(oss.str().c_str());
2112 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2119 int tmp=nbc+singleVal;
2120 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2125 std::ostringstream oss;
2126 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2127 throw INTERP_KERNEL::Exception(oss.str().c_str());
2133 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2139 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
2140 daIntTyypp->checkAllocated();
2141 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2145 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
2149 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis)
2153 std::vector<int> multiVal;
2154 std::pair<int, std::pair<int,int> > slic;
2155 MEDCoupling::DataArrayInt *daIntTyypp=0;
2156 int nbc=self->getNumberOfCells();
2157 convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2164 std::ostringstream oss;
2165 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2166 throw INTERP_KERNEL::Exception(oss.str().c_str());
2170 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
2177 int tmp=nbc+singleVal;
2178 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
2183 std::ostringstream oss;
2184 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
2185 throw INTERP_KERNEL::Exception(oss.str().c_str());
2191 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
2196 self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
2202 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
2203 daIntTyypp->checkAllocated();
2204 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
2208 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
2212 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li)
2214 int szArr,sw,iTypppArr;
2215 std::vector<int> stdvecTyyppArr;
2216 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2219 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
2220 throw INTERP_KERNEL::Exception(oss.str().c_str());
2222 self->insertNextCell(type,size,tmp);
2225 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li)
2227 int szArr,sw,iTypppArr;
2228 std::vector<int> stdvecTyyppArr;
2229 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2230 self->insertNextCell(type,szArr,tmp);
2233 DataArrayInt *getNodalConnectivity()
2235 DataArrayInt *ret=self->getNodalConnectivity();
2240 DataArrayInt *getNodalConnectivityIndex()
2242 DataArrayInt *ret=self->getNodalConnectivityIndex();
2248 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1)
2250 int szArr,sw,iTypppArr;
2251 std::vector<int> stdvecTyyppArr;
2252 const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
2253 int nbOfDepthPeelingPerformed=0;
2254 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
2255 PyObject *res=PyTuple_New(2);
2256 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
2261 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI)
2263 DataArrayInt *v0=0,*v1=0;
2264 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
2265 PyObject *res = PyList_New(2);
2266 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2267 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyObject *distanceToPoint(PyObject *point) const
2275 DataArrayDoubleTuple *aa;
2276 std::vector<double> bb;
2278 int nbOfCompo=self->getSpaceDimension();
2279 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
2282 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
2283 PyObject *ret=PyTuple_New(2);
2284 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
2285 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
2289 PyObject *distanceToPoints(const DataArrayDouble *pts) const
2291 DataArrayInt *ret1=0;
2292 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
2293 PyObject *ret=PyTuple_New(2);
2294 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2295 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2299 PyObject *tetrahedrize(int policy)
2302 DataArrayInt *ret1(0);
2303 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
2304 PyObject *ret=PyTuple_New(3);
2305 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
2306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
2311 PyObject *checkButterflyCells(double eps=1e-12)
2313 std::vector<int> cells;
2314 self->checkButterflyCells(cells,eps);
2315 DataArrayInt *ret=DataArrayInt::New();
2316 ret->alloc((int)cells.size(),1);
2317 std::copy(cells.begin(),cells.end(),ret->getPointer());
2318 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2321 PyObject *splitByType() const
2323 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
2325 PyObject *ret = PyList_New(sz);
2326 for(int i=0;i<sz;i++)
2327 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2331 PyObject *partitionBySpreadZone() const
2333 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
2334 int sz=retCpp.size();
2335 PyObject *ret=PyList_New(sz);
2336 for(int i=0;i<sz;i++)
2337 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2341 static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn)
2343 std::vector<DataArrayInt *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
2344 int sz=retCpp.size();
2345 PyObject *ret=PyList_New(sz);
2346 for(int i=0;i<sz;i++)
2347 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2351 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const
2354 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
2355 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
2356 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
2359 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
2362 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2363 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
2367 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
2370 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2371 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
2375 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2377 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
2378 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
2379 PyObject *ret=PyTuple_New(3);
2380 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2382 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2386 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const
2388 DataArrayInt *tmp0=0,*tmp1=0;
2389 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
2390 PyObject *ret=PyTuple_New(2);
2391 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2392 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2396 void duplicateNodes(PyObject *li)
2400 std::vector<int> multiVal;
2401 std::pair<int, std::pair<int,int> > slic;
2402 MEDCoupling::DataArrayInt *daIntTyypp=0;
2403 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2407 return self->duplicateNodes(&singleVal,&singleVal+1);
2409 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2411 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2413 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2417 void duplicateNodesInConn(PyObject *li, int offset)
2421 std::vector<int> multiVal;
2422 std::pair<int, std::pair<int,int> > slic;
2423 MEDCoupling::DataArrayInt *daIntTyypp=0;
2424 convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2428 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2430 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2432 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2434 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2438 void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds)
2440 int szArr,sw,iTypppArr;
2441 std::vector<int> stdvecTyyppArr;
2442 const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
2443 self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
2446 PyObject *getLevArrPerCellTypes(PyObject *li) const
2449 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2450 DataArrayInt *tmp0,*tmp1=0;
2451 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2452 PyObject *ret=PyTuple_New(2);
2453 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2454 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2458 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const
2460 DataArrayInt *ret0=0,*ret1=0;
2461 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2462 PyObject *ret=PyTuple_New(2);
2463 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2464 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2468 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms)
2470 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2471 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2472 DataArrayInt *ret1=0,*ret2=0;
2473 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2474 PyObject *ret=PyTuple_New(3);
2475 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2476 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2477 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2481 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms)
2483 std::vector<const MEDCoupling::MEDCouplingUMesh *> meshes;
2484 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2485 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2486 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2489 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
2492 std::vector<const MEDCouplingUMesh *> meshes;
2493 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2494 std::vector<DataArrayInt *> corr;
2495 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2497 PyObject *ret1=PyList_New(sz);
2498 for(int i=0;i<sz;i++)
2499 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2500 PyObject *ret=PyList_New(2);
2501 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2502 PyList_SetItem(ret,1,ret1);
2506 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms)
2508 std::vector<MEDCouplingUMesh *> meshes;
2509 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2510 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2513 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps)
2515 std::vector<MEDCouplingUMesh *> meshes;
2516 convertFromPyObjVectorOfObj<MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2517 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2520 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const
2524 DataArrayDoubleTuple *aa;
2525 std::vector<double> bb;
2527 int spaceDim=self->getSpaceDimension();
2528 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2529 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2531 std::vector<int> cells;
2532 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2533 DataArrayInt *ret=DataArrayInt::New();
2534 ret->alloc((int)cells.size(),1);
2535 std::copy(cells.begin(),cells.end(),ret->getPointer());
2536 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2539 void orientCorrectly2DCells(PyObject *vec, bool polyOnly)
2543 DataArrayDoubleTuple *aa;
2544 std::vector<double> bb;
2546 int spaceDim=self->getSpaceDimension();
2547 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2548 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2549 self->orientCorrectly2DCells(v,polyOnly);
2552 PyObject *arePolyhedronsNotCorrectlyOriented() const
2554 std::vector<int> cells;
2555 self->arePolyhedronsNotCorrectlyOriented(cells);
2556 DataArrayInt *ret=DataArrayInt::New();
2557 ret->alloc((int)cells.size(),1);
2558 std::copy(cells.begin(),cells.end(),ret->getPointer());
2559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
2562 PyObject *getFastAveragePlaneOfThis() const
2566 self->getFastAveragePlaneOfThis(vec,pos);
2568 std::copy(vec,vec+3,vals);
2569 std::copy(pos,pos+3,vals+3);
2570 return convertDblArrToPyListOfTuple<double>(vals,3,2);
2573 static MEDCouplingUMesh *MergeUMeshes(PyObject *li)
2575 std::vector<const MEDCoupling::MEDCouplingUMesh *> tmp;
2576 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2577 return MEDCouplingUMesh::MergeUMeshes(tmp);
2580 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const
2583 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2584 PyObject *ret=PyTuple_New(2);
2585 PyObject *ret0Py=ret0?Py_True:Py_False;
2587 PyTuple_SetItem(ret,0,ret0Py);
2588 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2592 PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const
2595 bool ret0=self->areCellsIncludedInPolicy7(other,ret1);
2596 PyObject *ret=PyTuple_New(2);
2597 PyObject *ret0Py=ret0?Py_True:Py_False;
2599 PyTuple_SetItem(ret,0,ret0Py);
2600 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2604 PyObject *explode3DMeshTo1D() const
2606 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2607 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2608 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2609 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2610 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2611 PyObject *ret=PyTuple_New(5);
2612 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2613 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2614 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2615 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2616 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2620 PyObject *explodeIntoEdges() const
2622 MCAuto<DataArrayInt> desc,descIndex,revDesc,revDescIndx;
2623 MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
2624 PyObject *ret=PyTuple_New(5);
2625 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2626 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2627 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2628 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2629 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2633 PyObject *explodeMeshIntoMicroEdges() const
2635 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2636 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2637 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2638 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2639 MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3);
2640 PyObject *ret=PyTuple_New(5);
2641 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2642 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2643 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2644 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2645 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2649 PyObject *buildDescendingConnectivity() const
2651 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2652 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2653 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2654 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2655 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2656 PyObject *ret=PyTuple_New(5);
2657 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2658 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2659 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2660 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2661 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2665 PyObject *buildDescendingConnectivity2() const
2667 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2668 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2669 MCAuto<DataArrayInt> d2=DataArrayInt::New();
2670 MCAuto<DataArrayInt> d3=DataArrayInt::New();
2671 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2672 PyObject *ret=PyTuple_New(5);
2673 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2674 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2675 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2676 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2677 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2681 PyObject *computeNeighborsOfCells() const
2683 DataArrayInt *neighbors=0,*neighborsIdx=0;
2684 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2685 PyObject *ret=PyTuple_New(2);
2686 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2687 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2691 PyObject *computeNeighborsOfNodes() const
2693 DataArrayInt *neighbors=0,*neighborsIdx=0;
2694 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2695 PyObject *ret=PyTuple_New(2);
2696 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2697 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2701 PyObject *computeEnlargedNeighborsOfNodes() const
2703 MCAuto<DataArrayInt> neighbors,neighborsIdx;
2704 self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
2705 PyObject *ret=PyTuple_New(2);
2706 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2707 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2711 PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const
2713 MCAuto<DataArrayInt> cellNeigh,cellNeighIndex;
2714 self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
2715 PyObject *ret=PyTuple_New(2);
2716 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2717 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2721 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI)
2723 DataArrayInt *neighbors=0,*neighborsIdx=0;
2724 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2725 PyObject *ret=PyTuple_New(2);
2726 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2727 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2731 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2733 MCAuto<DataArrayInt> d0=DataArrayInt::New();
2734 MCAuto<DataArrayInt> d1=DataArrayInt::New();
2735 DataArrayInt *d2,*d3,*d4,*dd5;
2736 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2737 PyObject *ret=PyTuple_New(7);
2738 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2739 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2740 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2743 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2744 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2748 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const
2751 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2752 da->checkAllocated();
2753 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2756 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const
2759 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2760 da->checkAllocated();
2761 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2764 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const
2767 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2768 da->checkAllocated();
2769 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2772 PyObject *getTypesOfPart(DataArrayInt *da) const
2775 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2776 da->checkAllocated();
2777 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2778 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2779 PyObject *res = PyList_New(result.size());
2780 for (int i=0;iL!=result.end(); i++, iL++)
2781 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2785 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const
2788 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2789 da->checkAllocated();
2790 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2791 ret->setName(da->getName().c_str());
2795 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps)
2797 DataArrayInt *cellNb1=0,*cellNb2=0;
2798 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2799 PyObject *ret=PyTuple_New(3);
2800 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2801 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2802 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2806 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps)
2808 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2809 DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2810 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2811 PyObject *ret(PyTuple_New(4));
2812 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2813 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2814 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2815 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2819 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const
2821 int spaceDim=self->getSpaceDimension();
2823 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2825 DataArrayDouble *a,*a2;
2826 DataArrayDoubleTuple *aa,*aa2;
2827 std::vector<double> bb,bb2;
2829 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
2830 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
2831 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2832 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2834 DataArrayInt *cellIds=0;
2835 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2836 PyObject *ret=PyTuple_New(2);
2837 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2838 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2842 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const
2844 int spaceDim=self->getSpaceDimension();
2846 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2848 DataArrayDouble *a,*a2;
2849 DataArrayDoubleTuple *aa,*aa2;
2850 std::vector<double> bb,bb2;
2852 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
2853 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
2854 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2855 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2857 DataArrayInt *cellIds=0;
2858 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2859 PyObject *ret=PyTuple_New(2);
2860 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2861 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2865 MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const
2868 DataArrayDouble *a,*a2;
2869 DataArrayDoubleTuple *aa,*aa2;
2870 std::vector<double> bb,bb2;
2872 const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
2873 const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
2874 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
2875 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
2876 MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
2880 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const
2882 int spaceDim=self->getSpaceDimension();
2884 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2886 DataArrayDouble *a,*a2;
2887 DataArrayDoubleTuple *aa,*aa2;
2888 std::vector<double> bb,bb2;
2890 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
2891 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
2892 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2893 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2894 return self->getCellIdsCrossingPlane(orig,vect,eps);
2897 void convertToPolyTypes(PyObject *li)
2901 std::vector<int> pos2;
2902 DataArrayInt *pos3=0;
2903 DataArrayIntTuple *pos4=0;
2904 convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
2909 self->convertToPolyTypes(&pos1,&pos1+1);
2916 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2921 self->convertToPolyTypes(pos3->begin(),pos3->end());
2925 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2929 void convertAllToPoly();
2930 void convertExtrudedPolyhedra();
2932 void simplifyPolyhedra(double eps);
2933 MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
2934 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
2937 //== MEDCouplingUMesh End
2939 //== MEDCouplingMappedExtrudedMesh
2941 class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh
2944 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
2945 static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
2946 MEDCouplingUMesh *build3DUnstructuredMesh() const;
2947 int get2DCellIdForExtrusion() const;
2949 MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId)
2951 return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2954 MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D)
2956 return MEDCouplingMappedExtrudedMesh::New(mesh3D);
2959 MEDCouplingMappedExtrudedMesh()
2961 return MEDCouplingMappedExtrudedMesh::New();
2964 std::string __str__() const
2966 return self->simpleRepr();
2969 std::string __repr__() const
2971 std::ostringstream oss;
2972 self->reprQuickOverview(oss);
2976 PyObject *getMesh2D() const
2978 MEDCouplingUMesh *ret=self->getMesh2D();
2981 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2983 PyObject *getMesh1D() const
2985 MEDCouplingUMesh *ret=self->getMesh1D();
2988 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2990 PyObject *getMesh3DIds() const
2992 DataArrayInt *ret=self->getMesh3DIds();
2995 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3000 //== MEDCouplingMappedExtrudedMesh End
3002 class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
3005 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3006 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
3007 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
3008 int getNodalConnectivityLength() const;
3009 virtual void allocateCells(int nbOfCells=0);
3010 virtual void checkConsistencyOfConnectivity() const;
3013 virtual void insertNextCell(PyObject *li)
3015 int szArr,sw,iTypppArr;
3016 std::vector<int> stdvecTyyppArr;
3017 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3018 self->insertNextCell(tmp,tmp+szArr);
3021 virtual DataArrayInt *getNodalConnectivity() const
3023 DataArrayInt *ret=self->getNodalConnectivity();
3024 if(ret) ret->incrRef();
3028 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li)
3030 std::vector< const MEDCoupling1GTUMesh *> parts;
3031 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
3032 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
3037 //== MEDCoupling1SGTUMesh
3039 class MEDCoupling1SGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3042 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3043 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
3044 void setNodalConnectivity(DataArrayInt *nodalConn);
3045 int getNumberOfNodesPerCell() const;
3046 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
3047 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3048 MEDCoupling1GTUMesh *computeDualMesh() const;
3049 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const;
3050 DataArrayInt *sortHexa8EachOther();
3053 MEDCoupling1SGTUMesh()
3055 return MEDCoupling1SGTUMesh::New();
3058 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3060 return MEDCoupling1SGTUMesh::New(name,type);
3063 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m)
3065 return MEDCoupling1SGTUMesh::New(m);
3068 std::string __str__() const
3070 return self->simpleRepr();
3073 std::string __repr__() const
3075 std::ostringstream oss;
3076 self->reprQuickOverview(oss);
3080 PyObject *structurizeMe(double eps=1e-12) const
3082 DataArrayInt *cellPerm(0),*nodePerm(0);
3083 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
3084 PyObject *ret(PyTuple_New(3));
3085 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
3086 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3087 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3091 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
3093 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3094 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3095 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
3098 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li)
3100 std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;
3101 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
3102 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
3107 //== MEDCoupling1SGTUMesh End
3109 //== MEDCoupling1DGTUMesh
3111 class MEDCoupling1DGTUMesh : public MEDCoupling::MEDCoupling1GTUMesh
3114 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
3115 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
3116 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex);
3117 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const;
3118 bool isPacked() const;
3121 MEDCoupling1DGTUMesh()
3123 return MEDCoupling1DGTUMesh::New();
3125 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
3127 return MEDCoupling1DGTUMesh::New(name,type);
3130 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m)
3132 return MEDCoupling1DGTUMesh::New(m);
3135 std::string __str__() const
3137 return self->simpleRepr();
3140 std::string __repr__() const
3142 std::ostringstream oss;
3143 self->reprQuickOverview(oss);
3147 DataArrayInt *getNodalConnectivityIndex() const
3149 DataArrayInt *ret=self->getNodalConnectivityIndex();
3150 if(ret) ret->incrRef();
3154 PyObject *retrievePackedNodalConnectivity() const
3156 DataArrayInt *ret1=0,*ret2=0;
3157 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
3158 PyObject *ret0Py=ret0?Py_True:Py_False;
3160 PyObject *ret=PyTuple_New(3);
3161 PyTuple_SetItem(ret,0,ret0Py);
3162 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3163 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3167 PyObject *copyWithNodalConnectivityPacked() const
3170 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
3171 PyObject *ret=PyTuple_New(2);
3172 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
3173 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
3174 PyTuple_SetItem(ret,1,ret1Py);
3178 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li)
3180 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3181 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3182 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
3185 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li)
3187 std::vector<const MEDCoupling::MEDCoupling1DGTUMesh *> tmp;
3188 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
3189 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
3192 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt)
3194 std::vector<const MEDCoupling::DataArrayInt *> tmp;
3195 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3196 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
3201 //== MEDCoupling1DGTUMeshEnd
3203 class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh
3206 int getCellIdFromPos(int i, int j, int k) const;
3207 int getNodeIdFromPos(int i, int j, int k) const;
3208 int getNumberOfCellsOfSubLevelMesh() const;
3209 int getSpaceDimensionOnNodeStruct() const;
3210 double computeSquareness() const;
3211 virtual std::vector<int> getNodeGridStructure() const;
3212 std::vector<int> getCellGridStructure() const;
3213 MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
3214 std::vector<int> getLocationFromCellId(int cellId) const;
3215 std::vector<int> getLocationFromNodeId(int cellId) const;
3216 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
3217 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
3218 static int DeduceNumberOfGivenStructure(const std::vector<int>& st);
3219 static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev);
3220 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct);
3223 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const
3225 int tmpp1=-1,tmpp2=-1;
3226 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
3227 std::vector< std::pair<int,int> > inp;
3231 for(int i=0;i<tmpp1;i++)
3232 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3237 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
3238 inp.resize(tmpp1/2);
3239 for(int i=0;i<tmpp1/2;i++)
3240 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
3243 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
3244 return self->buildStructuredSubPart(inp);
3247 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part)
3249 std::vector< std::pair<int,int> > inp;
3250 convertPyToVectorPairInt(part,inp);
3252 int szArr,sw,iTypppArr;
3253 std::vector<int> stdvecTyyppArr;
3254 const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
3255 std::vector<int> tmp5(tmp4,tmp4+szArr);
3257 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
3260 static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da)
3262 std::vector< std::pair<int,int> > inp;
3263 convertPyToVectorPairInt(part,inp);
3264 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
3267 static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da)
3269 std::vector< std::pair<int,int> > inp;
3270 convertPyToVectorPairInt(part,inp);
3271 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
3274 static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part)
3276 std::vector< std::pair<int,int> > inp;
3277 convertPyToVectorPairInt(part,inp);
3278 std::vector<int> stWithGhost;
3279 std::vector< std::pair<int,int> > partWithGhost;
3280 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
3281 PyObject *ret(PyTuple_New(2));
3282 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
3283 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
3287 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat)
3289 std::vector< std::pair<int,int> > inp;
3290 convertPyToVectorPairInt(partCompactFormat,inp);
3291 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
3294 static void AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other)
3296 std::vector< std::pair<int,int> > inp;
3297 convertPyToVectorPairInt(partCompactFormat,inp);
3298 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
3301 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part)
3303 std::vector< std::pair<int,int> > inp;
3304 convertPyToVectorPairInt(part,inp);
3305 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
3308 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li)
3310 int szArr,sw,iTypppArr;
3311 std::vector<int> stdvecTyyppArr;
3312 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3313 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
3316 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li)
3318 int szArr,sw,iTypppArr;
3319 std::vector<int> stdvecTyyppArr;
3320 const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
3321 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3324 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat)
3326 std::vector< std::pair<int,int> > inp;
3327 convertPyToVectorPairInt(partCompactFormat,inp);
3328 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3331 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims)
3333 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3334 PyObject *retPy=PyList_New(ret.size());
3335 for(std::size_t i=0;i<ret.size();i++)
3337 PyObject *tmp=PyTuple_New(2);
3338 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3339 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3340 PyList_SetItem(retPy,i,tmp);
3345 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2)
3347 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3348 convertPyToVectorPairInt(r1,r1Cpp);
3349 convertPyToVectorPairInt(r2,r2Cpp);
3350 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3351 PyObject *retPy=PyList_New(ret.size());
3352 for(std::size_t i=0;i<ret.size();i++)
3354 PyObject *tmp=PyTuple_New(2);
3355 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3356 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3357 PyList_SetItem(retPy,i,tmp);
3362 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3364 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3365 convertPyToVectorPairInt(r1,r1Cpp);
3366 convertPyToVectorPairInt(r2,r2Cpp);
3367 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3370 static PyObject *IsPartStructured(PyObject *li, PyObject *st)
3372 int szArr,sw,iTypppArr;
3373 std::vector<int> stdvecTyyppArr;
3374 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3375 int szArr2,sw2,iTypppArr2;
3376 std::vector<int> stdvecTyyppArr2;
3377 const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3378 std::vector<int> tmp3(tmp2,tmp2+szArr2);
3379 std::vector< std::pair<int,int> > partCompactFormat;
3380 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3381 PyObject *ret=PyTuple_New(2);
3382 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3383 PyTuple_SetItem(ret,0,ret0Py);
3384 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3385 for(std::size_t i=0;i<partCompactFormat.size();i++)
3387 PyObject *tmp4=PyTuple_New(2);
3388 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3389 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3390 PyList_SetItem(ret1Py,i,tmp4);
3392 PyTuple_SetItem(ret,1,ret1Py);
3396 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true)
3398 std::vector< std::pair<int,int> > param0,param1,ret;
3399 convertPyToVectorPairInt(bigInAbs,param0);
3400 convertPyToVectorPairInt(partOfBigInAbs,param1);
3401 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3402 PyObject *retPy(PyList_New(ret.size()));
3403 for(std::size_t i=0;i<ret.size();i++)
3405 PyObject *tmp(PyTuple_New(2));
3406 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3407 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3408 PyList_SetItem(retPy,i,tmp);
3413 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation)
3415 std::vector< std::pair<int,int> > param0;
3416 convertPyToVectorPairInt(part,param0);
3417 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3418 PyObject *retPy(PyList_New(ret.size()));
3419 for(std::size_t i=0;i<ret.size();i++)
3421 PyObject *tmp(PyTuple_New(2));
3422 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3423 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3424 PyList_SetItem(retPy,i,tmp);
3429 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo)
3431 std::vector< std::pair<int,int> > param0,param1;
3432 convertPyToVectorPairInt(startingFrom,param0);
3433 convertPyToVectorPairInt(goingTo,param1);
3434 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3437 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true)
3439 std::vector< std::pair<int,int> > param0,param1,ret;
3440 convertPyToVectorPairInt(bigInAbs,param0);
3441 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3442 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3443 PyObject *retPy(PyList_New(ret.size()));
3444 for(std::size_t i=0;i<ret.size();i++)
3446 PyObject *tmp(PyTuple_New(2));
3447 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3448 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3449 PyList_SetItem(retPy,i,tmp);
3456 class MEDCouplingCurveLinearMesh;
3458 //== MEDCouplingCMesh
3460 class MEDCouplingCMesh : public MEDCoupling::MEDCouplingStructuredMesh
3463 static MEDCouplingCMesh *New();
3464 static MEDCouplingCMesh *New(const std::string& meshName);
3465 void setCoords(const DataArrayDouble *coordsX,
3466 const DataArrayDouble *coordsY=0,
3467 const DataArrayDouble *coordsZ=0);
3468 void setCoordsAt(int i, const DataArrayDouble *arr);
3469 MEDCouplingCurveLinearMesh *buildCurveLinear() const;
3473 return MEDCouplingCMesh::New();
3475 MEDCouplingCMesh(const std::string& meshName)
3477 return MEDCouplingCMesh::New(meshName);
3479 std::string __str__() const
3481 return self->simpleRepr();
3483 std::string __repr__() const
3485 std::ostringstream oss;
3486 self->reprQuickOverview(oss);
3489 DataArrayDouble *getCoordsAt(int i)
3491 DataArrayDouble *ret=self->getCoordsAt(i);
3499 //== MEDCouplingCMesh End
3501 //== MEDCouplingCurveLinearMesh
3503 class MEDCouplingCurveLinearMesh : public MEDCoupling::MEDCouplingStructuredMesh
3506 static MEDCouplingCurveLinearMesh *New();
3507 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
3508 void setCoords(const DataArrayDouble *coords);
3510 MEDCouplingCurveLinearMesh()
3512 return MEDCouplingCurveLinearMesh::New();
3514 MEDCouplingCurveLinearMesh(const std::string& meshName)
3516 return MEDCouplingCurveLinearMesh::New(meshName);
3518 std::string __str__() const
3520 return self->simpleRepr();
3522 std::string __repr__() const
3524 std::ostringstream oss;
3525 self->reprQuickOverview(oss);
3528 DataArrayDouble *getCoords()
3530 DataArrayDouble *ret=self->getCoords();
3535 void setNodeGridStructure(PyObject *gridStruct)
3537 int szArr,sw,iTypppArr;
3538 std::vector<int> stdvecTyyppArr;
3539 const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3540 self->setNodeGridStructure(tmp,tmp+szArr);
3545 //== MEDCouplingCurveLinearMesh End
3547 //== MEDCouplingIMesh
3549 class MEDCouplingIMesh : public MEDCoupling::MEDCouplingStructuredMesh
3552 static MEDCouplingIMesh *New();
3554 void setSpaceDimension(int spaceDim);
3555 std::vector<int> getNodeStruct() const;
3556 std::vector<double> getOrigin() const;
3557 std::vector<double> getDXYZ() const;
3558 void setAxisUnit(const std::string& unitName);
3559 std::string getAxisUnit() const;
3560 double getMeasureOfAnyCell() const;
3561 MEDCouplingCMesh *convertToCartesian() const;
3562 void refineWithFactor(const std::vector<int>& factors);
3563 MEDCouplingIMesh *asSingleCell() const;
3564 MEDCouplingIMesh *buildWithGhost(int ghostLev) const;
3569 return MEDCouplingIMesh::New();
3571 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3573 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3574 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3575 const int *nodeStrctPtr(0);
3576 const double *originPtr(0),*dxyzPtr(0);
3578 std::vector<int> bb0;
3579 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
3582 std::vector<double> bb,bb2;
3584 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3585 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3587 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3590 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
3592 return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3595 void setNodeStruct(PyObject *nodeStrct)
3598 std::vector<int> bb0;
3599 const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
3600 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3603 void setOrigin(PyObject *origin)
3605 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3608 DataArrayDoubleTuple *aa;
3609 std::vector<double> bb;
3611 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3612 self->setOrigin(originPtr,originPtr+nbTuples);
3615 void setDXYZ(PyObject *dxyz)
3617 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3620 DataArrayDoubleTuple *aa;
3621 std::vector<double> bb;
3623 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3624 self->setDXYZ(originPtr,originPtr+nbTuples);
3627 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA)
3629 std::vector< std::pair<int,int> > inp;
3630 convertPyToVectorPairInt(fineLocInCoarse,inp);
3631 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3634 static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize)
3636 std::vector< std::pair<int,int> > inp;
3637 convertPyToVectorPairInt(fineLocInCoarse,inp);
3638 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3641 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts)
3643 std::vector< std::pair<int,int> > inp;
3644 convertPyToVectorPairInt(fineLocInCoarse,inp);
3645 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3648 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
3650 std::vector< std::pair<int,int> > inp;
3651 convertPyToVectorPairInt(fineLocInCoarse,inp);
3652 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3655 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize)
3657 std::vector< std::pair<int,int> > inp;
3658 convertPyToVectorPairInt(fineLocInCoarse,inp);
3659 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3662 std::string __str__() const
3664 return self->simpleRepr();
3666 std::string __repr__() const
3668 std::ostringstream oss;
3669 self->reprQuickOverview(oss);
3675 //== MEDCouplingIMesh End
3679 namespace MEDCoupling
3681 class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
3684 virtual void checkConsistencyLight() const;
3685 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
3686 virtual void copyTinyStringsFrom(const MEDCouplingField *other);
3687 void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
3688 void setName(const char *name);
3689 std::string getDescription() const;
3690 void setDescription(const char *desc);
3691 std::string getName() const;
3692 TypeOfField getTypeOfField() const;
3693 NatureOfField getNature() const;
3694 virtual void setNature(NatureOfField nat);
3695 DataArrayDouble *getLocalizationOfDiscr() const;
3696 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
3697 int getNumberOfTuplesExpected() const;
3698 int getNumberOfMeshPlacesExpected() const;
3699 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3700 const std::vector<double>& gsCoo, const std::vector<double>& wg);
3701 void clearGaussLocalizations();
3702 MEDCouplingGaussLocalization& getGaussLocalization(int locId);
3703 int getNbOfGaussLocalization() const;
3704 int getGaussLocalizationIdOfOneCell(int cellId) const;
3705 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
3706 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
3707 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3709 PyObject *getMesh() const
3711 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3714 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3717 PyObject *getDiscretization()
3719 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3722 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3725 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
3727 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3728 return convertIntArrToPyList3(ret);
3731 PyObject *buildSubMeshData(PyObject *li) const
3733 DataArrayInt *ret1=0;
3734 MEDCouplingMesh *ret0=0;
3736 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3737 if (!SWIG_IsOK(res1))
3740 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3741 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3745 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3747 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3748 da2->checkAllocated();
3749 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3751 PyObject *res = PyList_New(2);
3752 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3753 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3757 PyObject *buildSubMeshDataRange(int begin, int end, int step) const
3759 DataArrayInt *ret1=0;
3761 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3762 PyObject *res=PyTuple_New(2);
3763 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3765 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3768 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3769 PyTuple_SetItem(res,1,res1);
3774 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3777 int v0; std::vector<int> v1;
3778 const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
3779 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3782 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3783 const std::vector<double>& gsCoo, const std::vector<double>& wg)
3786 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3787 if (!SWIG_IsOK(res1))
3790 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3791 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3795 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3797 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3798 da2->checkAllocated();
3799 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3803 PyObject *getCellIdsHavingGaussLocalization(int locId) const
3805 std::vector<int> tmp;
3806 self->getCellIdsHavingGaussLocalization(locId,tmp);
3807 DataArrayInt *ret=DataArrayInt::New();
3808 ret->alloc((int)tmp.size(),1);
3809 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3810 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3813 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const
3815 std::vector<int> inp0;
3816 convertPyToNewIntArr4(code,1,3,inp0);
3817 std::vector<const DataArrayInt *> inp1;
3818 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
3819 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3824 class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
3827 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
3828 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
3829 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
3830 static MEDCouplingFieldTemplate *New(TypeOfField type);
3831 std::string simpleRepr() const;
3832 std::string advancedRepr() const;
3833 bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3834 bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
3837 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f)
3839 return MEDCouplingFieldTemplate::New(f);
3842 MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f)
3844 return MEDCouplingFieldTemplate::New(f);
3847 MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f)
3849 return MEDCouplingFieldTemplate::New(f);
3852 MEDCouplingFieldTemplate(TypeOfField type)
3854 return MEDCouplingFieldTemplate::New(type);
3857 std::string __str__() const
3859 return self->simpleRepr();
3862 std::string __repr__() const
3864 std::ostringstream oss;
3865 self->reprQuickOverview(oss);
3869 PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const
3872 bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
3873 PyObject *ret=PyTuple_New(2);
3874 PyObject *ret0Py=ret0?Py_True:Py_False;
3876 PyTuple_SetItem(ret,0,ret0Py);
3877 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3884 class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
3887 TypeOfTimeDiscretization getTimeDiscretization() const;
3889 MEDCouplingFieldT();
3890 ~MEDCouplingFieldT();
3893 %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
3894 %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
3895 %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
3897 class MEDCouplingFieldInt;
3898 class MEDCouplingFieldFloat;
3900 class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
3903 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3904 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3905 bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3906 bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const;
3907 void setTimeUnit(const std::string& unit);
3908 std::string getTimeUnit() const;
3909 void synchronizeTimeWithSupport();
3910 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
3911 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
3912 std::string simpleRepr() const;
3913 std::string advancedRepr() const;
3914 std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
3915 MEDCouplingFieldInt *convertToIntField() const;
3916 MEDCouplingFieldFloat *convertToFloatField() const;
3917 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3918 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3919 MEDCouplingFieldDouble *deepCopy() const;
3920 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
3921 MEDCouplingFieldDouble *nodeToCellDiscretization() const;
3922 MEDCouplingFieldDouble *cellToNodeDiscretization() const;
3923 double getIJ(int tupleId, int compoId) const;
3924 double getIJK(int cellId, int nodeIdInCell, int compoId) const;
3925 void synchronizeTimeWithMesh();
3926 void setArray(DataArrayDouble *array);
3927 void setEndArray(DataArrayDouble *array);
3928 void setTime(double val, int iteration, int order);
3929 void setStartTime(double val, int iteration, int order);
3930 void setEndTime(double val, int iteration, int order);
3931 void applyLin(double a, double b, int compoId);
3932 void applyLin(double a, double b);
3933 int getNumberOfComponents() const;
3934 int getNumberOfTuples() const;
3935 int getNumberOfValues() const;
3936 void setTimeTolerance(double val);
3937 double getTimeTolerance() const;
3938 void setIteration(int it);
3939 void setEndIteration(int it);
3940 void setOrder(int order);
3941 void setEndOrder(int order);
3942 void setTimeValue(double val);
3943 void setEndTimeValue(double val);
3944 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
3945 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
3946 bool mergeNodes(double eps, double epsOnVals=1e-15);
3947 bool mergeNodesCenter(double eps, double epsOnVals=1e-15);
3948 bool zipCoords(double epsOnVals=1e-15);
3949 bool zipConnectivity(int compType,double epsOnVals=1e-15);
3950 bool simplexize(int policy);
3951 MEDCouplingFieldDouble *doublyContractedProduct() const;
3952 MEDCouplingFieldDouble *determinant() const;
3953 MEDCouplingFieldDouble *eigenValues() const;
3954 MEDCouplingFieldDouble *eigenVectors() const;
3955 MEDCouplingFieldDouble *inverse() const;
3956 MEDCouplingFieldDouble *trace() const;
3957 MEDCouplingFieldDouble *deviator() const;
3958 MEDCouplingFieldDouble *magnitude() const;
3959 MEDCouplingFieldDouble *maxPerTuple() const;
3960 void changeNbOfComponents(int newNbOfComp, double dftValue=0.);
3961 void sortPerTuple(bool asc);
3962 MEDCouplingFieldDouble &operator=(double value);
3963 void fillFromAnalytic(int nbOfComp, const std::string& func);
3964 void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
3965 void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3966 void applyFunc(int nbOfComp, const std::string& func);
3967 void applyFuncCompo(int nbOfComp, const std::string& func);
3968 void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
3969 void applyFunc(int nbOfComp, double val);
3970 void applyFunc(const std::string& func);
3971 void applyFuncFast32(const std::string& func);
3972 void applyFuncFast64(const std::string& func);
3973 double accumulate(int compId) const;
3974 double getMaxValue() const;
3975 double getMinValue() const;
3976 double getAverageValue() const;
3977 double norm2() const;
3978 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3979 double getWeightedAverageValue(int compId, bool isWAbs) const;
3980 double integral(int compId, bool isWAbs) const;
3981 double normL1(int compId) const;
3982 double normL2(int compId) const;
3983 double normMax(int compId) const;
3984 DataArrayInt *findIdsInRange(double vmin, double vmax) const;
3985 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
3986 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3987 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3988 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3989 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const;
3990 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3991 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const;
3992 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3993 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const;
3994 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3995 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3996 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3997 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3998 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
3999 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const;
4000 MEDCouplingFieldDouble *negate() const;
4002 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
4004 return MEDCouplingFieldDouble::New(type,td);
4007 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
4009 return MEDCouplingFieldDouble::New(ft,td);
4012 std::string __str__() const
4014 return self->simpleRepr();
4017 std::string __repr__() const
4019 std::ostringstream oss;
4020 self->reprQuickOverview(oss);
4024 PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const
4027 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
4028 PyObject *ret=PyTuple_New(2);
4029 PyObject *ret0Py=ret0?Py_True:Py_False;
4031 PyTuple_SetItem(ret,0,ret0Py);
4032 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4036 MEDCouplingFieldDouble *voronoize(double eps) const
4038 MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
4042 MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const
4044 MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
4048 MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
4050 const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
4052 DataArrayDouble *a,*a2;
4053 DataArrayDoubleTuple *aa,*aa2;
4054 std::vector<double> bb,bb2;
4056 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
4057 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
4058 return self->computeVectorFieldCyl(centerPtr,vectorPtr);
4061 DataArrayDouble *getArray()
4063 DataArrayDouble *ret=self->getArray();
4069 PyObject *getArrays() const
4071 std::vector<DataArrayDouble *> arrs=self->getArrays();
4072 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
4076 PyObject *ret=PyTuple_New(sz);
4077 for(int i=0;i<sz;i++)
4080 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4082 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
4087 void setArrays(PyObject *ls)
4089 std::vector<const DataArrayDouble *> tmp;
4090 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
4092 std::vector<DataArrayDouble *> arrs(sz);
4093 for(int i=0;i<sz;i++)
4094 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
4095 self->setArrays(arrs);
4098 DataArrayDouble *getEndArray()
4100 DataArrayDouble *ret=self->getEndArray();
4106 PyObject *getValueOn(PyObject *sl) const
4110 DataArrayDoubleTuple *aa;
4111 std::vector<double> bb;
4113 const MEDCouplingMesh *mesh=self->getMesh();
4115 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4116 int spaceDim=mesh->getSpaceDimension();
4117 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4118 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4120 int sz=self->getNumberOfComponents();
4121 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4122 self->getValueOn(spaceLoc,res);
4123 return convertDblArrToPyList<double>(res,sz);
4126 PyObject *getValueOnPos(int i, int j, int k) const
4128 int sz=self->getNumberOfComponents();
4129 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4130 self->getValueOnPos(i,j,k,res);
4131 return convertDblArrToPyList<double>(res,sz);
4134 DataArrayDouble *getValueOnMulti(PyObject *locs) const
4136 const MEDCouplingMesh *mesh(self->getMesh());
4138 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
4141 double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
4142 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
4143 mesh->getSpaceDimension(),true,nbPts);
4144 return self->getValueOnMulti(inp,nbPts);
4147 PyObject *getValueOn(PyObject *sl, double time) const
4151 DataArrayDoubleTuple *aa;
4152 std::vector<double> bb;
4154 const MEDCouplingMesh *mesh=self->getMesh();
4156 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
4157 int spaceDim=mesh->getSpaceDimension();
4158 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
4159 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
4162 int sz=self->getNumberOfComponents();
4163 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
4164 self->getValueOn(spaceLoc,time,res);
4165 return convertDblArrToPyList<double>(res,sz);
4168 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
4170 if(self->getArray()!=0)
4171 MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
4174 MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
4175 MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
4176 self->setArray(arr);
4183 double tmp0=self->getTime(tmp1,tmp2);
4184 PyObject *res = PyList_New(3);
4185 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4186 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4187 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4191 PyObject *getStartTime()
4194 double tmp0=self->getStartTime(tmp1,tmp2);
4195 PyObject *res = PyList_New(3);
4196 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4197 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4198 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4202 PyObject *getEndTime()
4205 double tmp0=self->getEndTime(tmp1,tmp2);
4206 PyObject *res = PyList_New(3);
4207 PyList_SetItem(res,0,SWIG_From_double(tmp0));
4208 PyList_SetItem(res,1,SWIG_From_int(tmp1));
4209 PyList_SetItem(res,2,SWIG_From_int(tmp2));
4212 PyObject *accumulate() const
4214 int sz=self->getNumberOfComponents();
4215 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4216 self->accumulate(tmp);
4217 return convertDblArrToPyList<double>(tmp,sz);
4219 PyObject *integral(bool isWAbs) const
4221 int sz=self->getNumberOfComponents();
4222 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4223 self->integral(isWAbs,tmp);
4224 return convertDblArrToPyList<double>(tmp,sz);
4226 PyObject *getWeightedAverageValue(bool isWAbs=true) const
4228 int sz=self->getNumberOfComponents();
4229 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4230 self->getWeightedAverageValue(tmp,isWAbs);
4231 return convertDblArrToPyList<double>(tmp,sz);
4233 PyObject *normL1() const
4235 int sz=self->getNumberOfComponents();
4236 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4238 return convertDblArrToPyList<double>(tmp,sz);
4240 PyObject *normL2() const
4242 int sz=self->getNumberOfComponents();
4243 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4245 return convertDblArrToPyList<double>(tmp,sz);
4247 PyObject *normMax() const
4249 int sz=self->getNumberOfComponents();
4250 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
4252 return convertDblArrToPyList<double>(tmp,sz);
4254 void renumberCells(PyObject *li, bool check=true)
4256 int szArr,sw,iTypppArr;
4257 std::vector<int> stdvecTyyppArr;
4258 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4259 self->renumberCells(tmp,check);
4262 void renumberCellsWithoutMesh(PyObject *li, bool check=true)
4264 int szArr,sw,iTypppArr;
4265 std::vector<int> stdvecTyyppArr;
4266 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4267 self->renumberCellsWithoutMesh(tmp,check);
4270 void renumberNodes(PyObject *li, double eps=1e-15)
4272 int szArr,sw,iTypppArr;
4273 std::vector<int> stdvecTyyppArr;
4274 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4275 self->renumberNodes(tmp,eps);
4278 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15)
4280 int szArr,sw,iTypppArr;
4281 std::vector<int> stdvecTyyppArr;
4282 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4283 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
4286 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const
4288 return fieldT_buildSubPart(self,li);
4291 MEDCouplingFieldDouble *__getitem__(PyObject *li) const
4293 return fieldT__getitem__(self,li);
4296 PyObject *getMaxValue2() const
4299 double r1=self->getMaxValue2(tmp);
4300 PyObject *ret=PyTuple_New(2);
4301 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4302 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4306 PyObject *getMinValue2() const
4309 double r1=self->getMinValue2(tmp);
4310 PyObject *ret=PyTuple_New(2);
4311 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4312 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4316 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const
4318 std::vector<int> tmp;
4319 convertPyToNewIntArr3(li,tmp);
4320 return self->keepSelectedComponents(tmp);
4323 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
4325 std::vector<int> tmp;
4326 convertPyToNewIntArr3(li,tmp);
4327 self->setSelectedComponents(f,tmp);
4330 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const
4333 DataArrayDouble *a,*a2;
4334 DataArrayDoubleTuple *aa,*aa2;
4335 std::vector<double> bb,bb2;
4338 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
4339 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
4340 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4341 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4343 return self->extractSlice3D(orig,vect,eps);
4346 MEDCouplingFieldDouble *__add__(PyObject *obj)
4348 return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
4351 MEDCouplingFieldDouble *__radd__(PyObject *obj)
4353 return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
4356 MEDCouplingFieldDouble *__sub__(PyObject *obj)
4358 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.";
4359 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4362 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4364 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4366 return (*self)-(*other);
4368 throw INTERP_KERNEL::Exception(msg);
4373 DataArrayDoubleTuple *aa;
4374 std::vector<double> bb;
4376 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4381 if(!self->getArray())
4382 throw INTERP_KERNEL::Exception(msg2);
4383 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4384 ret->applyLin(1.,-val);
4385 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4386 ret2->setArray(ret);
4391 if(!self->getArray())
4392 throw INTERP_KERNEL::Exception(msg2);
4393 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4394 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4395 ret2->setArray(ret);
4400 if(!self->getArray())
4401 throw INTERP_KERNEL::Exception(msg2);
4402 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4403 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4404 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4405 ret2->setArray(ret);
4410 if(!self->getArray())
4411 throw INTERP_KERNEL::Exception(msg2);
4412 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4413 MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4414 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4415 ret2->setArray(ret);
4419 { throw INTERP_KERNEL::Exception(msg); }
4423 MEDCouplingFieldDouble *__rsub__(PyObject *obj)
4425 return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4428 MEDCouplingFieldDouble *__mul__(PyObject *obj)
4430 return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
4433 MEDCouplingFieldDouble *__rmul__(PyObject *obj)
4435 return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4438 MEDCouplingFieldDouble *__div__(PyObject *obj)
4440 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.";
4441 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4444 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4446 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4448 return (*self)/(*other);
4450 throw INTERP_KERNEL::Exception(msg);
4455 DataArrayDoubleTuple *aa;
4456 std::vector<double> bb;
4458 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4464 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4465 if(!self->getArray())
4466 throw INTERP_KERNEL::Exception(msg2);
4467 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4468 ret->applyLin(1./val,0);
4469 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4470 ret2->setArray(ret);
4475 if(!self->getArray())
4476 throw INTERP_KERNEL::Exception(msg2);
4477 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4478 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4479 ret2->setArray(ret);
4484 if(!self->getArray())
4485 throw INTERP_KERNEL::Exception(msg2);
4486 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4487 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4488 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4489 ret2->setArray(ret);
4494 if(!self->getArray())
4495 throw INTERP_KERNEL::Exception(msg2);
4496 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4497 MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4498 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4499 ret2->setArray(ret);
4503 { throw INTERP_KERNEL::Exception(msg); }
4507 MEDCouplingFieldDouble *__rdiv__(PyObject *obj)
4509 return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4512 MEDCouplingFieldDouble *__pow__(PyObject *obj)
4514 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.";
4515 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4518 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4520 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4522 return (*self)^(*other);
4524 throw INTERP_KERNEL::Exception(msg);
4529 DataArrayDoubleTuple *aa;
4530 std::vector<double> bb;
4532 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4537 if(!self->getArray())
4538 throw INTERP_KERNEL::Exception(msg2);
4539 MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
4541 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4542 ret2->setArray(ret);
4547 if(!self->getArray())
4548 throw INTERP_KERNEL::Exception(msg2);
4549 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4550 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4551 ret2->setArray(ret);
4556 if(!self->getArray())
4557 throw INTERP_KERNEL::Exception(msg2);
4558 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4559 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4560 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4561 ret2->setArray(ret);
4566 if(!self->getArray())
4567 throw INTERP_KERNEL::Exception(msg2);
4568 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4569 MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4570 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4571 ret2->setArray(ret);
4575 { throw INTERP_KERNEL::Exception(msg); }
4579 MEDCouplingFieldDouble *__neg__() const
4581 return self->negate();
4584 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
4586 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.";
4587 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4590 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4592 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4596 Py_XINCREF(trueSelf);
4600 throw INTERP_KERNEL::Exception(msg);
4605 DataArrayDoubleTuple *aa;
4606 std::vector<double> bb;
4608 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4613 if(!self->getArray())
4614 throw INTERP_KERNEL::Exception(msg2);
4615 self->getArray()->applyLin(1.,val);
4616 Py_XINCREF(trueSelf);
4621 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4624 Py_XINCREF(trueSelf);
4629 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4630 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4631 ret2->setArray(aaa);
4633 Py_XINCREF(trueSelf);
4638 if(!self->getArray())
4639 throw INTERP_KERNEL::Exception(msg2);
4640 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4641 self->getArray()->addEqual(aaa);
4642 Py_XINCREF(trueSelf);
4646 { throw INTERP_KERNEL::Exception(msg); }
4650 PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
4652 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.";
4653 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4656 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4658 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4662 Py_XINCREF(trueSelf);
4666 throw INTERP_KERNEL::Exception(msg);
4671 DataArrayDoubleTuple *aa;
4672 std::vector<double> bb;
4674 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4679 if(!self->getArray())
4680 throw INTERP_KERNEL::Exception(msg2);
4681 self->getArray()->applyLin(1.,-val);
4682 Py_XINCREF(trueSelf);
4687 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4690 Py_XINCREF(trueSelf);
4695 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4696 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4697 ret2->setArray(aaa);
4699 Py_XINCREF(trueSelf);
4704 if(!self->getArray())
4705 throw INTERP_KERNEL::Exception(msg2);
4706 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4707 self->getArray()->substractEqual(aaa);
4708 Py_XINCREF(trueSelf);
4712 { throw INTERP_KERNEL::Exception(msg); }
4716 PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
4718 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.";
4719 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4722 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4724 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4728 Py_XINCREF(trueSelf);
4732 throw INTERP_KERNEL::Exception(msg);
4737 DataArrayDoubleTuple *aa;
4738 std::vector<double> bb;
4740 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4745 if(!self->getArray())
4746 throw INTERP_KERNEL::Exception(msg2);
4747 self->getArray()->applyLin(val,0);
4748 Py_XINCREF(trueSelf);
4753 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4756 Py_XINCREF(trueSelf);
4761 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4762 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4763 ret2->setArray(aaa);
4765 Py_XINCREF(trueSelf);
4770 if(!self->getArray())
4771 throw INTERP_KERNEL::Exception(msg2);
4772 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4773 self->getArray()->multiplyEqual(aaa);
4774 Py_XINCREF(trueSelf);
4778 { throw INTERP_KERNEL::Exception(msg); }
4782 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
4784 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.";
4785 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4788 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4790 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4794 Py_XINCREF(trueSelf);
4798 throw INTERP_KERNEL::Exception(msg);
4803 DataArrayDoubleTuple *aa;
4804 std::vector<double> bb;
4806 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4812 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4813 if(!self->getArray())
4814 throw INTERP_KERNEL::Exception(msg2);
4815 self->getArray()->applyLin(1./val,0);
4816 Py_XINCREF(trueSelf);
4821 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4824 Py_XINCREF(trueSelf);
4829 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4830 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4831 ret2->setArray(aaa);
4833 Py_XINCREF(trueSelf);
4838 if(!self->getArray())
4839 throw INTERP_KERNEL::Exception(msg2);
4840 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4841 self->getArray()->divideEqual(aaa);
4842 Py_XINCREF(trueSelf);
4846 { throw INTERP_KERNEL::Exception(msg); }
4850 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
4852 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.";
4853 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4856 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
4858 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
4862 Py_XINCREF(trueSelf);
4866 throw INTERP_KERNEL::Exception(msg);
4871 DataArrayDoubleTuple *aa;
4872 std::vector<double> bb;
4874 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
4879 if(!self->getArray())
4880 throw INTERP_KERNEL::Exception(msg2);
4881 self->getArray()->applyPow(val);
4882 Py_XINCREF(trueSelf);
4887 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4890 Py_XINCREF(trueSelf);
4895 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4896 MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
4897 ret2->setArray(aaa);
4899 Py_XINCREF(trueSelf);
4904 if(!self->getArray())
4905 throw INTERP_KERNEL::Exception(msg2);
4906 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size());
4907 self->getArray()->powEqual(aaa);
4908 Py_XINCREF(trueSelf);
4912 { throw INTERP_KERNEL::Exception(msg); }
4916 static MEDCouplingFieldDouble *MergeFields(PyObject *li)
4918 std::vector<const MEDCouplingFieldDouble *> tmp;
4919 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4920 return MEDCouplingFieldDouble::MergeFields(tmp);
4923 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true)
4925 std::vector<const MEDCouplingFieldDouble *> tmp;
4926 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4927 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4930 PyObject *getTinySerializationInformation() const
4932 return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
4935 PyObject *serialize() const
4937 return field_serialize<double>(self);
4940 PyObject *__getstate__() const
4942 return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
4945 void __setstate__(PyObject *inp)
4947 field__setstate__<double>(self,inp);
4952 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4955 int getNumberOfFields() const;
4956 MEDCouplingMultiFields *deepCopy() const;
4957 virtual std::string simpleRepr() const;
4958 virtual std::string advancedRepr() const;
4959 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4960 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4961 virtual void checkConsistencyLight() const;
4964 std::string __str__() const
4966 return self->simpleRepr();
4968 static MEDCouplingMultiFields *New(PyObject *li)
4970 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4971 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4973 std::vector<MEDCouplingFieldDouble *> fs(sz);
4974 for(int i=0;i<sz;i++)
4975 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4976 return MEDCouplingMultiFields::New(fs);
4978 MEDCouplingMultiFields(PyObject *li)
4980 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
4981 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4983 std::vector<MEDCouplingFieldDouble *> fs(sz);
4984 for(int i=0;i<sz;i++)
4985 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4986 return MEDCouplingMultiFields::New(fs);
4988 PyObject *getFields() const
4990 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4991 int sz=fields.size();
4992 PyObject *res = PyList_New(sz);
4993 for(int i=0;i<sz;i++)
4997 fields[i]->incrRef();
4998 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
5002 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
5007 PyObject *getFieldAtPos(int id) const
5009 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
5013 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
5016 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
5018 PyObject *getMeshes() const
5020 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
5022 PyObject *res = PyList_New(sz);
5023 for(int i=0;i<sz;i++)
5028 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5032 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5037 PyObject *getDifferentMeshes() const
5039 std::vector<int> refs;
5040 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
5042 PyObject *res = PyList_New(sz);
5043 for(int i=0;i<sz;i++)
5048 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
5052 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
5056 PyObject *ret=PyTuple_New(2);
5057 PyTuple_SetItem(ret,0,res);
5058 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
5061 PyObject *getArrays() const
5063 std::vector<DataArrayDouble *> ms=self->getArrays();
5065 PyObject *res = PyList_New(sz);
5066 for(int i=0;i<sz;i++)
5071 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5075 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5080 PyObject *getDifferentArrays() const
5082 std::vector< std::vector<int> > refs;
5083 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
5085 PyObject *res = PyList_New(sz);
5086 PyObject *res2 = PyList_New(sz);
5087 for(int i=0;i<sz;i++)
5092 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5096 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 ));
5098 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
5101 PyObject *ret=PyTuple_New(2);
5102 PyTuple_SetItem(ret,0,res);
5103 PyTuple_SetItem(ret,1,res2);
5109 class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
5112 static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5113 static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5114 bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5115 bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const;
5116 void setTimeUnit(const std::string& unit);
5117 std::string getTimeUnit() const;
5118 void setTime(double val, int iteration, int order);
5119 void setArray(DataArrayInt *array);
5120 MEDCouplingFieldInt *deepCopy() const;
5121 MEDCouplingFieldInt *clone(bool recDeepCpy) const;
5122 MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const;
5123 MEDCouplingFieldDouble *convertToDblField() const;
5124 MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const;
5126 MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5128 return MEDCouplingFieldInt::New(type,td);
5131 MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5133 return MEDCouplingFieldInt::New(ft,td);
5136 PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const
5139 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5140 PyObject *ret=PyTuple_New(2);
5141 PyObject *ret0Py=ret0?Py_True:Py_False;
5143 PyTuple_SetItem(ret,0,ret0Py);
5144 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5148 std::string __str__() const
5150 return self->simpleRepr();
5153 std::string __repr__() const
5155 std::ostringstream oss;
5156 self->reprQuickOverview(oss);
5160 MEDCouplingFieldInt *buildSubPart(PyObject *li) const
5162 return fieldT_buildSubPart(self,li);
5165 MEDCouplingFieldInt *__getitem__(PyObject *li) const
5167 return fieldT__getitem__(self,li);
5170 DataArrayInt *getArray()
5172 DataArrayInt *ret=self->getArray();
5181 double tmp0=self->getTime(tmp1,tmp2);
5182 PyObject *res = PyList_New(3);
5183 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5184 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5185 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5189 PyObject *getTinySerializationInformation() const
5191 return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
5194 PyObject *serialize() const
5196 return field_serialize<int>(self);
5199 PyObject *__getstate__() const
5201 return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
5204 void __setstate__(PyObject *inp)
5206 field__setstate__<int>(self,inp);
5211 class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
5214 static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
5215 static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
5216 bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5217 bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const;
5218 void setTimeUnit(const std::string& unit);
5219 std::string getTimeUnit() const;
5220 void setTime(double val, int iteration, int order);
5221 void setArray(DataArrayFloat *array);
5222 MEDCouplingFieldFloat *deepCopy() const;
5223 MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
5224 MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const;
5225 MEDCouplingFieldDouble *convertToDblField() const;
5226 MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const;
5228 MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
5230 return MEDCouplingFieldFloat::New(type,td);
5233 MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
5235 return MEDCouplingFieldFloat::New(ft,td);
5238 PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const
5241 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
5242 PyObject *ret=PyTuple_New(2);
5243 PyObject *ret0Py=ret0?Py_True:Py_False;
5245 PyTuple_SetItem(ret,0,ret0Py);
5246 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5250 std::string __str__() const
5252 return self->simpleRepr();
5255 std::string __repr__() const
5257 std::ostringstream oss;
5258 self->reprQuickOverview(oss);
5262 MEDCouplingFieldFloat *buildSubPart(PyObject *li) const
5264 return fieldT_buildSubPart(self,li);
5267 MEDCouplingFieldFloat *__getitem__(PyObject *li) const
5269 return fieldT__getitem__(self,li);
5272 DataArrayFloat *getArray()
5274 DataArrayFloat *ret=self->getArray();
5283 double tmp0=self->getTime(tmp1,tmp2);
5284 PyObject *res = PyList_New(3);
5285 PyList_SetItem(res,0,SWIG_From_double(tmp0));
5286 PyList_SetItem(res,1,SWIG_From_int(tmp1));
5287 PyList_SetItem(res,2,SWIG_From_int(tmp2));
5291 PyObject *getTinySerializationInformation() const
5293 return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
5296 PyObject *serialize() const
5298 return field_serialize<float>(self);
5301 PyObject *__getstate__() const
5303 return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
5306 void __setstate__(PyObject *inp)
5308 field__setstate__<float>(self,inp);
5313 class MEDCouplingDefinitionTime
5316 MEDCouplingDefinitionTime();
5317 void assign(const MEDCouplingDefinitionTime& other);
5318 bool isEqual(const MEDCouplingDefinitionTime& other) const;
5319 double getTimeResolution() const;
5320 std::vector<double> getHotSpotsTime() const;
5323 std::string __str__() const
5325 std::ostringstream oss;
5326 self->appendRepr(oss);
5330 PyObject *getIdsOnTimeRight(double tm) const
5332 int meshId,arrId,arrIdInField,fieldId;
5333 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
5334 PyObject *res=PyList_New(4);
5335 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5336 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5337 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5338 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5342 PyObject *getIdsOnTimeLeft(double tm) const
5344 int meshId,arrId,arrIdInField,fieldId;
5345 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
5346 PyObject *res=PyList_New(4);
5347 PyList_SetItem(res,0,PyInt_FromLong(meshId));
5348 PyList_SetItem(res,1,PyInt_FromLong(arrId));
5349 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
5350 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
5356 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
5359 double getTimeTolerance() const;
5360 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
5364 MEDCouplingFieldOverTime(PyObject *li)
5366 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5367 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5369 std::vector<MEDCouplingFieldDouble *> fs(sz);
5370 for(int i=0;i<sz;i++)
5371 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5372 return MEDCouplingFieldOverTime::New(fs);
5374 std::string __str__() const
5376 return self->simpleRepr();
5378 static MEDCouplingFieldOverTime *New(PyObject *li)
5380 std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
5381 convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
5383 std::vector<MEDCouplingFieldDouble *> fs(sz);
5384 for(int i=0;i<sz;i++)
5385 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
5386 return MEDCouplingFieldOverTime::New(fs);
5391 class MEDCouplingCartesianAMRMesh;
5393 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
5396 int getNumberOfCellsRecursiveWithOverlap() const;
5397 int getNumberOfCellsRecursiveWithoutOverlap() const;
5398 int getMaxNumberOfLevelsRelativeToThis() const;
5401 MEDCouplingCartesianAMRMeshGen *getMesh() const
5403 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5411 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
5414 int getNumberOfOverlapedCellsForFather() const;
5415 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const;
5416 std::vector<int> computeCellGridSt() const;
5419 PyObject *getBLTRRange() const
5421 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
5422 return convertFromVectorPairInt(ret);
5425 PyObject *getBLTRRangeRelativeToGF() const
5427 std::vector< std::pair<int,int> > ret(self->getBLTRRangeRelativeToGF());
5428 return convertFromVectorPairInt(ret);
5431 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
5433 std::vector< std::pair<int,int> > inp;
5434 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5435 self->addPatch(inp,factors);
5438 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
5440 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5442 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
5443 if(patchId==mesh->getNumberOfPatches())
5445 std::ostringstream oss;
5446 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
5447 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5450 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
5456 void __delitem__(int patchId)
5458 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
5460 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
5461 mesh->removePatch(patchId);
5466 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
5468 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
5469 return mesh->getNumberOfPatches();
5474 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
5478 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
5481 int getAbsoluteLevel() const;
5482 int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5483 std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
5484 int getSpaceDimension() const;
5485 const std::vector<int>& getFactors() const;
5486 void setFactors(const std::vector<int>& newFactors);
5487 int getMaxNumberOfLevelsRelativeToThis() const;
5488 int getNumberOfCellsAtCurrentLevel() const;
5489 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const;
5490 int getNumberOfCellsRecursiveWithOverlap() const;
5491 int getNumberOfCellsRecursiveWithoutOverlap() const;
5492 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const;
5493 virtual void detachFromFather();
5495 int getNumberOfPatches() const;
5496 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const;
5497 MEDCouplingUMesh *buildUnstructured() const;
5498 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const;
5499 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const;
5500 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const;
5501 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const;
5502 void removeAllPatches();
5503 void removePatch(int patchId);
5504 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors);
5505 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps);
5506 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const;
5507 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const;
5508 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const;
5509 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const;
5510 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
5511 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const;
5512 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const;
5513 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const;
5514 std::string buildPythonDumpOfThis() const;
5517 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors)
5519 std::vector< std::pair<int,int> > inp;
5520 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5521 self->addPatch(inp,factors);
5524 PyObject *getPatches() const
5526 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5528 PyObject *ret = PyList_New(sz);
5529 for(int i=0;i<sz;i++)
5531 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5534 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5539 // agy : don't know why typemap fails here ??? let it in the extend section
5540 PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
5542 return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 );
5545 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const
5547 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5548 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5554 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const
5556 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5557 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5563 virtual PyObject *positionRelativeToGodFather() const
5565 std::vector<int> out1;
5566 std::vector< std::pair<int,int> > out0(self->positionRelativeToGodFather(out1));
5567 PyObject *ret(PyTuple_New(2));
5568 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5569 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5573 virtual PyObject *retrieveGridsAt(int absoluteLev) const
5575 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5577 PyObject *ret = PyList_New(sz);
5578 for(int i=0;i<sz;i++)
5579 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5583 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
5585 std::vector<const DataArrayDouble *> inp;
5586 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp);
5587 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5590 virtual MEDCouplingCartesianAMRMeshGen *getFather() const
5592 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5598 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const
5600 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5606 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const
5608 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5614 MEDCouplingIMesh *getImageMesh() const
5616 const MEDCouplingIMesh *ret(self->getImageMesh());
5619 return const_cast<MEDCouplingIMesh *>(ret);
5622 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const
5624 if(patchId==self->getNumberOfPatches())
5626 std::ostringstream oss;
5627 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5628 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5631 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5637 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const
5639 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5640 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5641 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5644 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5646 std::vector<const MEDCoupling::DataArrayDouble *> arrsOnPatches2;
5647 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5648 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5651 void __delitem__(int patchId)
5653 self->removePatch(patchId);
5658 return self->getNumberOfPatches();
5663 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5667 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5670 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
5673 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5675 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5676 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5677 const int *nodeStrctPtr(0);
5678 const double *originPtr(0),*dxyzPtr(0);
5680 std::vector<int> bb0;
5681 nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
5684 std::vector<double> bb,bb2;
5686 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5687 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5689 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5692 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps)
5694 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5695 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5696 std::vector< std::vector<int> > inp2;
5697 convertPyToVectorOfVectorOfInt(factors,inp2);
5698 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5701 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
5703 return MEDCoupling_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5706 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh)
5708 return MEDCouplingCartesianAMRMesh::New(mesh);
5713 class MEDCouplingDataForGodFather : public RefCountObject
5716 virtual void synchronizeFineToCoarse();
5717 virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev);
5718 virtual void synchronizeCoarseToFine();
5719 virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev);
5720 virtual void synchronizeAllGhostZones();
5721 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
5722 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level);
5723 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level);
5724 virtual void alloc();
5725 virtual void dealloc();
5728 MEDCouplingCartesianAMRMesh *getMyGodFather()
5730 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5738 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5741 int getNumberOfLevels() const;
5742 MEDCouplingAMRAttribute *deepCopy() const;
5743 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
5744 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5745 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5746 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
5747 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
5748 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
5749 std::string writeVTHB(const std::string& fileName) const;
5752 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
5754 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5755 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5756 MEDCouplingAMRAttribute *ret(0);
5759 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5760 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5762 catch(INTERP_KERNEL::Exception&)
5764 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5765 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5770 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev)
5772 return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5775 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
5777 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5778 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5784 void spillInfoOnComponents(PyObject *compNames)
5786 std::vector< std::vector<std::string> > compNamesCpp;
5787 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5788 self->spillInfoOnComponents(compNamesCpp);
5791 void spillNatures(PyObject *nfs)
5793 std::vector<int> inp0;
5794 if(!fillIntVector(nfs,inp0))
5795 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5796 std::size_t sz(inp0.size());
5797 std::vector<NatureOfField> inp00(sz);
5798 for(std::size_t i=0;i<sz;i++)
5799 inp00[i]=(NatureOfField)inp0[i];
5800 self->spillNatures(inp00);
5803 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
5805 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5806 int sz((int)ret.size());
5807 PyObject *retPy(PyList_New(sz));
5808 for(int i=0;i<sz;i++)
5809 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5815 class DenseMatrix : public RefCountObject, public TimeLabel
5818 static DenseMatrix *New(int nbRows, int nbCols);
5819 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols);
5820 DenseMatrix *deepCopy() const;
5821 DenseMatrix *shallowCpy() const;
5823 int getNumberOfRows() const;
5824 int getNumberOfCols() const;
5825 int getNbOfElems() const;
5826 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1);
5827 void reShape(int nbRows, int nbCols);
5830 bool isEqual(const DenseMatrix& other, double eps) const;
5831 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const;
5832 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec);
5835 DenseMatrix(int nbRows, int nbCols)
5837 return DenseMatrix::New(nbRows,nbCols);
5840 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols)
5842 return DenseMatrix::New(array,nbRows,nbCols);
5845 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const
5848 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5849 PyObject *ret=PyTuple_New(2);
5850 PyObject *ret0Py=ret0?Py_True:Py_False;
5852 PyTuple_SetItem(ret,0,ret0Py);
5853 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5857 DataArrayDouble *getData()
5859 DataArrayDouble *ret(self->getData());
5865 DenseMatrix *__add__(const DenseMatrix *other)
5867 return MEDCoupling::DenseMatrix::Add(self,other);
5870 DenseMatrix *__sub__(const DenseMatrix *other)
5872 return MEDCoupling::DenseMatrix::Substract(self,other);
5875 DenseMatrix *__mul__(const DenseMatrix *other)
5877 return MEDCoupling::DenseMatrix::Multiply(self,other);
5880 DenseMatrix *__mul__(const DataArrayDouble *other)
5882 return MEDCoupling::DenseMatrix::Multiply(self,other);
5885 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other)
5887 self->addEqual(other);
5888 Py_XINCREF(trueSelf);
5892 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other)
5894 self->substractEqual(other);
5895 Py_XINCREF(trueSelf);
5899 PyObject *toNumPyMatrix() // not const. It is not a bug !
5901 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5910 def MEDCouplingUMeshReduce(self):
5911 return MEDCouplingStdReduceFunct,(MEDCouplingUMesh,((),(self.__getstate__()),))
5912 def MEDCouplingCMeshReduce(self):
5913 return MEDCouplingStdReduceFunct,(MEDCouplingCMesh,((),(self.__getstate__()),))
5914 def MEDCouplingIMeshReduce(self):
5915 return MEDCouplingStdReduceFunct,(MEDCouplingIMesh,((),(self.__getstate__()),))
5916 def MEDCouplingMappedExtrudedMeshReduce(self):
5917 return MEDCouplingStdReduceFunct,(MEDCouplingMappedExtrudedMesh,((),(self.__getstate__()),))
5918 def MEDCouplingCurveLinearMeshReduce(self):
5919 return MEDCouplingStdReduceFunct,(MEDCouplingCurveLinearMesh,((),(self.__getstate__()),))
5920 def MEDCoupling1SGTUMeshReduce(self):
5921 return MEDCouplingStdReduceFunct,(MEDCoupling1SGTUMesh,((),(self.__getstate__()),))
5922 def MEDCoupling1DGTUMeshReduce(self):
5923 return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
5924 def MEDCouplingFieldDoubleReduce(self):
5925 self.checkConsistencyLight()
5926 d=(self.getTypeOfField(),self.getTimeDiscretization())
5927 return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
5928 def MEDCouplingFieldIntReduce(self):
5929 self.checkConsistencyLight()
5930 d=(self.getTypeOfField(),self.getTimeDiscretization())
5931 return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
5932 def MEDCouplingFieldFloatReduce(self):
5933 self.checkConsistencyLight()
5934 d=(self.getTypeOfField(),self.getTimeDiscretization())
5935 return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
5938 # Forwarding DataArrayInt functions to MEDCouplingUMesh:
5940 MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays
5941 MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice
5942 MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays
5943 ##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice
5944 MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx
5945 MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays
5946 ##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice
5952 __filename=os.environ.get('PYTHONSTARTUP')
5953 if __filename and os.path.isfile(__filename):
5954 exec(open(__filename).read())